From 55f5458e18ebb745abd917b2cca27385b2c02bd3 Mon Sep 17 00:00:00 2001 From: "Yang You(UU)" Date: Tue, 12 Jul 2022 10:57:06 -0700 Subject: [network\wlan\wdi] Move Project to be Windows Driver Compliance ready (#752) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Running the ApiValidator and make sure the issue free. 2. Running the InfVerif and make sure the INF file issue free. There is limitations for MSFT currently doesn’t have any SDIO based WI-FI NICs, so the latest Driver Verifier /RC 33 36 tests not run --- network/wlan/WDI/COMMON/common.vcxproj | 12 +- network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj | 15 +- .../wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj | 12 +- .../WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf | 291 ++++----------------- 4 files changed, 71 insertions(+), 259 deletions(-) diff --git a/network/wlan/WDI/COMMON/common.vcxproj b/network/wlan/WDI/COMMON/common.vcxproj index 339f1c94..3de209fa 100644 --- a/network/wlan/WDI/COMMON/common.vcxproj +++ b/network/wlan/WDI/COMMON/common.vcxproj @@ -50,20 +50,20 @@ Windows10 True - Universal + Windows Driver Windows10 False - Universal + Windows Driver True - Universal + Windows Driver Win8 @@ -72,17 +72,17 @@ Windows10 False - Universal + Windows Driver Windows10 True - Universal + Windows Driver Windows10 False - Universal + Windows Driver DbgengKernelDebugger diff --git a/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj b/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj index 963ab013..057df090 100644 --- a/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj +++ b/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj @@ -132,7 +132,7 @@ True - Universal + Windows Driver true @@ -147,7 +147,7 @@ False - Universal + Windows Driver @@ -162,7 +162,7 @@ Windows10 True - Universal + Windows Driver @@ -185,7 +185,7 @@ Windows10 False - Universal + Windows Driver true @@ -207,7 +207,7 @@ Windows10 True - Universal + Windows Driver true @@ -229,7 +229,7 @@ Windows10 False - Universal + Windows Driver true @@ -878,6 +878,9 @@ + + + \ No newline at end of file diff --git a/network/wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj b/network/wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj index 112e7ea9..ec170811 100644 --- a/network/wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj +++ b/network/wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj @@ -135,7 +135,7 @@ Windows10 True - Universal + Windows Driver Win8 @@ -148,7 +148,7 @@ Windows10 False - Universal + Windows Driver Win8 @@ -161,7 +161,7 @@ Windows10 True - Universal + Windows Driver Win8 @@ -182,7 +182,7 @@ Windows10 False - Universal + Windows Driver Win8 @@ -203,7 +203,7 @@ Windows10 True - Universal + Windows Driver Win8 @@ -224,7 +224,7 @@ Windows10 False - Universal + Windows Driver Win8 diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf index 8343a003..181700f1 100644 --- a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf +++ b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf @@ -14,6 +14,7 @@ Signature = "$Windows NT$" Class = Net ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} Provider = %Realtek% +PnpLockdown = 1 CatalogFile.NT = netrtwlans.cat ;; for WHQL certified DriverVer = 11/23/2015,3008.22.1030.2015 @@ -71,35 +72,6 @@ ExcludeFromSelect = * ;; For 8723D RTK common ================================================================ %RTL8723ds.DeviceDesc% = RTL8723ds.ndi, SD\VID_024C&PID_D723 -;;---------------------------------------------------------------------------- -;; Realtek 8723as default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8723as.ndi.NT] -AddReg = NDIS_64.reg, RTL8723as.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8723as.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8723as.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - ;;---------------------------------------------------------------------------- ;; Realtek 8723bs default installation ;;---------------------------------------------------------------------------- @@ -114,19 +86,20 @@ Include = netvwifibus.inf Needs = VWiFiBus.CopyFiles Characteristics = 0x84 BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. CopyFiles = RTWlanS.CopyFiles *IfType = 71 ; IF_TYPE_IEEE80211 *MediaType = 16 ; NdisMediumNative802_11 *PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 [RTL8723bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog Include = netvwifibus.inf Needs = VWiFiBus.Services [RTL8723bs.ndi.NT.HW] Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration +Needs = VWiFiBus.PnPFilterRegistration.HW ;;---------------------------------------------------------------------------- ;; Acer 8723bs installation ;;---------------------------------------------------------------------------- @@ -141,19 +114,20 @@ Include = netvwifibus.inf Needs = VWiFiBus.CopyFiles Characteristics = 0x84 BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. CopyFiles = RTWlanS.CopyFiles *IfType = 71 ; IF_TYPE_IEEE80211 *MediaType = 16 ; NdisMediumNative802_11 *PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 [ACER8723bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog Include = netvwifibus.inf Needs = VWiFiBus.Services [ACER8723bs.ndi.NT.HW] Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration +Needs = VWiFiBus.PnPFilterRegistration.HW ;;---------------------------------------------------------------------------- ;; HP 8723bs installation ;;---------------------------------------------------------------------------- @@ -168,19 +142,20 @@ Include = netvwifibus.inf Needs = VWiFiBus.CopyFiles Characteristics = 0x84 BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. CopyFiles = RTWlanS.CopyFiles *IfType = 71 ; IF_TYPE_IEEE80211 *MediaType = 16 ; NdisMediumNative802_11 *PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 [HP8723bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog Include = netvwifibus.inf Needs = VWiFiBus.Services [HP8723bs.ndi.NT.HW] Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration +Needs = VWiFiBus.PnPFilterRegistration.HW ;;---------------------------------------------------------------------------- @@ -197,19 +172,20 @@ Include = netvwifibus.inf Needs = VWiFiBus.CopyFiles Characteristics = 0x84 BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. CopyFiles = RTWlanS.CopyFiles *IfType = 71 ; IF_TYPE_IEEE80211 *MediaType = 16 ; NdisMediumNative802_11 *PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 [RSVD8723bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog Include = netvwifibus.inf Needs = VWiFiBus.Services [RSVD8723bs.ndi.NT.HW] Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration +Needs = VWiFiBus.PnPFilterRegistration.HW ;;---------------------------------------------------------------------------- @@ -226,19 +202,20 @@ Include = netvwifibus.inf Needs = VWiFiBus.CopyFiles Characteristics = 0x84 BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. CopyFiles = RTWlanS.CopyFiles *IfType = 71 ; IF_TYPE_IEEE80211 *MediaType = 16 ; NdisMediumNative802_11 *PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 [RTL8188es.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog Include = netvwifibus.inf Needs = VWiFiBus.Services [RTL8188es.ndi.NT.HW] Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration +Needs = VWiFiBus.PnPFilterRegistration.HW ;;---------------------------------------------------------------------------- @@ -255,19 +232,20 @@ Include = netvwifibus.inf Needs = VWiFiBus.CopyFiles Characteristics = 0x84 BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. CopyFiles = RTWlanS.CopyFiles *IfType = 71 ; IF_TYPE_IEEE80211 *MediaType = 16 ; NdisMediumNative802_11 *PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 [RTL8821as.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog Include = netvwifibus.inf Needs = VWiFiBus.Services [RTL8821as.ndi.NT.HW] Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration +Needs = VWiFiBus.PnPFilterRegistration.HW ;;---------------------------------------------------------------------------- @@ -284,19 +262,20 @@ Include = netvwifibus.inf Needs = VWiFiBus.CopyFiles Characteristics = 0x84 BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. CopyFiles = RTWlanS.CopyFiles *IfType = 71 ; IF_TYPE_IEEE80211 *MediaType = 16 ; NdisMediumNative802_11 *PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 [RTL8814as.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog Include = netvwifibus.inf Needs = VWiFiBus.Services [RTL8814as.ndi.NT.HW] Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration +Needs = VWiFiBus.PnPFilterRegistration.HW ;;---------------------------------------------------------------------------- @@ -313,19 +292,20 @@ Include = netvwifibus.inf Needs = VWiFiBus.CopyFiles Characteristics = 0x84 BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. CopyFiles = RTWlanS.CopyFiles *IfType = 71 ; IF_TYPE_IEEE80211 *MediaType = 16 ; NdisMediumNative802_11 *PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 [RTL8192es.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog Include = netvwifibus.inf Needs = VWiFiBus.Services [RTL8192es.ndi.NT.HW] Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration +Needs = VWiFiBus.PnPFilterRegistration.HW ;;---------------------------------------------------------------------------- @@ -342,19 +322,20 @@ Include = netvwifibus.inf Needs = VWiFiBus.CopyFiles Characteristics = 0x84 BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. CopyFiles = RTWlanS.CopyFiles *IfType = 71 ; IF_TYPE_IEEE80211 *MediaType = 16 ; NdisMediumNative802_11 *PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 [RTL8703bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog Include = netvwifibus.inf Needs = VWiFiBus.Services [RTL8703bs.ndi.NT.HW] Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration +Needs = VWiFiBus.PnPFilterRegistration.HW ;;---------------------------------------------------------------------------- @@ -371,19 +352,20 @@ Include = netvwifibus.inf Needs = VWiFiBus.CopyFiles Characteristics = 0x84 BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. CopyFiles = RTWlanS.CopyFiles *IfType = 71 ; IF_TYPE_IEEE80211 *MediaType = 16 ; NdisMediumNative802_11 *PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 [RTL8188fs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog Include = netvwifibus.inf Needs = VWiFiBus.Services [RTL8188fs.ndi.NT.HW] Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration +Needs = VWiFiBus.PnPFilterRegistration.HW ;;---------------------------------------------------------------------------- ;; Realtek 8822bs default installation @@ -399,19 +381,20 @@ Include = netvwifibus.inf Needs = VWiFiBus.CopyFiles Characteristics = 0x84 BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. CopyFiles = RTWlanS.CopyFiles *IfType = 71 ; IF_TYPE_IEEE80211 *MediaType = 16 ; NdisMediumNative802_11 *PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 [RTL8822bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog Include = netvwifibus.inf Needs = VWiFiBus.Services [RTL8822bs.ndi.NT.HW] Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration +Needs = VWiFiBus.PnPFilterRegistratio.HW ;;---------------------------------------------------------------------------- @@ -428,19 +411,20 @@ Include = netvwifibus.inf Needs = VWiFiBus.CopyFiles Characteristics = 0x84 BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; TODO: IF IHV provided the Rtlihvs.dll. CopyFiles = RTWlanS.CopyFiles *IfType = 71 ; IF_TYPE_IEEE80211 *MediaType = 16 ; NdisMediumNative802_11 *PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 [RTL8723ds.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog Include = netvwifibus.inf Needs = VWiFiBus.Services [RTL8723ds.ndi.NT.HW] Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration +Needs = VWiFiBus.PnPFilterRegistration.HW ;;---------------------------------------------------------------------------- ;; OS relative registry. @@ -457,7 +441,7 @@ DisplayName = %RtlWlans.DeviceDesc.DispName% ServiceType = 1 ; %SERVICE_KERNEL_DRIVER% StartType = 3 ; %SERRVICE_DEMAND_START% ErrorControl = 1 ; %SERRVICE_ERROR_NORMAL% -ServiceBinary = %12%\rtwlans.sys +ServiceBinary = %13%\rtwlans.sys LoadOrderGroup = NDIS ;; @@ -471,34 +455,11 @@ HKR, , EventMessageFile, 0x00020000, "%%SystemRoot%%\System32\netevent.dll" HKR, , TypesSupported , 0x00010001, 7 [CIHVS.reg] -HKR, Ndi\IHVExtensions, ExtensibilityDLL, 0, "%SystemRoot%\system32\Rtlihvs.dll" +HKR, Ndi\IHVExtensions, ExtensibilityDLL, 0, "%13%\Rtlihvs.dll" HKR, Ndi\IHVExtensions, UIExtensibilityCLSID, 0, "{6C2A8CCA-B2A2-4d81-A3B2-4E15F445C312}" HKR, Ndi\IHVExtensions, GroupName, 0, "Realtek CCX SDK IHV Service" HKR, Ndi\IHVExtensions, AdapterOUI, 0x00010001, 0x00e04c -;******************************************************************************* -; WAPI section -;******************************************************************************* -[wapi.reg] -HKR,defaults,WapiSupport,0,"1" -HKR,,WapiSupport,0,"1" - -;******************************************************************************* -; RTL8723as common paramters -;******************************************************************************* -[RTL8723as.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - ;******************************************************************************* ; RTL8723bs common paramters @@ -606,33 +567,6 @@ HKR,,RomDLFwEnable,0,"1" HKR,defaults,bFwCtrlPwrOff,0,"1" HKR,,bFwCtrlPwrOff,0,"1" - -;******************************************************************************* -; RTL8188Fs common paramters -;******************************************************************************* -[RTL8188fs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,RomDLFwEnable,0,"0" -HKR,,RomDLFwEnable,0,"0" - -HKR,defaults,bFwCtrlPwrOff,0,"1" -HKR,,bFwCtrlPwrOff,0,"1" - - ;******************************************************************************* ; RTL8821as common paramters ;******************************************************************************* @@ -849,22 +783,6 @@ HKR,Ndi\params\AntDiv, type, 0, "enum" HKR,Ndi\params\AntDiv\enum, "0", 0, %DISABLED_STR% HKR,Ndi\params\AntDiv\enum, "1", 0, %ENABLED_STR% -HKLM, SYSTEM\CurrentControlSet\Services\RtlWlans\Parameters, "BtAntennaInHw", 0x00010001,2 - -[Ndis5Set.reg] -HKR,Ndi\params\PSPXlinkMode, ParamDesc, 0, %PSP_XLINK_STR% -HKR,Ndi\params\PSPXlinkMode, type, 0, "enum" -HKR,Ndi\params\PSPXlinkMode, default, 0, "0" -HKR,Ndi\params\PSPXlinkMode\enum, "0", 0, %DISABLE_STR% -HKR,Ndi\params\PSPXlinkMode\enum, "1", 0, %ENABLE_STR% -HKR,defaults,PSPXlinkMode,0,"0" -HKR,,PSPXlinkMode,0,"0" - -;Inactive Power Save -HKR,defaults,InactivePs,0,"0" -HKR,,InactivePs,0,"0" - - [Ndis6Set.reg] ;Inactive Power Save HKR,defaults,InactivePs,0,"2" @@ -896,19 +814,6 @@ HKR,,BWSetting,,"1" HKR,,Channel,0,"10" -[11gWirelessMode.reg] -HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% -HKR,Ndi\params\WirelessMode, type, 0, "enum" -HKR,Ndi\params\WirelessMode, default, 0, "8" -HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% -HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% -HKR,defaults,WirelessMode, 0, "4" -HKR,,WirelessMode, 0, "4" - -HKR,,BWSetting,0,"0" - -HKR,,Channel,0,"10" - [11acWirelessMode.reg] HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% HKR,Ndi\params\WirelessMode, type, 0, "enum" @@ -937,101 +842,22 @@ HKR,,BWSetting,0,"2" ;;---------------------------------------------------------------------------- [32kEnable.reg] HKR,,bLowPowerEnable,0,"1" -[32kDisable.reg] -HKR,,bLowPowerEnable,0,"0" ;------------------------------------------------------------------------------- ; PnP pre-transition handling ;------------------------------------------------------------------------------- [PnpPreTransOn.reg] HKR,,PreTransPnP,0,"1" -[PnpPreTransOff.reg] -HKR,,PreTransPnP,0,"0" ;;---------------------------------------------------------------------------- ;; WOWLAN Control Parameters ;;---------------------------------------------------------------------------- -[WowlanAllEnable.reg] -HKR,,WoWLANLPSLevel,0,"2" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"1" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "1" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"1" [WowlanDisable.reg] HKR,,WoWLANLPSLevel,0,"0" HKR,,ARPOffloadEnable,0,"0" HKR,,GTKOffloadEnable,0,"0" -[WowlanAllEnableNoLPS.reg] -HKR,,WoWLANLPSLevel,0,"0" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"1" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "1" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"1" - -[WowlanEnableNoPatternMatch.reg] -HKR,,WoWLANLPSLevel,0,"2" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"1" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "0" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"0" - -[WowlanEnableNoLPSNoPatternMatch.reg] -HKR,,WoWLANLPSLevel,0,"0" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"1" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "0" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"0" - [ConnectedStandbyEnable.reg] HKR,,WoWLANLPSLevel,0,"2" HKR,,ARPOffloadEnable,0,"1" @@ -1063,18 +889,12 @@ HKR,,*PacketCoalescing,0,"0" ;------------------------------------------------------------------------------- [AutoChnlSelon.reg] HKR,,AutoChnlSel,0,"1" -[AutoChnlSeloff.reg] -HKR,,AutoChnlSel,0,"0" ;;---------------------------------------------------------------------------- ;; RSSI to Grid Mode Parameters ;;---------------------------------------------------------------------------- -[RSSI2GridRealMode.reg] -HKR,,RSSI2GridMode,0,"1" [RSSI2GridMode_2.reg] HKR,,RSSI2GridMode,0,"2" -[RSSI2GridMode_4.reg] -HKR,,RSSI2GridMode,0,"4" ;;---------------------------------------------------------------------------- ;; KFREE parameters @@ -1082,13 +902,6 @@ HKR,,RSSI2GridMode,0,"4" [KFREE_COMMON.reg] HKR,,RfKFreeEnable,0,"0" -;******************************************************************************* -; Customer reg section -;******************************************************************************* -[ScanType.reg] -HKR,defaults,PassiveScan, 0, "0" -HKR,,PassiveScan, 0, "0" - ;******************************************************************************* ; Multi-Channel Concurrent section ;******************************************************************************* @@ -1104,30 +917,26 @@ HKR,,MultiChannelFcsMode, 0, "0" ;******************************************************************************* ; Destination Directory ;******************************************************************************* -[RTWlanS.CopyFiles] -rtwlans.sys,,,2 - [DestinationDirs] -DefaultDestDir = 11 -RTWlanS.CopyFiles = 12 -CIHVS.CopyFiles = 11 -RtlUI2.CopyFiles = 10 +DefaultDestDir = 13 +RTWlanS.CopyFiles = 13 +;CIHVS.CopyFiles = 13 ;;**************************************************************************** ;; Source Files ;;**************************************************************************** -[CIHVS.CopyFiles] -Rtlihvs.dll,,,2 - -[RegisterUIExt] -11,,RtlExtUI.dll,1 +[RTWlanS.CopyFiles] +rtwlans.sys,,,2 -[RtlUI2.CopyFiles] -RtlUI2.exe,,,2 +;TODO, The following section should be included in CopyFiles +; But current solution not found the Rtlihvs.dll file. +; so comment out; +;[CIHVS.CopyFiles] +;Rtlihvs.dll,,,2 [SourceDisksFiles] rtwlans.sys = 1 -Rtlihvs.dll = 1 +;Rtlihvs.dll = 1 [SourceDisksNames] 1=%DISKNAME%,,, -- cgit v1.3.1 From c09d9910b1379af9ea0d3de4ec4d90fc1ed2ecac Mon Sep 17 00:00:00 2001 From: Tom Molenhouse Date: Mon, 18 Jul 2022 12:39:50 -0700 Subject: [network\ndis\ndisprot] Virtual Miniport: Fix UINT8 comparison with ULONG (#754) fix UINT8 comparison with ULONG --- network/ndis/netvmini/6x/rssv2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network/ndis/netvmini/6x/rssv2.c b/network/ndis/netvmini/6x/rssv2.c index 1f8efb0e..35ad6fb8 100644 --- a/network/ndis/netvmini/6x/rssv2.c +++ b/network/ndis/netvmini/6x/rssv2.c @@ -210,7 +210,7 @@ Return Value: --*/ { - UINT8 index; + ULONG index; PNDIS_RSS_PROCESSOR processor; for (index = 0; -- cgit v1.3.1 From becc483cd0de057185990c01e0a95cc63458191e Mon Sep 17 00:00:00 2001 From: emilyhobby <86006065+emilyhobby@users.noreply.github.com> Date: Mon, 8 Aug 2022 11:18:27 -0700 Subject: Include/Needs inbox services (#765) * Include/Needs inbox services * Added header comment specifying required minimum OS version --- general/umdfSkeleton/UMDFSkeleton_OSR.inx | Bin 5646 -> 4976 bytes hid/vhidmini2/driver/umdf2/VhidminiUm.inx | Bin 5402 -> 4912 bytes .../umdf_filter/WUDFOsrUsbFilterOnKmDriver.inx | Bin 6574 -> 6620 bytes usb/umdf_fx2/driver/WUDFOsrUsbFx2.inx | Bin 6916 -> 6356 bytes usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.inx | Bin 5920 -> 5254 bytes usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.inx | Bin 5920 -> 5254 bytes usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.inx | Bin 5920 -> 5254 bytes usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.inx | Bin 5920 -> 5254 bytes 8 files changed, 0 insertions(+), 0 deletions(-) diff --git a/general/umdfSkeleton/UMDFSkeleton_OSR.inx b/general/umdfSkeleton/UMDFSkeleton_OSR.inx index 3da01ae6..91efb336 100644 Binary files a/general/umdfSkeleton/UMDFSkeleton_OSR.inx and b/general/umdfSkeleton/UMDFSkeleton_OSR.inx differ diff --git a/hid/vhidmini2/driver/umdf2/VhidminiUm.inx b/hid/vhidmini2/driver/umdf2/VhidminiUm.inx index 73bf251c..ffabc450 100644 Binary files a/hid/vhidmini2/driver/umdf2/VhidminiUm.inx and b/hid/vhidmini2/driver/umdf2/VhidminiUm.inx differ diff --git a/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilterOnKmDriver.inx b/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilterOnKmDriver.inx index 6153e18b..6cf1f091 100644 Binary files a/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilterOnKmDriver.inx and b/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilterOnKmDriver.inx differ diff --git a/usb/umdf_fx2/driver/WUDFOsrUsbFx2.inx b/usb/umdf_fx2/driver/WUDFOsrUsbFx2.inx index 9ad339b6..4f21c018 100644 Binary files a/usb/umdf_fx2/driver/WUDFOsrUsbFx2.inx and b/usb/umdf_fx2/driver/WUDFOsrUsbFx2.inx differ diff --git a/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.inx b/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.inx index 69f0c0c4..1b11d447 100644 Binary files a/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.inx and b/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.inx differ diff --git a/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.inx b/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.inx index 98d8c453..30529676 100644 Binary files a/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.inx and b/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.inx differ diff --git a/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.inx b/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.inx index c4846f6e..92f29a24 100644 Binary files a/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.inx and b/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.inx differ diff --git a/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.inx b/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.inx index 215e5f98..1eff425c 100644 Binary files a/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.inx and b/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.inx differ -- cgit v1.3.1 From 5108e2744c7aa807e9d9855c2088dbd622e99641 Mon Sep 17 00:00:00 2001 From: Parag Mali Date: Thu, 11 Aug 2022 14:00:15 -0700 Subject: [biometrics] Use includes/needs for wudfbiousbsample (#767) --- biometrics/driver/WudfBioUsbSample.inx | Bin 11368 -> 10470 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/biometrics/driver/WudfBioUsbSample.inx b/biometrics/driver/WudfBioUsbSample.inx index 4e73c050..f28f74c4 100644 Binary files a/biometrics/driver/WudfBioUsbSample.inx and b/biometrics/driver/WudfBioUsbSample.inx differ -- cgit v1.3.1 From 78a4097df51c69947516fff09abf1444eebe70c2 Mon Sep 17 00:00:00 2001 From: emilyhobby <86006065+emilyhobby@users.noreply.github.com> Date: Wed, 31 Aug 2022 15:16:48 -0700 Subject: Include/Needs inbox services for hidusbfx2, vhidmini, umdf_filter_umdf (#778) --- hid/hidusbfx2/sys/hidusbfx2.inx | Bin 12214 -> 9060 bytes hid/vhidmini2/driver/kmdf/vhidmini.inx | Bin 4784 -> 4440 bytes .../umdf_filter/WUDFOsrUsbFilterOnUmFx2Driver.inx | Bin 6906 -> 6224 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/hid/hidusbfx2/sys/hidusbfx2.inx b/hid/hidusbfx2/sys/hidusbfx2.inx index 43a55fb0..cb8bc3be 100644 Binary files a/hid/hidusbfx2/sys/hidusbfx2.inx and b/hid/hidusbfx2/sys/hidusbfx2.inx differ diff --git a/hid/vhidmini2/driver/kmdf/vhidmini.inx b/hid/vhidmini2/driver/kmdf/vhidmini.inx index 3e709ef6..cc62a879 100644 Binary files a/hid/vhidmini2/driver/kmdf/vhidmini.inx and b/hid/vhidmini2/driver/kmdf/vhidmini.inx differ diff --git a/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilterOnUmFx2Driver.inx b/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilterOnUmFx2Driver.inx index 4d716e83..27f04d75 100644 Binary files a/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilterOnUmFx2Driver.inx and b/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilterOnUmFx2Driver.inx differ -- cgit v1.3.1 From 62b5e8faba904292fa02b91effad5d5e0d0bd9bb Mon Sep 17 00:00:00 2001 From: Adonais Romero Gonzalez Date: Mon, 26 Sep 2022 16:08:26 -0700 Subject: [general/filehistory] Remove sample; APIs have been deprecated --- exclusions.csv | 1 - general/filehistory/README.md | 29 --- general/filehistory/exe/fhsetup.cpp | 271 ------------------------ general/filehistory/exe/fhsetup.h | 27 --- general/filehistory/exe/fhsetup.vcxproj | 190 ----------------- general/filehistory/exe/fhsetup.vcxproj.Filters | 22 -- general/filehistory/filehistory.sln | 28 --- 7 files changed, 568 deletions(-) delete mode 100644 general/filehistory/README.md delete mode 100644 general/filehistory/exe/fhsetup.cpp delete mode 100644 general/filehistory/exe/fhsetup.h delete mode 100644 general/filehistory/exe/fhsetup.vcxproj delete mode 100644 general/filehistory/exe/fhsetup.vcxproj.Filters delete mode 100644 general/filehistory/filehistory.sln diff --git a/exclusions.csv b/exclusions.csv index 86ab66e8..39bc53c7 100644 --- a/exclusions.csv +++ b/exclusions.csv @@ -2,7 +2,6 @@ Path,Reason general\dchu\osrfx2_dchu_base,Wrong Toolset - needs migration general\dchu\osrfx2_dchu_extension_loose,Needs fix for project not found general\dchu\osrfx2_dchu_extension_tight,Wrong Toolset - needs migration -general\filehistory,Deprecated APIs general\simplemediasource,ARM64 LNK1181: cannot open input file 'SimpleMediaSource.lib' general\winhec 2017 lab\toaster driver,Needs input from end user general\winhec 2017 lab\toaster support app,Needs input from end user diff --git a/general/filehistory/README.md b/general/filehistory/README.md deleted file mode 100644 index 9cbadf3b..00000000 --- a/general/filehistory/README.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -page_type: sample -description: "A console application that starts the file history service, if it is stopped, and schedules regular backups." -languages: -- cpp -products: -- windows -- windows-wdk ---- - -# File History Sample - -The FileHistory sample is a console application that starts the file history service, if it is stopped, and schedules regular backups. The application requires, as a command-line parameter, the path name of a storage device to use as the default backup target. - -This sample application uses the [File History API](https://docs.microsoft.com/windows/win32/devnotes/file-history-api). The File History API enables third parties to automatically configure the File History feature on a Windows platform and customize it in accordance with their unique needs. - -## Run the sample - -The name of the built sample application is Fhsetup.exe. To run this application, open a command window and enter a command that has the following format: - -`fhsetup ` - -The `path` command-line parameter is the path name of a storage device to use as the default backup target. The following are examples: - -`fhsetup D:\` - -`fhsetup \\server\share` - -If the specified target is inaccessible, read-only, an invalid drive type (such as a CD), already being used for file history, or part of the protected namespace, the application fails the request and does not enable file history on the target. diff --git a/general/filehistory/exe/fhsetup.cpp b/general/filehistory/exe/fhsetup.cpp deleted file mode 100644 index 41edfd02..00000000 --- a/general/filehistory/exe/fhsetup.cpp +++ /dev/null @@ -1,271 +0,0 @@ -// -// File History Sample Setup Tool -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// - -#include - -HRESULT ScheduleBackups() -/*++ - -Routine Description: - - This function starts the File History service if it is stopped - and schedules regular backups. - -Arguments: - - None - -Return Value: - - S_OK if successful - HRESULT from underlying functions - ---*/ -{ - HRESULT backupHr = S_OK; - HRESULT pipeHr = S_OK; - FH_SERVICE_PIPE_HANDLE pipe = NULL; - - pipeHr = FhServiceOpenPipe(TRUE, &pipe); - if (SUCCEEDED(pipeHr)) - { - backupHr = FhServiceReloadConfiguration(pipe); - pipeHr = FhServiceClosePipe(pipe); - } - - // The HRESULT from the backup operation is more important than - // the HRESULT from pipe operations - return FAILED(backupHr) ? backupHr : pipeHr; -} - -HRESULT ConfigureFileHistory( - _In_ PWSTR TargetPath - ) -/*++ - -Routine Description: - - This function configures a target for File History. - It will only succeed if the user has never configured File History - before and there is no File History data on the target. - -Arguments: - - TargetPath - - The path of the File History target - -Return Value: - - S_OK if successful - E_INVALIDARG if TargetPath is NULL - E_FAIL if configuration failed because File History is disabled by - group policy or the target is not valid - HRESULT from underlying functions - ---*/ -{ - HRESULT hr = S_OK; - FH_BACKUP_STATUS backupStatus; - FH_DEVICE_VALIDATION_RESULT validationResult; - CComPtr configMgr; - CComBSTR targetPath; - CComBSTR targetName; - - // TargetPath must not be NULL - if (TargetPath == NULL) - { - hr = E_INVALIDARG; - goto Cleanup; - } - - // Copy the target path into a local variable and set the target name - // to an empty string to allow the config manager to set a name - _ATLTRY - { - targetPath = TargetPath; - targetName = L""; - } - _ATLCATCH(e) - { - hr = e; - goto Cleanup; - } - - // The configuration manager is used to create and load configuration - // files, get/set the backup status, validate a target, etc - hr = configMgr.CoCreateInstance(CLSID_FhConfigMgr); - if (FAILED(hr)) - { - wprintf(L"Error: CoCreateInstance failed (0x%X)\n", hr); - goto Cleanup; - } - - // Create a new default configuration file - do not overwrite if one - // already exists - wprintf(L"Creating default configuration\n"); - hr = configMgr->CreateDefaultConfiguration(FALSE); - if (FAILED(hr)) - { - if (hr == FHCFG_E_CONFIG_ALREADY_EXISTS) - { - wprintf(L"Error: File History has previously been configured\n"); - } - else - { - wprintf(L"Error: CreateDefaultConfiguration failed (0x%X)\n", hr); - } - goto Cleanup; - } - - // Check the backup status - // If File History is disabled by group policy, quit - wprintf(L"Getting backup status\n"); - hr = configMgr->GetBackupStatus(&backupStatus); - if (FAILED(hr)) - { - wprintf(L"Error: GetBackupStatus failed (0x%X)\n", hr); - goto Cleanup; - } - if (backupStatus == FH_STATUS_DISABLED_BY_GP) - { - wprintf(L"Error: File History is disabled by group policy\n"); - hr = E_FAIL; - goto Cleanup; - } - - // Make sure the target is valid to be used for File History - wprintf(L"Validating target\n"); - hr = configMgr->ValidateTarget(targetPath, &validationResult); - if (FAILED(hr)) - { - wprintf(L"Error: ValidateTarget failed (0x%X)\n", hr); - goto Cleanup; - } - if (validationResult != FH_VALID_TARGET) - { - // If the target is inaccessible, read-only, an invalid drive type - // (such as a CD), already being used for File History, or part of - // the protected namespace - don't enable File History - wprintf(L"Error: %ws is not a valid target\n", targetPath.m_str); - hr = E_FAIL; - goto Cleanup; - } - - // Provision the target to be used for File History and set - // it as the default target - wprintf(L"Provisioning and setting target\n"); - hr = configMgr->ProvisionAndSetNewTarget(targetPath, targetName); - if (FAILED(hr)) - { - wprintf(L"Error: ProvisionAndSetNewTarget failed (0x%X)\n", hr); - goto Cleanup; - } - - // Enable File History - wprintf(L"Enabling File History\n"); - hr = configMgr->SetBackupStatus(FH_STATUS_ENABLED); - if (FAILED(hr)) - { - wprintf(L"Error: SetBackupStatus failed (0x%X)\n", hr); - goto Cleanup; - } - - // Save the configuration to disk - wprintf(L"Saving configuration\n"); - hr = configMgr->SaveConfiguration(); - if (FAILED(hr)) - { - wprintf(L"Error: SaveConfiguration failed (0x%X)\n", hr); - goto Cleanup; - } - - // Tell the File History service to schedule backups - wprintf(L"Scheduling regular backups\n"); - hr = ScheduleBackups(); - if (FAILED(hr)) - { - wprintf(L"Error: ScheduleBackups failed (0x%X)\n", hr); - goto Cleanup; - } - - // Recommend the target to other Homegroup members - wprintf(L"Recommending target to Homegroup\n"); - HRESULT hrRecommend = configMgr->ChangeDefaultTargetRecommendation(TRUE); - if (FAILED(hrRecommend)) - { - wprintf(L"Warning: Failed to recommend target to Homegroup (0x%X)\n", hrRecommend); - } - - wprintf(L"Success! File History is now enabled\n"); - -Cleanup: - return hr; -} - -int __cdecl wmain( - _In_ int Argc, - _In_reads_(Argc) PWSTR Argv[] - ) -/*++ - -Routine Description: - - This is the main entry point of the console application. - -Arguments: - - Argc - the number of command line arguments - Argv - command line arguments - -Return Value: - - exit code - ---*/ -{ - HRESULT hr = S_OK; - BOOL comInitialized = FALSE; - - wprintf(L"\nFile History Sample Setup Tool\n"); - wprintf(L"Copyright (C) Microsoft Corporation. All rights reserved.\n\n"); - - // If there are fewer than 2 command-line arguments, print the correct - // usage and exit - if (Argc < 2) - { - wprintf(L"Usage: fhsetup \n\n"); - wprintf(L"Examples:\n"); - wprintf(L" fhsetup D:\\\n"); - wprintf(L" fhsetup \\\\server\\share\\\n\n"); - goto Cleanup; - } - - // COM is needed to use the Config Manager - wprintf(L"Initializing COM...\n"); - hr = CoInitialize(NULL); - if (FAILED(hr)) - { - wprintf(L"Error: CoInitialize failed (0x%X)\n", hr); - goto Cleanup; - } - comInitialized = TRUE; - - hr = ConfigureFileHistory(Argv[1]); - if (FAILED(hr)) - { - wprintf(L"File History configuration failed (0x%X)\n", hr); - goto Cleanup; - } - -Cleanup: - // If COM was initialized, make sure it is uninitialized - if (comInitialized) - { - CoUninitialize(); - comInitialized = FALSE; - } - - return 0; -} diff --git a/general/filehistory/exe/fhsetup.h b/general/filehistory/exe/fhsetup.h deleted file mode 100644 index eeb241c9..00000000 --- a/general/filehistory/exe/fhsetup.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// File History Sample Setup Tool -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -// -// Define CLSID_FhConfigMgr. -// We must include initguid.h before using DEFINE_GUID otherwise -// DEFINE_GUID will declare CLSID_FhConfigMgr as extern. -// - -#include -DEFINE_GUID(CLSID_FhConfigMgr,0xED43BB3C,0x09E9,0x498a,0x9D,0xF6,0x21,0x77,0x24,0x4C,0x6D,0xB4); \ No newline at end of file diff --git a/general/filehistory/exe/fhsetup.vcxproj b/general/filehistory/exe/fhsetup.vcxproj deleted file mode 100644 index e6e78377..00000000 --- a/general/filehistory/exe/fhsetup.vcxproj +++ /dev/null @@ -1,190 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {DD221269-A9F3-43ED-A12B-B9C7CF812D1D} - $(MSBuildProjectName) - Debug - Win32 - {8E38B679-4605-44E5-9C1B-44B05A5A5DF5} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - Application - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - Application - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - Application - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - Application - - - - $(IntDir) - - - - - - - - - - - - - - - - fhsetup - Dynamic - - - fhsetup - Dynamic - - - fhsetup - Dynamic - - - fhsetup - Dynamic - - - - true - Level4 - Sync - %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. - - - %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. - - - %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. - - - %(AdditionalDependencies);shell32.lib;shlwapi.lib;Ole32.lib;Oleaut32.lib;User32.lib;fhsvcctl.lib - - - - - true - Level4 - Sync - %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. - - - %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. - - - %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. - - - %(AdditionalDependencies);shell32.lib;shlwapi.lib;Ole32.lib;Oleaut32.lib;User32.lib;fhsvcctl.lib - - - - - true - Level4 - Sync - %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. - - - %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. - - - %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. - - - %(AdditionalDependencies);shell32.lib;shlwapi.lib;Ole32.lib;Oleaut32.lib;User32.lib;fhsvcctl.lib - - - - - true - Level4 - Sync - %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. - - - %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. - - - %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. - - - %(AdditionalDependencies);shell32.lib;shlwapi.lib;Ole32.lib;Oleaut32.lib;User32.lib;fhsvcctl.lib - - - - - - - - - - - - - - - - - - - diff --git a/general/filehistory/exe/fhsetup.vcxproj.Filters b/general/filehistory/exe/fhsetup.vcxproj.Filters deleted file mode 100644 index 5cb08132..00000000 --- a/general/filehistory/exe/fhsetup.vcxproj.Filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {A057879C-B0E4-4D55-A840-76CB421200B5} - - - h;hpp;hxx;hm;inl;inc;xsd - {351B6DDB-CB13-4598-9469-D8DA8C566237} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {11B25EA5-2E86-459D-8B67-F8184BA99C72} - - - - - Source Files - - - \ No newline at end of file diff --git a/general/filehistory/filehistory.sln b/general/filehistory/filehistory.sln deleted file mode 100644 index 200c158c..00000000 --- a/general/filehistory/filehistory.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0 -MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fhsetup", "exe\fhsetup.vcxproj", "{DD221269-A9F3-43ED-A12B-B9C7CF812D1D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {DD221269-A9F3-43ED-A12B-B9C7CF812D1D}.Debug|Win32.ActiveCfg = Debug|Win32 - {DD221269-A9F3-43ED-A12B-B9C7CF812D1D}.Debug|Win32.Build.0 = Debug|Win32 - {DD221269-A9F3-43ED-A12B-B9C7CF812D1D}.Release|Win32.ActiveCfg = Release|Win32 - {DD221269-A9F3-43ED-A12B-B9C7CF812D1D}.Release|Win32.Build.0 = Release|Win32 - {DD221269-A9F3-43ED-A12B-B9C7CF812D1D}.Debug|x64.ActiveCfg = Debug|x64 - {DD221269-A9F3-43ED-A12B-B9C7CF812D1D}.Debug|x64.Build.0 = Debug|x64 - {DD221269-A9F3-43ED-A12B-B9C7CF812D1D}.Release|x64.ActiveCfg = Release|x64 - {DD221269-A9F3-43ED-A12B-B9C7CF812D1D}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal -- cgit v1.3.1 From 509c49d0192b84de459fdfae9bd8c1e16f6cafa0 Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 5 Oct 2022 11:55:25 -0700 Subject: [smartcrd\pscr] Get pscr sample building properly (#788) --- smartcrd/pscr/pscr.inx | Bin 6260 -> 6272 bytes smartcrd/pscr/pscrnt.c | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/smartcrd/pscr/pscr.inx b/smartcrd/pscr/pscr.inx index 22a8b269..93ea8f4b 100644 Binary files a/smartcrd/pscr/pscr.inx and b/smartcrd/pscr/pscr.inx differ diff --git a/smartcrd/pscr/pscrnt.c b/smartcrd/pscr/pscrnt.c index 4505035f..3249371d 100644 --- a/smartcrd/pscr/pscrnt.c +++ b/smartcrd/pscr/pscrnt.c @@ -406,8 +406,8 @@ PscrRegisterWithSmcLib( SmartcardExtension = &DeviceExtension->SmartcardExtension; // allocate the reader extension - ReaderExtension = ExAllocatePoolWithTag( - NonPagedPoolNx, + ReaderExtension = ExAllocatePool2( + POOL_FLAG_NON_PAGED, sizeof( READER_EXTENSION ), SMARTCARD_POOL_TAG ); -- cgit v1.3.1 From fe08ec9700c65d38a6deb79d51753ea4a19e465b Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 5 Oct 2022 15:42:41 -0700 Subject: Add PnpLockdown=1 to a bunch of sample INFs (#789) --- bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx | Bin 5944 -> 5974 bytes bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx | Bin 5958 -> 5988 bytes bluetooth/serialhcibus/WDK/SerialBusWdk.inx | Bin 4702 -> 4732 bytes .../osrfx2_DCHU_component/osrfx2_DCHU_component.inx | 1 + .../osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx | 1 + .../osrfx2_DCHU_component/osrfx2_DCHU_component.inx | 1 + .../osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx | 1 + .../Toaster Driver/toaster/toaster.inx | 1 + general/echo/kmdf/driver/AutoSync/echo.inx | Bin 4842 -> 4872 bytes general/echo/kmdf/driver/DriverSync/echo_2.inx | Bin 4998 -> 5028 bytes general/echo/umdf/WUDFEchoDriver.inx | Bin 4412 -> 4442 bytes general/echo/umdf2/driver/AutoSync/echoum.inx | Bin 3924 -> 3954 bytes general/echo/umdfSocketEcho/Driver/SocketEcho.inx | Bin 4280 -> 4310 bytes general/pcidrv/kmdf/genpci.inx | Bin 7198 -> 7238 bytes .../toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx | Bin 5754 -> 5780 bytes general/toaster/toastDrv/kmdf/bus/static/statbus.inx | Bin 5658 -> 5688 bytes general/toaster/toastDrv/kmdf/filter/filter.inx | Bin 7318 -> 7352 bytes .../toastDrv/kmdf/func/featured/wdffeatured.inx | Bin 5870 -> 5900 bytes .../toaster/toastDrv/kmdf/func/simple/wdfsimple.inx | Bin 6838 -> 6868 bytes .../toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx | Bin 4598 -> 4628 bytes .../toaster/toastDrv/umdf/Toastmon/WUDFToastMon.inx | Bin 4034 -> 4064 bytes general/toaster/toastDrv/umdf/func/WUDFToaster.inx | Bin 4510 -> 4540 bytes general/toaster/umdf2/filter/generic/filterum.inx | Bin 4904 -> 4934 bytes general/toaster/umdf2/func/featured/wdffeaturedum.inx | Bin 4924 -> 4954 bytes general/toaster/umdf2/func/simple/wdfsimpleum.inx | Bin 4796 -> 4826 bytes general/umdfSkeleton/UMDFSkeleton_OSR.inx | Bin 4976 -> 5006 bytes general/umdfSkeleton/UMDFSkeleton_Root.inx | Bin 3798 -> 3828 bytes gpio/samples/simdevice/kmdf/simdevice.inx | Bin 3022 -> 3052 bytes gpio/samples/simdevice/umdf/simdeviceumdf.inx | 1 + gpio/samples/simgpio/simgpio.inx | Bin 3722 -> 3752 bytes gpio/samples/simgpio_i2c/simgpio_i2c.inx | Bin 3794 -> 3824 bytes 31 files changed, 6 insertions(+) diff --git a/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx b/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx index 16c1ef51..a1d3eb5a 100644 Binary files a/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx and b/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx differ diff --git a/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx b/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx index efb08654..fecdbcb5 100644 Binary files a/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx and b/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx differ diff --git a/bluetooth/serialhcibus/WDK/SerialBusWdk.inx b/bluetooth/serialhcibus/WDK/SerialBusWdk.inx index 6fa29006..27f70ab6 100644 Binary files a/bluetooth/serialhcibus/WDK/SerialBusWdk.inx and b/bluetooth/serialhcibus/WDK/SerialBusWdk.inx differ diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx index 8baab1a0..62c305cb 100644 --- a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx @@ -24,6 +24,7 @@ Class = SoftwareComponent ClassGuid = {5c4c3332-344d-483c-8739-259e934c9cc8} Provider = %ManufacturerName% CatalogFile = osrfx2_DCHU_component.cat +PnpLockdown = 1 [Manufacturer] %ManufacturerName% = OsrFx2Component, NT$ARCH$ diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx index cb2e9177..29b8e8ec 100644 --- a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx @@ -25,6 +25,7 @@ Provider = %ManufacturerName% ExtensionId = {aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa} ; replace with your own GUID {zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz} CatalogFile = osrfx2_DCHU_extension.cat DriverVer = 05/16/2017,15.14.36.721 +PnpLockdown = 1 [Manufacturer] %ManufacturerName% = OsrFx2Extension, NT$ARCH$ diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx index 8baab1a0..62c305cb 100644 --- a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx @@ -24,6 +24,7 @@ Class = SoftwareComponent ClassGuid = {5c4c3332-344d-483c-8739-259e934c9cc8} Provider = %ManufacturerName% CatalogFile = osrfx2_DCHU_component.cat +PnpLockdown = 1 [Manufacturer] %ManufacturerName% = OsrFx2Component, NT$ARCH$ diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx index ed4a3c87..28f1dd0b 100644 --- a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx @@ -25,6 +25,7 @@ Provider = %ManufacturerName% ExtensionId = {zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz} ; replace with your own GUID CatalogFile = osrfx2_DCHU_extension.cat DriverVer = 05/16/2017,15.14.36.721 +PnpLockdown = 1 [Manufacturer] %ManufacturerName% = OsrFx2Extension, NT$ARCH$ diff --git a/general/WinHEC 2017 Lab/Toaster Driver/toaster/toaster.inx b/general/WinHEC 2017 Lab/Toaster Driver/toaster/toaster.inx index 2217039d..2e7e0ad3 100644 --- a/general/WinHEC 2017 Lab/Toaster Driver/toaster/toaster.inx +++ b/general/WinHEC 2017 Lab/Toaster Driver/toaster/toaster.inx @@ -7,6 +7,7 @@ ClassGuid = {4D36E97D-E325-11CE-BFC1-08002BE10318} Provider = Contoso DriverVer = 06/16/1999, 5.00.2064 CatalogFile = toaster.cat +PnpLockdown = 1 [Manufacturer] Contoso = Contoso, NT$ARCH$ diff --git a/general/echo/kmdf/driver/AutoSync/echo.inx b/general/echo/kmdf/driver/AutoSync/echo.inx index bfb3b356..43ff49d2 100644 Binary files a/general/echo/kmdf/driver/AutoSync/echo.inx and b/general/echo/kmdf/driver/AutoSync/echo.inx differ diff --git a/general/echo/kmdf/driver/DriverSync/echo_2.inx b/general/echo/kmdf/driver/DriverSync/echo_2.inx index ea524f85..f4ece1a7 100644 Binary files a/general/echo/kmdf/driver/DriverSync/echo_2.inx and b/general/echo/kmdf/driver/DriverSync/echo_2.inx differ diff --git a/general/echo/umdf/WUDFEchoDriver.inx b/general/echo/umdf/WUDFEchoDriver.inx index ad6e9bf4..cf8acb0d 100644 Binary files a/general/echo/umdf/WUDFEchoDriver.inx and b/general/echo/umdf/WUDFEchoDriver.inx differ diff --git a/general/echo/umdf2/driver/AutoSync/echoum.inx b/general/echo/umdf2/driver/AutoSync/echoum.inx index cae8b45f..d15e4413 100644 Binary files a/general/echo/umdf2/driver/AutoSync/echoum.inx and b/general/echo/umdf2/driver/AutoSync/echoum.inx differ diff --git a/general/echo/umdfSocketEcho/Driver/SocketEcho.inx b/general/echo/umdfSocketEcho/Driver/SocketEcho.inx index b660186b..b1475187 100644 Binary files a/general/echo/umdfSocketEcho/Driver/SocketEcho.inx and b/general/echo/umdfSocketEcho/Driver/SocketEcho.inx differ diff --git a/general/pcidrv/kmdf/genpci.inx b/general/pcidrv/kmdf/genpci.inx index 1ccf8ca9..b10b695a 100644 Binary files a/general/pcidrv/kmdf/genpci.inx and b/general/pcidrv/kmdf/genpci.inx differ diff --git a/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx b/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx index c51e1e9b..55f07bda 100644 Binary files a/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx and b/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx differ diff --git a/general/toaster/toastDrv/kmdf/bus/static/statbus.inx b/general/toaster/toastDrv/kmdf/bus/static/statbus.inx index a28b3144..544c87ed 100644 Binary files a/general/toaster/toastDrv/kmdf/bus/static/statbus.inx and b/general/toaster/toastDrv/kmdf/bus/static/statbus.inx differ diff --git a/general/toaster/toastDrv/kmdf/filter/filter.inx b/general/toaster/toastDrv/kmdf/filter/filter.inx index d579ff7e..a8538010 100644 Binary files a/general/toaster/toastDrv/kmdf/filter/filter.inx and b/general/toaster/toastDrv/kmdf/filter/filter.inx differ diff --git a/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx b/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx index 73a1a1ea..1b81d480 100644 Binary files a/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx and b/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx differ diff --git a/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx b/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx index 69fbea75..aac79307 100644 Binary files a/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx and b/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx differ diff --git a/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx b/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx index cfee1b11..a63a6c5c 100644 Binary files a/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx and b/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx differ diff --git a/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.inx b/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.inx index eba3c794..245b304e 100644 Binary files a/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.inx and b/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.inx differ diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.inx b/general/toaster/toastDrv/umdf/func/WUDFToaster.inx index 9874becf..e804dcff 100644 Binary files a/general/toaster/toastDrv/umdf/func/WUDFToaster.inx and b/general/toaster/toastDrv/umdf/func/WUDFToaster.inx differ diff --git a/general/toaster/umdf2/filter/generic/filterum.inx b/general/toaster/umdf2/filter/generic/filterum.inx index 0efeb0d3..4de6d127 100644 Binary files a/general/toaster/umdf2/filter/generic/filterum.inx and b/general/toaster/umdf2/filter/generic/filterum.inx differ diff --git a/general/toaster/umdf2/func/featured/wdffeaturedum.inx b/general/toaster/umdf2/func/featured/wdffeaturedum.inx index bb8af311..c4e79f13 100644 Binary files a/general/toaster/umdf2/func/featured/wdffeaturedum.inx and b/general/toaster/umdf2/func/featured/wdffeaturedum.inx differ diff --git a/general/toaster/umdf2/func/simple/wdfsimpleum.inx b/general/toaster/umdf2/func/simple/wdfsimpleum.inx index 3187b27f..44252e4e 100644 Binary files a/general/toaster/umdf2/func/simple/wdfsimpleum.inx and b/general/toaster/umdf2/func/simple/wdfsimpleum.inx differ diff --git a/general/umdfSkeleton/UMDFSkeleton_OSR.inx b/general/umdfSkeleton/UMDFSkeleton_OSR.inx index 91efb336..9729eee7 100644 Binary files a/general/umdfSkeleton/UMDFSkeleton_OSR.inx and b/general/umdfSkeleton/UMDFSkeleton_OSR.inx differ diff --git a/general/umdfSkeleton/UMDFSkeleton_Root.inx b/general/umdfSkeleton/UMDFSkeleton_Root.inx index 63d9f94c..abb05491 100644 Binary files a/general/umdfSkeleton/UMDFSkeleton_Root.inx and b/general/umdfSkeleton/UMDFSkeleton_Root.inx differ diff --git a/gpio/samples/simdevice/kmdf/simdevice.inx b/gpio/samples/simdevice/kmdf/simdevice.inx index 74e5ba4e..48f8a52d 100644 Binary files a/gpio/samples/simdevice/kmdf/simdevice.inx and b/gpio/samples/simdevice/kmdf/simdevice.inx differ diff --git a/gpio/samples/simdevice/umdf/simdeviceumdf.inx b/gpio/samples/simdevice/umdf/simdeviceumdf.inx index 14764b15..3c0def96 100644 --- a/gpio/samples/simdevice/umdf/simdeviceumdf.inx +++ b/gpio/samples/simdevice/umdf/simdeviceumdf.inx @@ -9,6 +9,7 @@ ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171} Provider=%ProviderName% CatalogFile=gpiosamples.cat DriverVer=03/20/2003,5.00.3788 +PnpLockdown=1 [Manufacturer] %ManufacturerName%=Standard,NT$ARCH$ diff --git a/gpio/samples/simgpio/simgpio.inx b/gpio/samples/simgpio/simgpio.inx index 96239192..b0a724e2 100644 Binary files a/gpio/samples/simgpio/simgpio.inx and b/gpio/samples/simgpio/simgpio.inx differ diff --git a/gpio/samples/simgpio_i2c/simgpio_i2c.inx b/gpio/samples/simgpio_i2c/simgpio_i2c.inx index c81e3955..ffe92042 100644 Binary files a/gpio/samples/simgpio_i2c/simgpio_i2c.inx and b/gpio/samples/simgpio_i2c/simgpio_i2c.inx differ -- cgit v1.3.1 From 803a5e44ac3abf4a847d9164c5788296efa80f02 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 6 Oct 2022 10:22:17 -0700 Subject: Add PnpLockdown=1 to more sample INFs (#790) --- hid/hidusbfx2/sys/hidusbfx2.inx | Bin 9060 -> 9094 bytes hid/vhidmini2/driver/kmdf/vhidmini.inx | Bin 4440 -> 4470 bytes hid/vhidmini2/driver/umdf2/VhidminiUm.inx | Bin 4912 -> 4942 bytes input/kbfiltr/sys/kbfiltr.inx | Bin 5714 -> 5744 bytes input/moufiltr/moufiltr.inx | Bin 5704 -> 5734 bytes .../HidSwitchDriverSample/RadioSwitchHidUsbFx2.inx | Bin 7088 -> 7114 bytes .../windows-drivertemplate-nfc.inf | Bin 3832 -> 3862 bytes nfp/net/driver/netnfpprovider.inx | Bin 3838 -> 3868 bytes pofx/PEP/acpi/sampleacpipep.inx | Bin 4212 -> 4242 bytes .../SingleComp/SingleComponentSingleStateUm.inx | Bin 4472 -> 4502 bytes pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.inx | Bin 3898 -> 3928 bytes .../Driver/SingleComp/SingleComponentFStateSample.inx | Bin 6220 -> 6250 bytes print/autoconfig/AutoCnfg.inf | 1 + .../usb_host_based_sample.inf | 1 + 14 files changed, 2 insertions(+) diff --git a/hid/hidusbfx2/sys/hidusbfx2.inx b/hid/hidusbfx2/sys/hidusbfx2.inx index cb8bc3be..90153f38 100644 Binary files a/hid/hidusbfx2/sys/hidusbfx2.inx and b/hid/hidusbfx2/sys/hidusbfx2.inx differ diff --git a/hid/vhidmini2/driver/kmdf/vhidmini.inx b/hid/vhidmini2/driver/kmdf/vhidmini.inx index cc62a879..d16724ca 100644 Binary files a/hid/vhidmini2/driver/kmdf/vhidmini.inx and b/hid/vhidmini2/driver/kmdf/vhidmini.inx differ diff --git a/hid/vhidmini2/driver/umdf2/VhidminiUm.inx b/hid/vhidmini2/driver/umdf2/VhidminiUm.inx index ffabc450..2b449fe7 100644 Binary files a/hid/vhidmini2/driver/umdf2/VhidminiUm.inx and b/hid/vhidmini2/driver/umdf2/VhidminiUm.inx differ diff --git a/input/kbfiltr/sys/kbfiltr.inx b/input/kbfiltr/sys/kbfiltr.inx index d5788b55..6f7db255 100644 Binary files a/input/kbfiltr/sys/kbfiltr.inx and b/input/kbfiltr/sys/kbfiltr.inx differ diff --git a/input/moufiltr/moufiltr.inx b/input/moufiltr/moufiltr.inx index 406de846..fe547b21 100644 Binary files a/input/moufiltr/moufiltr.inx and b/input/moufiltr/moufiltr.inx differ diff --git a/network/radio/HidSwitchDriverSample/RadioSwitchHidUsbFx2.inx b/network/radio/HidSwitchDriverSample/RadioSwitchHidUsbFx2.inx index c7d1ba0f..a9cf9004 100644 Binary files a/network/radio/HidSwitchDriverSample/RadioSwitchHidUsbFx2.inx and b/network/radio/HidSwitchDriverSample/RadioSwitchHidUsbFx2.inx differ diff --git a/nfc/NfcCxSample/windows-drivertemplate-nfc/windows-drivertemplate-nfc.inf b/nfc/NfcCxSample/windows-drivertemplate-nfc/windows-drivertemplate-nfc.inf index d6070a8c..2c26ad5b 100644 Binary files a/nfc/NfcCxSample/windows-drivertemplate-nfc/windows-drivertemplate-nfc.inf and b/nfc/NfcCxSample/windows-drivertemplate-nfc/windows-drivertemplate-nfc.inf differ diff --git a/nfp/net/driver/netnfpprovider.inx b/nfp/net/driver/netnfpprovider.inx index 1adf15b7..fa19a86d 100644 Binary files a/nfp/net/driver/netnfpprovider.inx and b/nfp/net/driver/netnfpprovider.inx differ diff --git a/pofx/PEP/acpi/sampleacpipep.inx b/pofx/PEP/acpi/sampleacpipep.inx index 158fed33..b4059974 100644 Binary files a/pofx/PEP/acpi/sampleacpipep.inx and b/pofx/PEP/acpi/sampleacpipep.inx differ diff --git a/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx b/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx index 7eab5b70..4883fc28 100644 Binary files a/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx and b/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx differ diff --git a/pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.inx b/pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.inx index 3a02e75f..c6c65e74 100644 Binary files a/pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.inx and b/pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.inx differ diff --git a/pofx/WDF/Driver/SingleComp/SingleComponentFStateSample.inx b/pofx/WDF/Driver/SingleComp/SingleComponentFStateSample.inx index 2a15c660..277e4828 100644 Binary files a/pofx/WDF/Driver/SingleComp/SingleComponentFStateSample.inx and b/pofx/WDF/Driver/SingleComp/SingleComponentFStateSample.inx differ diff --git a/print/autoconfig/AutoCnfg.inf b/print/autoconfig/AutoCnfg.inf index 70cd5a53..79d871d9 100644 --- a/print/autoconfig/AutoCnfg.inf +++ b/print/autoconfig/AutoCnfg.inf @@ -13,6 +13,7 @@ ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318} Class=Printer DriverVer=11/17/2005,1.0.0.2 CatalogFile=AutoCnfg.cat +PnpLockdown=1 ; ; Manufacturer section. diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.inf b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.inf index b4326484..7c237031 100644 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.inf +++ b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.inf @@ -13,6 +13,7 @@ ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318} Class=Printer DriverVer=03/12/2013,1.0.0.1 ClassVer=4.0 +PnpLockdown=1 ; ; Manufacturer section. -- cgit v1.3.1 From d475c9bca937ddbd72b8b423783a140356306fb0 Mon Sep 17 00:00:00 2001 From: 薄景仁 Date: Tue, 11 Oct 2022 06:24:56 +0800 Subject: [usb/usbview] fix infinite loop (#792) --- usb/usbview/xmlhelper.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/usb/usbview/xmlhelper.cpp b/usb/usbview/xmlhelper.cpp index f67c9587..6ed0f61b 100644 --- a/usb/usbview/xmlhelper.cpp +++ b/usb/usbview/xmlhelper.cpp @@ -2071,6 +2071,7 @@ String ^ XmlGetStringDescriptor(UCHAR index, PSTRING_DESCRIPTOR_NODE stringDesc, { // If we are required to return only english descriptor, continue foundNonEnglishDescriptor = true; + stringDesc = stringDesc->Next; continue; } -- cgit v1.3.1 From f20a01318ddb570731de91f62e94b37550139b28 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 14 Oct 2022 13:50:18 -0700 Subject: Fix some infverif 1203 (missing section) and 1324 (no PnpLockdown=1) errors (#793) * Clean up some misc infverif 1203 errors * Clean up some infverif 1324 (no PnpLockdown=1) errors --- TrEE/Miniport/TrEEMiniportSample.inf | Bin 4652 -> 4682 bytes TrEE/OSService/TrEEOSServiceSample.inf | Bin 4572 -> 4602 bytes biometrics/driver/WudfBioUsbSample.inx | Bin 10470 -> 10500 bytes general/toaster/toastpkg/inf/toastpkg.inf | 4 ++-- general/toaster/toastpkg/toastcd/toastpkg.inf | 4 ++-- network/modem/fakemodem/mdmfake.inx | Bin 24198 -> 24276 bytes print/XPSDrvSmpl/install/xdsmpl.inf | 1 + print/XpsRasFilter/install/xpsrassmpl.inf | 1 + sd/miniport/sdhc/sdhc.inx | Bin 7864 -> 7894 bytes sensors/ADXL345Acc/ADXL345Acc.inx | Bin 4986 -> 5020 bytes sensors/Activity/Activity.inx | Bin 4790 -> 4824 bytes sensors/CustomSensors/CustomSensors.inx | Bin 5054 -> 5088 bytes sensors/Fusion/FusionSensor.inx | Bin 4990 -> 5024 bytes sensors/Pedometer/Pedometer.inx | Bin 4840 -> 4874 bytes sensors/SensorsComboDriver/SensorsComboDriver.inx | Bin 5262 -> 5296 bytes .../SimpleDeviceOrientationSensor.inx | Bin 5972 -> 6006 bytes serial/VirtualSerial/ComPort/virtualserial.inx | Bin 4228 -> 4258 bytes serial/VirtualSerial/FakeModem/fakemodem.inx | Bin 16888 -> 16918 bytes serial/VirtualSerial2/ComPort/virtualserial2um.inx | Bin 4160 -> 4190 bytes serial/VirtualSerial2/FakeModem/fakemodem2um.inx | Bin 16566 -> 16596 bytes serial/serial/serial.inx | Bin 6212 -> 6238 bytes simbatt/func/simbatt-wdfcoinstall.inx | 1 + simbatt/func/simbatt.inx | Bin 3862 -> 3892 bytes spb/SkeletonI2C/skeletoni2c.inx | Bin 3874 -> 3904 bytes spb/SpbTestTool/sys/spbtesttool.inx | Bin 4688 -> 4722 bytes storage/class/cdrom/src/cdrom.inf | Bin 8312 -> 8366 bytes storage/class/disk/src/diskdev.inf | 1 + storage/miniports/lsi_u3/src/lsi_u3.inf | Bin 6022 -> 6052 bytes storage/sfloppy/src/sfloppy.inf | 1 + thermal/simsensor/simsensor.inf | 1 + thermal/thermalclient/simtc.inf | 1 + usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx | Bin 5984 -> 6010 bytes usb/kmdf_fx2/driver/osrusbfx2.inx | Bin 7628 -> 7654 bytes usb/ufxclientsample/UfxClientSample.inx | Bin 4136 -> 4170 bytes usb/umdf2_fx2/driver/osrusbfx2um.inx | Bin 6348 -> 6378 bytes .../umdf_filter/WUDFOsrUsbFilterOnKmDriver.inx | Bin 6620 -> 6646 bytes .../umdf_filter/WUDFOsrUsbFilterOnUmFx2Driver.inx | Bin 6224 -> 6254 bytes usb/umdf_fx2/driver/WUDFOsrUsbFx2.inx | Bin 6356 -> 6386 bytes usb/usbsamp/sys/driver/usbsamp.inx | Bin 6444 -> 6470 bytes usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx | Bin 5540 -> 5566 bytes usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx | Bin 5540 -> 5566 bytes usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx | Bin 5540 -> 5566 bytes usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx | Bin 5540 -> 5566 bytes usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx | Bin 5540 -> 5566 bytes usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.inx | Bin 5254 -> 5284 bytes usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.inx | Bin 5254 -> 5284 bytes usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.inx | Bin 5254 -> 5284 bytes usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.inx | Bin 5254 -> 5284 bytes video/KMDOD/Sample/sampledisplay.inf | Bin 5936 -> 5960 bytes wia/ProdScan/ProdScan.inf | 3 ++- wia/microdrv/testmcro.inf | 1 + wia/wiadriverex/wiadriver.inf | 1 + .../WpdBasicHardwareDriver.inx | 1 + .../WpdMultiTransportDriver.inx | 1 + .../WpdServiceSampleDriver.inx | 1 + wpd/WpdWudfSampleDriver/WpdWudfSampleDriver.inx | Bin 4074 -> 4104 bytes 56 files changed, 18 insertions(+), 5 deletions(-) diff --git a/TrEE/Miniport/TrEEMiniportSample.inf b/TrEE/Miniport/TrEEMiniportSample.inf index c1ba30a2..f9b0716f 100644 Binary files a/TrEE/Miniport/TrEEMiniportSample.inf and b/TrEE/Miniport/TrEEMiniportSample.inf differ diff --git a/TrEE/OSService/TrEEOSServiceSample.inf b/TrEE/OSService/TrEEOSServiceSample.inf index e14149b9..e283ff98 100644 Binary files a/TrEE/OSService/TrEEOSServiceSample.inf and b/TrEE/OSService/TrEEOSServiceSample.inf differ diff --git a/biometrics/driver/WudfBioUsbSample.inx b/biometrics/driver/WudfBioUsbSample.inx index f28f74c4..bd32c0dc 100644 Binary files a/biometrics/driver/WudfBioUsbSample.inx and b/biometrics/driver/WudfBioUsbSample.inx differ diff --git a/general/toaster/toastpkg/inf/toastpkg.inf b/general/toaster/toastpkg/inf/toastpkg.inf index 04ac6103..5068d751 100644 --- a/general/toaster/toastpkg/inf/toastpkg.inf +++ b/general/toaster/toastpkg/inf/toastpkg.inf @@ -28,6 +28,7 @@ DriverVer=09/21/2006,6.0.5736.1 CatalogFile.NTx86 = tostx86.cat CatalogFile.NTIA64 = tostia64.cat CatalogFile.NTAMD64 = tstamd64.cat +PnpLockdown=1 [DestinationDirs] DefaultDestDir = 12 @@ -36,8 +37,7 @@ CoInstaller_CopyFiles = 11 ; ================= Class section ===================== [ClassInstall32] -Addreg=ToasterClassReg -CopyFiles=ToasterClassInstallerCopyFiles +Addreg=ToasterClassReg [ToasterClassReg] HKR,,,0,%ClassName% diff --git a/general/toaster/toastpkg/toastcd/toastpkg.inf b/general/toaster/toastpkg/toastcd/toastpkg.inf index 04ac6103..5068d751 100644 --- a/general/toaster/toastpkg/toastcd/toastpkg.inf +++ b/general/toaster/toastpkg/toastcd/toastpkg.inf @@ -28,6 +28,7 @@ DriverVer=09/21/2006,6.0.5736.1 CatalogFile.NTx86 = tostx86.cat CatalogFile.NTIA64 = tostia64.cat CatalogFile.NTAMD64 = tstamd64.cat +PnpLockdown=1 [DestinationDirs] DefaultDestDir = 12 @@ -36,8 +37,7 @@ CoInstaller_CopyFiles = 11 ; ================= Class section ===================== [ClassInstall32] -Addreg=ToasterClassReg -CopyFiles=ToasterClassInstallerCopyFiles +Addreg=ToasterClassReg [ToasterClassReg] HKR,,,0,%ClassName% diff --git a/network/modem/fakemodem/mdmfake.inx b/network/modem/fakemodem/mdmfake.inx index 8886b9e6..688cd08f 100644 Binary files a/network/modem/fakemodem/mdmfake.inx and b/network/modem/fakemodem/mdmfake.inx differ diff --git a/print/XPSDrvSmpl/install/xdsmpl.inf b/print/XPSDrvSmpl/install/xdsmpl.inf index 5d93dfbd..2514a3ec 100644 --- a/print/XPSDrvSmpl/install/xdsmpl.inf +++ b/print/XPSDrvSmpl/install/xdsmpl.inf @@ -22,6 +22,7 @@ Provider=%ProviderString% ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318} Class=Printer DriverVer=10/17/2008,6.1.6930.0 +PnpLockdown=1 [Manufacturer] %ManufacturerName%=Standard,NTx86,NTia64,NTamd64,NTx86.6.0,NTia64.6.0,NTamd64.6.0,NTarm64.6.0 diff --git a/print/XpsRasFilter/install/xpsrassmpl.inf b/print/XpsRasFilter/install/xpsrassmpl.inf index d16530be..3136be00 100644 --- a/print/XpsRasFilter/install/xpsrassmpl.inf +++ b/print/XpsRasFilter/install/xpsrassmpl.inf @@ -22,6 +22,7 @@ Provider=%ProviderString% ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318} Class=Printer DriverVer=10/17/2008,6.1.6930.0 +PnpLockdown=1 [Manufacturer] %ManufacturerName%=Standard,NTx86.6.1,NTia64.6.1,NTamd64.6.1,NTarm64.6.1 diff --git a/sd/miniport/sdhc/sdhc.inx b/sd/miniport/sdhc/sdhc.inx index 8bfb88a6..31e3a964 100644 Binary files a/sd/miniport/sdhc/sdhc.inx and b/sd/miniport/sdhc/sdhc.inx differ diff --git a/sensors/ADXL345Acc/ADXL345Acc.inx b/sensors/ADXL345Acc/ADXL345Acc.inx index 14ae5aad..fefa0961 100644 Binary files a/sensors/ADXL345Acc/ADXL345Acc.inx and b/sensors/ADXL345Acc/ADXL345Acc.inx differ diff --git a/sensors/Activity/Activity.inx b/sensors/Activity/Activity.inx index 01f2fd3b..e7591ddb 100644 Binary files a/sensors/Activity/Activity.inx and b/sensors/Activity/Activity.inx differ diff --git a/sensors/CustomSensors/CustomSensors.inx b/sensors/CustomSensors/CustomSensors.inx index fb73ab41..4792a9c0 100644 Binary files a/sensors/CustomSensors/CustomSensors.inx and b/sensors/CustomSensors/CustomSensors.inx differ diff --git a/sensors/Fusion/FusionSensor.inx b/sensors/Fusion/FusionSensor.inx index 1c562304..07757f3a 100644 Binary files a/sensors/Fusion/FusionSensor.inx and b/sensors/Fusion/FusionSensor.inx differ diff --git a/sensors/Pedometer/Pedometer.inx b/sensors/Pedometer/Pedometer.inx index bb6cb2a2..9b88aeac 100644 Binary files a/sensors/Pedometer/Pedometer.inx and b/sensors/Pedometer/Pedometer.inx differ diff --git a/sensors/SensorsComboDriver/SensorsComboDriver.inx b/sensors/SensorsComboDriver/SensorsComboDriver.inx index 36389fad..5ce6c23e 100644 Binary files a/sensors/SensorsComboDriver/SensorsComboDriver.inx and b/sensors/SensorsComboDriver/SensorsComboDriver.inx differ diff --git a/sensors/SimpleDeviceOrientationSensor/SimpleDeviceOrientationSensor.inx b/sensors/SimpleDeviceOrientationSensor/SimpleDeviceOrientationSensor.inx index 6dbbf7be..273a9f66 100644 Binary files a/sensors/SimpleDeviceOrientationSensor/SimpleDeviceOrientationSensor.inx and b/sensors/SimpleDeviceOrientationSensor/SimpleDeviceOrientationSensor.inx differ diff --git a/serial/VirtualSerial/ComPort/virtualserial.inx b/serial/VirtualSerial/ComPort/virtualserial.inx index d7c8f01c..4782e2f2 100644 Binary files a/serial/VirtualSerial/ComPort/virtualserial.inx and b/serial/VirtualSerial/ComPort/virtualserial.inx differ diff --git a/serial/VirtualSerial/FakeModem/fakemodem.inx b/serial/VirtualSerial/FakeModem/fakemodem.inx index 54cf099d..a57b6314 100644 Binary files a/serial/VirtualSerial/FakeModem/fakemodem.inx and b/serial/VirtualSerial/FakeModem/fakemodem.inx differ diff --git a/serial/VirtualSerial2/ComPort/virtualserial2um.inx b/serial/VirtualSerial2/ComPort/virtualserial2um.inx index 6d95d795..94ffc922 100644 Binary files a/serial/VirtualSerial2/ComPort/virtualserial2um.inx and b/serial/VirtualSerial2/ComPort/virtualserial2um.inx differ diff --git a/serial/VirtualSerial2/FakeModem/fakemodem2um.inx b/serial/VirtualSerial2/FakeModem/fakemodem2um.inx index 35bbc3c5..1dc1c32e 100644 Binary files a/serial/VirtualSerial2/FakeModem/fakemodem2um.inx and b/serial/VirtualSerial2/FakeModem/fakemodem2um.inx differ diff --git a/serial/serial/serial.inx b/serial/serial/serial.inx index 3322653b..1879188c 100644 Binary files a/serial/serial/serial.inx and b/serial/serial/serial.inx differ diff --git a/simbatt/func/simbatt-wdfcoinstall.inx b/simbatt/func/simbatt-wdfcoinstall.inx index 21696763..15c596ab 100644 --- a/simbatt/func/simbatt-wdfcoinstall.inx +++ b/simbatt/func/simbatt-wdfcoinstall.inx @@ -25,6 +25,7 @@ ClassGuid={72631e54-78a4-11d0-bcf7-00aa00b7b32a} Provider=%ProviderName% DriverVer=04/30/2008, 6.01.6598 CatalogFile=simbatt-wdfcoinstall.cat ; TODO: Add a signed catalog file +PnpLockdown=1 [DestinationDirs] DefaultDestDir = 12 diff --git a/simbatt/func/simbatt.inx b/simbatt/func/simbatt.inx index 4f249563..3b138e05 100644 Binary files a/simbatt/func/simbatt.inx and b/simbatt/func/simbatt.inx differ diff --git a/spb/SkeletonI2C/skeletoni2c.inx b/spb/SkeletonI2C/skeletoni2c.inx index 1a911e9d..736fe247 100644 Binary files a/spb/SkeletonI2C/skeletoni2c.inx and b/spb/SkeletonI2C/skeletoni2c.inx differ diff --git a/spb/SpbTestTool/sys/spbtesttool.inx b/spb/SpbTestTool/sys/spbtesttool.inx index ae1a4fe4..390e6984 100644 Binary files a/spb/SpbTestTool/sys/spbtesttool.inx and b/spb/SpbTestTool/sys/spbtesttool.inx differ diff --git a/storage/class/cdrom/src/cdrom.inf b/storage/class/cdrom/src/cdrom.inf index d74fe65b..47245307 100644 Binary files a/storage/class/cdrom/src/cdrom.inf and b/storage/class/cdrom/src/cdrom.inf differ diff --git a/storage/class/disk/src/diskdev.inf b/storage/class/disk/src/diskdev.inf index 73a26b23..4db49829 100644 --- a/storage/class/disk/src/diskdev.inf +++ b/storage/class/disk/src/diskdev.inf @@ -15,6 +15,7 @@ ClassGUID={4d36e967-e325-11ce-bfc1-08002be10318} Class=DiskDrive DriverVer=08/27/1999,5.2.1425.0 ;CatalogFile=your_cat_here.cat ; Supply your own catalog file here. +PnpLockdown=1 [DestinationDirs] DefaultDestDir = 12 diff --git a/storage/miniports/lsi_u3/src/lsi_u3.inf b/storage/miniports/lsi_u3/src/lsi_u3.inf index 8d631d41..821c9555 100644 Binary files a/storage/miniports/lsi_u3/src/lsi_u3.inf and b/storage/miniports/lsi_u3/src/lsi_u3.inf differ diff --git a/storage/sfloppy/src/sfloppy.inf b/storage/sfloppy/src/sfloppy.inf index 5eb2f79a..2f5c4bbd 100644 --- a/storage/sfloppy/src/sfloppy.inf +++ b/storage/sfloppy/src/sfloppy.inf @@ -11,6 +11,7 @@ ClassGuid={4D36E980-E325-11CE-BFC1-08002BE10318} Provider=%ProviderString% CatalogFile=ddk_sample.cat DriverVer=05/17/2002,5.2.3635.0 +PnpLockdown=1 ;You must specify which platform is supported by each SourceDisksNames section ;Valid platform identifiers include .x86, .ia64, .alpha, .axp64 diff --git a/thermal/simsensor/simsensor.inf b/thermal/simsensor/simsensor.inf index dad037e1..63f7a368 100644 --- a/thermal/simsensor/simsensor.inf +++ b/thermal/simsensor/simsensor.inf @@ -19,6 +19,7 @@ ClassGuid={4D36E97D-E325-11CE-BFC1-08002BE10318} Provider=%ProviderString% DriverVer=09/02/2011, 6.02.8105 CatalogFile=simsensor.cat +PnpLockdown=1 [DestinationDirs] DefaultDestDir = 12 diff --git a/thermal/thermalclient/simtc.inf b/thermal/thermalclient/simtc.inf index 74148cad..7e607612 100644 --- a/thermal/thermalclient/simtc.inf +++ b/thermal/thermalclient/simtc.inf @@ -19,6 +19,7 @@ ClassGuid={4D36E97D-E325-11CE-BFC1-08002BE10318} Provider=%ProviderString% DriverVer=07/22/2011, 6.02.8040 CatalogFile=thermalclient.cat +PnpLockdown=1 [DestinationDirs] DefaultDestDir = 12 diff --git a/usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx b/usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx index 7336000f..4ba231a7 100644 Binary files a/usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx and b/usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx differ diff --git a/usb/kmdf_fx2/driver/osrusbfx2.inx b/usb/kmdf_fx2/driver/osrusbfx2.inx index 68e0ff48..c40a9192 100644 Binary files a/usb/kmdf_fx2/driver/osrusbfx2.inx and b/usb/kmdf_fx2/driver/osrusbfx2.inx differ diff --git a/usb/ufxclientsample/UfxClientSample.inx b/usb/ufxclientsample/UfxClientSample.inx index 51525cc8..7ee9f649 100644 Binary files a/usb/ufxclientsample/UfxClientSample.inx and b/usb/ufxclientsample/UfxClientSample.inx differ diff --git a/usb/umdf2_fx2/driver/osrusbfx2um.inx b/usb/umdf2_fx2/driver/osrusbfx2um.inx index f7f8f16c..baa04707 100644 Binary files a/usb/umdf2_fx2/driver/osrusbfx2um.inx and b/usb/umdf2_fx2/driver/osrusbfx2um.inx differ diff --git a/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilterOnKmDriver.inx b/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilterOnKmDriver.inx index 6cf1f091..cc64a1d4 100644 Binary files a/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilterOnKmDriver.inx and b/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilterOnKmDriver.inx differ diff --git a/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilterOnUmFx2Driver.inx b/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilterOnUmFx2Driver.inx index 27f04d75..b8ff8b0f 100644 Binary files a/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilterOnUmFx2Driver.inx and b/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilterOnUmFx2Driver.inx differ diff --git a/usb/umdf_fx2/driver/WUDFOsrUsbFx2.inx b/usb/umdf_fx2/driver/WUDFOsrUsbFx2.inx index 4f21c018..b9e32223 100644 Binary files a/usb/umdf_fx2/driver/WUDFOsrUsbFx2.inx and b/usb/umdf_fx2/driver/WUDFOsrUsbFx2.inx differ diff --git a/usb/usbsamp/sys/driver/usbsamp.inx b/usb/usbsamp/sys/driver/usbsamp.inx index 5b16de78..9f4cf03a 100644 Binary files a/usb/usbsamp/sys/driver/usbsamp.inx and b/usb/usbsamp/sys/driver/usbsamp.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx index c8678d1e..f2172744 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx index c8678d1e..f2172744 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx index c8678d1e..f2172744 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx index c8678d1e..f2172744 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx index c8678d1e..f2172744 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx differ diff --git a/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.inx b/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.inx index 1b11d447..4a439824 100644 Binary files a/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.inx and b/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.inx differ diff --git a/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.inx b/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.inx index 30529676..2e6a18f8 100644 Binary files a/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.inx and b/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.inx differ diff --git a/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.inx b/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.inx index 92f29a24..1430ec45 100644 Binary files a/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.inx and b/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.inx differ diff --git a/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.inx b/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.inx index 1eff425c..225c377f 100644 Binary files a/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.inx and b/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.inx differ diff --git a/video/KMDOD/Sample/sampledisplay.inf b/video/KMDOD/Sample/sampledisplay.inf index 8f666e4d..949e981c 100644 Binary files a/video/KMDOD/Sample/sampledisplay.inf and b/video/KMDOD/Sample/sampledisplay.inf differ diff --git a/wia/ProdScan/ProdScan.inf b/wia/ProdScan/ProdScan.inf index 9ff8d18b..26359afa 100644 --- a/wia/ProdScan/ProdScan.inf +++ b/wia/ProdScan/ProdScan.inf @@ -11,7 +11,8 @@ Class=Image ClassGUID={6bdd1fc6-810f-11d0-bec7-08002be2092f} Provider=%ProviderString% DriverVer=10/16/2015,1.0.0.2 -CatalogFile = prodscan.cat +CatalogFile=prodscan.cat +PnpLockdown=1 [SourceDisksFiles] ProdScan.dll=1 diff --git a/wia/microdrv/testmcro.inf b/wia/microdrv/testmcro.inf index 4b59377f..13e5b682 100644 --- a/wia/microdrv/testmcro.inf +++ b/wia/microdrv/testmcro.inf @@ -9,6 +9,7 @@ ClassGUID={6bdd1fc6-810f-11d0-bec7-08002be2092f} Provider=%ProviderString% DriverVer=11/02/2007,1.0.0.1 CatalogFile=testmcro.cat +PnpLockdown=1 [SourceDisksFiles.x86] testmcro.dll=1 diff --git a/wia/wiadriverex/wiadriver.inf b/wia/wiadriverex/wiadriver.inf index c478af70..b0d37528 100644 --- a/wia/wiadriverex/wiadriver.inf +++ b/wia/wiadriverex/wiadriver.inf @@ -9,6 +9,7 @@ ClassGUID={6bdd1fc6-810f-11d0-bec7-08002be2092f} Provider=%ProviderString% DriverVer=09/20/2004,1.0.0.7 CatalogFile=wiadriver.cat +PnpLockdown=1 [SourceDisksFiles] wiadriverex.dll=1 diff --git a/wpd/WpdBasicHardwareDriver/WpdBasicHardwareDriver.inx b/wpd/WpdBasicHardwareDriver/WpdBasicHardwareDriver.inx index 493a1964..4f11ac23 100644 --- a/wpd/WpdBasicHardwareDriver/WpdBasicHardwareDriver.inx +++ b/wpd/WpdBasicHardwareDriver/WpdBasicHardwareDriver.inx @@ -9,6 +9,7 @@ ClassGuid={EEC5AD98-8080-425f-922A-DABF3DE3F69A} Provider=%Provider% CatalogFile=WpdBasicHardwareDriver.cat DriverVer=01/24/2007,1.1.1.1 +PnpLockdown=1 [Manufacturer] %Mfg%=Standard,NT$ARCH$ diff --git a/wpd/WpdMultiTransportDriver/WpdMultiTransportDriver.inx b/wpd/WpdMultiTransportDriver/WpdMultiTransportDriver.inx index 5e20c4c3..b8504e04 100644 --- a/wpd/WpdMultiTransportDriver/WpdMultiTransportDriver.inx +++ b/wpd/WpdMultiTransportDriver/WpdMultiTransportDriver.inx @@ -9,6 +9,7 @@ ClassGuid={EEC5AD98-8080-425f-922A-DABF3DE3F69A} Provider=%Provider% CatalogFile=WpdMultiTransportDriver.cat DriverVer=01/24/2005,1.1.1.1 +PnpLockdown=1 [Manufacturer] %Mfg%=Standard,NT$ARCH$ diff --git a/wpd/WpdServiceSampleDriver/WpdServiceSampleDriver.inx b/wpd/WpdServiceSampleDriver/WpdServiceSampleDriver.inx index 0f4365cc..cbf328ca 100644 --- a/wpd/WpdServiceSampleDriver/WpdServiceSampleDriver.inx +++ b/wpd/WpdServiceSampleDriver/WpdServiceSampleDriver.inx @@ -9,6 +9,7 @@ ClassGuid={EEC5AD98-8080-425f-922A-DABF3DE3F69A} Provider=%Provider% CatalogFile=WpdServiceSampleDriver.cat DriverVer=01/24/2007,1.1.1.1 +PnpLockdown=1 [Manufacturer] %Mfg%=Standard,NT$ARCH$ diff --git a/wpd/WpdWudfSampleDriver/WpdWudfSampleDriver.inx b/wpd/WpdWudfSampleDriver/WpdWudfSampleDriver.inx index a2e11b1b..7eddbacb 100644 Binary files a/wpd/WpdWudfSampleDriver/WpdWudfSampleDriver.inx and b/wpd/WpdWudfSampleDriver/WpdWudfSampleDriver.inx differ -- cgit v1.3.1 From 82537c2a1da27908ffbc5d98a7ad77e6af0956c8 Mon Sep 17 00:00:00 2001 From: taj0207 Date: Wed, 9 Nov 2022 11:31:14 -0800 Subject: Add mobile broadband mbbcx client driver sample code (#797) --- network/wwan/cxwmbclass/README.md | 14 + network/wwan/cxwmbclass/adapter.cpp | 197 ++ network/wwan/cxwmbclass/businit.cpp | 1906 ++++++++++++ network/wwan/cxwmbclass/cxwmbclass.rc | 20 + network/wwan/cxwmbclass/cxwmbclass.sln | 35 + network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf | 119 + .../wwan/cxwmbclass/cxwmbclass/cxwmbclass.vcxproj | 176 ++ .../cxwmbclass/cxwmbclass.vcxproj.filters | 107 + network/wwan/cxwmbclass/datapipe.cpp | 998 ++++++ network/wwan/cxwmbclass/device.cpp | 381 +++ network/wwan/cxwmbclass/driver.cpp | 120 + network/wwan/cxwmbclass/inc/BusInterface.h | 573 ++++ network/wwan/cxwmbclass/inc/MbbLibrary.h | 175 ++ network/wwan/cxwmbclass/inc/adapter.h | 53 + network/wwan/cxwmbclass/inc/align.h | 168 + network/wwan/cxwmbclass/inc/data.h | 185 ++ network/wwan/cxwmbclass/inc/device.h | 45 + network/wwan/cxwmbclass/inc/mbbmessages.h | 3273 ++++++++++++++++++++ network/wwan/cxwmbclass/inc/mbbncm.h | 431 +++ network/wwan/cxwmbclass/inc/power.h | 11 + network/wwan/cxwmbclass/inc/precomp.h | 53 + network/wwan/cxwmbclass/inc/rxqueue.h | 26 + network/wwan/cxwmbclass/inc/txqueue.h | 22 + network/wwan/cxwmbclass/inc/usbbus.h | 235 ++ network/wwan/cxwmbclass/inc/util.h | 42 + network/wwan/cxwmbclass/inc/utils.h | 61 + network/wwan/cxwmbclass/power.cpp | 116 + network/wwan/cxwmbclass/rxqueue.cpp | 602 ++++ network/wwan/cxwmbclass/sources.inc | 12 + network/wwan/cxwmbclass/txqueue.cpp | 988 ++++++ network/wwan/cxwmbclass/util.cpp | 326 ++ network/wwan/cxwmbclass/utils.cpp | 588 ++++ 32 files changed, 12058 insertions(+) create mode 100644 network/wwan/cxwmbclass/README.md create mode 100644 network/wwan/cxwmbclass/adapter.cpp create mode 100644 network/wwan/cxwmbclass/businit.cpp create mode 100644 network/wwan/cxwmbclass/cxwmbclass.rc create mode 100644 network/wwan/cxwmbclass/cxwmbclass.sln create mode 100644 network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf create mode 100644 network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.vcxproj create mode 100644 network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.vcxproj.filters create mode 100644 network/wwan/cxwmbclass/datapipe.cpp create mode 100644 network/wwan/cxwmbclass/device.cpp create mode 100644 network/wwan/cxwmbclass/driver.cpp create mode 100644 network/wwan/cxwmbclass/inc/BusInterface.h create mode 100644 network/wwan/cxwmbclass/inc/MbbLibrary.h create mode 100644 network/wwan/cxwmbclass/inc/adapter.h create mode 100644 network/wwan/cxwmbclass/inc/align.h create mode 100644 network/wwan/cxwmbclass/inc/data.h create mode 100644 network/wwan/cxwmbclass/inc/device.h create mode 100644 network/wwan/cxwmbclass/inc/mbbmessages.h create mode 100644 network/wwan/cxwmbclass/inc/mbbncm.h create mode 100644 network/wwan/cxwmbclass/inc/power.h create mode 100644 network/wwan/cxwmbclass/inc/precomp.h create mode 100644 network/wwan/cxwmbclass/inc/rxqueue.h create mode 100644 network/wwan/cxwmbclass/inc/txqueue.h create mode 100644 network/wwan/cxwmbclass/inc/usbbus.h create mode 100644 network/wwan/cxwmbclass/inc/util.h create mode 100644 network/wwan/cxwmbclass/inc/utils.h create mode 100644 network/wwan/cxwmbclass/power.cpp create mode 100644 network/wwan/cxwmbclass/rxqueue.cpp create mode 100644 network/wwan/cxwmbclass/sources.inc create mode 100644 network/wwan/cxwmbclass/txqueue.cpp create mode 100644 network/wwan/cxwmbclass/util.cpp create mode 100644 network/wwan/cxwmbclass/utils.cpp diff --git a/network/wwan/cxwmbclass/README.md b/network/wwan/cxwmbclass/README.md new file mode 100644 index 00000000..d0b04978 --- /dev/null +++ b/network/wwan/cxwmbclass/README.md @@ -0,0 +1,14 @@ +--- +page_type: sample +description: "Demonstrates use of the cxwmbclass driver." +languages: +- c +products: +- windows +- windows-wdk +--- + +# cxwmbclass samples + +This sample demonstrates use of the cxwmbclass. + diff --git a/network/wwan/cxwmbclass/adapter.cpp b/network/wwan/cxwmbclass/adapter.cpp new file mode 100644 index 00000000..ed60b427 --- /dev/null +++ b/network/wwan/cxwmbclass/adapter.cpp @@ -0,0 +1,197 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#include "precomp.h" + +#include "device.h" +#include "txqueue.h" +#include "rxqueue.h" + +_Use_decl_annotations_ NTSTATUS WmbClassAdapterStart(NETADAPTER netAdapter) +{ + NTSTATUS status = STATUS_SUCCESS; + PWMBCLASS_NETADAPTER_CONTEXT netAdapterContext = WmbClassGetNetAdapterContext(netAdapter); + PWMBCLASS_DEVICE_CONTEXT deviceContext = netAdapterContext->WmbDeviceContext; + + ULONG64 maxXmitLinkSpeed = MBB_MEDIA_MAX_SPEED; + ULONG64 maxRcvLinkSpeed = MBB_MEDIA_MAX_SPEED; + DWORD maxPowerFilterSize = 0; + + NET_ADAPTER_LINK_LAYER_CAPABILITIES linkLayerCapabilities; + NET_ADAPTER_LINK_LAYER_CAPABILITIES_INIT(&linkLayerCapabilities, maxXmitLinkSpeed, maxRcvLinkSpeed); + + NetAdapterSetLinkLayerCapabilities(netAdapter, &linkLayerCapabilities); + + if (deviceContext->BusParams.IsErrataDevice) + { + NetAdapterSetLinkLayerMtuSize(netAdapter, deviceContext->BusParams.MTU); + } + else + { + NetAdapterSetLinkLayerMtuSize(netAdapter, deviceContext->BusParams.MaxSegmentSize); + } + + if (deviceContext->BusParams.PowerFiltersSupported > 0) + { + NET_ADAPTER_WAKE_BITMAP_CAPABILITIES bitmapCapabilities; + NET_ADAPTER_WAKE_BITMAP_CAPABILITIES_INIT(&bitmapCapabilities); + + bitmapCapabilities.BitmapPattern = TRUE; + bitmapCapabilities.MaximumPatternCount = deviceContext->BusParams.PowerFiltersSupported; + + if (deviceContext->BusParams.IsErrataDevice) + { + // For errata devices we will report the device specific max pattern size. + // 192 bytes is the maximum power filter size as per the MBIM spec. + // If a device reports more than 192 bytes as the power filter size, we + // normalize it here to 192 bytes. This will prevent erroneous devices + // from indicating arbitrary pattern size. This needs to change with any + // MBIM spec revision. + + if (deviceContext->BusParams.MaxPowerFilterSize > WMBCLASS_MAX_MBIM_WOL_PATTERN) + { + maxPowerFilterSize = WMBCLASS_MAX_MBIM_WOL_PATTERN; + } + else + { + maxPowerFilterSize = deviceContext->BusParams.MaxPowerFilterSize; + } + } + else + { + // To maintain backward compatibility with Win8 devices, we continue + // reporting 256 bytes as the wake pattern size. + maxPowerFilterSize = WMBCLASS_MAX_WOL_PATTERN; + } + + bitmapCapabilities.MaximumPatternSize = maxPowerFilterSize; + + NetAdapterWakeSetBitmapCapabilities(netAdapter, &bitmapCapabilities); + } + + NET_ADAPTER_WAKE_MEDIA_CHANGE_CAPABILITIES wakeMediaChangeCapabilities; + NET_ADAPTER_WAKE_MEDIA_CHANGE_CAPABILITIES_INIT(&wakeMediaChangeCapabilities); + + wakeMediaChangeCapabilities.MediaConnect = TRUE; + wakeMediaChangeCapabilities.MediaDisconnect = TRUE; + + NetAdapterWakeSetMediaChangeCapabilities(netAdapter, &wakeMediaChangeCapabilities); + + if (deviceContext->BusParams.SelectiveSuspendSupported) + { + NET_ADAPTER_WAKE_PACKET_FILTER_CAPABILITIES wakePacketFilterCapabilities; + NET_ADAPTER_WAKE_PACKET_FILTER_CAPABILITIES_INIT(&wakePacketFilterCapabilities); + wakePacketFilterCapabilities.PacketFilterMatch = TRUE; + + NetAdapterWakeSetPacketFilterCapabilities(netAdapter, &wakePacketFilterCapabilities); + } + + NET_ADAPTER_TX_CAPABILITIES txCapabilities; + NET_ADAPTER_TX_CAPABILITIES_INIT(&txCapabilities, 1); + NET_ADAPTER_RX_CAPABILITIES rxCapabilities; + NET_ADAPTER_RX_CAPABILITIES_INIT_DRIVER_MANAGED(&rxCapabilities, EvtAdapterReturnRxBuffer, MBB_MAX_PACKET_SIZE, 1); + + NetAdapterSetDataPathCapabilities(netAdapter, &txCapabilities, &rxCapabilities); + + status = NetAdapterStart(netAdapter); + + return status; +} + +NTSTATUS +EvtAdapterCreateTxQueue(_In_ NETADAPTER netAdapter, _Inout_ NETTXQUEUE_INIT* txQueueInit) +{ + NTSTATUS status = STATUS_SUCCESS; + PMBB_TXQUEUE_CONTEXT txQueueContext = NULL; + PWMBCLASS_NETADAPTER_CONTEXT netAdapterContext = WmbClassGetNetAdapterContext(netAdapter); + PWMBCLASS_DEVICE_CONTEXT deviceContext = netAdapterContext->WmbDeviceContext; + WDF_OBJECT_ATTRIBUTES txAttributes; + NET_EXTENSION_QUERY extension; + + WDF_OBJECT_ATTRIBUTES_INIT(&txAttributes); + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&txAttributes, MBB_TXQUEUE_CONTEXT); + + txAttributes.EvtDestroyCallback = EvtTxQueueDestroy; + + NET_PACKET_QUEUE_CONFIG queueConfig; + NET_PACKET_QUEUE_CONFIG_INIT(&queueConfig, EvtTxQueueAdvance, EvtTxQueueSetNotificationEnabled, EvtTxQueueCancel); + + NETPACKETQUEUE txQueue; + status = NetTxQueueCreate(txQueueInit, &txAttributes, &queueConfig, &txQueue); + + if (!NT_SUCCESS(status)) + { + goto Exit; + } + + txQueueContext = MbbGetTxQueueContext(txQueue); + + + txQueueContext->NetAdapterContext = netAdapterContext; + txQueueContext->DatapathDescriptor = NetTxQueueGetRingCollection(txQueue); + + // Try to use MaxOutDatagrams parameter as the tx completion batch size, but limit to half of the packet ring buffer + auto maxBatchSize = NetRingCollectionGetPacketRing(txQueueContext->DatapathDescriptor)->NumberOfElements / 2; + txQueueContext->CompletionBatchSize = min(deviceContext->BusParams.MaxOutDatagrams, maxBatchSize); + + NET_EXTENSION_QUERY_INIT(&extension, NET_FRAGMENT_EXTENSION_MDL_NAME, NET_FRAGMENT_EXTENSION_MDL_VERSION_1, NetExtensionTypeFragment); + + NetTxQueueGetExtension(txQueue, &extension, &txQueueContext->MdlExtension); + + netAdapterContext->TxQueue = txQueue; +Exit: + return status; +} + +void EvtRxQueueStart(_In_ NETPACKETQUEUE rxQueue) +{ + MbbGetRxQueueContext(rxQueue)->NetAdapterContext->AllowRxTraffic = TRUE; +} + +NTSTATUS +EvtAdapterCreateRxQueue(_In_ NETADAPTER netAdapter, _Inout_ NETRXQUEUE_INIT* rxQueueInit) +{ + NTSTATUS status = STATUS_SUCCESS; + + PMBB_RXQUEUE_CONTEXT rxQueueContext = NULL; + WDF_OBJECT_ATTRIBUTES rxAttributes; + NET_EXTENSION_QUERY extension; + PWMBCLASS_NETADAPTER_CONTEXT netAdapterContext = WmbClassGetNetAdapterContext(netAdapter); + + NET_PACKET_QUEUE_CONFIG rxConfig; + NET_PACKET_QUEUE_CONFIG_INIT(&rxConfig, EvtRxQueueAdvance, EvtRxQueueSetNotificationEnabled, EvtRxQueueCancel); + rxConfig.EvtStart = EvtRxQueueStart; + + WDF_OBJECT_ATTRIBUTES_INIT(&rxAttributes); + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&rxAttributes, MBB_RXQUEUE_CONTEXT); + rxAttributes.EvtDestroyCallback = EvtRxQueueDestroy; + + NETPACKETQUEUE rxQueue; + status = NetRxQueueCreate(rxQueueInit, &rxAttributes, &rxConfig, &rxQueue); + + if (!NT_SUCCESS(status)) + { + goto Exit; + } + + rxQueueContext = MbbGetRxQueueContext(rxQueue); + + NET_EXTENSION_QUERY_INIT(&extension, NET_FRAGMENT_EXTENSION_VIRTUAL_ADDRESS_NAME, NET_FRAGMENT_EXTENSION_VIRTUAL_ADDRESS_VERSION_1, NetExtensionTypeFragment); + + NetRxQueueGetExtension(rxQueue, &extension, &rxQueueContext->VirtualAddressExtension); + + rxQueueContext->NetAdapterContext = netAdapterContext; + rxQueueContext->DatapathDescriptor = NetRxQueueGetRingCollection(rxQueue); + + NET_EXTENSION_QUERY_INIT(&extension, NET_FRAGMENT_EXTENSION_RETURN_CONTEXT_NAME, NET_FRAGMENT_EXTENSION_RETURN_CONTEXT_VERSION_1, NetExtensionTypeFragment); + + NetRxQueueGetExtension(rxQueue, &extension, &rxQueueContext->ReturnContextExtension); + + // Set netAdapterContext->RxQueue to mean EvtAdapterCreateRxQueue completed successfully + netAdapterContext->RxQueue = rxQueue; + +Exit: + + return status; +} diff --git a/network/wwan/cxwmbclass/businit.cpp b/network/wwan/cxwmbclass/businit.cpp new file mode 100644 index 00000000..a4109ada --- /dev/null +++ b/network/wwan/cxwmbclass/businit.cpp @@ -0,0 +1,1906 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#include + +#pragma pack(push, 1) + +typedef struct _USB_DESCRIPTOR_HEADER +{ + + BYTE bLength; + BYTE bDescriptorType; + +} USB_DESCRIPTOR_HEADER, * PUSB_DESCRIPTOR_HEADER; + +#pragma pack(pop) + +NTSTATUS +MbbParseConfigDescriptor( + WDFUSBDEVICE WdfUsbDevice, + PUSHORT MaxSegmentSize, + PUCHAR NcmCaps, + PUCHAR PowerFiltersSupported, + PUCHAR MaxPowerFilterSize, + PUCHAR CommunicationClassInterface, + PUCHAR DataClassInterface, + PUSHORT MaxControlMessage, + PUCHAR AltCommunicationClassSetting, + PUCHAR AltDataClassSetting, + PUSHORT BulkInDataClassPacketSize, + PUSHORT MTU, + PUSHORT MbimVersion, + PUSHORT MbimExtendedVersion); + +NTSTATUS +GetNtbParameters(WDFUSBDEVICE WdfUsbDevice, PNCM_NTB_PARAMETER NcmNtb); + +NTSTATUS +GetDeviceString(__in WDFUSBDEVICE UsbDevice, __in UCHAR Index, __out PWSTR* String); + +VOID FreeBusObject(_In_ __drv_freesMem(Mem) PBUS_OBJECT BusObject); + +NTSTATUS +SetActivityIdForRequest(__in WDFREQUEST Request, __in LPGUID ActivityId); + +void ResetDataPipeWorkItem(_In_ WDFWORKITEM WorkItem); + +EVT_WDF_USB_READER_COMPLETION_ROUTINE InterruptPipeReadComplete; +EVT_WDF_USB_READERS_FAILED InterruptPipeReadError; + +NTSTATUS +MbbBusInitializeByWdf( + _In_ WDFDEVICE WdfDevice, + _In_ MBB_BUS_RESPONSE_AVAILABLE_CALLBACK ResponseAvailableCallback, + _In_ MBB_BUS_DATA_RECEIVE_CALLBACK ReceiveDataCallback, + _In_ MBB_BUS_SS_IDLE_CONFIRM_CALLBACK IdleConfirmCallback, + _In_ MBB_BUS_SS_IDLE_NOTIFICATION_COMPLETE_CALLBACK IdleNotificationComplete, + _In_ MBB_PROTOCOL_HANDLE ProtocolHandle, + _Outptr_ MBB_BUS_HANDLE* BusHandle, + _Inout_opt_ MBB_BUS_HANDLE preAllocatedBusObject) +{ + NTSTATUS Status = STATUS_SUCCESS; + WDF_OBJECT_ATTRIBUTES attributes; + + WDF_USB_DEVICE_SELECT_CONFIG_PARAMS configParams; + PWDF_USB_INTERFACE_SETTING_PAIR settingPairs = NULL; + WDF_USB_INTERFACE_SELECT_SETTING_PARAMS SettingParams; + WDFUSBPIPE pipe; + WDF_USB_PIPE_INFORMATION pipeInfo; + WDFUSBINTERFACE UsbInterface = NULL; + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + USB_DEVICE_DESCRIPTOR DeviceDescriptor; + USB_INTERFACE_DESCRIPTOR InterfaceDescriptor; + WDF_USB_DEVICE_CREATE_CONFIG Config; + + WDF_WORKITEM_CONFIG workitemConfig; + WDF_OBJECT_ATTRIBUTES workitemAttributes; + + UCHAR numInterfaces; + UCHAR interfaceIndex; + UCHAR i; + USHORT DescriptorSize = 0; + UCHAR CurrentSetting; + USHORT BulkInPacketSize = 0; + WDF_USB_CONTINUOUS_READER_CONFIG ReaderConfig; + + PIRP UsbSsIrp = NULL; + + PBUS_OBJECT BusObject = NULL; + + USB_CAP_DEVICE_INFO usbCapDeviceInfo = { USB_CAP_DEVICE_TYPE_MAXIMUM, 0, 0, 0 }; + ULONG capResultLength = 0; + + WDF_USB_DEVICE_INFORMATION deviceInformation; + + *BusHandle = NULL; + + if (preAllocatedBusObject == NULL) + { + + BusObject = (PBUS_OBJECT)ALLOCATE_NONPAGED_POOL(sizeof(BUS_OBJECT)); + + if (BusObject == NULL) + { + Status = STATUS_NO_MEMORY; + goto Cleanup; + } + + RtlZeroMemory(BusObject, sizeof(*BusObject)); + + BusObject->Fdo = WdfDeviceWdmGetDeviceObject(WdfDevice); + + INITIALIZE_PASSIVE_LOCK(&BusObject->Lock); + BusObject->State = BUS_STATE_CLOSED; + + BusObject->ProtocolHandle = ProtocolHandle; + BusObject->ResponseAvailableCallback = ResponseAvailableCallback; + BusObject->ReceiveDataCallback = ReceiveDataCallback; + BusObject->IdleConfirmCallback = IdleConfirmCallback; + BusObject->IdleNotificationComplete = IdleNotificationComplete; + + } + else + { + BusObject = (PBUS_OBJECT)preAllocatedBusObject; + } + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, USB_DEVICE_CONTEXT); + + WDF_USB_DEVICE_CREATE_CONFIG_INIT(&Config, USBD_CLIENT_CONTRACT_VERSION_602); + + Status = WdfUsbTargetDeviceCreateWithParameters(WdfDevice, &Config, &attributes, &BusObject->WdfUsbDevice); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + usbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + usbDeviceContext->BulkPipeResetFlag = FALSE; + usbDeviceContext->BulkPipeResetWorkitem = NULL; + + // + // create a work item to reset data pipe + // + ExInitializeRundownProtection(&usbDeviceContext->BulkPipeResetRundown); + + WDF_OBJECT_ATTRIBUTES_INIT(&workitemAttributes); + workitemAttributes.ParentObject = BusObject->WdfUsbDevice; + WDF_WORKITEM_CONFIG_INIT(&workitemConfig, ResetDataPipeWorkItem); + + Status = WdfWorkItemCreate(&workitemConfig, &workitemAttributes, &usbDeviceContext->BulkPipeResetWorkitem); + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + // + // create a lock + // + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.ParentObject = BusObject->WdfUsbDevice; + + Status = WdfWaitLockCreate(&attributes, &usbDeviceContext->PipeStateLock); + + if (!NT_SUCCESS(Status)) + { + return Status; + } + + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.ParentObject = BusObject->WdfUsbDevice; + + Status = WdfCollectionCreate(&attributes, &usbDeviceContext->WriteRequestCollection); + + if (!NT_SUCCESS(Status)) + { + return Status; + } + + // + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.ParentObject = BusObject->WdfUsbDevice; + + Status = WdfSpinLockCreate(&attributes, &usbDeviceContext->WriteCollectionLock); + + if (!NT_SUCCESS(Status)) + { + return Status; + } + + // + // see if the bus driver supports chained mdl's + // + Status = WdfUsbTargetDeviceQueryUsbCapability(BusObject->WdfUsbDevice, (PGUID)&GUID_USB_CAPABILITY_CHAINED_MDLS, 0, NULL, NULL); + + if (NT_SUCCESS(Status)) + { + // + // request work, the stack supports chained mdl's + // + BusObject->ChainedMdlsSupported = TRUE; + } + else + { + } + + // see what USB device type the bus driver is supporting + // + Status = WdfUsbTargetDeviceQueryUsbCapability( + BusObject->WdfUsbDevice, (PGUID)&GUID_USB_CAPABILITY_DEVICE_TYPE, sizeof(USB_CAP_DEVICE_INFO), (PVOID)&usbCapDeviceInfo, &capResultLength); + + if (NT_SUCCESS(Status)) + { + // + // request work, the stack returns USB device type + // + if (IsUsbCapDeviceInfoValid(usbCapDeviceInfo, capResultLength)) + { + BusObject->UsbCapDeviceInfo = usbCapDeviceInfo; + } + } + + WdfUsbTargetDeviceGetDeviceDescriptor(BusObject->WdfUsbDevice, &DeviceDescriptor); + + Status = GetDeviceString(BusObject->WdfUsbDevice, DeviceDescriptor.iManufacturer, &BusObject->Manufacturer); + + Status = GetDeviceString(BusObject->WdfUsbDevice, DeviceDescriptor.iProduct, &BusObject->Model); + + WDF_USB_DEVICE_INFORMATION_INIT(&deviceInformation); + Status = WdfUsbTargetDeviceRetrieveInformation(BusObject->WdfUsbDevice, &deviceInformation); + if (NT_SUCCESS(Status)) + { + BusObject->RemoteWakeCapable = IS_USB_DEVICE_REMOTE_WAKE_CAPABLE(deviceInformation); + } + + Status = MbbParseConfigDescriptor( + BusObject->WdfUsbDevice, + &BusObject->MaxSegmentSize, + &BusObject->NcmParams, + &BusObject->PowerFiltersSupported, + &BusObject->MaxPowerFilterSize, + &usbDeviceContext->UsbCommunicationInterfaceIndex, + &usbDeviceContext->UsbDataInterfaceIndex, + &BusObject->MaxControlChannelSize, + &usbDeviceContext->UsbCommunicationInterfaceSetting, + &usbDeviceContext->UsbDataInterfaceSetting, + &BulkInPacketSize, + &BusObject->MTU, + &BusObject->MbimVersion, + &BusObject->MbimExtendedVersion); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + if (BusObject->MaxControlChannelSize < MIN_CONTROL_MESSAGE_SIZE) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + goto Cleanup; + } + + if (BulkInPacketSize == 0) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + goto Cleanup; + } + + numInterfaces = WdfUsbTargetDeviceGetNumInterfaces(BusObject->WdfUsbDevice); + + settingPairs = (PWDF_USB_INTERFACE_SETTING_PAIR)ALLOCATE_NONPAGED_POOL(sizeof(WDF_USB_INTERFACE_SETTING_PAIR) * numInterfaces); + + if (settingPairs == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto Cleanup; + } + + for (interfaceIndex = 0; interfaceIndex < numInterfaces; interfaceIndex++) + { + settingPairs[interfaceIndex].UsbInterface = WdfUsbTargetDeviceGetInterface(BusObject->WdfUsbDevice, interfaceIndex); + + // + // Select alternate setting zero on all interfaces. + // + settingPairs[interfaceIndex].SettingIndex = 0; + } + + WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES(&configParams, numInterfaces, settingPairs); + + Status = WdfUsbTargetDeviceSelectConfig(BusObject->WdfUsbDevice, NULL, &configParams); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + if (configParams.Types.MultiInterface.NumberOfConfiguredInterfaces < 2) + { + Status = STATUS_NO_SUCH_DEVICE; + goto Cleanup; + } + + + usbDeviceContext->WdfCommunicationInterfaceIndex = 0xff; + usbDeviceContext->WdfDataInterfaceIndex = 0xff; + + for (i = 0; i < configParams.Types.MultiInterface.NumberOfConfiguredInterfaces; i++) + { + UsbInterface = WdfUsbTargetDeviceGetInterface(BusObject->WdfUsbDevice, i); + CurrentSetting = WdfUsbInterfaceGetConfiguredSettingIndex(UsbInterface); + WdfUsbInterfaceGetDescriptor(UsbInterface, CurrentSetting, &InterfaceDescriptor); + if ((InterfaceDescriptor.bInterfaceNumber == usbDeviceContext->UsbCommunicationInterfaceIndex)) + { + if (usbDeviceContext->WdfCommunicationInterfaceIndex == 0xff) + { + usbDeviceContext->WdfCommunicationInterfaceIndex = i; + } + } + + if ((InterfaceDescriptor.bInterfaceNumber == usbDeviceContext->UsbDataInterfaceIndex)) + { + if (usbDeviceContext->WdfDataInterfaceIndex == 0xff) + { + usbDeviceContext->WdfDataInterfaceIndex = i; + } + } + } + + if ((usbDeviceContext->WdfCommunicationInterfaceIndex == 0xff) || (usbDeviceContext->WdfDataInterfaceIndex == 0xff)) + { + Status = STATUS_NO_SUCH_DEVICE; + goto Cleanup; + } + + // + // get interrupt pipe handles + // + { + BYTE ConfiguredPipes = 0; + UsbInterface = WdfUsbTargetDeviceGetInterface(BusObject->WdfUsbDevice, usbDeviceContext->WdfCommunicationInterfaceIndex); + + WDF_USB_INTERFACE_SELECT_SETTING_PARAMS_INIT_SETTING(&SettingParams, usbDeviceContext->UsbCommunicationInterfaceSetting); + + Status = WdfUsbInterfaceSelectSetting(UsbInterface, WDF_NO_OBJECT_ATTRIBUTES, &SettingParams); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + ConfiguredPipes = WdfUsbInterfaceGetNumConfiguredPipes(UsbInterface); + + if (ConfiguredPipes != 1) + { + Status = STATUS_NO_SUCH_DEVICE; + goto Cleanup; + } + + WDF_USB_PIPE_INFORMATION_INIT(&pipeInfo); + + pipe = WdfUsbInterfaceGetConfiguredPipe( + UsbInterface, + 0, // index 0 + &pipeInfo); + + if (WdfUsbPipeTypeInterrupt == pipeInfo.PipeType) + { + usbDeviceContext->InterruptPipe = pipe; + usbDeviceContext->InterruptPipeIoTarget = WdfUsbTargetPipeGetIoTarget(pipe); + + usbDeviceContext->InterruptPipeMaxPacket = pipeInfo.MaximumPacketSize; + } + else + { + Status = STATUS_NO_SUCH_DEVICE; + goto Cleanup; + } + } + + BusObject->SyncInterruptReadBuffer = (PUCHAR)ALLOCATE_NONPAGED_POOL(usbDeviceContext->InterruptPipeMaxPacket); + + if (BusObject->SyncInterruptReadBuffer == NULL) + { + Status = STATUS_NO_MEMORY; + goto Cleanup; + } + + // + // Configure the continous reader now + // + + WDF_USB_CONTINUOUS_READER_CONFIG_INIT(&ReaderConfig, InterruptPipeReadComplete, BusObject, usbDeviceContext->InterruptPipeMaxPacket); + + ReaderConfig.NumPendingReads = 1; + ReaderConfig.EvtUsbTargetPipeReadersFailed = InterruptPipeReadError; + + Status = WdfUsbTargetPipeConfigContinuousReader(usbDeviceContext->InterruptPipe, &ReaderConfig); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + Status = GetNtbParameters(BusObject->WdfUsbDevice, &BusObject->NtbParam); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + if (!BusObject->ChainedMdlsSupported) + { + // + // chained mdl's not supported, create a lookaside list to hold the buffers + // + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.ParentObject = BusObject->WdfUsbDevice; + // + // TODO : For testing + // + // BusObject->NtbParam.dwNtbOutMaxSize = 512; + + Status = WdfLookasideListCreate( + &attributes, BusObject->NtbParam.dwNtbOutMaxSize, NonPagedPoolNx, WDF_NO_OBJECT_ATTRIBUTES, 'CBMW', &usbDeviceContext->LookasideList); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + } + + if (BusObject->UsbCapDeviceInfo.DeviceInfoHeader.DeviceType == USB_CAP_DEVICE_TYPE_UDE_MBIM) + { + BusObject->MaxBulkInTransfer = BusObject->NtbParam.dwNtbInMaxSize < MAX_HOST_NTB_SIZE_FOR_UDE_MBIM + ? BusObject->NtbParam.dwNtbInMaxSize + : MAX_HOST_NTB_SIZE_FOR_UDE_MBIM; + } + else + { + BusObject->MaxBulkInTransfer = + BusObject->NtbParam.dwNtbInMaxSize < MAX_HOST_NTB_SIZE ? BusObject->NtbParam.dwNtbInMaxSize : MAX_HOST_NTB_SIZE; + } + + // + // round down the transfer size so it is a multiple of maxpacket size for the builk in pipe + // + BusObject->MaxBulkInTransfer = (BusObject->MaxBulkInTransfer / BulkInPacketSize) * BulkInPacketSize; + + BusObject->BulkInHeaderSize = + ROUND_UP_COUNT((ULONG)MmSizeOfMdl(NULL, ROUND_UP_COUNT(BusObject->MaxBulkInTransfer + PAGE_SIZE, ALIGN_QUAD)), ALIGN_QUAD); + + if ((BusObject->NtbParam.bmNtbFormatSupported & NCM_NTB_FORMAT_32_BIT) == NCM_NTB_FORMAT_32_BIT) + { + // + // device supports 32 bit mode + // + if ((BusObject->NtbParam.dwNtbInMaxSize > 0xffff) || (BusObject->NtbParam.dwNtbOutMaxSize > 0xffff)) + { + // + // the device can actually handle a transfer larger than 16bit, change to 32 bit + // + BusObject->NtbFormat32Bit = TRUE; + } + } + + // + // put the device back into a known state + // + Status = MbbBusResetDeviceAndSetParms(BusObject); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + *BusHandle = BusObject; + usbDeviceContext->BusObject = BusObject; + BusObject = NULL; + +Cleanup: + + if (settingPairs != NULL) + { + FREE_POOL(settingPairs); + settingPairs = NULL; + } + + if (BusObject != NULL && preAllocatedBusObject == NULL) + { + FreeBusObject(BusObject); + BusObject = NULL; + } + + return Status; +} + +VOID FreeBusObject(_In_ __drv_freesMem(Mem) PBUS_OBJECT BusObject) + +{ + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + + if (BusObject->WdfUsbDevice != NULL) + { + + usbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + if (usbDeviceContext->InterruptPipeIoTarget != NULL) + { + WdfIoTargetStop(usbDeviceContext->InterruptPipeIoTarget, WdfIoTargetCancelSentIo); + } + + usbDeviceContext->BusObject = NULL; + } + + if (BusObject->Manufacturer != NULL) + { + FREE_POOL(BusObject->Manufacturer); + BusObject->Manufacturer = NULL; + } + + if (BusObject->Model != NULL) + { + FREE_POOL(BusObject->Model); + BusObject->Model = NULL; + } + + if (BusObject->WdfDevice != NULL) + { + WdfObjectDelete(BusObject->WdfDevice); + } + + if (BusObject->UsbSsIrp != NULL) + { + IoCancelIrp(BusObject->UsbSsIrp); + + + KeWaitForSingleObject(&BusObject->UsbSsIrpComplete, Executive, KernelMode, FALSE, NULL); + + + IoFreeIrp(BusObject->UsbSsIrp); + BusObject->UsbSsIrp = NULL; + } + + if (BusObject->SyncInterruptReadBuffer != NULL) + { + FREE_POOL(BusObject->SyncInterruptReadBuffer); + BusObject->SyncInterruptReadBuffer = NULL; + } + + FREE_POOL(BusObject); + BusObject = NULL; + + return; +} + +VOID MbbBusCleanup(__in MBB_BUS_HANDLE BusHandle) + +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + + FreeBusObject(BusObject); + BusObject = NULL; + + return; +} + +NTSTATUS +MbbParseConfigDescriptor( + WDFUSBDEVICE WdfUsbDevice, + PUSHORT MaxSegmentSize, + PUCHAR NcmCaps, + PUCHAR PowerFiltersSupported, + PUCHAR MaxPowerFilterSize, + PUCHAR CommunicationClassInterface, + PUCHAR DataClassInterface, + PUSHORT MaxControlMessage, + PUCHAR AltCommunicationClassSetting, + PUCHAR AltDataClassSetting, + PUSHORT BulkInDataClassPacketSize, + PUSHORT MTU, + PUSHORT MbimVersion, + PUSHORT MbimExtendedVersion) + +{ + + NTSTATUS Status; + + BYTE* ConfigDescriptorBuffer = NULL; + PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor = NULL; + PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor = NULL; + PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor = NULL; + PUSB_INTERFACE_ASSOCIATION_DESCRIPTOR IadDescriptor = NULL; + PUSB_CS_DESCRIPTOR CsDescriptor = NULL; + PUSB_CS_ECM_DESCRIPTOR EcmDescriptor = NULL; + PUSB_CS_NCM_DESCRIPTOR NcmDescriptor = NULL; + PUSB_CS_MBB_DESCRIPTOR MbbDescriptor = NULL; + PUSB_CS_MBB_DESCRIPTOR_EXTENDED MbbDescriptorExtended = NULL; + PUSB_CS_CDC_DESCRIPTOR CdcDescriptor = NULL; + + BYTE* Current = NULL; + USHORT DescriptorSize = 0; + + BOOLEAN GotEcmDesc = FALSE; + BOOLEAN GotNcmDesc = FALSE; + BOOLEAN GotMbbDesc = FALSE; + BYTE CurrentInterface = 0; + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + + *CommunicationClassInterface = 0xff; + *DataClassInterface = 0xff; + *AltCommunicationClassSetting = 0; + *AltDataClassSetting = 0; + *BulkInDataClassPacketSize = 0; + *MTU = 0; + *MbimVersion = 0x0100; // Default to MBIM 1.0 Version + *MbimExtendedVersion = 0x0100; + + usbDeviceContext = GetUsbDeviceContext(WdfUsbDevice); + + Status = WdfUsbTargetDeviceRetrieveConfigDescriptor(WdfUsbDevice, NULL, &DescriptorSize); + + if (Status != STATUS_BUFFER_TOO_SMALL) + { + + goto Cleanup; + } + + ConfigDescriptorBuffer = (BYTE*)ALLOCATE_NONPAGED_POOL(DescriptorSize); + + if (ConfigDescriptorBuffer == NULL) + { + Status = STATUS_NO_MEMORY; + goto Cleanup; + } + + Status = WdfUsbTargetDeviceRetrieveConfigDescriptor(WdfUsbDevice, ConfigDescriptorBuffer, &DescriptorSize); + + if (!NT_SUCCESS(Status)) + { + + goto Cleanup; + } + + Current = ConfigDescriptorBuffer; + + while (Current + sizeof(USB_DESCRIPTOR_HEADER) <= ConfigDescriptorBuffer + DescriptorSize) + { + PUSB_DESCRIPTOR_HEADER Header = (PUSB_DESCRIPTOR_HEADER)Current; + + if (Current + Header->bLength > ConfigDescriptorBuffer + DescriptorSize) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + + goto Cleanup; + } + + switch (Header->bDescriptorType) + { + case USB_CONFIGURATION_DESCRIPTOR_TYPE: + + ConfigDescriptor = (PUSB_CONFIGURATION_DESCRIPTOR)Current; + + break; + + case USB_INTERFACE_DESCRIPTOR_TYPE: + + InterfaceDescriptor = (PUSB_INTERFACE_DESCRIPTOR)Current; + + CurrentInterface = InterfaceDescriptor->bInterfaceNumber; + + if ((InterfaceDescriptor->bInterfaceClass == MBIM_CC_INTERFACE_CLASS) && + ((InterfaceDescriptor->bInterfaceSubClass == MBIM_CC_INTERFACE_SUBCLASS)) && + (InterfaceDescriptor->bInterfaceProtocol == MBIM_CC_INTERFACE_PROTOCOL || + InterfaceDescriptor->bInterfaceProtocol == MBIM_CC_INTERFACE_NBL_PROTOCOL || + InterfaceDescriptor->bInterfaceProtocol == MBIM_CC_INTERFACE_NETPACKET_PROTOCOL)) + { + + *CommunicationClassInterface = InterfaceDescriptor->bInterfaceNumber; + *AltCommunicationClassSetting = InterfaceDescriptor->bAlternateSetting; + } + + if ((InterfaceDescriptor->bInterfaceClass == MBIM_DC_INTERFACE_CLASS) && + (InterfaceDescriptor->bInterfaceSubClass == MBIM_DC_INTERFACE_SUBCLASS) && + (InterfaceDescriptor->bInterfaceProtocol == MBIM_DC_INTERFACE_PROTOCOL)) + { + *DataClassInterface = InterfaceDescriptor->bInterfaceNumber; + *AltDataClassSetting = InterfaceDescriptor->bAlternateSetting; + } + + break; + + case USB_ENDPOINT_DESCRIPTOR_TYPE: + + if ((Header->bLength != sizeof(*EndpointDescriptor))) + { + + Status = STATUS_INFO_LENGTH_MISMATCH; + + goto Cleanup; + } + + EndpointDescriptor = (PUSB_ENDPOINT_DESCRIPTOR)Current; + + + if (CurrentInterface == *DataClassInterface) + { + // + // this endpoint is for the data interface + // + if (USB_ENDPOINT_DIRECTION_IN(EndpointDescriptor->bEndpointAddress) && (EndpointDescriptor->bmAttributes & USB_ENDPOINT_TYPE_BULK)) + { + // + // bulk in endpoint + // + *BulkInDataClassPacketSize = EndpointDescriptor->wMaxPacketSize & 0x7ff; + + } + } + + break; + + case USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE: + + + break; + + case USB_CDC_CS_DESCRIPTOR_TYPE: + + CsDescriptor = (PUSB_CS_DESCRIPTOR)Current; + + switch (CsDescriptor->bSubType) + { + case USB_CDC_CS_ECM_DESCRIPTOR_SUBTYPE: + + EcmDescriptor = (PUSB_CS_ECM_DESCRIPTOR)Current; + + + break; + + case USB_CDC_CS_NCM_DESCRIPTOR_SUBTYPE: + + NcmDescriptor = (PUSB_CS_NCM_DESCRIPTOR)Current; + + break; + + case USB_CDC_CS_DESCRIPTOR_SUBTYPE: + + if ((CsDescriptor->bLength != sizeof(*CdcDescriptor))) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + + goto Cleanup; + } + + CdcDescriptor = (PUSB_CS_CDC_DESCRIPTOR)Current; + + break; + + case USB_CDC_CS_MBB_DESCRIPTOR_SUBTYPE: + + if ((CsDescriptor->bLength != sizeof(*MbbDescriptor))) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + + goto Cleanup; + } + + MbbDescriptor = (PUSB_CS_MBB_DESCRIPTOR)Current; + + if (MbbDescriptor->wMbbVersion < MBIM_MBB_FUNCDESC_MIN_VERSION) + { + + Status = STATUS_INFO_LENGTH_MISMATCH; + goto Cleanup; + } + + if (MbbDescriptor->wMaxSegmentSize < MBIM_MIN_SEGMENT_SIZE) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + goto Cleanup; + } + + if (MbbDescriptor->bMaxFilterSize > MBIM_MAX_PACKET_FILTER_SIZE) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + + goto Cleanup; + } + + if (MbbDescriptor->bNumberPowerFilters < MBIM_MIN_NUMBER_OF_PACKET_FILTERS) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + + goto Cleanup; + } + + *MaxSegmentSize = MbbDescriptor->wMaxSegmentSize; + *PowerFiltersSupported = MbbDescriptor->bNumberPowerFilters; + *MaxPowerFilterSize = MbbDescriptor->bMaxFilterSize; + *NcmCaps = MbbDescriptor->bmNetworkCapabilities; + *MaxControlMessage = MbbDescriptor->wMaxControlMessage; + GotMbbDesc = TRUE; + *MbimVersion = MbbDescriptor->wMbbVersion; + + break; + + case USB_CDC_CS_MBB_DESCRIPTOR_EXTENDED_SUBTYPE: + + // MBIM 1.0 - 6.5: If MBIM Extended Functional Descriptor is provided, it must appear after MBIM Functional Descriptor. + if (!GotMbbDesc) + { + Status = STATUS_UNRECOGNIZED_MEDIA; + + goto Cleanup; + } + + if ((CsDescriptor->bLength != sizeof(*MbbDescriptorExtended))) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + + goto Cleanup; + } + + MbbDescriptorExtended = (PUSB_CS_MBB_DESCRIPTOR_EXTENDED)Current; + + if (MbbDescriptorExtended->wMbbVersion < MBIM_MBB_FUNCDESC_EXTENDED_MIN_VERSION) + { + + Status = STATUS_INFO_LENGTH_MISMATCH; + goto Cleanup; + } + + if (MbbDescriptorExtended->wMTU < MBIM_MIN_MTU_SIZE) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + goto Cleanup; + } + + // If the Extended MTU comes in as larger than the MaxSegmentSize, we set the MTU to MaxSegmentSize + if (MbbDescriptorExtended->wMTU > *MaxSegmentSize) + { + // Check if the MaxSegmentSize is not less than the Minimum MTU size, if it is then bail + if (*MaxSegmentSize < MBIM_MIN_MTU_SIZE) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + goto Cleanup; + } + else + { + MbbDescriptorExtended->wMTU = *MaxSegmentSize; + } + } + + *MTU = MbbDescriptorExtended->wMTU; + *MbimExtendedVersion = MbbDescriptorExtended->wMbbVersion; + + break; + + default: + + + break; + } + + break; + + default: + + + break; + } + + Current += Header->bLength; + } + + Status = STATUS_SUCCESS; + +Cleanup: + + if (ConfigDescriptorBuffer != NULL) + { + FREE_POOL(ConfigDescriptorBuffer); + ConfigDescriptorBuffer = NULL; + } + + if (!(GotMbbDesc)) + { + + Status = STATUS_UNRECOGNIZED_MEDIA; + } + + if ((*CommunicationClassInterface == 0xff) || (*DataClassInterface == 0xff)) + { + + Status = STATUS_UNRECOGNIZED_MEDIA; + } + + return Status; +} + +NTSTATUS +GetNtbParameters(WDFUSBDEVICE WdfUsbDevice, PNCM_NTB_PARAMETER NcmNtb) + +{ + + NTSTATUS Status; + ULONG BytesTransfered = 0; + + Status = SendSyncControlCommand( + WdfUsbDevice, BmRequestDeviceToHost, BmRequestToInterface, GET_NTB_PARAMETERS, 0, (PUCHAR)NcmNtb, sizeof(*NcmNtb), &BytesTransfered); + + if (NT_SUCCESS(Status)) + { + if (BytesTransfered < sizeof(*NcmNtb)) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + goto Cleanup; + } + } + else + { + goto Cleanup; + } + + if ((NcmNtb->bmNtbFormatSupported & NCM_NTB_FORMAT_16_BIT) != NCM_NTB_FORMAT_16_BIT) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + goto Cleanup; + } + + if (NcmNtb->wNdpInPayloadRemainder >= NcmNtb->wNdpInDivisor) + { + Status = STATUS_INVALID_PARAMETER; + goto Cleanup; + } + + if ((NcmNtb->wNdpInPayloadRemainder > NcmNtb->dwNtbInMaxSize) || (NcmNtb->wNdpInDivisor > NcmNtb->dwNtbInMaxSize)) + { + Status = STATUS_INVALID_PARAMETER; + goto Cleanup; + } + + if ((NcmNtb->wNdpInAlignment < 4) || (NcmNtb->wNdpInAlignment > NcmNtb->dwNtbInMaxSize) || + ((NcmNtb->wNdpInAlignment - 1) & NcmNtb->wNdpInAlignment) != 0) + { + Status = STATUS_INVALID_PARAMETER; + goto Cleanup; + } + + if (NcmNtb->wNdpOutPayloadRemainder >= NcmNtb->wNdpOutDivisor) + { + Status = STATUS_INVALID_PARAMETER; + goto Cleanup; + } + + if ((NcmNtb->wNdpOutPayloadRemainder > NcmNtb->dwNtbOutMaxSize) || (NcmNtb->wNdpOutDivisor > NcmNtb->dwNtbOutMaxSize)) + { + Status = STATUS_INVALID_PARAMETER; + goto Cleanup; + } + + if ((NcmNtb->wNdpOutAlignment < 4) || (NcmNtb->wNdpOutAlignment > NcmNtb->dwNtbOutMaxSize) || + ((NcmNtb->wNdpOutAlignment - 1) & NcmNtb->wNdpOutAlignment) != 0) + { + Status = STATUS_INVALID_PARAMETER; + goto Cleanup; + } + +Cleanup: + + return Status; +} + +NTSTATUS +SetActivityIdForRequest(__in WDFREQUEST Request, __in LPGUID ActivityId) +{ + NTSTATUS Status = STATUS_SUCCESS; + PIRP Irp = NULL; + + do + { + GUID zeroGuid = { 0 }; + + if (ActivityId == NULL || IsEqualGUID(*ActivityId, zeroGuid)) + { + Status = STATUS_INVALID_PARAMETER; + break; + } + + Irp = WdfRequestWdmGetIrp(Request); + + if (Irp == NULL) + { + Status = STATUS_INVALID_PARAMETER; + break; + } + + // set the activity id of the IRP + Status = IoSetActivityIdIrp(Irp, ActivityId); + } while (FALSE); + + return Status; +} + +EVT_WDF_REQUEST_COMPLETION_ROUTINE SendCompletionRoutine; + +VOID SendCompletionRoutine(__in WDFREQUEST Request, __in WDFIOTARGET Target, __in PWDF_REQUEST_COMPLETION_PARAMS Params, __in WDFCONTEXT Context) + +{ + PREQUEST_CONTEXT ReqContext = NULL; + + ReqContext = GetRequestContext(Request); + + (ReqContext->Callback.Send)(ReqContext->ProtocolHandle, ReqContext->CallbackContext, Params->IoStatus.Status); + + WdfObjectDelete(Request); +} + +NTSTATUS +MbbBusSendMessageFragment( + __in MBB_BUS_HANDLE BusHandle, + __in MBB_REQUEST_HANDLE RequestHandle, + __in PVOID MessageFragment, + __in ULONG FragmentLength, + __in LPGUID ActivityId, + __in MBB_BUS_SEND_COMPLETION_CALLBACK SendCompletionCallback) + + /* + Description + The protocol layer call this routine to request the bus layer to + send a message fragment. Fragmentation / Reassembly is handled by + the protocol layer and it will only handle fragments that are within + the maximum transfer size of the bus. + + This routine is asynchronous and returns immediately after queueing + the transfer. The caller is notified of the completion through the + callback. + + Parameters + __in MBB_BUS_HANDLE BusHandle, + BusHandle identifies the instance of the bus layer. + + __in MBB_REQUEST_HANDLE RequestHandle, + Identifies the request. + + __in PVOID MessageFragment, + The data payload that needs to be sent. + + __in ULONG FragmentLength, + Length of the data payload. This will not be greater than the + maximum transfer size supported by the bus. + + __in LPGUID ActivityId, + The activity Id to be associated with this fragment transfer. + This activity Id will also be used by USB for logging USB events. + + __in MBB_BUS_SEND_COMPLETION_CALLBACK SendCompletionCallback + The completion callback routine that will be called by the bus + when the transfer is complete. + + Return Value + + NTSTATUS_SUCCESS + The transfer has completed successfully. SendCompletionCallback will NOT be called. + + NTSTATUS_PENDING + The transfer was queued. SendCompletionCallback will be called on completion. + + Other failure code + The transfer could not be queued. SendCompletionCallback will NOT be called. + */ + +{ + + WDF_USB_CONTROL_SETUP_PACKET packet; + NTSTATUS status; + WDF_OBJECT_ATTRIBUTES attributes; + WDFMEMORY memHandle = NULL; + WDFREQUEST request = NULL; + BOOLEAN SentToDevice = FALSE; + PREQUEST_CONTEXT Context = NULL; + WDF_REQUEST_SEND_OPTIONS SendOptions; + + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, REQUEST_CONTEXT); + attributes.ParentObject = BusObject->WdfUsbDevice; + + status = WdfRequestCreate(&attributes, WdfUsbTargetDeviceGetIoTarget(BusObject->WdfUsbDevice), &request); + + if (!NT_SUCCESS(status)) + { + + goto Cleanup; + } + + Context = GetRequestContext(request); + + Context->CallbackContext = RequestHandle; + Context->Callback.Send = SendCompletionCallback; + Context->ProtocolHandle = BusObject->ProtocolHandle; + Context->UsbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.ParentObject = request; + + status = WdfMemoryCreatePreallocated(&attributes, MessageFragment, FragmentLength, &memHandle); + + if (!NT_SUCCESS(status)) + { + + goto Cleanup; + } + + WDF_USB_CONTROL_SETUP_PACKET_INIT_CLASS( + &packet, BmRequestHostToDevice, BmRequestToInterface, SEND_ENCAPSULATE_COMMAND, 0, Context->UsbDeviceContext->UsbCommunicationInterfaceIndex); + + status = WdfUsbTargetDeviceFormatRequestForControlTransfer(BusObject->WdfUsbDevice, request, &packet, memHandle, NULL); + + if (!NT_SUCCESS(status)) + { + + goto Cleanup; + } + + WdfRequestSetCompletionRoutine(request, SendCompletionRoutine, NULL); + + WDF_REQUEST_SEND_OPTIONS_INIT(&SendOptions, 0); + + WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(&SendOptions, WDF_REL_TIMEOUT_IN_SEC(10)); + + // Set the activity Id of the IRP associated with the request. + // Ignore any failures + SetActivityIdForRequest(request, ActivityId); + + if (FragmentLength >= sizeof(MBB_COMMAND_HEADER)) + { + PMBB_COMMAND_HEADER CommandHeader = (PMBB_COMMAND_HEADER)MessageFragment; + } + + SentToDevice = WdfRequestSend(request, WdfUsbTargetDeviceGetIoTarget(BusObject->WdfUsbDevice), &SendOptions); + + status = STATUS_PENDING; + + if (!SentToDevice) + { + + status = WdfRequestGetStatus(request); + + } + +Cleanup: + + if (!NT_SUCCESS(status)) + { + if (request != NULL) + { + WdfObjectDelete(request); + request = NULL; + } + } + + return status; +} + +EVT_WDF_REQUEST_COMPLETION_ROUTINE ReceiveCompletionRoutine; + +VOID ReceiveCompletionRoutine(__in WDFREQUEST Request, __in WDFIOTARGET Target, __in PWDF_REQUEST_COMPLETION_PARAMS Params, __in WDFCONTEXT Context) + +{ + PREQUEST_CONTEXT ReqContext = NULL; + GUID ActivityId = { 0 }; + PIRP Irp = NULL; + NTSTATUS Status = STATUS_INVALID_PARAMETER; + + ReqContext = GetRequestContext(Request); + + // Get the IRP + Irp = WdfRequestWdmGetIrp(Request); + + if (Irp != NULL) + { + // Get the activity Id + Status = IoGetActivityIdIrp(Irp, &ActivityId); + } + + if (NT_SUCCESS(Params->IoStatus.Status) && (Params->IoStatus.Information >= sizeof(MBB_COMMAND_DONE_HEADER))) + { + + PMBB_COMMAND_DONE_HEADER CommandHeader = (PMBB_COMMAND_DONE_HEADER)ReqContext->Buffer; + } + + (*ReqContext->Callback.Receive)( + ReqContext->ProtocolHandle, ReqContext->CallbackContext, Params->IoStatus.Status, (ULONG)Params->IoStatus.Information); + + WdfObjectDelete(Request); +} + +NTSTATUS +MbbBusReceiveMessageFragment( + _In_ MBB_BUS_HANDLE BusHandle, + _In_ MBB_REQUEST_HANDLE RequestHandle, + _In_ __drv_aliasesMem PVOID MessageFragment, + _In_ ULONG FragmentLength, + _In_ LPGUID ActivityId, + _In_ MBB_BUS_RECEIVE_COMPLETION_CALLBACK ReceiveCompletionCallback) + /* + Description + + Parameters + + + Return Value + + NTSTATUS_SUCCESS + Initialization was successful. + + Other failure code + */ + /* + Description + The protocol layer call this routine to request the bus layer to + receive data from the device. Reassembly is handled by the protocol layer. + + This routine is asynchronous and returns immediately after queueing + the transfer. The caller is notified of the completion through the + callback. + + Parameters + _In_ MBB_BUS_HANDLE BusHandle, + BusHandle identifies the instance of the bus layer. + + _In_ MBB_REQUEST_HANDLE RequestHandle, + Identifies the request. + + _In_ __drv_aliasesMem PVOID MessageFragment, + The data buffer that would be filled with the received data. + + _In_ ULONG FragmentLength, + Length of the data requested from the device. This will not be + greater than the maximum transfer size supported by the bus. + + _In_ LPGUID ActivityId, + The activity Id to be associated with this fragment transfer. + This activity Id will also be used by USB for logging USB events. + + _In_ MBB_BUS_RECEIVE_COMPLETION_CALLBACK ReceiveCompletionCallback + The completion callback routine that will be called by the bus + when the transfer is complete. + + Return Value + + NTSTATUS_SUCCESS + The transfer has completed successfully. ReceiveCompletionCallback will NOT be called. + + NTSTATUS_PENDING + The transfer was queued. ReceiveCompletionCallback will be called on completion. + + Other failure code + The transfer could not be queued. ReceiveCompletionCallback will NOT be called. + */ + +{ + WDF_USB_CONTROL_SETUP_PACKET packet; + NTSTATUS status; + WDF_OBJECT_ATTRIBUTES attributes; + WDFMEMORY memHandle = NULL; + WDFREQUEST request = NULL; + BOOLEAN SentToDevice = FALSE; + PREQUEST_CONTEXT Context = NULL; + WDF_REQUEST_SEND_OPTIONS SendOptions; + PIRP Irp = NULL; + + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, REQUEST_CONTEXT); + + attributes.ParentObject = BusObject->WdfUsbDevice; + + status = WdfRequestCreate(&attributes, WdfUsbTargetDeviceGetIoTarget(BusObject->WdfUsbDevice), &request); + + if (!NT_SUCCESS(status)) + { + + goto Cleanup; + } + + Context = GetRequestContext(request); + + Context->CallbackContext = RequestHandle; + Context->Callback.Receive = ReceiveCompletionCallback; + Context->ProtocolHandle = BusObject->ProtocolHandle; + Context->UsbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + Context->Buffer = MessageFragment; + Context->BufferLength = FragmentLength; + + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.ParentObject = request; + + status = WdfMemoryCreatePreallocated(&attributes, MessageFragment, FragmentLength, &memHandle); + + if (!NT_SUCCESS(status)) + { + + goto Cleanup; + } + + WDF_USB_CONTROL_SETUP_PACKET_INIT_CLASS( + &packet, BmRequestDeviceToHost, BmRequestToInterface, GET_ENCAPSULATE_RESPONSE, 0, Context->UsbDeviceContext->UsbCommunicationInterfaceIndex); + + status = WdfUsbTargetDeviceFormatRequestForControlTransfer(BusObject->WdfUsbDevice, request, &packet, memHandle, NULL); + + if (!NT_SUCCESS(status)) + { + + goto Cleanup; + } + + WdfRequestSetCompletionRoutine(request, ReceiveCompletionRoutine, NULL); + + WDF_REQUEST_SEND_OPTIONS_INIT(&SendOptions, 0); + + WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(&SendOptions, WDF_REL_TIMEOUT_IN_SEC(10)); + + // Set the activity Id of the IRP associated with the request. + // Ignore any failures + SetActivityIdForRequest(request, ActivityId); + + SentToDevice = WdfRequestSend(request, WdfUsbTargetDeviceGetIoTarget(BusObject->WdfUsbDevice), &SendOptions); + + status = STATUS_PENDING; + + if (!SentToDevice) + { + + status = WdfRequestGetStatus(request); + + } + +Cleanup: + + if (!NT_SUCCESS(status)) + { + if (request != NULL) + { + WdfObjectDelete(request); + request = NULL; + } + } + + return status; +} + +VOID InterruptPipeReadComplete(__in WDFUSBPIPE Pipe, __in WDFMEMORY Memory, __in size_t NumBytesTransfered, __in WDFCONTEXT Context) + +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)Context; + PVOID Buffer = NULL; + PUSB_CDC_NOTIFICATION CdcNotification = NULL; + PUSB_CDC_NOTIFICATION_SPEED_CHANGE CdcSpeedChangeNotification = NULL; + ULONG TempBytesTransfered = (ULONG)NumBytesTransfered; + UCHAR IndicateBuffer[INTERRUPT_REASSEMBLY_BUFFER_SIZE]; + ULONG BufferLength = 0; + + + Buffer = WdfMemoryGetBuffer(Memory, NULL); + + // + // process this fragment, the function will return a non-zero value if a complete message is returned. + // + BufferLength = ProcessInterruptPipeRead(BusObject, (PCUCHAR)Buffer, NumBytesTransfered, IndicateBuffer, sizeof(IndicateBuffer)); + + if (BufferLength >= sizeof(*CdcNotification)) + { + CdcNotification = (PUSB_CDC_NOTIFICATION)&IndicateBuffer[0]; + + switch (CdcNotification->bNotificationCode) + { + case USB_CDC_NOTIFICATION_RESPONSE_AVAILABLE: (BusObject->ResponseAvailableCallback)(BusObject->ProtocolHandle); break; + + case USB_CDC_NOTIFICATION_NETWORK_CONNECTION: + case USB_CDC_NOTIFICATION_CONNECTION_SPEED_CHANGE: + default: break; + } + } + + return; +} + +BOOLEAN +InterruptPipeReadError(__in WDFUSBPIPE Pipe, __in NTSTATUS Status, __in USBD_STATUS UsbdStatus) + +{ + return TRUE; +} + +NTSTATUS +MbbBusQueryBusParameters(__in MBB_BUS_HANDLE BusHandle, __out PMBB_BUS_PARAMETERS BusParameters) + +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + + RtlZeroMemory(BusParameters, sizeof(*BusParameters)); + + BusParameters->FragmentSize = BusObject->MaxControlChannelSize; + + BusParameters->MaxSegmentSize = BusObject->MaxSegmentSize; + + BusParameters->Ntb32BitSupported = (BusObject->NtbParam.bmNtbFormatSupported & NCM_NTB_FORMAT_32_BIT) == NCM_NTB_FORMAT_32_BIT; + BusParameters->MaxOutNtb = BusObject->NtbParam.dwNtbOutMaxSize; + + if ((BusObject->NtbParam.wNtbOutMaxDatagrams == 0) || (BusObject->NtbParam.wNtbOutMaxDatagrams > MAX_OUT_DATAGRAMS)) + { + // + // Zero means unlimited, impose a limit so the driver can preallocated the contexts it needs + // + BusParameters->MaxOutDatagrams = MAX_OUT_DATAGRAMS; + } + else + { + BusParameters->MaxOutDatagrams = BusObject->NtbParam.wNtbOutMaxDatagrams; + } + + BusParameters->NdpOutDivisor = BusObject->NtbParam.wNdpOutDivisor; + BusParameters->NdpOutRemainder = BusObject->NtbParam.wNdpOutPayloadRemainder; + BusParameters->NdpOutAlignment = BusObject->NtbParam.wNdpOutAlignment; + // + // TODO: Read the current value from the bus object when SetNtb is implemented + // + BusParameters->CurrentMode32Bit = BusObject->NtbFormat32Bit; + BusParameters->SelectiveSuspendSupported = TRUE; + + BusParameters->PowerFiltersSupported = BusObject->PowerFiltersSupported; + BusParameters->MaxPowerFilterSize = BusObject->MaxPowerFilterSize; + BusParameters->RemoteWakeCapable = BusObject->RemoteWakeCapable; + + if (BusObject->Manufacturer != NULL) + { + RtlStringCbCopyW(BusParameters->Manufacturer, sizeof(BusParameters->Manufacturer), BusObject->Manufacturer); + } + + if (BusObject->Model != NULL) + { + RtlStringCbCopyW(BusParameters->Model, sizeof(BusParameters->Model), BusObject->Model); + } + + BusParameters->MTU = BusObject->MTU; + if (BusObject->MTU != 0) + { + BusParameters->IsErrataDevice = TRUE; + } + else + { + BusParameters->IsErrataDevice = FALSE; + } + + BusParameters->MbimVersion = BusObject->MbimVersion; + BusParameters->MbimExtendedVersion = BusObject->MbimExtendedVersion; + + return STATUS_SUCCESS; +} + +NTSTATUS MbbBusHandshake(_In_ PBUS_OBJECT BusObject, _In_ ULONG TransactionId, _In_opt_ PVOID FastIOSendNetBufferListsComplete, _In_opt_ PVOID FastIOIndicateReceiveNetBufferLists) +{ + NTSTATUS Status; + ULONG BytesTransferred = 0; + UCHAR ReadBuffer[256]; + ULONG RetryCount = 0; + MBB_OPEN_MESSAGE OpenMessage; + PMBB_OPEN_DONE OpenDoneMessage = NULL; + MBB_OPEN_MESSAGE_FASTIO OpenMessageFastIO; + PMBB_OPEN_DONE_FASTIO OpenDoneMessageFastIO = NULL; + + RtlZeroMemory(&OpenMessage, sizeof(OpenMessage)); + + OpenMessage.MessageHeader.MessageType = MBB_MESSAGE_TYPE_OPEN; + OpenMessage.MessageHeader.MessageLength = sizeof(OpenMessage); + OpenMessage.MessageHeader.MessageTransactionId = TransactionId; + OpenMessage.MaximumControlTransfer = + BusObject->MaxControlChannelSize < MAX_CONTROL_MESSAGE_SIZE ? BusObject->MaxControlChannelSize : MAX_CONTROL_MESSAGE_SIZE; + + do + { + RetryCount++; + + Status = TransactControlChannel( + BusObject, RetryCount * INITIAL_OPEN_TIMEOUT, (PUCHAR)&OpenMessage, sizeof(OpenMessage), (PUCHAR)&ReadBuffer[0], sizeof(ReadBuffer), &BytesTransferred); + } while ((Status == STATUS_IO_TIMEOUT) && (RetryCount < MAX_OPEN_RETRY_ATTEMPTS)); + + if (NT_SUCCESS(Status)) + { + if (BytesTransferred < sizeof(*OpenDoneMessage)) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + } + } + + if (NT_SUCCESS(Status)) + { + OpenDoneMessage = (PMBB_OPEN_DONE)&ReadBuffer[0]; + + if ((OpenDoneMessage->MessageHeader.MessageType != MBB_MESSAGE_TYPE_OPEN_DONE) || + (OpenDoneMessage->MessageHeader.MessageLength < sizeof(*OpenDoneMessage)) || + (OpenDoneMessage->MessageHeader.MessageTransactionId != OpenMessage.MessageHeader.MessageTransactionId)) + { + Status = STATUS_NDIS_INVALID_DATA; + } + else if (OpenDoneMessage->MbbStatus != STATUS_SUCCESS) + { + Status = STATUS_OPEN_FAILED; + } + } + return Status; +} + +NTSTATUS +MbbBusStart(_In_ MBB_BUS_HANDLE BusHandle) +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + NTSTATUS Status; + BOOLEAN FailOpen = FALSE; + + BOOLEAN AltSettingSet = FALSE; + + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + + ACQUIRE_PASSIVE_LOCK(&BusObject->Lock); + + if (BusObject->State != BUS_STATE_CLOSED) + { + FailOpen = TRUE; + } + else + { + BusObject->State = BUS_STATE_OPENING; + } + + RELEASE_PASSIVE_LOCK(&BusObject->Lock); + + if (FailOpen) + { + Status = STATUS_UNSUCCESSFUL; + + goto Cleanup; + } + + usbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + Status = MbbBusResetDeviceAndSetParms(BusObject); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + Status = MbbBusSelectDataAltSetting(BusObject, ALT_DATA_SETTING_1); + + if (NT_ERROR(Status)) + { + goto Cleanup; + } + + AltSettingSet = TRUE; + + // + // start the continouse reader now + // + Status = WdfIoTargetStart(usbDeviceContext->InterruptPipeIoTarget); + + if (!NT_SUCCESS(Status)) + { + + goto Cleanup; + } + + Status = STATUS_SUCCESS; + + ACQUIRE_PASSIVE_LOCK(&BusObject->Lock); + + BusObject->State = BUS_STATE_OPENED; + + RELEASE_PASSIVE_LOCK(&BusObject->Lock); + +Cleanup: + + if (!NT_SUCCESS(Status)) + { + // + // stop the pipe reader + // + WdfIoTargetStop(usbDeviceContext->InterruptPipeIoTarget, WdfIoTargetCancelSentIo); + + // + // set the data pipes back to alt seeting 0 + // + if (AltSettingSet) + { + MbbBusSelectDataAltSetting(BusObject, ALT_DATA_SETTING_0); + } + + ACQUIRE_PASSIVE_LOCK(&BusObject->Lock); + + BusObject->State = BUS_STATE_CLOSED; + + RELEASE_PASSIVE_LOCK(&BusObject->Lock); + } + + return Status; +} + +NTSTATUS +MbbBusStop(__in MBB_BUS_HANDLE BusHandle) +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + NTSTATUS Status; + + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + + + usbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + // + // stop the interrupt pipe so the continuous reader will stop and we can do sync reads + // + WdfIoTargetStop(usbDeviceContext->InterruptPipeIoTarget, WdfIoTargetCancelSentIo); + + Status = STATUS_SUCCESS; + + MbbBusSelectDataAltSetting(BusObject, ALT_DATA_SETTING_0); + + ACQUIRE_PASSIVE_LOCK(&BusObject->Lock); + + BusObject->State = BUS_STATE_CLOSED; + + RELEASE_PASSIVE_LOCK(&BusObject->Lock); + + + return Status; +} + +BOOLEAN +MbbBusIsStoped(_In_ MBB_BUS_HANDLE BusHandle) +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + return BusObject->State == BUS_STATE_CLOSED; +} + +NTSTATUS +MbbBusOpen(_In_ MBB_BUS_HANDLE BusHandle, _In_ ULONG TransactionId, _In_opt_ PVOID FastIOSendNetBufferListsComplete, _In_opt_ PVOID FastIOIndicateReceiveNetBufferLists) +/* + Description + + Opens the session with the device + + Parameters + __in MBB_BUS_HANDLE BusHandle, + BusHandle identifies the instance of the bus layer. + + + Return Value + + NTSTATUS_SUCCESS + Information was successfully returned in the BusParameters structure. + + NTSTATUS_INVALID_PARAMETER + One of the required parameters is missing or bad. + + Other failure code +*/ +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + NTSTATUS Status; + BOOLEAN FailOpen = FALSE; + + PUSB_CDC_NOTIFICATION Notification = NULL; + BOOLEAN AltSettingSet = FALSE; + + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + + ACQUIRE_PASSIVE_LOCK(&BusObject->Lock); + + if (BusObject->State != BUS_STATE_CLOSED) + { + FailOpen = TRUE; + } + else + { + BusObject->State = BUS_STATE_OPENING; + } + + RELEASE_PASSIVE_LOCK(&BusObject->Lock); + + if (FailOpen) + { + Status = STATUS_UNSUCCESSFUL; + + + goto Cleanup; + } + + usbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + + Status = MbbBusResetDeviceAndSetParms(BusObject); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + Status = MbbBusSelectDataAltSetting(BusObject, ALT_DATA_SETTING_1); + + if (NT_ERROR(Status)) + { + goto Cleanup; + } + + AltSettingSet = TRUE; + + Status = MbbBusHandshake(BusObject, TransactionId, FastIOSendNetBufferListsComplete, FastIOIndicateReceiveNetBufferLists); + if (NT_ERROR(Status)) + { + goto Cleanup; + } + + // + // start the continouse reader now + // + Status = WdfIoTargetStart(usbDeviceContext->InterruptPipeIoTarget); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + Status = STATUS_SUCCESS; + + ACQUIRE_PASSIVE_LOCK(&BusObject->Lock); + + BusObject->State = BUS_STATE_OPENED; + + RELEASE_PASSIVE_LOCK(&BusObject->Lock); + +Cleanup: + + if (!NT_SUCCESS(Status)) + { + // + // stop the pipe reader + // + WdfIoTargetStop(usbDeviceContext->InterruptPipeIoTarget, WdfIoTargetCancelSentIo); + + // + // set the data pipes back to alt seeting 0 + // + if (AltSettingSet) + { + MbbBusSelectDataAltSetting(BusObject, ALT_DATA_SETTING_0); + } + + ACQUIRE_PASSIVE_LOCK(&BusObject->Lock); + + BusObject->State = BUS_STATE_CLOSED; + + RELEASE_PASSIVE_LOCK(&BusObject->Lock); + } + + return Status; +} + +NTSTATUS +MbbBusClose(__in MBB_BUS_HANDLE BusHandle, __in ULONG TransactionId, __in BOOLEAN ForceClose) +/* + Description + + Opens the session with the device + + Parameters + __in MBB_BUS_HANDLE BusHandle, + BusHandle identifies the instance of the bus layer. + + + Return Value + + NTSTATUS_SUCCESS + Information was successfully returned in the BusParameters structure. + + NTSTATUS_INVALID_PARAMETER + One of the required parameters is missing or bad. + + Other failure code +*/ + +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + NTSTATUS Status; + BOOLEAN FailClose = FALSE; + + ULONG BytesTransfered = 0; + PUSB_CDC_NOTIFICATION Notification = NULL; + MBB_CLOSE_MESSAGE CloseMessage; + PMBB_CLOSE_DONE CloseDoneMessage = NULL; + UCHAR ReadBuffer[256]; + + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + + + ACQUIRE_PASSIVE_LOCK(&BusObject->Lock); + + if (!ForceClose) + { + if (BusObject->State != BUS_STATE_OPENED) + { + FailClose = TRUE; + } + } + + RELEASE_PASSIVE_LOCK(&BusObject->Lock); + + if (FailClose) + { + Status = STATUS_UNSUCCESSFUL; + + goto Cleanup; + } + + usbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + // + // stop the interrupt pipe so the continuous reader will stop and we can do sync reads + // + WdfIoTargetStop(usbDeviceContext->InterruptPipeIoTarget, WdfIoTargetCancelSentIo); + + RtlZeroMemory(&CloseMessage, sizeof(CloseMessage)); + + CloseMessage.MessageHeader.MessageType = MBB_MESSAGE_TYPE_CLOSE; + CloseMessage.MessageHeader.MessageLength = sizeof(CloseMessage); + CloseMessage.MessageHeader.MessageTransactionId = TransactionId; + + Status = TransactControlChannel( + BusObject, DEFAULT_IO_TIMEOUT, (PUCHAR)&CloseMessage, sizeof(CloseMessage), (PUCHAR)&ReadBuffer[0], sizeof(ReadBuffer), &BytesTransfered); + + if (NT_SUCCESS(Status)) + { + if (BytesTransfered < sizeof(*CloseDoneMessage)) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + } + } + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + CloseDoneMessage = (PMBB_CLOSE_DONE)&ReadBuffer[0]; + + if ((CloseDoneMessage->MessageHeader.MessageType != MBB_MESSAGE_TYPE_CLOSE_DONE) || + (CloseDoneMessage->MessageHeader.MessageLength < sizeof(*CloseDoneMessage)) || + (CloseDoneMessage->MessageHeader.MessageTransactionId != CloseMessage.MessageHeader.MessageTransactionId)) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + + goto Cleanup; + } + +Cleanup: + + Status = STATUS_SUCCESS; + + MbbBusSelectDataAltSetting(BusObject, ALT_DATA_SETTING_0); + + ACQUIRE_PASSIVE_LOCK(&BusObject->Lock); + + BusObject->State = BUS_STATE_CLOSED; + + RELEASE_PASSIVE_LOCK(&BusObject->Lock); + + return Status; +} + +VOID MbbBusSetNotificationState(__in MBB_BUS_HANDLE BusHandle, __in BOOLEAN Enabled) + +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + + usbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + if (!Enabled) + { + WdfIoTargetStop(usbDeviceContext->InterruptPipeIoTarget, WdfIoTargetCancelSentIo); + } + else + { + (void)WdfIoTargetStart(usbDeviceContext->InterruptPipeIoTarget); + } + + return; +} \ No newline at end of file diff --git a/network/wwan/cxwmbclass/cxwmbclass.rc b/network/wwan/cxwmbclass/cxwmbclass.rc new file mode 100644 index 00000000..6df53fd8 --- /dev/null +++ b/network/wwan/cxwmbclass/cxwmbclass.rc @@ -0,0 +1,20 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// +#include "windows.h" +#include "ntverp.h" + +/*-----------------------------------------------*/ +/* the following lines are specific to this file */ +/*-----------------------------------------------*/ + +#define VER_FILETYPE VFT_DRV + +#define VER_FILESUBTYPE VFT2_DRV_NETWORK + +#define VER_FILEDESCRIPTION_STR "Windows Mobile Broadband Class Driver" + +#define VER_INTERNALNAME_STR "cxwmbclass.sys" +#define VER_ORIGINALFILENAME_STR "cxwmbclass.sys" + +#include "common.ver" diff --git a/network/wwan/cxwmbclass/cxwmbclass.sln b/network/wwan/cxwmbclass/cxwmbclass.sln new file mode 100644 index 00000000..249990f1 --- /dev/null +++ b/network/wwan/cxwmbclass/cxwmbclass.sln @@ -0,0 +1,35 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32929.385 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cxwmbclass", "cxwmbclass\cxwmbclass.vcxproj", "{11CC63F7-F6D0-4CED-99BA-C5FDAE88D29C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {11CC63F7-F6D0-4CED-99BA-C5FDAE88D29C}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {11CC63F7-F6D0-4CED-99BA-C5FDAE88D29C}.Debug|ARM64.Build.0 = Debug|ARM64 + {11CC63F7-F6D0-4CED-99BA-C5FDAE88D29C}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {11CC63F7-F6D0-4CED-99BA-C5FDAE88D29C}.Debug|x64.ActiveCfg = Debug|x64 + {11CC63F7-F6D0-4CED-99BA-C5FDAE88D29C}.Debug|x64.Build.0 = Debug|x64 + {11CC63F7-F6D0-4CED-99BA-C5FDAE88D29C}.Debug|x64.Deploy.0 = Debug|x64 + {11CC63F7-F6D0-4CED-99BA-C5FDAE88D29C}.Release|ARM64.ActiveCfg = Release|ARM64 + {11CC63F7-F6D0-4CED-99BA-C5FDAE88D29C}.Release|ARM64.Build.0 = Release|ARM64 + {11CC63F7-F6D0-4CED-99BA-C5FDAE88D29C}.Release|ARM64.Deploy.0 = Release|ARM64 + {11CC63F7-F6D0-4CED-99BA-C5FDAE88D29C}.Release|x64.ActiveCfg = Release|x64 + {11CC63F7-F6D0-4CED-99BA-C5FDAE88D29C}.Release|x64.Build.0 = Release|x64 + {11CC63F7-F6D0-4CED-99BA-C5FDAE88D29C}.Release|x64.Deploy.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3DEAC1E8-F245-49DC-AD26-8A3694201775} + EndGlobalSection +EndGlobal diff --git a/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf b/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf new file mode 100644 index 00000000..69055bfb --- /dev/null +++ b/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf @@ -0,0 +1,119 @@ +;------------------------------------------------------------------------------- +; netwmbclass.inf +; +; Copyright (c) Microsoft Corporation. All rights reserved. + +[version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} +Provider = %ManufacturerName% +CatalogFile=cxwmbclass.cat +DriverVer = ; will be filled in at build time by StampInf +PnpLockdown = 1 + +[SourceDisksNames] +3426=windows cd + +[SourceDisksFiles] +cxwmbclass.sys = 3426 + +[DestinationDirs] +DefaultDestDir=13 + +[Manufacturer] +%ManufacturerName% = Msft,NT$ARCH$ + +[Msft.NT$ARCH$] + ; DisplayName Section DeviceID + ; ----------- ------- -------- +;%wmbclass.DeviceDesc% = wmbclass.ndi, USB\MS_COMP_MBIM +;%wmbclass.DeviceDesc% = wmbclass.ndi, USB\class_02&subclass_0e&prot_00 +%wmbclass.DeviceDesc% = wmbclass.ndi, USB\VID_1199&PID_9071&MI_0C ;Sierra Wireless EM7430 Qualcomm Snapdragon X7 LTE-A + +;------------------------------------------------------------------------------- +; Adapter DDInstall and Services section +; for NetAdapter drivers +[wmbclass.ndi] +AddReg = wmbclass.Reg +CopyFiles = wmbclassCopyFiles +Characteristics = 0x4 ; NCF_PHYSICAL +BusType = 15 +*IfType = 243; IF_TYPE_WWANPP +*MediaType = 9; NdisMediumWirelessWan +*PhysicalMediaType = 8; NdisPhysicalMediumWirelessWan +EnableDhcp = 0; Disable DHCP + +[wmbclassCopyFiles] +cxwmbclass.sys,,,0x0100 + +[wmbclass.ndi.HW] +Include = pci.inf +Needs = PciD3ColdSupported.HW +AddReg = wmbclass.ndi.AddReg.HW + +[wmbclass.ndi.AddReg.HW] +HKR,,"AllowIdleIrpInD3",0x00010001,0x1 + +[wmbclass.ndi.Services] +AddService = %ServiceName%, 2, wmbclass.Service, wmbclass.EventLog + +; For mobile broadband drivers +[wmbclass.Reg] +HKR, Ndi, Service, 0, %ServiceName% +HKR, Ndi\Interfaces, UpperRange, 0, "flpp4, flpp6" +HKR, Ndi\Interfaces, LowerRange, 0, "ppip" +HKR, , AllowDriverToOverrideDeviceName, 0x00010001, 1 + +; standard INF keywords for NetAdapter drivers +; using AddReg directive so they will work when this INF being Includes/Needs + +HKR, NetworkInterface, *IfConnectorPresent, 0x00010001, 1 +HKR, NetworkInterface, *ConnectionType, 0x00010001, 1 +HKR, NetworkInterface, *DirectionType, 0x00010001, 0 +HKR, NetworkInterface, *AccessType, 0x00010001, 2 +HKR, NetworkInterface, *HardwareLoopback, 0x00010001, 0 +HKR, , NumberOfNetworkInterfaces, 0x00010001, 17 + +; Selective Suspend +HKR,Ndi\params\*SelectiveSuspend,ParamDesc,,%SelectiveSuspend% +HKR,Ndi\params\*SelectiveSuspend,default,,"1" +HKR,Ndi\params\*SelectiveSuspend,type,,"enum" +HKR,Ndi\params\*SelectiveSuspend\enum,0,,%Disabled% +HKR,Ndi\params\*SelectiveSuspend\enum,1,,%Enabled% + +;----------------------------------------------------------------------------- +; Driver and Service Section +; + +; For wmbclass.x drivers +[wmbclass.Service] +DisplayName = %wmbclass.Service.DispName% +ServiceType = 1 ;%SERVICE_KERNEL_DRIVER% +StartType = 3 ;%SERVICE_DEMAND_START% +ErrorControl = 1 ;%SERVICE_ERROR_NORMAL% +ServiceBinary = %13%\cxwmbclass.sys +LoadOrderGroup = NDIS + +[wmbclass.EventLog] +AddReg = wmbclass.AddEventLog.Reg + +[wmbclass.AddEventLog.Reg] +HKR, , EventMessageFile, 0x00020000, "%%SystemRoot%%\System32\netevent.dll" +HKR, , TypesSupported, 0x00010001, 7 + +;----------------------------------------------------------------------------- +; Non-localizable Strings +; +[Strings] +ServiceName = "cxwmbclass" + +;----------------------------------------------------------------------------- +; Localizable Strings +; +ManufacturerName = "Sample Code" +wmbclass.DeviceDesc = "Generic Mobile Broadband Adapter" +wmbclass.Service.DispName = "USB Mobile Broadband Adapter Driver" +Disabled = "Disabled" +Enabled = "Enabled" +SelectiveSuspend = "Selective Suspend" diff --git a/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.vcxproj b/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.vcxproj new file mode 100644 index 00000000..9d7d5b16 --- /dev/null +++ b/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.vcxproj @@ -0,0 +1,176 @@ + + + + + Debug + x64 + + + Release + x64 + + + Debug + ARM64 + + + Release + ARM64 + + + + {11CC63F7-F6D0-4CED-99BA-C5FDAE88D29C} + {1bc93793-694f-48fe-9372-81e2b05556fd} + v4.5 + 12.0 + Debug + x64 + cxwmbclass + + + + Windows10 + true + WindowsKernelModeDriver10.0 + Driver + KMDF + Universal + + + Windows10 + false + WindowsKernelModeDriver10.0 + Driver + KMDF + Universal + + + Windows10 + true + WindowsKernelModeDriver10.0 + Driver + KMDF + Universal + + + Windows10 + false + WindowsKernelModeDriver10.0 + Driver + KMDF + Universal + + + + + + + + + + + DbgengKernelDebugger + $(SolutionDir)\inc;$(IncludePath) + $(KIT_SHARED_INC_PATH_WDK)\netcx\shared\1.0;$(KM_IncludePath)\mbbcx\1.0;$(KIT_SHARED_INC_PATH_WDK);$(KM_IncludePath)\netcx\kmdf\adapter\2.3;$(ExternalIncludePath) + + + DbgengKernelDebugger + $(SolutionDir)\inc;$(IncludePath) + $(KIT_SHARED_INC_PATH_WDK)\netcx\shared\1.0;$(KM_IncludePath)\mbbcx\1.0;$(KIT_SHARED_INC_PATH_WDK);$(KM_IncludePath)\netcx\kmdf\adapter\2.3;$(ExternalIncludePath) + + + DbgengKernelDebugger + $(SolutionDir)\inc;$(IncludePath) + $(KIT_SHARED_INC_PATH_WDK)\netcx\shared\1.0;$(KM_IncludePath)\mbbcx\1.0;$(KIT_SHARED_INC_PATH_WDK);$(KM_IncludePath)\netcx\kmdf\adapter\2.3;$(ExternalIncludePath) + + + DbgengKernelDebugger + $(SolutionDir)\inc;$(IncludePath) + $(KIT_SHARED_INC_PATH_WDK)\netcx\shared\1.0;$(KM_IncludePath)\mbbcx\1.0;$(KIT_SHARED_INC_PATH_WDK);$(KM_IncludePath)\netcx\kmdf\adapter\2.3;$(ExternalIncludePath) + + + + sha256 + + + 4748;%(DisableSpecificWarnings);4101;4189;4100;4267 + Level3 + + + $(WindowsDDK_LibraryPath)\x64\ndis.lib;$(WindowsDDK_LibraryPath)\x64\netio.lib;$(WindowsDDK_LibraryPath)\x64\usbd.lib;$(WindowsDDK_LibraryPath)\x64\usbdex.lib;$(WindowsDDK_LibraryPath)\x64\wdmguid.lib;$(WindowsDDK_LibraryPath)\x64\netcx\kmdf\adapter\2.3\netadaptercxstub.lib;$(WindowsDDK_LibraryPath)\x64\mbbcx\1.0\mbbcxstub.lib;%(AdditionalDependencies) + + + + + sha256 + + + Level3 + + + $(WindowsDDK_LibraryPath)\x64\ndis.lib;$(WindowsDDK_LibraryPath)\x64\netio.lib;$(WindowsDDK_LibraryPath)\x64\usbd.lib;$(WindowsDDK_LibraryPath)\x64\usbdex.lib;$(WindowsDDK_LibraryPath)\x64\wdmguid.lib;$(WindowsDDK_LibraryPath)\x64\netcx\kmdf\adapter\2.3\netadaptercxstub.lib;$(WindowsDDK_LibraryPath)\x64\mbbcx\1.0\mbbcxstub.lib;%(AdditionalDependencies) + + + + + sha256 + + + Level3 + + + $(WindowsDDK_LibraryPath)\arm64\ndis.lib;$(WindowsDDK_LibraryPath)\arm64\netio.lib;$(WindowsDDK_LibraryPath)\arm64\usbd.lib;$(WindowsDDK_LibraryPath)\arm64\usbdex.lib;$(WindowsDDK_LibraryPath)\arm64\wdmguid.lib;$(WindowsDDK_LibraryPath)\arm64\netcx\kmdf\adapter\2.3\netadaptercxstub.lib;$(WindowsDDK_LibraryPath)\arm64\mbbcx\1.0\mbbcxstub.lib;%(AdditionalDependencies) + + + + + sha256 + + + Level3 + + + $(WindowsDDK_LibraryPath)\arm64\ndis.lib;$(WindowsDDK_LibraryPath)\arm64\netio.lib;$(WindowsDDK_LibraryPath)\arm64\usbd.lib;$(WindowsDDK_LibraryPath)\arm64\usbdex.lib;$(WindowsDDK_LibraryPath)\arm64\wdmguid.lib;$(WindowsDDK_LibraryPath)\arm64\netcx\kmdf\adapter\2.3\netadaptercxstub.lib;$(WindowsDDK_LibraryPath)\arm64\mbbcx\1.0\mbbcxstub.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.vcxproj.filters b/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.vcxproj.filters new file mode 100644 index 00000000..7136df25 --- /dev/null +++ b/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.vcxproj.filters @@ -0,0 +1,107 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {8E41214B-6785-4CFE-B992-037D68949A14} + inf;inv;inx;mof;mc; + + + + + Driver Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/network/wwan/cxwmbclass/datapipe.cpp b/network/wwan/cxwmbclass/datapipe.cpp new file mode 100644 index 00000000..4452b761 --- /dev/null +++ b/network/wwan/cxwmbclass/datapipe.cpp @@ -0,0 +1,998 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#include "precomp.h" + +typedef struct _USB_WRITE_REQ_CONTEXT +{ + WDFMEMORY UrbMemory; + PURB Urb; + PMDL Mdl; + WDFMEMORY LookasideBuffer; + PBUS_OBJECT BusObject; + MBB_BUS_SEND_DATA_COMPLETION_CALLBACK Callback; + MBB_REQUEST_HANDLE RequestHandle; + +} USB_WRITE_REQ_CONTEXT, *PUSB_WRITE_REQ_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(USB_WRITE_REQ_CONTEXT, GetWriteRequestContext) + +EVT_WDF_USB_READER_COMPLETION_ROUTINE BulkInReadComplete; + +EVT_WDF_USB_READERS_FAILED BulkInReadError; + +NTSTATUS +GetWriteRequests(WDFUSBDEVICE UsbDevice, WDFREQUEST* ReturnedWriteRequest); + +VOID FreeWriteRequest(WDFUSBDEVICE UsbDevice, WDFREQUEST WriteRequest); + +NTSTATUS +MbbBusSelectDataAltSetting(__in MBB_BUS_HANDLE BusHandle, __in UCHAR AltSetting) + +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + WDF_USB_INTERFACE_SELECT_SETTING_PARAMS SettingParams; + WDFUSBINTERFACE UsbInterface = NULL; + WDF_USB_PIPE_INFORMATION pipeInfo; + WDFUSBPIPE pipe; + UCHAR ConfiguredPipes = 0; + UCHAR index = 0; + NTSTATUS Status; + NTSTATUS TempStatus; + WDF_USB_CONTINUOUS_READER_CONFIG ReaderConfig; + + usbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + WdfWaitLockAcquire(usbDeviceContext->PipeStateLock, NULL); + + UsbInterface = WdfUsbTargetDeviceGetInterface(BusObject->WdfUsbDevice, usbDeviceContext->WdfDataInterfaceIndex); + + WDF_USB_INTERFACE_SELECT_SETTING_PARAMS_INIT_SETTING(&SettingParams, AltSetting == 0 ? 0 : usbDeviceContext->UsbDataInterfaceSetting); + + Status = WdfUsbInterfaceSelectSetting(UsbInterface, NULL, &SettingParams); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + ConfiguredPipes = WdfUsbInterfaceGetNumConfiguredPipes(UsbInterface); + + if (((AltSetting == ALT_DATA_SETTING_0) && (ConfiguredPipes != ALT_DATA_SETTING_0_PIPES)) || + ((AltSetting == ALT_DATA_SETTING_1) && (ConfiguredPipes != ALT_DATA_SETTING_1_PIPES))) + { + Status = STATUS_UNSUCCESSFUL; + + goto Cleanup; + } + + if (AltSetting == ALT_DATA_SETTING_1) + { + for (index = 0; index < ConfiguredPipes; index++) + { + + WDF_USB_PIPE_INFORMATION_INIT(&pipeInfo); + + pipe = WdfUsbInterfaceGetConfiguredPipe( + UsbInterface, + index, // PipeIndex, + &pipeInfo); + + if (WdfUsbPipeTypeBulk == pipeInfo.PipeType) + { + + if (WdfUsbTargetPipeIsInEndpoint(pipe)) + { + usbDeviceContext->BulkInputPipeConfigured = TRUE; + usbDeviceContext->BulkInputPipe = pipe; + usbDeviceContext->BulkInputPipeMaxPacket = pipeInfo.MaximumPacketSize; + } + else + { + usbDeviceContext->BulkOutputPipeConfigured = TRUE; + usbDeviceContext->BulkOutputPipe = pipe; + usbDeviceContext->BulkOutputPipeMaxPacket = pipeInfo.MaximumPacketSize; + } + } + else + { + + Status = STATUS_UNSUCCESSFUL; + + goto Cleanup; + } + } + + if (!(usbDeviceContext->BulkInputPipeConfigured && usbDeviceContext->BulkOutputPipeConfigured)) + { + Status = STATUS_UNSUCCESSFUL; + + goto Cleanup; + } + + // + // configure the continous reader on the bulk pipe now, since this can only be done once on a given pipe + // unless it is unselected + // + WDF_USB_CONTINUOUS_READER_CONFIG_INIT(&ReaderConfig, BulkInReadComplete, BusObject, BusObject->MaxBulkInTransfer); + + if (BusObject->UsbCapDeviceInfo.DeviceInfoHeader.DeviceType == USB_CAP_DEVICE_TYPE_UDE_MBIM) + { + ReaderConfig.NumPendingReads = PENDING_BULK_IN_READS_FOR_UDE_MBIM; + } + else + { + ReaderConfig.NumPendingReads = PENDING_BULK_IN_READS; + } + ReaderConfig.HeaderLength = BusObject->BulkInHeaderSize; + ReaderConfig.EvtUsbTargetPipeReadersFailed = BulkInReadError; + + Status = WdfUsbTargetPipeConfigContinuousReader(usbDeviceContext->BulkInputPipe, &ReaderConfig); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + // + // call this now that the pipe is configured + // + PreAllocateWriteRequests(BusObject->WdfUsbDevice); + } + else + { + // + // selecting the setting causes the frame work to delete the pipe + // + WDFREQUEST WriteRequest = NULL; + + usbDeviceContext->BulkInputPipeConfigured = FALSE; + usbDeviceContext->BulkInputPipe = NULL; + + usbDeviceContext->BulkOutputPipeConfigured = FALSE; + usbDeviceContext->BulkOutputPipe = NULL; + + WdfSpinLockAcquire(usbDeviceContext->WriteCollectionLock); + + WriteRequest = (WDFREQUEST)WdfCollectionGetLastItem(usbDeviceContext->WriteRequestCollection); + + // + // delete the write request because they are associated with a pipe object + // + while (WriteRequest != NULL) + { + WdfCollectionRemove(usbDeviceContext->WriteRequestCollection, WriteRequest); + + WdfObjectDelete(WriteRequest); + WriteRequest = (WDFREQUEST)WdfCollectionGetLastItem(usbDeviceContext->WriteRequestCollection); + } + + WdfSpinLockRelease(usbDeviceContext->WriteCollectionLock); + } + +Cleanup: + + if (!NT_SUCCESS(Status)) + { + // + // failed to configure the pipes, set back to alt setting 0 + // + WDF_USB_INTERFACE_SELECT_SETTING_PARAMS_INIT_SETTING(&SettingParams, 0); + + TempStatus = WdfUsbInterfaceSelectSetting(UsbInterface, NULL, &SettingParams); + + usbDeviceContext->BulkInputPipeConfigured = FALSE; + usbDeviceContext->BulkInputPipe = NULL; + + usbDeviceContext->BulkOutputPipeConfigured = FALSE; + usbDeviceContext->BulkOutputPipe = NULL; + } + + WdfWaitLockRelease(usbDeviceContext->PipeStateLock); + + return Status; +} + +NTSTATUS +MbbUsbDeviceStartDataPipes(__in PUSB_DEVICE_CONTEXT usbDeviceContext) +{ + NTSTATUS Status; + + WdfWaitLockAcquire(usbDeviceContext->PipeStateLock, NULL); + + if (!(usbDeviceContext->BulkInputPipeConfigured && usbDeviceContext->BulkOutputPipeConfigured)) + { + Status = STATUS_UNSUCCESSFUL; + + goto Cleanup; + } + + Status = WdfIoTargetStart(WdfUsbTargetPipeGetIoTarget(usbDeviceContext->BulkInputPipe)); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + usbDeviceContext->BulkInputPipeStarted = TRUE; + + Status = WdfIoTargetStart(WdfUsbTargetPipeGetIoTarget(usbDeviceContext->BulkOutputPipe)); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + usbDeviceContext->BulkOutputPipeStarted = TRUE; + +Cleanup: + + if (!NT_SUCCESS(Status)) + { + // + // failed to configure the pipes, set back to alt setting 0 + // + if (usbDeviceContext->BulkInputPipeStarted) + { + WdfIoTargetStop(WdfUsbTargetPipeGetIoTarget(usbDeviceContext->BulkInputPipe), WdfIoTargetCancelSentIo); + } + + if (usbDeviceContext->BulkOutputPipeStarted) + { + WdfIoTargetStop(WdfUsbTargetPipeGetIoTarget(usbDeviceContext->BulkOutputPipe), WdfIoTargetCancelSentIo); + } + + usbDeviceContext->BulkInputPipeStarted = FALSE; + usbDeviceContext->BulkOutputPipeStarted = FALSE; + } + + WdfWaitLockRelease(usbDeviceContext->PipeStateLock); + + return Status; +} + +NTSTATUS +MbbBusStartDataPipes(__in MBB_BUS_HANDLE BusHandle) +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + return MbbUsbDeviceStartDataPipes(GetUsbDeviceContext(BusObject->WdfUsbDevice)); +} + +VOID MbbUsbDeviceStopDataPipes(__in PUSB_DEVICE_CONTEXT usbDeviceContext) +{ + WDFUSBINTERFACE UsbInterface = NULL; + + WdfWaitLockAcquire(usbDeviceContext->PipeStateLock, NULL); + + if (usbDeviceContext->BulkInputPipeConfigured) + { + WdfIoTargetStop(WdfUsbTargetPipeGetIoTarget(usbDeviceContext->BulkInputPipe), WdfIoTargetCancelSentIo); + } + if (usbDeviceContext->BulkOutputPipeConfigured) + { + WdfIoTargetStop(WdfUsbTargetPipeGetIoTarget(usbDeviceContext->BulkOutputPipe), WdfIoTargetCancelSentIo); + } + + usbDeviceContext->BulkInputPipeStarted = FALSE; + + usbDeviceContext->BulkOutputPipeStarted = FALSE; + + WdfWaitLockRelease(usbDeviceContext->PipeStateLock); + + return; +} + +VOID MbbBusStopDataPipes(__in MBB_BUS_HANDLE BusHandle) +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + PUSB_DEVICE_CONTEXT usbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + WdfWorkItemFlush(usbDeviceContext->BulkPipeResetWorkitem); + + MbbUsbDeviceStopDataPipes(GetUsbDeviceContext(BusObject->WdfUsbDevice)); +} + +NTSTATUS +MbbUsbDeviceResetBulkPipe(__in PUSB_DEVICE_CONTEXT usbDeviceContext, __in BOOLEAN Out) + +{ + WDFUSBPIPE Pipe = NULL; + WDF_REQUEST_SEND_OPTIONS SendOptions; + NTSTATUS StatusToReturn = STATUS_SUCCESS; + NTSTATUS Status; + + WdfWaitLockAcquire(usbDeviceContext->PipeStateLock, NULL); + + if (Out ? usbDeviceContext->BulkOutputPipeConfigured : usbDeviceContext->BulkInputPipeConfigured) + { + + Pipe = Out ? usbDeviceContext->BulkOutputPipe : usbDeviceContext->BulkInputPipe; + + WDF_REQUEST_SEND_OPTIONS_INIT(&SendOptions, WDF_REQUEST_SEND_OPTION_IGNORE_TARGET_STATE); + + WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(&SendOptions, WDF_REL_TIMEOUT_IN_SEC(30)); + + Status = WdfUsbTargetPipeAbortSynchronously(Pipe, NULL, &SendOptions); + + if (!NT_SUCCESS(Status)) + { + if (StatusToReturn == STATUS_SUCCESS) + { + StatusToReturn = Status; + } + } + + WDF_REQUEST_SEND_OPTIONS_INIT(&SendOptions, WDF_REQUEST_SEND_OPTION_IGNORE_TARGET_STATE); + + WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(&SendOptions, WDF_REL_TIMEOUT_IN_SEC(30)); + + Status = WdfUsbTargetPipeResetSynchronously(Pipe, NULL, &SendOptions); + + if (!NT_SUCCESS(Status)) + { + if (StatusToReturn == STATUS_SUCCESS) + { + StatusToReturn = Status; + } + } + } + WdfWaitLockRelease(usbDeviceContext->PipeStateLock); + + return StatusToReturn; +} + +NTSTATUS +MbbBusResetBulkPipe(__in MBB_BUS_HANDLE BusHandle, __in BOOLEAN Out) +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + return MbbUsbDeviceResetBulkPipe(GetUsbDeviceContext(BusObject->WdfUsbDevice), Out); +} + +EVT_WDF_REQUEST_COMPLETION_ROUTINE WriteCompletionRoutine; + +void WriteCompletionRoutine(__in WDFREQUEST Request, __in WDFIOTARGET Target, __in PWDF_REQUEST_COMPLETION_PARAMS CompletionParams, __in WDFCONTEXT Context) +/*++ + +Routine Description + + Request - Handle to the WDFREQUEST which was used to send data to the USB target. + Target - Handle to the Iotarget to which teh Request was sent. COnceptually this + is the BULK USB __out pipe(on of Data or beacon) + CompletionParams - In case of USB this contains the USB status and amount of bytes transferred + + + Context - This is the COntext we set in WdfRequestSend + + +Arguments: + + + +Return Value: + + + +--*/ + +{ + PUSB_WRITE_REQ_CONTEXT WriteContext; + NTSTATUS Status; + + UNREFERENCED_PARAMETER(Target); + WriteContext = (PUSB_WRITE_REQ_CONTEXT)Context; + + Status = CompletionParams->IoStatus.Status; + + // + // For usb devices, we should look at the Usb.Completion param. + // + + if (WriteContext->Callback != NULL) + { + (*WriteContext->Callback)(WriteContext->BusObject->ProtocolHandle, WriteContext->RequestHandle, Status, WriteContext->Mdl); + } + + if (WriteContext->LookasideBuffer != NULL) + { + + WdfObjectDelete(WriteContext->LookasideBuffer); + } + + if (WriteContext->UrbMemory != NULL) + { + WdfObjectDelete(WriteContext->UrbMemory); + } + + FreeWriteRequest(WriteContext->BusObject->WdfUsbDevice, Request); +} + +NTSTATUS +MbbBusWriteData(__in MBB_BUS_HANDLE BusHandle, __in MBB_REQUEST_HANDLE RequestHandle, __in PMDL Mdl, __in MBB_BUS_SEND_DATA_COMPLETION_CALLBACK Callback) + +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + PMDL TempMdl = NULL; + ULONGLONG TotalTransferLength = 0; + NTSTATUS Status; + WDFMEMORY urbMemory = NULL; + WDF_OBJECT_ATTRIBUTES objectAttribs; + PURB urbBuffer = NULL; + WDF_REQUEST_SEND_OPTIONS SendOptions; + WDFREQUEST WriteRequest = NULL; + USBD_PIPE_HANDLE usbdPipeHandle = NULL; + PUSB_WRITE_REQ_CONTEXT writeContext = NULL; + BOOLEAN SentToDevice = FALSE; + WDFMEMORY BufferMemoryObject = NULL; + WDFREQUEST WriteRequestZLP = NULL; + PUSB_WRITE_REQ_CONTEXT writeContextZLP = NULL; + + usbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + if (!ExAcquireRundownProtection(&usbDeviceContext->BulkPipeResetRundown)) + { + return STATUS_NDIS_ADAPTER_NOT_READY; + } + + // + // make sure the length is not too big + // + TempMdl = Mdl; + + while (TempMdl != NULL) + { + TotalTransferLength += MmGetMdlByteCount(TempMdl); + + TempMdl = TempMdl->Next; + } + + if (TotalTransferLength > BusObject->NtbParam.dwNtbOutMaxSize) + { + // + // too big + // + Status = STATUS_UNSUCCESSFUL; + + goto Cleanup; + } + + if ((TotalTransferLength < BusObject->NtbParam.dwNtbOutMaxSize) && (TotalTransferLength % usbDeviceContext->BulkOutputPipeMaxPacket == 0)) + { + // + // The transfer length is less than the max out transfer size, and transfer length is a multiple of MaxPacket size. + // Need to send a ZLP to the device stack to terminated the transfer. + + Status = GetWriteRequests(BusObject->WdfUsbDevice, &WriteRequestZLP); + + if (!NT_SUCCESS(Status)) + { + + goto Cleanup; + } + + writeContextZLP = GetWriteRequestContext(WriteRequestZLP); + + writeContextZLP->BusObject = BusObject; + writeContextZLP->Callback = NULL; + } + + Status = GetWriteRequests(BusObject->WdfUsbDevice, &WriteRequest); + + if (!NT_SUCCESS(Status)) + { + + goto Cleanup; + } + + writeContext = GetWriteRequestContext(WriteRequest); + + if (usbDeviceContext->LookasideList == NULL) + { + + // + // allocate the URB, request is the parent + // + WDF_OBJECT_ATTRIBUTES_INIT(&objectAttribs); + objectAttribs.ParentObject = WriteRequest; + + Status = WdfUsbTargetDeviceCreateUrb(BusObject->WdfUsbDevice, &objectAttribs, &urbMemory, &urbBuffer); + + if (!NT_SUCCESS(Status)) + { + + goto Cleanup; + } + + // + // get the USBD pipe handle, to build the URB + // + usbdPipeHandle = WdfUsbTargetPipeWdmGetPipeHandle(usbDeviceContext->BulkOutputPipe); + + // + // NOTE : call UsbBuildInterruptOrBulkTransferRequest otherwise + // WdfUsbTargetPipeFormatRequestForUrb will assert + // with *** Assertion failed: Urb->UrbHeader.Length >= sizeof(_URB_HEADER) + // + UsbBuildInterruptOrBulkTransferRequest( + urbBuffer, + sizeof(struct _URB_BULK_OR_INTERRUPT_TRANSFER), + usbdPipeHandle, + NULL, + Mdl, + (ULONG)TotalTransferLength, + USBD_TRANSFER_DIRECTION_OUT | USBD_SHORT_TRANSFER_OK, + NULL); + + // + // By calling WdfUsbTargetPipeFormatRequestForUrb the frameworks allocate a lot of resources + // like the underlying IRP for the request and hence it is better to do it at initilization + // to prevent an avoidable failure later. + // + Status = WdfUsbTargetPipeFormatRequestForUrb(usbDeviceContext->BulkOutputPipe, WriteRequest, urbMemory, NULL); + + if (!NT_SUCCESS(Status)) + { + + goto Cleanup; + } + + writeContext->UrbMemory = urbMemory; + writeContext->Urb = (PURB)urbBuffer; + } + else + { + // + // usb stack does not support chained mdl's, double buffer the transfer + // + PUCHAR DestBuffer = NULL; + PUCHAR SourceAddress = NULL; + size_t BufferSize = 0; + ULONG SourceLength = 0; + WDFMEMORY_OFFSET MemoryOffset; + + Status = WdfMemoryCreateFromLookaside(usbDeviceContext->LookasideList, &BufferMemoryObject); + + if (!NT_SUCCESS(Status)) + { + + goto Cleanup; + } + + DestBuffer = (PUCHAR)WdfMemoryGetBuffer(BufferMemoryObject, &BufferSize); + + TempMdl = Mdl; + TotalTransferLength = 0; + while (TempMdl != NULL) + { + SourceLength = MmGetMdlByteCount(TempMdl); + + SourceAddress = (PUCHAR)MmGetSystemAddressForMdlSafe(TempMdl, NormalPagePriority | MdlMappingNoExecute); + + if (SourceAddress == NULL) + { + + Status = STATUS_INSUFFICIENT_RESOURCES; + + goto Cleanup; + } + + RtlCopyMemory(DestBuffer, SourceAddress, SourceLength); + + DestBuffer += SourceLength; + + TotalTransferLength += SourceLength; + + ASSERT(TotalTransferLength <= BufferSize); + + TempMdl = TempMdl->Next; + } + + MemoryOffset.BufferOffset = 0; + MemoryOffset.BufferLength = (ULONG)TotalTransferLength; + + Status = WdfUsbTargetPipeFormatRequestForWrite(usbDeviceContext->BulkOutputPipe, WriteRequest, BufferMemoryObject, &MemoryOffset); + if (!NT_SUCCESS(Status)) + { + + goto Cleanup; + } + + writeContext->LookasideBuffer = BufferMemoryObject; + BufferMemoryObject = NULL; + } + + // + // set REQUEST_CONTEXT parameters. + // + + writeContext->Mdl = Mdl; + writeContext->BusObject = BusObject; + writeContext->Callback = Callback; + writeContext->RequestHandle = RequestHandle; + + WdfRequestSetCompletionRoutine(WriteRequest, WriteCompletionRoutine, writeContext); + + WDF_REQUEST_SEND_OPTIONS_INIT(&SendOptions, 0); + + WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(&SendOptions, WDF_REL_TIMEOUT_IN_SEC(30)); + + SentToDevice = WdfRequestSend(WriteRequest, WdfUsbTargetPipeGetIoTarget(usbDeviceContext->BulkOutputPipe), &SendOptions); + + Status = STATUS_PENDING; + + if (!SentToDevice) + { + Status = WdfRequestGetStatus(WriteRequest); + } + else + { + WriteRequest = NULL; + } + + if (NT_SUCCESS(Status)) + { + + // + // actual data write worked, see if we need to send the zlp + // + + if (WriteRequestZLP != NULL) + { + + NTSTATUS ZlpStatus; + + Status = WdfUsbTargetPipeFormatRequestForWrite(usbDeviceContext->BulkOutputPipe, WriteRequestZLP, NULL, NULL); + if (!NT_SUCCESS(Status)) + { + + goto Cleanup; + } + + WdfRequestSetCompletionRoutine(WriteRequestZLP, WriteCompletionRoutine, writeContextZLP); + + WDF_REQUEST_SEND_OPTIONS_INIT(&SendOptions, 0); + + WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(&SendOptions, WDF_REL_TIMEOUT_IN_SEC(30)); + + SentToDevice = WdfRequestSend(WriteRequestZLP, WdfUsbTargetPipeGetIoTarget(usbDeviceContext->BulkOutputPipe), &SendOptions); + + ZlpStatus = STATUS_PENDING; + + if (!SentToDevice) + { + + ZlpStatus = WdfRequestGetStatus(WriteRequestZLP); + } + else + { + WriteRequestZLP = NULL; + } + } + } + +Cleanup: + + ExReleaseRundownProtection(&usbDeviceContext->BulkPipeResetRundown); + + if (WriteRequest != NULL) + { + if (NULL != writeContext) + { + if (NULL != writeContext->LookasideBuffer) + { + WdfObjectDelete(writeContext->LookasideBuffer); + } + if (NULL != writeContext->UrbMemory) + { + WdfObjectDelete(writeContext->UrbMemory); + } + } + + FreeWriteRequest(BusObject->WdfUsbDevice, WriteRequest); + WriteRequest = NULL; + } + + if (WriteRequestZLP != NULL) + { + FreeWriteRequest(BusObject->WdfUsbDevice, WriteRequestZLP); + WriteRequestZLP = NULL; + } + + return Status; +} + +VOID BulkInReadComplete(__in WDFUSBPIPE Pipe, __in WDFMEMORY Memory, __in size_t NumBytesTransferred, __in WDFCONTEXT Context) + +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)Context; + PUCHAR Buffer = NULL; + PMDL Mdl = NULL; + PUCHAR DataBuffer = NULL; + + if (NumBytesTransferred > 0) + { + // + // actaully got some data + // + Buffer = (PUCHAR)WdfMemoryGetBuffer(Memory, NULL); + + // + // the header at the front is where we will put the MDL + // + Mdl = (PMDL)Buffer; + + // + // the actual payload starts after the header/mdl + // + DataBuffer = Buffer + BusObject->BulkInHeaderSize; + + ASSERT(((ULONG_PTR)DataBuffer & 0x7) == 0); + + // + // bytes transfered does not include the header + // + MmInitializeMdl(Mdl, DataBuffer, NumBytesTransferred); + + MmBuildMdlForNonPagedPool(Mdl); + + ASSERT(BusObject->BulkInHeaderSize >= MmSizeOfMdl(Mdl, NumBytesTransferred)); + + WdfObjectReference(Memory); + + (*BusObject->ReceiveDataCallback)(BusObject->ProtocolHandle, Memory, Mdl); + } + + return; +} + +BOOLEAN +BulkInReadError(__in WDFUSBPIPE Pipe, __in NTSTATUS Status, __in USBD_STATUS UsbdStatus) + +{ + return TRUE; +} + +VOID MbbBusReturnReceiveBuffer(__in MBB_BUS_HANDLE BusHandle, __in MBB_RECEIVE_CONTEXT ReceiveContext, __in PMDL Mdl) + +{ + WDFMEMORY Memory = (WDFMEMORY)ReceiveContext; + + WdfObjectDereference(Memory); + + return; +} + +NTSTATUS +CreateWriteRequest(WDFUSBDEVICE UsbDevice, WDFREQUEST* ReturnedWriteRequest) + +{ + + WDFREQUEST WriteRequest = NULL; + PUSB_WRITE_REQ_CONTEXT writeContext = NULL; + WDF_OBJECT_ATTRIBUTES objectAttribs; + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + NTSTATUS Status = STATUS_INVALID_PARAMETER; + + *ReturnedWriteRequest = NULL; + + usbDeviceContext = GetUsbDeviceContext(UsbDevice); + + if (usbDeviceContext->BulkOutputPipe == NULL) + { + goto Cleanup; + } + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&objectAttribs, USB_WRITE_REQ_CONTEXT); + objectAttribs.ParentObject = UsbDevice; + + // + // create the request + // + Status = WdfRequestCreate(&objectAttribs, WdfUsbTargetPipeGetIoTarget(usbDeviceContext->BulkOutputPipe), &WriteRequest); + + if (!NT_SUCCESS(Status)) + { + + goto Cleanup; + } + + writeContext = GetWriteRequestContext(WriteRequest); + RtlZeroMemory(writeContext, sizeof(*writeContext)); + + // + // Preallocate the request timer to prevent the request from failing while trying to send it. + // + Status = WdfRequestAllocateTimer(WriteRequest); + + if (!NT_SUCCESS(Status)) + { + + goto Cleanup; + } + + Status = WdfUsbTargetPipeFormatRequestForWrite(usbDeviceContext->BulkOutputPipe, WriteRequest, NULL, NULL); + if (!NT_SUCCESS(Status)) + { + + goto Cleanup; + } + + *ReturnedWriteRequest = WriteRequest; + WriteRequest = NULL; + +Cleanup: + + if (WriteRequest != NULL) + { + WdfObjectDelete(WriteRequest); + WriteRequest = NULL; + } + + return Status; +} + +NTSTATUS +PreAllocateWriteRequests(WDFUSBDEVICE UsbDevice) + +{ + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + WDFREQUEST WriteRequest = NULL; + NTSTATUS Status; + ULONG i = 0; + + usbDeviceContext = GetUsbDeviceContext(UsbDevice); + + for (i = 0; i < MAX_PREALLOCATED_WRITE_REQUESTS; i++) + { + Status = CreateWriteRequest(UsbDevice, &WriteRequest); + + if (!NT_SUCCESS(Status)) + { + break; + } + + Status = WdfCollectionAdd(usbDeviceContext->WriteRequestCollection, WriteRequest); + + if (!NT_SUCCESS(Status)) + { + WdfObjectDelete(WriteRequest); + WriteRequest = NULL; + break; + } + } + + return Status; +} + +NTSTATUS +GetWriteRequests(WDFUSBDEVICE UsbDevice, WDFREQUEST* ReturnedWriteRequest) +{ + + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + NTSTATUS Status = STATUS_SUCCESS; + WDF_REQUEST_REUSE_PARAMS ReuseParams; + PUSB_WRITE_REQ_CONTEXT writeContext = NULL; + + usbDeviceContext = GetUsbDeviceContext(UsbDevice); + + *ReturnedWriteRequest = NULL; + + if (usbDeviceContext->BulkOutputPipe == NULL) + { + return STATUS_UNSUCCESSFUL; + } + + WdfSpinLockAcquire(usbDeviceContext->WriteCollectionLock); + + *ReturnedWriteRequest = (WDFREQUEST)WdfCollectionGetLastItem(usbDeviceContext->WriteRequestCollection); + + if (*ReturnedWriteRequest == NULL) + { + // + // the collection is empty, try creating a new one + // + WdfSpinLockRelease(usbDeviceContext->WriteCollectionLock); + + Status = CreateWriteRequest(UsbDevice, ReturnedWriteRequest); + } + else + { + + WdfCollectionRemove(usbDeviceContext->WriteRequestCollection, *ReturnedWriteRequest); + + WdfSpinLockRelease(usbDeviceContext->WriteCollectionLock); + + WDF_REQUEST_REUSE_PARAMS_INIT(&ReuseParams, 0, STATUS_SUCCESS); + + WdfRequestReuse(*ReturnedWriteRequest, &ReuseParams); + } + + if (NT_SUCCESS(Status)) + { + writeContext = GetWriteRequestContext(*ReturnedWriteRequest); + RtlZeroMemory(writeContext, sizeof(*writeContext)); + } + + return Status; +} + +VOID FreeWriteRequest(WDFUSBDEVICE UsbDevice, WDFREQUEST WriteRequest) + +{ + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + NTSTATUS Status = STATUS_SUCCESS; + ULONG RequestCount = 0; + + usbDeviceContext = GetUsbDeviceContext(UsbDevice); + + WdfSpinLockAcquire(usbDeviceContext->WriteCollectionLock); + + RequestCount = WdfCollectionGetCount(usbDeviceContext->WriteRequestCollection); + + if (RequestCount < MAX_PREALLOCATED_WRITE_REQUESTS * 2) + { + // + // put it back in the collection + // + Status = WdfCollectionAdd(usbDeviceContext->WriteRequestCollection, WriteRequest); + + if (NT_SUCCESS(Status)) + { + WriteRequest = NULL; + } + } + + WdfSpinLockRelease(usbDeviceContext->WriteCollectionLock); + + if (WriteRequest != NULL) + { + WdfObjectDelete(WriteRequest); + WriteRequest = NULL; + } + + return; +} + +VOID MbbBusResetDataPipes(_In_ MBB_BUS_HANDLE BusHandle) +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + PUSB_DEVICE_CONTEXT usbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + if (!InterlockedCompareExchange(&usbDeviceContext->BulkPipeResetFlag, TRUE, FALSE)) + { + WdfWorkItemEnqueue(usbDeviceContext->BulkPipeResetWorkitem); + } + else + { + } +} + +VOID MbbUsbDeviceCyclePort(_In_ PUSB_DEVICE_CONTEXT usbDeviceContext) +{ + NTSTATUS Status = WdfUsbTargetDeviceCyclePortSynchronously(usbDeviceContext->BusObject->WdfUsbDevice); + if (!NT_SUCCESS(Status)) + { + } +} + +void ResetDataPipeWorkItem(_In_ WDFWORKITEM WorkItem) +{ + PUSB_DEVICE_CONTEXT usbDeviceContext = GetUsbDeviceContext(WdfWorkItemGetParentObject(WorkItem)); + + ExWaitForRundownProtectionRelease(&usbDeviceContext->BulkPipeResetRundown); + ExRundownCompleted(&usbDeviceContext->BulkPipeResetRundown); + + MbbUsbDeviceStopDataPipes(usbDeviceContext); + + MbbUsbDeviceResetBulkPipe(usbDeviceContext, TRUE); + + MbbUsbDeviceCyclePort(usbDeviceContext); + + MbbUsbDeviceStartDataPipes(usbDeviceContext); + + ExReInitializeRundownProtection(&usbDeviceContext->BulkPipeResetRundown); + + InterlockedExchange(&usbDeviceContext->BulkPipeResetFlag, FALSE); +} diff --git a/network/wwan/cxwmbclass/device.cpp b/network/wwan/cxwmbclass/device.cpp new file mode 100644 index 00000000..0aadfc35 --- /dev/null +++ b/network/wwan/cxwmbclass/device.cpp @@ -0,0 +1,381 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#include "precomp.h" + +#include "device.h" +#include "rxqueue.h" + +const ULONG MBB_DEFAULT_IDLE_TIMEOUT_HINT_MS = 2u * 1000u; // 2 seconds + +_Use_decl_annotations_ VOID EvtMbbDeviceSendMbimFragment(WDFDEVICE Device, MBBREQUEST Fragment) +{ + PWMBCLASS_DEVICE_CONTEXT deviceContext = WmbClassGetDeviceContext(Device); + + size_t bufferSize = 0; + PVOID buffer = MbbRequestGetBuffer(Fragment, &bufferSize); + + auto completionRoutine = [](MBB_PROTOCOL_HANDLE, MBB_REQUEST_HANDLE RequestHandle, NTSTATUS NtStatus) { + MbbRequestComplete((MBBREQUEST)RequestHandle, NtStatus); + }; + + NTSTATUS sendStatus = MbbBusSendMessageFragment( + deviceContext->BusHandle, Fragment, buffer, (ULONG)bufferSize, (LPGUID)MbbRequestGetCorrelationId(Fragment), completionRoutine); + + // Accoding to the documentation of MbbBusSendMessageFragment the completion routine + // will be called only when ntStatus is STATUS_PENDING, so we need to call it ourselves + // for the other cases + if (sendStatus != STATUS_PENDING) + { + completionRoutine(deviceContext, Fragment, sendStatus); + } +} + +VOID MbbNdisResponseFragmentAvailable(__in MBB_PROTOCOL_HANDLE ProtocolHandle) +{ + PWMBCLASS_DEVICE_CONTEXT deviceContext = (PWMBCLASS_DEVICE_CONTEXT)ProtocolHandle; + MbbDeviceResponseAvailable(deviceContext->WdfDevice); +} + +_Use_decl_annotations_ VOID EvtMbbDeviceReceiveMbimFragment(WDFDEVICE Device, MBBREQUEST Fragment) +{ + PWMBCLASS_DEVICE_CONTEXT deviceContext = WmbClassGetDeviceContext(Device); + + size_t bufferSize = 0; + PVOID buffer = MbbRequestGetBuffer(Fragment, &bufferSize); + + auto completionRoutine = [](MBB_PROTOCOL_HANDLE, MBB_REQUEST_HANDLE RequestHandle, NTSTATUS Status, ULONG_PTR ReceivedLength) { + MbbRequestCompleteWithInformation((MBBREQUEST)RequestHandle, Status, ReceivedLength); + }; + + // Accoding to the documentation of MbbBusReceiveMessageFragment the completion routine + // will be called only when ntStatus is STATUS_PENDING, so we need to call it ourselves + // for the other cases + NTSTATUS receiveStatus = MbbBusReceiveMessageFragment( + deviceContext->BusHandle, Fragment, buffer, (ULONG)bufferSize, (LPGUID)MbbRequestGetCorrelationId(Fragment), completionRoutine); + + if (receiveStatus != STATUS_PENDING) + { + completionRoutine(deviceContext, Fragment, receiveStatus, 0); + } +} + +static NTSTATUS SetupAdapterSpecificPowerSettings(_In_ PWMBCLASS_DEVICE_CONTEXT DeviceContext) +{ + NTSTATUS status = STATUS_SUCCESS; + + if (DeviceContext->BusParams.RemoteWakeCapable) + { + // + // Configure USB selective suspend with default timeout + // + WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS idleSettings; + WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS_INIT(&idleSettings, IdleUsbSelectiveSuspend); + + idleSettings.IdleTimeout = MBB_DEFAULT_IDLE_TIMEOUT_HINT_MS; + idleSettings.IdleTimeoutType = SystemManagedIdleTimeoutWithHint; + + status = WdfDeviceAssignS0IdleSettings(DeviceContext->WdfDevice, &idleSettings); + if (!NT_SUCCESS(status)) + { + goto Exit; + } + } +Exit: + return status; +} + +NTSTATUS +MbbInitializeHardware(_In_ PWMBCLASS_DEVICE_CONTEXT DeviceContext) +{ + NTSTATUS status = STATUS_SUCCESS; + WDF_OBJECT_ATTRIBUTES attributes; + UNICODE_STRING manufacturer; + UNICODE_STRING model; + + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.ParentObject = DeviceContext->WdfDevice; + status = WdfLookasideListCreate( + &attributes, + sizeof(MBB_NDIS_RECEIVE_CONTEXT), + NonPagedPoolNx, + WDF_NO_OBJECT_ATTRIBUTES, + MbbPoolTagMdlReceive, + &DeviceContext->ReceiveLookasideList); + if (!NT_SUCCESS(status)) + { + goto Cleanup; + } + + for (int i = 0; i < MBB_MAX_NUMBER_OF_SESSIONS; i++) + { + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.ParentObject = DeviceContext->WdfDevice; + + status = WdfSpinLockCreate(&attributes, &DeviceContext->Sessions[i].WdfRecvSpinLock); + if (!NT_SUCCESS(status)) + { + goto Cleanup; + } + } + + status = MbbBusInitializeByWdf( + DeviceContext->WdfDevice, + MbbNdisResponseFragmentAvailable, + MbbNdisReceiveCallback, + nullptr, + nullptr, + DeviceContext, + &DeviceContext->BusHandle, + nullptr); + + if (status != STATUS_SUCCESS) + { + goto Cleanup; + } + + // + // Initialize the OID/CID handlers before the device is OPENED. + // Once the device is opened and the interrupt pipe is connected. + // This driver will start receiving unsolicited interrupt message + // from the device. + // + status = MbbBusQueryBusParameters(DeviceContext->BusHandle, &DeviceContext->BusParams); + + if (status != STATUS_SUCCESS) + { + goto Cleanup; + } + + WDFMEMORY sharedPaddingMemory; + ULONG sharedPaddingLength = max(DeviceContext->BusParams.NdpOutAlignment, DeviceContext->BusParams.NdpOutDivisor); + status = CreateNonPagedWdfMemory( + sharedPaddingLength, &sharedPaddingMemory, (PVOID*)&DeviceContext->sharedPaddingBuffer, DeviceContext->WdfDevice, MbbPoolTagNtbSend); + if (!NT_SUCCESS(status)) + { + goto Cleanup; + } + + RtlInitUnicodeString(&manufacturer, DeviceContext->BusParams.Manufacturer); + RtlInitUnicodeString(&model, DeviceContext->BusParams.Model); + MBB_DEVICE_MBIM_PARAMETERS mbimParams; + + // 2.0 by default + MBB_MBIM_EXTENDED_VERSION mbimExVer = MbbMbimExtendedVersion2Dot0; + switch(DeviceContext->BusParams.MbimExtendedVersion) + { + case 0x0100: + mbimExVer = MbbMbimExtendedVersion1Dot0; + break; + case 0x0200: + mbimExVer = MbbMbimExtendedVersion2Dot0; + break; + case 0x0300: + mbimExVer = MbbMbimExtendedVersion3Dot0; + break; + case 0x0400: + mbimExVer = MbbMbimExtendedVersion4Dot0; + break; + default: + status = STATUS_INVALID_PARAMETER; + goto Cleanup; + } + + MBB_DEVICE_MBIM_PARAMETERS_INIT( + &mbimParams, + DeviceContext->BusParams.IsErrataDevice ? MbbMbimVersion1Dot0Errata : MbbMbimVersion1Dot0, + DeviceContext->BusParams.FragmentSize, + mbimExVer); + + MbbDeviceSetMbimParameters(DeviceContext->WdfDevice, &mbimParams); + + MBB_DEVICE_WAKE_CAPABILITIES mbbWakeCapabilities; + MBB_DEVICE_WAKE_CAPABILITIES_INIT(&mbbWakeCapabilities); + + mbbWakeCapabilities.PacketState = TRUE; + mbbWakeCapabilities.RegisterState = TRUE; + mbbWakeCapabilities.SmsReceive = TRUE; + mbbWakeCapabilities.UiccChange = TRUE; + mbbWakeCapabilities.UssdReceive = TRUE; + + MbbDeviceSetWakeCapabilities(DeviceContext->WdfDevice, &mbbWakeCapabilities); + + status = SetupAdapterSpecificPowerSettings(DeviceContext); + if (NT_ERROR(status)) + { + goto Cleanup; + } + +Cleanup: + + if (status != STATUS_SUCCESS) + { + if (DeviceContext != NULL) + { + if (DeviceContext->BusHandle != NULL) + { + MbbBusStop(DeviceContext->BusHandle); + MbbBusCleanup(DeviceContext->BusHandle); + DeviceContext->BusHandle = NULL; + } + } + + } + + return status; +} + +void MbbReleaseHardware(_In_ PWMBCLASS_DEVICE_CONTEXT DeviceContext) +{ + + if (DeviceContext->BusHandle != NULL) + { + MbbBusCleanup(DeviceContext->BusHandle); + DeviceContext->BusHandle = NULL; + } + + return; +} + +NTSTATUS +EvtDevicePrepareHardware(_In_ WDFDEVICE device, _In_ WDFCMRESLIST resourcesRaw, _In_ WDFCMRESLIST resourcesTranslated) +{ + UNREFERENCED_PARAMETER(resourcesRaw); + UNREFERENCED_PARAMETER(resourcesTranslated); + + PWMBCLASS_DEVICE_CONTEXT deviceContext = WmbClassGetDeviceContext(device); + + NTSTATUS status = MbbInitializeHardware(deviceContext); + + return status; +} + +NTSTATUS +EvtDeviceReleaseHardware(_In_ WDFDEVICE device, _In_ WDFCMRESLIST resourcesTranslated) +{ + UNREFERENCED_PARAMETER(resourcesTranslated); + PWMBCLASS_DEVICE_CONTEXT deviceContext = WmbClassGetDeviceContext(device); + + MbbReleaseHardware(deviceContext); + + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ void EvtDeviceSurpriseRemoval(WDFDEVICE device) +{ + UNREFERENCED_PARAMETER(device); +} + +NTSTATUS MbbInitAdapterContext(_In_ WDFDEVICE Device, _In_ NETADAPTER NetAdapter) +{ + WDF_OBJECT_ATTRIBUTES adapterAttributes; + PWMBCLASS_DEVICE_CONTEXT deviceContext = WmbClassGetDeviceContext(Device); + PWMBCLASS_NETADAPTER_CONTEXT netAdapterContext = WmbClassGetNetAdapterContext(NetAdapter); + + ULONG ntbSize; + ntbSize = FIELD_OFFSET(MBB_NTB_BUILD_CONTEXT, NdpDatagramEntries); + ntbSize += (deviceContext->BusParams.MaxOutDatagrams * sizeof(MBB_NDP_HEADER_ENTRY)); + + WDF_OBJECT_ATTRIBUTES_INIT(&adapterAttributes); + adapterAttributes.ParentObject = NetAdapter; + + NTSTATUS ntStatus = WdfLookasideListCreate( + &adapterAttributes, ntbSize, NonPagedPoolNx, WDF_NO_OBJECT_ATTRIBUTES, MbbPoolTagNtbSend, &netAdapterContext->NtbLookasideList); + if (!NT_SUCCESS(ntStatus)) + { + return ntStatus; + } + + WDF_OBJECT_ATTRIBUTES_INIT(&adapterAttributes); + adapterAttributes.ParentObject = NetAdapter; + ntStatus = WdfLookasideListCreate( + &adapterAttributes, + sizeof(MBB_RECEIVE_NDP_CONTEXT), + NonPagedPoolNx, + WDF_NO_OBJECT_ATTRIBUTES, + MbbPoolTagMdlReceive, + &netAdapterContext->ReceiveNdpLookasideList); + if (!NT_SUCCESS(ntStatus)) + { + return ntStatus; + } + netAdapterContext->SessionId = MbbAdapterGetSessionId(NetAdapter); + WdfSpinLockAcquire(deviceContext->Sessions[netAdapterContext->SessionId].WdfRecvSpinLock); + deviceContext->Sessions[netAdapterContext->SessionId].NetAdapterContext = netAdapterContext; + // Allow to receive data from this point since connection may happen before RxQueueCreate, if it happens, we allow to cache the recieved NDP + netAdapterContext->AllowRxTraffic = TRUE; + InitializeListHead(&netAdapterContext->ReceiveNdpList); + netAdapterContext->WmbDeviceContext = deviceContext; + netAdapterContext->NetAdapter = NetAdapter; + WdfSpinLockRelease(deviceContext->Sessions[netAdapterContext->SessionId].WdfRecvSpinLock); + return ntStatus; +} + +_Use_decl_annotations_ NTSTATUS EvtMbbDeviceCreateAdapter(WDFDEVICE Device, NETADAPTER_INIT* AdapterInit) +{ + + NET_ADAPTER_DATAPATH_CALLBACKS datapathCallbacks; + NET_ADAPTER_DATAPATH_CALLBACKS_INIT(&datapathCallbacks, EvtAdapterCreateTxQueue, EvtAdapterCreateRxQueue); + + NetAdapterInitSetDatapathCallbacks(AdapterInit, &datapathCallbacks); + + WDF_OBJECT_ATTRIBUTES adapterAttributes; + WDF_OBJECT_ATTRIBUTES_INIT(&adapterAttributes); + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&adapterAttributes, WMBCLASS_NETADAPTER_CONTEXT); + adapterAttributes.EvtCleanupCallback = EvtAdapterCleanup; + + NETADAPTER netAdapter; + NTSTATUS ntStatus = NetAdapterCreate(AdapterInit, &adapterAttributes, &netAdapter); + if (!NT_SUCCESS(ntStatus)) + { + return ntStatus; + } + + ntStatus = MbbAdapterInitialize(netAdapter); + + if (!NT_SUCCESS(ntStatus)) + { + return ntStatus; + } + + ntStatus = MbbInitAdapterContext(Device, netAdapter); + if (!NT_SUCCESS(ntStatus)) + { + return ntStatus; + } + + ntStatus = WmbClassAdapterStart(netAdapter); + + if (!NT_SUCCESS(ntStatus)) + { + return ntStatus; + } + + return ntStatus; +} + +_Use_decl_annotations_ VOID EvtAdapterCleanup(_In_ WDFOBJECT NetAdapter) +{ + PWMBCLASS_NETADAPTER_CONTEXT netAdapterContext = WmbClassGetNetAdapterContext(NetAdapter); + PWMBCLASS_DEVICE_CONTEXT deviceContext = netAdapterContext->WmbDeviceContext; + if (deviceContext == NULL || deviceContext->Sessions[netAdapterContext->SessionId].NetAdapterContext == NULL) + { + return; + } + + // Cancel these Ndps which are cached before RxQueueCreate but not cleaned in case RxQueueCreate failed. + // NetAdapter should be destoryed immediately if RxQueueCreate failed, or these cached Ndps will stay in memory until release device or delete additional PDP + MbbRecvCancelNdps(deviceContext, netAdapterContext->SessionId); + + WdfSpinLockAcquire(deviceContext->Sessions[netAdapterContext->SessionId].WdfRecvSpinLock); + deviceContext->Sessions[netAdapterContext->SessionId].NetAdapterContext = NULL; + WdfSpinLockRelease(deviceContext->Sessions[netAdapterContext->SessionId].WdfRecvSpinLock); + +} + +_Use_decl_annotations_ VOID EvtMbbDeviceReset(WDFDEVICE WdfDevice) +{ + PWMBCLASS_DEVICE_CONTEXT deviceContext = WmbClassGetDeviceContext(WdfDevice); + MbbBusResetDataPipes(deviceContext->BusHandle); +} diff --git a/network/wwan/cxwmbclass/driver.cpp b/network/wwan/cxwmbclass/driver.cpp new file mode 100644 index 00000000..e1c8bc69 --- /dev/null +++ b/network/wwan/cxwmbclass/driver.cpp @@ -0,0 +1,120 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#include "precomp.h" + +#include "device.h" +#include "power.h" + +MINIPORT_DRIVER_CONTEXT GlobalControl = {0}; + +EXTERN_C __declspec(code_seg("INIT")) DRIVER_INITIALIZE DriverEntry; +EVT_WDF_DRIVER_UNLOAD EvtDriverUnload; +EVT_WDF_DRIVER_DEVICE_ADD EvtDriverDeviceAdd; + +#define MBB_DRIVER_DEFAULT_POOL_TAG 'DBMW' + +__declspec(code_seg("INIT")) NTSTATUS DriverEntry(_In_ PDRIVER_OBJECT driverObject, _In_ PUNICODE_STRING registryPath) +{ + NTSTATUS status = STATUS_SUCCESS; + + WDF_DRIVER_CONFIG driverConfig; + WDF_DRIVER_CONFIG_INIT(&driverConfig, EvtDriverDeviceAdd); + driverConfig.DriverPoolTag = MBB_DRIVER_DEFAULT_POOL_TAG; + + driverConfig.EvtDriverUnload = EvtDriverUnload; + + WDFDRIVER driver; + status = WdfDriverCreate(driverObject, registryPath, WDF_NO_OBJECT_ATTRIBUTES, &driverConfig, &driver); + if (!NT_SUCCESS(status)) + { + goto Exit; + } + +Exit: + return status; +} + +NTSTATUS +EvtDriverDeviceAdd(_In_ WDFDRIVER driver, _Inout_ PWDFDEVICE_INIT deviceInit) +{ + UNREFERENCED_PARAMETER((driver)); + + NTSTATUS status = STATUS_SUCCESS; + + status = NetDeviceInitConfig(deviceInit); + if (!NT_SUCCESS(status)) + { + goto Exit; + } + + status = MbbDeviceInitConfig(deviceInit); + if (!NT_SUCCESS(status)) + { + goto Exit; + } + + // Register with the NetAdapter framework that we want to do the Device Reset + //NET_DEVICE_RESET_CONFIG resetConfig; + //NET_DEVICE_RESET_CONFIG_INIT(&resetConfig, EvtMbbDeviceReset); + //NetDeviceInitSetResetConfig(deviceInit, &resetConfig); + + NET_DEVICE_POWER_POLICY_EVENT_CALLBACKS netPowerPolicyCallbacks; + NET_DEVICE_POWER_POLICY_EVENT_CALLBACKS_INIT(&netPowerPolicyCallbacks); + netPowerPolicyCallbacks.EvtDevicePreviewBitmapPattern = EvtDevicePreviewBitmapPattern; + + NetDeviceInitSetPowerPolicyEventCallbacks(deviceInit, &netPowerPolicyCallbacks); + + WDF_OBJECT_ATTRIBUTES deviceAttributes; + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&deviceAttributes, WMBCLASS_DEVICE_CONTEXT); + + WDF_PNPPOWER_EVENT_CALLBACKS pnpPowerCallbacks; + WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks); + pnpPowerCallbacks.EvtDevicePrepareHardware = EvtDevicePrepareHardware; + pnpPowerCallbacks.EvtDeviceReleaseHardware = EvtDeviceReleaseHardware; + pnpPowerCallbacks.EvtDeviceSurpriseRemoval = EvtDeviceSurpriseRemoval; + pnpPowerCallbacks.EvtDeviceD0Entry = EvtDeviceD0Entry; + pnpPowerCallbacks.EvtDeviceD0Exit = EvtDeviceD0Exit; + WdfDeviceInitSetPnpPowerEventCallbacks(deviceInit, &pnpPowerCallbacks); + + WDF_POWER_POLICY_EVENT_CALLBACKS powerPolicyCallbacks; + WDF_POWER_POLICY_EVENT_CALLBACKS_INIT(&powerPolicyCallbacks); + powerPolicyCallbacks.EvtDeviceArmWakeFromS0 = EvtDeviceArmWakeFromS0; + powerPolicyCallbacks.EvtDeviceDisarmWakeFromS0 = EvtDeviceDisarmWakeFromS0; + WdfDeviceInitSetPowerPolicyEventCallbacks(deviceInit, &powerPolicyCallbacks); + + WDFDEVICE wdfDevice; + status = WdfDeviceCreate(&deviceInit, &deviceAttributes, &wdfDevice); + if (!NT_SUCCESS(status)) + { + goto Exit; + } + + // Set the device to be not ejectable + WDF_DEVICE_PNP_CAPABILITIES pnpCapabilities; + WDF_DEVICE_PNP_CAPABILITIES_INIT(&pnpCapabilities); + pnpCapabilities.SurpriseRemovalOK = WdfTrue; + WdfDeviceSetPnpCapabilities(wdfDevice, &pnpCapabilities); + + PWMBCLASS_DEVICE_CONTEXT deviceContext = WmbClassGetDeviceContext(wdfDevice); + deviceContext->WdfDevice = wdfDevice; + + MBB_DEVICE_CONFIG mbbDeviceConfig; + MBB_DEVICE_CONFIG_INIT( + &mbbDeviceConfig, EvtMbbDeviceSendMbimFragment, EvtMbbDeviceReceiveMbimFragment, EvtMbbDeviceSendDeviceServiceSessionData, EvtMbbDeviceCreateAdapter); + + status = MbbDeviceInitialize(wdfDevice, &mbbDeviceConfig); + if (!NT_SUCCESS(status)) + { + goto Exit; + } + +Exit: + return status; +} + +VOID EvtDriverUnload(_In_ WDFDRIVER driver) +{ + UNREFERENCED_PARAMETER(driver); +} diff --git a/network/wwan/cxwmbclass/inc/BusInterface.h b/network/wwan/cxwmbclass/inc/BusInterface.h new file mode 100644 index 00000000..d72c663a --- /dev/null +++ b/network/wwan/cxwmbclass/inc/BusInterface.h @@ -0,0 +1,573 @@ +/*************************************************************************** + +Copyright (c) 2010 Microsoft Corporation + +Module Name: + + BusInterface.h + +Abstract: + + This module defines the interface between the upper NDIS layer and lower + bus layer of the MBB (Mobile BroadBand) Class driver. + +Environment: + + kernel mode only + +Notes: + + The upper ndis layer may only communicate with the lower bus layer through + these interfaces. + +Revision History: + + 2/7/2010 : created + +Authors: + + TriRoy + +****************************************************************************/ + +#ifndef _BusInterface_H_ +#define _BusInterface_H_ + +//////////////////////////////////////////////////////////////////////////////// +// +// INCLUDES +// +//////////////////////////////////////////////////////////////////////////////// +#if 0 +#include "MbbDebug.h" +#endif +//////////////////////////////////////////////////////////////////////////////// +// +// DEFINES +// +//////////////////////////////////////////////////////////////////////////////// + +#define MAX_PARAMETER_STRING (128) + +#define ALT_DATA_SETTING_0 (0) +#define ALT_DATA_SETTING_1 (1) + +#define MAX_PENDING_SENDS (3) + +//////////////////////////////////////////////////////////////////////////////// +// +// TYPEDEFS +// +//////////////////////////////////////////////////////////////////////////////// +typedef PVOID MBB_BUS_HANDLE; +typedef PVOID MBB_PROTOCOL_HANDLE; +typedef PVOID MBB_REQUEST_HANDLE; +typedef PVOID MBB_RECEIVE_CONTEXT; + +typedef struct _MBB_BUS_PARAMETERS +{ + ULONG FragmentSize; + + ULONG MaxSegmentSize; + + BOOLEAN ChainedMdlsSupported; + BOOLEAN Ntb32BitSupported; + BOOLEAN CurrentMode32Bit; + BOOLEAN SelectiveSuspendSupported; + + ULONG MaxOutNtb; + USHORT MaxOutDatagrams; + USHORT NdpOutDivisor; + USHORT NdpOutRemainder; + USHORT NdpOutAlignment; + + BYTE PowerFiltersSupported; + BYTE MaxPowerFilterSize; + + WCHAR Manufacturer[MAX_PARAMETER_STRING]; + WCHAR Model[MAX_PARAMETER_STRING]; + + BYTE MaxOutstandingCommandMessages; + USHORT MTU; + BOOLEAN IsErrataDevice; + USHORT MbimVersion; + BOOLEAN RemoteWakeCapable; + USHORT MbimExtendedVersion; + +} MBB_BUS_PARAMETERS, *PMBB_BUS_PARAMETERS; + +typedef struct _MBB_CONNECTION_STATE +{ + + BOOLEAN ConnectionUp; + ULONGLONG UpStreamBitRate; + ULONGLONG DownStreamBitRate; + +} MBB_CONNECTION_STATE, *PMBB_CONNECTION_STATE; + +typedef __callback VOID (*MBB_BUS_SEND_COMPLETION_CALLBACK)(__in MBB_PROTOCOL_HANDLE ProtocolHandle, __in MBB_REQUEST_HANDLE RequestHandle, __in NTSTATUS Status); + +typedef __callback VOID (*MBB_BUS_RECEIVE_COMPLETION_CALLBACK)( + __in MBB_PROTOCOL_HANDLE ProtocolHandle, __in MBB_REQUEST_HANDLE RequestHandle, __in NTSTATUS Status, __in ULONG_PTR ReceivedLength); + +typedef __callback VOID (*MBB_BUS_RESPONSE_AVAILABLE_CALLBACK)(__in MBB_PROTOCOL_HANDLE ProtocolHandle); + +typedef __callback VOID (*MBB_BUS_SEND_DATA_COMPLETION_CALLBACK)( + __in MBB_PROTOCOL_HANDLE ProtocolHandle, __in MBB_REQUEST_HANDLE RequestHandle, __in NTSTATUS Status, __in PMDL Mdl); + +typedef __callback VOID (*MBB_BUS_DATA_RECEIVE_CALLBACK)(__in MBB_PROTOCOL_HANDLE ProtocolHandle, __in MBB_RECEIVE_CONTEXT ReceiveContext, __in PMDL Mdl); + +typedef __callback VOID (*MBB_BUS_SS_IDLE_CONFIRM_CALLBACK)(__in MBB_PROTOCOL_HANDLE ProtocolHandle, __in DEVICE_POWER_STATE PowerState); + +typedef __callback VOID (*MBB_BUS_SS_IDLE_NOTIFICATION_COMPLETE_CALLBACK)(__in MBB_PROTOCOL_HANDLE ProtocolHandle, __in NTSTATUS Status); + +//////////////////////////////////////////////////////////////////////////////// +// +// INTERFACE +// +//////////////////////////////////////////////////////////////////////////////// +EXTERN_C +NTSTATUS +MbbBusInitialize( + _In_ PDEVICE_OBJECT Pdo, + _In_ PDEVICE_OBJECT Fdo, + _In_ PDEVICE_OBJECT NextDeviceObject, + _In_ MBB_BUS_RESPONSE_AVAILABLE_CALLBACK ResponseAvailableCallback, + _In_ MBB_BUS_DATA_RECEIVE_CALLBACK ReceiveDataCallback, + _In_ MBB_BUS_SS_IDLE_CONFIRM_CALLBACK IdleConfirmCallback, + _In_ MBB_BUS_SS_IDLE_NOTIFICATION_COMPLETE_CALLBACK IdleNotificationComplete, + _In_ MBB_PROTOCOL_HANDLE ProtocolHandle, + _Outptr_ MBB_BUS_HANDLE* BusHandle); +/* + Description + This routine initializes the bus layer i.e. the lower layer in the + MBB Class Driver. All bus layer implementations need to have this + function. The Protocol Layer i.e. the upper layer in the MBB Class + Driver will call this function before calling any other function in + the Bus Layer. + + Parameters + _In_ PDEVICE_OBJECT DeviceObject, + The WDM device representation of the device. + + _In_ MBB_BUS_NOTIFICATION_CALLBACK NotificationCallback, + The routine the bus layer calls when it needs to notify + the upper protocol layer. + + _In_ MBB_PROTOCOL_HANDLE ProtocolHandle, + The handle the bus layer passes back to the protocol layer + when it calls any callback. The protocol layer uses this handle + to identify the instance of the MBB device the callback is meant for. + + _Outptr_ MBB_BUS_HANDLE BusHandle + The handle returned by the bus layer on successful initialization. + The protocol layer passes this handle to the bus layer on subsequent + calls to the bus layer. The bus layer uses this handle to indetify + the instance of the MBB device. + + Return Value + NTSTATUS_SUCCESS + Initialization was successful. + + Other failure code +*/ + +EXTERN_C +NTSTATUS +MbbBusInitializeByWdf( + _In_ WDFDEVICE WdfDevice, + _In_ MBB_BUS_RESPONSE_AVAILABLE_CALLBACK ResponseAvailableCallback, + _In_ MBB_BUS_DATA_RECEIVE_CALLBACK ReceiveDataCallback, + _In_ MBB_BUS_SS_IDLE_CONFIRM_CALLBACK IdleConfirmCallback, + _In_ MBB_BUS_SS_IDLE_NOTIFICATION_COMPLETE_CALLBACK IdleNotificationComplete, + _In_ MBB_PROTOCOL_HANDLE ProtocolHandle, + _Outptr_ MBB_BUS_HANDLE* BusHandle, + _Inout_opt_ MBB_BUS_HANDLE preAllocatedBusObject); + +EXTERN_C +VOID MbbBusCleanup(__in MBB_BUS_HANDLE BusHandle); +/* + Description + This will be last call from Protocol layer in to Bus Layer + to cleanup the bus layer. The bus layer should free all + resources. The BusHandle will not be used for subsequent calls. + If there are pending requests the Bus Layer should not return + from this call unless all operations are complete. + + Parameters + __in MBB_BUS_HANDLE BusHandle + BusHandle identifies the instance of the bus layer. + + Return Value + None +*/ + +EXTERN_C +NTSTATUS +MbbBusQueryBusParameters(__in MBB_BUS_HANDLE BusHandle, __out PMBB_BUS_PARAMETERS BusParameters); +/* + Description + This routine queries the bus specific parameters like transfer size, + DMA support etc... This is called when the bus is initialized to format + requests correctly before sending to the bus. + + Parameters + __in MBB_BUS_HANDLE BusHandle, + BusHandle identifies the instance of the bus layer. + + __out PMBB_BUS_PARAMETERS BusParameters + The buffer where the bus layer returns the information to the caller. + + + Return Value + + NTSTATUS_SUCCESS + Information was successfully returned in the BusParameters structure. + + NTSTATUS_INVALID_PARAMETER + One of the required parameters is missing or bad. + + Other failure code +*/ +EXTERN_C +NTSTATUS +MbbBusSendMessageFragment( + __in MBB_BUS_HANDLE BusHandle, + __in MBB_REQUEST_HANDLE RequestHandle, + __in PVOID MessageFragment, + __in ULONG FragmentLength, + __in LPGUID ActivityId, + __in MBB_BUS_SEND_COMPLETION_CALLBACK SendCompletionCallback); +/* + Description + The protocol layer call this routine to request the bus layer to + send a message fragment. Fragmentation / Reassembly is handled by + the protocol layer and it will only handle fragments that are within + the maximum transfer size of the bus. + + This routine is asynchronous and returns immediately after queueing + the transfer. The caller is notified of the completion through the + callback. + + Parameters + __in MBB_BUS_HANDLE BusHandle, + BusHandle identifies the instance of the bus layer. + + __in MBB_REQUEST_HANDLE RequestHandle, + Identifies the request. + + __in PVOID MessageFragment, + The data payload that needs to be sent. + + __in ULONG FragmentLength, + Length of the data payload. This will not be greater than the + maximum transfer size supported by the bus. + + __in MBB_BUS_SEND_COMPLETION_CALLBACK SendCompletionCallback + The completion callback routine that will be called by the bus + when the transfer is complete. + + Return Value + + NTSTATUS_SUCCESS + The transfer has completed successfully. SendCompletionCallback will NOT be called. + + NTSTATUS_PENDING + The transfer was queued. SendCompletionCallback will be called on completion. + + Other failure code + The transfer could not be queued. SendCompletionCallback will NOT be called. +*/ + +EXTERN_C +NTSTATUS +MbbBusReceiveMessageFragment( + _In_ MBB_BUS_HANDLE BusHandle, + _In_ MBB_REQUEST_HANDLE RequestHandle, + _In_ __drv_aliasesMem PVOID MessageFragment, + _In_ ULONG FragmentLength, + _In_ LPGUID ActivityId, + _In_ MBB_BUS_RECEIVE_COMPLETION_CALLBACK ReceiveCompletionCallback); +/* + Description + + Parameters + + + Return Value + + NTSTATUS_SUCCESS + Initialization was successful. + + Other failure code +*/ +/* + Description + The protocol layer call this routine to request the bus layer to + receive data from the device. Reassembly is handled by the protocol layer. + + This routine is asynchronous and returns immediately after queueing + the transfer. The caller is notified of the completion through the + callback. + + Parameters + _In_ MBB_BUS_HANDLE BusHandle, + BusHandle identifies the instance of the bus layer. + + _In_ MBB_REQUEST_HANDLE RequestHandle, + Identifies the request. + + _InOut_ PVOID MessageFragment, + The data buffer that would be filled with the received data. + + _In_ ULONG FragmentLength, + Length of the data requested from the device. This will not be + greater than the maximum transfer size supported by the bus. + + _In_ MBB_BUS_RECEIVE_COMPLETION_CALLBACK ReceiveCompletionCallback + The completion callback routine that will be called by the bus + when the transfer is complete. + + Return Value + + NTSTATUS_SUCCESS + The transfer has completed successfully. ReceiveCompletionCallback will NOT be called. + + NTSTATUS_PENDING + The transfer was queued. ReceiveCompletionCallback will be called on completion. + + Other failure code + The transfer could not be queued. ReceiveCompletionCallback will NOT be called. +*/ + +EXTERN_C +NTSTATUS +MbbBusSetPacketFilter(__in MBB_BUS_HANDLE BusHandle, __in ULONG PacketFilter); +/* + Description + Sets the packet filter on the device. + For MBB only directed is supported + + Parameters + __in MBB_BUS_HANDLE BusHandle, + BusHandle identifies the instance of the bus layer. + + __in ULONG PacketFilter + the filter to apply + + + Return Value + + NTSTATUS_SUCCESS + Information was successfully returned in the BusParameters structure. + + NTSTATUS_INVALID_PARAMETER + One of the required parameters is missing or bad. + + Other failure code +*/ + +EXTERN_C +NTSTATUS +MbbBusGetStat(__in MBB_BUS_HANDLE BusHandle, __in USHORT StatIndex, __out ULONGLONG* Value); +/* + Description + Retrieves a status from the device + + Parameters + __in MBB_BUS_HANDLE BusHandle, + BusHandle identifies the instance of the bus layer. + + __in ULONG PacketFilter + the filter to apply + + + Return Value + + NTSTATUS_SUCCESS + Information was successfully returned in the BusParameters structure. + + NTSTATUS_INVALID_PARAMETER + One of the required parameters is missing or bad. + + Other failure code +*/ + +EXTERN_C +NTSTATUS +MbbBusStart(_In_ MBB_BUS_HANDLE BusHandle); + +EXTERN_C +NTSTATUS +MbbBusStop(__in MBB_BUS_HANDLE BusHandle); + +EXTERN_C +BOOLEAN +MbbBusIsStoped(_In_ MBB_BUS_HANDLE BusHandle); + +EXTERN_C +NTSTATUS +MbbBusOpen(_In_ MBB_BUS_HANDLE BusHandle, _In_ ULONG TransactionId, _In_opt_ PVOID FastIOSendNetBufferListsComplete, _In_opt_ PVOID FastIOIndicateReceiveNetBufferLists); +/* + Description + + Opens the session with the device + + Parameters + __in MBB_BUS_HANDLE BusHandle, + BusHandle identifies the instance of the bus layer. + + + Return Value + + NTSTATUS_SUCCESS + Information was successfully returned in the BusParameters structure. + + NTSTATUS_INVALID_PARAMETER + One of the required parameters is missing or bad. + + Other failure code +*/ + +EXTERN_C +NTSTATUS +MbbBusClose(__in MBB_BUS_HANDLE BusHandle, __in ULONG TransactionId, __in BOOLEAN ForceClose); +/* + Description + + Opens the session with the device + + Parameters + __in MBB_BUS_HANDLE BusHandle, + BusHandle identifies the instance of the bus layer. + + + Return Value + + NTSTATUS_SUCCESS + Information was successfully returned in the BusParameters structure. + + NTSTATUS_INVALID_PARAMETER + One of the required parameters is missing or bad. + + Other failure code +*/ + +EXTERN_C +NTSTATUS +MbbBusStartDataPipes(__in MBB_BUS_HANDLE BusHandle); +/* + Description + + Selects alt data interface 1 and starts the IoTargets + + Parameters + __in MBB_BUS_HANDLE BusHandle, + BusHandle identifies the instance of the bus layer. + + + Return Value + + NTSTATUS_SUCCESS + Information was successfully returned in the BusParameters structure. + + NTSTATUS_INVALID_PARAMETER + One of the required parameters is missing or bad. + + Other failure code +*/ + +EXTERN_C +VOID MbbBusStopDataPipes(__in MBB_BUS_HANDLE BusHandle); +/* + Description + + Resets the IoTargets canceling all and waiting for io to compelte + Selects alt data interface 0 disabling the pipes + + Parameters + __in MBB_BUS_HANDLE BusHandle, + BusHandle identifies the instance of the bus layer. + + + Return Value + + NTSTATUS_SUCCESS + Information was successfully returned in the BusParameters structure. + + NTSTATUS_INVALID_PARAMETER + One of the required parameters is missing or bad. + + Other failure code +*/ + +EXTERN_C +void MbbBusResetDataPipes(_In_ MBB_BUS_HANDLE BusHandle); + +EXTERN_C +NTSTATUS +MbbBusWriteData(__in MBB_BUS_HANDLE BusHandle, __in MBB_REQUEST_HANDLE RequestHandle, __in PMDL Mdl, __in MBB_BUS_SEND_DATA_COMPLETION_CALLBACK Callback); +/* + Description + + Writes data to device bulk out pipe + + Parameters + __in MBB_BUS_HANDLE BusHandle, + BusHandle identifies the instance of the bus layer. + + __in MBB_REQUEST_HANDLE RequestHandle, + Identifies the request. + + __in PMDL Mdl + pointer to an MDL identifying the data to send. The bus layer will own this until the completion callback is called. + + __in MBB_BUS_SEND_DATA_COMPLETION_CALLBACK Callback + Callback that will be called when write is complete. + + Return Value + + NTSTATUS_SUCCESS + Information was successfully returned in the BusParameters structure. + + NTSTATUS_INVALID_PARAMETER + One of the required parameters is missing or bad. + + Other failure code +*/ +EXTERN_C +VOID MbbBusReturnReceiveBuffer(__in MBB_BUS_HANDLE BusHandle, __in MBB_RECEIVE_CONTEXT ReceiveContext, __in PMDL Mdl); + +EXTERN_C +NTSTATUS +MbbBusSelectDataAltSetting(__in MBB_BUS_HANDLE BusHandle, __in UCHAR AltSetting); + +EXTERN_C +NTSTATUS +MbbBusIdleNotification(__in MBB_BUS_HANDLE BusHandle, __in BOOLEAN ForceIdle); + +EXTERN_C +VOID MbbBusCancelIdleNotification(__in MBB_BUS_HANDLE BusHandle); + +EXTERN_C +NTSTATUS +MbbBusSetPowerFilterPattern( + __in MBB_BUS_HANDLE BusHandle, + __in ULONG PatternId, + __in_bcount_opt(MaskSize) PCUCHAR Mask, + __in ULONG MaskSize, + __in_bcount_opt(PatternSize) PCUCHAR Pattern, + __in ULONG PatternSize); + +EXTERN_C +NTSTATUS +MbbBusResetBulkPipe(__in MBB_BUS_HANDLE BusHandle, __in BOOLEAN Out); + +EXTERN_C +VOID MbbBusSetNotificationState(__in MBB_BUS_HANDLE BusHandle, __in BOOLEAN Enabled); + +EXTERN_C +BOOLEAN +MbbBusIsUde(_In_ MBB_BUS_HANDLE BusHandle); + +#endif diff --git a/network/wwan/cxwmbclass/inc/MbbLibrary.h b/network/wwan/cxwmbclass/inc/MbbLibrary.h new file mode 100644 index 00000000..03f64d8a --- /dev/null +++ b/network/wwan/cxwmbclass/inc/MbbLibrary.h @@ -0,0 +1,175 @@ +/*************************************************************************** + +Copyright (c) 2010 Microsoft Corporation + +Module Name: + + MbbLibrary.h + +Abstract: + + This header files contains the interfaces to the pack / unpack and + fragment / reassembly functions provided by the Mbb library. + The class driver Protocol layer calls the libary to convert payloads + to messages as defined in the MBB Class Driver Hardware Interface + document before sending it to the Bus Layer. + +Environment: + + User and kernel mode only + +Notes: + + This library can be used both in user and kernel mode because it does not + to make any memory allocations. + +Revision History: + + 2/7/2010 : created + +Authors: + + TriRoy + +****************************************************************************/ +EXTERN_C +NTSTATUS +MbbLibForamtBufferAsOpenMessage(__out_bcount_opt(*BufferLength) PVOID MessageBuffer, __inout PULONG BufferLength, __in ULONG MaximumControlTransfer); +/* + Description + Formats an input buffer as a MBB Open Message. + + Parameters + __out_opt_bcount(*BufferLength) PVOID MessageBuffer + The input message buffer. This parameter may be NULL + if BufferLength is 0. This parameter should not be NULL + when BufferLength is non-zero. + + __inout PULONG BufferLength + This provides the length of the memory location described by MessageBuffer. + If BufferLength is 0 then the function will return the required buffer length + in this parameter with STATUS_BUFFER_OVERFLOW. On success, the amount of + buffer space used by the routine is returned to the caller in BufferLength. + + __in ULONG MaximumControlTransfer + MaximumControlTransfer field of the Open Message. + + Return Value + STATUS_BUFFER_OVERFLOW + The buffer passed in is not sufficient for formatting the message. + + STATUS_INVALID_PARAMETER + One of the required parameters is missing. + + STATUS_SUCCESS + The input buffer was formatted successfully and the amount of buffer + used is returned in BufferLength. +*/ +EXTERN_C +NTSTATUS +MbbLibForamtBufferAsCloseMessage(__out_bcount_opt(*BufferLength) PVOID MessageBuffer, __inout PULONG BufferLength); +/* + Description + Formats an input buffer as a MBB Close Message. + + Parameters + __out_opt_bcount(*BufferLength) PVOID MessageBuffer + The input message buffer. This parameter may be NULL + if BufferLength is 0. This parameter should not be NULL + when BufferLength is non-zero. + + __inout PULONG BufferLength + This provides the length of the memory location described by MessageBuffer. + If BufferLength is 0 then the function will return the required buffer length + in this parameter with STATUS_BUFFER_OVERFLOW. On success, the amount of + buffer space used by the routine is returned to the caller in BufferLength. + + Return Value + STATUS_BUFFER_OVERFLOW + The buffer passed in is not sufficient for formatting the message. + + STATUS_INVALID_PARAMETER + One of the required parameters is missing. + + STATUS_SUCCESS + The input buffer was formatted successfully and the amount of buffer + used is returned in BufferLength. +*/ +EXTERN_C +NTSTATUS +MbbLibFragmentBufferToCommandMessages( + __in PMBB_COMMAND Command, + __in MBB_COMMAND_TYPE CommandType, + __in_bcount_opt(PayloadLength) PCHAR Payload, + __in ULONG PayloadLength, + __inout_opt PULONG TransactionId, + __in ULONG CurrentFragment, + __inout PULONG FragmentBufferCount, + __inout PULONG FragmentLength, + __out_ecount_opt(*FragmentBufferCount) PCHAR* FragmentBuffers); +/* + Description + Given the Payload the routine fragments the payload + in to the FragmentBuffers. + + Parameters + __in MBB_COMMAND Command + Command contains the GUID and Cid. + The GUID identifying the service for this message. + The command identifier for the given service. + + __in MBB_COMMAND_TYPE CommandType + Identifies whether the command is a Set or Query. + + __in_bcount(PayloadLength) PCHAR Payload + The Payload is a byte array that needs to be fragmented. + If Payload length is not 0 Payload should be provided. + + __in ULONG PayloadLength + Length of the payload. If there is no Payload for this command + Payload is set to 0. + + __inout PULONG TransactionId + If non-zero then this is the transaction id used for the fragments. + If zero then a new transcation id is generated and returned to the caller. + + __in ULONG CurrentFragment + If non-zero then Fragments are constructed starting this Fragment. + If zero then Fragments are constructed from the beginning. + + __inout ULONG FragmentBufferCount + Number of input fragments i.e. numberof buffers described by + FragmentBuffers array. If the caller is querying for the + number of fragments required then this should be set to 0. + The function will return the number of fragment required + with STATUS_BUFFER_OVERFLOW. + + __in ULONG FragmentLength + Length of each output fragment buffers. All fragment + buffers needs to be of the same size. + The length of the last fragment is returned on STATUS_SUCCESS. + All but the last fragment are of FragmentLength size. + The last fragment can be lesser than the FragmentLength size. + + __out_ecount_opt(*FragmentBufferCount) PCHAR* FragmentBuffers + Array of input fragment buffers. If FragmentCount is 0 + FragmentBuffers can be NULL. If FragmentCount is non 0 + FragmentBuffers should be provided. + + Return Value + STATUS_INVALID_PARAMETER + One of the required parameters is missing. + + STATUS_SUCCESS + The Payload was fragmented successfully in to + FragmentBuffers and the number of fragments used is + returned in FragmentCount. + + STATUS_MORE_PROCESSING_REQUIRED + The complete Payload is not fragmented yet. + This is not a failure code but an indication to the caller that + more calls are needed with more fragment buffers. +*/ + +ULONG +MbbLibraryGetNextTransactionId(); diff --git a/network/wwan/cxwmbclass/inc/adapter.h b/network/wwan/cxwmbclass/inc/adapter.h new file mode 100644 index 00000000..236daad4 --- /dev/null +++ b/network/wwan/cxwmbclass/inc/adapter.h @@ -0,0 +1,53 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#pragma once + +// packet and header sizes +#define MBB_MAX_PACKET_SIZE (1514) + +// maximum link speed for send and recv in bps +#define MBB_MEDIA_MAX_SPEED 1'000'000'000 + +// supported filters +#define WMBCLASS_MAX_WOL_PATTERN (256) +#define WMBCLASS_MAX_MBIM_WOL_PATTERN (192) + +// +// Context for each NetAdapter instance. +// Each NetAdapter instance corresponds to an IP interface +// +typedef struct _WMBCLASS_NETADAPTER_CONTEXT +{ + PWMBCLASS_DEVICE_CONTEXT WmbDeviceContext; // Wdf device context + NETADAPTER NetAdapter; // NetAdapter object + + ULONG ConnectionId; + ULONG SessionId; + MBB_CONNECTION_STATE ConnectionState; + + // RxQuere-related objects + + WDFLOOKASIDE NtbLookasideList; + WDFLOOKASIDE ReceiveNdpLookasideList; + + LIST_ENTRY ReceiveNdpList; + NETPACKETQUEUE TxQueue; // Tx Queue object + NETPACKETQUEUE RxQueue; // Rx Queue object + BOOLEAN AllowRxTraffic; +} WMBCLASS_NETADAPTER_CONTEXT, *PWMBCLASS_NETADAPTER_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(WMBCLASS_NETADAPTER_CONTEXT, WmbClassGetNetAdapterContext); + +// +// NetAdapter functions +// + +EVT_NET_ADAPTER_CREATE_TXQUEUE EvtAdapterCreateTxQueue; +EVT_NET_ADAPTER_CREATE_RXQUEUE EvtAdapterCreateRxQueue; + +EVT_WDF_DEVICE_CONTEXT_DESTROY MbbDestroyAdapterContext; + +NTSTATUS +WmbClassAdapterStart(_In_ NETADAPTER netAdapter); diff --git a/network/wwan/cxwmbclass/inc/align.h b/network/wwan/cxwmbclass/inc/align.h new file mode 100644 index 00000000..5c8117d3 --- /dev/null +++ b/network/wwan/cxwmbclass/inc/align.h @@ -0,0 +1,168 @@ +/*++ + +Copyright (c) 1988-1992 Microsoft Corporation + +Module Name: + + Align.h + +Abstract: + + +Author: + + John Rogers (JohnRo) 15-May-1991 + +Environment: + + This code assumes that sizeof(DWORD) >= sizeof(PVOID). + +Revision History: + + 15-May-1991 JohnRo + Created align.h for NT/LAN from OS/2 1.2 HPFS pbmacros.h. + 19-Jun-1991 JohnRo + Make sure pointer-to-wider-then-byte doesn't get messed up. + 10-Jul-1991 JohnRo + Added ALIGN_BYTE and ALIGN_CHAR for completeness. + 21-Aug-1991 CliffV + Fix ROUND_DOWN_* to include ~ + 03-Dec-1991 JohnRo + Worst-case on MIPS is 8-byte alignment. + Added COUNT_IS_ALIGNED() and POINTER_IS_ALIGNED() macros. + 26-Jun-1992 JohnRo + RAID 9933: ALIGN_WORST should be 8 for x86 builds. + +--*/ + +#ifndef _ALIGN_ +#define _ALIGN_ + + +// BOOL +// COUNT_IS_ALIGNED( +// IN DWORD Count, +// IN DWORD Pow2 // undefined if this isn't a power of 2. +// ); +// +#define COUNT_IS_ALIGNED(Count,Pow2) \ + ( ( ( (Count) & (((Pow2)-1)) ) == 0) ? TRUE : FALSE ) + +// BOOL +// POINTER_IS_ALIGNED( +// IN PVOID Ptr, +// IN DWORD Pow2 // undefined if this isn't a power of 2. +// ); +// +#define POINTER_IS_ALIGNED(Ptr,Pow2) \ + ( ( ( ((ULONG_PTR)(Ptr)) & (((Pow2)-1)) ) == 0) ? TRUE : FALSE ) + + +// Note ............. +// There is a subtle issue with all these alignment methods +// The way the alignment is done depends on the lValue assignment of these MACRO +// For example: +// UINT64 fileSizeAlligned = ROUND_UP_COUNT(fileSize, pageSize) +// will do a correct 64 bit aligned rounding up +// UINT32 pagesInFileCount = ROUND_UP_COUNT(fileSize, pageSize) / pageSize; +// this will truncate the pageSize to UINT32 when evaluating ~(Pow2-1) below +// causing the result to truncate the most significant 32 bits in fileSize + + +#define ROUND_DOWN_COUNT(Count,Pow2) \ + ( (Count) & (~(((LONG)(Pow2))-1)) ) + +#define ROUND_DOWN_POINTER(Ptr,Pow2) \ + ( (PVOID) ROUND_DOWN_COUNT( ((ULONG_PTR)(Ptr)), (Pow2) ) ) + + +// If Count is not already aligned, then +// round Count up to an even multiple of "Pow2". "Pow2" must be a power of 2. +// +// DWORD +// ROUND_UP_COUNT( +// IN DWORD Count, +// IN DWORD Pow2 +// ); +#define ROUND_UP_COUNT(Count,Pow2) \ + ( ((Count)+(Pow2)-1) & (~(((LONG)(Pow2))-1)) ) + +// PVOID +// ROUND_UP_POINTER( +// IN PVOID Ptr, +// IN DWORD Pow2 +// ); + +// If Ptr is not already aligned, then round it up until it is. +#define ROUND_UP_POINTER(Ptr,Pow2) \ + ( (PVOID) ( (((ULONG_PTR)(Ptr))+(Pow2)-1) & (~(((LONG)(Pow2))-1)) ) ) + + +// Usage: myPtr = ROUND_UP_POINTER( unalignedPtr, ALIGN_LPVOID ) + +#define ALIGN_BYTE sizeof(UCHAR) +#define ALIGN_CHAR sizeof(CHAR) +#define ALIGN_DESC_CHAR sizeof(DESC_CHAR) +#define ALIGN_DWORD sizeof(DWORD) +#define ALIGN_LONG sizeof(LONG) +#define ALIGN_LPBYTE sizeof(LPBYTE) +#define ALIGN_LPDWORD sizeof(LPDWORD) +#define ALIGN_LPSTR sizeof(LPSTR) +#define ALIGN_LPTSTR sizeof(LPTSTR) +#define ALIGN_LPVOID sizeof(PVOID) +#define ALIGN_LPWORD sizeof(LPWORD) +#define ALIGN_TCHAR sizeof(TCHAR) +#define ALIGN_WCHAR sizeof(WCHAR) +#define ALIGN_WORD sizeof(WORD) + +// +// For now, use a hardcoded constant. however, this should be visited again +// and maybe changed to sizeof(QUAD). +// + +#define ALIGN_QUAD 8 + +#if defined(_X86_) + +#define ALIGN_WORST 8 + +#elif defined(_AMD64_) + +#define ALIGN_WORST 8 + +#elif defined(_ARM_) + +#define ALIGN_WORST 8 + +#elif defined(_ARM64_) + +#define ALIGN_WORST 8 + +#elif defined(_ALPHA_) + +// +// Worst-case alignment on ALPHA is 8 bytes (for double). Specify this here, +// in case our allocator is used for structures containing this. (That is, +// even though NT/LAN doesn't need this for our data structures, let's be +// permissive.) The alignment requirements apply to Alpha. +// + +#define ALIGN_WORST 8 + +#elif defined(_IA64_) + +// +// IA64 note for QUAD: The NT QUAD type definition is NOT the EM 16byte quad type. +// Because of some NT constraints, QUAD type size cannot be changed. +// + +#define ALIGN_WORST 16 + +#else // none of the above + +#error "Unknown alignment requirements for align.h" + +#endif // none of the above + +#endif // _ALIGN_ + diff --git a/network/wwan/cxwmbclass/inc/data.h b/network/wwan/cxwmbclass/inc/data.h new file mode 100644 index 00000000..4ac1a8ab --- /dev/null +++ b/network/wwan/cxwmbclass/inc/data.h @@ -0,0 +1,185 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// +//////////////////////////////////////////////////////////////////////////////// +// +// DEFINES +// +//////////////////////////////////////////////////////////////////////////////// +#pragma once + +#define MBB_DEFAULT_SESSION_ID 0 + +typedef struct _DSS_PACKET +{ + WDFMEMORY Data; + PMDL Mdl; +} DSS_PACKET, *PDSS_PACKET; + +typedef struct _MBB_PORT MBB_PORT, *PMBB_PORT; + +typedef struct _MINIPORT_DRIVER_CONTEXT +{ + WDFDRIVER hDriver; +} MINIPORT_DRIVER_CONTEXT, *PMINIPORT_DRIVER_CONTEXT; + +typedef struct _MBB_RECEIVE_QUEUE +{ + // + // Queue State + // + BOOLEAN LookasideList; + NDIS_SPIN_LOCK Lock; + KEVENT QueueEmptyEvent; + // + // Track Receives + // + LIST_ENTRY ReceivedQueue; + // + // Resources + // + NDIS_HANDLE NblPool; + NPAGED_LOOKASIDE_LIST ReceiveLookasideList; + +} MBB_RECEIVE_QUEUE, *PMBB_RECEIVE_QUEUE; + +typedef struct _MBB_NDIS_RECEIVE_CONTEXT +{ + // + // Resources + // + + PMDL Mdl; + PUCHAR ReceiveNtbBuffer; + WDFLOOKASIDE ReceiveLookasideList; + PMBB_RECEIVE_QUEUE RecvQueue; + MBB_BUS_HANDLE BusHandle; + MBB_RECEIVE_CONTEXT BusContext; + PWMBCLASS_DEVICE_CONTEXT WmbDeviceContext; + // + // Parse state + // + ULONG NtbSequence; + WDFMEMORY ReceiveLookasideBufferMemory; + + LONG TotalNdpCount; + LONG CompletedNdpCount; +} MBB_NDIS_RECEIVE_CONTEXT, *PMBB_NDIS_RECEIVE_CONTEXT; + +typedef struct _MBB_RECEIVE_NDP_CONTEXT +{ + LIST_ENTRY ReceiveNdpNode; + PMBB_NDIS_RECEIVE_CONTEXT ReceiveContext; + WDFMEMORY ReceiveNdpLookasideBufferMemory; + PVOID Nth; + PVOID Ndp; + ULONG CurrentDatagramIndex; + ULONG IndicatedPackets; + PWMBCLASS_NETADAPTER_CONTEXT NetAdapterContext; +} MBB_RECEIVE_NDP_CONTEXT, *PMBB_RECEIVE_NDP_CONTEXT; + +extern MINIPORT_DRIVER_CONTEXT GlobalControl; + +typedef enum +{ + MbbNdpTypeNoCrc = 0, + MbbNdpTypeCrc, + MbbNdpTypeIps, + MbbNdpTypeVendor_1, // Vendor with session id X (need not be 1) + MbbNdpTypeVendor_2, // Vendor with session id Y (need not be X + 1) + MbbNdpTypeVendor_3, + MbbNdpTypeVendor_Max, // Max 4 vendor sessions in one NTB + MbbNdpTypeMax + +} MBB_NDP_TYPE; + +typedef struct _MBB_PACKET_CONTEXT +{ + PMDL DataStartMdl; + PMDL DataEndMdl; + PMDL PaddingMdl; + PMDL ModifiedMdl; + MDL OriginalMdl; + +} MBB_PACKET_CONTEXT, *PMBB_PACKET_CONTEXT; + +typedef struct _MBB_NDP_HEADER_ENTRY +{ + MBB_NDP_TYPE NdpType; + ULONG SessionId; + ULONG DatagramOffset; + ULONG DatagramLength; + ULONG NextEntryIndex; + PNET_BUFFER NetBuffer; + PNET_BUFFER_LIST NetBufferList; + + union + { + NET_PACKET* NetPacket; + PDSS_PACKET DssPacket; + }; + MBB_PACKET_CONTEXT NetPacketContext; +} MBB_NDP_HEADER_ENTRY, *PMBB_NDP_HEADER_ENTRY; + +typedef struct _MBB_NTB_BUILD_CONTEXT +{ + LIST_ENTRY NtbQLink; + // + // Read-only values + // + BOOLEAN IsNtb32Bit; + ULONG NtbHeaderSize; + ULONG NdpHeaderFixedSize; + ULONG NdpDatagramEntrySize; + ULONG NtbOutMaxSize; + USHORT NtbOutMaxDatagrams; + USHORT NdpOutDivisor; + USHORT NdpOutPayloadRemainder; + USHORT NdpOutAlignment; + PVOID PaddingBuffer; + WDFLOOKASIDE NtbLookasideList; + // + // Network Transfer Header(NTH) + // + union + { + NCM_NTH16 Nth16; + NCM_NTH32 Nth32; + }; + PMDL NthMdl; + // + // NDP Header + // + PMDL NdpMdl; + ULONG NdpSize; + PVOID NdpBuffer; + // + // NDP Datagrams + // + ULONG DatagramCount; + ULONG DatagramLength; + PMDL DatagramLastMdl; + + WDFMEMORY NtbLookasideBufferMemory; + WDFMEMORY NdpBufferMemory; + NETPACKETQUEUE NetTxQueue; + NETADAPTER NetAdapter; + NET_RING_COLLECTION const* NetDatapathDescriptor; + +#if DBG + // + // Testing + // + PCHAR ScratchBuffer; + ULONG ScratchLength; +#endif + + // + // NDP Headers. Varialble length array is limited + // to NdpMaxDatagrams. NdpFirstDatagramEntry of -1 + // is invalid. + // + ULONG NdpFirstDatagramEntry[MbbNdpTypeMax]; + MBB_NDP_HEADER_ENTRY NdpDatagramEntries[ANYSIZE_ARRAY]; + +} MBB_NTB_BUILD_CONTEXT, *PMBB_NTB_BUILD_CONTEXT; diff --git a/network/wwan/cxwmbclass/inc/device.h b/network/wwan/cxwmbclass/inc/device.h new file mode 100644 index 00000000..a00ea7f4 --- /dev/null +++ b/network/wwan/cxwmbclass/inc/device.h @@ -0,0 +1,45 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#pragma once + +typedef struct _WMBCLASS_DEVICE_CONTEXT +{ + void* WdfTriageInfoPtr; + + WDFDEVICE WdfDevice; + bool m_armedWake; + ULONG TraceInstance; + + MBB_BUS_HANDLE BusHandle; + MBB_BUS_PARAMETERS BusParams; + + ULONGLONG DSSPacketsReceivedCount; + ULONGLONG DSSPacketsSentCount; + + LONG NtbSequenceNumber; + + WDFLOOKASIDE ReceiveLookasideList; + PUCHAR sharedPaddingBuffer; + + struct + { + WDFSPINLOCK WdfRecvSpinLock; + struct _WMBCLASS_NETADAPTER_CONTEXT* NetAdapterContext; // the context of the netAdapter instance if this session is in use + } Sessions[MBB_MAX_NUMBER_OF_SESSIONS]; + +} WMBCLASS_DEVICE_CONTEXT, *PWMBCLASS_DEVICE_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(WMBCLASS_DEVICE_CONTEXT, WmbClassGetDeviceContext); + +EVT_WDF_DEVICE_PREPARE_HARDWARE EvtDevicePrepareHardware; +EVT_WDF_DEVICE_RELEASE_HARDWARE EvtDeviceReleaseHardware; +EVT_WDF_DEVICE_SURPRISE_REMOVAL EvtDeviceSurpriseRemoval; + +EVT_MBB_DEVICE_SEND_MBIM_FRAGMENT EvtMbbDeviceSendMbimFragment; +EVT_MBB_DEVICE_RECEIVE_MBIM_FRAGMENT EvtMbbDeviceReceiveMbimFragment; +EVT_MBB_DEVICE_CREATE_ADAPTER EvtMbbDeviceCreateAdapter; +//EVT_NET_DEVICE_RESET EvtMbbDeviceReset; + +EVT_WDF_OBJECT_CONTEXT_CLEANUP EvtAdapterCleanup; diff --git a/network/wwan/cxwmbclass/inc/mbbmessages.h b/network/wwan/cxwmbclass/inc/mbbmessages.h new file mode 100644 index 00000000..61957009 --- /dev/null +++ b/network/wwan/cxwmbclass/inc/mbbmessages.h @@ -0,0 +1,3273 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.01.0625 */ +/* at Mon Jan 18 19:14:07 2038 + */ +/* @@MIDL_FILE_HEADING( ) */ + + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 500 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#if 0 +#include +#include +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCNDR_H_VERSION__ */ +#endif + +#ifndef __MbbMessages_h__ +#define __MbbMessages_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#ifndef DECLSPEC_XFGVIRT +#if _CONTROL_FLOW_GUARD_XFG +#define DECLSPEC_XFGVIRT(base, func) __declspec(xfg_virtual(base, func)) +#else +#define DECLSPEC_XFGVIRT(base, func) +#endif +#endif + +/* Forward Declarations */ + +/* header files for imported files */ +// #include "wtypes.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_MbbMessages_0000_0000 */ +/* [local] */ + +// +// Copyright (C) Microsoft. All rights reserved. +// +#include +// +// Service Ids +// +// Invald GUID +// 00000000-0000-0000-0000-000000000000 +DEFINE_GUID( MBB_UUID_INVALID, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ); +#define MBB_UUID_INVALID_CONSTANT { 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } +// Basic IP Connectivity +// a289cc33-bcbb-8b4f-b6b0-133ec2aae6df +DEFINE_GUID( MBB_UUID_BASIC_CONNECT, 0xa289cc33, 0xbcbb, 0x8b4f, 0xb6, 0xb0, 0x13, 0x3e, 0xc2, 0xaa, 0xe6, 0xdf ); +#define MBB_UUID_BASIC_CONNECT_CONSTANT { 0xa289cc33, 0xbcbb, 0x8b4f, { 0xb6, 0xb0, 0x13, 0x3e, 0xc2, 0xaa, 0xe6, 0xdf } } +// SMS +// 533fbeeb-14fe-4467-9f90-33a223e56c3f +DEFINE_GUID( MBB_UUID_SMS, 0x533fbeeb, 0x14fe, 0x4467, 0x9f, 0x90, 0x33, 0xa2, 0x23, 0xe5, 0x6c, 0x3f ); +#define MBB_UUID_SMS_CONSTANT { 0x533fbeeb, 0x14fe, 0x4467, { 0x9f, 0x90, 0x33, 0xa2, 0x23, 0xe5, 0x6c, 0x3f } } +// USSD +// e550a0c8-5e82-479e-82f7-10abf4c3351f +DEFINE_GUID( MBB_UUID_USSD, 0xe550a0c8, 0x5e82, 0x479e, 0x82, 0xf7, 0x10, 0xab, 0xf4, 0xc3, 0x35, 0x1f ); +#define MBB_UUID_USSD_CONSTANT { 0xe550a0c8, 0x5e82, 0x479e, { 0x82, 0xf7, 0x10, 0xab, 0xf4, 0xc3, 0x35, 0x1f } } +// Phonebook +// 4bf38476-1e6a-41db-b1d8-bed289c25bdb +DEFINE_GUID( MBB_UUID_PHONEBOOK, 0x4bf38476, 0x1e6a, 0x41db, 0xb1, 0xd8, 0xbe, 0xd2, 0x89, 0xc2, 0x5b, 0xdb ); +#define MBB_UUID_PHONEBOOK_CONSTANT { 0x4bf38476, 0x1e6a, 0x41db, { 0xb1, 0xd8, 0xbe, 0xd2, 0x89, 0xc2, 0x5b, 0xdb } } +// SIM Application Toolkit +// d8f20131-fcb5-4e17-8602-d6ed3816164c +DEFINE_GUID( MBB_UUID_SAT, 0xd8f20131, 0xfcb5, 0x4e17, 0x86, 0x02, 0xd6, 0xed, 0x38, 0x16, 0x16, 0x4c ); +#define MBB_UUID_SAT_CONSTANT { 0xd8f20131, 0xfcb5, 0x4e17, { 0x86, 0x02, 0xd6, 0xed, 0x38, 0x16, 0x16, 0x4c } } +// Windows 7 Vendor Extension +// b492e7e2-adba-499d-8401-7794bb913c1c +DEFINE_GUID( MBB_UUID_MS_VENDOR_EXTENSION, 0xb492e7e2, 0xadba, 0x499d, 0x84, 0x01, 0x77, 0x94, 0xbb, 0x91, 0x3c, 0x1c ); +#define MBB_UUID_MS_VENDOR_EXTENSION_CONSTANT { 0xb492e7e2, 0xadba, 0x499d, { 0x84, 0x01, 0x77, 0x94, 0xbb, 0x91, 0x3c, 0x1c } } +// Authentication +// 1d2b5ff7-0aa1-48b2-aa52-50f15767174e +DEFINE_GUID( MBB_UUID_AUTH, 0x1d2b5ff7, 0x0aa1, 0x48b2, 0xaa, 0x52, 0x50, 0xf1, 0x57,0x67, 0x17, 0x4e ); +#define MBB_UUID_AUTH_CONSTANT { 0x1d2b5ff7, 0x0aa1, 0x48b2, { 0xaa, 0x52, 0x50, 0xf1, 0x57,0x67, 0x17, 0x4e } } +// Device Service Stream +// c08a26dd-7718-4382-8482-6e0d583c4d0e +DEFINE_GUID( MBB_UUID_DSS, 0xc08a26dd, 0x7718, 0x4382, 0x84, 0x82, 0x6e, 0x0d, 0x58, 0x3c, 0x4d, 0x0e ); +#define MBB_UUID_DSS_CONSTANT { 0xc08a26dd, 0x7718, 0x4382, { 0x84, 0x82, 0x6e, 0x0d, 0x58, 0x3c, 0x4d, 0x0e } } +// Multi-carrier device service +// 8b569648-628d-4653-9b9f-1025404424e1 +DEFINE_GUID( MBB_UUID_MULTICARRIER, 0x8b569648, 0x628d, 0x4653, 0x9b, 0x9f, 0x10, 0x25, 0x40, 0x44, 0x24, 0xe1 ); +#define MBB_UUID_MULTICARRIER_CONSTANT { 0x8b569648, 0x628d, 0x4653, { 0x9b, 0x9f, 0x10, 0x25, 0x40, 0x44, 0x24, 0xe1 } } +// Host Shutdown device service +// 883b7c26-985f-43fa-9804-27d7fb80959c +DEFINE_GUID( MBB_UUID_HOSTSHUTDOWN, 0x883b7c26, 0x985f, 0x43fa, 0x98, 0x04, 0x27, 0xd7, 0xfb, 0x80, 0x95, 0x9c ); +#define MBB_UUID_HOSTSHUTDOWN_CONSTANT { 0x883b7c26, 0x985f, 0x43fa, { 0x98, 0x04, 0x27, 0xd7, 0xfb, 0x80, 0x95, 0x9c } } +// MBIM 2.0 voice extensions +// 8d8b9eba-37be-449b-8f1e-61cb034a702e +DEFINE_GUID( MBB_UUID_VOICEEXTENSIONS, 0x8d8b9eba, 0x37be, 0x449b, 0x8f, 0x1e, 0x61, 0xcb, 0x03, 0x4a, 0x70, 0x2e ); +#define MBB_UUID_VOICEEXTENSIONS_CONSTANT { 0x8d8b9eba, 0x37be, 0x449b, { 0x8f, 0x1e, 0x61, 0xcb, 0x03, 0x4a, 0x70, 0x2e } } +// Low-Level UICC Access +// c2f6588e-f037-4bc9-8665-f4d44bd09367 +DEFINE_GUID( MBB_UUID_UICC_LOW_LEVEL, 0xc2f6588e, 0xf037, 0x4bc9, 0x86, 0x65, 0xf4, 0xd4, 0x4b, 0xd0, 0x93, 0x67 ); +#define MBB_UUID_UICC_LOW_LEVEL_CONSTANT { 0xc2f6588e, 0xf037, 0x4bc9, { 0x86, 0x65, 0xf4, 0xd4, 0x4b, 0xd0, 0x93, 0x67 } } +// Selective Absorption Rate (SAR) control +// 68223d04-9f6c-4e0f-822d-28441fb72340 +DEFINE_GUID( MBB_UUID_SARCONTROL, 0x68223d04, 0x9f6c, 0x4e0f, 0x82, 0x2d, 0x28, 0x44, 0x1f, 0xb7, 0x23, 0x40 ); +#define MBB_UUID_SARCONTROL_CONSTANT { 0x68223d04, 0x9f6c, 0x4e0f, { 0x82, 0x2d, 0x28, 0x44, 0x1f, 0xb7, 0x23, 0x40 } } +// Basic IP Connectivity Extensions (a private Microsoft service not approved by MBIM USB forum as of 2016/11/09) +// 3d01dcc5-fef5-4d05-0d3a-bef7058e9aaf +DEFINE_GUID( MBB_UUID_BASIC_CONNECT_EXTENSIONS, 0x3d01dcc5, 0xfef5, 0x4d05, 0x0d, 0x3a, 0xbe, 0xf7, 0x05, 0x8e, 0x9a, 0xaf ); +#define MBB_UUID_BASIC_CONNECT_EXT_CONSTANT { 0x3d01dcc5, 0xfef5, 0x4d05, { 0x0d, 0x3a, 0xbe, 0xf7, 0x05, 0x8e, 0x9a, 0xaf } } +// DeviceService GUID for Modem Log Transfer (parameter for DSS connect/disconnect request to open/close DSS data channel) +// 0ebb1ceb-af2d-484d-8df3-53bc51fd162c +DEFINE_GUID( MBB_UUID_MODEM_LOG_TRANSFER, 0x0ebb1ceb, 0xaf2d, 0x484d, 0x8d, 0xf3, 0x53, 0xbc, 0x51, 0xfd, 0x16, 0x2c ); +#define MBB_UUID_MODEM_LOG_TRANSFER_CONSTANT { 0x0ebb1ceb, 0xaf2d, 0x484d, { 0x8d, 0xf3, 0x53, 0xbc, 0x51, 0xfd, 0x16, 0x2c } } +// +// Context Type GUIDs +// +// MBIMContextTypeNone +// B43F758C-A560-4B46-B35E-C5869641FB54 +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_NONE, 0xB43F758C, 0xA560, 0x4B46, 0xB3, 0x5E, 0xC5, 0x86, 0x96, 0x41, 0xFB, 0x54 ); +// MBIMContextTypeInternet +// 7E5E2A7E-4E6F-7272-736B-656E7E5E2A7E +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_INTERNET, 0x7E5E2A7E, 0x4E6F, 0x7272, 0x73, 0x6B, 0x65, 0x6E, 0x7E, 0x5E, 0x2A, 0x7E ); +// MBIMContextTypeVpn +// 9B9F7BBE-8952-44B7-83AC-CA41318DF7A0 +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_VPN, 0x9B9F7BBE, 0x8952, 0x44B7, 0x83, 0xAC, 0xCA, 0x41, 0x31, 0x8D, 0xF7, 0xA0 ); +// MBIMContextTypeVoice +// 88918294-0EF4-4396-8CCA-A8588FBC02B2 +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_VOICE, 0x88918294, 0x0EF4, 0x4396, 0x8C, 0xCA, 0xA8, 0x58, 0x8F, 0xBC, 0x02, 0xB2 ); +// MBIMContextTypeVideoShare +// 05A2A716-7C34-4B4D-9A91-C5EF0C7AAACC +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_VIDEO_SHARE, 0x05A2A716,0x7C34, 0x4B4D, 0x9A, 0x91, 0xC5, 0xEF, 0x0C, 0x7A, 0xAA, 0xCC ); +// MBIMContextTypePurchase +// B3272496-AC6C-422B-A8C0-ACF687A27217 +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_PURCHASE, 0xB3272496, 0xAC6C, 0x422B, 0xA8, 0xC0, 0xAC, 0xF6, 0x87, 0xA2, 0x72, 0x17 ); +// MBIMContextTypeIMS +// 21610D01-3074-4BCE-9425-B53A07D697D6 +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_IMS, 0x21610D01, 0x3074, 0x4BCE, 0x94, 0x25, 0xB5, 0x3A, 0x07, 0xD6, 0x97, 0xD6 ); +// MBIMContextTypeMMS +// 46726664-7269-6BC6-9624-D1D35389ACA9 +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_MMS, 0x46726664, 0x7269, 0x6BC6, 0x96, 0x24, 0xD1, 0xD3, 0x53, 0x89, 0xAC, 0xA9 ); +// MBIMContextTypeLocal +// A57A9AFC-B09F-45D7-BB40-033C39F60DB9 +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_LOCAL, 0xA57A9AFC, 0xB09F, 0x45D7, 0xBB, 0x40, 0x03, 0x3C, 0x39, 0xF6, 0x0D, 0xB9 ); +// MBIMMsContextTypeAdmin +// 5f7e4c2e-e80b-40a9-a239-f0abcfd11f4b +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_MS_ADMIN, 0x5f7e4c2e, 0xe80b, 0x40a9, 0xa2, 0x39, 0xf0, 0xab, 0xcf, 0xd1, 0x1f, 0x4b ); +// MBIMMSContextTypeApp +// 74d88a3d-dfbd-4799-9a8c-7310a37bb2ee +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_MS_APP, 0x74d88a3d, 0xdfbd, 0x4799, 0x9a, 0x8c, 0x73, 0x10, 0xa3, 0x7b, 0xb2, 0xee ); +// MBIMMsContextTypeXcap +// 50d378a7-baa5-4a50-b872-3fe5bb463411 +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_MS_XCAP, 0x50d378a7, 0xbaa5, 0x4a50, 0xb8, 0x72, 0x3f, 0xe5, 0xbb, 0x46, 0x34, 0x11 ); +// MBIMMsContextTypeTethering +// 5e4e0601-48dc-4e2b-acb8-08b4016bbaac +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_MS_TETHERING, 0x5e4e0601, 0x48dc, 0x4e2b, 0xac, 0xb8, 0x08, 0xb4, 0x01, 0x6b, 0xba, 0xac ); +// MBIMMsContextTypeEmergencyCalling +// 5f41adb8-204e-4d31-9da8-b3c970e360f2 +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_MS_EMERGENCYCALL, 0x5f41adb8, 0x204e, 0x4d31, 0x9d, 0xa8, 0xb3, 0xc9, 0x70, 0xe3, 0x60, 0xf2 ); +// 9C494542-A43B-4EA5-B8B7-53310E71DF10 +DEFINE_GUID( MBB_UUID_CONTEXT_TYPE_CUSTOM, 0x9C494542, 0xA43B, 0x4EA5, 0xB8, 0xB7, 0x53, 0x31, 0x0E, 0x71, 0xDF, 0x10); +// 146FED19-EB71-42A7-B3EB-3875DEA61D92 +DEFINE_GUID(GUID_USB_CAPABILITY_DEVICE_TYPE, 0x146FED19, 0xEB71, 0x42A7, 0xB3, 0xEB, 0x38, 0x75, 0xDE, 0xA6, 0x1D, 0x92); +#define MBB_STATUS_SUCCESS( STATUS ) \ + ( \ + ((STATUS) == MBB_STATUS_SUCCESS) || \ + ((STATUS) == MBB_STATUS_SMS_MORE_DATA) \ + ) +#define MBB_STATUS_IS_BASIC(MBBSTATUS) (((MBBSTATUS) >= MBB_STATUS_BASIC_START) && ((MBBSTATUS) < MBB_STATUS_BASIC_END)) +#define MBB_STATUS_BASIC_INDEX(MBBSTATUS) ((MBBSTATUS)-MBB_STATUS_BASIC_START) +#define MBB_STATUS_BASIC_COUNT() (MBB_STATUS_BASIC_END-MBB_STATUS_BASIC_START) +#define MBB_STATUS_IS_SMS(MBBSTATUS) (((MBBSTATUS) >= MBB_STATUS_SMS_START) && ((MBBSTATUS) < MBB_STATUS_SMS_END)) +#define MBB_STATUS_SMS_INDEX(MBBSTATUS) ((MBBSTATUS)-MBB_STATUS_SMS_START) +#define MBB_STATUS_SMS_COUNT() (MBB_STATUS_SMS_END-MBB_STATUS_SMS_START) +#define MBB_STATUS_IS_UICC(MBBSTATUS) (((MBBSTATUS) >= MBB_STATUS_UICC_START) && ((MBBSTATUS) < MBB_STATUS_UICC_END)) +#define MBB_STATUS_UICC_INDEX(MBBSTATUS) ((MBBSTATUS)-MBB_STATUS_UICC_START) +#define MBB_STATUS_UICC_COUNT() (MBB_STATUS_UICC_END-MBB_STATUS_UICC_START) +#define MBB_UUID_TO_NET(_dest, _src) \ +{ \ + (_dest)->Data1 = RtlUlongByteSwap((_src)->Data1); \ + (_dest)->Data2 = RtlUshortByteSwap((_src)->Data2); \ + (_dest)->Data3 = RtlUshortByteSwap((_src)->Data3); \ + RtlCopyMemory((_dest)->Data4, (_src)->Data4, sizeof((_src)->Data4)); \ + \ +} +#define MBB_UUID_TO_HOST(_dest, _src) MBB_UUID_TO_NET(_dest, _src) +#define MBB_IS_DEVICE_REGISTERED( _State_ ) \ +( \ + ( (_State_) == MbbRegisterStateHome ) || \ + ( (_State_) == MbbRegisterStateRoaming ) || \ + ( (_State_) == MbbRegisterStatePartner ) \ +) +#include +#define MBB_MAXIMUM_DATA_CLASS_NAME_LENGTH ( 11 ) + +#define MBB_MAXIMUM_DEVICE_ID_LENGTH ( 17 ) + +#define MBB_MAXIMUM_FIRMWARE_INFO_LENGTH ( 31 ) + +#define MBB_MAXIMUM_SUBSCRIBER_ID_LENGTH ( 15 ) + +#define MBB_MAXIMUM_SIM_ICC_ID_LENGTH ( 20 ) + +#define MBB_MAXIMUM_TELEPHONE_NUMBER_LENGTH ( 15 ) + +#define MBB_MAXIMUM_TELEPHONE_NUMBER_ERRATA_LENGTH ( 22 ) + +#define MBB_MAXIMUM_PIN_LENGTH ( 16 ) + +#define MBB_MAXIMUM_PROVIDER_ID_LENGTH ( 6 ) + +#define MBB_MAXIMUM_PROVIDER_NAME_LENGTH ( 20 ) + +#define MBB_MAXIMUM_ROAMING_TEXT_LENGTH ( 63 ) + +#define MBB_MAXIMUM_ACCESS_STRING_LENGTH ( 100 ) + +#define MBB_MAXIMUM_USERNAME_LENGTH ( 255 ) + +#define MBB_MAXIMUM_PASSWORD_LENGTH ( 255 ) + +#define MBB_MAXIMUM_SMS_ADDRESS_LENGTH ( 20 ) + +#define MBB_MAXIMUM_SMS_CDMA_ADDRESS_LENGTH ( 49 ) + +#define MBB_MAXIMUM_SMS_CDMA_TIMESTAMP_LENGTH ( 21 ) + +#define MBB_MAXIMUM_SMS_CDMA_BUFFER_LENGTH ( 160 ) + +#define MBB_MAXIMUM_SMS_GSM_PDU_BUFFER_LENGTH ( 183 ) + +#define MBB_MAXIMUM_SMS_CDMA_PDU_BUFFER_LENGTH ( 255 ) + +#define MBB_USSD_STRING_LEN_MAX ( 160 ) + +#define MBB_RSSI_DISABLE ( 0xffffffff ) + +#define MBB_RSSI_DEFAULT ( 0 ) + +#define MBB_SET_CONTEXT_STATE_EX3_MIN_TLV_CNT ( 3 ) + +#define MBB_CONTEXT_STATE_EX3_MIN_TLV_CNT ( 1 ) + +#define MBIM_VERSION_1_0 ( 0x100 ) + +#define MBIM_MS_EXTENDED_VER_1_0 ( 0x100 ) + +#define MBIM_MS_EXTENDED_VER_2_0 ( 0x200 ) + +#define MBIM_MS_EXTENDED_VER_3_0 ( 0x300 ) + +#define MBB_MS_DEVICE_CAPS_INFO_V3_MIN_TLV_CNT ( 6 ) + +#define MBB_TLV_TYPE_RESERVED ( 0 ) + +#define MBB_TLV_TYPE_UE_POLICIES ( 1 ) + +#define MBB_TLV_TYPE_SINGLE_NSSAI ( 2 ) + +#define MBB_TLV_TYPE_ALLOWED_NSSAI ( 3 ) + +#define MBB_TLV_TYPE_CFG_NSSAI ( 4 ) + +#define MBB_TLV_TYPE_DFLT_CFG_NSSAI ( 5 ) + +#define MBB_TLV_TYPE_PRECFG_DFLT_CFG_NSSAI ( 6 ) + +#define MBB_TLV_TYPE_REJ_NSSAI ( 7 ) + +#define MBB_TLV_TYPE_LADN ( 8 ) + +#define MBB_TLV_TYPE_TAI ( 9 ) + +#define MBB_TLV_TYPE_WCHAR_STR ( 10 ) + +#define MBB_TLV_TYPE_UINT16_TBL ( 11 ) + +#define MBB_TLV_TYPE_EAP_PACKET ( 12 ) + +#define MBB_TLV_TYPE_PCO ( 13 ) + +#define MBB_TLV_TYPE_ROUTE_SELECTION_DESCRIPTORS ( 14 ) + +#define MBB_TLV_TYPE_TRAFFIC_PARAMETERS ( 15 ) + +#define MBB_TLV_TYPE_WAKE_COMMAND ( 16 ) + +#define MBB_TLV_TYPE_WAKE_PACKET ( 17 ) + +#define MBB_NW_PARAMS_INFO_CONFIG_TLV_CNT ( 6 ) + +#define MBB_NW_PARAMS_INFO_UE_POLICIES_TLV_CNT ( 1 ) + +typedef unsigned short MBB_TLV_TYPE; + +typedef +enum _USB_CAP_DEVICE_TYPE + { + USB_CAP_DEVICE_TYPE_USB = 0, + USB_CAP_DEVICE_TYPE_UDE_MBIM = 1, + USB_CAP_DEVICE_TYPE_UDE_MBIM_FASTIO = 2, + USB_CAP_DEVICE_TYPE_MAXIMUM = ( USB_CAP_DEVICE_TYPE_UDE_MBIM_FASTIO + 1 ) + } USB_CAP_DEVICE_TYPE; + +typedef struct _USB_CAP_DEVICE_INFO_HEADER + { + USB_CAP_DEVICE_TYPE DeviceType; + UCHAR DeviceMinorVersion; + UCHAR DeviceMajorVersion; + ULONG Reserved; + } USB_CAP_DEVICE_INFO_HEADER; + +typedef struct _USB_CAP_DEVICE_INFO_HEADER *PUSB_CAP_DEVICE_INFO_HEADER; + +typedef struct _USB_CAP_DEVICE_INFO + { + USB_CAP_DEVICE_INFO_HEADER DeviceInfoHeader; + } USB_CAP_DEVICE_INFO; + +typedef struct _USB_CAP_DEVICE_INFO *PUSB_CAP_DEVICE_INFO; + +typedef +enum _MBB_NBL_TYPE + { + MBB_NBL_TYPE_IP = 0, + MBB_NBL_TYPE_DSS = 1, + MBB_NBL_TYPE_MAXIMUM = ( MBB_NBL_TYPE_DSS + 1 ) + } MBB_NBL_TYPE; + +typedef +enum _MBB_STATUS + { + MBB_STATUS_SUCCESS = 0, + MBB_STATUS_BASIC_START = 0, + MBB_STATUS_BUSY = 1, + MBB_STATUS_FAILURE = 2, + MBB_STATUS_SIM_NOT_INSERTED = 3, + MBB_STATUS_BAD_SIM = 4, + MBB_STATUS_PIN_REQUIRED = 5, + MBB_STATUS_PIN_DISABLED = 6, + MBB_STATUS_NOT_REGISTERED = 7, + MBB_STATUS_PROVIDERS_NOT_FOUND = 8, + MBB_STATUS_NO_DEVICE_SUPPORT = 9, + MBB_STATUS_PROVIDER_NOT_VISIBLE = 10, + MBB_STATUS_DATA_CLASS_NOT_AVAILABLE = 11, + MBB_STATUS_PACKET_SVC_DETACHED = 12, + MBB_STATUS_MAX_ACTIVATED_CONTEXTS = 13, + MBB_STATUS_NOT_INITIALIZED = 14, + MBB_STATUS_VOICE_CALL_IN_PROGRESS = 15, + MBB_STATUS_CONTEXT_NOT_ACTIVATED = 16, + MBB_STATUS_SERVICE_NOT_ACTIVATED = 17, + MBB_STATUS_INVALID_ACCESS_STRING = 18, + MBB_STATUS_INVALID_USER_NAME_PWD = 19, + MBB_STATUS_RADIO_POWER_OFF = 20, + MBB_STATUS_INVALID_PARAMETERS = 21, + MBB_STATUS_READ_FAILURE = 22, + MBB_STATUS_WRITE_FAILURE = 23, + MBB_STATUS_DENIED_POLICY = 24, + MBB_STATUS_NO_PHONEBOOK = 25, + MBB_STATUS_PARAMETER_TOO_LONG = 26, + MBB_STATUS_STK_BUSY = 27, + MBB_STATUS_OPERATION_NOT_ALLOWED = 28, + MBB_STATUS_MEMORY_FAILURE = 29, + MBB_STATUS_INVALID_MEMORY_INDEX = 30, + MBB_STATUS_MEMORY_FULL = 31, + MBB_STATUS_FILTER_NOT_SUPPORTED = 32, + MBB_STATUS_DSS_INSTANCE_LIMIT = 33, + MBB_STATUS_INVALID_DEVICE_SERVICE_OPERATION = 34, + MBB_STATUS_AUTH_INCORRECT_AUTN = 35, + MBB_STATUS_AUTH_SYNC_FAILURE = 36, + MBB_STATUS_AUTH_AMF_NOT_SET = 37, + MBB_STATUS_CONTEXT_NOT_SUPPORTED = 38, + MBB_STATUS_SHAREABILITY_CONDITION_ERROR = 39, + MBB_STATUS_PIN_FAILURE = 40, + MBB_STATUS_NO_LTE_ATTACH_CONFIG = 41, + MBB_STATUS_SESSION_ALREADY_EXISTS = 42, + MBB_STATUS_BASIC_END = ( MBB_STATUS_SESSION_ALREADY_EXISTS + 1 ) , + MBB_STATUS_SMS_UNKNOWN_SMSC_ADDRESS = 100, + MBB_STATUS_SMS_START = 100, + MBB_STATUS_SMS_NETWORK_TIMEOUT = 101, + MBB_STATUS_SMS_LANG_NOT_SUPPORTED = 102, + MBB_STATUS_SMS_ENCODING_NOT_SUPPORTED = 103, + MBB_STATUS_SMS_FORMAT_NOT_SUPPORTED = 104, + MBB_STATUS_SMS_MORE_DATA = 105, + MBB_STATUS_SMS_END = ( MBB_STATUS_SMS_MORE_DATA + 1 ) , + MBB_STATUS_UICC_NO_LOGICAL_CHANNELS = 0x87430001, + MBB_STATUS_UICC_START = 0x87430001, + MBB_STATUS_UICC_SELECT_FAILED = 0x87430002, + MBB_STATUS_UICC_INVALID_LOGICAL_CHANNEL = 0x87430003, + MBB_STATUS_UICC_END = ( MBB_STATUS_UICC_INVALID_LOGICAL_CHANNEL + 1 ) + } MBB_STATUS; + +typedef +enum _MBB_ERROR + { + MBB_ERROR_NONE = 0, + MBB_ERROR_TIMEOUT_FRAGMENT = 1, + MBB_ERROR_FRAGMENT_OUT_OF_SEQUENCE = 2, + MBB_ERROR_LENGTH_MISMATCH = 3, + MBB_ERROR_DUPLICATE_TID = 4, + MBB_ERROR_NOT_OPENED = 5, + MBB_ERROR_UNKNOWN = 6, + MBB_ERROR_CANCEL = 7, + MBB_ERROR_MAX_TRANSFER = 8 + } MBB_ERROR; + +typedef +enum _MBB_MESSAGE_TYPE + { + MBB_MESSAGE_TYPE_NONE = 0, + MBB_MESSAGE_TYPE_OPEN = 0x1, + MBB_MESSAGE_TYPE_CLOSE = 0x2, + MBB_MESSAGE_TYPE_COMMAND = 0x3, + MBB_MESSAGE_TYPE_HOST_ERROR = 0x4, + MBB_MESSAGE_TYPE_OPEN_DONE = 0x80000001, + MBB_MESSAGE_TYPE_CLOSE_DONE = 0x80000002, + MBB_MESSAGE_TYPE_COMMAND_DONE = 0x80000003, + MBB_MESSAGE_TYPE_FUNCTION_ERROR = 0x80000004, + MBB_MESSAGE_TYPE_INDICATE_STATUS = 0x80000007 + } MBB_MESSAGE_TYPE; + +typedef +enum _MBB_COMMAND_TYPE + { + MBB_COMMAND_TYPE_QUERY = 0, + MBB_COMMAND_TYPE_SET = 1 + } MBB_COMMAND_TYPE; + +typedef struct _MBB_MESSAGE_HEADER + { + MBB_MESSAGE_TYPE MessageType; + ULONG MessageLength; + ULONG MessageTransactionId; + } MBB_MESSAGE_HEADER; + +typedef struct _MBB_MESSAGE_HEADER *PMBB_MESSAGE_HEADER; + +typedef struct _MBB_FRAGMENT_HEADER + { + ULONG TotalFragments; + ULONG CurrentFragment; + } MBB_FRAGMENT_HEADER; + +typedef struct _MBB_FRAGMENT_HEADER *PMBB_FRAGMENT_HEADER; + +typedef struct _MBB_COMMAND + { + GUID ServiceId; + ULONG CommandId; + } MBB_COMMAND; + +typedef struct _MBB_COMMAND *PMBB_COMMAND; + +typedef struct _MBB_COMMAND_HEADER + { + MBB_MESSAGE_HEADER MessageHeader; + MBB_FRAGMENT_HEADER FragmentHeader; + MBB_COMMAND Command; + MBB_COMMAND_TYPE CommandType; + ULONG InformationBufferLength; + } MBB_COMMAND_HEADER; + +typedef struct _MBB_COMMAND_HEADER *PMBB_COMMAND_HEADER; + +typedef struct _MBB_COMMAND_FRAGMENT_HEADER + { + MBB_MESSAGE_HEADER MessageHeader; + MBB_FRAGMENT_HEADER FragmentHeader; + } MBB_COMMAND_FRAGMENT_HEADER; + +typedef struct _MBB_COMMAND_FRAGMENT_HEADER *PMBB_COMMAND_FRAGMENT_HEADER; + +typedef struct _MBB_COMMAND_DONE_HEADER + { + MBB_MESSAGE_HEADER MessageHeader; + MBB_FRAGMENT_HEADER FragmentHeader; + MBB_COMMAND Command; + MBB_STATUS MbbStatus; + ULONG InformationBufferLength; + } MBB_COMMAND_DONE_HEADER; + +typedef struct _MBB_COMMAND_DONE_HEADER *PMBB_COMMAND_DONE_HEADER; + +typedef struct _MBB_INDICATE_STATUS_HEADER + { + MBB_MESSAGE_HEADER MessageHeader; + MBB_FRAGMENT_HEADER FragmentHeader; + MBB_COMMAND Command; + ULONG InformationBufferLength; + } MBB_INDICATE_STATUS_HEADER; + +typedef struct _MBB_INDICATE_STATUS_HEADER *PMBB_INDICATE_STATUS_HEADER; + +typedef struct _MBB_OPEN_MESSAGE + { + MBB_MESSAGE_HEADER MessageHeader; + ULONG MaximumControlTransfer; + } MBB_OPEN_MESSAGE; + +typedef struct _MBB_OPEN_MESSAGE *PMBB_OPEN_MESSAGE; + +typedef struct _MBB_OPEN_MESSAGE_FASTIO + { + MBB_MESSAGE_HEADER MessageHeader; + ULONG MaximumControlTransfer; + PVOID AdapterContext; + PVOID SendNetBufferListsCompleteHandler; + PVOID ReceiveNetBufferListsHandler; + } MBB_OPEN_MESSAGE_FASTIO; + +typedef struct _MBB_OPEN_MESSAGE_FASTIO *PMBB_OPEN_MESSAGE_FASTIO; + +typedef struct _MBB_CLOSE_MESSAGE + { + MBB_MESSAGE_HEADER MessageHeader; + } MBB_CLOSE_MESSAGE; + +typedef struct _MBB_CLOSE_MESSAGE *PMBB_CLOSE_MESSAGE; + +typedef struct _MBB_OPEN_DONE + { + MBB_MESSAGE_HEADER MessageHeader; + MBB_STATUS MbbStatus; + } MBB_OPEN_DONE; + +typedef struct _MBB_OPEN_DONE *PMBB_OPEN_DONE; + +typedef struct _MBB_OPEN_DONE_FASTIO + { + MBB_MESSAGE_HEADER MessageHeader; + MBB_STATUS MbbStatus; + PVOID ModemContext; + PVOID SendNetBufferListsHandler; + PVOID ReturnNetBufferListsHandler; + PVOID CancelSendHandler; + PVOID HaltHandler; + PVOID PauseHandler; + PVOID ShutdownHandler; + PVOID ResetHandler; + PVOID RestartHandler; + } MBB_OPEN_DONE_FASTIO; + +typedef struct _MBB_OPEN_DONE_FASTIO *PMBB_OPEN_DONE_FASTIO; + +typedef struct _MBB_CLOSE_DONE + { + MBB_MESSAGE_HEADER MessageHeader; + MBB_STATUS MbbStatus; + } MBB_CLOSE_DONE; + +typedef struct _MBB_CLOSE_DONE *PMBB_CLOSE_DONE; + +typedef struct _MBB_ERROR_MESSAGE + { + MBB_MESSAGE_HEADER MessageHeader; + MBB_ERROR ErrorCode; + } MBB_ERROR_MESSAGE; + +typedef struct _MBB_ERROR_MESSAGE *PMBB_ERROR_MESSAGE; + +typedef +enum _MBB_BASIC_CID + { + MBB_BASIC_CID_DEVICE_CAPS = 1, + MBB_BASIC_CID_SUBSCRIBER_READY_INFO = 2, + MBB_BASIC_CID_RADIO_STATE = 3, + MBB_BASIC_CID_PIN_INFO = 4, + MBB_BASIC_CID_PIN_LIST = 5, + MBB_BASIC_CID_HOME_PROVIDER = 6, + MBB_BASIC_CID_PREFERRED_PROVIDERS = 7, + MBB_BASIC_CID_VISIBLE_PROVIDERS = 8, + MBB_BASIC_CID_REGISTER_STATE = 9, + MBB_BASIC_CID_PACKET_SERVICE = 10, + MBB_BASIC_CID_SIGNAL_STATE = 11, + MBB_BASIC_CID_CONNECT = 12, + MBB_BASIC_CID_PROVISIONED_CONTEXTS = 13, + MBB_BASIC_CID_SERVICE_ACTIVATION = 14, + MBB_BASIC_CID_IP_ADDRESS_INFO = 15, + MBB_BASIC_CID_DEVICE_SERVICES = 16, + MBB_BASIC_CID_NOTIFY_DEVICE_SERVICE_UPDATES = 19, + MBB_BASIC_CID_PACKET_STATISTICS = 20, + MBB_BASIC_CID_NETWORK_IDLE_HINT = 21, + MBB_BASIC_CID_EMERGENCY_MODE = 22, + MBB_BASIC_CID_PACKET_FILTERS = 23, + MBB_BASIC_CID_MULTICARRIER_PROVIDERS = 24, + MBB_BASIC_CID_MAXIMUM = ( MBB_BASIC_CID_MULTICARRIER_PROVIDERS + 1 ) + } MBB_BASIC_CID; + +typedef +enum _MBB_SMS_CID + { + MBB_SMS_CID_CONFIGURATION = 1, + MBB_SMS_CID_READ = 2, + MBB_SMS_CID_SEND = 3, + MBB_SMS_CID_DELETE = 4, + MBB_SMS_CID_STATUS = 5, + MBB_SMS_CID_MAXIMUM = ( MBB_SMS_CID_STATUS + 1 ) + } MBB_SMS_CID; + +typedef +enum _MBB_VENDOR_CID + { + MBB_VENDOR_CID_MS_VENDOR_SPECIFIC = 1, + MBB_VENDOR_CID_MAXIMUM = ( MBB_VENDOR_CID_MS_VENDOR_SPECIFIC + 1 ) + } MBB_VENDOR_CID; + +typedef +enum _MBB_USSD_CID + { + MBB_USSD_CID_USSD = 1, + MBB_USSD_CID_MAXIMUM = ( MBB_USSD_CID_USSD + 1 ) + } MBB_USSD_CID; + +typedef +enum _MBB_PHONEBOOK_CID + { + MBB_PHONEBOOK_CID_CONFIGURATION = 1, + MBB_PHONEBOOK_CID_READ = 2, + MBB_PHONEBOOK_CID_DELETE = 3, + MBB_PHONEBOOK_CID_SAVE = 4, + MBB_PHONEBOOK_CID_MAXIMUM = ( MBB_PHONEBOOK_CID_SAVE + 1 ) + } MBB_PHONEBOOK_CID; + +typedef +enum _MBB_SAT_CID + { + MBB_SAT_CID_PAC = 1, + MBB_SAT_CID_TERMINAL_RESPONSE = 2, + MBB_SAT_CID_ENVELOPE = 3, + MBB_SAT_CID_MAXIMUM = ( MBB_SAT_CID_ENVELOPE + 1 ) + } MBB_SAT_CID; + +typedef +enum _MBB_AUTH_CID + { + MBB_AUTH_CID_AKA = 1, + MBB_AUTH_CID_AKAP = 2, + MBB_AUTH_CID_SIM = 3, + MBB_AUTH_CID_MAXIUM = ( MBB_AUTH_CID_SIM + 1 ) + } MBB_AUTH_CID; + +typedef +enum _MBB_DSS_CID + { + MBB_DSS_CID_CONNECT = 1, + MBB_DSS_CID_MAXIUM = ( MBB_DSS_CID_CONNECT + 1 ) + } MBB_DSS_CID; + +typedef +enum _MBB_MULTICARRIER_CID + { + MBB_MULTICARRIER_CID_CAPABILITIES = 1, + MBB_MULTICARRIER_CID_LOCATION_INFO = 2, + MBB_MULTICARRIER_CID_CURRENT_CID_LIST = 3, + MBB_MULTICARRIER_CID_MAXIMUM = ( MBB_MULTICARRIER_CID_CURRENT_CID_LIST + 1 ) + } MBB_MULTICARRIER_CID; + +typedef +enum _MBB_HOSTSHUTDOWN_CID + { + MBB_HOSTSHUTDOWN_CID_ONE = 1, + MBB_HOSTSHUTDOWN_CID_PRESHUTDOWN = 2, + MBB_HOSTSHUTDOWN_CID_MAX = ( MBB_HOSTSHUTDOWN_CID_PRESHUTDOWN + 1 ) + } MBB_HOSTSHUTDOWN_CID; + +typedef +enum _MBB_VOICEEXTENSIONS_CID + { + MBB_VOICEEXTENSIONS_CID_SYS_CAPS = 1, + MBB_VOICEEXTENSIONS_CID_DEVICE_CAPS_V2 = 2, + MBB_VOICEEXTENSIONS_CID_SYS_SLOTMAPPINGS = 3, + MBB_VOICEEXTENSIONS_CID_SLOT_INFO_STATUS = 4, + MBB_VOICEEXTENSIONS_CID_DEVICE_BINDINGS = 5, + MBB_VOICEEXTENSIONS_CID_REGISTER_STATE_V2 = 6, + MBB_VOICEEXTENSIONS_CID_IMS_VOICE_STATE = 7, + MBB_VOICEEXTENSIONS_CID_SIGNAL_STATE_V2 = 8, + MBB_VOICEEXTENSIONS_CID_LOCATION_STATE = 9, + MBB_VOICEEXTENSIONS_CID_NITZ = 10, + MBB_VOICEEXTENSIONS_CID_MAX = ( MBB_VOICEEXTENSIONS_CID_NITZ + 1 ) + } MBB_VOICEEXTENSIONS_CID; + +typedef +enum _MBB_UICC_CID + { + MBB_UICC_CID_ATR = 1, + MBB_UICC_CID_OPEN_CHANNEL = 2, + MBB_UICC_CID_CLOSE_CHANNEL = 3, + MBB_UICC_CID_APDU = 4, + MBB_UICC_CID_TERMINAL_CAPABILITY = 5, + MBB_UICC_CID_RESET = 6, + MBB_UICC_CID_APP_LIST = 7, + MBB_UICC_CID_FILE_STATUS = 8, + MBB_UICC_CID_ACCESS_BINARY = 9, + MBB_UICC_CID_ACCESS_RECORD = 10, + MBB_UICC_CID_MAXIMUM = ( MBB_UICC_CID_ACCESS_RECORD + 1 ) + } MBB_UICC_CID; + +typedef +enum _MBB_SAR_CID + { + MBB_SAR_CID_CONFIG = 1, + MBB_SAR_CID_TRANSMISSION_STATUS = 2, + MBB_SAR_CID_MAXIMUM = ( MBB_SAR_CID_TRANSMISSION_STATUS + 1 ) + } MBB_SAR_CID; + +typedef +enum _MBB_BASICCONNECTEXT_CID + { + MBB_BASICCONNECTEXT_CID_PROVISIONED_CONTEXT_V2 = 1, + MBB_BASICCONNECTEXT_CID_NETWORK_BLACKLIST = 2, + MBB_BASICCONNECTEXT_CID_LTE_ATTACH_CONFIG = 3, + MBB_BASICCONNECTEXT_CID_LTE_ATTACH_STATUS = 4, + MBB_BASICCONNECTEXT_CID_SYS_CAPS = 5, + MBB_BASICCONNECTEXT_CID_DEVICE_CAPS_V2 = 6, + MBB_BASICCONNECTEXT_CID_DEVICE_SLOT_MAPPINGS = 7, + MBB_BASICCONNECTEXT_CID_SLOT_INFO_STATUS = 8, + MBB_BASICCONNECTEXT_CID_PCO = 9, + MBB_BASICCONNECTEXT_CID_DEVICE_RESET = 10, + MBB_BASICCONNECTEXT_CID_BASE_STATIONS_INFO = 11, + MBB_BASICCONNECTEXT_CID_LOCATION_INFO_STATUS = 12, + MBB_BASICCONNECTEXT_CID_MODEM_LOGGING_CONFIG = 13, + MBB_BASICCONNECTEXT_CID_PIN_INFO_EX2 = 14, + MBB_BASICCONNECTEXT_CID_VERSION = 15, + MBB_BASICCONNECTEXT_CID_MODEM_CONFIG = 16, + MBB_BASICCONNECTEXT_CID_REGISTRATION_PARAMS = 17, + MBB_BASICCONNECTEXT_CID_NETWORK_PARAMS = 18, + MBB_BASICCONNECTEXT_CID_WAKE_REASON = 19, + MBB_BASICCONNECTEXT_CID_MAXIMUM = ( MBB_BASICCONNECTEXT_CID_WAKE_REASON + 1 ) + } MBB_BASICCONNECTEXT_CID; + +typedef +enum _MBB_DEVICE_TYPE + { + MbbDeviceTypeUnknown = 0, + MbbDeviceTypeEmbedded = 1, + MbbDeviceTypeRemovable = 2, + MbbDeviceTypeRemote = 3, + MbbDeviceTypeMaximum = ( MbbDeviceTypeRemote + 1 ) + } MBB_DEVICE_TYPE; + +typedef +enum _MBB_CELLULAR_CLASS + { + MbbCellularClassInvalid = 0, + MbbCellularClassGsm = 1, + MbbCellularClassCdma = 2, + MbbCellularClassMaximum = ( MbbCellularClassCdma + 1 ) + } MBB_CELLULAR_CLASS; + +typedef +enum _MBB_VOICE_CLASS + { + MbbVoiceClassInvalid = 0, + MbbVoiceClassNoVoice = 1, + MbbVoiceClassSeparateVoiceData = 2, + MbbVoiceClassSimultaneousVoiceData = 3, + MbbVoiceClassMaximum = ( MbbVoiceClassSimultaneousVoiceData + 1 ) + } MBB_VOICE_CLASS; + +typedef +enum _MBB_SIM_CLASS + { + MbbSimClassInvalid = 0, + MbbSimClassSimLogical = 1, + MbbSimClassSimRemovable = 2, + MbbSimClassMaximum = ( MbbSimClassSimRemovable + 1 ) + } MBB_SIM_CLASS; + +typedef +enum _MBB_DATA_CLASS_VALUE + { + MbbDataClassNone = 0, + MbbDataClassGprs = 0x1, + MbbDataClassEdge = 0x2, + MbbDataClassUmts = 0x4, + MbbDataClassHsdpa = 0x8, + MbbDataClassHsupa = 0x10, + MbbDataClassLte = 0x20, + MbbDataClass5G = 0x40, + MbbDataClass_UNUSED = 0x80, + MbbDataClassTdScdma = 0x1000, + MbbDataClass1xRtt = 0x10000, + MbbDataClass1xEvdo = 0x20000, + MbbDataClass1xEvdoReva = 0x40000, + MbbDataClass1xEvdv = 0x80000, + MbbDataClass3xRtt = 0x100000, + MbbDataClass1xEvdoRevb = 0x200000, + MbbDataClassUmb = 0x400000, + MbbDataClassCustom = 0x80000000 + } MBB_DATA_CLASS_VALUE; + +typedef +enum _MBB_DATA_SUBCLASS_VALUE + { + MbbDataSubClassNone = 0, + MbbDataSubClass5GENDC = 0x1, + MbbDataSubClass5GNR = 0x2, + MbbDataSubClass5GNEDC = 0x4, + MbbDataSubClass5GELTE = 0x8, + MbbDataSubClassNGENDC = 0x10 + } MBB_DATA_SUBCLASS_VALUE; + +typedef +enum _MBB_FREQUENCY_RANGE + { + MbbFrequencyRangeUnknown = 0, + MbbFrequencyRange1 = 1, + MbbFrequencyRange2 = 2, + MbbFrequencyRange1AndRange2 = 3, + MbbFrequencyRangeMaximum = ( MbbFrequencyRange1AndRange2 + 1 ) + } MBB_FREQUENCY_RANGE; + +typedef +enum _MBB_BAND_CLASS_VALUE + { + MbbBandClassUnknown = 0, + MbbBandClass0 = 0x1, + MbbBandClassI = 0x2, + MbbBandClassII = 0x4, + MbbBandClassIII = 0x8, + MbbBandClassIV = 0x10, + MbbBandClassV = 0x20, + MbbBandClassVI = 0x40, + MbbBandClassVII = 0x80, + MbbBandClassVIII = 0x100, + MbbBandClassIX = 0x200, + MbbBandClassX = 0x400, + MbbBandClassXI = 0x800, + MbbBandClassXII = 0x1000, + MbbBandClassXIII = 0x2000, + MbbBandClassXIV = 0x4000, + MbbBandClassXV = 0x8000, + MbbBandClassXVI = 0x10000, + MbbBandClassXVII = 0x20000, + MbbBandClassCustom = 0x80000000 + } MBB_BAND_CLASS_VALUE; + +typedef +enum _MBB_SMS_CAPS_VALUE + { + MbbSmsCapsNone = 0, + MbbSmsCapsPduReceive = 0x1, + MbbSmsCapsPduSend = 0x2, + MbbSmsCapsTextReceive = 0x4, + MbbSmsCapsTextSend = 0x8 + } MBB_SMS_CAPS_VALUE; + +typedef +enum _MBB_CONTROL_CAPS_VALUE + { + MbbControlCapsNone = 0, + MbbControlCapsRegManual = 0x1, + MbbControlCapsHwRadioSwitch = 0x2, + MbbControlCapsCdmaMobileIp = 0x4, + MbbControlCapsCdmaSimpleIp = 0x8, + MbbControlCapsMultiCarrier = 0x10, + MbbControlCapsESIM = 0x20, + MbbControlCapsUEPolicyRouteSelection = 0x40, + MbbControlCapsSIMHotSwapCapable = 0x80 + } MBB_CONTROL_CAPS_VALUE; + +typedef +enum _MBB_READY_STATE + { + MbbReadyStateOff = 0, + MbbReadyStateInitialized = 1, + MbbReadyStateSimNotInserted = 2, + MbbReadyStateBadSim = 3, + MbbReadyStateFailure = 4, + MbbReadyStateNotActivated = 5, + MbbReadyStateDeviceLocked = 6, + MbbReadyStateNoEsimProfile = 7, + MbbReadyStateMaximum = ( MbbReadyStateNoEsimProfile + 1 ) + } MBB_READY_STATE; + +typedef +enum _MBB_READY_INFO_FLAGS + { + MbbReadyInfoFlagsNone = 0, + MbbReadyInfoFlagsUniqueId = 1 + } MBB_READY_INFO_FLAGS; + +typedef +enum _MBB_EMERGENCY_MODE + { + MbbEmergencyModeOff = 0, + MbbEmergencyModeOn = 1, + MbbEmergencyModeMaximum = ( MbbEmergencyModeOn + 1 ) + } MBB_EMERGENCY_MODE; + +typedef +enum _MBB_RADIO_STATE + { + MbbRadioStateOff = 0, + MbbRadioStateOn = 1, + MbbRadioStateMaximum = ( MbbRadioStateOn + 1 ) + } MBB_RADIO_STATE; + +typedef +enum _MBB_PIN_TYPE + { + MbbPinTypeNone = 0, + MbbPinTypeCustom = 1, + MbbPinTypePin1 = 2, + MbbPinTypePin2 = 3, + MbbPinTypeDeviceSimPin = 4, + MbbPinTypeDeviceFirstSimPin = 5, + MbbPinTypeNetworkPin = 6, + MbbPinTypeNetworkSubsetPin = 7, + MbbPinTypeSvcProviderPin = 8, + MbbPinTypeCorporatePin = 9, + MbbPinTypeSubsidyLock = 10, + MbbPinTypePuk1 = 11, + MbbPinTypePuk2 = 12, + MbbPinTypeDeviceFirstSimPuk = 13, + MbbPinTypeNetworkPuk = 14, + MbbPinTypeNetworkSubsetPuk = 15, + MbbPinTypeSvcProviderPuk = 16, + MbbPinTypeCorporatePuk = 17, + MbbPinTypeNev = 18, + MbbPinTypeAdm = 19, + MbbPinTypeMaximum = ( MbbPinTypeAdm + 1 ) + } MBB_PIN_TYPE; + +typedef +enum _MBB_PIN_STATE + { + MbbPinStateUnlocked = 0, + MbbPinStateLocked = 1, + MbbPinStateMaximum = ( MbbPinStateLocked + 1 ) + } MBB_PIN_STATE; + +typedef +enum _MBB_PIN_OPERATION + { + MbbPinOperationEnter = 0, + MbbPinOperationEnable = 1, + MbbPinOperationDisable = 2, + MbbPinOperationChange = 3, + MbbPinOperationMaximum = ( MbbPinOperationChange + 1 ) + } MBB_PIN_OPERATION; + +typedef +enum _MBB_PIN_MODE + { + MbbPinModeNotSupported = 0, + MbbPinModeEnabled = 1, + MbbPinModeDisabled = 2, + MbbPinModeMaximum = ( MbbPinModeDisabled + 1 ) + } MBB_PIN_MODE; + +typedef +enum _MBB_PIN_FORMAT + { + MbbPinFormatUnknown = 0, + MbbPinFormatNumeric = 1, + MbbPinFormatAlphaNumeric = 2, + MbbPinFormatMaximum = ( MbbPinFormatAlphaNumeric + 1 ) + } MBB_PIN_FORMAT; + +typedef +enum _MBB_PROVIDER_STATE_VALUE + { + MbbProviderStateHome = 0x1, + MbbProviderStateForbidden = 0x2, + MbbProviderStatePreferred = 0x4, + MbbProviderStateVisible = 0x8, + MbbProviderStateRegistered = 0x10, + MbbProviderStatePreferredMulticarrier = 0x20 + } MBB_PROVIDER_STATE_VALUE; + +typedef +enum _MBB_REGISTER_ACTION + { + MbbRegisterActionAutomatic = 0, + MbbRegisterActionManual = 1, + MbbRegisterActionMaximum = ( MbbRegisterActionManual + 1 ) + } MBB_REGISTER_ACTION; + +typedef +enum _MBB_REGISTER_STATE + { + MbbRegisterStateUnknown = 0, + MbbRegisterStateDeregistered = 1, + MbbRegisterStateSearching = 2, + MbbRegisterStateHome = 3, + MbbRegisterStateRoaming = 4, + MbbRegisterStatePartner = 5, + MbbRegisterStateDenied = 6, + MbbRegisterStateMaximum = ( MbbRegisterStateDenied + 1 ) + } MBB_REGISTER_STATE; + +typedef +enum _MBB_REGISTER_MODE + { + MbbRegisterModeUnknown = 0, + MbbRegisterModeAutomatic = 1, + MbbRegisterModeManual = 2, + MbbRegisterModeMaximum = ( MbbRegisterModeManual + 1 ) + } MBB_REGISTER_MODE; + +typedef +enum _MBB_PACKET_SERVICE_ACTION + { + MbbPacketServiceActionAttach = 0, + MbbPacketServiceActionDetach = 1, + MbbPacketServiceActionMaximum = ( MbbPacketServiceActionDetach + 1 ) + } MBB_PACKET_SERVICE_ACTION; + +typedef +enum _MBB_PACKET_SERVICE_STATE + { + MbbPacketServiceStateUnknown = 0, + MbbPacketServiceStateAttaching = 1, + MbbPacketServiceStateAttached = 2, + MbbPacketServiceStateDetaching = 3, + MbbPacketServiceStateDetached = 4, + MbbPacketServiceStateMaximum = ( MbbPacketServiceStateDetached + 1 ) + } MBB_PACKET_SERVICE_STATE; + +typedef +enum _MBB_CONTEXT_IP_TYPE + { + MbbContextIPTypeDefault = 0, + MbbContextIPTypeIPv4 = 1, + MbbContextIPTypeIPv6 = 2, + MbbContextIPTypeIPv4v6 = 3, + MbbContextIPTypeIPv4AndIPv6 = 4, + MbbContextIPTypeMaximum = ( MbbContextIPTypeIPv4AndIPv6 + 1 ) + } MBB_CONTEXT_IP_TYPE; + +typedef +enum _MBB_ACTIVATION_COMMAND + { + MbbActivationCommandDeactivate = 0, + MbbActivationCommandActivate = 1, + MbbActivationCommandCancel = 2, + MbbActivationCommandMaximum = ( MbbActivationCommandCancel + 1 ) + } MBB_ACTIVATION_COMMAND; + +typedef +enum _MBB_COMPRESSION + { + MbbCompressionNone = 0, + MbbCompressionEnable = 1, + MbbCompressionMaximum = ( MbbCompressionEnable + 1 ) + } MBB_COMPRESSION; + +typedef +enum _MBB_AUTH_PROTOCOL + { + MbbAuthProtocolNone = 0, + MbbAuthProtocolPap = 1, + MbbAuthProtocolChap = 2, + MbbAuthProtocolMsChapV2 = 3, + MbbAuthProtocolMaximum = ( MbbAuthProtocolMsChapV2 + 1 ) + } MBB_AUTH_PROTOCOL; + +typedef +enum _MBB_ACTIVATION_STATE + { + MbbActivationStateUnknown = 0, + MbbActivationStateActivated = 1, + MbbActivationStateActivating = 2, + MbbActivationStateDeactivated = 3, + MbbActivationStateDeactivating = 4, + MbbActivationStateMaximum = ( MbbActivationStateDeactivating + 1 ) + } MBB_ACTIVATION_STATE; + +typedef +enum _MBB_VOICE_CALL_STATE + { + MbbVoiceCallStateNone = 0, + MbbVoiceCallStateInProgress = 1, + MbbVoiceCallStateHangUp = 2, + MbbVoiceCallStateMaximum = ( MbbVoiceCallStateHangUp + 1 ) + } MBB_VOICE_CALL_STATE; + +typedef +enum _MBB_SMS_FORMAT + { + MbbSmsFormatPdu = 0, + MbbSmsFormatCdma = 1, + MbbSmsFormatMaximum = ( MbbSmsFormatCdma + 1 ) + } MBB_SMS_FORMAT; + +typedef +enum _MBB_SMS_FLAG + { + MbbSmsFlagAll = 0, + MbbSmsFlagIndex = 1, + MbbSmsFlagNew = 2, + MbbSmsFlagOld = 3, + MbbSmsFlagSent = 4, + MbbSmsFlagDraft = 5, + MbbSmsFlagMaximum = ( MbbSmsFlagDraft + 1 ) + } MBB_SMS_FLAG; + +typedef +enum _MBB_SMS_CDMA_LANGUAGE + { + MbbSmsCdmaLanguageUnknown = 0, + MbbSmsCdmaLanguageEnglish = 1, + MbbSmsCdmaLanguageFrench = 2, + MbbSmsCdmaLanguageSpanish = 3, + MbbSmsCdmaLanguageJapanese = 4, + MbbSmsCdmaLanguageKorean = 5, + MbbSmsCdmaLanguageChinese = 6, + MbbSmsCdmaLanguageHebrew = 7, + MbbSmsCdmaLanguageMaximum = ( MbbSmsCdmaLanguageHebrew + 1 ) + } MBB_SMS_CDMA_LANGUAGE; + +typedef +enum _MBB_SMS_CDMA_ENCODING + { + MbbSmsCdmaEncodingOctet = 0, + MbbSmsCdmaEncodingEpm = 1, + MbbSmsCdmaEncoding7BitAscii = 2, + MbbSmsCdmaEncodingIa5 = 3, + MbbSmsCdmaEncodingUnicode = 4, + MbbSmsCdmaEncodingShiftJis = 5, + MbbSmsCdmaEncodingKorean = 6, + MbbSmsCdmaEncodingLatinHebrew = 7, + MbbSmsCdmaEncodingLatin = 8, + MbbSmsCdmaEncodingGsm7Bit = 9, + MbbSmsCdmaEncodingMaximum = ( MbbSmsCdmaEncodingGsm7Bit + 1 ) + } MBB_SMS_CDMA_ENCODING; + +typedef +enum _MBB_SMS_MESSAGE_STATUS + { + MbbSmsMessageStatusNew = 0, + MbbSmsMessageStatusOld = 1, + MbbSmsMessageStatusDraft = 2, + MbbSmsMessageStatusSent = 3, + MbbSmsMessageStatusMaximum = ( MbbSmsMessageStatusSent + 1 ) + } MBB_SMS_MESSAGE_STATUS; + +typedef +enum _MBB_REG_FLAGS_VALUE + { + MbbRegFlagsNone = 0, + MbbRegFlagsNoManualReg = 0x1, + MbbRegFlagsPSAutoAttach = 0x2 + } MBB_REG_FLAGS_VALUE; + +typedef +enum _MBB_SMS_STATUS_FLAGS_VALUE + { + MbbSmsFlagNone = 0, + MbbSmsFlagMessageStoreFull = 1, + MbbSmsFlagNewMessage = 2 + } MBB_SMS_STATUS_FLAGS_VALUE; + +typedef struct _MBB_STRING + { + ULONG Offset; + ULONG Size; + } MBB_STRING; + +typedef struct _MBB_STRING *PMBB_STRING; + +typedef struct _MBB_ARRAY_ELEMENT + { + ULONG Offset; + ULONG Size; + } MBB_ARRAY_ELEMENT; + +typedef struct _MBB_ARRAY_ELEMENT *PMBB_ARRAY_ELEMENT; + +typedef struct _MBB_ARRAY_ELEMENT2 + { + ULONG Size; + ULONG Offset; + } MBB_ARRAY_ELEMENT2; + +typedef struct _MBB_ARRAY_ELEMENT2 *PMBB_ARRAY_ELEMENT2; + +typedef +enum _MBB_DSS_PAYLOAD_SUPPORT + { + MbbDssPayloadNone = 0, + MbbDssPayloadHostToDevice = 0x1, + MbbDssPayloadDeviceToHost = 0x2 + } MBB_DSS_PAYLOAD_SUPPORT; + +typedef +enum _MBB_DSS_LINK_STATE + { + MbbDssLinkDeactivate = 0, + MbbDssLinkActivate = 0x1 + } MBB_DSS_LINK_STATE; + +typedef +enum _MBB_IP_CONFIGURATION_FLAGS_VALUE + { + MbbIpFlagsNone = 0, + MbbIpFlagsAddressAvailable = 0x1, + MbbIpFlagsGatewayAvailable = 0x2, + MbbIpFlagsDnsServerAvailable = 0x4, + MbbIpFlagsMTUAvailable = 0x8 + } MBB_IP_CONFIGURATION_FLAGS_VALUE; + +typedef +enum _MBB_NETWORK_IDLE_HINT_STATE + { + MbbNetworkIdleHintDisabled = 0, + MbbNetworkIdleHintEnabled = 1 + } MBB_NETWORK_IDLE_HINT_STATE; + +typedef +enum _MBB_SAR_BACKOFF_STATE + { + MbbSarBackoffStatusDisabled = 0, + MbbSarBackoffStatusEnabled = 1, + MbbSarBackoffStatusMaximum = ( MbbSarBackoffStatusEnabled + 1 ) + } MBB_SAR_BACKOFF_STATE; + +typedef +enum _MBB_SAR_CONTROL_MODE + { + MbbSarControlModeDevice = 0, + MbbSarControlModeOS = 1, + MbbSarControlModeMaximum = ( MbbSarControlModeOS + 1 ) + } MBB_SAR_CONTROL_MODE; + +typedef +enum _MBB_SAR_WIFI_HARDWARE_INTEGRATION + { + MbbSarWifiHardwareNotIntegrated = 0, + MbbSarWifiHardwareIntegrated = 1, + MbbSarWifiHardwareIntegrationMaximum = ( MbbSarWifiHardwareIntegrated + 1 ) + } MBB_SAR_WIFI_HARDWARE_INTEGRATION; + +typedef +enum _MBB_SAR_TRANSMISSION_STATUS_NOTIFICATION_STATE + { + MbbTransmissionNotificationDisabled = 0, + MbbTransmissionNotificationEnabled = 1, + MbbTransmissionNotificationMaximum = ( MbbTransmissionNotificationEnabled + 1 ) + } MBB_SAR_TRANSMISSION_STATUS_NOTIFICATION_STATE; + +typedef +enum _MBB_SAR_TRANSMISSION_STATUS + { + MbbTransmissionStateInactive = 0, + MbbTransmissionStateActive = 1, + MbbTransmissionStateMaximum = ( MbbTransmissionStateActive + 1 ) + } MBB_SAR_TRANSMISSION_STATUS; + +typedef +enum _MBB_BASICCONNECTEXT_CONTEXT_ROAMING_CONTROL + { + MbbMsContextRoamingControlHomeOnly = 0, + MbbMsContextRoamingControlPartnerOnly = 1, + MbbMsContextRoamingControlNonPartnerOnly = 2, + MbbMsContextRoamingControlHomeAndPartner = 3, + MbbMsContextRoamingControlHomeAndNonPartner = 4, + MbbMsContextRoamingControlPartnerAndNonPartner = 5, + MbbMsContextRoamingControlAllowAll = 6, + MbbMsContextRoamingControlMaximum = ( MbbMsContextRoamingControlAllowAll + 1 ) + } MBB_BASICCONNECTEXT_CONTEXT_ROAMING_CONTROL; + +typedef +enum _MBB_BASICCONNECTEXT_CONTEXT_MEDIA_TYPE + { + MbbMsContextMediaTypeCellularOnly = 0, + MbbMsContextMediaTypeWifiOnly = 1, + MbbMsContextMediaTypeAll = 2, + MbbMsContextMediaTypeMaximum = ( MbbMsContextMediaTypeAll + 1 ) + } MBB_BASICCONNECTEXT_CONTEXT_MEDIA_TYPE; + +typedef +enum _MBB_BASICCONNECTEXT_CONTEXT_ENABLE + { + MbbMsContextDisabled = 0, + MbbMsContextEnabled = 1, + MbbMsContextEnableMaximum = ( MbbMsContextEnabled + 1 ) + } MBB_BASICCONNECTEXT_CONTEXT_ENABLE; + +typedef +enum _MBB_BASICCONNECTEXT_CONTEXT_SOURCE + { + MbbMsContextSourceAdmin = 0, + MbbMsContextSourceUser = 1, + MbbMsContextSourceOperator = 2, + MbbMsContextSourceModem = 3, + MbbMsContextSourceDevice = 4, + MbbMsContextSourceMaximum = ( MbbMsContextSourceDevice + 1 ) + } MBB_BASICCONNECTEXT_CONTEXT_SOURCE; + +typedef +enum _MBB_BASICCONNECTEXT_CONTEXT_OPERATIONS + { + MbbMsContextOperationDefault = 0, + MbbMsContextOperationDelete = 1, + MbbMsContextOperationRestoreFactory = 2, + MbbMsContextOperationMaximum = ( MbbMsContextOperationRestoreFactory + 1 ) + } MBB_BASICCONNECTEXT_CONTEXT_OPERATIONS; + +typedef +enum _MBB_BASICCONNECTEXT_NETWORK_BLACKLIST_STATE + { + MbbMsNetworkBlacklistStateNotActuated = 0, + MbbMsNetworkBlacklistSIMProviderActuated = 1, + MbbMsNetworkBlacklistNetworkProviderActuated = 2, + MbbMsNetworkBlacklistStateMaximum = ( MbbMsNetworkBlacklistNetworkProviderActuated + 1 ) + } MBB_BASICCONNECTEXT_NETWORK_BLACKLIST_STATE; + +typedef +enum _MBB_BASICCONNECTEXT_NETWORK_BLACKLIST_TYPE + { + MbbMsNetworkBlacklistTypeSIM = 0, + MbbMsNetworkBlacklistTypeNetwork = 1, + MbbMsNetworkBlacklistTypeMaximum = ( MbbMsNetworkBlacklistTypeNetwork + 1 ) + } MBB_BASICCONNECTEXT_NETWORK_BLACKLIST_TYPE; + +typedef +enum _MBB_BASICCONNECTEXT_LTEATTACH_ROAMING_CONTROL + { + MbbMsLteAttachContextRoamingControlHome = 0, + MbbMsLteAttachContextRoamingControlPartner = 1, + MbbMsLteAttachContextRoamingControlNonPartner = 2, + MbbMsLteAttachContextRoamingControlMaximum = ( MbbMsLteAttachContextRoamingControlNonPartner + 1 ) + } MBB_BASICCONNECTEXT_LTEATTACH_ROAMING_CONTROL; + +typedef +enum _MBB_BASICCONNECTEXT_LTEATTACH_CONTEXT_OPERATIONS + { + MbbMsLteAttachContextOperationDefault = 0, + MbbMsLteAttachContextOperationRestoreFactory = 1, + MbbMsLteAttachContextOperationMaximum = ( MbbMsLteAttachContextOperationRestoreFactory + 1 ) + } MBB_BASICCONNECTEXT_LTEATTACH_CONTEXT_OPERATIONS; + +typedef +enum _MBB_BASICCONNECTEXT_LTEATTACH_STATE + { + MbbMsLteAttachStateDetached = 0, + MbbMsLteAttachStateAttached = 1, + MbbMsLteAttachStateMaximum = ( MbbMsLteAttachStateAttached + 1 ) + } MBB_BASICCONNECTEXT_LTEATTACH_STATE; + +typedef +enum _MBB_BASICCONNECTEXT_UICCSLOT_STATE + { + MbbMsUiccSlotStateUnknown = 0, + MbbMsUiccSlotStateOffEmpty = 1, + MbbMsUiccSlotStateOff = 2, + MbbMsUiccSlotStateEmpty = 3, + MbbMsUiccSlotStateNotReady = 4, + MbbMsUiccSlotStateActive = 5, + MbbMsUiccSlotStateError = 6, + MbbMsUiccSlotStateActiveEsim = 7, + MbbMsUiccSlotStateActiveEsimNoProfiles = 8 + } MBB_BASICCONNECTEXT_UICCSLOT_STATE; + +typedef +enum _MBB_BASICCONNECTEXT_MODEM_LOGGING_LEVEL_CONFIG + { + MbbMsModemLoggingLevelProd = 0, + MbbMsModemLoggingLevelLabVerbose = 1, + MbbMsModemLoggingLevelLabMedium = 2, + MbbMsModemLoggingLevelLabLow = 3, + MbbMsModemLoggingLevelOem = 4, + MbbMsModemLoggingLevelMaximum = ( MbbMsModemLoggingLevelOem + 1 ) + } MBB_BASICCONNECTEXT_MODEM_LOGGING_LEVEL_CONFIG; + +typedef +enum _MBB_PCO_TYPE + { + MbbPcoTypeComplete = 0, + MbbPcoTypePartial = 1, + MbbPcoTypeMaximum = ( MbbPcoTypePartial + 1 ) + } MBB_PCO_TYPE; + +typedef struct _MBB_DEVICE_CAPS + { + MBB_DEVICE_TYPE DeviceType; + MBB_CELLULAR_CLASS CellularClass; + MBB_VOICE_CLASS VoiceClass; + MBB_SIM_CLASS SimClass; + ULONG DataClass; + ULONG SmsCaps; + ULONG ControlCaps; + ULONG dwMaxSessions; + MBB_STRING CustomDataClass; + MBB_STRING DeviceIdString; + MBB_STRING FirmwareInfo; + MBB_STRING HardwareInfo; + UCHAR DataBuffer[ 1 ]; + } MBB_DEVICE_CAPS; + +typedef struct _MBB_DEVICE_CAPS *PMBB_DEVICE_CAPS; + +typedef struct _MBB_SUBSCRIBER_READY_INFO + { + MBB_READY_STATE ReadyState; + MBB_STRING SubscriberId; + MBB_STRING SimIccId; + MBB_READY_INFO_FLAGS ReadyInfoFlags; + ULONG TelephoneNumberCount; + MBB_STRING TelephoneNumbers[ 1 ]; + } MBB_SUBSCRIBER_READY_INFO; + +typedef struct _MBB_SUBSCRIBER_READY_INFO *PMBB_SUBSCRIBER_READY_INFO; + +typedef +enum _MBB_SUBSCRIBER_READY_STATUS_FLAGS + { + MbbSubscriberReadyStatusFlagNone = 0, + MbbSubscriberReadyStatusFlagESim = 0x1, + MbbSubscriberReadyStatusFlagSIMRemovabilityKnown = 0x2, + MbbSubscriberReadyStatusFlagSIMRemovable = 0x4 + } MBB_SUBSCRIBER_READY_STATUS_FLAGS; + +typedef struct _MBB_SUBSCRIBER_READY_INFO_EX3 + { + MBB_READY_STATE ReadyState; + MBB_SUBSCRIBER_READY_STATUS_FLAGS StatusFlags; + MBB_STRING SubscriberId; + MBB_STRING SimIccId; + MBB_READY_INFO_FLAGS ReadyInfoFlags; + ULONG TelephoneNumberCount; + MBB_STRING TelephoneNumbers[ 1 ]; + } MBB_SUBSCRIBER_READY_INFO_EX3; + +typedef struct _MBB_SUBSCRIBER_READY_INFO_EX3 *PMBB_SUBSCRIBER_READY_INFO_EX3; + +typedef struct _MBB_QUERY_RADIO_STATE + { + MBB_RADIO_STATE HwRadioState; + MBB_RADIO_STATE SwRadioState; + } MBB_QUERY_RADIO_STATE; + +typedef struct _MBB_QUERY_RADIO_STATE *PMBB_QUERY_RADIO_STATE; + +typedef struct _MBB_PIN_INFO + { + MBB_PIN_TYPE PinType; + MBB_PIN_STATE PinState; + ULONG AttemptsRemaining; + } MBB_PIN_INFO; + +typedef struct _MBB_PIN_INFO *PMBB_PIN_INFO; + +typedef struct _MBB_PIN_ACTION + { + MBB_PIN_TYPE PinType; + MBB_PIN_OPERATION PinOperation; + MBB_STRING Pin; + MBB_STRING NewPin; + UCHAR DataBuffer[ 1 ]; + } MBB_PIN_ACTION; + +typedef struct _MBB_PIN_ACTION *PMBB_PIN_ACTION; + +typedef struct _MBB_PIN_DESCRIPTION + { + MBB_PIN_MODE PinMode; + MBB_PIN_FORMAT PinFormat; + ULONG PinLengthMin; + ULONG PinLengthMax; + } MBB_PIN_DESCRIPTION; + +typedef struct _MBB_PIN_DESCRIPTION *PMBB_PIN_DESCRIPTION; + +typedef struct _MBB_PIN_LIST + { + MBB_PIN_DESCRIPTION PinDescPin1; + MBB_PIN_DESCRIPTION PinDescPin2; + MBB_PIN_DESCRIPTION PinDescDeviceSimPin; + MBB_PIN_DESCRIPTION PinDescDeviceFirstSimPin; + MBB_PIN_DESCRIPTION PinDescNetworkPin; + MBB_PIN_DESCRIPTION PinDescNetworkSubsetPin; + MBB_PIN_DESCRIPTION PinDescSvcProviderPin; + MBB_PIN_DESCRIPTION PinDescCorporatePin; + MBB_PIN_DESCRIPTION PinDescSubsidyLock; + MBB_PIN_DESCRIPTION PinDescCustom; + } MBB_PIN_LIST; + +typedef struct _MBB_PIN_LIST *PMBB_PIN_LIST; + +typedef struct _MBB_PROVIDER + { + MBB_STRING ProviderId; + ULONG ProviderState; + MBB_STRING ProviderName; + MBB_CELLULAR_CLASS CellularClass; + ULONG Rssi; + ULONG ErrorRate; + } MBB_PROVIDER; + +typedef struct _MBB_PROVIDER *PMBB_PROVIDER; + +typedef struct _MBB_PROVIDER_LIST + { + ULONG ProviderCount; + MBB_ARRAY_ELEMENT Providers[ 1 ]; + } MBB_PROVIDER_LIST; + +typedef struct _MBB_PROVIDER_LIST *PMBB_PROVIDER_LIST; + +typedef struct _MBB_REGISTRATION_STATE + { + ULONG NetworkError; + MBB_REGISTER_STATE RegisterState; + MBB_REGISTER_MODE RegisterMode; + ULONG AvailableDataClasses; + MBB_CELLULAR_CLASS CurrentCellularClass; + MBB_STRING ProviderId; + MBB_STRING ProviderName; + MBB_STRING RoamingText; + ULONG RegFlags; + UCHAR DataBuffer[ 1 ]; + } MBB_REGISTRATION_STATE; + +typedef struct _MBB_REGISTRATION_STATE *PMBB_REGISTRATION_STATE; + +typedef struct _MBB_SET_REGISTER_STATE + { + MBB_STRING ProviderId; + MBB_REGISTER_ACTION RegisterAction; + ULONG DataClass; + UCHAR DataBuffer[ 1 ]; + } MBB_SET_REGISTER_STATE; + +typedef struct _MBB_SET_REGISTER_STATE *PMBB_SET_REGISTER_STATE; + +typedef struct _MBB_SET_PACKET_SERVICE + { + MBB_PACKET_SERVICE_ACTION PacketServiceAction; + } MBB_SET_PACKET_SERVICE; + +typedef struct _MBB_SET_PACKET_SERVICE *PMBB_SET_PACKET_SERVICE; + +typedef struct _MBB_PACKET_SERVICE + { + ULONG NetworkError; + MBB_PACKET_SERVICE_STATE PacketServiceState; + ULONG HighestAvailableDataClass; + ULONGLONG UplinkSpeed; + ULONGLONG DownlinkSpeed; + } MBB_PACKET_SERVICE; + +typedef struct _MBB_PACKET_SERVICE *PMBB_PACKET_SERVICE; + +typedef struct _MBB_PACKET_SERVICE_INFO_V2 + { + ULONG NetworkError; + MBB_PACKET_SERVICE_STATE PacketServiceState; + MBB_DATA_CLASS_VALUE CurrentDataClass; + ULONGLONG UplinkSpeed; + ULONGLONG DownlinkSpeed; + MBB_FREQUENCY_RANGE FrequencyRange; + } MBB_PACKET_SERVICE_INFO_V2; + +typedef struct _MBB_PACKET_SERVICE_INFO_V2 *PMBB_PACKET_SERVICE_INFO_V2; + +typedef struct _MBB_PLMN + { + USHORT Mcc; + USHORT Mnc; + } MBB_PLMN; + +typedef struct _MBB_PLMN *PMBB_PLMN; + +typedef struct _MBB_TAI + { + MBB_PLMN Plmn; + ULONG Tac; + } MBB_TAI; + +typedef struct _MBB_TAI *PMBB_TAI; + +typedef struct _MBB_PACKET_SERVICE_INFO_V3 + { + ULONG NetworkError; + MBB_PACKET_SERVICE_STATE PacketServiceState; + MBB_DATA_CLASS_VALUE CurrentDataClass; + ULONGLONG UplinkSpeed; + ULONGLONG DownlinkSpeed; + MBB_FREQUENCY_RANGE FrequencyRange; + MBB_DATA_SUBCLASS_VALUE CurrentDataSubClass; + MBB_TAI TrackingAreaId; + } MBB_PACKET_SERVICE_INFO_V3; + +typedef struct _MBB_PACKET_SERVICE_INFO_V3 *PMBB_PACKET_SERVICE_INFO_V3; + +typedef struct _MBB_SET_SIGNAL_INDICATION + { + ULONG RssiInterval; + ULONG RssiThreshold; + ULONG ErrorRateThreshold; + } MBB_SET_SIGNAL_INDICATION; + +typedef struct _MBB_SET_SIGNAL_INDICATION *PMBB_SET_SIGNAL_INDICATION; + +typedef struct _MBB_SIGNAL_STATE + { + ULONG Rssi; + ULONG ErrorRate; + ULONG RssiInterval; + ULONG RssiThreshold; + ULONG ErrorRateThreshold; + } MBB_SIGNAL_STATE; + +typedef struct _MBB_SIGNAL_STATE *PMBB_SIGNAL_STATE; + +typedef struct _MBB_SET_CONTEXT_STATE + { + ULONG SessionId; + MBB_ACTIVATION_COMMAND ActivationCommand; + MBB_STRING AccessString; + MBB_STRING UserName; + MBB_STRING Password; + MBB_COMPRESSION Compression; + MBB_AUTH_PROTOCOL AuthProtocol; + MBB_CONTEXT_IP_TYPE IPType; + GUID ContextType; + CHAR DataBuffer[ 1 ]; + } MBB_SET_CONTEXT_STATE; + +typedef struct _MBB_SET_CONTEXT_STATE *PMBB_SET_CONTEXT_STATE; + +typedef +enum _MBB_ACCESS_MEDIA_PREF + { + MbbAccessMediaPrefNone = 0, + MbbAccessMediaPref3GPP = 1, + MbbAccessMediaPref3GPPPreferred = 2, + MbbAccessMediaPrefMaximum = ( MbbAccessMediaPref3GPPPreferred + 1 ) + } MBB_ACCESS_MEDIA_PREF; + +typedef struct _MBB_SET_CONTEXT_STATE_EX3 + { + ULONG SessionId; + MBB_ACTIVATION_COMMAND ActivationCommand; + MBB_COMPRESSION Compression; + MBB_AUTH_PROTOCOL AuthProtocol; + MBB_CONTEXT_IP_TYPE IPType; + GUID ContextType; + MBB_ACCESS_MEDIA_PREF MediaPreference; + } MBB_SET_CONTEXT_STATE_EX3; + +typedef struct _MBB_SET_CONTEXT_STATE_EX3 *PMBB_SET_CONTEXT_STATE_EX3; + +typedef struct _MBB_QUERY_CONTEXT_EX3 + { + ULONG SessionId; + } MBB_QUERY_CONTEXT_EX3; + +typedef struct _MBB_QUERY_CONTEXT_EX3 *PMBB_QUERY_CONTEXT_EX3; + +typedef struct _MBB_CONTEXT_STATE + { + ULONG SessionId; + MBB_ACTIVATION_STATE ActivationState; + MBB_VOICE_CALL_STATE VoiceCallState; + MBB_CONTEXT_IP_TYPE IPType; + GUID ContextType; + ULONG NetworkError; + } MBB_CONTEXT_STATE; + +typedef struct _MBB_CONTEXT_STATE *PMBB_CONTEXT_STATE; + +typedef struct _MBB_CONTEXT_STATE_EX3 + { + ULONG SessionId; + MBB_ACTIVATION_STATE ActivationState; + MBB_VOICE_CALL_STATE VoiceCallState; + MBB_CONTEXT_IP_TYPE IPType; + GUID ContextType; + ULONG NetworkError; + MBB_ACCESS_MEDIA_PREF MediaPreference; + } MBB_CONTEXT_STATE_EX3; + +typedef struct _MBB_CONTEXT_STATE_EX3 *PMBB_CONTEXT_STATE_EX3; + +typedef struct _MBB_SET_CONTEXT + { + ULONG ContextId; + GUID ContextType; + MBB_STRING AccessString; + MBB_STRING UserName; + MBB_STRING Password; + MBB_COMPRESSION Compression; + MBB_AUTH_PROTOCOL AuthProtocol; + MBB_STRING ProviderId; + UCHAR DataBuffer[ 1 ]; + } MBB_SET_CONTEXT; + +typedef struct _MBB_SET_CONTEXT *PMBB_SET_CONTEXT; + +typedef struct _MBB_CONTEXT + { + ULONG ContextId; + GUID ContextType; + MBB_STRING AccessString; + MBB_STRING UserName; + MBB_STRING Password; + MBB_COMPRESSION Compression; + MBB_AUTH_PROTOCOL AuthProtocol; + UCHAR DataBuffer[ 1 ]; + } MBB_CONTEXT; + +typedef struct _MBB_CONTEXT *PMBB_CONTEXT; + +typedef struct _MBB_CONTEXT_LIST + { + ULONG ContextCount; + MBB_ARRAY_ELEMENT Contexts[ 1 ]; + } MBB_CONTEXT_LIST; + +typedef struct _MBB_CONTEXT_LIST *PMBB_CONTEXT_LIST; + +typedef struct _MBB_SERVICE_ACTIVATION + { + CHAR VendorSpecificBuffer[ 1 ]; + } MBB_SERVICE_ACTIVATION; + +typedef struct _MBB_SERVICE_ACTIVATION *PMBB_SERVICE_ACTIVATION; + +typedef struct _MBB_SERVICE_ACTIVATION_STATUS + { + ULONG NetworkError; + CHAR VendorSpecificBuffer[ 1 ]; + } MBB_SERVICE_ACTIVATION_STATUS; + +typedef struct _MBB_SERVICE_ACTIVATION_STATUS *PMBB_SERVICE_ACTIVATION_STATUS; + +typedef struct _MBB_IPV4_ADDRESS + { + ULONG OnLinkPrefixLength; + UCHAR IPV4Address[ 4 ]; + } MBB_IPV4_ADDRESS; + +typedef struct _MBB_IPV4_ADDRESS *PMBB_IPV4_ADDRESS; + +typedef struct _MBB_IPV6_ADDRESS + { + ULONG OnLinkPrefixLength; + UCHAR IPV6Address[ 16 ]; + } MBB_IPV6_ADDRESS; + +typedef struct _MBB_IPV6_ADDRESS *PMBB_IPV6_ADDRESS; + +typedef struct _MBB_IP_ADDRESS_INFO + { + ULONG SessionId; + ULONG IPv4Flags; + ULONG IPv6Flags; + ULONG IPv4AddressCount; + ULONG IPv4AddressOffset; + ULONG IPv6AddressCount; + ULONG IPv6AddressOffset; + ULONG IPv4GatewayOffset; + ULONG IPv6GatewayOffset; + ULONG IPv4DnsServerCount; + ULONG IPv4DnsServerOffset; + ULONG IPv6DnsServerCount; + ULONG IPv6DnsServerOffset; + ULONG IPv4MTU; + ULONG IPv6MTU; + } MBB_IP_ADDRESS_INFO; + +typedef struct _MBB_IP_ADDRESS_INFO *PMBB_IP_ADDRESS_INFO; + +typedef struct _MBB_PACKET_STATISTICS + { + ULONG InDiscards; + ULONG InErrors; + ULONGLONG InOctets; + ULONGLONG InPackets; + ULONGLONG OutOctets; + ULONGLONG OutPackets; + ULONG OutErrors; + ULONG OutDiscards; + } MBB_PACKET_STATISTICS; + +typedef struct _MBB_PACKET_STATISTICS *PMBB_PACKET_STATISTICS; + +typedef +enum _MBB_VISIBLE_PROVIDERS_ACTION_VALUE + { + MbbVisibleProvidersActionFull = 0, + MbbVisibleProvidersActionMulticarrier = 0x1, + MbbVisibleProvidersActionMax = ( MbbVisibleProvidersActionMulticarrier + 1 ) + } MBB_VISIBLE_PROVIDERS_ACTION_VALUE; + +typedef struct _MBB_GET_VISIBLE_PROVIDERS + { + ULONG Action; + } MBB_GET_VISIBLE_PROVIDERS; + +typedef struct _MBB_GET_VISIBLE_PROVIDERS *PMBB_GET_VISIBLE_PROVIDERS; + +typedef +enum _MBB_SMS_STORAGE_STATE + { + MbbSmsStorageNotInitialized = 0, + MbbSmsStorageInitialized = 1 + } MBB_SMS_STORAGE_STATE; + +typedef struct _MBB_SET_SMS_CONFIGURATION + { + MBB_SMS_FORMAT SmsFormat; + MBB_STRING ScAddress; + UCHAR DataBuffer[ 1 ]; + } MBB_SET_SMS_CONFIGURATION; + +typedef struct _MBB_SET_SMS_CONFIGURATION *PMBB_SET_SMS_CONFIGURATION; + +typedef struct _MBB_SMS_CONFIGURATION + { + MBB_SMS_STORAGE_STATE SmsStorageState; + MBB_SMS_FORMAT SmsFormat; + ULONG MaxMessages; + ULONG CdmaShortMessageSize; + MBB_STRING ScAddress; + UCHAR DataBuffer[ 1 ]; + } MBB_SMS_CONFIGURATION; + +typedef struct _MBB_SMS_CONFIGURATION *PMBB_SMS_CONFIGURATION; + +typedef struct _MBB_SMS_READ + { + MBB_SMS_FORMAT SmsFormat; + MBB_SMS_FLAG SmsFlag; + ULONG MessageIndex; + } MBB_SMS_READ; + +typedef struct _MBB_SMS_READ *PMBB_SMS_READ; + +typedef struct _MBB_SMS_CDMA_RECORD + { + ULONG MessageIndex; + MBB_SMS_MESSAGE_STATUS MessageStatus; + MBB_STRING Address; + MBB_STRING TimeStamp; + MBB_SMS_CDMA_ENCODING EncodingId; + MBB_SMS_CDMA_LANGUAGE LanguageId; + MBB_ARRAY_ELEMENT EncodedMessage; + ULONG SizeInCharacters; + UCHAR DataBuffer[ 1 ]; + } MBB_SMS_CDMA_RECORD; + +typedef struct _MBB_SMS_CDMA_RECORD *PMBB_SMS_CDMA_RECORD; + +typedef struct _MBB_SMS_PDU_RECORD + { + ULONG MessageIndex; + MBB_SMS_MESSAGE_STATUS MessageStatus; + MBB_ARRAY_ELEMENT PduData; + UCHAR DataBuffer[ 1 ]; + } MBB_SMS_PDU_RECORD; + +typedef struct _MBB_SMS_PDU_RECORD *PMBB_SMS_PDU_RECORD; + +typedef struct _MBB_SMS_RECEIVE + { + MBB_SMS_FORMAT SmsFormat; + ULONG MessageCount; + MBB_ARRAY_ELEMENT MessageElement[ 1 ]; + } MBB_SMS_RECEIVE; + +typedef struct _MBB_SMS_RECEIVE *PMBB_SMS_RECEIVE; + +typedef struct _MBB_SMS_SEND_PDU + { + MBB_ARRAY_ELEMENT PduData; + UCHAR DataBuffer[ 1 ]; + } MBB_SMS_SEND_PDU; + +typedef struct _MBB_SMS_SEND_PDU *PMBB_SMS_SEND_PDU; + +typedef struct _MBB_SMS_SEND_CDMA + { + MBB_SMS_CDMA_ENCODING EncodingId; + MBB_SMS_CDMA_LANGUAGE LanguageId; + MBB_STRING Address; + MBB_ARRAY_ELEMENT EncodedMessage; + ULONG SizeInCharacters; + UCHAR DataBuffer[ 1 ]; + } MBB_SMS_SEND_CDMA; + +typedef struct _MBB_SMS_SEND_CDMA *PMBB_SMS_SEND_CDMA; + +typedef struct _MBB_SMS_SEND + { + MBB_SMS_FORMAT SmsFormat; + /* [switch_is] */ /* [switch_type] */ union __MIDL___MIDL_itf_MbbMessages_0000_0000_0001 + { + /* [case()] */ MBB_SMS_SEND_PDU Pdu; + /* [case()] */ MBB_SMS_SEND_CDMA Cdma; + } u; + } MBB_SMS_SEND; + +typedef struct _MBB_SMS_SEND *PMBB_SMS_SEND; + +typedef struct _MBB_SMS_SEND_STATUS + { + ULONG MessageReference; + } MBB_SMS_SEND_STATUS; + +typedef struct _MBB_SMS_SEND_STATUS *PMBB_SMS_SEND_STATUS; + +typedef struct _MBB_SMS_DELETE + { + MBB_SMS_FLAG SmsFlags; + ULONG MessageIndex; + } MBB_SMS_DELETE; + +typedef struct _MBB_SMS_DELETE *PMBB_SMS_DELETE; + +typedef struct _MBB_SMS_STATUS + { + ULONG StatusFlags; + ULONG MessageIndex; + } MBB_SMS_STATUS; + +typedef struct _MBB_SMS_STATUS *PMBB_SMS_STATUS; + +typedef +enum _MBB_USSD_ACTION + { + MbbUSSDInitiate = 0, + MbbUSSDContinue = 1, + MbbUSSDCancel = 2 + } MBB_USSD_ACTION; + +typedef +enum _MBB_USSD_RESPONSE + { + MbbUSSDNoActionRequired = 0, + MbbUSSDActionRequired = 1, + MbbUSSDTerminated = 2, + MbbUSSDOtherLocalClient = 3, + MbbUSSDOperationNotSupported = 4, + MbbUSSDNetworkTimeOut = 5 + } MBB_USSD_RESPONSE; + +typedef +enum _MBB_USSD_SESSION_STATE + { + MbbUSSDNewSession = 0, + MbbUSSDExistingSession = 1 + } MBB_USSD_SESSION_STATE; + +typedef struct _MBB_SET_USSD + { + MBB_USSD_ACTION USSDAction; + ULONG USSDDataCodingScheme; + MBB_ARRAY_ELEMENT USSDPayload; + UCHAR DataBuffer[ 1 ]; + } MBB_SET_USSD; + +typedef struct _MBB_SET_USSD *PMBB_SET_USSD; + +typedef struct _MBB_USSD + { + MBB_USSD_RESPONSE USSDResponse; + MBB_USSD_SESSION_STATE USSDSessionState; + ULONG USSDDataCodingScheme; + MBB_ARRAY_ELEMENT USSDPayload; + UCHAR DataBuffer[ 1 ]; + } MBB_USSD; + +typedef struct _MBB_USSD *PMBB_USSD; + +typedef struct _MBB_AKA_AUTH_CHALLENGE + { + UCHAR Rand[ 16 ]; + UCHAR Autn[ 16 ]; + } MBB_AKA_AUTH_CHALLENGE; + +typedef struct _MBB_AKA_AUTH_CHALLENGE *PMBB_AKA_AUTH_CHALLENGE; + +typedef struct _MBB_AKA_AUTH_RESPONSE + { + UCHAR Res[ 16 ]; + ULONG ResLength; + UCHAR IK[ 16 ]; + UCHAR CK[ 16 ]; + UCHAR Auts[ 14 ]; + } MBB_AKA_AUTH_RESPONSE; + +typedef struct _MBB_AKA_AUTH_RESPONSE *PMBB_AKA_AUTH_RESPONSE; + +typedef struct _MBB_AKAP_AUTH_CHALLENGE + { + UCHAR Rand[ 16 ]; + UCHAR Autn[ 16 ]; + MBB_STRING NetworkName; + UCHAR DataBuffer[ 1 ]; + } MBB_AKAP_AUTH_CHALLENGE; + +typedef struct _MBB_AKAP_AUTH_CHALLENGE *PMBB_AKAP_AUTH_CHALLENGE; + +typedef struct _MBB_AKAP_AUTH_RESPONSE + { + UCHAR Res[ 16 ]; + ULONG ResLength; + UCHAR IK[ 16 ]; + UCHAR CK[ 16 ]; + UCHAR Auts[ 14 ]; + } MBB_AKAP_AUTH_RESPONSE; + +typedef struct _MBB_AKAP_AUTH_RESPONSE *PMBB_AKAP_AUTH_RESPONSE; + +typedef struct _MBB_SIM_AUTH_CHALLENGE + { + UCHAR Rand1[ 16 ]; + UCHAR Rand2[ 16 ]; + UCHAR Rand3[ 16 ]; + ULONG n; + } MBB_SIM_AUTH_CHALLENGE; + +typedef struct _MBB_SIM_AUTH_CHALLENGE *PMBB_SIM_AUTH_CHALLENGE; + +typedef struct _MBB_SIM_AUTH_RESPONSE + { + UCHAR Sres1[ 4 ]; + UCHAR Kc1[ 8 ]; + UCHAR Sres2[ 4 ]; + UCHAR Kc2[ 8 ]; + UCHAR Sres3[ 4 ]; + UCHAR Kc3[ 8 ]; + ULONG n; + } MBB_SIM_AUTH_RESPONSE; + +typedef struct _MBB_SIM_AUTH_RESPONSE *PMBB_SIM_AUTH_RESPONSE; + +typedef struct _MBB_PACKET_FILTERS + { + ULONG SessionId; + ULONG PacketFiltersCount; + MBB_ARRAY_ELEMENT ArrayElement[ 1 ]; + } MBB_PACKET_FILTERS; + +typedef struct _MBB_PACKET_FILTERS *PMBB_PACKET_FILTERS; + +typedef struct _MBB_SINGLE_PACKET_FILTER + { + ULONG FilterSize; + ULONG PacketFilterOffset; + ULONG PacketMaskOffset; + UCHAR DataBuffer[ 1 ]; + } MBB_SINGLE_PACKET_FILTER; + +typedef struct _MBB_SINGLE_PACKET_FILTER *PMBB_SINGLE_PACKET_FILTER; + +typedef struct _MBB_SINGLE_PACKET_FILTER_V2 + { + ULONG FilterSize; + ULONG PacketFilterOffset; + ULONG PacketMaskOffset; + ULONG FilterId; + UCHAR DataBuffer[ 1 ]; + } MBB_SINGLE_PACKET_FILTER_V2; + +typedef struct _MBB_SINGLE_PACKET_FILTER_V2 *PMBB_SINGLE_PACKET_FILTER_V2; + +typedef struct _MBB_NETWORK_IDLE_HINT + { + MBB_NETWORK_IDLE_HINT_STATE NetworkIdleHintState; + } MBB_NETWORK_IDLE_HINT; + +typedef struct _MBB_NETWORK_IDLE_HINT *PMBB_NETWORK_IDLE_HINT; + +typedef struct _MBB_DEVICE_SERVICE_ELEMENT + { + GUID DeviceServiceId; + MBB_DSS_PAYLOAD_SUPPORT DSSPayload; + ULONG MaxDSSInstances; + ULONG CIDCount; + ULONG CIDList[ 1 ]; + } MBB_DEVICE_SERVICE_ELEMENT; + +typedef struct _MBB_DEVICE_SERVICE_ELEMENT *PMBB_DEVICE_SERVICE_ELEMENT; + +typedef struct _MBB_DEVICE_SERVICES_HEADER + { + ULONG DeviceServicesCount; + ULONG MaxDSSSessions; + MBB_ARRAY_ELEMENT ArrayElement[ 1 ]; + } MBB_DEVICE_SERVICES_HEADER; + +typedef struct _MBB_DEVICE_SERVICES_HEADER *PMBB_DEVICE_SERVICES_HEADER; + +typedef struct _MBB_SUBSCRIBE_EVENT_ENTRY + { + GUID DeviceServiceId; + ULONG CIDCount; + ULONG CIDList[ 1 ]; + } MBB_SUBSCRIBE_EVENT_ENTRY; + +typedef struct _MBB_SUBSCRIBE_EVENT_ENTRY *PMBB_SUBSCRIBE_EVENT_ENTRY; + +typedef struct _MBB_SUBSCRIBE_EVENT_LIST + { + ULONG Count; + MBB_ARRAY_ELEMENT ArrayElement[ 1 ]; + } MBB_SUBSCRIBE_EVENT_LIST; + +typedef struct _MBB_SUBSCRIBE_EVENT_LIST *PMBB_SUBSCRIBE_EVENT_LIST; + +typedef struct _MBB_SET_DSS_CONNECT + { + GUID DeviceServiceId; + ULONG DssSessionId; + MBB_DSS_LINK_STATE DssLinkState; + } MBB_SET_DSS_CONNECT; + +typedef struct _MBB_SET_DSS_CONNECT *PMBB_SET_DSS_CONNECT; + +typedef struct _MBB_SET_DSS_CLOSE + { + ULONG DssSessionId; + } MBB_SET_DSS_CLOSE; + +typedef struct _MBB_SET_DSS_CLOSE *PMBB_SET_DSS_CLOSE; + +typedef struct _MBB_MULTICARRIER_CURRENT_CID_LIST + { + ULONG CIDCount; + ULONG CIDList[ 1 ]; + } MBB_MULTICARRIER_CURRENT_CID_LIST; + +typedef struct _MBB_MULTICARRIER_CURRENT_CID_LIST *PMBB_MULTICARRIER_CURRENT_CID_LIST; + +typedef +enum _MBB_UICC_APP_TYPE + { + MbbUiccAppTypeUnknown = 0, + MbbUiccAppTypeMf = 1, + MbbUiccAppTypeMfSIM = 2, + MbbUiccAppTypeMfRUIM = 3, + MbbUiccAppTypeUSIM = 4, + MbbUiccAppTypeCSIM = 5, + MbbUiccAppTypeISIM = 6, + MbbUiccAppTypeMax = ( MbbUiccAppTypeISIM + 1 ) + } MBB_UICC_APP_TYPE; + +typedef struct _MBB_UICC_APP_INFO + { + MBB_UICC_APP_TYPE AppType; + MBB_ARRAY_ELEMENT AppId; + MBB_ARRAY_ELEMENT AppName; + ULONG NumPins; + MBB_ARRAY_ELEMENT PinRef; + UCHAR DataBuffer[ 1 ]; + } MBB_UICC_APP_INFO; + +typedef struct _MBB_UICC_APP_INFO *PMBB_UICC_APP_INFO; + +typedef struct _MBB_UICC_APP_LIST + { + ULONG Version; + ULONG AppCount; + ULONG ActiveAppIndex; + ULONG AppListSize; + MBB_ARRAY_ELEMENT DataBuffer[ 1 ]; + } MBB_UICC_APP_LIST; + +typedef struct _MBB_UICC_APP_LIST *PMBB_UICC_APP_LIST; + +typedef +enum _MBB_UICC_FILE_ACCESSIBILITY + { + MbbUiccFileAccessibilityUnknown = 0, + MbbUiccFileAccessibilityNotShareable = 1, + MbbUiccFileAccessibilityShareable = 2, + MbbUiccFileAccessibilityMax = ( MbbUiccFileAccessibilityShareable + 1 ) + } MBB_UICC_FILE_ACCESSIBILITY; + +typedef +enum _MBB_UICC_FILE_TYPE + { + MbbUiccFileTypeUnknown = 0, + MbbUiccFileTypeWorkingEf = 1, + MbbUiccFileTypeInternalEf = 2, + MbbUiccFileTypeDfOrAdf = 3, + MbbUiccFileTypeMax = ( MbbUiccFileTypeDfOrAdf + 1 ) + } MBB_UICC_FILE_TYPE; + +typedef +enum _MBB_UICC_FILE_STRUCTURE + { + MbbUiccFileStructureUnknown = 0, + MbbUiccFileStructureTransparent = 1, + MbbUiccFileStructureCyclic = 2, + MbbUiccFileStructureLinear = 3, + MbbUiccFileStructureBertlv = 4, + MbbUiccFileStructureMax = ( MbbUiccFileStructureBertlv + 1 ) + } MBB_UICC_FILE_STRUCTURE; + +typedef struct _MBB_UICC_FILE_PATH + { + ULONG Version; + MBB_ARRAY_ELEMENT AppId; + MBB_ARRAY_ELEMENT FilePath; + UCHAR DataBuffer[ 1 ]; + } MBB_UICC_FILE_PATH; + +typedef struct _MBB_UICC_FILE_PATH *PMBB_UICC_FILE_PATH; + +typedef struct _MBB_UICC_FILE_STATUS + { + ULONG Version; + ULONG StatusWord1; + ULONG StatusWord2; + MBB_UICC_FILE_ACCESSIBILITY FileAccessibility; + MBB_UICC_FILE_TYPE FileType; + MBB_UICC_FILE_STRUCTURE FileStructure; + ULONG ItemCount; + ULONG ItemSize; + MBB_PIN_TYPE FileLockStatus[ 4 ]; + } MBB_UICC_FILE_STATUS; + +typedef struct _MBB_UICC_FILE_STATUS *PMBB_UICC_FILE_STATUS; + +typedef struct _MBB_UICC_ACCESS_BINARY + { + ULONG Version; + MBB_ARRAY_ELEMENT AppId; + MBB_ARRAY_ELEMENT UiccFilePath; + ULONG FileOffset; + ULONG NumberOfBytes; + MBB_ARRAY_ELEMENT LocalPin; + MBB_ARRAY_ELEMENT BinaryData; + UCHAR DataBuffer[ 1 ]; + } MBB_UICC_ACCESS_BINARY; + +typedef struct _MBB_UICC_ACCESS_BINARY *PMBB_UICC_ACCESS_BINARY; + +typedef struct _MBB_UICC_ACCESS_RECORD + { + ULONG Version; + MBB_ARRAY_ELEMENT AppId; + MBB_ARRAY_ELEMENT UiccFilePath; + ULONG RecordNumber; + MBB_ARRAY_ELEMENT LocalPin; + MBB_ARRAY_ELEMENT RecordData; + UCHAR DataBuffer[ 1 ]; + } MBB_UICC_ACCESS_RECORD; + +typedef struct _MBB_UICC_ACCESS_RECORD *PMBB_UICC_ACCESS_RECORD; + +typedef struct _MBB_UICC_RESPONSE + { + ULONG Version; + ULONG StatusWord1; + ULONG StatusWord2; + MBB_ARRAY_ELEMENT ResponseData; + UCHAR DataBuffer[ 1 ]; + } MBB_UICC_RESPONSE; + +typedef struct _MBB_UICC_RESPONSE *PMBB_UICC_RESPONSE; + +typedef struct _MBB_PIN_APP + { + ULONG Version; + MBB_ARRAY_ELEMENT AppId; + UCHAR DataBuffer[ 1 ]; + } MBB_PIN_APP; + +typedef struct _MBB_PIN_APP *PMBB_PIN_APP; + +typedef struct _MBB_PIN_ACTION_EX2 + { + MBB_PIN_TYPE PinType; + MBB_PIN_OPERATION PinOperation; + MBB_STRING Pin; + MBB_STRING NewPin; + MBB_ARRAY_ELEMENT AppId; + UCHAR DataBuffer[ 1 ]; + } MBB_PIN_ACTION_EX2; + +typedef struct _MBB_PIN_ACTION_EX2 *PMBB_PIN_ACTION_EX2; + +typedef struct _MBB_SYS_CAPS_INFO + { + ULONG NumberOfExecutors; + ULONG NumberOfSlots; + ULONG Concurrency; + } MBB_SYS_CAPS_INFO; + +typedef struct _MBB_SYS_CAPS_INFO *PMBB_SYS_CAPS_INFO; + +typedef struct _MBB_DEVICE_CAPS_V2 + { + MBB_DEVICE_TYPE DeviceType; + MBB_CELLULAR_CLASS CellularClass; + MBB_VOICE_CLASS VoiceClass; + MBB_SIM_CLASS SimClass; + ULONG DataClass; + ULONG SmsCaps; + ULONG ControlCaps; + ULONG dwMaxSessions; + MBB_STRING CustomDataClass; + MBB_STRING DeviceIdString; + MBB_STRING FirmwareInfo; + MBB_STRING HardwareInfo; + ULONG DeviceIndex; + UCHAR DataBuffer[ 1 ]; + } MBB_DEVICE_CAPS_V2; + +typedef struct _MBB_DEVICE_CAPS_V2 *PMBB_DEVICE_CAPS_V2; + +typedef struct _MBB_DEVICE_SLOT_MAPPING_INFO + { + ULONG MapCount; + MBB_ARRAY_ELEMENT SlotMapList[ 1 ]; + } MBB_DEVICE_SLOT_MAPPING_INFO; + +typedef struct _MBB_DEVICE_SLOT_MAPPING_INFO *PMBB_DEVICE_SLOT_MAPPING_INFO; + +typedef +enum _MBB_UICCSLOT_STATE + { + MbbUiccSlotStateOffEmpty = 0, + MbbUiccSlotStateOff = 1, + MbbUiccSlotStateEmpty = 2, + MbbUiccSlotStateNotReady = 3, + MbbUiccSlotStateActive = 4, + MbbUiccSlotStateError = 5 + } MBB_UICCSLOT_STATE; + +typedef struct _MBB_SLOT_INFO_REQ + { + ULONG SlotIndex; + } MBB_SLOT_INFO_REQ; + +typedef struct _MBB_SLOT_INFO_REQ *PMBB_SLOT_INFO_REQ; + +typedef struct _MBB_SLOT_INFO + { + ULONG SlotIndex; + MBB_UICCSLOT_STATE State; + } MBB_SLOT_INFO; + +typedef struct _MBB_SLOT_INFO *PMBB_SLOT_INFO; + +typedef struct _MBB_DEVICE_BINDINGS_INFO + { + ULONG ApplicationCount; + MBB_ARRAY_ELEMENT ApplicationList[ 1 ]; + } MBB_DEVICE_BINDINGS_INFO; + +typedef struct _MBB_DEVICE_BINDINGS_INFO *PMBB_DEVICE_BINDINGS_INFO; + +typedef +enum _MBB_REGISTRATION_VOICE_CLASS + { + MbbRegistrationVoiceClassVoiceCentric = 0, + MbbRegistrationVoiceClassDataCentric = 1 + } MBB_REGISTRATION_VOICE_CLASS; + +typedef +enum _MBB_REGISTRATION_VOICE_DOMAIN_PREFERENCE + { + MbbRegistrationVoiceDomainPreferenceCsOnly = 0, + MbbRegistrationVoiceDomainPreferenceCsPreferred = 1, + MbbRegistrationVoiceDomainPreferenceImsPreferred = 2, + MbbRegistrationVoiceDomainPreferenceImsOnly = 3 + } MBB_REGISTRATION_VOICE_DOMAIN_PREFERENCE; + +typedef +enum _MBB_REGISTRATION_VOICE_SUPPORT + { + MbbRegistrationVoiceSupportNone = 0, + MbbRegistrationVoiceSupportIms = 0x1, + MbbRegistrationVoiceSupportEmergencyAttach = 0x2, + MbbRegistrationVoiceSupportCs = 0x4, + MbbRegistrationVoiceSupportCsfb = 0x8, + MbbRegistrationVoiceSupport1xCsfb = 0x10, + MbbRegistrationVoiceSupportCsEmergency = 0x20 + } MBB_REGISTRATION_VOICE_SUPPORT; + +typedef +enum _MBB_REGISTRATION_CDMA_ROAM_MODE + { + MbbRegistrationCdmaRoamModeAutomatic = 0, + MbbRegistrationCdmaRoamModeHomeOnly = 1 + } MBB_REGISTRATION_CDMA_ROAM_MODE; + +typedef struct _MBB_SET_REGISTER_STATE_V2 + { + MBB_STRING ProviderId; + MBB_REGISTER_ACTION RegisterAction; + ULONG DataClass; + MBB_REGISTRATION_VOICE_CLASS VoiceClass; + MBB_REGISTRATION_VOICE_DOMAIN_PREFERENCE VoiceDomain; + MBB_REGISTRATION_CDMA_ROAM_MODE CdmaRoamMode; + MBB_ARRAY_ELEMENT AcquisitionOrder[ 1 ]; + } MBB_SET_REGISTER_STATE_V2; + +typedef struct _MBB_SET_REGISTER_STATE_V2 *PMBB_SET_REGISTER_STATE_V2; + +typedef struct _MBB_REGISTRATION_STATE_V2 + { + ULONG NetworkError; + MBB_REGISTER_STATE RegisterState; + MBB_REGISTER_MODE RegisterMode; + ULONG AvailableDataClasses; + MBB_CELLULAR_CLASS CurrentCellularClass; + MBB_STRING ProviderId; + MBB_STRING ProviderName; + MBB_STRING RoamingText; + ULONG RegFlags; + MBB_REGISTRATION_VOICE_SUPPORT VoiceSupport; + ULONG CurrentRATClass; + UCHAR DataBuffer[ 1 ]; + } MBB_REGISTRATION_STATE_V2; + +typedef struct _MBB_REGISTRATION_STATE_V2 *PMBB_REGISTRATION_STATE_V2; + +typedef struct _MBB_REGISTRATION_STATE_INFOS_V2 + { + ULONG ElementCount; + MBB_ARRAY_ELEMENT RegistrationStateList[ 1 ]; + } MBB_REGISTRATION_STATE_INFOS_V2; + +typedef struct _MBB_REGISTRATION_STATE_INFOS_V2 *PMBB_REGISTRATION_STATE_INFOS_V2; + +typedef struct _MBB_REGISTRATION_STATE_INFO_V2 + { + ULONG NetworkError; + MBB_REGISTER_STATE RegisterState; + MBB_REGISTER_MODE RegisterMode; + ULONG AvailableDataClasses; + MBB_CELLULAR_CLASS CurrentCellularClass; + MBB_STRING ProviderId; + MBB_STRING ProviderName; + MBB_STRING RoamingText; + ULONG RegistrationFlag; + ULONG PreferredDataClasses; + UCHAR DataBuffer[ 1 ]; + } MBB_REGISTRATION_STATE_INFO_V2; + +typedef struct _MBB_REGISTRATION_STATE_INFO_V2 *PMBB_REGISTRATION_STATE_INFO_V2; + +typedef +enum _MBB_IMS_VOICE_STATUS + { + MbbImsVoiceStatusUnknown = 0, + MbbImsVoiceStatusUnregistered = 1, + MbbImsVoiceStatusRegistered = 2 + } MBB_IMS_VOICE_STATUS; + +typedef struct _MBB_SET_IMS_VOICE_STATE + { + MBB_IMS_VOICE_STATUS ImsVoiceStatus; + } MBB_SET_IMS_VOICE_STATE; + +typedef struct _MBB_SET_IMS_VOICE_STATE *PMBB_SET_IMS_VOICE_STATE; + +typedef struct _MBB_IMS_VOICE_STATE + { + MBB_IMS_VOICE_STATUS ImsVoiceStatus; + } MBB_IMS_VOICE_STATE; + +typedef struct _MBB_IMS_VOICE_STATE *PMBB_IMS_VOICE_STATE; + +typedef struct _MBB_SET_SIGNAL_INDICATION_V2 + { + ULONG RssiInterval; + ULONG RssiThreshold; + ULONG ErrorRateThreshold; + ULONG SnrThreshold; + } MBB_SET_SIGNAL_INDICATION_V2; + +typedef struct _MBB_SET_SIGNAL_INDICATION_V2 *PMBB_SET_SIGNAL_INDICATION_V2; + +typedef struct _MBB_SIGNAL_STATE_V2 + { + ULONG Rssi; + ULONG ErrorRate; + ULONG RssiInterval; + ULONG RssiThreshold; + ULONG ErrorRateThreshold; + ULONG Snr; + ULONG SnrThreshold; + ULONG DataClass; + } MBB_SIGNAL_STATE_V2; + +typedef struct _MBB_SIGNAL_STATE_V2 *PMBB_SIGNAL_STATE_V2; + +typedef struct _MBB_RSRP_SNR_INFO + { + ULONG RSRP; + ULONG SNR; + ULONG RSRPThreshold; + ULONG SNRThreshold; + MBB_DATA_CLASS_VALUE SystemType; + } MBB_RSRP_SNR_INFO; + +typedef struct _MBB_RSRP_SNR_INFO *PMBB_RSRP_SNR_INFO; + +typedef struct _MBB_RSRP_SNR + { + ULONG ElementCount; + MBB_RSRP_SNR_INFO DataBuffer[ 1 ]; + } MBB_RSRP_SNR; + +typedef struct _MBB_RSRP_SNR *PMBB_RSRP_SNR; + +typedef struct _MBB_SIGNAL_STATE_INFO_V2 + { + ULONG Rssi; + ULONG ErrorRate; + ULONG SignalStrengthInterval; + ULONG RssiThreshold; + ULONG ErrorRateThreshold; + ULONG RsrpSnrOffset; + ULONG RsrpSnrSize; + MBB_RSRP_SNR DataBuffer; + } MBB_SIGNAL_STATE_INFO_V2; + +typedef struct _MBB_SIGNAL_STATE_INFO_V2 *PMBB_SIGNAL_STATE_INFO_V2; + +typedef struct _MBB_SIGNAL_STATE_INFOS_V2 + { + ULONG ElementCount; + MBB_ARRAY_ELEMENT SignalStateList[ 1 ]; + } MBB_SIGNAL_STATE_INFOS_V2; + +typedef struct _MBB_SIGNAL_STATE_INFOS_V2 *PMBB_SIGNAL_STATE_INFOS_V2; + +typedef +enum _MBB_LOCATION_TRIGGER_MODE + { + MbbLocationTriggerNone = 0, + MbbLocationTriggerAreaCode = 1, + MbbLocationTriggerAreaCellId = 2 + } MBB_LOCATION_TRIGGER_MODE; + +typedef struct _MBB_SET_LOCATION_STATE + { + MBB_LOCATION_TRIGGER_MODE Trigger; + } MBB_SET_LOCATION_STATE; + +typedef struct _MBB_SET_LOCATION_STATE *PMBB_SET_LOCATION_STATE; + +typedef struct _MBB_LOCATION_STATE_INFO + { + MBB_LOCATION_TRIGGER_MODE Trigger; + ULONG DataClass; + ULONG AreaCode; + ULONG CellId; + } MBB_LOCATION_STATE_INFO; + +typedef struct _MBB_LOCATION_STATE_INFO *PMBB_LOCATION_STATE_INFO; + +typedef struct _MBB_NITZ_INFO + { + ULONG Year; + ULONG Month; + ULONG Day; + ULONG Hour; + ULONG Minute; + ULONG Second; + ULONG TimeZoneOffsetMinutes; + ULONG DaylightSavingTimeOffsetMinutes; + ULONG DataClasses; + } MBB_NITZ_INFO; + +typedef struct _MBB_NITZ_INFO *PMBB_NITZ_INFO; + +typedef struct _MBB_ATR_INFO + { + MBB_ARRAY_ELEMENT2 Atr; + UCHAR DataBuffer[ 1 ]; + } MBB_ATR_INFO; + +typedef struct _MBB_ATR_INFO *PMBB_ATR_INFO; + +typedef struct _MBB_SET_UICC_OPEN_CHANNEL + { + MBB_ARRAY_ELEMENT2 AppId; + ULONG SelectP2Arg; + ULONG ChannelGroup; + UCHAR DataBuffer[ 1 ]; + } MBB_SET_UICC_OPEN_CHANNEL; + +typedef struct _MBB_SET_UICC_OPEN_CHANNEL *PMBB_SET_UICC_OPEN_CHANNEL; + +typedef struct _MBB_UICC_OPEN_CHANNEL_INFO + { + UCHAR Status[ 4 ]; + ULONG Channel; + MBB_ARRAY_ELEMENT2 Response; + UCHAR DataBuffer[ 1 ]; + } MBB_UICC_OPEN_CHANNEL_INFO; + +typedef struct _MBB_UICC_OPEN_CHANNEL_INFO *PMBB_UICC_OPEN_CHANNEL_INFO; + +typedef struct _MBB_SET_UICC_CLOSE_CHANNEL + { + ULONG Channel; + ULONG ChannelGroup; + ULONG SelectP2Arg; + } MBB_SET_UICC_CLOSE_CHANNEL; + +typedef struct _MBB_SET_UICC_CLOSE_CHANNEL *PMBB_SET_UICC_CLOSE_CHANNEL; + +typedef struct _MBB_UICC_CLOSE_CHANNEL_INFO + { + UCHAR Status[ 4 ]; + } MBB_UICC_CLOSE_CHANNEL_INFO; + +typedef struct _MBB_UICC_CLOSE_CHANNEL_INFO *PMBB_UICC_CLOSE_CHANNEL_INFO; + +typedef +enum _MBB_UICC_SECURE_MESSAGING + { + MbbUiccSecureMessagingNone = 0, + MbbUiccSecureMessagingNoHdrAuth = 1 + } MBB_UICC_SECURE_MESSAGING; + +typedef +enum _MBB_UICC_CLASS_BYTE_TYPE + { + MbbUiccClassByteTypeInterindustry = 0, + MbbUiccClassByteTypeExtended = 1 + } MBB_UICC_CLASS_BYTE_TYPE; + +typedef struct _MBB_SET_UICC_APDU + { + ULONG Channel; + MBB_UICC_SECURE_MESSAGING SecureMessaging; + MBB_UICC_CLASS_BYTE_TYPE Type; + MBB_ARRAY_ELEMENT2 Command; + UCHAR DataBuffer[ 1 ]; + } MBB_SET_UICC_APDU; + +typedef struct _MBB_SET_UICC_APDU *PMBB_SET_UICC_APDU; + +typedef struct _MBB_UICC_APDU_INFO + { + UCHAR Status[ 4 ]; + MBB_ARRAY_ELEMENT2 Response; + UCHAR DataBuffer[ 1 ]; + } MBB_UICC_APDU_INFO; + +typedef struct _MBB_UICC_APDU_INFO *PMBB_UICC_APDU_INFO; + +typedef struct _MBB_UICC_TERMINAL_CAPABILITY_TLV + { + UCHAR Data[ 3 ]; + } MBB_UICC_TERMINAL_CAPABILITY_TLV; + +typedef struct _MBB_UICC_TERMINAL_CAPABILITY_TLV *PMBB_UICC_TERMINAL_CAPABILITY_TLV; + +typedef struct _MBB_SET_UICC_TERMINAL_CAPABILITY + { + ULONG ElementCount; + MBB_ARRAY_ELEMENT CapabilityList[ 1 ]; + } MBB_SET_UICC_TERMINAL_CAPABILITY; + +typedef struct _MBB_SET_UICC_TERMINAL_CAPABILITY *PMBB_SET_UICC_TERMINAL_CAPABILITY; + +typedef struct _MBB_UICC_TERMINAL_CAPABILITY_INFO + { + ULONG ElementCount; + MBB_ARRAY_ELEMENT CapabilityList[ 1 ]; + } MBB_UICC_TERMINAL_CAPABILITY_INFO; + +typedef struct _MBB_UICC_TERMINAL_CAPABILITY_INFO *PMBB_UICC_TERMINAL_CAPABILITY_INFO; + +typedef +enum _MBB_UICC_PASSTHROUGH_ACTION + { + MbbUiccPassThroughDisable = 0, + MbbUiccPassThroughEnable = 1 + } MBB_UICC_PASSTHROUGH_ACTION; + +typedef +enum _MBB_UICC_PASSTHROUGH_STATUS + { + MbbUiccPassThroughDisabled = 0, + MbbUiccPassThroughEnabled = 1 + } MBB_UICC_PASSTHROUGH_STATUS; + +typedef struct _MBB_SET_UICC_RESET + { + MBB_UICC_PASSTHROUGH_ACTION PassThroughAction; + } MBB_SET_UICC_RESET; + +typedef struct _MBB_SET_UICC_RESET *PMBB_SET_UICC_RESET; + +typedef struct _MBB_UICC_RESET_INFO + { + MBB_UICC_PASSTHROUGH_STATUS PassThroughStatus; + } MBB_UICC_RESET_INFO; + +typedef struct _MBB_UICC_RESET_INFO *PMBB_UICC_RESET_INFO; + +typedef struct _MBB_SAR_CONFIG_INDICES + { + ULONG SarAntennaIndex; + ULONG SarBackoffIndex; + } MBB_SAR_CONFIG_INDICES; + +typedef struct _MBB_SAR_CONFIG_INDICES *PMBB_SAR_CONFIG_INDICES; + +typedef struct _MBB_SAR_CONFIG_INFO + { + MBB_SAR_CONTROL_MODE SarMode; + MBB_SAR_BACKOFF_STATE SarBackoffStatus; + MBB_SAR_WIFI_HARDWARE_INTEGRATION SarWifiIntegration; + ULONG ElementCount; + MBB_ARRAY_ELEMENT Configurations[ 1 ]; + } MBB_SAR_CONFIG_INFO; + +typedef struct _MBB_SAR_CONFIG_INFO *PMBB_SAR_CONFIG_INFO; + +typedef struct _MBB_SET_SAR_CONFIG + { + MBB_SAR_CONTROL_MODE SarMode; + MBB_SAR_BACKOFF_STATE SarBackoffStatus; + ULONG ElementCount; + MBB_ARRAY_ELEMENT Configurations[ 1 ]; + } MBB_SET_SAR_CONFIG; + +typedef struct _MBB_SET_SAR_CONFIG *PMBB_SET_SAR_CONFIG; + +typedef struct _MBB_SAR_TRANSMISSION_STATUS_INFO + { + MBB_SAR_TRANSMISSION_STATUS_NOTIFICATION_STATE ChannelNotification; + MBB_SAR_TRANSMISSION_STATUS TransmissionStatus; + ULONG HysteresisTimer; + } MBB_SAR_TRANSMISSION_STATUS_INFO; + +typedef struct _MBB_SAR_TRANSMISSION_STATUS_INFO *PMBB_SAR_TRANSMISSION_STATUS_INFO; + +typedef struct _MBB_SET_SAR_TRANSMISSION_STATUS + { + MBB_SAR_TRANSMISSION_STATUS_NOTIFICATION_STATE ChannelNotification; + ULONG HysteresisTimer; + } MBB_SET_SAR_TRANSMISSION_STATUS; + +typedef struct _MBB_SET_SAR_TRANSMISSION_STATUS *PMBB_SET_SAR_TRANSMISSION_STATUS; + +typedef struct _MBB_SET_MS_CONTEXT_PROVISIONED_CONTEXT_V2 + { + MBB_BASICCONNECTEXT_CONTEXT_OPERATIONS Operation; + GUID ContextType; + MBB_CONTEXT_IP_TYPE IPType; + MBB_BASICCONNECTEXT_CONTEXT_ENABLE Enable; + MBB_BASICCONNECTEXT_CONTEXT_ROAMING_CONTROL Roaming; + MBB_BASICCONNECTEXT_CONTEXT_MEDIA_TYPE MediaType; + MBB_BASICCONNECTEXT_CONTEXT_SOURCE Source; + MBB_STRING AccessString; + MBB_STRING UserName; + MBB_STRING Password; + MBB_COMPRESSION Compression; + MBB_AUTH_PROTOCOL AuthProtocol; + UCHAR DataBuffer[ 1 ]; + } MBB_SET_MS_CONTEXT_PROVISIONED_CONTEXT_V2; + +typedef struct _MBB_SET_MS_CONTEXT_PROVISIONED_CONTEXT_V2 *PMBB_SET_MS_CONTEXT_PROVISIONED_CONTEXT_V2; + +typedef struct _MBB_MS_CONTEXT_V2 + { + ULONG ContextId; + GUID ContextType; + MBB_CONTEXT_IP_TYPE IPType; + MBB_BASICCONNECTEXT_CONTEXT_ENABLE Enable; + MBB_BASICCONNECTEXT_CONTEXT_ROAMING_CONTROL Roaming; + MBB_BASICCONNECTEXT_CONTEXT_MEDIA_TYPE MediaType; + MBB_BASICCONNECTEXT_CONTEXT_SOURCE Source; + MBB_STRING AccessString; + MBB_STRING UserName; + MBB_STRING Password; + MBB_COMPRESSION Compression; + MBB_AUTH_PROTOCOL AuthProtocol; + UCHAR DataBuffer[ 1 ]; + } MBB_MS_CONTEXT_V2; + +typedef struct _MBB_MS_CONTEXT_V2 *PMBB_MS_CONTEXT_V2; + +typedef struct _MBB_MS_NETWORK_BLACKLIST_PROVIDER + { + ULONG MCC; + ULONG MNC; + MBB_BASICCONNECTEXT_NETWORK_BLACKLIST_TYPE NetworkBlacklistType; + } MBB_MS_NETWORK_BLACKLIST_PROVIDER; + +typedef struct _MBB_MS_NETWORK_BLACKLIST_PROVIDER *PMBB_MS_NETWORK_BLACKLIST_PROVIDER; + +typedef struct _MBB_MS_NETWORK_BLACKLIST_INFO + { + MBB_BASICCONNECTEXT_NETWORK_BLACKLIST_STATE BlacklistState; + ULONG ElementCount; + MBB_ARRAY_ELEMENT Contexts[ 1 ]; + } MBB_MS_NETWORK_BLACKLIST_INFO; + +typedef struct _MBB_MS_NETWORK_BLACKLIST_INFO *PMBB_MS_NETWORK_BLACKLIST_INFO; + +typedef struct _MBB_MS_VERSION_INFO + { + USHORT bcdMBIMVersion; + USHORT bcdMBIMExtendedVersion; + } MBB_MS_VERSION_INFO; + +typedef struct _MBB_MS_VERSION_INFO *PMBB_MS_VERSION_INFO; + +typedef struct _MBB_MS_LTE_ATTACH_CONTEXT + { + MBB_CONTEXT_IP_TYPE IPType; + MBB_BASICCONNECTEXT_LTEATTACH_ROAMING_CONTROL Roaming; + MBB_BASICCONNECTEXT_CONTEXT_SOURCE Source; + MBB_STRING AccessString; + MBB_STRING UserName; + MBB_STRING Password; + MBB_COMPRESSION Compression; + MBB_AUTH_PROTOCOL AuthProtocol; + UCHAR DataBuffer[ 1 ]; + } MBB_MS_LTE_ATTACH_CONTEXT; + +typedef struct _MBB_MS_LTE_ATTACH_CONTEXT *PMBB_MS_LTE_ATTACH_CONTEXT; + +typedef struct _MBB_SET_MS_CONTEXT_LTE_ATTACH_CONFIG + { + MBB_BASICCONNECTEXT_LTEATTACH_CONTEXT_OPERATIONS Operation; + ULONG ElementCount; + MBB_ARRAY_ELEMENT Contexts[ 1 ]; + } MBB_SET_MS_CONTEXT_LTE_ATTACH_CONFIG; + +typedef struct _MBB_SET_MS_CONTEXT_LTE_ATTACH_CONFIG *PMBB_SET_MS_CONTEXT_LTE_ATTACH_CONFIG; + +typedef struct _MBB_MS_LTE_ATTACH_CONFIG_INFO + { + ULONG ElementCount; + MBB_ARRAY_ELEMENT Contexts[ 1 ]; + } MBB_MS_LTE_ATTACH_CONFIG_INFO; + +typedef struct _MBB_MS_LTE_ATTACH_CONFIG_INFO *PMBB_MS_LTE_ATTACH_CONFIG_INFO; + +typedef struct _MBB_MS_LTE_ATTACH_STATUS + { + MBB_BASICCONNECTEXT_LTEATTACH_STATE LteAttachState; + MBB_CONTEXT_IP_TYPE IPType; + MBB_STRING AccessString; + MBB_STRING UserName; + MBB_STRING Password; + MBB_COMPRESSION Compression; + MBB_AUTH_PROTOCOL AuthProtocol; + UCHAR DataBuffer[ 1 ]; + } MBB_MS_LTE_ATTACH_STATUS; + +typedef struct _MBB_MS_LTE_ATTACH_STATUS *PMBB_MS_LTE_ATTACH_STATUS; + +typedef struct _MBB_MS_LTE_ATTACH_STATUS_V2 + { + MBB_BASICCONNECTEXT_LTEATTACH_STATE LteAttachState; + ULONG NetworkError; + MBB_CONTEXT_IP_TYPE IPType; + MBB_STRING AccessString; + MBB_STRING UserName; + MBB_STRING Password; + MBB_COMPRESSION Compression; + MBB_AUTH_PROTOCOL AuthProtocol; + UCHAR DataBuffer[ 1 ]; + } MBB_MS_LTE_ATTACH_STATUS_V2; + +typedef struct _MBB_MS_LTE_ATTACH_STATUS_V2 *PMBB_MS_LTE_ATTACH_STATUS_V2; + +typedef struct _MBB_MS_SYS_CAPS_INFO + { + ULONG NumberOfExecutors; + ULONG NumberOfSlots; + ULONG Concurrency; + ULONG64 ModemId; + } MBB_MS_SYS_CAPS_INFO; + +typedef struct _MBB_MS_SYS_CAPS_INFO *PMBB_MS_SYS_CAPS_INFO; + +typedef struct _MBB_MS_DEVICE_CAPS_INFO_V2 + { + MBB_DEVICE_TYPE DeviceType; + MBB_CELLULAR_CLASS CellularClass; + MBB_VOICE_CLASS VoiceClass; + MBB_SIM_CLASS SimClass; + ULONG DataClass; + ULONG SmsCaps; + ULONG ControlCaps; + ULONG dwMaxSessions; + MBB_STRING CustomDataClass; + MBB_STRING DeviceIdString; + MBB_STRING FirmwareInfo; + MBB_STRING HardwareInfo; + ULONG ExecutorIndex; + UCHAR DataBuffer[ 1 ]; + } MBB_MS_DEVICE_CAPS_INFO_V2; + +typedef struct _MBB_MS_DEVICE_CAPS_INFO_V2 *PMBB_MS_DEVICE_CAPS_INFO_V2; + +typedef struct _MBB_MS_DEVICE_CAPS_INFO_V3_OBS + { + MBB_DEVICE_TYPE DeviceType; + MBB_CELLULAR_CLASS CellularClass; + MBB_VOICE_CLASS VoiceClass; + ULONG SimClassBitMasks; + ULONG DataClass; + ULONG SmsCaps; + ULONG ControlCaps; + ULONGLONG MiscCaps; + ULONG dwMaxSessions; + ULONG ExecutorIndex; + ULONG WcdmaBandClass; + } MBB_MS_DEVICE_CAPS_INFO_V3_OBS; + +typedef struct _MBB_MS_DEVICE_CAPS_INFO_V3_OBS *PMBB_MS_DEVICE_CAPS_INFO_V3_OBS; + +typedef struct _MBB_MS_DEVICE_CAPS_INFO_V3 + { + MBB_DEVICE_TYPE DeviceType; + MBB_CELLULAR_CLASS CellularClass; + MBB_VOICE_CLASS VoiceClass; + ULONG SimClassBitMasks; + ULONG DataClass; + ULONG SmsCaps; + ULONG ControlCaps; + ULONGLONG DataSubClass; + ULONG dwMaxSessions; + ULONG ExecutorIndex; + ULONG WcdmaBandClass; + } MBB_MS_DEVICE_CAPS_INFO_V3; + +typedef struct _MBB_MS_DEVICE_CAPS_INFO_V3 *PMBB_MS_DEVICE_CAPS_INFO_V3; + +typedef struct _MBB_MS_DEVICE_SLOT_MAPPING_INFO + { + ULONG MapCount; + MBB_ARRAY_ELEMENT SlotMapList[ 1 ]; + } MBB_MS_DEVICE_SLOT_MAPPING_INFO; + +typedef struct _MBB_MS_DEVICE_SLOT_MAPPING_INFO *PMBB_MS_DEVICE_SLOT_MAPPING_INFO; + +typedef struct _MBB_MS_SLOT_INFO_REQ + { + ULONG SlotIndex; + } MBB_MS_SLOT_INFO_REQ; + +typedef struct _MBB_MS_SLOT_INFO_REQ *PMBB_MS_SLOT_INFO_REQ; + +typedef struct _MBB_MS_SLOT_INFO + { + ULONG SlotIndex; + MBB_BASICCONNECTEXT_UICCSLOT_STATE State; + } MBB_MS_SLOT_INFO; + +typedef struct _MBB_MS_SLOT_INFO *PMBB_MS_SLOT_INFO; + +typedef struct _MBB_MS_PCO_VALUE + { + ULONG SessionId; + ULONG PcoDataSize; + MBB_PCO_TYPE PcoDataType; + UCHAR PcoDataBuffer[ 1 ]; + } MBB_MS_PCO_VALUE; + +typedef struct _MBB_MS_PCO_VALUE *PMBB_MS_PCO_VALUE; + +typedef struct _MBB_MS_BASE_STATIONS_INFO_REQ + { + ULONG MaxGSMCount; + ULONG MaxUMTSCount; + ULONG MaxTDSCDMACount; + ULONG MaxLTECount; + ULONG MaxCDMACount; + } MBB_MS_BASE_STATIONS_INFO_REQ; + +typedef struct _MBB_MS_BASE_STATIONS_INFO_REQ *PMBB_MS_BASE_STATIONS_INFO_REQ; + +typedef struct _MBB_MS_BASE_STATIONS_INFO_REQ_V2 + { + ULONG MaxGSMCount; + ULONG MaxUMTSCount; + ULONG MaxTDSCDMACount; + ULONG MaxLTECount; + ULONG MaxCDMACount; + ULONG MaxNRCount; + } MBB_MS_BASE_STATIONS_INFO_REQ_V2; + +typedef struct _MBB_MS_BASE_STATIONS_INFO_REQ_V2 *PMBB_MS_BASE_STATIONS_INFO_REQ_V2; + +typedef struct _MBB_MS_BASE_STATIONS_INFO + { + MBB_DATA_CLASS_VALUE SystemType; + MBB_ARRAY_ELEMENT GSMServingCell; + MBB_ARRAY_ELEMENT UMTSServingCell; + MBB_ARRAY_ELEMENT TDSCDMAServingCell; + MBB_ARRAY_ELEMENT LTEServingCell; + MBB_ARRAY_ELEMENT GSMNmr; + MBB_ARRAY_ELEMENT UMTSMrl; + MBB_ARRAY_ELEMENT TDSCDMAMrl; + MBB_ARRAY_ELEMENT LTEMrl; + MBB_ARRAY_ELEMENT CDMAMrl; + UCHAR DataBuffer[ 1 ]; + } MBB_MS_BASE_STATIONS_INFO; + +typedef struct _MBB_MS_BASE_STATIONS_INFO *PMBB_MS_BASE_STATIONS_INFO; + +typedef struct _MBB_MS_BASE_STATIONS_INFO_V2 + { + MBB_DATA_CLASS_VALUE SystemType; + MBB_DATA_SUBCLASS_VALUE SystemSubType; + MBB_ARRAY_ELEMENT GSMServingCell; + MBB_ARRAY_ELEMENT UMTSServingCell; + MBB_ARRAY_ELEMENT TDSCDMAServingCell; + MBB_ARRAY_ELEMENT LTEServingCell; + MBB_ARRAY_ELEMENT GSMNmr; + MBB_ARRAY_ELEMENT UMTSMrl; + MBB_ARRAY_ELEMENT TDSCDMAMrl; + MBB_ARRAY_ELEMENT LTEMrl; + MBB_ARRAY_ELEMENT CDMAMrl; + MBB_ARRAY_ELEMENT NRServingCells; + MBB_ARRAY_ELEMENT NRNeighborCells; + UCHAR DataBuffer[ 1 ]; + } MBB_MS_BASE_STATIONS_INFO_V2; + +typedef struct _MBB_MS_BASE_STATIONS_INFO_V2 *PMBB_MS_BASE_STATIONS_INFO_V2; + +typedef struct _MBB_MODEM_LOGGING_CONFIG + { + ULONG Version; + ULONG MaxSegmentSize; + ULONG MaxFlushTime; + MBB_BASICCONNECTEXT_MODEM_LOGGING_LEVEL_CONFIG LevelConfig; + } MBB_MODEM_LOGGING_CONFIG; + +typedef struct _MBB_MODEM_LOGGING_CONFIG *PMBB_MODEM_LOGGING_CONFIG; + +typedef struct _MBB_TLV_IE + { + MBB_TLV_TYPE Type; + UCHAR Reserved; + UCHAR PaddingLength; + ULONG DataLength; + } MBB_TLV_IE; + +typedef struct _MBB_TLV_IE *PMBB_TLV_IE; + +typedef +enum _MBB_ACCESS_TYPE + { + MbbAccessUnknown = 0, + MbbAccess3GPP = 1, + MbbAccessNon3GPP = 2, + MbbAccessMaximum = ( MbbAccessNon3GPP + 1 ) + } MBB_ACCESS_TYPE; + +typedef struct _MBB_PRE_DFLT_NSSAI_INFO + { + MBB_ACCESS_TYPE AccessType; + MBB_TLV_IE PreferredNSSAI; + } MBB_PRE_DFLT_NSSAI_INFO; + +typedef struct _MBB_PRE_DFLT_NSSAI_INFO *PMBB_PRE_DFLT_NSSAI_INFO; + +typedef struct _MBB_SNSSAI_INFO + { + UCHAR SnssaiLength; + UCHAR Sst; + } MBB_SNSSAI_INFO; + +typedef struct _MBB_SNSSAI_INFO *PMBB_SNSSAI_INFO; + +typedef struct _MBB_TAI_LIST_SINGLE_PLMN + { + MBB_PLMN Plmn; + UCHAR ElementCount; + ULONG TacList[ 1 ]; + } MBB_TAI_LIST_SINGLE_PLMN; + +typedef struct _MBB_TAI_LIST_SINGLE_PLMN *PMBB_TAI_LIST_SINGLE_PLMN; + +typedef struct _MBB_TAI_LIST_MULTI_PLMNS + { + UCHAR ElementCount; + MBB_TAI TaiList[ 1 ]; + } MBB_TAI_LIST_MULTI_PLMNS; + +typedef struct _MBB_TAI_LIST_MULTI_PLMNS *PMBB_TAI_LIST_MULTI_PLMNS; + +typedef struct _MBB_TAI_LIST_INFO + { + UCHAR ListType; + /* [switch_is] */ /* [switch_type] */ union __MIDL___MIDL_itf_MbbMessages_0000_0000_0002 + { + /* [case()] */ MBB_TAI_LIST_SINGLE_PLMN SinglePlmnTaiList; + /* [case()] */ MBB_TAI_LIST_MULTI_PLMNS MultiPlmnsTaiList; + } u; + } MBB_TAI_LIST_INFO; + +typedef struct _MBB_TAI_LIST_INFO *PMBB_TAI_LIST_INFO; + +typedef struct _MBB_DNN + { + UCHAR DnnLength; + } MBB_DNN; + +typedef struct _MBB_DNN *PMBB_DNN; + +typedef struct _MBB_LADN + { + MBB_DNN Dnn; + } MBB_LADN; + +typedef struct _MBB_LADN *PMBB_LADN; + +typedef +enum _MBB_MODEM_CONFIG_STATUS + { + ModemConfigStatusUnknown = 0, + ModemConfigStatusStarted = 1, + ModemConfigStatusCompleted = 2, + ModemConfigStatusMaximum = ( ModemConfigStatusCompleted + 1 ) + } MBB_MODEM_CONFIG_STATUS; + +typedef struct _MBB_MODEM_CONFIG_INFO + { + MBB_MODEM_CONFIG_STATUS ConfigStatus; + MBB_TLV_IE ConfigName; + } MBB_MODEM_CONFIG_INFO; + +typedef struct _MBB_MODEM_CONFIG_INFO *PMBB_MODEM_CONFIG_INFO; + +typedef +enum _MBB_MICO_MODE + { + MicoModeDisabled = 0, + MicoModeEnabled = 1, + MicoModeUnsupported = 2, + MBIMMicoModeDefault = 3, + MicoModeMaximum = ( MBIMMicoModeDefault + 1 ) + } MBB_MICO_MODE; + +typedef +enum _MBB_DRX_PARAMS + { + DRXNotSpecified = 0, + MBIMDRXNotSupported = 1, + DRXCycle32 = 2, + DRXCycle64 = 3, + DRXCycle128 = 4, + DRXCycle256 = 5, + DRXCycleMaximum = ( DRXCycle256 + 1 ) + } MBB_DRX_PARAMS; + +typedef +enum _MBB_DEFAULT_PDU_HINT + { + MBIMDefaultPDUSessionActivationUnlikely = 0, + MBIMDefaultPDUSessionActivationLikely = 1, + DefaultPDUMaximum = ( MBIMDefaultPDUSessionActivationLikely + 1 ) + } MBB_DEFAULT_PDU_HINT; + +typedef +enum _MBB_MS_LADN_IND + { + LADNInfoNotNeeded = 0, + LADNInfoRequested = 1, + LADNInfoMaximum = ( LADNInfoRequested + 1 ) + } MBB_MS_LADN_IND; + +typedef struct _MBB_REGISTRATION_PARAMS_INFO + { + MBB_MICO_MODE MicoMode; + MBB_DRX_PARAMS DRXParams; + MBB_MS_LADN_IND LADNInfo; + MBB_DEFAULT_PDU_HINT DefaultPDUHint; + ULONG ReRegisterIfNeeded; + } MBB_REGISTRATION_PARAMS_INFO; + +typedef struct _MBB_REGISTRATION_PARAMS_INFO *PMBB_REGISTRATION_PARAMS_INFO; + +typedef +enum _MBB_MICO_IND + { + RaaiTypeRaNotAllocated = 0, + RaaiTypeRaAllocated = 1, + RaaiTypeNotAvailable = 0xffffffff + } MBB_MICO_IND; + +typedef struct _MBB_NW_PARAMS_QUERY_INFO + { + USHORT AreConfigurationsNeeded; + USHORT AreUEPoliciesNeeded; + } MBB_NW_PARAMS_QUERY_INFO; + +typedef struct _MBB_NW_PARAMS_QUERY_INFO *PMBB_NW_PARAMS_QUERY_INFO; + +typedef struct _MBB_NW_PARAMS_INFO + { + MBB_MICO_IND MicoInd; + MBB_DRX_PARAMS DRXParams; + } MBB_NW_PARAMS_INFO; + +typedef struct _MBB_NW_PARAMS_INFO *PMBB_NW_PARAMS_INFO; + +typedef +enum _MBB_WAKE_TYPE + { + WakeTypeCIDResponse = 0, + WakeTypeCIDIndication = 1, + WakeTypePacket = 2 + } MBB_WAKE_TYPE; + +typedef struct _MBB_WAKE_REASON + { + MBB_WAKE_TYPE WakeType; + ULONG SessionId; + } MBB_WAKE_REASON; + +typedef struct _MBB_WAKE_REASON *PMBB_WAKE_REASON; + +typedef struct _MBB_WAKE_COMMAND + { + MBB_COMMAND Command; + ULONG PayloadOffset; + ULONG PayloadSize; + UCHAR DataBuffer[ 1 ]; + } MBB_WAKE_COMMAND; + +typedef struct _MBB_WAKE_COMMAND *PMBB_WAKE_COMMAND; + +typedef struct _MBB_WAKE_PACKET + { + ULONG FilterId; + ULONG OriginalPacketSize; + ULONG SavedPacketOffset; + ULONG SavedPacketSize; + UCHAR DataBuffer[ 1 ]; + } MBB_WAKE_PACKET; + +typedef struct _MBB_WAKE_PACKET *PMBB_WAKE_PACKET; + +#include + + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/network/wwan/cxwmbclass/inc/mbbncm.h b/network/wwan/cxwmbclass/inc/mbbncm.h new file mode 100644 index 00000000..9731dedf --- /dev/null +++ b/network/wwan/cxwmbclass/inc/mbbncm.h @@ -0,0 +1,431 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#pragma once + +#define NCM10_CC_INTERFACE_CLASS (0x02) +#define NCM10_CC_INTERFACE_SUBCLASS (0x0d) +#define NCM10_CC_INTERFACE_PROTOCOL (0x00) + +#define MBIM_CC_INTERFACE_CLASS (0x02) +#define MBIM_CC_INTERFACE_SUBCLASS (0x0e) +#define MBIM_CC_INTERFACE_PROTOCOL (0x00) +#define MBIM_CC_INTERFACE_NBL_PROTOCOL (0x01) +#define MBIM_CC_INTERFACE_NETPACKET_PROTOCOL (0x02) + + +#define MBIM_DC_INTERFACE_CLASS (0x0A) +#define MBIM_DC_INTERFACE_SUBCLASS (0x00) +#define MBIM_DC_INTERFACE_PROTOCOL (0x02) + +#define MBIM_MBB_FUNCDESC_MIN_VERSION (0x0100) +#define MBIM_MBB_FUNCDESC_EXTENDED_MIN_VERSION (0x0100) + +#define SEND_ENCAPSULATE_COMMAND (0x00) +#define GET_ENCAPSULATE_RESPONSE (0x01) +#define RESET_FUNCTION (0x05) +#define SET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER (0x41) +#define GET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER (0x42) +#define SET_PACKET_FILTER (0x43) +#define GET_STATISTIC (0x44) + +#define GET_NTB_PARAMETERS (0x80) +#define GET_NBT_FORMAT (0x83) +#define SET_NBT_FORMAT (0x84) +#define GET_NTB_INPUT_SIZE (0x85) +#define SET_NTB_INPUT_SIZE (0x86) +#define GET_MAX_DATAGRAM_SIZE (0x87) + + +#define MBIM_MIN_SEGMENT_SIZE (1280) +#define MBIM_MAX_PACKET_FILTER_SIZE (192) +#define MBIM_MIN_NUMBER_OF_PACKET_FILTERS (16) +#define MBIM_MIN_MTU_SIZE (1280) +#define MBIM_MAX_MTU_SIZE (1500) + +#define USB_CDC_CS_DESCRIPTOR_TYPE (0x24) + +#define USB_CDC_CS_DESCRIPTOR_SUBTYPE (0x0) +#define USB_CDC_UNION_DESCRIPTOR_SUBTYPE (0x6) +#define USB_CDC_CS_ECM_DESCRIPTOR_SUBTYPE (0xf) +#define USB_CDC_CS_NCM_DESCRIPTOR_SUBTYPE (0x1a) +#define USB_CDC_CS_MBB_DESCRIPTOR_SUBTYPE (0x1b) +#define USB_CDC_CS_MBB_DESCRIPTOR_EXTENDED_SUBTYPE (0x1c) + + +#define USB_CDC_NOTIFICATION_NETWORK_CONNECTION (0x00) +#define USB_CDC_NOTIFICATION_RESPONSE_AVAILABLE (0x01) +#define USB_CDC_NOTIFICATION_CONNECTION_SPEED_CHANGE (0x2a) + +#define NCM_NETWORK_CAPS_SET_FILTER_SUPPORTED (1 << 0) +#define NCM_NETWORK_CAPS_GET_SET_ADDRESS_SUPPORTED (1 << 1) +#define NCM_NETWORK_CAPS_ENCAPSULATED_COMMAND_SUPPORTED (1 << 2) +#define NCM_NETWORK_CAPS_MAX_DATAGRAM_SUPPORTED (1 << 3) +#define NCM_NETWORK_CAPS_GET_SET_CRC_SUPPORTED (1 << 4) +#define NCM_NETWORK_CAPS_GET_8_BYTE_INPUT_SIZE_SUPPORTED (1 << 5) + +#define NCM_NTB_FORMAT_16_BIT (1 << 0) +#define NCM_NTB_FORMAT_32_BIT (1 << 1) + +#define NCM_PACKET_FILTER_DIRECTED (1 << 2) + +#define NCM_SET_NTB_FORMAT_16_BIT (0x0) +#define NCM_SET_NTB_FORMAT_32_BIT (0x1) + + + +#define NCM_STAT_RESERVED 0x00 +#define NCM_XMIT_OK 0x01 +#define NCM_RCV_OK 0x02 +#define NCM_XMIT_ERROR 0x03 +#define NCM_RCV_ERROR 0x04 +#define NCM_RCV_NO_BUFFER 0x05 +#define NCM_DIRECTED_BYTES_XMIT 0x06 +#define NCM_DIRECTED_FRAMES_XMIT 0x07 +#define NCM_MULTICAST_BYTES_XMIT 0x08 +#define NCM_MULTICAST_FRAMES_XMIT 0x09 +#define NCM_BROADCAST_BYTES_XMIT 0x0A +#define NCM_BROADCAST_FRAMES_XMIT 0x0B +#define NCM_DIRECTED_BYTES_RCV 0x0C +#define NCM_DIRECTED_FRAMES_RCV 0x0D +#define NCM_MULTICAST_BYTES_RCV 0x0E +#define NCM_MULTICAST_FRAMES_RCV 0x0F +#define NCM_BROADCAST_BYTES_RCV 0x10 +#define NCM_BROADCAST_FRAMES_RCV 0x11 +#define NCM_RCV_CRC_ERROR 0x12 +#define NCM_TRANSMIT_QUEUE_LENGTH 0x13 +#define NCM_RCV_ERROR_ALIGNMENT 0x14 +#define NCM_XMIT_ONE_COLLISION 0x15 +#define NCM_XMIT_MORE_COLLISIONS 0x16 +#define NCM_XMIT_DEFERRED 0x17 +#define NCM_XMIT_MAX_COLLISIONS 0x18 +#define NCM_RCV_OVERRUN 0x19 +#define NCM_XMIT_UNDERRUN 0x1A +#define NCM_XMIT_HEARTBEAT_FAILURE 0x1B +#define NCM_XMIT_TIMES_CRS_LOST 0x1C +#define NCM_XMIT_LATE_COLLISIONS 0x1D + +#define NCM_NDP_SESSION_SHIFT 24 +#define NCM_NDP_SIGNATURE_MASK 0x00FFFFFF + +#define NCM_NTH16_SIG 'HMCN' +#define NCM_NTH32_SIG 'hmcn' + +#define NCM_NDP16_IPS 'SPI' +#define NCM_NDP16_VENDOR 'SSD' + +#define NCM_NDP32_IPS 'spi' +#define NCM_NDP32_VENDOR 'ssd' + +#define NCM_CID_SIG 'dcbm' + +#pragma pack( push,1) + +typedef struct _NCM_NTB_PARAMETER { + + USHORT wLength; + USHORT bmNtbFormatSupported; + ULONG dwNtbInMaxSize; + USHORT wNdpInDivisor; + USHORT wNdpInPayloadRemainder; + USHORT wNdpInAlignment; + USHORT wReserved1; + ULONG dwNtbOutMaxSize; + USHORT wNdpOutDivisor; + USHORT wNdpOutPayloadRemainder; + USHORT wNdpOutAlignment; + USHORT wNtbOutMaxDatagrams; + +} NCM_NTB_PARAMETER, *PNCM_NTB_PARAMETER; + +typedef struct _USB_CS_DESCRIPTOR { + + BYTE bLength; + BYTE bDescriptorType; + BYTE bSubType; + +} USB_CS_DESCRIPTOR, *PUSB_CS_DESCRIPTOR; + +typedef struct _USB_CS_UNION_DESCRIPTOR { + + BYTE bLength; + BYTE bDescriptorType; + BYTE bSubType; + BYTE bControlInterface; + BYTE bSubordinateInterface[1]; + +} USB_CS_UNION_DESCRIPTOR, *PUSB_CS_UNION_DESCRIPTOR; + + +typedef struct _USB_CS_CDC_DESCRIPTOR { + + BYTE bLength; + BYTE bDescriptorType; + BYTE bSubType; + USHORT wCDCVersion; + +} USB_CS_CDC_DESCRIPTOR, *PUSB_CS_CDC_DESCRIPTOR; + +typedef struct _USB_CS_ECM_DESCRIPTOR { + + BYTE bLength; + BYTE bDescriptorType; + BYTE bSubType; + BYTE iMacAddress; + ULONG bmEthernetStatistics; + USHORT wMaxSegmentSize; + USHORT wNumberMCFilters; + BYTE bNumberPowerFilters; + +} USB_CS_ECM_DESCRIPTOR, *PUSB_CS_ECM_DESCRIPTOR; + +typedef struct _USB_CS_NCM_DESCRIPTOR { + + BYTE bLength; + BYTE bDescriptorType; + BYTE bSubType; + USHORT wNcmVersion; + BYTE bmNetworkCapabilities; + +} USB_CS_NCM_DESCRIPTOR, *PUSB_CS_NCM_DESCRIPTOR; + + +typedef struct _USB_CS_MBB_DESCRIPTOR { + + BYTE bLength; + BYTE bDescriptorType; + BYTE bSubType; + USHORT wMbbVersion; + USHORT wMaxControlMessage; + BYTE bNumberPowerFilters; + BYTE bMaxFilterSize; + USHORT wMaxSegmentSize; + BYTE bmNetworkCapabilities; + +} USB_CS_MBB_DESCRIPTOR, *PUSB_CS_MBB_DESCRIPTOR; + +typedef struct _USB_CS_MBB_DESCRIPTOR_EXTENDED { + + BYTE bLength; + BYTE bDescriptorType; + BYTE bSubType; + USHORT wMbbVersion; + BYTE bMaxOutstandingCommandMessages; + USHORT wMTU; + +} USB_CS_MBB_DESCRIPTOR_EXTENDED, *PUSB_CS_MBB_DESCRIPTOR_EXTENDED; + +typedef struct _USB_CDC_NOTIFICATION { + + BYTE bmRequestType; + BYTE bNotificationCode; + USHORT wValue; + USHORT wIndex; + USHORT wLength; + +} USB_CDC_NOTIFICATION, *PUSB_CDC_NOTIFICATION; + +typedef struct _USB_CDC_NOTIFICATION_SPEED_CHANGE { + + USB_CDC_NOTIFICATION NotificationHeader; + ULONG DownLinkBitRate; + ULONG UpLinkBitRate; + +} USB_CDC_NOTIFICATION_SPEED_CHANGE, *PUSB_CDC_NOTIFICATION_SPEED_CHANGE; + + +typedef struct _NCM_NTH16 { + + ULONG dwSignature; + USHORT wHeaderLength; + USHORT wSequence; + USHORT wBlockLength; + USHORT wFpIndex; + +} NCM_NTH16, *PNCM_NTH16; + +typedef struct _NCM_NTH32 { + + ULONG dwSignature; + USHORT wHeaderLength; + USHORT wSequence; + ULONG dwBlockLength; + ULONG dwFpIndex; + +} NCM_NTH32, *PNCM_NTH32; + +typedef struct _NCM_NDP16_DATAGRAM { + + USHORT wDatagramIndex; + USHORT wDatagramLength; + +} NCM_NDP16_DATAGRAM, *PNCM_NDP16_DATAGRAM; + + +typedef struct _NCM_NDP16 { + + ULONG dwSignature; + USHORT wLength; + USHORT wNextFpIndex; + + NCM_NDP16_DATAGRAM Datagram[1]; + +} NCM_NDP16, *PNCM_NDP16; + + +typedef struct _NCM_NDP32_DATAGRAM { + + ULONG dwDatagramIndex; + ULONG dwDatagramLength; + +} NCM_NDP32_DATAGRAM, *PNCM_NDP32_DATAGRAM; + + +typedef struct _NCM_NDP32 { + + ULONG dwSignature; + USHORT wLength; + USHORT wReserved6; + ULONG dwNextFpIndex; + ULONG dwReserved12; + + NCM_NDP32_DATAGRAM Datagram[1]; + +} NCM_NDP32, *PNCM_NDP32; + + +#pragma pack( pop) + +// +// NTB +// + +#define MBB_NTB_GET_OFFSET(NTH,_X_) ((ULONG)(((SIZE_T)(_X_))-((SIZE_T)(NTH)))) +#define MBB_NTB_GET_SEQUENCE(NTH) (((PNCM_NTH32)(NTH))->wSequence) +#define MBB_NTB_GET_SIGNATURE(NTH) (((PNCM_NTH32)(NTH))->dwSignature) +#define MBB_NTB_GET_HEADER_LENGTH(NTH) (((PNCM_NTH32)(NTH))->wHeaderLength) +#define MBB_NTB_IS_32BIT(NTH) (MBB_NTB_GET_SIGNATURE(NTH) == NCM_NTH32_SIG) +#define MBB_NTB_IS_16BIT(NTH) (MBB_NTB_GET_SIGNATURE(NTH) == NCM_NTH16_SIG) + +// +// NTB32 + +#define MBB_NTH32_GET_SEQUENCE(NTH) MBB_NTB_GET_SEQUENCE(NTH) +#define MBB_NTH32_GET_SIGNATURE(NTH) MBB_NTB_GET_SIGNATURE(NTH) +#define MBB_NTH32_GET_HEADER_LENGTH(NTH) MBB_NTB_GET_HEADER_LENGTH(NTH) +#define MBB_NTH32_GET_BLOCK_LENGTH(NTH) ((NTH)->dwBlockLength) +#define MBB_NTH32_GET_FIRST_NDP_OFFSET(NTH) ((NTH)->dwFpIndex) +#define MBB_NTH32_GET_FIRST_NDP(NTH) ((MBB_NTH32_GET_FIRST_NDP_OFFSET(NTH) != 0)? ((PNCM_NDP32)(((PCHAR)(NTH)) + MBB_NTH32_GET_FIRST_NDP_OFFSET(NTH))): NULL) +#define MBB_NTH32_IS_VALID_BLOCK_LENGTH(NTH,MAXLEN) (MBB_NTH32_GET_BLOCK_LENGTH(NTH) <= (MAXLEN)) +#define MBB_NTH32_IS_VALID_HEADER_LENGTH(NTH) (MBB_NTB_GET_HEADER_LENGTH(NTH) == sizeof(NCM_NTH32)) +#define MBB_NTH32_IS_VALID_SIGNATURE(NTH) (MBB_NTB_GET_SIGNATURE(NTH) == NCM_NTH32_SIG) +#define MBB_NTH32_IS_VALID_FIRST_NDP(NTH) \ + ( \ + MBB_NTH32_GET_FIRST_NDP_OFFSET(NTH)<= (ULONG_MAX - sizeof(NCM_NDP32)) && \ + (MBB_NTH32_GET_FIRST_NDP_OFFSET(NTH) + sizeof(NCM_NDP32)) <= MBB_NTH32_GET_BLOCK_LENGTH(NTH) \ + ) + +#define MBB_NDP32_GET_SIGNATURE(NDP) ((NDP)->dwSignature) +#define MBB_NDP32_GET_SESSIONID(NDP) (MBB_NDP32_GET_SIGNATURE(NDP) >> NCM_NDP_SESSION_SHIFT) +#define MBB_NDP32_GET_SIGNATURE_TYPE(NDP) (MBB_NDP32_GET_SIGNATURE(NDP) & NCM_NDP_SIGNATURE_MASK) +#define MBB_NDP32_GET_LENGTH(NDP) ((NDP)->wLength) +#define MBB_NDP32_GET_NEXT_NDP_OFFSET(NDP) ((NDP)->dwNextFpIndex) +#define MBB_NDP32_GET_NEXT_NDP(NTH,NDP) ((MBB_NDP32_GET_NEXT_NDP_OFFSET(NDP) != 0)? ((PNCM_NDP32)(((PCHAR)(NTH)) + MBB_NDP32_GET_NEXT_NDP_OFFSET(NDP))): NULL) +#define MBB_NDP32_GET_DATAGRAM_COUNT(NDP) ((MBB_NDP32_GET_LENGTH(NDP)-FIELD_OFFSET(NCM_NDP32,Datagram)) / sizeof(NCM_NDP32_DATAGRAM)) +#define MBB_NDP32_GET_DATAGRAM_OFFSET(NDP,IDX) ((NDP)->Datagram[(IDX)].dwDatagramIndex) +#define MBB_NDP32_GET_DATAGRAM_LENGTH(NDP,IDX) ((NDP)->Datagram[(IDX)].dwDatagramLength) +#define MBB_NDP32_GET_DATAGRAM(NTH,NDP,IDX) ((MBB_NDP32_GET_DATAGRAM_OFFSET(NDP,IDX) != 0)? (((PCHAR)(NTH)) + MBB_NDP32_GET_DATAGRAM_OFFSET(NDP,IDX)): NULL) +#define MBB_NDP32_IS_DATAGRAM_PRESENT(NDP,IDX) ((FIELD_OFFSET(NCM_NDP32,Datagram)+((IDX)*sizeof(NCM_NDP32_DATAGRAM))) <= MBB_NDP32_GET_LENGTH(NDP)) + +#define MBB_NTB32_IS_END_DATAGRAM(NTH,NDP,IDX) \ + ( \ + MBB_NDP32_IS_DATAGRAM_PRESENT(NDP,IDX) && \ + ( \ + MBB_NDP32_GET_DATAGRAM_OFFSET(NDP,IDX) == 0 || \ + MBB_NDP32_GET_DATAGRAM_LENGTH(NDP,IDX) == 0 \ + ) \ + ) +#define MBB_NTB32_IS_VALID_DATAGRAM(NTH,NDP,IDX) \ + ( \ + MBB_NDP32_IS_DATAGRAM_PRESENT(NDP,IDX) && \ + MBB_NDP32_GET_DATAGRAM_OFFSET(NDP,IDX) != 0 && \ + MBB_NDP32_GET_DATAGRAM_LENGTH(NDP,IDX) != 0 && \ + MBB_NDP32_GET_DATAGRAM_OFFSET(NDP,IDX) < MBB_NTH32_GET_BLOCK_LENGTH(NTH) && \ + MBB_NDP32_GET_DATAGRAM_OFFSET(NDP,IDX) <= (ULONG_MAX - MBB_NDP32_GET_DATAGRAM_LENGTH(NDP,IDX)) && \ + (MBB_NDP32_GET_DATAGRAM_OFFSET(NDP,IDX) + MBB_NDP32_GET_DATAGRAM_LENGTH(NDP,IDX)) <= MBB_NTH32_GET_BLOCK_LENGTH(NTH) \ + ) +#define MBB_NTB32_IS_VALID_NDP_LENGTH(NTH,NDP) \ + ( \ + (MBB_NTB_GET_OFFSET(NTH,NDP) < MBB_NTH32_GET_BLOCK_LENGTH(NTH)) && \ + (MBB_NDP32_GET_LENGTH(NDP) >= FIELD_OFFSET(NCM_NDP32,Datagram)) && \ + (MBB_NTB_GET_OFFSET(NTH,NDP) <= ULONG_MAX - MBB_NDP32_GET_LENGTH(NDP)) && \ + ((MBB_NTB_GET_OFFSET(NTH,NDP)+MBB_NDP32_GET_LENGTH(NDP)) <= MBB_NTH32_GET_BLOCK_LENGTH(NTH)) \ + ) +#define MBB_NTB32_IS_VALID_NDP_SIGNATURE(NDP) \ + ( \ + ((MBB_NDP32_GET_SIGNATURE(NDP) & NCM_NDP_SIGNATURE_MASK) == NCM_NDP32_IPS) || \ + ((MBB_NDP32_GET_SIGNATURE(NDP) & NCM_NDP_SIGNATURE_MASK) == NCM_NDP32_VENDOR) \ + ) + +// +// NTB16 +// + +#define MBB_NTH16_GET_SEQUENCE(NTH) MBB_NTB_GET_SEQUENCE(NTH) +#define MBB_NTH16_GET_SIGNATURE(NTH) MBB_NTB_GET_SIGNATURE(NTH) +#define MBB_NTH16_GET_HEADER_LENGTH(NTH) MBB_NTB_GET_HEADER_LENGTH(NTH) +#define MBB_NTH16_GET_BLOCK_LENGTH(NTH) ((NTH)->wBlockLength) +#define MBB_NTH16_GET_FIRST_NDP_OFFSET(NTH) ((NTH)->wFpIndex) +#define MBB_NTH16_GET_FIRST_NDP(NTH) ((MBB_NTH16_GET_FIRST_NDP_OFFSET(NTH) != 0)? ((PNCM_NDP16)(((PCHAR)(NTH)) + MBB_NTH16_GET_FIRST_NDP_OFFSET(NTH))): NULL) +#define MBB_NTH16_IS_VALID_BLOCK_LENGTH(NTH,MAXLEN) (MBB_NTH16_GET_BLOCK_LENGTH(NTH) <= (MAXLEN)) +#define MBB_NTH16_IS_VALID_HEADER_LENGTH(NTH) (MBB_NTB_GET_HEADER_LENGTH(NTH) == sizeof(NCM_NTH16)) +#define MBB_NTH16_IS_VALID_SIGNATURE(NTH) (MBB_NTB_GET_SIGNATURE(NTH) == NCM_NTH16_SIG) +#define MBB_NTH16_IS_VALID_FIRST_NDP(NTH) \ + ( \ + MBB_NTH16_GET_FIRST_NDP_OFFSET(NTH) <= (USHRT_MAX - sizeof(NCM_NDP16)) &&\ + (MBB_NTH16_GET_FIRST_NDP_OFFSET(NTH) + sizeof(NCM_NDP16)) <= MBB_NTH16_GET_BLOCK_LENGTH(NTH) \ + ) + +#define MBB_NDP16_GET_SIGNATURE(NDP) ((NDP)->dwSignature) +#define MBB_NDP16_GET_SESSIONID(NDP) (MBB_NDP16_GET_SIGNATURE(NDP) >> NCM_NDP_SESSION_SHIFT) +#define MBB_NDP16_GET_SIGNATURE_TYPE(NDP) (MBB_NDP16_GET_SIGNATURE(NDP) & NCM_NDP_SIGNATURE_MASK) +#define MBB_NDP16_GET_LENGTH(NDP) ((NDP)->wLength) +#define MBB_NDP16_GET_NEXT_NDP_OFFSET(NDP) ((NDP)->wNextFpIndex) +#define MBB_NDP16_GET_NEXT_NDP(NTH,NDP) ((MBB_NDP16_GET_NEXT_NDP_OFFSET(NDP) != 0)? ((PNCM_NDP16)(((PCHAR)(NTH)) + MBB_NDP16_GET_NEXT_NDP_OFFSET(NDP))): NULL) +#define MBB_NDP16_GET_DATAGRAM_COUNT(NDP) ((MBB_NDP16_GET_LENGTH(NDP)-FIELD_OFFSET(NCM_NDP16,Datagram)) / sizeof(NCM_NDP16_DATAGRAM)) +#define MBB_NDP16_GET_DATAGRAM_OFFSET(NDP,IDX) ((NDP)->Datagram[(IDX)].wDatagramIndex) +#define MBB_NDP16_GET_DATAGRAM_LENGTH(NDP,IDX) ((NDP)->Datagram[(IDX)].wDatagramLength) +#define MBB_NDP16_GET_DATAGRAM(NTH,NDP,IDX) ((MBB_NDP16_GET_DATAGRAM_OFFSET(NDP,IDX) != 0)? (((PCHAR)(NTH)) + MBB_NDP16_GET_DATAGRAM_OFFSET(NDP,IDX)): NULL) +#define MBB_NDP16_IS_DATAGRAM_PRESENT(NDP,IDX) ((FIELD_OFFSET(NCM_NDP16,Datagram)+((IDX)*sizeof(NCM_NDP16_DATAGRAM))) <= MBB_NDP16_GET_LENGTH(NDP)) + +#define MBB_NTB16_IS_END_DATAGRAM(NTH,NDP,IDX) \ + ( \ + MBB_NDP16_IS_DATAGRAM_PRESENT(NDP,IDX) && \ + ( \ + MBB_NDP16_GET_DATAGRAM_OFFSET(NDP,IDX) == 0 || \ + MBB_NDP16_GET_DATAGRAM_LENGTH(NDP,IDX) == 0 \ + ) \ + ) +#define MBB_NTB16_IS_VALID_DATAGRAM(NTH,NDP,IDX) \ + ( \ + MBB_NDP16_IS_DATAGRAM_PRESENT(NDP,IDX) && \ + MBB_NDP16_GET_DATAGRAM_OFFSET(NDP,IDX) != 0 && \ + MBB_NDP16_GET_DATAGRAM_LENGTH(NDP,IDX) != 0 && \ + MBB_NDP16_GET_DATAGRAM_OFFSET(NDP,IDX) < MBB_NTH16_GET_BLOCK_LENGTH(NTH) && \ + MBB_NDP16_GET_DATAGRAM_OFFSET(NDP,IDX) <= (USHRT_MAX - MBB_NDP16_GET_DATAGRAM_LENGTH(NDP,IDX)) &&\ + (MBB_NDP16_GET_DATAGRAM_OFFSET(NDP,IDX) + MBB_NDP16_GET_DATAGRAM_LENGTH(NDP,IDX)) <= MBB_NTH16_GET_BLOCK_LENGTH(NTH) \ + ) +#define MBB_NTB16_IS_VALID_NDP_LENGTH(NTH,NDP) \ + ( \ + (MBB_NTB_GET_OFFSET(NTH,NDP) < MBB_NTH16_GET_BLOCK_LENGTH(NTH)) && \ + (MBB_NDP16_GET_LENGTH(NDP) >= FIELD_OFFSET(NCM_NDP16,Datagram)) && \ + (MBB_NTB_GET_OFFSET(NTH,NDP) <= (ULONG)(USHRT_MAX - MBB_NDP16_GET_LENGTH(NDP))) &&\ + ((MBB_NTB_GET_OFFSET(NTH,NDP)+MBB_NDP16_GET_LENGTH(NDP)) <= MBB_NTH16_GET_BLOCK_LENGTH(NTH)) \ + ) +#define MBB_NTB16_IS_VALID_NDP_SIGNATURE(NDP) \ + ( \ + ((MBB_NDP16_GET_SIGNATURE(NDP) & NCM_NDP_SIGNATURE_MASK) == NCM_NDP16_IPS) || \ + ((MBB_NDP16_GET_SIGNATURE(NDP) & NCM_NDP_SIGNATURE_MASK) == NCM_NDP16_VENDOR) \ + ) + diff --git a/network/wwan/cxwmbclass/inc/power.h b/network/wwan/cxwmbclass/inc/power.h new file mode 100644 index 00000000..0205fb8e --- /dev/null +++ b/network/wwan/cxwmbclass/inc/power.h @@ -0,0 +1,11 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#pragma once + +EVT_WDF_DEVICE_D0_ENTRY EvtDeviceD0Entry; +EVT_WDF_DEVICE_D0_EXIT EvtDeviceD0Exit; +EVT_WDF_DEVICE_ARM_WAKE_FROM_S0 EvtDeviceArmWakeFromS0; +EVT_WDF_DEVICE_DISARM_WAKE_FROM_S0 EvtDeviceDisarmWakeFromS0; +EVT_NET_DEVICE_PREVIEW_WAKE_SOURCE EvtDevicePreviewBitmapPattern; diff --git a/network/wwan/cxwmbclass/inc/precomp.h b/network/wwan/cxwmbclass/inc/precomp.h new file mode 100644 index 00000000..706407ba --- /dev/null +++ b/network/wwan/cxwmbclass/inc/precomp.h @@ -0,0 +1,53 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#pragma once + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define INITGUID +#include + +#include + +#include "mbbncm.h" + +#include "mbbmessages.h" +#define MBB_MAX_NUMBER_OF_SESSIONS 17 // including the default session for the physical/primary interface +#define MBB_DEFAULT_SESSION_ID 0 // for physical/primay interface. Must be 0. Do NOT change it. +#define MBB_INVALID_SESSION_ID MBB_MAX_NUMBER_OF_SESSIONS + +#define WMBCLASS_RADIO_STATE_OFF 0 +#define WMBCLASS_RADIO_STATE_ON 1 + +#include "BusInterface.h" + +#include "align.h" +#include "device.h" +#include "adapter.h" +#include "data.h" +#include "txqueue.h" +#include "util.h" +#include "usbbus.h" +#include "utils.h" diff --git a/network/wwan/cxwmbclass/inc/rxqueue.h b/network/wwan/cxwmbclass/inc/rxqueue.h new file mode 100644 index 00000000..fa57e6e0 --- /dev/null +++ b/network/wwan/cxwmbclass/inc/rxqueue.h @@ -0,0 +1,26 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#pragma once + +typedef struct _MBB_RXQUEUE_CONTEXT +{ + PWMBCLASS_NETADAPTER_CONTEXT NetAdapterContext; + LONG NotificationEnabled; + NET_RING_COLLECTION const* DatapathDescriptor; + NET_EXTENSION ReturnContextExtension; + NET_EXTENSION VirtualAddressExtension; +} MBB_RXQUEUE_CONTEXT, *PMBB_RXQUEUE_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(MBB_RXQUEUE_CONTEXT, MbbGetRxQueueContext); + +EVT_WDF_OBJECT_CONTEXT_DESTROY EvtRxQueueDestroy; + +EVT_PACKET_QUEUE_SET_NOTIFICATION_ENABLED EvtRxQueueSetNotificationEnabled; +EVT_PACKET_QUEUE_ADVANCE EvtRxQueueAdvance; +EVT_PACKET_QUEUE_CANCEL EvtRxQueueCancel; + +VOID MbbNdisReceiveCallback(_In_ MBB_PROTOCOL_HANDLE ProtocolHandle, _In_ MBB_RECEIVE_CONTEXT ReceiveContext, _In_ PMDL Mdl); + +VOID EvtAdapterReturnRxBuffer(_In_ NETADAPTER Adapter, _In_ NET_FRAGMENT_RETURN_CONTEXT_HANDLE RxBufferReturnContext); diff --git a/network/wwan/cxwmbclass/inc/txqueue.h b/network/wwan/cxwmbclass/inc/txqueue.h new file mode 100644 index 00000000..7bab9c07 --- /dev/null +++ b/network/wwan/cxwmbclass/inc/txqueue.h @@ -0,0 +1,22 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// +#pragma once + +typedef struct _MBB_TXQUEUE_CONTEXT +{ + PWMBCLASS_NETADAPTER_CONTEXT NetAdapterContext; + LONG NotificationEnabled; + UINT32 CompletionBatchSize; + NET_RING_COLLECTION const* DatapathDescriptor; + NET_EXTENSION MdlExtension; +} MBB_TXQUEUE_CONTEXT, *PMBB_TXQUEUE_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(MBB_TXQUEUE_CONTEXT, MbbGetTxQueueContext); + +EVT_WDF_OBJECT_CONTEXT_DESTROY EvtTxQueueDestroy; +EVT_PACKET_QUEUE_SET_NOTIFICATION_ENABLED EvtTxQueueSetNotificationEnabled; +EVT_PACKET_QUEUE_CANCEL EvtTxQueueCancel; +EVT_PACKET_QUEUE_ADVANCE EvtTxQueueAdvance; + +EVT_MBB_DEVICE_SEND_DEVICE_SERVICE_SESSION_DATA EvtMbbDeviceSendDeviceServiceSessionData; diff --git a/network/wwan/cxwmbclass/inc/usbbus.h b/network/wwan/cxwmbclass/inc/usbbus.h new file mode 100644 index 00000000..cca02f60 --- /dev/null +++ b/network/wwan/cxwmbclass/inc/usbbus.h @@ -0,0 +1,235 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// +#pragma once + +#define INITIALIZE_PASSIVE_LOCK(__lock) KeInitializeGuardedMutex(__lock) + +#define ACQUIRE_PASSIVE_LOCK(__lock) KeAcquireGuardedMutex(__lock) + +#define RELEASE_PASSIVE_LOCK(__lock) KeReleaseGuardedMutex(__lock) + +#define WMB_PUSH_LOCK EX_PUSH_LOCK + +#define INIT_PUSHLOCK(PushLock) ExInitializePushLock(PushLock) + +#define ACQUIRE_PUSHLOCK_EXCLUSIVE(PushLock) \ + do \ + { \ + KeEnterCriticalRegion(); \ + ExAcquirePushLockExclusive((PushLock)); \ + } while (0) + +#define RELEASE_PUSHLOCK_EXCLUSIVE(PushLock) \ + do \ + { \ + ExReleasePushLockExclusive((PushLock)); \ + KeLeaveCriticalRegion(); \ + } while (0) + +#define ACQUIRE_PUSHLOCK_SHARED(PushLock) \ + do \ + { \ + KeEnterCriticalRegion(); \ + ExAcquirePushLockShared((PushLock)); \ + } while (0) + +#define RELEASE_PUSHLOCK_SHARED(PushLock) \ + do \ + { \ + ExReleasePushLockShared((PushLock)); \ + KeLeaveCriticalRegion(); \ + } while (0) + +#define MAX_PREALLOCATED_WRITE_REQUESTS (20) + +//#define DEFAULT_INTERRUPT_PIPE_READ_SIZE (8) +#define DEFAULT_IO_TIMEOUT (10) + +#define MAX_HOST_NTB_SIZE (0x10000) +#define MAX_HOST_NTB_SIZE_FOR_UDE_MBIM (0x20000) +#define MAX_OUT_DATAGRAMS (64) + +#define INTERRUPT_REASSEMBLY_BUFFER_SIZE (64) + +#define MIN_CONTROL_MESSAGE_SIZE (64) +#define MAX_CONTROL_MESSAGE_SIZE (4096) + +#define ALT_DATA_SETTING_0_PIPES (0) +#define ALT_DATA_SETTING_1_PIPES (2) + +#define INITIAL_OPEN_TIMEOUT (5) +#define MAX_OPEN_RETRY_ATTEMPTS (4) + +#define PENDING_BULK_IN_READS (3) +#define PENDING_BULK_IN_READS_FOR_UDE_MBIM (10) + +typedef enum _BUS_STATE +{ + + BUS_STATE_CLOSED = 0, + BUS_STATE_CLOSING, + + BUS_STATE_OPENING, + BUS_STATE_OPENED + +} BUS_STATE, + *PBUS_STATE; + +typedef struct _POWER_FILTER_LOOKUP +{ + + ULONG PatternId; + BOOLEAN InUse; + +} POWER_FILTER_LOOKUP, *PPOWER_FILTER_LOOKUP; + +typedef struct _BUS_OBJECT +{ + + KGUARDED_MUTEX Lock; + BUS_STATE State; + + PDEVICE_OBJECT Pdo; + PDEVICE_OBJECT Fdo; + PDEVICE_OBJECT NextDeviceObject; + + MBB_PROTOCOL_HANDLE ProtocolHandle; + MBB_BUS_RESPONSE_AVAILABLE_CALLBACK ResponseAvailableCallback; + + MBB_BUS_DATA_RECEIVE_CALLBACK ReceiveDataCallback; + + MBB_BUS_SS_IDLE_CONFIRM_CALLBACK IdleConfirmCallback; + MBB_BUS_SS_IDLE_NOTIFICATION_COMPLETE_CALLBACK IdleNotificationComplete; + + WDFDEVICE WdfDevice; + WDFUSBDEVICE WdfUsbDevice; + + USHORT MaxControlChannelSize; + + USHORT MaxSegmentSize; + BYTE NcmParams; + BOOLEAN NtbFormat32Bit; + BYTE PowerFiltersSupported; + BYTE MaxPowerFilterSize; + + BYTE MaxOutstandingCommandMessages; + USHORT MTU; + + NCM_NTB_PARAMETER NtbParam; + + PWSTR Manufacturer; + PWSTR Model; + + ULONG MaxBulkInTransfer; + ULONG BulkInHeaderSize; + + BOOLEAN ChainedMdlsSupported; + + PIRP UsbSsIrp; + USB_IDLE_CALLBACK_INFO UsbSsCallback; + + KEVENT UsbSsIrpComplete; + + PPOWER_FILTER_LOOKUP PowerFilterTable; + + PUCHAR SyncInterruptReadBuffer; + + UCHAR InterruptReassemnblyBuffer[INTERRUPT_REASSEMBLY_BUFFER_SIZE]; + ULONG CurrentOffset; + ULONG ExpectLength; + + USHORT MbimVersion; + USHORT MbimExtendedVersion; + BOOLEAN RemoteWakeCapable; + + USB_CAP_DEVICE_INFO UsbCapDeviceInfo; + PVOID ModemContext; + +} BUS_OBJECT, *PBUS_OBJECT; + +typedef struct _WDF_DEVICE_INFO +{ + + PBUS_OBJECT BusObject; + +} WDF_DEVICE_INFO, *PWDF_DEVICE_INFO; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(WDF_DEVICE_INFO, GetWdfDeviceInfo) + +// +// put this in the NIC data structure +// +typedef struct _USB_DEVICE_CONTEXT +{ + size_t NumberOfPipes; + + WDFWAITLOCK PipeStateLock; + + UCHAR UsbCommunicationInterfaceIndex; + UCHAR UsbDataInterfaceIndex; + + UCHAR UsbCommunicationInterfaceSetting; + UCHAR UsbDataInterfaceSetting; + + UCHAR WdfCommunicationInterfaceIndex; + UCHAR WdfDataInterfaceIndex; + + BOOLEAN BulkInputPipeConfigured; + BOOLEAN BulkInputPipeStarted; + ULONG BulkInputPipeMaxPacket; + WDFUSBPIPE BulkInputPipe; + + BOOLEAN BulkOutputPipeConfigured; + BOOLEAN BulkOutputPipeStarted; + ULONG BulkOutputPipeMaxPacket; + WDFUSBPIPE BulkOutputPipe; + + WDFUSBPIPE InterruptPipe; + + WDFIOTARGET InterruptPipeIoTarget; + ULONG InterruptPipeMaxPacket; + + WDFLOOKASIDE LookasideList; + + WDFSPINLOCK WriteCollectionLock; + WDFCOLLECTION WriteRequestCollection; + + WDFWORKITEM BulkPipeResetWorkitem; + LONG BulkPipeResetFlag; + EX_RUNDOWN_REF BulkPipeResetRundown; + PBUS_OBJECT BusObject; +} USB_DEVICE_CONTEXT, *PUSB_DEVICE_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(USB_DEVICE_CONTEXT, GetUsbDeviceContext) + +typedef struct _REQUEST_CONTEXT +{ + + PVOID CallbackContext; + union + { + + MBB_BUS_SEND_COMPLETION_CALLBACK Send; + MBB_BUS_RECEIVE_COMPLETION_CALLBACK Receive; + + } Callback; + + MBB_PROTOCOL_HANDLE ProtocolHandle; + + PUSB_DEVICE_CONTEXT UsbDeviceContext; + + PVOID Buffer; + ULONG BufferLength; + +} REQUEST_CONTEXT, *PREQUEST_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(REQUEST_CONTEXT, GetRequestContext) + +VOID MbbBusMiniportUsbIdle(PVOID Context); + +NTSTATUS +PreAllocateWriteRequests(WDFUSBDEVICE UsbDevice); + +#define IS_USB_DEVICE_REMOTE_WAKE_CAPABLE(deviceInformation) \ + ((deviceInformation.Traits & WDF_USB_DEVICE_TRAIT_REMOTE_WAKE_CAPABLE) > 0 ? TRUE : FALSE); diff --git a/network/wwan/cxwmbclass/inc/util.h b/network/wwan/cxwmbclass/inc/util.h new file mode 100644 index 00000000..12d166b4 --- /dev/null +++ b/network/wwan/cxwmbclass/inc/util.h @@ -0,0 +1,42 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// +#pragma once +typedef enum +{ + MbbPoolTagDefault = '0CBM', + MbbPoolTagNtbSend = '1CBM', + MbbPoolTagNblSend = '2CBM', + MbbPoolTagNbSend = '3CBM', + MbbPoolTagMdlReceive = '6CBM' +} MBB_POOL_TAG; + +#define ALLOCATE_PAGED_POOL(_y) ExAllocatePool2(POOL_FLAG_PAGED, _y, MbbPoolTagDefault) +#define ALLOCATE_NONPAGED_POOL(_y) ExAllocatePool2(POOL_FLAG_NON_PAGED, _y, MbbPoolTagDefault) +#define ALLOCATE_NONPAGED_POOL_WITH_TAG(_x, _y) ExAllocatePool2(POOL_FLAG_NON_PAGED, _x, _y) + +#define FREE_POOL(_x) \ + { \ + ExFreePool(_x); \ + _x = NULL; \ + }; + +#define MIN(_X_, _Y_) (((_X_) < (_Y_)) ? (_X_) : (_Y_)) +#define MAX(_X_, _Y_) (((_X_) > (_Y_)) ? (_X_) : (_Y_)) + +#define ALIGN_FLOOR(_VALUE_, _ALIGN_) ALIGN_DOWN_BY(_VALUE_, _ALIGN_) +#define ALIGN_CIELING(_VALUE_, _ALIGN_) ALIGN_UP_BY(_VALUE_, _ALIGN_) +#define ALIGN(_VALUE_, _ALIGN_) ALIGN_CIELING(_VALUE_, _ALIGN_) +#define ALIGN_AT_OFFSET(_VALUE_, _ALIGN_, _OFFSET_) \ + (((SIZE_T)(_VALUE_) <= (ALIGN_FLOOR(_VALUE_, _ALIGN_) + (_OFFSET_))) ? (ALIGN_FLOOR(_VALUE_, _ALIGN_) + (_OFFSET_)) \ + : (ALIGN(_VALUE_, _ALIGN_) + (_OFFSET_))) + +NTSTATUS +MbbNtbValidate(_In_ PVOID Nth, _In_ ULONG BufferLength, _In_ BOOLEAN Is32Bit, _Out_opt_ ULONG* NdpCount); + +NTSTATUS +CreateNonPagedWdfMemory(_In_ ULONG ObjectSize, _Out_ WDFMEMORY* WdfMemory, _Out_opt_ PVOID* ObjectMemory, _In_ WDFOBJECT Parent, _In_ ULONG PoolTag); + +PMDL AllocateNonPagedMdl(_In_reads_bytes_(Length) PVOID VirtualAddress, _In_ ULONG Length); + +VOID MbbRecvCancelNdps(_In_ PWMBCLASS_DEVICE_CONTEXT DeviceContext, _In_ ULONG SessionId); diff --git a/network/wwan/cxwmbclass/inc/utils.h b/network/wwan/cxwmbclass/inc/utils.h new file mode 100644 index 00000000..e7d06637 --- /dev/null +++ b/network/wwan/cxwmbclass/inc/utils.h @@ -0,0 +1,61 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// +#pragma once +NTSTATUS +SendSyncControlCommand( + __in WDFUSBDEVICE WdfUsbDevice, + __in WDF_USB_BMREQUEST_DIRECTION Direction, + __in WDF_USB_BMREQUEST_RECIPIENT Recipient, + __in BYTE Request, + __in USHORT Value, + __inout_bcount_opt(BufferLength) PUCHAR Buffer, + __in ULONG BufferLength, + __out_opt PULONG BytesTransfered); + +NTSTATUS +TransactControlChannel( + __in PBUS_OBJECT BusObject, + __in ULONG TimeOut, + __in_bcount_opt(InBufferLength) PUCHAR InBuffer, + __in ULONG InBufferLength, + __out_bcount_opt(OutBufferLength) PUCHAR OutBuffer, + __in ULONG OutBufferLength, + __out PULONG BytesRead); + +NTSTATUS +ReadInterrupt(_In_ PBUS_OBJECT BusObject, _Inout_updates_bytes_(BufferLength) PUCHAR Buffer, _In_ ULONG BufferLength, _In_ ULONG Timeout, _Out_ PULONG BytesRead); + +NTSTATUS +GetDeviceString(__in WDFUSBDEVICE UsbDevice, __in UCHAR Index, __out PWSTR* String); + +NTSTATUS +MbbBusSetPacketFilter(__in MBB_BUS_HANDLE BusHandle, __in ULONG PacketFilter); + +NTSTATUS +MbbBusSetNtbInSize(__in MBB_BUS_HANDLE BusHandle, __in ULONG InSize); + +NTSTATUS +MbbBusGetStat(__in MBB_BUS_HANDLE BusHandle, __in USHORT StatIndex, __out ULONGLONG* Value); + +NTSTATUS +MbbBusSetNtbFormat(__in MBB_BUS_HANDLE BusHandle, __in USHORT Format); + +NTSTATUS +MbbBusResetFunction(__in MBB_BUS_HANDLE BusHandle); + +ULONG +ProcessInterruptPipeRead( + PBUS_OBJECT BusObject, + __in_ecount(NewFragmentLength) PCUCHAR NewFragment, + ULONG NewFragmentLength, + __out_ecount(MessageBufferSize) PUCHAR CompleteMessageBuffer, + ULONG MessageBufferSize); + +NTSTATUS +WaitForResponseAvailible(PBUS_OBJECT BusObject, ULONG TimeOut); + +NTSTATUS +MbbBusResetDeviceAndSetParms(__in PBUS_OBJECT BusObject); + +BOOLEAN IsUsbCapDeviceInfoValid(_In_ USB_CAP_DEVICE_INFO UsbCapDeviceInfo, _In_ ULONG CapResultLength); diff --git a/network/wwan/cxwmbclass/power.cpp b/network/wwan/cxwmbclass/power.cpp new file mode 100644 index 00000000..e0726975 --- /dev/null +++ b/network/wwan/cxwmbclass/power.cpp @@ -0,0 +1,116 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#include "precomp.h" + +#include "power.h" +#include "device.h" +#include "adapter.h" + +_Use_decl_annotations_ NTSTATUS EvtDeviceD0Entry(WDFDEVICE Device, WDF_POWER_DEVICE_STATE previousPowerState) +{ + NTSTATUS status = STATUS_SUCCESS; + PWMBCLASS_DEVICE_CONTEXT deviceContext = WmbClassGetDeviceContext(Device); + UNREFERENCED_PARAMETER(previousPowerState); + do + { + if (MbbBusIsStoped(deviceContext->BusHandle)) + { + // + // device was in d3, open it again + // + status = MbbBusStart(deviceContext->BusHandle); + + if (!NT_SUCCESS(status)) + { + WdfDeviceSetFailed(deviceContext->WdfDevice, WdfDeviceFailedAttemptRestart); + break; + } + } + else + { + MbbBusSetNotificationState(deviceContext->BusHandle, TRUE); + } + // Allow sessions to receive data from this point since RxQueueCreate happens later after D0Entry. We need cache NDPs receive before RxQueueCreate + for (int i = 0; i < MBB_MAX_NUMBER_OF_SESSIONS; i++) + { + if (deviceContext->Sessions[i].NetAdapterContext == NULL) + { + continue; + } + deviceContext->Sessions[i].NetAdapterContext->AllowRxTraffic = TRUE; + } + MbbBusStartDataPipes(deviceContext->BusHandle); + } while (FALSE); + + return status; +} + +_Use_decl_annotations_ NTSTATUS EvtDeviceD0Exit(WDFDEVICE Device, WDF_POWER_DEVICE_STATE TargetPowerState) +{ + UNREFERENCED_PARAMETER(TargetPowerState); + PWMBCLASS_DEVICE_CONTEXT deviceContext = WmbClassGetDeviceContext(Device); + + MbbBusStopDataPipes(deviceContext->BusHandle); + // + // If the device is not armed for wake, close has been sent by MbbCx. All response available notifications from close in MbbCx to EvtDeviceD0Exit will be ignored. + // + // If the device is armed for wake, No response available notification after EvtDeviceArmWakeFromS0 where we stop the notification. + if (!deviceContext->m_armedWake) + { + MbbBusStop(deviceContext->BusHandle); + } + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ NTSTATUS EvtDevicePreviewBitmapPattern(WDFDEVICE Device, NETWAKESOURCE BitmapPattern) +{ + // We don't need to look at the pattern itself, only how many we currently have + UNREFERENCED_PARAMETER(BitmapPattern); + + NET_WAKE_SOURCE_LIST wakeSourceList; + NET_WAKE_SOURCE_LIST_INIT(&wakeSourceList); + NetDeviceGetWakeSourceList(Device, &wakeSourceList); + + auto const wakeSourceCount = NetWakeSourceListGetCount(&wakeSourceList); + size_t numberOfPowerFilters = 0; + + // Count how many power filters are currently stored for this device + for (size_t i = 0; i < wakeSourceCount; i++) + { + auto wakeSource = NetWakeSourceListGetElement(&wakeSourceList, i); + auto const wakeSourceType = NetWakeSourceGetType(wakeSource); + + if (wakeSourceType == NetWakeSourceTypeBitmapPattern) + { + numberOfPowerFilters++; + } + } + + auto const deviceContext = WmbClassGetDeviceContext(Device); + auto const maxPowerFilters = deviceContext->BusParams.PowerFiltersSupported; + + NT_ASSERT(numberOfPowerFilters <= maxPowerFilters); + + if (numberOfPowerFilters == maxPowerFilters) + { + return STATUS_NDIS_PM_WOL_PATTERN_LIST_FULL; + } + + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ NTSTATUS EvtDeviceArmWakeFromS0(WDFDEVICE Device) +{ + PWMBCLASS_DEVICE_CONTEXT deviceContext = WmbClassGetDeviceContext(Device); + deviceContext->m_armedWake = true; + MbbBusSetNotificationState(deviceContext->BusHandle, FALSE); + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ VOID EvtDeviceDisarmWakeFromS0(WDFDEVICE Device) +{ + PWMBCLASS_DEVICE_CONTEXT deviceContext = WmbClassGetDeviceContext(Device); + deviceContext->m_armedWake = false; +} diff --git a/network/wwan/cxwmbclass/rxqueue.cpp b/network/wwan/cxwmbclass/rxqueue.cpp new file mode 100644 index 00000000..836201a5 --- /dev/null +++ b/network/wwan/cxwmbclass/rxqueue.cpp @@ -0,0 +1,602 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#include "precomp.h" + +#include "device.h" +#include "rxqueue.h" + +#define MBB_NTH_GET_FIRST_NDP_OFFSET(IS32BIT, NTH) \ + ((IS32BIT) ? MBB_NTH32_GET_FIRST_NDP_OFFSET((PNCM_NTH32)NTH) : MBB_NTH16_GET_FIRST_NDP_OFFSET((PNCM_NTH16)NTH)) + +void MbbNotifyRxReady(_In_ NETPACKETQUEUE RxQueue) +{ + PMBB_RXQUEUE_CONTEXT rxQueueContext = MbbGetRxQueueContext(RxQueue); + if (InterlockedExchange(&rxQueueContext->NotificationEnabled, FALSE) == TRUE) + { + NetRxQueueNotifyMoreReceivedPacketsAvailable(RxQueue); + } +} + +VOID MbbRecvCleanup(_In_ PMBB_NDIS_RECEIVE_CONTEXT Receive) +{ + MbbBusReturnReceiveBuffer(Receive->BusHandle, Receive->BusContext, Receive->Mdl); + + WdfObjectDelete(Receive->ReceiveLookasideBufferMemory); +} + +VOID MbbRecvReturnNdp(_In_ PMBB_NDIS_RECEIVE_CONTEXT ReceiveContext, _In_opt_ PMBB_RECEIVE_NDP_CONTEXT ReceiveNdpContext) +{ + LONG newCompletedCount = InterlockedIncrement(&ReceiveContext->CompletedNdpCount); + if (newCompletedCount == ReceiveContext->TotalNdpCount) + { + MbbRecvCleanup(ReceiveContext); + } + if (ReceiveNdpContext != NULL) + { + WdfObjectDelete(ReceiveNdpContext->ReceiveNdpLookasideBufferMemory); + } +} + +_Use_decl_annotations_ VOID MbbRecvCancelNdps(PWMBCLASS_DEVICE_CONTEXT DeviceContext, ULONG SessionId) +{ + LIST_ENTRY tempList; + PLIST_ENTRY listEntry; + PLIST_ENTRY nextEntry; + PMBB_RECEIVE_NDP_CONTEXT receiveNdpContext = NULL; + PWMBCLASS_NETADAPTER_CONTEXT netAdapterContext = DeviceContext->Sessions[SessionId].NetAdapterContext; + + InitializeListHead(&tempList); + + WdfSpinLockAcquire(DeviceContext->Sessions[SessionId].WdfRecvSpinLock); + InsertHeadList(&netAdapterContext->ReceiveNdpList, &tempList); + RemoveEntryList(&netAdapterContext->ReceiveNdpList); + InitializeListHead(&netAdapterContext->ReceiveNdpList); + // Cannot cache the received Ndps anymore + netAdapterContext->AllowRxTraffic = FALSE; + WdfSpinLockRelease(DeviceContext->Sessions[SessionId].WdfRecvSpinLock); + + for (listEntry = tempList.Flink; listEntry != &tempList; listEntry = nextEntry) + { + nextEntry = listEntry->Flink; + receiveNdpContext = CONTAINING_RECORD(listEntry, MBB_RECEIVE_NDP_CONTEXT, ReceiveNdpNode); + MbbRecvReturnNdp(receiveNdpContext->ReceiveContext, receiveNdpContext); + } +} + +void MbbReceiveDssData(__in PWMBCLASS_DEVICE_CONTEXT DeviceContext, __in ULONG SessionId, __in_bcount_opt(InBufferSize) PUCHAR InBuffer, __in ULONG InBufferSize) +{ + NTSTATUS status; + WDFMEMORY data; + + status = WdfMemoryCreatePreallocated(WDF_NO_OBJECT_ATTRIBUTES, InBuffer, InBufferSize, &data); + + if (NT_SUCCESS(status)) + { + DeviceContext->DSSPacketsReceivedCount++; + + MbbDeviceReceiveDeviceServiceSessionData(DeviceContext->WdfDevice, SessionId, data); + WdfObjectDelete(data); + } +} + +NTSTATUS +MbbRecvNdpUnpackDss32(_In_ PMBB_NDIS_RECEIVE_CONTEXT ReceiveContext, _In_ PNCM_NTH32 Nth, _In_ PNCM_NDP32 Ndp) +{ + UNREFERENCED_PARAMETER(Nth); + NTSTATUS status = STATUS_SUCCESS; + ULONG datagramCount = MBB_NDP32_GET_DATAGRAM_COUNT(Ndp); + ULONG sessionId = MBB_NDP32_GET_SESSIONID(Ndp); + for (ULONG index = 0; index < datagramCount; index++) + { + if (MBB_NTB32_IS_END_DATAGRAM(Nth, Ndp, index)) + break; + + // Forward to the dss receive handler + MbbReceiveDssData( + ReceiveContext->WmbDeviceContext, sessionId, (PUCHAR)MBB_NDP32_GET_DATAGRAM(Nth, Ndp, index), MBB_NDP32_GET_DATAGRAM_LENGTH(Ndp, index)); + } + + MbbRecvReturnNdp(ReceiveContext, NULL); + return status; +} + +NTSTATUS +MbbRecvNdpUnpackDss16(_In_ PMBB_NDIS_RECEIVE_CONTEXT ReceiveContext, _In_ PNCM_NTH16 Nth, _In_ PNCM_NDP16 Ndp) +{ + UNREFERENCED_PARAMETER(Nth); + NTSTATUS status = STATUS_SUCCESS; + ULONG datagramCount = MBB_NDP16_GET_DATAGRAM_COUNT(Ndp); + ULONG sessionId = MBB_NDP16_GET_SESSIONID(Ndp); + for (ULONG index = 0; index < datagramCount; index++) + { + if (MBB_NTB16_IS_END_DATAGRAM(Nth, Ndp, index)) + break; + + // Forward to the dss receive handler + MbbReceiveDssData( + ReceiveContext->WmbDeviceContext, sessionId, (PUCHAR)MBB_NDP16_GET_DATAGRAM(Nth, Ndp, index), MBB_NDP16_GET_DATAGRAM_LENGTH(Ndp, index)); + } + MbbRecvReturnNdp(ReceiveContext, NULL); + return status; +} + +NTSTATUS +MbbRecvAddNdp(_In_ PMBB_NDIS_RECEIVE_CONTEXT ReceiveContext, _In_ PVOID Nth, _In_ PVOID Ndp, _In_ ULONG SessionId) +{ + NTSTATUS status = STATUS_SUCCESS; + PWMBCLASS_DEVICE_CONTEXT deviceContext = ReceiveContext->WmbDeviceContext; + PWMBCLASS_NETADAPTER_CONTEXT netAdapterContext = NULL; + WDFMEMORY ndpContextMemory; + PMBB_RECEIVE_NDP_CONTEXT ndpContext = NULL; + size_t ndpContextSize; + BOOLEAN returnNdp = FALSE; + + WdfSpinLockAcquire(deviceContext->Sessions[SessionId].WdfRecvSpinLock); + do + { + netAdapterContext = deviceContext->Sessions[SessionId].NetAdapterContext; + if (netAdapterContext == NULL) + { + returnNdp = TRUE; + break; + } + + if (!NT_SUCCESS(status = WdfMemoryCreateFromLookaside(netAdapterContext->ReceiveNdpLookasideList, &ndpContextMemory))) + { + returnNdp = TRUE; + break; + } + + ndpContext = (PMBB_RECEIVE_NDP_CONTEXT)WdfMemoryGetBuffer(ndpContextMemory, &ndpContextSize); + RtlZeroMemory(ndpContext, ndpContextSize); + ndpContext->Nth = Nth; + ndpContext->Ndp = Ndp; + ndpContext->ReceiveContext = ReceiveContext; + ndpContext->ReceiveNdpLookasideBufferMemory = ndpContextMemory; + ndpContext->NetAdapterContext = netAdapterContext; + if (netAdapterContext->AllowRxTraffic) + { + InsertTailList(&netAdapterContext->ReceiveNdpList, &ndpContext->ReceiveNdpNode); + } + else + { + returnNdp = TRUE; + break; + } + + // If RxQueueCreate hasn't completed yet, we only queue the received Ndp and don't need notify RxReady + if (netAdapterContext->RxQueue) + { + MbbNotifyRxReady(netAdapterContext->RxQueue); + } + } while (FALSE); + WdfSpinLockRelease(deviceContext->Sessions[SessionId].WdfRecvSpinLock); + + if (returnNdp) + { + MbbRecvReturnNdp(ReceiveContext, ndpContext); + } + return status; +} + +VOID MbbRecvNtbParse(_In_ PMBB_NDIS_RECEIVE_CONTEXT ReceiveContext) +{ + NTSTATUS status = STATUS_SUCCESS; + PNCM_NTH32 nth32; + PNCM_NTH16 nth16; + PNCM_NDP32 ndp32; + PNCM_NDP16 ndp16; + PVOID nth = ReceiveContext->ReceiveNtbBuffer; + + if (MBB_NTB_IS_32BIT(nth)) + { + nth32 = (PNCM_NTH32)nth; + for (ndp32 = MBB_NTH32_GET_FIRST_NDP(nth32); ndp32 != NULL; ndp32 = MBB_NDP32_GET_NEXT_NDP(nth32, ndp32)) + { + if (MBB_NDP32_GET_SIGNATURE_TYPE(ndp32) == NCM_NDP32_VENDOR) + { + status = MbbRecvNdpUnpackDss32(ReceiveContext, nth32, ndp32); + if (!NT_SUCCESS(status)) + { + } + } + else if (MBB_NDP32_GET_SIGNATURE_TYPE(ndp32) == NCM_NDP32_IPS) + { + status = MbbRecvAddNdp(ReceiveContext, nth32, ndp32, MBB_NDP32_GET_SESSIONID(ndp32)); + if (!NT_SUCCESS(status)) + { + } + } + else + { + MbbRecvReturnNdp(ReceiveContext, NULL); + } + } + } + else if (MBB_NTB_IS_16BIT(nth)) + { + nth16 = (PNCM_NTH16)nth; + for (ndp16 = MBB_NTH16_GET_FIRST_NDP(nth16); ndp16 != NULL; ndp16 = MBB_NDP16_GET_NEXT_NDP(nth16, ndp16)) + { + if (MBB_NDP16_GET_SIGNATURE_TYPE(ndp16) == NCM_NDP16_VENDOR) + { + status = MbbRecvNdpUnpackDss16(ReceiveContext, nth16, ndp16); + if (!NT_SUCCESS(status)) + { + } + } + else if (MBB_NDP16_GET_SIGNATURE_TYPE(ndp16) == NCM_NDP16_IPS) + { + status = MbbRecvAddNdp(ReceiveContext, nth16, ndp16, MBB_NDP32_GET_SESSIONID(ndp16)); + if (!NT_SUCCESS(status)) + { + } + } + else + { + MbbRecvReturnNdp(ReceiveContext, NULL); + } + } + } +} + +NTSTATUS +MbbRecvNtbUnpackIpNdp32(_In_ PMBB_RECEIVE_NDP_CONTEXT ReceiveNdpContext, _In_ PNCM_NTH32 Nth32, _In_ PNCM_NDP32 Ndp32, _Inout_ ULONG* IncompletedDatagramIndex, _In_ PMBB_RXQUEUE_CONTEXT RxQueueContext) +{ + PCHAR incompletedDatagram; + ULONG incompletedDatagramLength; + NET_PACKET* packet; + NET_FRAGMENT* fragment; + NET_FRAGMENT_RETURN_CONTEXT* returnContext; + NET_FRAGMENT_VIRTUAL_ADDRESS* virtualAddress; + NTSTATUS status = STATUS_SUCCESS; + ULONG datagramCount = MBB_NDP32_GET_DATAGRAM_COUNT(Ndp32); + + NET_RING * pr = NetRingCollectionGetPacketRing(RxQueueContext->DatapathDescriptor); + NET_RING * fr = NetRingCollectionGetFragmentRing(RxQueueContext->DatapathDescriptor); + + while ((incompletedDatagram = MBB_NDP32_GET_DATAGRAM(Nth32, Ndp32, *IncompletedDatagramIndex)) != NULL) + { + if (*IncompletedDatagramIndex >= datagramCount) + { + break; + } + + if (fr->BeginIndex == fr->EndIndex) + { + status = STATUS_BUFFER_OVERFLOW; + break; + } + + incompletedDatagramLength = MBB_NDP32_GET_DATAGRAM_LENGTH(Ndp32, *IncompletedDatagramIndex); + + UINT32 const fragmentIndex = fr->BeginIndex; + fragment = NetRingGetFragmentAtIndex(fr, fragmentIndex); + fragment->Capacity = incompletedDatagramLength; + fragment->ValidLength = incompletedDatagramLength; + fragment->Offset = 0; + + returnContext = NetExtensionGetFragmentReturnContext(&RxQueueContext->ReturnContextExtension, fragmentIndex); + virtualAddress = + NetExtensionGetFragmentVirtualAddress(&RxQueueContext->VirtualAddressExtension, fragmentIndex); + + + returnContext->Handle = (NET_FRAGMENT_RETURN_CONTEXT_HANDLE)ReceiveNdpContext; + virtualAddress->VirtualAddress = incompletedDatagram; + + (ReceiveNdpContext->IndicatedPackets)++; + (*IncompletedDatagramIndex)++; + + UINT32 const packetIndex = pr->BeginIndex; + packet = NetRingGetPacketAtIndex(pr, packetIndex); + packet->FragmentIndex = fragmentIndex; + packet->FragmentCount = 1; + packet->Layout = {}; + + pr->BeginIndex = NetRingIncrementIndex(pr, pr->BeginIndex); + fr->BeginIndex = NetRingIncrementIndex(fr, fr->BeginIndex); + } + return status; +} + +NTSTATUS +MbbRecvNtbUnpackIpNdp16(_In_ PMBB_RECEIVE_NDP_CONTEXT ReceiveNdpContext, _In_ PNCM_NTH16 Nth16, _In_ PNCM_NDP16 Ndp16, _Inout_ ULONG* IncompletedDatagramIndex, _In_ PMBB_RXQUEUE_CONTEXT RxQueueContext) +{ + PCHAR incompletedDatagram; + ULONG incompletedDatagramLength; + NET_PACKET* packet; + NET_FRAGMENT* fragment; + NET_FRAGMENT_RETURN_CONTEXT* returnContext; + NET_FRAGMENT_VIRTUAL_ADDRESS* virtualAddress; + NTSTATUS status = STATUS_SUCCESS; + ULONG datagramCount = MBB_NDP16_GET_DATAGRAM_COUNT(Ndp16); + + NET_RING * pr = NetRingCollectionGetPacketRing(RxQueueContext->DatapathDescriptor); + NET_RING * fr = NetRingCollectionGetFragmentRing(RxQueueContext->DatapathDescriptor); + + while ((incompletedDatagram = MBB_NDP16_GET_DATAGRAM(Nth16, Ndp16, *IncompletedDatagramIndex)) != NULL) + { + if (*IncompletedDatagramIndex >= datagramCount) + { + break; + } + + if (fr->BeginIndex == fr->EndIndex) + { + status = STATUS_BUFFER_OVERFLOW; + break; + } + + incompletedDatagramLength = MBB_NDP16_GET_DATAGRAM_LENGTH(Ndp16, *IncompletedDatagramIndex); + + UINT32 const fragmentIndex = fr->BeginIndex; + fragment = NetRingGetFragmentAtIndex(fr, fragmentIndex); + fragment->Capacity = incompletedDatagramLength; + fragment->ValidLength = incompletedDatagramLength; + fragment->Offset = 0; + + returnContext = NetExtensionGetFragmentReturnContext(&RxQueueContext->ReturnContextExtension, fragmentIndex); + virtualAddress = + NetExtensionGetFragmentVirtualAddress(&RxQueueContext->VirtualAddressExtension, fragmentIndex); + + returnContext->Handle = (NET_FRAGMENT_RETURN_CONTEXT_HANDLE)ReceiveNdpContext; + virtualAddress->VirtualAddress = incompletedDatagram; + + (ReceiveNdpContext->IndicatedPackets)++; + (*IncompletedDatagramIndex)++; + + UINT32 const packetIndex = pr->BeginIndex; + packet = NetRingGetPacketAtIndex(pr, packetIndex); + packet->FragmentIndex = fragmentIndex; + packet->FragmentCount = 1; + packet->Layout = {}; + + pr->BeginIndex = NetRingIncrementIndex(pr, pr->BeginIndex); + fr->BeginIndex = NetRingIncrementIndex(fr, fr->BeginIndex); + } + + return status; +} + +NTSTATUS +MbbRecvNdpUnpackIps(_In_ PMBB_RECEIVE_NDP_CONTEXT ReceiveNdpContext, _In_ PMBB_RXQUEUE_CONTEXT RxQueueContext) +{ + NTSTATUS status = STATUS_SUCCESS; + PNCM_NTH32 nth32; + PNCM_NTH16 nth16; + PNCM_NDP32 ndp32; + PNCM_NDP16 ndp16; + PMBB_NDIS_RECEIVE_CONTEXT receiveContext = ReceiveNdpContext->ReceiveContext; + PVOID nth = receiveContext->ReceiveNtbBuffer; + + if (MBB_NTB_IS_32BIT(nth)) + { + nth32 = (PNCM_NTH32)nth; + ndp32 = (PNCM_NDP32)ReceiveNdpContext->Ndp; + status = MbbRecvNtbUnpackIpNdp32(ReceiveNdpContext, nth32, ndp32, &ReceiveNdpContext->CurrentDatagramIndex, RxQueueContext); + } + else if (MBB_NTB_IS_16BIT(nth)) + { + nth16 = (PNCM_NTH16)nth; + ndp16 = (PNCM_NDP16)ReceiveNdpContext->Ndp; + status = MbbRecvNtbUnpackIpNdp16(ReceiveNdpContext, nth16, ndp16, &ReceiveNdpContext->CurrentDatagramIndex, RxQueueContext); + } + + return status; +} + +PMBB_NDIS_RECEIVE_CONTEXT +MbbRecvQQueueReceive(_In_ PWMBCLASS_DEVICE_CONTEXT DeviceContext, _In_ MBB_RECEIVE_CONTEXT BusContext, _In_ PMDL Mdl, _In_reads_(sizeof(NCM_NTH32)) PUCHAR ReceiveNtbBuffer) +{ + PMBB_NDIS_RECEIVE_CONTEXT receiveContext = NULL; + WDFMEMORY receiveContextMemory; + size_t receiveContextSize; + NTSTATUS status = STATUS_SUCCESS; + + do + { + if (!NT_SUCCESS(status = WdfMemoryCreateFromLookaside(DeviceContext->ReceiveLookasideList, &receiveContextMemory))) + { + break; + } + + receiveContext = (PMBB_NDIS_RECEIVE_CONTEXT)WdfMemoryGetBuffer(receiveContextMemory, &receiveContextSize); + RtlZeroMemory(receiveContext, receiveContextSize); + + receiveContext->Mdl = Mdl; + receiveContext->WmbDeviceContext = DeviceContext; + receiveContext->BusHandle = DeviceContext->BusHandle; + receiveContext->BusContext = BusContext; + receiveContext->ReceiveLookasideList = DeviceContext->ReceiveLookasideList; + receiveContext->ReceiveLookasideBufferMemory = receiveContextMemory; + receiveContext->ReceiveNtbBuffer = ReceiveNtbBuffer; + receiveContext->NtbSequence = MBB_NTB_GET_SEQUENCE(ReceiveNtbBuffer); + } while (FALSE); + + return receiveContext; +} + +VOID MbbNdisReceiveCallback(_In_ MBB_PROTOCOL_HANDLE ProtocolHandle, _In_ MBB_RECEIVE_CONTEXT ReceiveContext, _In_ PMDL Mdl) +{ + PUCHAR dataBuffer; + ULONG dataLength; + PVOID nth; + BOOLEAN returnBuffer = TRUE; + PWMBCLASS_DEVICE_CONTEXT deviceContext = (PWMBCLASS_DEVICE_CONTEXT)ProtocolHandle; + PMBB_NDIS_RECEIVE_CONTEXT receive = NULL; + ULONG ndpCount = 1; + NTSTATUS status = STATUS_SUCCESS; + do + { + if ((dataBuffer = (PUCHAR)MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority | MdlMappingNoExecute)) == NULL) + { + status = STATUS_RESOURCE_DATA_NOT_FOUND; + break; + } + dataLength = MmGetMdlByteCount(Mdl); + + nth = dataBuffer; + + if (!NT_SUCCESS(status = MbbNtbValidate(nth, dataLength, deviceContext->BusParams.CurrentMode32Bit, &ndpCount))) + { + { + ULONG i; + ULONG j; + + PUCHAR buffer = (PUCHAR)nth; + + for (i = 0; i < dataLength; i += 16) + { + UCHAR numString[16 * 3 + 1]; + UCHAR asciiBuffer[40]; + UCHAR value = 0; + const char translateTable[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + + RtlZeroMemory(numString, sizeof(numString)); + RtlZeroMemory(asciiBuffer, sizeof(asciiBuffer)); + + for (j = 0; j < 16; j++) + { + if (i + j >= dataLength) + { + // + // past the end, just put spaces + // + numString[j * 3] = ' '; + numString[j * 3 + 1] = ' '; + numString[j * 3 + 2] = ' '; + } + else + { + value = buffer[i + j]; + + numString[j * 3] = translateTable[value >> 4]; + numString[j * 3 + 1] = translateTable[value & 0xf]; + numString[j * 3 + 2] = ' '; + + if ((buffer[i + j] >= 32) && (buffer[i + j] < 128)) + { + asciiBuffer[j] = value; + } + else + { + asciiBuffer[j] = '.'; + } + } + } + } + } + break; + } + + if ((receive = MbbRecvQQueueReceive(deviceContext, ReceiveContext, Mdl, (PUCHAR)nth)) == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + returnBuffer = FALSE; + receive->TotalNdpCount = ndpCount; + + // Receive DSS, IPs will be received in EvtRxQueueAdvance + MbbRecvNtbParse(receive); + } while (FALSE); + + if (returnBuffer) + { + if (receive != NULL) + { + MbbRecvCleanup(receive); + } + else + { + MbbBusReturnReceiveBuffer(deviceContext->BusHandle, ReceiveContext, Mdl); + } + } +} + +void EvtRxQueueDestroy(_In_ WDFOBJECT RxQueue) +{ + PMBB_RXQUEUE_CONTEXT rxQueueContext = MbbGetRxQueueContext(RxQueue); + PWMBCLASS_NETADAPTER_CONTEXT netAdapterContext = rxQueueContext->NetAdapterContext; + netAdapterContext->RxQueue = NULL; +} + +VOID EvtRxQueueSetNotificationEnabled(_In_ NETPACKETQUEUE RxQueue, _In_ BOOLEAN NotificationEnabled) +{ + PMBB_RXQUEUE_CONTEXT txQueueContext = MbbGetRxQueueContext(RxQueue); + InterlockedExchange(&txQueueContext->NotificationEnabled, NotificationEnabled); +} + +void EvtRxQueueAdvance(_In_ NETPACKETQUEUE RxQueue) +{ + PMBB_RXQUEUE_CONTEXT rxQueueContext = MbbGetRxQueueContext(RxQueue); + PWMBCLASS_NETADAPTER_CONTEXT netAdapterContext = rxQueueContext->NetAdapterContext; + WDFSPINLOCK wdfRecvSpinLock = netAdapterContext->WmbDeviceContext->Sessions[netAdapterContext->SessionId].WdfRecvSpinLock; + PMBB_RECEIVE_NDP_CONTEXT receiveNdpContext; + NTSTATUS status = STATUS_SUCCESS; + + WdfSpinLockAcquire(wdfRecvSpinLock); + while (!IsListEmpty(&netAdapterContext->ReceiveNdpList)) + { + receiveNdpContext = CONTAINING_RECORD(RemoveHeadList(&netAdapterContext->ReceiveNdpList), MBB_RECEIVE_NDP_CONTEXT, ReceiveNdpNode); + receiveNdpContext->ReceiveNdpNode.Flink = receiveNdpContext->ReceiveNdpNode.Blink = NULL; + WdfSpinLockRelease(wdfRecvSpinLock); + + status = MbbRecvNdpUnpackIps(receiveNdpContext, rxQueueContext); + if (status == STATUS_BUFFER_OVERFLOW) + { + WdfSpinLockAcquire(wdfRecvSpinLock); + InsertHeadList(&netAdapterContext->ReceiveNdpList, &receiveNdpContext->ReceiveNdpNode); + break; + } + else + { + if (!NT_SUCCESS(status)) + { + } + } + + WdfSpinLockAcquire(wdfRecvSpinLock); + } + WdfSpinLockRelease(wdfRecvSpinLock); +} + +void EvtRxQueueCancel(_In_ NETPACKETQUEUE RxQueue) +{ + PMBB_RXQUEUE_CONTEXT rxQueueContext = MbbGetRxQueueContext(RxQueue); + PWMBCLASS_NETADAPTER_CONTEXT netAdapterContext = rxQueueContext->NetAdapterContext; + PWMBCLASS_DEVICE_CONTEXT deviceContext = netAdapterContext->WmbDeviceContext; + NET_RING_COLLECTION const* rings = rxQueueContext->DatapathDescriptor; + + NET_RING * pr = NetRingCollectionGetPacketRing(rings); + + while (pr->BeginIndex != pr->EndIndex) + { + NET_PACKET * packet = NetRingGetPacketAtIndex(pr, pr->BeginIndex); + packet->Ignore = 1; + pr->BeginIndex = NetRingIncrementIndex(pr, pr->BeginIndex); + } + + NET_RING * fr = NetRingCollectionGetFragmentRing(rings); + fr->BeginIndex = fr->EndIndex; + + // Cancel received Ndps which may be received after EvtRxQueueCancel started, these Ndps may never be processed by EvtRxQueueAdvance + MbbRecvCancelNdps(deviceContext, netAdapterContext->SessionId); +} + +VOID EvtAdapterReturnRxBuffer(_In_ NETADAPTER Adapter, _In_ NET_FRAGMENT_RETURN_CONTEXT_HANDLE RxBufferReturnContext) +{ + PMBB_RECEIVE_NDP_CONTEXT receiveNdpContext = (PMBB_RECEIVE_NDP_CONTEXT)RxBufferReturnContext; + UNREFERENCED_PARAMETER(Adapter); + NT_ASSERT(receiveNdpContext->IndicatedPackets); + + receiveNdpContext->IndicatedPackets--; + if ((receiveNdpContext->IndicatedPackets == 0) && (receiveNdpContext->ReceiveNdpNode.Blink == NULL) && + (receiveNdpContext->ReceiveNdpNode.Flink == NULL)) + { + MbbRecvReturnNdp(receiveNdpContext->ReceiveContext, receiveNdpContext); + } +} diff --git a/network/wwan/cxwmbclass/sources.inc b/network/wwan/cxwmbclass/sources.inc new file mode 100644 index 00000000..7b1e526c --- /dev/null +++ b/network/wwan/cxwmbclass/sources.inc @@ -0,0 +1,12 @@ +MBBCX_MAJOR_VERSION=1 +MBBCX_MINOR_VERSION=0 + +MBBCX_VERSION=$(MBBCX_MAJOR_VERSION).$(MBBCX_MINOR_VERSION) + +MBBCX_DDK_INC_PATH=$(ONECORE_EXTERNAL_DDK_INC_PATH)\mbbcx\$(MBBCX_VERSION) +MBBCX_DDK_LIB_PATH=$(ONECORE_EXTERNAL_DDK_LIB_PATH)\mbbcx\$(MBBCX_VERSION) + +KMDF_VERSION_MAJOR=1 +KMDF_VERSION_MINOR=31 +KMDF_VERSION=$(KMDF_VERSION_MAJOR).$(KMDF_VERSION_MINOR) +KMDF_DDK_INC_PATH=$(ONECORE_INTERNAL_DDK_INC_PATH)\wdf\kmdf\$(KMDF_VERSION); diff --git a/network/wwan/cxwmbclass/txqueue.cpp b/network/wwan/cxwmbclass/txqueue.cpp new file mode 100644 index 00000000..9708b8b2 --- /dev/null +++ b/network/wwan/cxwmbclass/txqueue.cpp @@ -0,0 +1,988 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#include "precomp.h" + +#include "device.h" +#include "txqueue.h" + +void MbbNotifyTxReady(_In_ NETPACKETQUEUE TxQueue) +{ + PMBB_TXQUEUE_CONTEXT txQueueContext = MbbGetTxQueueContext(TxQueue); + + if (InterlockedExchange(&txQueueContext->NotificationEnabled, FALSE) == TRUE) + { + NetTxQueueNotifyMoreCompletedPacketsAvailable(TxQueue); + } +} + +ULONG +MbbGetNetPacketDataLength(_In_ NET_PACKET* NetPacket, _In_ NET_RING_COLLECTION const* Rings) +{ + ULONG length = 0; + auto fr = NetRingCollectionGetFragmentRing(Rings); + for (UINT32 i = 0; i < NetPacket->FragmentCount; i++) + { + auto fragment = NetRingGetFragmentAtIndex(fr, (NetPacket->FragmentIndex + i) & fr->ElementIndexMask); + length += static_cast(fragment->ValidLength); + } + + return length; +} + +VOID MbbPacketRestoreMdl(_In_ PMBB_PACKET_CONTEXT PacketContext) +{ + if (PacketContext->ModifiedMdl != NULL) + { + *PacketContext->ModifiedMdl = PacketContext->OriginalMdl; + PacketContext->ModifiedMdl = NULL; + } +} + +VOID MbbPacketCleanupContext(_In_ PMBB_PACKET_CONTEXT PacketContext) +{ + MbbPacketRestoreMdl(PacketContext); + if (PacketContext->PaddingMdl != NULL) + { + IoFreeMdl(PacketContext->PaddingMdl); + PacketContext->PaddingMdl = NULL; + } + if (PacketContext->DataEndMdl != NULL) + { + IoFreeMdl(PacketContext->DataEndMdl); + PacketContext->DataEndMdl = NULL; + } + if (PacketContext->DataStartMdl != NULL) + { + IoFreeMdl(PacketContext->DataStartMdl); + PacketContext->DataStartMdl = NULL; + } +} + +FORCEINLINE +PMDL MbbPacketGetFirstMdl(_In_ PMBB_PACKET_CONTEXT PacketContext) +{ + if (PacketContext->PaddingMdl != NULL) + return PacketContext->PaddingMdl; + else + return PacketContext->DataStartMdl; +} + +FORCEINLINE +PMDL MbbPacketGetLastMdl(_In_ PMBB_PACKET_CONTEXT PacketContext) +{ + if (PacketContext->DataEndMdl != NULL) + return PacketContext->DataEndMdl; + else + return PacketContext->DataStartMdl; +} + +VOID MbbPacketSaveAndSetMdl(_In_ PMBB_PACKET_CONTEXT PacketContext, _In_ PMDL MdlToSave, _In_ PMDL MdlToSet) +{ + if (PacketContext->ModifiedMdl == NULL) + { + PacketContext->ModifiedMdl = MdlToSave; + PacketContext->OriginalMdl = *MdlToSave; + } + *MdlToSave = *MdlToSet; +} + +VOID MbbCleanupDssPacket(_In_ PDSS_PACKET Packet) +{ + if (Packet->Mdl != NULL) + { + IoFreeMdl(Packet->Mdl); + } + if (Packet != NULL) + { + FREE_POOL(Packet); + } +} + +VOID MbbNtbCleanupContext(_In_ PMBB_NTB_BUILD_CONTEXT NtbContext, _In_ NTSTATUS NtStatus) +{ + ULONG DatagramIndex; + BOOLEAN NeedReturnCompletedPackets = FALSE; + + for (DatagramIndex = 0; DatagramIndex < NtbContext->DatagramCount; DatagramIndex++) + { + MbbPacketCleanupContext(&NtbContext->NdpDatagramEntries[DatagramIndex].NetPacketContext); + if (NtbContext->NdpDatagramEntries[DatagramIndex].NdpType == MbbNdpTypeIps) + { + NtbContext->NdpDatagramEntries[DatagramIndex].NetPacket->Scratch = 1; + NeedReturnCompletedPackets = TRUE; + } + else if (NtbContext->NdpDatagramEntries[DatagramIndex].NdpType == MbbNdpTypeVendor_1) + { + MbbDeviceSendDeviceServiceSessionDataComplete(NtbContext->NdpDatagramEntries[DatagramIndex].DssPacket->Data, NtStatus); + + MbbCleanupDssPacket(NtbContext->NdpDatagramEntries[DatagramIndex].DssPacket); + } + } + if (NtbContext->NdpMdl != NULL) + { + IoFreeMdl(NtbContext->NdpMdl); + } + if (NtbContext->NthMdl != NULL) + { + IoFreeMdl(NtbContext->NthMdl); + } + if (NtbContext->NdpBufferMemory != NULL) + { + WdfObjectDelete(NtbContext->NdpBufferMemory); + } +#if DBG + if (NtbContext->ScratchBuffer != NULL) + { + FREE_POOL(NtbContext->ScratchBuffer); + } +#endif + if (NeedReturnCompletedPackets) + { + MbbNotifyTxReady(NtbContext->NetTxQueue); + } + WdfObjectDelete(NtbContext->NtbLookasideBufferMemory); +} + +FORCEINLINE +ULONG +MbbSendQGetNtbSequence(_In_ PWMBCLASS_DEVICE_CONTEXT DeviceContext) +{ + return InterlockedIncrement(&DeviceContext->NtbSequenceNumber); +} + +PMBB_NTB_BUILD_CONTEXT +MbbNtbAllocateContext(_In_ WDFLOOKASIDE NtbLookasideList, _In_ PMBB_BUS_PARAMETERS BusParams, _In_ PVOID PaddingBuffer, _In_ ULONG NtbSequence) +{ + NTSTATUS status = NDIS_STATUS_SUCCESS; + size_t ntbSize; + PMBB_NTB_BUILD_CONTEXT ntbContext = NULL; + WDFMEMORY ntbContextMemory; + + do + { +#pragma prefast(suppress \ + : __WARNING_MEMORY_LEAK, "By Design: Allocate ntb context from lookaside pool, released when send completes.") + if (!NT_SUCCESS(status = WdfMemoryCreateFromLookaside(NtbLookasideList, &ntbContextMemory))) + { + break; + } + + ntbContext = (PMBB_NTB_BUILD_CONTEXT)WdfMemoryGetBuffer(ntbContextMemory, &ntbSize); + RtlZeroMemory(ntbContext, ntbSize); + ntbContext->PaddingBuffer = PaddingBuffer; + ntbContext->NtbLookasideList = NtbLookasideList; + ntbContext->NtbLookasideBufferMemory = ntbContextMemory; + +#if DBG + ntbContext->ScratchLength = BusParams->MaxOutNtb; + if ((ntbContext->ScratchBuffer = (PCHAR)ALLOCATE_NONPAGED_POOL(ntbContext->ScratchLength)) == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + break; + } +#endif + // + // Initialize the NTH and the NTH MDL. + // + if ((ntbContext->IsNtb32Bit = BusParams->CurrentMode32Bit) == TRUE) + { + if ((ntbContext->NthMdl = AllocateNonPagedMdl(&ntbContext->Nth32, sizeof(ntbContext->Nth32))) == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + ntbContext->Nth32.dwSignature = NCM_NTH32_SIG; + ntbContext->Nth32.wHeaderLength = sizeof(NCM_NTH32); + ntbContext->Nth32.wSequence = (USHORT)NtbSequence; + + ntbContext->NtbHeaderSize = sizeof(NCM_NTH32); + ntbContext->NdpHeaderFixedSize = sizeof(NCM_NDP32); + ntbContext->NdpDatagramEntrySize = sizeof(NCM_NDP32_DATAGRAM); + } + else + { + if ((ntbContext->NthMdl = AllocateNonPagedMdl(&ntbContext->Nth16, sizeof(ntbContext->Nth16))) == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + ntbContext->Nth16.dwSignature = NCM_NTH16_SIG; + ntbContext->Nth16.wHeaderLength = sizeof(NCM_NTH16); + ntbContext->Nth16.wSequence = (USHORT)NtbSequence; + + ntbContext->NtbHeaderSize = sizeof(NCM_NTH16); + ntbContext->NdpHeaderFixedSize = sizeof(NCM_NDP16); + ntbContext->NdpDatagramEntrySize = sizeof(NCM_NDP16_DATAGRAM); + } + + ntbContext->NtbOutMaxSize = BusParams->MaxOutNtb; + ntbContext->NtbOutMaxDatagrams = BusParams->MaxOutDatagrams; + ntbContext->NdpOutDivisor = BusParams->NdpOutDivisor; + ntbContext->NdpOutPayloadRemainder = BusParams->NdpOutRemainder; + ntbContext->NdpOutAlignment = BusParams->NdpOutAlignment; + } while (FALSE); + + if (!NT_SUCCESS(status)) + { + if (ntbContext != NULL) + { + MbbNtbCleanupContext(ntbContext, status); + } + ntbContext = NULL; + } + return ntbContext; +} + +NTSTATUS +MbbFillPacketContext( + _In_ PMBB_PACKET_CONTEXT PacketContext, + _In_ PMDL PacketDataStartMdl, + _In_ ULONG PacketDataStartMdlDataOffset, + _In_ ULONG DatagramLength, + _In_ PVOID PaddingBuffer, + _In_ ULONG PaddingLength) +{ + ULONG packetDataStartMdlDataLength; + PCHAR packetDataStartBuffer; + PMDL packetDataEndMdl; + ULONG packetDataEndMdlDataLength; + PCHAR packetDataEndBuffer; + PMDL packetMdl; + ULONG packetMdlOffset; + ULONG packetMdlLength; + PMDL packetPenultimateMdl; + NTSTATUS status = STATUS_SUCCESS; + + do + { + if ((packetDataStartBuffer = (PCHAR)MmGetSystemAddressForMdlSafe(PacketDataStartMdl, NormalPagePriority | MdlMappingNoExecute)) == NULL) + { + status = STATUS_RESOURCE_DATA_NOT_FOUND; + break; + } + packetDataStartBuffer += PacketDataStartMdlDataOffset; + // + // Create new DataStart and DataEnd Mdls + // to remove the unused data space. + // + packetDataStartMdlDataLength = MmGetMdlByteCount(PacketDataStartMdl); + packetDataStartMdlDataLength -= PacketDataStartMdlDataOffset; + + if ((PacketContext->DataStartMdl = + AllocateNonPagedMdl(packetDataStartBuffer, (ULONG)(MIN(DatagramLength, packetDataStartMdlDataLength)))) == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + PacketContext->DataStartMdl->Next = PacketDataStartMdl->Next; + // + // Find the end MDL and the amount of data in the end MDL + // + packetMdl = PacketDataStartMdl; + packetMdlOffset = PacketDataStartMdlDataOffset; + packetPenultimateMdl = NULL; + + for (packetDataEndMdlDataLength = (ULONG)DatagramLength; packetDataEndMdlDataLength > (MmGetMdlByteCount(packetMdl) - packetMdlOffset); + packetDataEndMdlDataLength -= packetMdlLength) + { + packetPenultimateMdl = packetMdl; + packetMdlLength = MmGetMdlByteCount(packetMdl) - packetMdlOffset; + packetMdlOffset = 0; + packetMdl = packetMdl->Next; + } + packetDataEndMdl = packetMdl; + // + // If the starting and ending MDLs are not the same + // then build another partial MDL removing any unused + // data space. + // + if (packetDataEndMdl != PacketDataStartMdl) + { + if ((packetDataEndBuffer = (PCHAR)MmGetSystemAddressForMdlSafe(packetDataEndMdl, NormalPagePriority | MdlMappingNoExecute)) == NULL) + { + status = STATUS_RESOURCE_DATA_NOT_FOUND; + break; + } + + if ((PacketContext->DataEndMdl = AllocateNonPagedMdl(packetDataEndBuffer, packetDataEndMdlDataLength)) == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + PacketContext->DataEndMdl->Next = NULL; + + if (packetPenultimateMdl != PacketDataStartMdl) + { + MDL TempMdl = *packetPenultimateMdl; + TempMdl.Next = PacketContext->DataEndMdl; + + MbbPacketSaveAndSetMdl(PacketContext, packetPenultimateMdl, &TempMdl); + } + + if (PacketContext->DataStartMdl->Next == packetDataEndMdl) + { + PacketContext->DataStartMdl->Next = PacketContext->DataEndMdl; + } + } + // + // Allocate padding, if needed. The padding buffer is a share buffer. + // Every padding MDL points to this same buffer. The buffer contains + // all 0s. + // + if (PaddingLength != 0) + { + if ((PacketContext->PaddingMdl = AllocateNonPagedMdl(PaddingBuffer, PaddingLength)) == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + PacketContext->PaddingMdl->Next = PacketContext->DataStartMdl; + } + } while (FALSE); + + return status; +} + +VOID MbbNtbChainNb(_In_ PMBB_NTB_BUILD_CONTEXT NtbContext, _In_ PMBB_PACKET_CONTEXT PacketContext) +{ + if (NtbContext->DatagramLastMdl != NULL) + { + NtbContext->DatagramLastMdl->Next = MbbPacketGetFirstMdl(PacketContext); + } + else + { + NtbContext->NthMdl->Next = MbbPacketGetFirstMdl(PacketContext); + } + + NtbContext->DatagramLastMdl = MbbPacketGetLastMdl(PacketContext); +} + +NTSTATUS +MbbNtbAddPacket( + _In_ PMBB_NTB_BUILD_CONTEXT NtbContext, + _In_ PVOID PacketContext, + _In_ ULONG DatagramLength, + _In_ PMDL PacketDataStartMdl, + _In_ ULONG PacketDataStartMdlDataOffset, + _In_ MBB_NDP_TYPE CurrentNdpType, + _In_ ULONG SessionId) +{ + ULONG datagramOffset; + ULONG paddingLength; + ULONG ndpSize; + NTSTATUS status = STATUS_SUCCESS; + ULONG totalLength; + PMBB_PACKET_CONTEXT packetContext = NULL; + + do + { + if ((NtbContext->DatagramCount + 1) > NtbContext->NtbOutMaxDatagrams) + { + status = STATUS_BUFFER_OVERFLOW; + break; + } + + // + // Size of passed in NET_BUFFER, to be updated later in the NDP Context. + // + totalLength = NtbContext->NtbHeaderSize + NtbContext->DatagramLength; + paddingLength = ALIGN_AT_OFFSET(totalLength, NtbContext->NdpOutDivisor, NtbContext->NdpOutPayloadRemainder) - totalLength; + // + // Calculate the new NTB size based on the passed in MBB_PACKET + // + + // + // Fixed size NTH & DatagramSize along with Padding for all NDPs + // + datagramOffset = totalLength + paddingLength; + totalLength += DatagramLength + paddingLength; + + // + // Calculate NDP HeaderSize for all NDPs + // + ndpSize = totalLength; + totalLength = ALIGN(totalLength, NtbContext->NdpOutAlignment); + totalLength += NtbContext->NdpHeaderFixedSize; + totalLength += ((NtbContext->DatagramCount + 1) * NtbContext->NdpDatagramEntrySize); + ndpSize = totalLength - ndpSize; + // + // Can everything fit? + // + if (totalLength > NtbContext->NtbOutMaxSize) + { + status = STATUS_BUFFER_OVERFLOW; + break; + } + packetContext = &NtbContext->NdpDatagramEntries[NtbContext->DatagramCount].NetPacketContext; + if (!NT_SUCCESS( + status = MbbFillPacketContext( + packetContext, PacketDataStartMdl, PacketDataStartMdlDataOffset, DatagramLength, NtbContext->PaddingBuffer, paddingLength))) + { + break; + } + // + // Update the NTB Context for the new NET_BUFFER. + // + NtbContext->NdpDatagramEntries[NtbContext->DatagramCount].DatagramOffset = datagramOffset; + NtbContext->NdpDatagramEntries[NtbContext->DatagramCount].DatagramLength = DatagramLength; + NtbContext->NdpDatagramEntries[NtbContext->DatagramCount].NdpType = CurrentNdpType; + NtbContext->NdpDatagramEntries[NtbContext->DatagramCount].SessionId = SessionId; + if (CurrentNdpType == MbbNdpTypeIps) + { + NtbContext->NdpDatagramEntries[NtbContext->DatagramCount].NetPacket = (NET_PACKET*)PacketContext; + } + else if (CurrentNdpType == MbbNdpTypeVendor_1) + { + NtbContext->NdpDatagramEntries[NtbContext->DatagramCount].DssPacket = (PDSS_PACKET)PacketContext; + } + + NtbContext->NdpSize = ndpSize; + NtbContext->DatagramCount += 1; + NtbContext->DatagramLength += (DatagramLength + paddingLength); + + MbbNtbChainNb(NtbContext, packetContext); + } while (FALSE); + + if (!NT_SUCCESS(status)) + { + if (packetContext != NULL) + { + MbbPacketCleanupContext(packetContext); + } + } + return status; +} + +FORCEINLINE +PMDL MbbNtbGetMdlChainHead(_In_ PMBB_NTB_BUILD_CONTEXT NtbContext) +{ + return NtbContext->NthMdl; +} + +VOID MbbSendQCompleteNtb(_In_ MBB_PROTOCOL_HANDLE ProtocolHandle, _In_ MBB_REQUEST_HANDLE RequestHandle, _In_ NTSTATUS NtStatus, _In_ PMDL Mdl) +{ + UNREFERENCED_PARAMETER(ProtocolHandle); + PMBB_NTB_BUILD_CONTEXT ntbContext = (PMBB_NTB_BUILD_CONTEXT)RequestHandle; + PWMBCLASS_DEVICE_CONTEXT deviceContext = WmbClassGetNetAdapterContext(ntbContext->NetAdapter)->WmbDeviceContext; + UNREFERENCED_PARAMETER(Mdl); + + if (!NT_SUCCESS(NtStatus)) + { + if (NtStatus == STATUS_NDIS_ADAPTER_NOT_READY) + { + } + else if (NtStatus == STATUS_CANCELLED) + { + } + else if (NtStatus == STATUS_NO_SUCH_DEVICE) + { + } + else + { + MbbBusResetDataPipes(deviceContext->BusHandle); + } + } + + MbbNtbCleanupContext(ntbContext, NtStatus); +} + +ULONG +MbbNtbMapNdpTypeToSignature(_In_ MBB_NDP_TYPE MbbNdpType, _In_ BOOLEAN Is32Bit, _In_ ULONG SessionId) +{ + ULONG SessionMask = (SessionId << NCM_NDP_SESSION_SHIFT); + + switch (MbbNdpType) + { + case MbbNdpTypeIps: return ((Is32Bit == TRUE) ? NCM_NDP32_IPS | SessionMask : NCM_NDP16_IPS | SessionMask); + default: + if ((MbbNdpType >= MbbNdpTypeVendor_1) && (MbbNdpType <= MbbNdpTypeVendor_Max)) + { + return ((Is32Bit == TRUE) ? NCM_NDP32_VENDOR | SessionMask : NCM_NDP16_VENDOR | SessionMask); + } + } + return 0; +} + +VOID MbbNtbFillNdp32Header(_In_ PNCM_NDP32 Ndp, _In_ MBB_NDP_TYPE NdpType, _In_ PMBB_NTB_BUILD_CONTEXT NtbContext) +{ + ULONG datagramIndex = 0; + ULONG ndpDatagramIndex = 0; + PNCM_NDP32_DATAGRAM ndpDatagramEntries; + + Ndp->dwSignature = MbbNtbMapNdpTypeToSignature(NdpType, TRUE, NtbContext->NdpDatagramEntries[datagramIndex].SessionId); + Ndp->dwNextFpIndex = 0; + ndpDatagramEntries = Ndp->Datagram; + // + // Add datagram entries to the NDP Table + // + + for (datagramIndex = 0; datagramIndex < NtbContext->DatagramCount; datagramIndex++) + { + ndpDatagramEntries[ndpDatagramIndex].dwDatagramIndex = NtbContext->NdpDatagramEntries[datagramIndex].DatagramOffset; + ndpDatagramEntries[ndpDatagramIndex].dwDatagramLength = NtbContext->NdpDatagramEntries[datagramIndex].DatagramLength; + ndpDatagramIndex++; + } + // + // Terminating entry is taken in to account + // in the fixed size NDP Header. + // + ndpDatagramEntries[ndpDatagramIndex].dwDatagramIndex = 0; + ndpDatagramEntries[ndpDatagramIndex].dwDatagramLength = 0; + + Ndp->wLength = (USHORT)(NtbContext->NdpHeaderFixedSize + (ndpDatagramIndex * NtbContext->NdpDatagramEntrySize)); +} + +VOID MbbNtbFillNdp16Header(__in PNCM_NDP16 Ndp, __in MBB_NDP_TYPE NdpType, __in PMBB_NTB_BUILD_CONTEXT NtbContext) +{ + ULONG datagramIndex = 0; + ULONG ndpDatagramIndex = 0; + PNCM_NDP16_DATAGRAM ndpDatagramEntries; + + Ndp->dwSignature = MbbNtbMapNdpTypeToSignature(NdpType, FALSE, NtbContext->NdpDatagramEntries[datagramIndex].SessionId); + + Ndp->wNextFpIndex = 0; + ndpDatagramEntries = Ndp->Datagram; + // + // Add datagram entries to the NDP Table + // + for (datagramIndex = 0; datagramIndex < NtbContext->DatagramCount; datagramIndex++) + { + ndpDatagramEntries[ndpDatagramIndex].wDatagramIndex = (USHORT)NtbContext->NdpDatagramEntries[datagramIndex].DatagramOffset; + ndpDatagramEntries[ndpDatagramIndex].wDatagramLength = (USHORT)NtbContext->NdpDatagramEntries[datagramIndex].DatagramLength; + ndpDatagramIndex++; + } + // + // Terminating entry is taken in to account + // in the fixed size NDP Header. + // + ndpDatagramEntries[ndpDatagramIndex].wDatagramIndex = 0; + ndpDatagramEntries[ndpDatagramIndex].wDatagramLength = 0; + + Ndp->wLength = (USHORT)(NtbContext->NdpHeaderFixedSize + (ndpDatagramIndex * NtbContext->NdpDatagramEntrySize)); +} + +NTSTATUS +MbbNtbAddNdpHeaders(_In_ PMBB_NTB_BUILD_CONTEXT NtbContext) +{ + // Offset from the start of the NTB buffer to the start of NDP headers + ULONG ndpStartOffset; + // Offset from the start of the NTB Buffer to the current position. + ULONG ntbOffset; + PCHAR ndpBuffer; + MBB_NDP_TYPE ndpType; + PNCM_NDP16 ndp16; + PNCM_NDP32 ndp32; + NTSTATUS status = STATUS_SUCCESS; + + do + { + // + // Allocate buffer for all NDP headers. + // This includes padding for NDP Header alignment. + // + status = CreateNonPagedWdfMemory( + NtbContext->NdpSize, + &NtbContext->NdpBufferMemory, + &NtbContext->NdpBuffer, + NtbContext->NetTxQueue == NULL ? (WDFOBJECT)NtbContext->NetAdapter : NtbContext->NetTxQueue, + MbbPoolTagNtbSend); + if (!NT_SUCCESS(status)) + { + break; + } + RtlZeroMemory(NtbContext->NdpBuffer, NtbContext->NdpSize); + ndpBuffer = (PCHAR)(NtbContext->NdpBuffer); + // + // Chain the NDP Header through its MDL to datagram MDL + // + if ((NtbContext->NdpMdl = AllocateNonPagedMdl(NtbContext->NdpBuffer, NtbContext->NdpSize)) == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + NtbContext->DatagramLastMdl->Next = NtbContext->NdpMdl; + ndpStartOffset = NtbContext->NtbHeaderSize + NtbContext->DatagramLength; + + if (NtbContext->IsNtb32Bit) + NtbContext->Nth32.dwFpIndex = ALIGN(ndpStartOffset, NtbContext->NdpOutAlignment); + else + NtbContext->Nth16.wFpIndex = (USHORT)ALIGN(ndpStartOffset, NtbContext->NdpOutAlignment); + + ntbOffset = ALIGN(ndpStartOffset, NtbContext->NdpOutAlignment); + ndpType = NtbContext->NdpDatagramEntries[0].NdpType; + + if (NtbContext->IsNtb32Bit == TRUE) + { + ndp32 = (PNCM_NDP32)(ndpBuffer + (ntbOffset - ndpStartOffset)); + + MbbNtbFillNdp32Header(ndp32, ndpType, NtbContext); + } + else + { + ndp16 = (PNCM_NDP16)(ndpBuffer + (ntbOffset - ndpStartOffset)); + + MbbNtbFillNdp16Header(ndp16, ndpType, NtbContext); + } + + if (NtbContext->IsNtb32Bit == TRUE) + { + NtbContext->Nth32.dwBlockLength = NtbContext->NtbHeaderSize; + NtbContext->Nth32.dwBlockLength += NtbContext->DatagramLength; + NtbContext->Nth32.dwBlockLength += NtbContext->NdpSize; + } + else + { + NtbContext->Nth16.wBlockLength = (USHORT)(NtbContext->NtbHeaderSize); + NtbContext->Nth16.wBlockLength += (USHORT)(NtbContext->DatagramLength); + NtbContext->Nth16.wBlockLength += (USHORT)(NtbContext->NdpSize); + } + } while (FALSE); + // + // No cleanup. Cleanup done by caller. + // + return status; +} + +NTSTATUS +MbbTestValidateNtb(_In_ PMBB_NTB_BUILD_CONTEXT NtbContext, _In_reads_bytes_(ScratchLength) PCHAR ScratchBuffer, _In_ ULONG ScratchLength) +{ + PMDL currentMdl; + ULONGLONG ntbLength; + ULONG mdlLength; + PVOID mdlVa; + PVOID nth; + + nth = ScratchBuffer; + ntbLength = 0; + + for (currentMdl = MbbNtbGetMdlChainHead(NtbContext); currentMdl != NULL; currentMdl = currentMdl->Next) + { + mdlLength = MmGetMdlByteCount(currentMdl); + + if ((mdlVa = MmGetSystemAddressForMdlSafe(currentMdl, NormalPagePriority | MdlMappingNoExecute)) == NULL) + { + return STATUS_RESOURCE_DATA_NOT_FOUND; + } + + if ((ntbLength + mdlLength) > ScratchLength) + { + return STATUS_BUFFER_OVERFLOW; + } + + RtlCopyMemory(ScratchBuffer, mdlVa, mdlLength); + + ScratchBuffer += mdlLength; + ntbLength += mdlLength; + } + + return MbbNtbValidate(nth, (ULONG)ntbLength, NtbContext->IsNtb32Bit, NULL); +} + +void EvtTxQueueDestroy(_In_ WDFOBJECT TxQueue) +{ + PMBB_TXQUEUE_CONTEXT txQueueContext = MbbGetTxQueueContext(TxQueue); + + txQueueContext->NetAdapterContext->TxQueue = NULL; +} + +VOID EvtTxQueueSetNotificationEnabled(_In_ NETPACKETQUEUE TxQueue, _In_ BOOLEAN NotificationEnabled) +{ + PMBB_TXQUEUE_CONTEXT txQueueContext = MbbGetTxQueueContext(TxQueue); + + InterlockedExchange(&txQueueContext->NotificationEnabled, NotificationEnabled); +} + +void EvtTxQueueCancel(_In_ NETPACKETQUEUE TxQueue) +{ + NET_RING_COLLECTION const* rings = MbbGetTxQueueContext(TxQueue)->DatapathDescriptor; + + NET_RING * pr = NetRingCollectionGetPacketRing(rings); + while (pr->BeginIndex != pr->EndIndex) + { + UINT32 const packetIndex = pr->BeginIndex; + NetRingGetPacketAtIndex(pr, packetIndex)->Scratch = 1; + pr->BeginIndex = NetRingIncrementIndex(pr, pr->BeginIndex); + } +} + +bool MbbEnableTxBatching(_In_ NET_RING_COLLECTION const* Rings) +{ + NET_RING * ring = Rings->Rings[NetRingTypeFragment]; + return ((ring->EndIndex - ring->BeginIndex) & ring->ElementIndexMask) > (NetRingCollectionGetPacketRing(Rings)->NumberOfElements / 2); +} + +inline +VOID +CompleteTxPacketsBatch( + _In_ NET_RING_COLLECTION const * Rings, + _In_ UINT32 BatchSize +) +{ + UINT32 packetCount = 0; + + NET_RING * pr = NetRingCollectionGetPacketRing(Rings); + + while (pr->BeginIndex != pr->EndIndex) + { + UINT32 const packetIndex = pr->BeginIndex; + auto packet = NetRingGetPacketAtIndex(pr, packetIndex); + + // this function uses Scratch field as the bit for testing completion + if (!packet->Scratch) + { + break; + } + + packetCount++; + + NET_RING * fr = NetRingCollectionGetFragmentRing(Rings); + fr->BeginIndex = fr->EndIndex; + pr->BeginIndex = NetRingIncrementIndex(pr, pr->BeginIndex); + + if (packetCount >= BatchSize) + { + Rings->Rings[NetRingTypeFragment]->BeginIndex = fr->BeginIndex; + } + } +} + +void EvtTxQueueAdvance(_In_ NETPACKETQUEUE TxQueue) +{ + NTSTATUS status = STATUS_SUCCESS; + PMBB_TXQUEUE_CONTEXT txQueueContext = MbbGetTxQueueContext(TxQueue); + NET_RING_COLLECTION const* rings = txQueueContext->DatapathDescriptor; + PWMBCLASS_NETADAPTER_CONTEXT netAdapterContext = txQueueContext->NetAdapterContext; + PWMBCLASS_DEVICE_CONTEXT deviceContext = netAdapterContext->WmbDeviceContext; + PMBB_NTB_BUILD_CONTEXT ntbContext = NULL; + ULONG sessionId = netAdapterContext->SessionId; + ULONG batchSize = MbbEnableTxBatching(rings) ? txQueueContext->CompletionBatchSize : 1; + + NET_RING * pr = NetRingCollectionGetPacketRing(rings); + while (pr->BeginIndex != pr->EndIndex) + { + UINT32 packetIndex = pr->BeginIndex; + auto packet = NetRingGetPacketAtIndex(pr, packetIndex); + if (packet->Ignore) + { + packet->Scratch = 1; + pr->BeginIndex = NetRingIncrementIndex(pr, pr->BeginIndex); + continue; + } + + ntbContext = MbbNtbAllocateContext( + netAdapterContext->NtbLookasideList, &deviceContext->BusParams, deviceContext->sharedPaddingBuffer, MbbSendQGetNtbSequence(deviceContext)); + + if (ntbContext == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + ntbContext->NetTxQueue = TxQueue; + ntbContext->NetAdapter = netAdapterContext->NetAdapter; + ntbContext->NetDatapathDescriptor = rings; + + auto fr = NetRingCollectionGetFragmentRing(rings); + while (NT_SUCCESS( + status = MbbNtbAddPacket( + ntbContext, + packet, + MbbGetNetPacketDataLength(packet, rings), + NetExtensionGetFragmentMdl(&txQueueContext->MdlExtension, packet->FragmentIndex)->Mdl, + NetRingGetFragmentAtIndex(fr, packet->FragmentIndex)->Offset, + MbbNdpTypeIps, + sessionId))) + { + pr->BeginIndex = NetRingIncrementIndex(pr, pr->BeginIndex); + + // the ring buffer has no more net packets to send, + // so packing is done. break now to make USB request + if (pr->BeginIndex == pr->EndIndex) + { + break; + } + + packetIndex = pr->BeginIndex; + packet = NetRingGetPacketAtIndex(pr, packetIndex); + } + + if (status == STATUS_BUFFER_OVERFLOW) + { + // + // If the NTB was empty and this packet couldnt be added + // then ignore this packet to prevent retrying forever. + // Or send this NTB to bus then start a new NTB + // + if (ntbContext->DatagramCount == 0) + { + packet->Scratch = 1; + pr->BeginIndex = NetRingIncrementIndex(pr, pr->BeginIndex); + } + } + else if (status != STATUS_SUCCESS) + { + // + // MbbNtbAddPacket failed, we should ignore this packet, or the loop may never complete + // + packet->Scratch = 1; + pr->BeginIndex = NetRingIncrementIndex(pr, pr->BeginIndex); + } + + if (ntbContext->DatagramCount > 0) + { + status = MbbNtbAddNdpHeaders(ntbContext); + if (!NT_SUCCESS(status)) + { + } + else + { +#if DBG + if (!NT_SUCCESS(MbbTestValidateNtb(ntbContext, ntbContext->ScratchBuffer, ntbContext->ScratchLength))) + { + ASSERT(FALSE); + } +#endif + // + // Send the data. On failure, cleanup. + // + status = MbbBusWriteData(deviceContext->BusHandle, ntbContext, MbbNtbGetMdlChainHead(ntbContext), MbbSendQCompleteNtb); + if (!NT_SUCCESS(status)) + { + } + } + } + else + { + status = STATUS_UNSUCCESSFUL; + } + + if (!NT_SUCCESS(status)) + { + MbbSendQCompleteNtb(netAdapterContext, ntbContext, status, MbbNtbGetMdlChainHead(ntbContext)); + } + } + + CompleteTxPacketsBatch(rings, batchSize); +} + +PDSS_PACKET MbbAllocateDssPacket(_In_ WDFMEMORY Data, _In_ PVOID DataBuffer, _In_ size_t DataSize) +{ + NTSTATUS status = STATUS_SUCCESS; + PDSS_PACKET packet = NULL; + do + { +// By Design: Allocate packet from NtbSend Pool, released in function MbbNtbCleanupContext called from MbbSendQCompleteNtb. +#pragma prefast(suppress : __WARNING_MEMORY_LEAK, "Released in function MbbNtbCleanupContext") + packet = (PDSS_PACKET)ALLOCATE_NONPAGED_POOL_WITH_TAG(sizeof(DSS_PACKET), MbbPoolTagNtbSend); + if (packet == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + RtlZeroMemory(packet, sizeof(DSS_PACKET)); + + packet->Data = Data; + packet->Mdl = AllocateNonPagedMdl(DataBuffer, (ULONG)DataSize); + + if (packet->Mdl == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + } while (FALSE); + + if (!NT_SUCCESS(status)) + { + if (packet != NULL) + { + MbbCleanupDssPacket(packet); + packet = NULL; + } + } + + return packet; +} + +_Use_decl_annotations_ VOID EvtMbbDeviceSendDeviceServiceSessionData(WDFDEVICE Device, DSS_SESSION_ID SessionId, WDFMEMORY Data) +{ + PWMBCLASS_DEVICE_CONTEXT deviceContext = WmbClassGetDeviceContext(Device); + NTSTATUS status = STATUS_SUCCESS; + + PWMBCLASS_NETADAPTER_CONTEXT netAdapterContext = deviceContext->Sessions[MBB_DEFAULT_SESSION_ID].NetAdapterContext; + + PMBB_NTB_BUILD_CONTEXT ntbContext = NULL; + PDSS_PACKET packet = NULL; + BOOLEAN completeNow = TRUE; + + do + { + ntbContext = MbbNtbAllocateContext( + netAdapterContext->NtbLookasideList, &deviceContext->BusParams, deviceContext->sharedPaddingBuffer, MbbSendQGetNtbSequence(deviceContext)); + + if (ntbContext == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + ntbContext->NetTxQueue = NULL; + ntbContext->NetAdapter = netAdapterContext->NetAdapter; + size_t bufferSize = 0; + PVOID buffer = WdfMemoryGetBuffer(Data, &bufferSize); + + packet = MbbAllocateDssPacket(Data, buffer, bufferSize); + if (packet == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + status = MbbNtbAddPacket(ntbContext, packet, (ULONG)bufferSize, packet->Mdl, 0, MbbNdpTypeVendor_1, SessionId); + if (!NT_SUCCESS(status)) + { + MbbCleanupDssPacket(packet); + break; + } + + completeNow = FALSE; + + status = MbbNtbAddNdpHeaders(ntbContext); + if (!NT_SUCCESS(status)) + { + break; + } + +#if DBG + if (!NT_SUCCESS(MbbTestValidateNtb(ntbContext, ntbContext->ScratchBuffer, ntbContext->ScratchLength))) + { + ASSERT(FALSE); + } +#endif + + // + // Send the data. On failure, cleanup. It will return STATUS_PENDING when success + // + status = MbbBusWriteData(deviceContext->BusHandle, ntbContext, MbbNtbGetMdlChainHead(ntbContext), MbbSendQCompleteNtb); + if (!NT_SUCCESS(status)) + { + break; + } + + deviceContext->DSSPacketsSentCount++; + } while (FALSE); + + if (!NT_SUCCESS(status)) + { + if (ntbContext != NULL) + { + MbbSendQCompleteNtb(deviceContext, ntbContext, status, MbbNtbGetMdlChainHead(ntbContext)); + } + if (completeNow) + { + MbbDeviceSendDeviceServiceSessionDataComplete(Data, status); + } + } +} diff --git a/network/wwan/cxwmbclass/util.cpp b/network/wwan/cxwmbclass/util.cpp new file mode 100644 index 00000000..2e2e5f34 --- /dev/null +++ b/network/wwan/cxwmbclass/util.cpp @@ -0,0 +1,326 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// +//////////////////////////////////////////////////////////////////////////////// +// +// INCLUDES +// +//////////////////////////////////////////////////////////////////////////////// +#include "precomp.h" + +NTSTATUS +MbbNtbDetectNdp32Loop(_In_ PNCM_NTH32 Nth) +{ + PNCM_NDP32 FirstNdp; + PNCM_NDP32 Ndp; + PNCM_NDP32 LoopNdp; + + if ((FirstNdp = MBB_NTH32_GET_FIRST_NDP(Nth)) == NULL) + return STATUS_SUCCESS; + + if (!MBB_NTB32_IS_VALID_NDP_LENGTH(Nth, FirstNdp)) + { + return STATUS_UNSUCCESSFUL; + } + LoopNdp = MBB_NDP32_GET_NEXT_NDP(Nth, FirstNdp); + + for (Ndp = FirstNdp; Ndp != NULL && LoopNdp != NULL; Ndp = MBB_NDP32_GET_NEXT_NDP(Nth, Ndp)) + { + if (!MBB_NTB32_IS_VALID_NDP_LENGTH(Nth, LoopNdp)) + { + return STATUS_UNSUCCESSFUL; + } + + if (!MBB_NTB32_IS_VALID_NDP_LENGTH(Nth, Ndp)) + { + return STATUS_UNSUCCESSFUL; + } + + if (LoopNdp == Ndp) + { + return STATUS_UNSUCCESSFUL; + } + + if ((LoopNdp = MBB_NDP32_GET_NEXT_NDP(Nth, LoopNdp)) != NULL) + { + if (!MBB_NTB32_IS_VALID_NDP_LENGTH(Nth, LoopNdp)) + { + return STATUS_UNSUCCESSFUL; + } + LoopNdp = MBB_NDP32_GET_NEXT_NDP(Nth, LoopNdp); + } + } + return STATUS_SUCCESS; +} + +NTSTATUS +MbbNtbValidateNdp32(_In_ PNCM_NTH32 Nth, _In_ PNCM_NDP32 Ndp) +{ + ULONG Index; + ULONG DatagramCount = MBB_NDP32_GET_DATAGRAM_COUNT(Ndp); + + if (!MBB_NTB32_IS_VALID_NDP_SIGNATURE(Ndp)) + { + return STATUS_UNSUCCESSFUL; + } + + if (MBB_NDP32_GET_SIGNATURE_TYPE(Ndp) == NCM_NDP32_IPS) + { + // + // Check if the session id is valid, else discard + // + + // Check if session Id is greater than maximum supported. Here + // we can also check against MaxActivatedContexts, but this would + // mean we need to take a lock for getting the value of maxactivatedcontexts + // The lock can be avoided by checking against the maximum number of ports + // supported by the class driver. SESSION_PORT_TABLE.InUse can be used + // to check whether the session id is in use. + + if (MBB_NDP32_GET_SESSIONID(Ndp) >= MBB_MAX_NUMBER_OF_SESSIONS) + { + return STATUS_UNSUCCESSFUL; + } + } + + if (!MBB_NTB32_IS_VALID_NDP_LENGTH(Nth, Ndp)) + { + return STATUS_UNSUCCESSFUL; + } + + for (Index = 0; Index < DatagramCount; Index++) + { + if (MBB_NTB32_IS_END_DATAGRAM(Nth, Ndp, Index)) + return STATUS_SUCCESS; + + if (!MBB_NTB32_IS_VALID_DATAGRAM(Nth, Ndp, Index)) + { + return STATUS_UNSUCCESSFUL; + } + } + return STATUS_SUCCESS; +} + +NTSTATUS +MbbNtbValidateNth32(_In_ PNCM_NTH32 Nth, _In_ ULONG BufferLength, _Out_opt_ ULONG* NdpCount) +{ + PNCM_NDP32 Ndp; + ULONG ndpCount = 0; + if (BufferLength < sizeof(NCM_NTH32)) + { + return STATUS_UNSUCCESSFUL; + } + + if (!MBB_NTH32_IS_VALID_SIGNATURE(Nth)) + { + return STATUS_UNSUCCESSFUL; + } + + if (!MBB_NTH32_IS_VALID_HEADER_LENGTH(Nth)) + { + return STATUS_UNSUCCESSFUL; + } + + if (!MBB_NTH32_IS_VALID_BLOCK_LENGTH(Nth, BufferLength)) + { + return STATUS_UNSUCCESSFUL; + } + + if (!MBB_NTH32_IS_VALID_FIRST_NDP(Nth)) + { + return STATUS_UNSUCCESSFUL; + } + + if (MbbNtbDetectNdp32Loop(Nth) != STATUS_SUCCESS) + return STATUS_UNSUCCESSFUL; + + for (Ndp = MBB_NTH32_GET_FIRST_NDP(Nth); Ndp != NULL; Ndp = MBB_NDP32_GET_NEXT_NDP(Nth, Ndp)) + { + if (MbbNtbValidateNdp32(Nth, Ndp) != STATUS_SUCCESS) + return STATUS_UNSUCCESSFUL; + ndpCount++; + } + if (NdpCount != NULL) + { + *NdpCount = ndpCount; + } + return STATUS_SUCCESS; +} + +NTSTATUS +MbbNtbDetectNdp16Loop(_In_ PNCM_NTH16 Nth) +{ + PNCM_NDP16 FirstNdp; + PNCM_NDP16 Ndp; + PNCM_NDP16 LoopNdp; + + if ((FirstNdp = MBB_NTH16_GET_FIRST_NDP(Nth)) == NULL) + return STATUS_SUCCESS; + + if (!MBB_NTB16_IS_VALID_NDP_LENGTH(Nth, FirstNdp)) + { + return STATUS_UNSUCCESSFUL; + } + LoopNdp = MBB_NDP16_GET_NEXT_NDP(Nth, FirstNdp); + + for (Ndp = FirstNdp; Ndp != NULL && LoopNdp != NULL; Ndp = MBB_NDP16_GET_NEXT_NDP(Nth, Ndp)) + { + if (!MBB_NTB16_IS_VALID_NDP_LENGTH(Nth, LoopNdp)) + { + return STATUS_UNSUCCESSFUL; + } + + if (!MBB_NTB16_IS_VALID_NDP_LENGTH(Nth, Ndp)) + { + return STATUS_UNSUCCESSFUL; + } + + if (LoopNdp == Ndp) + { + return STATUS_UNSUCCESSFUL; + } + + if ((LoopNdp = MBB_NDP16_GET_NEXT_NDP(Nth, LoopNdp)) != NULL) + { + if (!MBB_NTB16_IS_VALID_NDP_LENGTH(Nth, LoopNdp)) + { + return STATUS_UNSUCCESSFUL; + } + LoopNdp = MBB_NDP16_GET_NEXT_NDP(Nth, LoopNdp); + } + } + return STATUS_SUCCESS; +} + +NTSTATUS +MbbNtbValidateNdp16(_In_ PNCM_NTH16 Nth, _In_ PNCM_NDP16 Ndp) +{ + ULONG Index; + ULONG DatagramCount = MBB_NDP16_GET_DATAGRAM_COUNT(Ndp); + + if (!MBB_NTB16_IS_VALID_NDP_SIGNATURE(Ndp)) + { + return STATUS_UNSUCCESSFUL; + } + + if (MBB_NDP16_GET_SIGNATURE_TYPE(Ndp) == NCM_NDP16_IPS) + { + // + // Check if the session id is valid, else discard + // + + // Check if session Id is greater than maximum supported. Here + // we can also check against MaxActivatedContexts, but this would + // mean we need to take a lock for getting the value of maxactivatedcontexts + // The lock can be avoided by checking against the maximum number of ports + // supported by the class driver. SESSION_PORT_TABLE.InUse can be used + // to check whether the session id is in use. + + if (MBB_NDP16_GET_SESSIONID(Ndp) >= MBB_MAX_NUMBER_OF_SESSIONS) + { + return STATUS_UNSUCCESSFUL; + } + } + + if (!MBB_NTB16_IS_VALID_NDP_LENGTH(Nth, Ndp)) + { + return STATUS_UNSUCCESSFUL; + } + + for (Index = 0; Index < DatagramCount; Index++) + { + if (MBB_NTB16_IS_END_DATAGRAM(Nth, Ndp, Index)) + return STATUS_SUCCESS; + + if (!MBB_NTB16_IS_VALID_DATAGRAM(Nth, Ndp, Index)) + { + return STATUS_UNSUCCESSFUL; + } + } + return STATUS_SUCCESS; +} + +NTSTATUS +MbbNtbValidateNth16(_In_ PNCM_NTH16 Nth, _In_ ULONG BufferLength, _Out_opt_ ULONG* NdpCount) +{ + PNCM_NDP16 Ndp; + ULONG ndpCount = 0; + if (BufferLength < sizeof(NCM_NTH16)) + { + return STATUS_UNSUCCESSFUL; + } + + if (!MBB_NTH16_IS_VALID_SIGNATURE(Nth)) + { + return STATUS_UNSUCCESSFUL; + } + + if (!MBB_NTH16_IS_VALID_HEADER_LENGTH(Nth)) + { + return STATUS_UNSUCCESSFUL; + } + + if (!MBB_NTH16_IS_VALID_BLOCK_LENGTH(Nth, BufferLength)) + { + return STATUS_UNSUCCESSFUL; + } + + if (!MBB_NTH16_IS_VALID_FIRST_NDP(Nth)) + { + return STATUS_UNSUCCESSFUL; + } + + if (MbbNtbDetectNdp16Loop(Nth) != STATUS_SUCCESS) + return STATUS_UNSUCCESSFUL; + + for (Ndp = MBB_NTH16_GET_FIRST_NDP(Nth); Ndp != NULL; Ndp = MBB_NDP16_GET_NEXT_NDP(Nth, Ndp)) + { + if (MbbNtbValidateNdp16(Nth, Ndp) != STATUS_SUCCESS) + return STATUS_UNSUCCESSFUL; + ndpCount++; + } + + if (NdpCount != NULL) + { + *NdpCount = ndpCount; + } + return STATUS_SUCCESS; +} + +NTSTATUS +MbbNtbValidate(_In_ PVOID Nth, _In_ ULONG BufferLength, _In_ BOOLEAN Is32Bit, _Out_opt_ ULONG* NdpCount) +{ + if (Is32Bit == TRUE) + return MbbNtbValidateNth32((PNCM_NTH32)Nth, BufferLength, NdpCount); + else + return MbbNtbValidateNth16((PNCM_NTH16)Nth, BufferLength, NdpCount); +} + +NTSTATUS +CreateNonPagedWdfMemory(_In_ ULONG ObjectSize, _Out_ WDFMEMORY* WdfMemory, _Out_opt_ PVOID* ObjectMemory, _In_ WDFOBJECT Parent, _In_ ULONG PoolTag = 0) +{ + NTSTATUS status; + WDF_OBJECT_ATTRIBUTES objectAttribs; + + WDF_OBJECT_ATTRIBUTES_INIT(&objectAttribs); + objectAttribs.ParentObject = Parent; + + status = WdfMemoryCreate(&objectAttribs, NonPagedPoolNx, PoolTag, ObjectSize, WdfMemory, ObjectMemory); + + return status; +} + +PMDL AllocateNonPagedMdl(_In_reads_bytes_(Length) PVOID VirtualAddress, _In_ ULONG Length) +{ + PMDL Mdl; + + Mdl = IoAllocateMdl(VirtualAddress, Length, FALSE, FALSE, NULL); + + if (Mdl) + { + MmBuildMdlForNonPagedPool(Mdl); + Mdl->Next = NULL; + } + + return Mdl; +} diff --git a/network/wwan/cxwmbclass/utils.cpp b/network/wwan/cxwmbclass/utils.cpp new file mode 100644 index 00000000..ec791ab4 --- /dev/null +++ b/network/wwan/cxwmbclass/utils.cpp @@ -0,0 +1,588 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// +#include +#include "util.h" +NTSTATUS +SendSyncControlCommand( + __in WDFUSBDEVICE WdfUsbDevice, + __in WDF_USB_BMREQUEST_DIRECTION Direction, + __in WDF_USB_BMREQUEST_RECIPIENT Recipient, + __in BYTE Request, + __in USHORT Value, + __inout_bcount_opt(BufferLength) PUCHAR Buffer, + __in ULONG BufferLength, + __out_opt PULONG BytesTransfered) + +{ + + NTSTATUS Status; + WDF_USB_CONTROL_SETUP_PACKET controlSetupPacket; + WDF_MEMORY_DESCRIPTOR memoryDescriptor; + WDF_REQUEST_SEND_OPTIONS SendOptions; + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + + usbDeviceContext = GetUsbDeviceContext(WdfUsbDevice); + + if (Buffer != NULL) + { + + WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&memoryDescriptor, (PVOID)Buffer, BufferLength); + } + + WDF_USB_CONTROL_SETUP_PACKET_INIT_CLASS(&controlSetupPacket, Direction, Recipient, Request, Value, usbDeviceContext->UsbCommunicationInterfaceIndex); + + WDF_REQUEST_SEND_OPTIONS_INIT(&SendOptions, 0); + + WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(&SendOptions, WDF_REL_TIMEOUT_IN_SEC(10)); + + Status = WdfUsbTargetDeviceSendControlTransferSynchronously( + WdfUsbDevice, WDF_NO_HANDLE, &SendOptions, &controlSetupPacket, (Buffer != NULL) ? &memoryDescriptor : NULL, BytesTransfered); + + if (!NT_SUCCESS(Status)) + { + BOOLEAN ToHost = Direction == BmRequestDeviceToHost; + } + + return Status; +} + +NTSTATUS +TransactControlChannel( + __in PBUS_OBJECT BusObject, + __in ULONG TimeOut, + __in_bcount_opt(InBufferLength) PUCHAR InBuffer, + __in ULONG InBufferLength, + __out_bcount_opt(OutBufferLength) PUCHAR OutBuffer, + __in ULONG OutBufferLength, + __out PULONG BytesRead) + +{ + ULONG BytesTransfered = 0; + NTSTATUS Status; + + *BytesRead = 0; + + Status = SendSyncControlCommand( + BusObject->WdfUsbDevice, BmRequestHostToDevice, BmRequestToInterface, SEND_ENCAPSULATE_COMMAND, 0, InBuffer, InBufferLength, &BytesTransfered); + + if (NT_SUCCESS(Status)) + { + if (BytesTransfered < InBufferLength) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + } + } + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + Status = WaitForResponseAvailible(BusObject, TimeOut); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + Status = SendSyncControlCommand( + BusObject->WdfUsbDevice, BmRequestDeviceToHost, BmRequestToInterface, GET_ENCAPSULATE_RESPONSE, 0, OutBuffer, OutBufferLength, &BytesTransfered); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + *BytesRead = BytesTransfered; + +Cleanup: + + return Status; +} + +NTSTATUS +ReadInterrupt(_In_ PBUS_OBJECT BusObject, _Inout_updates_bytes_(BufferLength) PUCHAR Buffer, _In_ ULONG BufferLength, _In_ ULONG Timeout, _Out_ PULONG BytesRead) + +{ + + NTSTATUS status; + WDFMEMORY memHandle = NULL; + + WDFREQUEST request = NULL; + BOOLEAN SentToDevice = FALSE; + WDF_REQUEST_SEND_OPTIONS SendOptions; + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + WDF_MEMORY_DESCRIPTOR MemoryDescriptor; + + usbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&MemoryDescriptor, (PVOID)Buffer, BufferLength); + + WDF_REQUEST_SEND_OPTIONS_INIT(&SendOptions, WDF_REQUEST_SEND_OPTION_IGNORE_TARGET_STATE); + + WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(&SendOptions, WDF_REL_TIMEOUT_IN_SEC(Timeout)); + + status = WdfUsbTargetPipeReadSynchronously(usbDeviceContext->InterruptPipe, NULL, &SendOptions, &MemoryDescriptor, BytesRead); + + return status; +} + +NTSTATUS +GetDeviceString(__in WDFUSBDEVICE UsbDevice, __in UCHAR Index, __out PWSTR* String) + +{ + NTSTATUS Status; + WDF_REQUEST_SEND_OPTIONS SendOptions; + USHORT CharacterCount = 0; + ULONG AllocationSize = 0; + PWSTR AllocatedString = NULL; + + WDF_REQUEST_SEND_OPTIONS_INIT(&SendOptions, 0); + + WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(&SendOptions, WDF_REL_TIMEOUT_IN_SEC(DEFAULT_IO_TIMEOUT)); + + *String = NULL; + + Status = WdfUsbTargetDeviceQueryString(UsbDevice, NULL, &SendOptions, NULL, &CharacterCount, Index, 0); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + // + // allocate one more char to make sure sting is null terminated + // + AllocationSize = (CharacterCount + 1) * sizeof(WCHAR); + + AllocatedString = (PWSTR)ALLOCATE_PAGED_POOL(AllocationSize); + + if (AllocatedString == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto Cleanup; + } + + RtlZeroMemory(AllocatedString, AllocationSize); + + Status = WdfUsbTargetDeviceQueryString(UsbDevice, NULL, &SendOptions, AllocatedString, &CharacterCount, Index, 0); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + *String = AllocatedString; + AllocatedString = NULL; + +Cleanup: + + if (AllocatedString != NULL) + { + FREE_POOL(AllocatedString); + AllocatedString = NULL; + } + + return Status; +} + +NTSTATUS +MbbBusSetPacketFilter(__in MBB_BUS_HANDLE BusHandle, __in ULONG PacketFilter) + +{ + + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + NTSTATUS Status; + ULONG BytesTransfered = 0; + UCHAR ReadBuffer[256]; + + Status = SendSyncControlCommand( + BusObject->WdfUsbDevice, BmRequestHostToDevice, BmRequestToInterface, SET_PACKET_FILTER, 0, (PUCHAR)&PacketFilter, sizeof(PacketFilter), &BytesTransfered); + + if (NT_SUCCESS(Status)) + { + if (BytesTransfered < sizeof(PacketFilter)) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + } + } + + return Status; +} + +NTSTATUS +MbbBusSetNtbInSize(__in MBB_BUS_HANDLE BusHandle, __in ULONG InSize) + +{ + + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + NTSTATUS Status; + ULONG BytesTransfered = 0; + + Status = SendSyncControlCommand( + BusObject->WdfUsbDevice, BmRequestHostToDevice, BmRequestToInterface, SET_NTB_INPUT_SIZE, 0, (PUCHAR)&InSize, sizeof(InSize), &BytesTransfered); + + if (NT_SUCCESS(Status)) + { + if (BytesTransfered < sizeof(InSize)) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + } + } + + return Status; +} + +NTSTATUS +MbbBusGetStat(__in MBB_BUS_HANDLE BusHandle, __in USHORT StatIndex, __out ULONGLONG* Value) + +{ + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + NTSTATUS Status; + ULONG BytesTransfered = 0; + +#pragma warning(suppress : 6001) + Status = SendSyncControlCommand( + BusObject->WdfUsbDevice, BmRequestDeviceToHost, BmRequestToInterface, GET_STATISTIC, StatIndex, (PUCHAR)Value, sizeof(*Value), &BytesTransfered); + + if (NT_SUCCESS(Status)) + { + if (BytesTransfered < sizeof(Value)) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + } + } + + return Status; +} + +NTSTATUS +MbbBusSetNtbFormat(__in MBB_BUS_HANDLE BusHandle, __in USHORT Format) + +{ + + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + NTSTATUS Status; + ULONG BytesTransfered = 0; + + Status = SendSyncControlCommand( + BusObject->WdfUsbDevice, BmRequestHostToDevice, BmRequestToInterface, SET_NBT_FORMAT, Format, (PUCHAR)NULL, 0, &BytesTransfered); + + if (NT_SUCCESS(Status)) + { + } + + return Status; +} + +NTSTATUS +MbbBusResetFunction(__in MBB_BUS_HANDLE BusHandle) + +{ + + PBUS_OBJECT BusObject = (PBUS_OBJECT)BusHandle; + NTSTATUS Status; + ULONG BytesTransfered = 0; + + Status = SendSyncControlCommand( + BusObject->WdfUsbDevice, BmRequestHostToDevice, BmRequestToInterface, RESET_FUNCTION, 0, (PUCHAR)NULL, 0, &BytesTransfered); + + if (NT_SUCCESS(Status)) + { + } + + return Status; +} + +NTSTATUS +MbbBusResetDeviceAndSetParms(__in PBUS_OBJECT BusObject) + +{ + NTSTATUS Status; + USHORT NtbFormat = NCM_SET_NTB_FORMAT_16_BIT; + + // + // put the device back into a known state + // + Status = MbbBusResetFunction(BusObject); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + Status = MbbBusSetNtbInSize(BusObject, BusObject->MaxBulkInTransfer); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + if ((BusObject->NtbParam.bmNtbFormatSupported & NCM_NTB_FORMAT_32_BIT) == NCM_NTB_FORMAT_32_BIT) + { + // + // device supports 32 bit mode + // + if (BusObject->NtbFormat32Bit) + { + // + // the device can actually handle a transfer larger than 16bit, change to 32 bit + // + NtbFormat = NCM_SET_NTB_FORMAT_32_BIT; + } + + // + // set the format + // + Status = MbbBusSetNtbFormat(BusObject, NtbFormat); + + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + } + +Cleanup: + + return Status; +} + +ULONG +ProcessInterruptPipeRead( + PBUS_OBJECT BusObject, + __in_ecount(NewFragmentLength) PCUCHAR NewFragment, + ULONG NewFragmentLength, + __out_ecount(MessageBufferSize) PUCHAR CompleteMessageBuffer, + ULONG MessageBufferSize) + +{ + + ULONG CompleteMessageLength = 0; + PUSB_CDC_NOTIFICATION CdcNotification = NULL; + + ASSERT(MessageBufferSize == sizeof(BusObject->InterruptReassemnblyBuffer)); + + if (BusObject->CurrentOffset == 0) + { + // + // beggining of interrupt transfer + // + if ((NewFragmentLength >= sizeof(*CdcNotification)) && (NewFragmentLength <= sizeof(BusObject->InterruptReassemnblyBuffer))) + { + // + // big enough for a notification + // + CdcNotification = (PUSB_CDC_NOTIFICATION)NewFragment; + + if ((CdcNotification->bmRequestType == 0xa1)) + { + BusObject->ExpectLength = sizeof(*CdcNotification) + CdcNotification->wLength; + + RtlCopyMemory(&BusObject->InterruptReassemnblyBuffer[BusObject->CurrentOffset], NewFragment, NewFragmentLength); + + BusObject->CurrentOffset += NewFragmentLength; + } + else + { + // + // wrong request type, drop + // + } + } + else + { + // + // not big enough to be a cdc notification, drop + // + } + } + else + { + // + // we already have some of the data + // + if ((NewFragmentLength + BusObject->CurrentOffset) <= sizeof(BusObject->InterruptReassemnblyBuffer)) + { + // + // still room in the NewFragment + // + RtlCopyMemory(&BusObject->InterruptReassemnblyBuffer[BusObject->CurrentOffset], NewFragment, NewFragmentLength); + } + else + { + // + // over flow, Keep procssing until we get the whole thing so we don't get out of sync + // + } + BusObject->CurrentOffset += NewFragmentLength; + } + + if (BusObject->CurrentOffset < BusObject->ExpectLength) + { + // + // we don't have the whole thing yet, keep going + // + if (NewFragmentLength == 0) + { + // + // got a zero length transfer, reset the re-assembly state + BusObject->ExpectLength = 0; + BusObject->CurrentOffset = 0; + } + } + else + { + if (BusObject->CurrentOffset == BusObject->ExpectLength) + { + // + // got it all + // + if ((BusObject->CurrentOffset <= sizeof(BusObject->InterruptReassemnblyBuffer)) && (BusObject->CurrentOffset <= MessageBufferSize)) + { + // + // the whole thing fit in the NewFragment + // + RtlCopyMemory(CompleteMessageBuffer, BusObject->InterruptReassemnblyBuffer, BusObject->CurrentOffset); + + CompleteMessageLength = BusObject->CurrentOffset; + BusObject->CurrentOffset = 0; + } + else + { + // + // it is bigger than the re-assembly NewFragment, + // drop it + // + } + + // + // done with the current re-assembled NewFragment + // + BusObject->ExpectLength = 0; + BusObject->CurrentOffset = 0; + } + else + { + // + // current offset is beyond the what we expected + // + ASSERT(0); + } + } + + return CompleteMessageLength; +} + +NTSTATUS +WaitForResponseAvailible(PBUS_OBJECT BusObject, ULONG TimeOut) + +{ + NTSTATUS Status; + UCHAR IndicateBuffer[INTERRUPT_REASSEMBLY_BUFFER_SIZE]; + ULONG BufferLength = 0; + ULONG BytesTransfered = 0; + BOOLEAN ExitLoop = FALSE; + PUSB_DEVICE_CONTEXT usbDeviceContext = NULL; + PUSB_CDC_NOTIFICATION Notification = NULL; + + usbDeviceContext = GetUsbDeviceContext(BusObject->WdfUsbDevice); + + BusObject->ExpectLength = 0; + BusObject->CurrentOffset = 0; + + while (!ExitLoop) + { + + Status = ReadInterrupt(BusObject, BusObject->SyncInterruptReadBuffer, usbDeviceContext->InterruptPipeMaxPacket, TimeOut, &BytesTransfered); + + if (NT_SUCCESS(Status)) + { + + BufferLength = ProcessInterruptPipeRead( + BusObject, BusObject->SyncInterruptReadBuffer, BytesTransfered, IndicateBuffer, sizeof(IndicateBuffer)); + + if (BufferLength == 0) + { + // + // + // don't have a complete message yet + // + continue; + } + else + { + if (BufferLength < sizeof(*Notification)) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + goto Cleanup; + } + + Notification = (PUSB_CDC_NOTIFICATION)IndicateBuffer; + + if (Notification->bNotificationCode != USB_CDC_NOTIFICATION_RESPONSE_AVAILABLE) + { + continue; + } + } + } + else + { + goto Cleanup; + } + + ExitLoop = TRUE; + } + + Status = STATUS_SUCCESS; + +Cleanup: + + return Status; +} + +BOOLEAN IsUsbCapDeviceInfoValid(_In_ USB_CAP_DEVICE_INFO UsbCapDeviceInfo, _In_ ULONG CapResultLength) +{ + if (CapResultLength < sizeof(USB_CAP_DEVICE_INFO_HEADER)) + { + return FALSE; + } + switch (UsbCapDeviceInfo.DeviceInfoHeader.DeviceType) + { + case USB_CAP_DEVICE_TYPE_UDE_MBIM: __fallthrough; + case USB_CAP_DEVICE_TYPE_UDE_MBIM_FASTIO: + // Only support version 1.0 now + if (UsbCapDeviceInfo.DeviceInfoHeader.DeviceMajorVersion == 0x1 && UsbCapDeviceInfo.DeviceInfoHeader.DeviceMinorVersion == 0x0) + { + return TRUE; + } + else + { + return FALSE; + } + default: return FALSE; + } +} + +/*++ + +Routine Description: + + Check if the bus type is Ude + +Arguments: + + BusHandle - identifies the instance of the bus layer. + +Return Value: + + TRUE - The bus type is Ude + FALSE - The bus type isn't Ude + +--*/ +BOOLEAN +MbbBusIsUde(_In_ MBB_BUS_HANDLE BusHandle) +{ + USB_CAP_DEVICE_TYPE DeviceType = ((PBUS_OBJECT)BusHandle)->UsbCapDeviceInfo.DeviceInfoHeader.DeviceType; + return (DeviceType == USB_CAP_DEVICE_TYPE_UDE_MBIM || DeviceType == USB_CAP_DEVICE_TYPE_UDE_MBIM_FASTIO); +} -- cgit v1.3.1 From e25d94bd373c807497b6087b7be3761476751d25 Mon Sep 17 00:00:00 2001 From: Jason Knichel Date: Mon, 28 Nov 2022 12:35:20 -0800 Subject: Hopefully fix develop branch error in these header files --- network/wwan/cxwmbclass/inc/BusInterface.h | 2 +- network/wwan/cxwmbclass/inc/MbbLibrary.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/network/wwan/cxwmbclass/inc/BusInterface.h b/network/wwan/cxwmbclass/inc/BusInterface.h index d72c663a..819f93e5 100644 --- a/network/wwan/cxwmbclass/inc/BusInterface.h +++ b/network/wwan/cxwmbclass/inc/BusInterface.h @@ -27,7 +27,7 @@ Revision History: Authors: TriRoy - + ****************************************************************************/ #ifndef _BusInterface_H_ diff --git a/network/wwan/cxwmbclass/inc/MbbLibrary.h b/network/wwan/cxwmbclass/inc/MbbLibrary.h index 03f64d8a..25c4bef9 100644 --- a/network/wwan/cxwmbclass/inc/MbbLibrary.h +++ b/network/wwan/cxwmbclass/inc/MbbLibrary.h @@ -22,7 +22,7 @@ Notes: This library can be used both in user and kernel mode because it does not to make any memory allocations. - + Revision History: 2/7/2010 : created @@ -30,7 +30,7 @@ Revision History: Authors: TriRoy - + ****************************************************************************/ EXTERN_C NTSTATUS @@ -38,7 +38,7 @@ MbbLibForamtBufferAsOpenMessage(__out_bcount_opt(*BufferLength) PVOID MessageBuf /* Description Formats an input buffer as a MBB Open Message. - + Parameters __out_opt_bcount(*BufferLength) PVOID MessageBuffer The input message buffer. This parameter may be NULL @@ -71,7 +71,7 @@ MbbLibForamtBufferAsCloseMessage(__out_bcount_opt(*BufferLength) PVOID MessageBu /* Description Formats an input buffer as a MBB Close Message. - + Parameters __out_opt_bcount(*BufferLength) PVOID MessageBuffer The input message buffer. This parameter may be NULL @@ -111,7 +111,7 @@ MbbLibFragmentBufferToCommandMessages( Description Given the Payload the routine fragments the payload in to the FragmentBuffers. - + Parameters __in MBB_COMMAND Command Command contains the GUID and Cid. -- cgit v1.3.1 From 017872812677324225c59437f3fd38ef0a1b2ae1 Mon Sep 17 00:00:00 2001 From: kahashimoto-ms <117399367+kahashimoto-ms@users.noreply.github.com> Date: Fri, 2 Dec 2022 14:40:39 -0800 Subject: Fix driver isolation violations 1322 and 1323 for netvmini (60, 620, 630) drivers. (#803) * fix driver isolation violations 1322 1323 for netvmini60.inf * fix driver isolation violations 1322 1323 for netvmini620.inf * fix driver isolation violations 1322 1323 for netvmini630.inf * change local type from ULONG to UINT8 to match return type * Remove AddReg TextModeFlags in inf for netvmini60 * Remove AddReg TextModeFlags in inf for netvmini620 * Remove AddReg TextModeFlags in inf for netvmini630 --- network/ndis/netvmini/6x/60/netvmini60.inf | Bin 8306 -> 8090 bytes network/ndis/netvmini/6x/620/netvmini620.inf | Bin 13052 -> 12836 bytes network/ndis/netvmini/6x/630/netvmini630.inf | Bin 15762 -> 15546 bytes network/ndis/netvmini/6x/rssv2.c | 2 +- 4 files changed, 1 insertion(+), 1 deletion(-) diff --git a/network/ndis/netvmini/6x/60/netvmini60.inf b/network/ndis/netvmini/6x/60/netvmini60.inf index bbfdef53..ed2c0b30 100644 Binary files a/network/ndis/netvmini/6x/60/netvmini60.inf and b/network/ndis/netvmini/6x/60/netvmini60.inf differ diff --git a/network/ndis/netvmini/6x/620/netvmini620.inf b/network/ndis/netvmini/6x/620/netvmini620.inf index 60c4b68b..fbe4f8c4 100644 Binary files a/network/ndis/netvmini/6x/620/netvmini620.inf and b/network/ndis/netvmini/6x/620/netvmini620.inf differ diff --git a/network/ndis/netvmini/6x/630/netvmini630.inf b/network/ndis/netvmini/6x/630/netvmini630.inf index 21c50a09..89bd114e 100644 Binary files a/network/ndis/netvmini/6x/630/netvmini630.inf and b/network/ndis/netvmini/6x/630/netvmini630.inf differ diff --git a/network/ndis/netvmini/6x/rssv2.c b/network/ndis/netvmini/6x/rssv2.c index 35ad6fb8..1f8efb0e 100644 --- a/network/ndis/netvmini/6x/rssv2.c +++ b/network/ndis/netvmini/6x/rssv2.c @@ -210,7 +210,7 @@ Return Value: --*/ { - ULONG index; + UINT8 index; PNDIS_RSS_PROCESSOR processor; for (index = 0; -- cgit v1.3.1 From 076552ed9a3011637ab67a93501b662f3cb1bcff Mon Sep 17 00:00:00 2001 From: kahashimoto-ms <117399367+kahashimoto-ms@users.noreply.github.com> Date: Fri, 2 Dec 2022 16:56:55 -0800 Subject: Netvmin680 fix (#805) * add NDIS_SUPPORT_NDIS680 in #if directive in adapter.c * add NDIS_SUPPORT_NDIS680 in #if directive in miniport.c * fix driver isolation violation 1323 for netvmini680.inf * fix driver isolation violation 1322 for netvmini680.inf * set NIC_PHYSICAL_MEDIUM to NdisPhysicalMedium802_3 in hardware.h * change local type from ULONG to UINT8 to match return type * Remove AddReg TextModeFlags in inf for netvmini680 --- network/ndis/netvmini/6x/680/netvmini680.inf | Bin 15762 -> 15546 bytes network/ndis/netvmini/6x/adapter.c | 21 ++++++++++++++++++--- network/ndis/netvmini/6x/hardware.h | 2 +- network/ndis/netvmini/6x/miniport.c | 10 +++++++--- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/network/ndis/netvmini/6x/680/netvmini680.inf b/network/ndis/netvmini/6x/680/netvmini680.inf index 876441f2..ac471b09 100644 Binary files a/network/ndis/netvmini/6x/680/netvmini680.inf and b/network/ndis/netvmini/6x/680/netvmini680.inf differ diff --git a/network/ndis/netvmini/6x/adapter.c b/network/ndis/netvmini/6x/adapter.c index f1beefc8..3cf0ce59 100644 --- a/network/ndis/netvmini/6x/adapter.c +++ b/network/ndis/netvmini/6x/adapter.c @@ -427,11 +427,26 @@ Arguments: // Set the power management capabilities. The format used is NDIS // version-specific. // -#if (NDIS_SUPPORT_NDIS620) +#if (NDIS_SUPPORT_NDIS680) + + NdisZeroMemory(&PmCapabilities, sizeof(PmCapabilities)); + + {C_ASSERT(sizeof(PmCapabilities) >= NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_2); } + PmCapabilities.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; + PmCapabilities.Header.Size = NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_2; + PmCapabilities.Header.Revision = NDIS_PM_CAPABILITIES_REVISION_2; + + PmCapabilities.MinMagicPacketWakeUp = NIC_MAGIC_PACKET_WAKEUP; + PmCapabilities.MinPatternWakeUp = NIC_PATTERN_WAKEUP; + PmCapabilities.MinLinkChangeWakeUp = NIC_LINK_CHANGE_WAKEUP; + + AdapterGeneral.PowerManagementCapabilitiesEx = &PmCapabilities; + +#elif (NDIS_SUPPORT_NDIS620) NdisZeroMemory(&PmCapabilities, sizeof(PmCapabilities)); - {C_ASSERT(sizeof(PmCapabilities) >= NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_1);} + {C_ASSERT(sizeof(PmCapabilities) >= NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_1); } PmCapabilities.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; PmCapabilities.Header.Size = NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_1; PmCapabilities.Header.Revision = NDIS_PM_CAPABILITIES_REVISION_1; @@ -2326,4 +2341,4 @@ Return Value: { *RefCount = Count; } -} +} \ No newline at end of file diff --git a/network/ndis/netvmini/6x/hardware.h b/network/ndis/netvmini/6x/hardware.h index c3076429..ddc4c4a3 100644 --- a/network/ndis/netvmini/6x/hardware.h +++ b/network/ndis/netvmini/6x/hardware.h @@ -90,7 +90,7 @@ C_ASSERT(sizeof(NIC_FRAME_HEADER) == HW_FRAME_HEADER_SIZE); #define NIC_MEDIUM_TYPE NdisMedium802_3 // If you have physical hardware on 802.3, use NdisPhysicalMedium802_3. -#define NIC_PHYSICAL_MEDIUM NdisPhysicalMediumUnspecified +#define NIC_PHYSICAL_MEDIUM NdisPhysicalMedium802_3 // Set this value to TRUE if there is a physical adapter. diff --git a/network/ndis/netvmini/6x/miniport.c b/network/ndis/netvmini/6x/miniport.c index 317f8c54..9ec793af 100644 --- a/network/ndis/netvmini/6x/miniport.c +++ b/network/ndis/netvmini/6x/miniport.c @@ -122,8 +122,13 @@ Arguments: NdisZeroMemory(&MPChar, sizeof(MPChar)); -#if (NDIS_SUPPORT_NDIS620) - {C_ASSERT(sizeof(MPChar) >= NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2);} +#if (NDIS_SUPPORT_NDIS680) + {C_ASSERT(sizeof(MPChar) >= NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_3); } + MPChar.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_DRIVER_CHARACTERISTICS; + MPChar.Header.Size = NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_3; + MPChar.Header.Revision = NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_3; +#elif (NDIS_SUPPORT_NDIS620) + {C_ASSERT(sizeof(MPChar) >= NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2); } MPChar.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_DRIVER_CHARACTERISTICS; MPChar.Header.Size = NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2; MPChar.Header.Revision = NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2; @@ -628,4 +633,3 @@ DbgPrintAddress( #endif //DBG - -- cgit v1.3.1 From 73d9bad032716b5ceab7b4abbd9569b57efcaace Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 12 Dec 2022 16:57:42 -0800 Subject: Clean up some infverif warnings and errors in print samples (#814) Co-authored-by: Jason Knichel --- .../C++/PTPCPlPr/install/ptpcplpr.inf | 4 +--- print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf | 8 ++++---- .../C++/gdl/res/gdlsmpl.inf | 1 + print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf | 5 +++-- print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf | 8 ++++---- print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf | 5 +++-- .../C++/uniuirep/res/uniuirep.inf | 1 + print/OEM Printer Customization Plug-in Samples/C++/winxp.inf | 1 + 8 files changed, 18 insertions(+), 15 deletions(-) diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf index c778b454..29d1a2b1 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf @@ -11,6 +11,7 @@ LayoutFile=ntprint.inf ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318} Class=Printer DriverVer=09/09/2005,1.0.0.2 +PnpLockdown=1 ; ; Manufacturer section. @@ -29,9 +30,6 @@ DriverVer=09/09/2005,1.0.0.2 ; that they appear in the INF file. ; -[Microsoft] -"UniDrv PT/PC Plugin Provider" = PTPCPLPR - [Microsoft.NTx86] "UniDrv PT/PC Plugin Provider" = PTPCPLPR diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf b/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf index e189a41d..95792aa5 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf @@ -12,6 +12,7 @@ LayoutFile=ntprint.inf ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318} Class=Printer DriverVer=6/07/2001,1.0.0.1 +PnpLockdown=1 ; ; Manufacturer section. @@ -30,9 +31,6 @@ DriverVer=6/07/2001,1.0.0.1 ; that they appear in the INF file. ; -[Microsoft] -"Bitmap Driver" = BITMAP - [Microsoft.NTx86] "Bitmap Driver" = BITMAP @@ -106,7 +104,7 @@ bitmap.dll = 100,bitmap\ia64 bitmap.dll = 100,bitmap\arm64 [SourceDisksFiles] -BITMAP.GPD = 100 +BITMAP.GPD = 100 BITMAP.INI = 100 ; @@ -122,3 +120,5 @@ DefaultDestDir=66000 ; [Strings] MS="Microsoft WDK Sample" +OEMSample="Sample Disk" + diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf b/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf index c57b08b1..f96e8d53 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf @@ -13,6 +13,7 @@ LayoutFile=ntprint.inf ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318} Class=Printer DriverVer=01/01/2006,1.0.0.1 +PnpLockdown=1 ; ; Manufacturer section. diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf b/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf index 0acf810b..46e88c07 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf @@ -13,6 +13,7 @@ LayoutFile=ntprint.inf ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318} Class=Printer DriverVer=6/07/2001,1.0.0.1 +PnpLockdown=1 ; ; Manufacturer section. @@ -21,7 +22,7 @@ DriverVer=6/07/2001,1.0.0.1 ; that we will display in the Dialog box ; [Manufacturer] -"Microsoft"=Microsoft, NTamd64, NTia64, NTarm64 +"Microsoft"=Microsoft, NTx86, NTamd64, NTia64, NTarm64 ; ; Model sections. @@ -31,7 +32,7 @@ DriverVer=6/07/2001,1.0.0.1 ; that they appear in the INF file. ; -[Microsoft] +[Microsoft.NTx86] "PostScript WaterMark Sample" = INSTALL_WATERMARK.PS "Unidrv WaterMark Sample" = INSTALL_WATERMARK.UNI "OEM PostScript Customization Sample" = INSTALL_OEMPS diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf b/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf index f3c014e5..e91115ba 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf @@ -12,6 +12,7 @@ LayoutFile=ntprint.inf ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318} Class=Printer DriverVer=6/07/2001,1.0.0.1 +PnpLockdown=1 ; ; Manufacturer section. @@ -30,9 +31,6 @@ DriverVer=6/07/2001,1.0.0.1 ; that they appear in the INF file. ; -[Microsoft] -"OEM Pre-Analysis sample" = OEM_PREAN - [Microsoft.NTx86] "OEM Pre-Analysis sample" = OEM_PREAN @@ -105,7 +103,7 @@ oemprean.dll = 100,oemprean\ia64 oemprean.dll = 100,oemprean\arm64 [SourceDisksFiles] -OEMPREAN.GPD = 100 +OEMPREAN.GPD = 100 OEMPREAN.INI = 100 ; @@ -121,3 +119,5 @@ DefaultDestDir=66000 ; [Strings] MS="Microsoft WDK Sample" +OEMSample="Sample Disk" + diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf b/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf index 280386e1..ca31ff3e 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf @@ -13,6 +13,7 @@ LayoutFile=ntprint.inf ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318} Class=Printer DriverVer=6/07/2001,1.0.0.1 +PnpLockdown=1 ; ; Manufacturer section. @@ -21,7 +22,7 @@ DriverVer=6/07/2001,1.0.0.1 ; that we will display in the Dialog box ; [Manufacturer] -"Microsoft"=Microsoft, NTamd64, NTia64, NTarm64 +"Microsoft"=Microsoft, NTx86, NTamd64, NTia64, NTarm64 ; ; Model sections. @@ -31,7 +32,7 @@ DriverVer=6/07/2001,1.0.0.1 ; that they appear in the INF file. ; -[Microsoft] +[Microsoft.NTx86] "OEM Custom UI Plugin" = SYNCSET.UNI "OEM Custom Help" = CUSTHELP.UNI diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf index df4505b6..d696a9d8 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf @@ -13,6 +13,7 @@ LayoutFile=ntprint.inf ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318} Class=Printer DriverVer=06/07/2001,1.0.0.1 +PnpLockdown=1 ; ; Manufacturer section. diff --git a/print/OEM Printer Customization Plug-in Samples/C++/winxp.inf b/print/OEM Printer Customization Plug-in Samples/C++/winxp.inf index 9ca95169..1692dbd5 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/winxp.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/winxp.inf @@ -12,6 +12,7 @@ LayoutFile=ntprint.inf ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318} Class=Printer DriverVer=6/07/2001,1.0.0.1 +PnpLockdown=1 ; ; Manufacturer section. -- cgit v1.3.1 From ed2dc1c4cd26fca2453916d9322b672eb82f0258 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 15 Dec 2022 16:39:10 -0800 Subject: Remove IA64 support from Print samples (#815) Co-authored-by: Jason Knichel --- .../C++/PTPCPlPr/install/ptpcplpr.inf | 8 +------- .../C++/bitmap.inf | 8 +------- .../C++/gdl/res/gdlsmpl.inf | 8 +------- .../C++/oemdll.inf | 19 +------------------ .../C++/oemprean.inf | 8 +------- .../C++/uisamples.inf | 10 +--------- .../C++/uniuirep/res/uniuirep.inf | 10 ++-------- print/XPSDrvSmpl/install/xdsmpl.inf | 16 +--------------- print/XpsRasFilter/install/xpsrassmpl.inf | 13 +------------ print/autoconfig/AutoCnfg.inf | 6 +----- 10 files changed, 11 insertions(+), 95 deletions(-) diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf index 29d1a2b1..0f615192 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf @@ -20,7 +20,7 @@ PnpLockdown=1 ; that we will display in the Dialog box ; [Manufacturer] -"Microsoft"=Microsoft, NTx86, NTamd64, NTia64 +"Microsoft"=Microsoft, NTx86, NTamd64 ; ; Model sections. @@ -36,9 +36,6 @@ PnpLockdown=1 [Microsoft.NTamd64] "UniDrv PT/PC Plugin Provider" = PTPCPLPR -[Microsoft.NTia64] -"UniDrv PT/PC Plugin Provider" = PTPCPLPR - ; ; Installer Sections ; @@ -82,9 +79,6 @@ PTPCPLPR.DLL = 100,x86 [SourceDisksFiles.amd64] PTPCPLPR.DLL = 100,amd64 -[SourceDisksFiles.IA64] -PTPCPLPR.DLL = 100,ia64 - [SourceDisksFiles] PTPCPLPR.GPD = 100 PTPCPLPR.INI = 100 diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf b/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf index 95792aa5..3a13228c 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf @@ -21,7 +21,7 @@ PnpLockdown=1 ; that we will display in the Dialog box ; [Manufacturer] -"Microsoft"=Microsoft, NTx86, NTamd64, NTia64, NTarm64 +"Microsoft"=Microsoft, NTx86, NTamd64, NTarm64 ; ; Model sections. @@ -37,9 +37,6 @@ PnpLockdown=1 [Microsoft.NTamd64] "Bitmap Driver" = BITMAP -[Microsoft.NTia64] -"Bitmap Driver" = BITMAP - [Microsoft.NTarm64] "Bitmap Driver" = BITMAP @@ -97,9 +94,6 @@ bitmap.dll = 100,bitmap\x86 [SourceDisksFiles.amd64] bitmap.dll = 100,bitmap\amd64 -[SourceDisksFiles.ia64] -bitmap.dll = 100,bitmap\ia64 - [SourceDisksFiles.arm64] bitmap.dll = 100,bitmap\arm64 diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf b/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf index f96e8d53..7c65f562 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf @@ -22,7 +22,7 @@ PnpLockdown=1 ; that we will display in the Dialog box ; [Manufacturer] -"Fabrikam"=Fabrikam,NTx86,NTamd64,NTia64 +"Fabrikam"=Fabrikam,NTx86,NTamd64 ; ; Model sections. @@ -38,9 +38,6 @@ PnpLockdown=1 [Fabrikam.NTamd64] "GDL Sample" = GDLSMPL -[Fabrikam.NTia64] -"GDL Sample" = GDLSMPL - ; ; Installer Sections @@ -73,9 +70,6 @@ GDLSMPL.dll = 100,x86 [SourceDisksFiles.amd64] GDLSMPL.dll = 100,amd64 -[SourceDisksFiles.IA64] -GDLSMPL.dll = 100,ia64 - [SourceDisksFiles] GDLSMPL.GPD = 100 GDLSMPL.INI = 100 diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf b/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf index 46e88c07..d70c1568 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf @@ -22,7 +22,7 @@ PnpLockdown=1 ; that we will display in the Dialog box ; [Manufacturer] -"Microsoft"=Microsoft, NTx86, NTamd64, NTia64, NTarm64 +"Microsoft"=Microsoft, NTx86, NTamd64, NTarm64 ; ; Model sections. @@ -48,14 +48,6 @@ PnpLockdown=1 "OEM UI Customization Sample (PS)" = INSTALL_OEMUI.PS "OEM UI Customization Sample (Unidrv)" = INSTALL_OEMUI.UNI -[Microsoft.NTia64] -"PostScript WaterMark Sample" = INSTALL_WATERMARK.PS -"Unidrv WaterMark Sample" = INSTALL_WATERMARK.UNI -"OEM PostScript Customization Sample" = INSTALL_OEMPS -"OEM Unidrv Customization Sample" = INSTALL_OEMUNI -"OEM UI Customization Sample (PS)" = INSTALL_OEMUI.PS -"OEM UI Customization Sample (Unidrv)" = INSTALL_OEMUI.UNI - [Microsoft.NTarm64] "PostScript WaterMark Sample" = INSTALL_WATERMARK.PS "Unidrv WaterMark Sample" = INSTALL_WATERMARK.UNI @@ -191,15 +183,6 @@ wmarkuni.dll = 100,WaterMarkUni\amd64 wmarkuniui.dll = 100,WaterMarkUni\amd64 wmarkui.dll = 100,WaterMark\amd64 -[SourceDisksFiles.ia64] -oemps.dll = 100,OEMPS\ia64 -oemui.dll = 100,OEMUI\ia64 -oemuni.dll = 100,OEMUNI\ia64 -wmarkps.dll = 100,WaterMark\ia64 -wmarkuni.dll = 100,WaterMarkUni\ia64 -wmarkuniui.dll = 100,WaterMarkUni\ia64 -wmarkui.dll = 100,WaterMark\ia64 - [SourceDisksFiles.arm64] oemps.dll = 100,OEMPS\arm64 oemui.dll = 100,OEMUI\arm64 diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf b/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf index e91115ba..6885d73a 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf @@ -21,7 +21,7 @@ PnpLockdown=1 ; that we will display in the Dialog box ; [Manufacturer] -"Microsoft"=Microsoft, NTx86, NTamd64, NTia64, NTarm64 +"Microsoft"=Microsoft, NTx86, NTamd64, NTarm64 ; ; Model sections. @@ -37,9 +37,6 @@ PnpLockdown=1 [Microsoft.NTamd64] "OEM Pre-Analysis sample" = OEM_PREAN -[Microsoft.NTia64] -"OEM Pre-Analysis sample" = OEM_PREAN - [Microsoft.NTarm64] "OEM Pre-Analysis sample" = OEM_PREAN @@ -96,9 +93,6 @@ oemprean.dll = 100,oemprean\x86 [SourceDisksFiles.amd64] oemprean.dll = 100,oemprean\amd64 -[SourceDisksFiles.ia64] -oemprean.dll = 100,oemprean\ia64 - [SourceDisksFiles.arm64] oemprean.dll = 100,oemprean\arm64 diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf b/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf index ca31ff3e..aed12762 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf @@ -22,7 +22,7 @@ PnpLockdown=1 ; that we will display in the Dialog box ; [Manufacturer] -"Microsoft"=Microsoft, NTx86, NTamd64, NTia64, NTarm64 +"Microsoft"=Microsoft, NTx86, NTamd64, NTarm64 ; ; Model sections. @@ -40,10 +40,6 @@ PnpLockdown=1 "OEM Custom UI Plugin" = SYNCSET.UNI "OEM Custom Help" = CUSTHELP.UNI -[Microsoft.NTia64] -"OEM Custom UI Plugin" = SYNCSET.UNI -"OEM Custom Help" = CUSTHELP.UNI - [Microsoft.NTarm64] "OEM Custom UI Plugin" = SYNCSET.UNI "OEM Custom Help" = CUSTHELP.UNI @@ -108,10 +104,6 @@ SYNCSET.DLL = 100,SyncSet\x86 CUSTHLP.DLL = 100,CustHlp\amd64 SYNCSET.DLL = 100,SyncSet\amd64 -[SourceDisksFiles.ia64] -CUSTHLP.DLL = 100,CustHlp\ia64 -SYNCSET.DLL = 100,SyncSet\ia64 - [SourceDisksFiles.arm64] CUSTHLP.DLL = 100,CustHlp\arm64 SYNCSET.DLL = 100,SyncSet\arm64 diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf index d696a9d8..46ce3677 100644 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf +++ b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf @@ -22,7 +22,7 @@ PnpLockdown=1 ; that we will display in the Dialog box ; [Manufacturer] -"Microsoft"=Microsoft,NTx86,NTamd64,NTia64 +"Microsoft"=Microsoft,NTx86,NTamd64 ; ; Model sections. @@ -38,9 +38,6 @@ PnpLockdown=1 [Microsoft.NTamd64] "Unidrv Full UI Replacement Sample" = UNIUIREP -[Microsoft.NTia64] -"Unidrv Full UI Replacement Sample" = UNIUIREP - ; ; Installer Sections @@ -73,11 +70,8 @@ uniuirep.dll = 100,x86 [SourceDisksFiles.amd64] uniuirep.dll = 100,amd64 -[SourceDisksFiles.IA64] -uniuirep.dll = 100,ia64 - [SourceDisksFiles] -uniuirep.GPD = 100 +uniuirep.GPD = 100 uniuirep.INI = 100 ; diff --git a/print/XPSDrvSmpl/install/xdsmpl.inf b/print/XPSDrvSmpl/install/xdsmpl.inf index 2514a3ec..37a0b569 100644 --- a/print/XPSDrvSmpl/install/xdsmpl.inf +++ b/print/XPSDrvSmpl/install/xdsmpl.inf @@ -25,23 +25,17 @@ DriverVer=10/17/2008,6.1.6930.0 PnpLockdown=1 [Manufacturer] -%ManufacturerName%=Standard,NTx86,NTia64,NTamd64,NTx86.6.0,NTia64.6.0,NTamd64.6.0,NTarm64.6.0 +%ManufacturerName%=Standard,NTx86,NTamd64,NTx86.6.0,NTamd64.6.0,NTarm64.6.0 [Standard.NTx86] "XPSDrv Sample Driver" = INSTALL_XDSMPL_FILTERS_PRE_VISTA -[Standard.NTia64] -"XPSDrv Sample Driver" = INSTALL_XDSMPL_FILTERS_PRE_VISTA - [Standard.NTamd64] "XPSDrv Sample Driver" = INSTALL_XDSMPL_FILTERS_PRE_VISTA [Standard.NTx86.6.0] "XPSDrv Sample Driver" = INSTALL_XDSMPL_FILTERS_VISTA -[Standard.NTia64.6.0] -"XPSDrv Sample Driver" = INSTALL_XDSMPL_FILTERS_VISTA - [Standard.NTamd64.6.0] "XPSDrv Sample Driver" = INSTALL_XDSMPL_FILTERS_VISTA @@ -75,10 +69,6 @@ CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-49 PackageAware=TRUE CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-4950-9ED8-A6335AFE79F5} -[PrinterPackageInstallation.ia64] -PackageAware=TRUE -CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-4950-9ED8-A6335AFE79F5} - [PrinterPackageInstallation.arm64] PackageAware=TRUE CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-4950-9ED8-A6335AFE79F5} @@ -114,10 +104,6 @@ xdsmpl-pipelineconfig.xml 1 = %Location%,, 2 = %Location%,,,x86 -[SourceDisksNames.ia64] -1 = %Location%,, -2 = %Location%,,,ia64 - [SourceDisksNames.amd64] 1 = %Location%,, 2 = %Location%,,,amd64 diff --git a/print/XpsRasFilter/install/xpsrassmpl.inf b/print/XpsRasFilter/install/xpsrassmpl.inf index 3136be00..fbfdcf94 100644 --- a/print/XpsRasFilter/install/xpsrassmpl.inf +++ b/print/XpsRasFilter/install/xpsrassmpl.inf @@ -25,15 +25,12 @@ DriverVer=10/17/2008,6.1.6930.0 PnpLockdown=1 [Manufacturer] -%ManufacturerName%=Standard,NTx86.6.1,NTia64.6.1,NTamd64.6.1,NTarm64.6.1 +%ManufacturerName%=Standard,NTx86.6.1,NTamd64.6.1,NTarm64.6.1 [Standard.NTx86.6.1] "XPSRas WDK Sample Driver" = INSTALL_FILTER -[Standard.NTia64.6.1] -"XPSRas WDK Sample Driver" = INSTALL_FILTER - [Standard.NTamd64.6.1] "XPSRas WDK Sample Driver" = INSTALL_FILTER @@ -56,10 +53,6 @@ CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-49 PackageAware=TRUE CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-4950-9ED8-A6335AFE79F5} -[PrinterPackageInstallation.ia64] -PackageAware=TRUE -CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-4950-9ED8-A6335AFE79F5} - [PrinterPackageInstallation.arm64] PackageAware=TRUE CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-4950-9ED8-A6335AFE79F5} @@ -76,10 +69,6 @@ xpsrasfilter.dll 1 = %Location%,, 2 = %Location%,,,x86 -[SourceDisksNames.ia64] -1 = %Location%,, -2 = %Location%,,,ia64 - [SourceDisksNames.amd64] 1 = %Location%,, 2 = %Location%,,,amd64 diff --git a/print/autoconfig/AutoCnfg.inf b/print/autoconfig/AutoCnfg.inf index 79d871d9..2a64ab8d 100644 --- a/print/autoconfig/AutoCnfg.inf +++ b/print/autoconfig/AutoCnfg.inf @@ -22,7 +22,7 @@ PnpLockdown=1 ; that we will display in the Dialog box ; [Manufacturer] -%ManufacturerName%=Standard, NTx86, NTamd64, NTia64, NTarm64 +%ManufacturerName%=Standard, NTx86, NTamd64, NTarm64 ; ; Model sections. @@ -39,10 +39,6 @@ PnpLockdown=1 "Unidrv AutoConfiguration Sample" = INSTALL_AUTO_CONFIG.UNI,DO_NOT_USE_THIS_HWID1 "PScript5 AutoConfiguration Sample" = INSTALL_AUTO_CONFIG.PS,DO_NOT_USE_THIS_HWID2 -[Standard.NTia64] -"Unidrv AutoConfiguration Sample" = INSTALL_AUTO_CONFIG.UNI,DO_NOT_USE_THIS_HWID1 -"PScript5 AutoConfiguration Sample" = INSTALL_AUTO_CONFIG.PS,DO_NOT_USE_THIS_HWID2 - [Standard.NTarm64] "Unidrv AutoConfiguration Sample" = INSTALL_AUTO_CONFIG.UNI,DO_NOT_USE_THIS_HWID1 "PScript5 AutoConfiguration Sample" = INSTALL_AUTO_CONFIG.PS,DO_NOT_USE_THIS_HWID2 -- cgit v1.3.1 From 7092f6df0e6e86f16dc4e7a11ea8eefbdb1c6da8 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 3 Jan 2023 13:07:39 -0800 Subject: Remove IA64 support from more samples (#816) Co-authored-by: Jason Knichel --- general/toaster/toastpkg/inf/autorun.inf | 3 --- general/toaster/toastpkg/inf/toastpkg.inf | 11 ++--------- general/toaster/toastpkg/toastcd/autorun.inf | 3 --- general/toaster/toastpkg/toastcd/toastpkg.inf | 11 ++--------- storage/class/disk/src/diskdev.inf | 9 +-------- wia/microdrv/testmcro.inf | 11 +---------- 6 files changed, 6 insertions(+), 42 deletions(-) diff --git a/general/toaster/toastpkg/inf/autorun.inf b/general/toaster/toastpkg/inf/autorun.inf index 4c582d7b..ee67cf9a 100644 --- a/general/toaster/toastpkg/inf/autorun.inf +++ b/general/toaster/toastpkg/inf/autorun.inf @@ -5,9 +5,6 @@ icon=i386\toastva.exe,0 [AutoRun.i386] open=i386\toastva.exe -[AutoRun.ia64] -open=ia64\toastva.exe - [AutoRun.amd64] open=amd64\toastva.exe diff --git a/general/toaster/toastpkg/inf/toastpkg.inf b/general/toaster/toastpkg/inf/toastpkg.inf index 5068d751..f7e45bd9 100644 --- a/general/toaster/toastpkg/inf/toastpkg.inf +++ b/general/toaster/toastpkg/inf/toastpkg.inf @@ -16,7 +16,7 @@ ; INF file for installing toaster device drivers (and, optionally, value- ; added software) via device-specific coinstaller. ; This is a mutlios INF file. Same INF file cab be used on -; x86, ia64 and amd64 platforms. +; x86 and amd64 platforms. ; ;--*/ [Version] @@ -26,7 +26,6 @@ ClassGuid={B85B7C50-6A01-11d2-B841-00C04FAD5171} Provider=%ProviderName% DriverVer=09/21/2006,6.0.5736.1 CatalogFile.NTx86 = tostx86.cat -CatalogFile.NTIA64 = tostia64.cat CatalogFile.NTAMD64 = tstamd64.cat PnpLockdown=1 @@ -49,14 +48,11 @@ HKR,,DeviceCharacteristics,0x10001,0x100 ; Use same security checks on re ;***************************************** [Manufacturer] -%ToastRUs%=ToastRUs,NTx86, NTia64, NTamd64 +%ToastRUs%=ToastRUs,NTx86, NTamd64 [ToastRUs.NTx86] %ToasterDevice.DeviceDesc%=Toaster_Device, {b85b7c50-6a01-11d2-b841-00c04fad5171}\MsToaster -[ToastRUs.NTia64] -%ToasterDevice.DeviceDesc%=Toaster_Device, {b85b7c50-6a01-11d2-b841-00c04fad5171}\MsToaster - [ToastRUs.NTamd64] %ToasterDevice.DeviceDesc%=Toaster_Device, {b85b7c50-6a01-11d2-b841-00c04fad5171}\MsToaster @@ -106,9 +102,6 @@ OriginalInfSourcePath = %1% [SourceDisksNames.x86] 1 = %DiskId1%, toastpkg.tag,,\i386 -[SourceDisksNames.ia64] -1 = %DiskId1%, toastpkg.tag,,\ia64 - [SourceDisksNames.amd64] 1 = %DiskId1%, toastpkg.tag,,\amd64 diff --git a/general/toaster/toastpkg/toastcd/autorun.inf b/general/toaster/toastpkg/toastcd/autorun.inf index 4c582d7b..ee67cf9a 100644 --- a/general/toaster/toastpkg/toastcd/autorun.inf +++ b/general/toaster/toastpkg/toastcd/autorun.inf @@ -5,9 +5,6 @@ icon=i386\toastva.exe,0 [AutoRun.i386] open=i386\toastva.exe -[AutoRun.ia64] -open=ia64\toastva.exe - [AutoRun.amd64] open=amd64\toastva.exe diff --git a/general/toaster/toastpkg/toastcd/toastpkg.inf b/general/toaster/toastpkg/toastcd/toastpkg.inf index 5068d751..f7e45bd9 100644 --- a/general/toaster/toastpkg/toastcd/toastpkg.inf +++ b/general/toaster/toastpkg/toastcd/toastpkg.inf @@ -16,7 +16,7 @@ ; INF file for installing toaster device drivers (and, optionally, value- ; added software) via device-specific coinstaller. ; This is a mutlios INF file. Same INF file cab be used on -; x86, ia64 and amd64 platforms. +; x86 and amd64 platforms. ; ;--*/ [Version] @@ -26,7 +26,6 @@ ClassGuid={B85B7C50-6A01-11d2-B841-00C04FAD5171} Provider=%ProviderName% DriverVer=09/21/2006,6.0.5736.1 CatalogFile.NTx86 = tostx86.cat -CatalogFile.NTIA64 = tostia64.cat CatalogFile.NTAMD64 = tstamd64.cat PnpLockdown=1 @@ -49,14 +48,11 @@ HKR,,DeviceCharacteristics,0x10001,0x100 ; Use same security checks on re ;***************************************** [Manufacturer] -%ToastRUs%=ToastRUs,NTx86, NTia64, NTamd64 +%ToastRUs%=ToastRUs,NTx86, NTamd64 [ToastRUs.NTx86] %ToasterDevice.DeviceDesc%=Toaster_Device, {b85b7c50-6a01-11d2-b841-00c04fad5171}\MsToaster -[ToastRUs.NTia64] -%ToasterDevice.DeviceDesc%=Toaster_Device, {b85b7c50-6a01-11d2-b841-00c04fad5171}\MsToaster - [ToastRUs.NTamd64] %ToasterDevice.DeviceDesc%=Toaster_Device, {b85b7c50-6a01-11d2-b841-00c04fad5171}\MsToaster @@ -106,9 +102,6 @@ OriginalInfSourcePath = %1% [SourceDisksNames.x86] 1 = %DiskId1%, toastpkg.tag,,\i386 -[SourceDisksNames.ia64] -1 = %DiskId1%, toastpkg.tag,,\ia64 - [SourceDisksNames.amd64] 1 = %DiskId1%, toastpkg.tag,,\amd64 diff --git a/storage/class/disk/src/diskdev.inf b/storage/class/disk/src/diskdev.inf index 4db49829..70e8fad1 100644 --- a/storage/class/disk/src/diskdev.inf +++ b/storage/class/disk/src/diskdev.inf @@ -25,16 +25,12 @@ DefaultDestDir = 12 ; [Manufacturer] -%MfgName% = Standard.Mfg, NTx86, NTia64, NTamd64 +%MfgName% = Standard.Mfg, NTx86, NTamd64 [Standard.Mfg.NTx86] %GenDisk.DeviceDesc% = disk, GenDisk %GenOptical.DeviceDesc% = disk, GenOptical -[Standard.Mfg.NTia64] -%GenDisk.DeviceDesc% = disk, GenDisk -%GenOptical.DeviceDesc% = disk, GenOptical - [Standard.Mfg.NTamd64] %GenDisk.DeviceDesc% = disk, GenDisk %GenOptical.DeviceDesc% = disk, GenOptical @@ -78,9 +74,6 @@ ServiceBinary = %12%\disk.sys [SourceDisksNames.x86] 1 = %DiskId1%,,,\i386 -[SourceDisksNames.ia64] -1 = %DiskId1%,,,\ia64 - [SourceDisksNames.amd64] 1 = %DiskId1%,,,\amd64 diff --git a/wia/microdrv/testmcro.inf b/wia/microdrv/testmcro.inf index 13e5b682..741c3bb4 100644 --- a/wia/microdrv/testmcro.inf +++ b/wia/microdrv/testmcro.inf @@ -16,11 +16,6 @@ testmcro.dll=1 [SourceDisksNames.x86] 1=%Location%,,, -[SourceDisksFiles.ia64] -testmcro.dll=1 -[SourceDisksNames.ia64] -1=%Location%,,, - [SourceDisksFiles.amd64] testmcro.dll=1 [SourceDisksNames.amd64] @@ -31,7 +26,7 @@ testmcro.dll=1 DefaultDestDir=11 [Manufacturer] -%ManufacturerName%=Models, NTx86, NTamd64, NTia64 +%ManufacturerName%=Models, NTx86, NTamd64 ; This is the models section for the x86 driver [Models.NTx86] @@ -41,10 +36,6 @@ DefaultDestDir=11 [Models.NTamd64] %WIASample.DeviceDesc% = WIASample.Scanner, PnPIDInformation -; This is the models section for the ia64 driver -[Models.NTia64] -%WIASample.DeviceDesc% = WIASample.Scanner, PnPIDInformation - [WIASample.Scanner] Include=sti.inf Needs=STI.SerialSection, STI.MICRODRIVERSection -- cgit v1.3.1 From 568ddda9b180706e03ead12e2e99bc46cd33a0a6 Mon Sep 17 00:00:00 2001 From: alexke-dev <65682333+alexke-dev@users.noreply.github.com> Date: Fri, 6 Jan 2023 16:36:29 -0800 Subject: Update ProdScan and WiaDriver samples (#824) Update ProdScan and WiaDriver samples to target a single architecture. --- wia/ProdScan/ProdScan.inf | 79 --------------------- wia/ProdScan/ProdScan.inx | Bin 0 -> 3734 bytes wia/ProdScan/ProdScan.vcxproj | 9 ++- wia/copywia.cmd | 4 +- wia/wiadriverex/usd/WiaDriver.inx | Bin 0 -> 7514 bytes wia/wiadriverex/usd/wiadriverex.vcxproj | 9 ++- wia/wiadriverex/wiadriver.inf | 119 -------------------------------- 7 files changed, 18 insertions(+), 202 deletions(-) delete mode 100644 wia/ProdScan/ProdScan.inf create mode 100644 wia/ProdScan/ProdScan.inx create mode 100644 wia/wiadriverex/usd/WiaDriver.inx delete mode 100644 wia/wiadriverex/wiadriver.inf diff --git a/wia/ProdScan/ProdScan.inf b/wia/ProdScan/ProdScan.inf deleted file mode 100644 index 26359afa..00000000 --- a/wia/ProdScan/ProdScan.inf +++ /dev/null @@ -1,79 +0,0 @@ -; -; ProdScan.inf - installation file for the Production Scanner Driver Sample -; -; Copyright (c) Microsoft Corporation. All rights reserved. -; -; Manufacturer: Microsoft -; -[Version] -Signature="$WINDOWS NT$" -Class=Image -ClassGUID={6bdd1fc6-810f-11d0-bec7-08002be2092f} -Provider=%ProviderString% -DriverVer=10/16/2015,1.0.0.2 -CatalogFile=prodscan.cat -PnpLockdown=1 - -[SourceDisksFiles] -ProdScan.dll=1 - -[SourceDisksNames] -1=%Location%,,, - -[DestinationDirs] -DefaultDestDir = 11 - -[Manufacturer] -%ManufacturerName%=Models,NTx86,NTAMD64,NTIA64,NTARM,NTARM64 - -[Models.NTx86] -%ProdScan.DeviceDesc% = ProdScan.Device, WIADRIVER_PNP_ID, USB\MS_COMP_SCAN&MS_SUBCOMP_WIAPNPID - -[Models.NTAMD64] -%ProdScan.DeviceDesc% = ProdScan.Device, WIADRIVER_PNP_ID, USB\MS_COMP_SCAN&MS_SUBCOMP_WIAPNPID - -[Models.NTIA64] -%ProdScan.DeviceDesc% = ProdScan.Device, WIADRIVER_PNP_ID, USB\MS_COMP_SCAN&MS_SUBCOMP_WIAPNPID - -[Models.NTARM] -%ProdScan.DeviceDesc% = ProdScan.Device, WIADRIVER_PNP_ID, USB\MS_COMP_SCAN&MS_SUBCOMP_WIAPNPID - -[Models.NTARM64] -%ProdScan.DeviceDesc% = ProdScan.Device, WIADRIVER_PNP_ID, USB\MS_COMP_SCAN&MS_SUBCOMP_WIAPNPID - -[ProdScan.Device] -Include = sti.inf -Needs = STI.SerialSection -PortSelect = no -SubClass = StillImage -DeviceType = 1 -DeviceSubType = 1 -Capabilities = 0x31 -Events = ProdScan.Events -AddReg = ProdScan.AddReg -CopyFiles = ProdScan.CopyFiles -ICMProfiles = "sRGB Color Space Profile.icm" - -[ProdScan.CopyFiles] -ProdScan.dll - -[ProdScan.AddReg] -HKR,,HardwareConfig,1,1 -HKR,,USDClass,,"{EB135F56-B088-4bc7-9733-422F324B3A09}" -HKCR,CLSID\{EB135F56-B088-4bc7-9733-422F324B3A09},,,"Production Scanner Driver Sample" -HKCR,CLSID\{EB135F56-B088-4bc7-9733-422F324B3A09}\InProcServer32,,0x00020000,%%SystemRoot%%\System32\ProdScan.dll -HKCR,CLSID\{EB135F56-B088-4bc7-9733-422F324B3A09}\InProcServer32,ThreadingModel,,"Both" - -[ProdScan.Events] -ScanEvent = %ScanEvent.Desc%,{A6C5A715-8C6E-11d2-977A-0000F87A926F},* - -[ProdScan.Device.Services] -Include = sti.inf -Needs = STI.SerialSection.Services - -[Strings] -ManufacturerName="TODO-Set-Manufacturer" -ProviderString="TODO-Set-Provider" -Location="Production Scanner Driver Sample Installation Source" -ProdScan.DeviceDesc = "Production Scanner Test Driver" -ScanEvent.Desc="Scan" diff --git a/wia/ProdScan/ProdScan.inx b/wia/ProdScan/ProdScan.inx new file mode 100644 index 00000000..33d0da88 Binary files /dev/null and b/wia/ProdScan/ProdScan.inx differ diff --git a/wia/ProdScan/ProdScan.vcxproj b/wia/ProdScan/ProdScan.vcxproj index 2b14d9a8..a94d26db 100644 --- a/wia/ProdScan/ProdScan.vcxproj +++ b/wia/ProdScan/ProdScan.vcxproj @@ -74,7 +74,14 @@ - + + + $(InfArch) + true + true + .\$(IntDir)\ProdScan.inf + + ProdScan diff --git a/wia/copywia.cmd b/wia/copywia.cmd index 49f6f1cf..df37a38c 100644 --- a/wia/copywia.cmd +++ b/wia/copywia.cmd @@ -92,11 +92,11 @@ copy wiadriverex\segfilter\%build_samples%\%cpu_samples%\segfilter.dll %1wiabi copy wiadriverex\imgfilter\%build_samples%\%cpu_samples%\imgfilter.dll %1wiabins\drivers copy wiadriverex\errhandler\%build_samples%\%cpu_samples%\errhandler.dll %1wiabins\drivers copy wiadriverex\uiext2\%build_samples%\%cpu_samples%\uiext2.dll %1wiabins\drivers -copy wiadriverex\wiadriver.inf %1wiabins\drivers +copy wiadriverex\usd\%build_samples%\%cpu_samples%\wiadriver.inf %1wiabins\drivers copy wiadriverex\sample.bmp %1wiabins\drivers copy prodscan\%build_samples%\%cpu_samples%\prodscan.dll %1wiabins\drivers -copy prodscan\prodscan.inf %1wiabins\drivers +copy prodscan\%build_samples%\%cpu_samples%\prodscan.inf %1wiabins\drivers copy "%build_tools%\%cpu_tools%\wiainfo2.exe" %1wiabins copy "%build_tools%\%cpu_tools%\wiatrcvw.exe" %1wiabins diff --git a/wia/wiadriverex/usd/WiaDriver.inx b/wia/wiadriverex/usd/WiaDriver.inx new file mode 100644 index 00000000..d7feb02f Binary files /dev/null and b/wia/wiadriverex/usd/WiaDriver.inx differ diff --git a/wia/wiadriverex/usd/wiadriverex.vcxproj b/wia/wiadriverex/usd/wiadriverex.vcxproj index 583c90f4..50129b85 100644 --- a/wia/wiadriverex/usd/wiadriverex.vcxproj +++ b/wia/wiadriverex/usd/wiadriverex.vcxproj @@ -74,7 +74,14 @@ - + + + $(InfArch) + true + true + .\$(IntDir)\WiaDriver.inf + + wiadriverex diff --git a/wia/wiadriverex/wiadriver.inf b/wia/wiadriverex/wiadriver.inf deleted file mode 100644 index b0d37528..00000000 --- a/wia/wiadriverex/wiadriver.inf +++ /dev/null @@ -1,119 +0,0 @@ -; WIADRIVER.INF -- WIA Driver setup file -; Copyright (c) 2003 Microsoft Corporation -; Manufacturer: Microsoft Windows Imaging Acquisition Team - -[Version] -Signature="$WINDOWS NT$" -Class=Image -ClassGUID={6bdd1fc6-810f-11d0-bec7-08002be2092f} -Provider=%ProviderString% -DriverVer=09/20/2004,1.0.0.7 -CatalogFile=wiadriver.cat -PnpLockdown=1 - -[SourceDisksFiles] -wiadriverex.dll=1 -segfilter.dll=1 -imgfilter.dll=1 -errhandler.dll=1 -uiext2.dll=1 -sample.bmp=1 - -[SourceDisksNames] -1=%Location%,,, - -[DestinationDirs] -DefaultDestDir=11 -WIADRIVER.StorageFiles=10,ServiceProfiles\LocalService\Documents\WIADRIVER\STORAGE - -[Manufacturer] -%ManufacturerName%=Models, NTx86, NTAMD64, NTIA64, NTARM, NTARM64 - -; This is the models section for the x86 driver -[Models.NTx86] -%WIADRIVER.DeviceDesc% = WIADRIVER.Device, WIADRIVER_PNP_ID, USB\MS_COMP_SCAN&MS_SUBCOMP_WIAPNPID - -; This is the models section for the AMD64 driver -[Models.NTAMD64] -%WIADRIVER.DeviceDesc% = WIADRIVER.Device, WIADRIVER_PNP_ID, USB\MS_COMP_SCAN&MS_SUBCOMP_WIAPNPID - -; This is the models section for the IA64 driver -[Models.NTIA64] -%WIADRIVER.DeviceDesc% = WIADRIVER.Device, WIADRIVER_PNP_ID, USB\MS_COMP_SCAN&MS_SUBCOMP_WIAPNPID - -; This is the models section for the ARM driver -[Models.NTARM] -%WIADRIVER.DeviceDesc% = WIADRIVER.Device, WIADRIVER_PNP_ID, USB\MS_COMP_SCAN&MS_SUBCOMP_WIAPNPID - -; This is the models section for the ARM64 driver -[Models.NTARM64] -%WIADRIVER.DeviceDesc% = WIADRIVER.Device, WIADRIVER_PNP_ID, USB\MS_COMP_SCAN&MS_SUBCOMP_WIAPNPID - -[WIADRIVER.Device] -Include=sti.inf -Needs=STI.SerialSection -PortSelect=no -SubClass=StillImage -DeviceType=1 -DeviceSubType=0x1 -Capabilities=0x30 -Events=WIADRIVER.Events -DeviceData=WIADRIVER.DeviceData -AddReg=WIADRIVER.AddReg -CopyFiles=WIADRIVER.CopyFiles,WIADRIVER.StorageFiles -ICMProfiles="sRGB Color Space Profile.icm" - -[WIADRIVER.Events] - -[WIADRIVER.Device.Services] -Include=sti.inf -Needs=STI.SerialSection.Services - -[WIADRIVER.DeviceData] -UI Class ID={07DD9E07-ECC0-438a-B5EB-C5227ECA910E} -StoragePath=%10%\ServiceProfiles\LocalService\Documents\WIADRIVER\STORAGE - -[WIADRIVER.AddReg] -HKR,,HardwareConfig,1,1 -HKR,,USDClass,,"{EEA1E6F7-A59C-487a-BFFA-BD8AA99FE503}" -HKCR,CLSID\{EEA1E6F7-A59C-487a-BFFA-BD8AA99FE503},,,"Extended WIA Driver" -HKCR,CLSID\{EEA1E6F7-A59C-487a-BFFA-BD8AA99FE503}\InProcServer32,,0x00020000,%%SystemRoot%%\System32\wiadriverex.dll -HKCR,CLSID\{EEA1E6F7-A59C-487a-BFFA-BD8AA99FE503}\InProcServer32,ThreadingModel,,"Both" - -HKCR,CLSID\{07DD9E07-ECC0-438a-B5EB-C5227ECA910E},,,"WIA Driver UI Extension" -HKCR,CLSID\{07DD9E07-ECC0-438a-B5EB-C5227ECA910E}\shellex\SegmentationFilter\{7B6D704B-A4F2-4ecf-8B86-8E0CF1A707F5} -HKCR,CLSID\{07DD9E07-ECC0-438a-B5EB-C5227ECA910E}\shellex\ImageProcessingFilter\{AA9198F3-3B91-47d3-A371-EBE7D243F606} -HKCR,CLSID\{07DD9E07-ECC0-438a-B5EB-C5227ECA910E}\shellex\ErrorHandler\{CFC1A4D4-5F27-4881-81E4-1BE314EB22F7} -HKCR,CLSID\{07DD9E07-ECC0-438a-B5EB-C5227ECA910E}\shellex\WiaDialogExtensionHandlers\{61364062-0593-4eda-84d2-f5531d8c3259} - -HKCR,CLSID\{7B6D704B-A4F2-4ecf-8B86-8E0CF1A707F5},,,"WIA Sample Segmentation Filter" -HKCR,CLSID\{7B6D704B-A4F2-4ecf-8B86-8E0CF1A707F5}\InProcServer32,,0x00020000,%%SystemRoot%%\System32\segfilter.dll -HKCR,CLSID\{7B6D704B-A4F2-4ecf-8B86-8E0CF1A707F5}\InProcServer32,ThreadingModel,,"Both" - -HKCR,CLSID\{AA9198F3-3B91-47d3-A371-EBE7D243F606},,,"WIA Sample Image Processing Filter" -HKCR,CLSID\{AA9198F3-3B91-47d3-A371-EBE7D243F606}\InProcServer32,,0x00020000,%%SystemRoot%%\System32\imgfilter.dll -HKCR,CLSID\{AA9198F3-3B91-47d3-A371-EBE7D243F606}\InProcServer32,ThreadingModel,,"Both" - -HKCR,CLSID\{CFC1A4D4-5F27-4881-81E4-1BE314EB22F7},,,"WIA Sample Error Handler" -HKCR,CLSID\{CFC1A4D4-5F27-4881-81E4-1BE314EB22F7}\InProcServer32,,0x00020000,%%SystemRoot%%\System32\errhandler.dll -HKCR,CLSID\{CFC1A4D4-5F27-4881-81E4-1BE314EB22F7}\InProcServer32,ThreadingModel,,"Both" - -HKCR,CLSID\{61364062-0593-4eda-84d2-f5531d8c3259},,,"WIA Dialog Extension Handler" -HKCR,CLSID\{61364062-0593-4eda-84d2-f5531d8c3259}\InProcServer32,,0x00020000,%%SystemRoot%%\System32\uiext2.dll -HKCR,CLSID\{61364062-0593-4eda-84d2-f5531d8c3259}\InProcServer32,ThreadingModel,,"Both" - -[WIADRIVER.CopyFiles] -wiadriverex.dll -segfilter.dll -imgfilter.dll -errhandler.dll -uiext2.dll - -[WIADRIVER.StorageFiles] -sample.bmp - -[Strings] -ManufacturerName="TODO-Set-Manufacturer" -ProviderString="TODO-Set-Provider" -Location="WIA Monster Device Driver Installation Source" -WIADRIVER.DeviceDesc="Extended WIA Monster Device" -- cgit v1.3.1 From 8cfa11c4cc71344667cb797ee46101a988972e03 Mon Sep 17 00:00:00 2001 From: dnl-q <45866298+dnl-q@users.noreply.github.com> Date: Fri, 13 Jan 2023 10:30:47 -0800 Subject: Update BthEchoSampleCli and BthEchoSampleSrv to be single architectur… (#825) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update BthEchoSampleCli and BthEchoSampleSrv to be single architecture targeted and the specific build architecture is stamped at the time it is built. * Remove long deprecated WDF coinstaller references. Rename CopyFiles section from Drivers_Dir to DriverStore_Dir. Revert TargetOSVersion for the Models sections to NT$ARCH$...1, the same as before without my changes. * Address more PR feedbacks and update README.md. Co-authored-by: Hongwei Qi --- bluetooth/bthecho/README.md | 4 ++-- bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx | Bin 5974 -> 4526 bytes bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx | Bin 5988 -> 4538 bytes 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bluetooth/bthecho/README.md b/bluetooth/bthecho/README.md index 6f7c92c8..275cf8d9 100644 --- a/bluetooth/bthecho/README.md +++ b/bluetooth/bthecho/README.md @@ -58,7 +58,7 @@ You can build the sample in two ways: using the Visual Studio Integrated Develop #### Server Installation -1. Copy KMDF coinstaller (wdfcoinstallerMMmmm.dll, from redist\\wdf\\ ), BthEchoSampleSrv.Sys, BthEchoSampleSrv.inf and bthsrvinst.exe on a temporary directory on the target machine. +1. Copy BthEchoSampleSrv.Sys, BthEchoSampleSrv.inf and bthsrvinst.exe on a temporary directory on the target machine. 1. Run bthsrvinst.exe /i to install the echo server device. This enables the Bluetooth Enumerator (BthEnum.sys) to enumerate echo server device and create a PDO for the device (please refer to the device tree below). @@ -111,7 +111,7 @@ You can build the sample in two ways: using the Visual Studio Integrated Develop > [!IMPORTANT] > This must be done on a separate machine from the one where echo server device was installed. -1. Copy KMDF coinstaller (wdfcoinstallerMMmmm.dll, from redist\\wdf\\), BthEchoSampleCli.Sys, BthEchoSampleCli.inf and bthecho.exe on a temporary directory on the target machine. +1. Copy BthEchoSampleCli.Sys, BthEchoSampleCli.inf and bthecho.exe on a temporary directory on the target machine. 1. Run bthprops.cpl from a command line or right click on the Bluetooth icon in the system tray and select 'Show Devices' to bring up a list of installed Bluetooth devices. diff --git a/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx b/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx index a1d3eb5a..e6bfeb55 100644 Binary files a/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx and b/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx differ diff --git a/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx b/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx index fecdbcb5..f8f62e88 100644 Binary files a/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx and b/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx differ -- cgit v1.3.1 From b35c9d13274e237eea8abdd5fb06c5f29429fddb Mon Sep 17 00:00:00 2001 From: alexke-dev <65682333+alexke-dev@users.noreply.github.com> Date: Wed, 18 Jan 2023 11:51:27 -0800 Subject: Update TestMcro sample to target a single architecture and support best practices (#837) * Update TestMcro sample to target a single architecture. * Update copywia.cmd to use the new path for the TestMcro.inf file. * Restore missing BOM to vcxproj file. --- wia/copywia.cmd | 2 +- wia/microdrv/testmcro.inf | 74 ------------------------------------------ wia/microdrv/testmcro.inx | Bin 0 -> 3240 bytes wia/microdrv/testmcro.vcxproj | 9 ++++- 4 files changed, 9 insertions(+), 76 deletions(-) delete mode 100644 wia/microdrv/testmcro.inf create mode 100644 wia/microdrv/testmcro.inx diff --git a/wia/copywia.cmd b/wia/copywia.cmd index df37a38c..999e8719 100644 --- a/wia/copywia.cmd +++ b/wia/copywia.cmd @@ -70,7 +70,7 @@ rem WIA 1.0 rem copy microdrv\%build_samples%\%cpu_samples%\testmcro.dll %1wiabins\drivers -copy microdrv\testmcro.inf %1wiabins\drivers +copy microdrv\%build_samples%\%cpu_samples%\testmcro.inf %1wiabins\drivers copy "%build_tools%\%cpu_tools%\wiatest.exe" %1wiabins if /I "%DDK_TARGET_OS%" EQU "WinXP" ( diff --git a/wia/microdrv/testmcro.inf b/wia/microdrv/testmcro.inf deleted file mode 100644 index 741c3bb4..00000000 --- a/wia/microdrv/testmcro.inf +++ /dev/null @@ -1,74 +0,0 @@ -; TESTMCRO.INF -- WIA sample MicroDriver scanner setup file -; Copyright (c) 2001 Microsoft Corporation -; Manufacturer: Microsoft - -[Version] -Signature="$WINDOWS NT$" -Class=Image -ClassGUID={6bdd1fc6-810f-11d0-bec7-08002be2092f} -Provider=%ProviderString% -DriverVer=11/02/2007,1.0.0.1 -CatalogFile=testmcro.cat -PnpLockdown=1 - -[SourceDisksFiles.x86] -testmcro.dll=1 -[SourceDisksNames.x86] -1=%Location%,,, - -[SourceDisksFiles.amd64] -testmcro.dll=1 -[SourceDisksNames.amd64] -1=%Location%,,, - -[DestinationDirs] -; By default, files will be copied to \windows\system32. -DefaultDestDir=11 - -[Manufacturer] -%ManufacturerName%=Models, NTx86, NTamd64 - -; This is the models section for the x86 driver -[Models.NTx86] -%WIASample.DeviceDesc% = WIASample.Scanner, PnPIDInformation - -; This is the models section for the amd64 driver -[Models.NTamd64] -%WIASample.DeviceDesc% = WIASample.Scanner, PnPIDInformation - -[WIASample.Scanner] -Include=sti.inf -Needs=STI.SerialSection, STI.MICRODRIVERSection -SubClass=StillImage -DeviceType=1 -DeviceSubType=0x1 -Capabilities=0x30 -Events=WIASample.Events -DeviceData=WIASample.DeviceData -AddReg=WIASample.AddReg -CopyFiles=WIASample.CopyFiles -ICMProfiles="sRGB Color Space Profile.icm" - -[WIASample.Events] - -[WIASample.Scanner.Services] -Include=sti.inf -Needs=STI.SerialSection.Services - -[WIASample.DeviceData] -Server=local -UI Class ID={4DB1AD10-3391-11D2-9A33-00C04FA36145} -MicroDriver="TESTMCRO.DLL" -Sample Entry=1,1 - -[WIASample.AddReg] -HKR,,HardwareConfig,1,1 - -[WIASample.CopyFiles] -testmcro.dll - -[Strings] -ManufacturerName="TODO-Set-Manufacturer" -ProviderString="TODO-Set-Provider" -Location="Install Source" -WIASample.DeviceDesc="WIA Sample MicroDriver Scanner Device" diff --git a/wia/microdrv/testmcro.inx b/wia/microdrv/testmcro.inx new file mode 100644 index 00000000..5cd679a7 Binary files /dev/null and b/wia/microdrv/testmcro.inx differ diff --git a/wia/microdrv/testmcro.vcxproj b/wia/microdrv/testmcro.vcxproj index 4fedb7a2..aba1deda 100644 --- a/wia/microdrv/testmcro.vcxproj +++ b/wia/microdrv/testmcro.vcxproj @@ -74,7 +74,14 @@ - + + + $(InfArch) + true + true + .\$(IntDir)\testmcro.inf + + testmcro -- cgit v1.3.1 From 710cb209787a9aac0b913b3670d51edd41c94a74 Mon Sep 17 00:00:00 2001 From: Cymoki Date: Wed, 25 Jan 2023 11:21:43 -0800 Subject: Create Test.txt --- general/echo/umdfSocketEcho/Test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 general/echo/umdfSocketEcho/Test.txt diff --git a/general/echo/umdfSocketEcho/Test.txt b/general/echo/umdfSocketEcho/Test.txt new file mode 100644 index 00000000..5ae50e29 --- /dev/null +++ b/general/echo/umdfSocketEcho/Test.txt @@ -0,0 +1 @@ +Testing git hub actions. -- cgit v1.3.1 From 54a98a7e6af65ebc3a8ec92c7c09d94d0b44a6fd Mon Sep 17 00:00:00 2001 From: Julia D'Zmura <78620953+judzmura@users.noreply.github.com> Date: Thu, 2 Feb 2023 15:53:08 -0800 Subject: Updates to make Sysvad and SimpleAudioSample Windows Drivers Compliant (#845) Updating sysvad and simpleaudiosample drivers. --- .../Source/Filters/Filters.vcxproj | 12 +- audio/simpleaudiosample/Source/Inc/Inc.vcxproj | 12 +- audio/simpleaudiosample/Source/Main/Main.vcxproj | 12 +- audio/simpleaudiosample/Source/Main/adapter.cpp | 69 ++++++----- .../Source/Main/minwavertstream.cpp | 47 ++++--- .../Source/Utilities/Utilities.vcxproj | 12 +- .../Source/Utilities/savedata.cpp | 106 ++++++++++------ audio/sysvad/APO/AecApo/AecApo.h | 9 +- audio/sysvad/APO/AecApo/AecApo.vcxproj | 14 +-- audio/sysvad/APO/AecApo/AecApoMfx.cpp | 33 +++++ audio/sysvad/APO/DelayAPO/DelayAPO.vcxproj | 12 +- audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp | 3 +- audio/sysvad/APO/DelayAPO/DelayAPOSFX.cpp | 3 +- audio/sysvad/APO/KWSApo/KWSApo.vcxproj | 14 +-- audio/sysvad/APO/SwapAPO/SwapAPO.h | 6 +- audio/sysvad/APO/SwapAPO/SwapAPO.vcxproj | 16 +-- audio/sysvad/APO/SwapAPO/swapapomfx.cpp | 47 +++++-- audio/sysvad/APO/SwapAPO/swapaposfx.cpp | 73 ++++++----- .../sysvad/EndpointsCommon/EndpointsCommon.vcxproj | 12 +- audio/sysvad/EndpointsCommon/mintopo.cpp | 94 ++++++++++++++ audio/sysvad/EndpointsCommon/mintopo.h | 8 ++ audio/sysvad/EndpointsCommon/minwavert.cpp | 46 ++++--- audio/sysvad/EndpointsCommon/minwavertstream.cpp | 46 ++++--- audio/sysvad/EndpointsCommon/speakertopo.cpp | 9 ++ audio/sysvad/EndpointsCommon/speakertoptable.h | 7 ++ .../KeywordDetectorContosoAdapter.vcxproj | 14 +-- .../TabletAudioSample/ComponentizedApoSample.inx | Bin 22464 -> 22572 bytes .../ComponentizedAudioSampleExtension.inx | Bin 13508 -> 13608 bytes .../TabletAudioSample/TabletAudioSample.vcxproj | 12 +- .../sysvad/TabletAudioSample/tabletaudiosample.inx | Bin 80172 -> 0 bytes audio/sysvad/adapter.cpp | 69 ++++++----- audio/sysvad/common.cpp | 5 - audio/sysvad/savedata.cpp | 135 ++++++++++++++------- audio/sysvad/savedata.h | 8 +- 34 files changed, 615 insertions(+), 350 deletions(-) delete mode 100644 audio/sysvad/TabletAudioSample/tabletaudiosample.inx diff --git a/audio/simpleaudiosample/Source/Filters/Filters.vcxproj b/audio/simpleaudiosample/Source/Filters/Filters.vcxproj index 82fd07dc..1bc012e0 100644 --- a/audio/simpleaudiosample/Source/Filters/Filters.vcxproj +++ b/audio/simpleaudiosample/Source/Filters/Filters.vcxproj @@ -38,7 +38,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -62,7 +62,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -70,7 +70,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -78,7 +78,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary diff --git a/audio/simpleaudiosample/Source/Inc/Inc.vcxproj b/audio/simpleaudiosample/Source/Inc/Inc.vcxproj index ab768d84..14fce7b3 100644 --- a/audio/simpleaudiosample/Source/Inc/Inc.vcxproj +++ b/audio/simpleaudiosample/Source/Inc/Inc.vcxproj @@ -38,7 +38,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -62,7 +62,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -70,7 +70,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -78,7 +78,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary diff --git a/audio/simpleaudiosample/Source/Main/Main.vcxproj b/audio/simpleaudiosample/Source/Main/Main.vcxproj index a68d0242..be92b9d4 100644 --- a/audio/simpleaudiosample/Source/Main/Main.vcxproj +++ b/audio/simpleaudiosample/Source/Main/Main.vcxproj @@ -40,7 +40,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -56,7 +56,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -64,7 +64,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -72,7 +72,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -80,7 +80,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/audio/simpleaudiosample/Source/Main/adapter.cpp b/audio/simpleaudiosample/Source/Main/adapter.cpp index 105f7fde..bbe23f26 100644 --- a/audio/simpleaudiosample/Source/Main/adapter.cpp +++ b/audio/simpleaudiosample/Source/Main/adapter.cpp @@ -45,10 +45,10 @@ _Dispatch_type_(IRP_MJ_PNP) DRIVER_DISPATCH PnpHandler; // -// Rendering streams are saved to a file by default. Use the registry value -// DoNotCreateDataFiles (DWORD) > 0 to override this default. +// Rendering streams are not saved to a file by default. Use the registry value +// DoNotCreateDataFiles (DWORD) = 0 to override this default. // -DWORD g_DoNotCreateDataFiles = 0; // default is off. +DWORD g_DoNotCreateDataFiles = 1; // default is off. DWORD g_DisableToneGenerator = 0; // default is to generate tones. UNICODE_STRING g_RegistryPath; // This is used to store the registry settings path for the driver @@ -192,7 +192,8 @@ Returns: { NTSTATUS ntStatus; - UNICODE_STRING parametersPath; + PDRIVER_OBJECT DriverObject; + HANDLE DriverKey; RTL_QUERY_REGISTRY_TABLE paramTable[] = { // QueryRoutine Flags Name EntryContext DefaultType DefaultData DefaultLength { NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_TYPECHECK, L"DoNotCreateDataFiles", &g_DoNotCreateDataFiles, (REG_DWORD << RTL_QUERY_REGISTRY_TYPECHECK_SHIFT) | REG_DWORD, &g_DoNotCreateDataFiles, sizeof(ULONG)}, @@ -202,29 +203,27 @@ Returns: DPF(D_TERSE, ("[GetRegistrySettings]")); - PAGED_CODE(); - - RtlInitUnicodeString(¶metersPath, NULL); + PAGED_CODE(); + UNREFERENCED_PARAMETER(RegistryPath); - parametersPath.MaximumLength = - RegistryPath->Length + sizeof(L"\\Parameters") + sizeof(WCHAR); + DriverObject = WdfDriverWdmGetDriverObject(WdfGetDriver()); + DriverKey = NULL; + ntStatus = IoOpenDriverRegistryKey(DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &DriverKey); - parametersPath.Buffer = (PWCH) ExAllocatePool2(POOL_FLAG_PAGED, parametersPath.MaximumLength, MINADAPTER_POOLTAG); - if (parametersPath.Buffer == NULL) + if (!NT_SUCCESS(ntStatus)) { - return STATUS_INSUFFICIENT_RESOURCES; + return ntStatus; } - RtlAppendUnicodeToString(¶metersPath, RegistryPath->Buffer); - RtlAppendUnicodeToString(¶metersPath, L"\\Parameters"); - - ntStatus = RtlQueryRegistryValues( - RTL_REGISTRY_ABSOLUTE | RTL_REGISTRY_OPTIONAL, - parametersPath.Buffer, - ¶mTable[0], - NULL, - NULL - ); + ntStatus = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PCWSTR) DriverKey, + ¶mTable[0], + NULL, + NULL); if (!NT_SUCCESS(ntStatus)) { @@ -240,10 +239,10 @@ Returns: DPF(D_VERBOSE, ("DoNotCreateDataFiles: %u", g_DoNotCreateDataFiles)); DPF(D_VERBOSE, ("DisableToneGenerator: %u", g_DisableToneGenerator)); - // - // Cleanup. - // - ExFreePool(parametersPath.Buffer); + if (DriverKey) + { + ZwClose(DriverKey); + } return STATUS_SUCCESS; } @@ -292,15 +291,6 @@ Return Value: ntStatus, DPF(D_ERROR, ("Registry path copy error 0x%x", ntStatus)), Done); - - // - // Get registry configuration. - // - ntStatus = GetRegistrySettings(RegistryPathName); - IF_FAILED_ACTION_JUMP( - ntStatus, - DPF(D_ERROR, ("Registry Configuration error 0x%x", ntStatus)), - Done); WDF_DRIVER_CONFIG_INIT(&config, WDF_NO_EVENT_CALLBACK); // @@ -323,6 +313,15 @@ Return Value: DPF(D_ERROR, ("WdfDriverCreate failed, 0x%x", ntStatus)), Done); + // + // Get registry configuration. + // + ntStatus = GetRegistrySettings(RegistryPathName); + IF_FAILED_ACTION_JUMP( + ntStatus, + DPF(D_ERROR, ("Registry Configuration error 0x%x", ntStatus)), + Done); + // // Tell the class driver to initialize the driver. // diff --git a/audio/simpleaudiosample/Source/Main/minwavertstream.cpp b/audio/simpleaudiosample/Source/Main/minwavertstream.cpp index 27289a0e..c189c939 100644 --- a/audio/simpleaudiosample/Source/Main/minwavertstream.cpp +++ b/audio/simpleaudiosample/Source/Main/minwavertstream.cpp @@ -108,8 +108,8 @@ NTSTATUS CMiniportWaveRTStream::ReadRegistrySettings() PAGED_CODE(); NTSTATUS ntStatus; - UNICODE_STRING parametersPath; - + PDRIVER_OBJECT DriverObject; + HANDLE DriverKey; RTL_QUERY_REGISTRY_TABLE paramTable[] = { // QueryRoutine Flags Name EntryContext DefaultType DefaultData DefaultLength { NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_TYPECHECK, L"HostCaptureToneFrequency", &m_ulHostCaptureToneFrequency, (REG_DWORD << RTL_QUERY_REGISTRY_TYPECHECK_SHIFT) | REG_DWORD, &m_ulHostCaptureToneFrequency, sizeof(DWORD) }, @@ -119,30 +119,37 @@ NTSTATUS CMiniportWaveRTStream::ReadRegistrySettings() { NULL, 0, NULL, NULL, 0, NULL, 0 } }; - RtlInitUnicodeString(¶metersPath, NULL); - - // The sizeof(WCHAR) is added to the maximum length, for allowing a space for null termination of the string. - parametersPath.MaximumLength = - g_RegistryPath.Length + sizeof(L"\\Parameters") + sizeof(WCHAR); + DriverObject = WdfDriverWdmGetDriverObject(WdfGetDriver()); + DriverKey = NULL; + ntStatus = IoOpenDriverRegistryKey(DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &DriverKey); - parametersPath.Buffer = (PWCH)ExAllocatePool2(POOL_FLAG_PAGED, parametersPath.MaximumLength, MINWAVERT_POOLTAG); - if (parametersPath.Buffer == NULL) + if (!NT_SUCCESS(ntStatus)) { - return STATUS_INSUFFICIENT_RESOURCES; + return ntStatus; } - RtlAppendUnicodeToString(¶metersPath, g_RegistryPath.Buffer); - RtlAppendUnicodeToString(¶metersPath, L"\\Parameters"); + ntStatus = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PCWSTR) DriverKey, + ¶mTable[0], + NULL, + NULL); - ntStatus = RtlQueryRegistryValues( - RTL_REGISTRY_ABSOLUTE | RTL_REGISTRY_OPTIONAL, - parametersPath.Buffer, - ¶mTable[0], - NULL, - NULL - ); + if (!NT_SUCCESS(ntStatus)) + { + DPF(D_VERBOSE, ("RtlQueryRegistryValues failed, using default values, 0x%x", ntStatus)); + // + // Don't return error because we will operate with default values. + // + } - ExFreePool(parametersPath.Buffer); + if (DriverKey) + { + ZwClose(DriverKey); + } return ntStatus; } diff --git a/audio/simpleaudiosample/Source/Utilities/Utilities.vcxproj b/audio/simpleaudiosample/Source/Utilities/Utilities.vcxproj index 0a71bf42..710bf748 100644 --- a/audio/simpleaudiosample/Source/Utilities/Utilities.vcxproj +++ b/audio/simpleaudiosample/Source/Utilities/Utilities.vcxproj @@ -38,7 +38,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -62,7 +62,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -70,7 +70,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -78,7 +78,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary diff --git a/audio/simpleaudiosample/Source/Utilities/savedata.cpp b/audio/simpleaudiosample/Source/Utilities/savedata.cpp index 7b2a11e9..02c3f602 100644 --- a/audio/simpleaudiosample/Source/Utilities/savedata.cpp +++ b/audio/simpleaudiosample/Source/Utilities/savedata.cpp @@ -44,8 +44,9 @@ Abstract: #define DEFAULT_FRAME_SIZE PAGE_SIZE * 4 #define DEFAULT_BUFFER_SIZE DEFAULT_FRAME_SIZE * DEFAULT_FRAME_COUNT -#define DEFAULT_FILE_NAME L"\\DosDevices\\C:\\STREAM" -#define OSDATA_FILE_NAME L"\\DosDevices\\O:\\STREAM" +#define DEFAULT_FILE_FOLDER1 L"\\DriverData\\Audio_Samples" +#define DEFAULT_FILE_FOLDER2 L"\\DriverData\\Audio_Samples\\SimpleAudioSample" +#define DEFAULT_FILE_NAME L"\\DriverData\\Audio_Samples\\SimpleAudioSample\\STREAM" #define OFFLOAD_FILE_NAME L"OFFLOAD" #define HOST_FILE_NAME L"HOST" @@ -444,59 +445,86 @@ CSaveData::Initialize { PAGED_CODE(); - NTSTATUS ntStatus = STATUS_SUCCESS; - WCHAR szTemp[MAX_PATH]; - size_t cLen; - OBJECT_ATTRIBUTES objectAttributes; - UNICODE_STRING osDataVolumeString; - HANDLE osDataFileHandle = NULL; - IO_STATUS_BLOCK ioStatusBlock; + NTSTATUS ntStatus = STATUS_SUCCESS; + WCHAR szTemp[MAX_PATH]; + size_t cLen = 0; + IO_STATUS_BLOCK ioStatusBlock = {0}; + HANDLE fileHandle; + OBJECT_ATTRIBUTES objectAttributes; + UNICODE_STRING fileName; DPF_ENTER(("[CSaveData::Initialize]")); m_ulStreamId++; - // Probe if OSData volume exists. - // - RtlStringCchPrintfW(szTemp, MAX_PATH, L"%s_probe.txt", OSDATA_FILE_NAME); - RtlInitUnicodeString(&osDataVolumeString, szTemp); - InitializeObjectAttributes - ( - &objectAttributes, - &osDataVolumeString, - OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, - NULL, - NULL - ); - - ntStatus = - ZwCreateFile - ( - &osDataFileHandle, - GENERIC_WRITE | SYNCHRONIZE, + RtlInitUnicodeString(&fileName, DEFAULT_FILE_FOLDER1); + InitializeObjectAttributes( + &objectAttributes, + &fileName, + OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + // Create the folder. + ntStatus = ZwCreateFile( + &fileHandle, + 0, &objectAttributes, &ioStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, 0, - FILE_OVERWRITE_IF, - FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, + FILE_OPEN_IF, + FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, NULL, - 0 - ); + 0); + + if (NT_SUCCESS(ntStatus)) + { + ZwClose(fileHandle); + fileHandle = NULL; + + RtlInitUnicodeString(&fileName, DEFAULT_FILE_FOLDER2); + InitializeObjectAttributes( + &objectAttributes, + &fileName, + OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + // Create the folder. + ntStatus = ZwCreateFile( + &fileHandle, + 0, + &objectAttributes, + &ioStatusBlock, + NULL, + FILE_ATTRIBUTE_NORMAL, + 0, + FILE_OPEN_IF, + FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, + NULL, + 0); + + if (NT_SUCCESS(ntStatus)) + { + ZwClose(fileHandle); + fileHandle = NULL; + } + } + if (NT_SUCCESS(ntStatus)) { - ZwClose(osDataFileHandle); + // Allocate data file name. + // + RtlStringCchPrintfW(szTemp, MAX_PATH, L"%s_%s_%d.wav", DEFAULT_FILE_NAME, HOST_FILE_NAME, m_ulStreamId); + m_FileName.Length = 0; + ntStatus = RtlStringCchLengthW (szTemp, sizeof(szTemp)/sizeof(szTemp[0]), &cLen); } - // Allocate data file name. - // - RtlStringCchPrintfW(szTemp, MAX_PATH, L"%s_%s_%d.wav", NT_SUCCESS(ntStatus) ? OSDATA_FILE_NAME : DEFAULT_FILE_NAME, HOST_FILE_NAME, m_ulStreamId); - m_FileName.Length = 0; - ntStatus = RtlStringCchLengthW (szTemp, sizeof(szTemp)/sizeof(szTemp[0]), &cLen); if (NT_SUCCESS(ntStatus)) { - m_FileName.MaximumLength = (USHORT)((cLen * sizeof(WCHAR)) + sizeof(WCHAR));//convert to wchar and add room for NULL + m_FileName.MaximumLength = (USHORT)((cLen * sizeof(WCHAR)) + sizeof(WCHAR));//convert to wchar and add room for NULL m_FileName.Buffer = (PWSTR) ExAllocatePool2 ( @@ -574,7 +602,7 @@ CSaveData::Initialize ( &m_objectAttributes, &m_FileName, - OBJ_CASE_INSENSITIVE|OBJ_KERNEL_HANDLE, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL ); diff --git a/audio/sysvad/APO/AecApo/AecApo.h b/audio/sysvad/APO/AecApo/AecApo.h index a62b69ce..7c96314d 100644 --- a/audio/sysvad/APO/AecApo/AecApo.h +++ b/audio/sysvad/APO/AecApo/AecApo.h @@ -99,13 +99,8 @@ public: ) override; // IAudioSystemEffects3 - STDMETHODIMP GetControllableSystemEffectsList(_Outptr_result_buffer_maybenull_(*numEffects) AUDIO_SYSTEMEFFECT** effects, _Out_ UINT* numEffects, _In_opt_ HANDLE event) override - { - UNREFERENCED_PARAMETER(effects); - UNREFERENCED_PARAMETER(numEffects); - UNREFERENCED_PARAMETER(event); - return S_OK; - } + STDMETHOD(GetControllableSystemEffectsList)( + _Outptr_result_buffer_maybenull_(*numEffects) AUDIO_SYSTEMEFFECT** effects, _Out_ UINT* numEffects, _In_opt_ HANDLE event) override; STDMETHODIMP SetAudioSystemEffectState(GUID, AUDIO_SYSTEMEFFECT_STATE) override {return S_OK;} diff --git a/audio/sysvad/APO/AecApo/AecApo.vcxproj b/audio/sysvad/APO/AecApo/AecApo.vcxproj index f40ce919..3602ba64 100644 --- a/audio/sysvad/APO/AecApo/AecApo.vcxproj +++ b/audio/sysvad/APO/AecApo/AecApo.vcxproj @@ -39,7 +39,7 @@ Windows10 False - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -57,7 +57,7 @@ Windows10 True - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -66,7 +66,7 @@ Windows10 True - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -75,7 +75,7 @@ Windows10 False - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -84,7 +84,7 @@ Windows10 True - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -350,4 +350,4 @@ - \ No newline at end of file + diff --git a/audio/sysvad/APO/AecApo/AecApoMfx.cpp b/audio/sysvad/APO/AecApo/AecApoMfx.cpp index 21f2c20d..0c16f348 100644 --- a/audio/sysvad/APO/AecApo/AecApoMfx.cpp +++ b/audio/sysvad/APO/AecApo/AecApoMfx.cpp @@ -375,6 +375,39 @@ STDMETHODIMP CAecApoMFX::GetEffectsList(_Outptr_result_buffer_maybenull_(*pcEffe return S_OK; } +STDMETHODIMP CAecApoMFX::GetControllableSystemEffectsList(_Outptr_result_buffer_maybenull_(*numEffects) AUDIO_SYSTEMEFFECT** effects, _Out_ UINT* numEffects, _In_opt_ HANDLE event) +{ + UNREFERENCED_PARAMETER(event); + + RETURN_HR_IF_NULL(E_POINTER, effects); + RETURN_HR_IF_NULL(E_POINTER, numEffects); + + *effects = nullptr; + *numEffects = 0; + + if (m_audioSignalProcessingMode == AUDIO_SIGNALPROCESSINGMODE_COMMUNICATIONS) + { + // Return the list of effects implemented by this APO for COMMUNICATIONS processing mode + static const GUID effectsList[] = {AUDIO_EFFECT_TYPE_ACOUSTIC_ECHO_CANCELLATION}; + + wil::unique_cotaskmem_array_ptr audioEffects( + static_cast(CoTaskMemAlloc(ARRAYSIZE(effectsList) * sizeof(AUDIO_SYSTEMEFFECT))), ARRAYSIZE(effectsList)); + RETURN_IF_NULL_ALLOC(audioEffects.get()); + + for (UINT i = 0; i < ARRAYSIZE(effectsList); i++) + { + audioEffects[i].id = effectsList[i]; + audioEffects[i].state = AUDIO_SYSTEMEFFECT_STATE_ON; + audioEffects[i].canSetState = FALSE; + } + + *numEffects = (UINT)audioEffects.size(); + *effects = audioEffects.release(); + } + + return S_OK; +} + HRESULT IsInputFormatSupportedForAec(IAudioMediaType* pMediaType, BOOL * pSupported) { ASSERT_NONREALTIME(); diff --git a/audio/sysvad/APO/DelayAPO/DelayAPO.vcxproj b/audio/sysvad/APO/DelayAPO/DelayAPO.vcxproj index ecdaf321..86f49395 100644 --- a/audio/sysvad/APO/DelayAPO/DelayAPO.vcxproj +++ b/audio/sysvad/APO/DelayAPO/DelayAPO.vcxproj @@ -39,7 +39,7 @@ Windows10 False - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -57,7 +57,7 @@ Windows10 True - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -66,7 +66,7 @@ Windows10 True - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -75,7 +75,7 @@ Windows10 False - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -84,7 +84,7 @@ Windows10 True - Universal + Windows Driver false WindowsApplicationForDrivers10.0 diff --git a/audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp b/audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp index 8778b252..e7492131 100644 --- a/audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp +++ b/audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp @@ -430,7 +430,8 @@ HRESULT CDelayAPOMFX::Initialize(UINT32 cbDataSize, BYTE* pbyData) processingMode != AUDIO_SIGNALPROCESSINGMODE_COMMUNICATIONS && processingMode != AUDIO_SIGNALPROCESSINGMODE_SPEECH && processingMode != AUDIO_SIGNALPROCESSINGMODE_MEDIA && - processingMode != AUDIO_SIGNALPROCESSINGMODE_MOVIE), hr = E_INVALIDARG, Exit); + processingMode != AUDIO_SIGNALPROCESSINGMODE_MOVIE && + processingMode != AUDIO_SIGNALPROCESSINGMODE_NOTIFICATION), hr = E_INVALIDARG, Exit); m_AudioProcessingMode = processingMode; // diff --git a/audio/sysvad/APO/DelayAPO/DelayAPOSFX.cpp b/audio/sysvad/APO/DelayAPO/DelayAPOSFX.cpp index 81594bb7..c37abb7c 100644 --- a/audio/sysvad/APO/DelayAPO/DelayAPOSFX.cpp +++ b/audio/sysvad/APO/DelayAPO/DelayAPOSFX.cpp @@ -388,7 +388,8 @@ HRESULT CDelayAPOSFX::Initialize(UINT32 cbDataSize, BYTE* pbyData) processingMode != AUDIO_SIGNALPROCESSINGMODE_COMMUNICATIONS && processingMode != AUDIO_SIGNALPROCESSINGMODE_SPEECH && processingMode != AUDIO_SIGNALPROCESSINGMODE_MEDIA && - processingMode != AUDIO_SIGNALPROCESSINGMODE_MOVIE), hr = E_INVALIDARG, Exit); + processingMode != AUDIO_SIGNALPROCESSINGMODE_MOVIE && + processingMode != AUDIO_SIGNALPROCESSINGMODE_NOTIFICATION), hr = E_INVALIDARG, Exit); m_AudioProcessingMode = processingMode; // diff --git a/audio/sysvad/APO/KWSApo/KWSApo.vcxproj b/audio/sysvad/APO/KWSApo/KWSApo.vcxproj index b34e03d9..592686b4 100644 --- a/audio/sysvad/APO/KWSApo/KWSApo.vcxproj +++ b/audio/sysvad/APO/KWSApo/KWSApo.vcxproj @@ -39,7 +39,7 @@ Windows10 False - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -57,7 +57,7 @@ Windows10 True - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -66,7 +66,7 @@ Windows10 True - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -75,7 +75,7 @@ Windows10 False - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -84,7 +84,7 @@ Windows10 True - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -352,4 +352,4 @@ - \ No newline at end of file + diff --git a/audio/sysvad/APO/SwapAPO/SwapAPO.h b/audio/sysvad/APO/SwapAPO/SwapAPO.h index aeb9d259..d169d9db 100644 --- a/audio/sysvad/APO/SwapAPO/SwapAPO.h +++ b/audio/sysvad/APO/SwapAPO/SwapAPO.h @@ -195,7 +195,8 @@ public: public: LONG m_fEnableSwapMFX; GUID m_AudioProcessingMode; - wil::com_ptr_nothrow m_device; + wil::com_ptr_nothrow m_deviceTopologyMMDevice; + wil::com_ptr_nothrow m_audioEndpoint; CComPtr m_spAPOSystemEffectsProperties; CComPtr m_spEnumerator; static const CRegAPOProperties<1> sm_RegProperties; // registration properties @@ -315,7 +316,8 @@ public: LONG m_fEnableSwapSFX; LONG m_fEnableDelaySFX; GUID m_AudioProcessingMode; - wil::com_ptr_nothrow m_device; + wil::com_ptr_nothrow m_deviceTopologyMMDevice; + wil::com_ptr_nothrow m_audioEndpoint; CComPtr m_spAPOSystemEffectsProperties; CComPtr m_spEnumerator; static const CRegAPOProperties<1> sm_RegProperties; // registration properties diff --git a/audio/sysvad/APO/SwapAPO/SwapAPO.vcxproj b/audio/sysvad/APO/SwapAPO/SwapAPO.vcxproj index 2a26307e..8ceee8ea 100644 --- a/audio/sysvad/APO/SwapAPO/SwapAPO.vcxproj +++ b/audio/sysvad/APO/SwapAPO/SwapAPO.vcxproj @@ -1,4 +1,4 @@ - + @@ -39,7 +39,7 @@ Windows10 False - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -57,7 +57,7 @@ Windows10 True - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -66,7 +66,7 @@ Windows10 True - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -75,7 +75,7 @@ Windows10 False - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -84,7 +84,7 @@ Windows10 True - Universal + Windows Driver false WindowsApplicationForDrivers10.0 @@ -427,4 +427,4 @@ - \ No newline at end of file + diff --git a/audio/sysvad/APO/SwapAPO/swapapomfx.cpp b/audio/sysvad/APO/SwapAPO/swapapomfx.cpp index 7a772a07..b05b1568 100644 --- a/audio/sysvad/APO/SwapAPO/swapapomfx.cpp +++ b/audio/sysvad/APO/SwapAPO/swapapomfx.cpp @@ -458,10 +458,38 @@ HRESULT CSwapAPOMFX::Initialize(UINT32 cbDataSize, BYTE* pbyData) // that need to run at a real-time priority. The work queue ID is used with the Rtwq APIs. hr = apoRtQueueService->GetRealTimeWorkQueue(&m_queueId); IF_FAILED_JUMP(hr, Exit); - + // Windows should pass a valid collection. ATLASSERT(papoSysFxInit3->pDeviceCollection != nullptr); IF_TRUE_ACTION_JUMP(papoSysFxInit3->pDeviceCollection == nullptr, hr = E_INVALIDARG, Exit); + + // Use IMMDevice to activate IAudioSystemEffectsPropertyStore that contains the default, user and + // volatile settings. + IMMDeviceCollection* deviceCollection = reinterpret_cast(pbyData)->pDeviceCollection; + UINT32 numDevices; + // Get the endpoint on which this APO has been created + // (It is the last device in the device collection) + hr = deviceCollection->GetCount(&numDevices); + IF_FAILED_JUMP(hr, Exit); + + hr = numDevices > 0 ? S_OK : E_UNEXPECTED; + IF_FAILED_JUMP(hr, Exit); + + hr = deviceCollection->Item(numDevices - 1, &m_audioEndpoint); + IF_FAILED_JUMP(hr, Exit); + + wil::unique_prop_variant activationParam; + hr = InitPropVariantFromCLSID(SWAP_APO_SFX_CONTEXT, &activationParam); + IF_FAILED_JUMP(hr, Exit); + + wil::com_ptr_nothrow effectsPropertyStore; + hr = m_audioEndpoint->Activate(__uuidof(effectsPropertyStore), CLSCTX_ALL, &activationParam, effectsPropertyStore.put_void()); + IF_FAILED_JUMP(hr, Exit); + + // This is where an APO might want to open the volatile or default property stores as well + // Use STGM_READWRITE if IPropertyStore::SetValue is needed. + hr = effectsPropertyStore->OpenUserPropertyStore(STGM_READ, m_userStore.put()); + IF_FAILED_JUMP(hr, Exit); // Save the processing mode being initialized. processingMode = papoSysFxInit3->AudioProcessingMode; @@ -523,7 +551,8 @@ HRESULT CSwapAPOMFX::Initialize(UINT32 cbDataSize, BYTE* pbyData) processingMode != AUDIO_SIGNALPROCESSINGMODE_COMMUNICATIONS && processingMode != AUDIO_SIGNALPROCESSINGMODE_SPEECH && processingMode != AUDIO_SIGNALPROCESSINGMODE_MEDIA && - processingMode != AUDIO_SIGNALPROCESSINGMODE_MOVIE), hr = E_INVALIDARG, Exit); + processingMode != AUDIO_SIGNALPROCESSINGMODE_MOVIE && + processingMode != AUDIO_SIGNALPROCESSINGMODE_NOTIFICATION), hr = E_INVALIDARG, Exit); m_AudioProcessingMode = processingMode; // @@ -755,7 +784,7 @@ HRESULT CSwapAPOMFX::SetAudioSystemEffectState(GUID effectId, AUDIO_SYSTEMEFFECT if (oldState != effectInfo.state) { SetEvent(m_hEffectsChangedEvent); - m_apoLoggingService->ApoLog(APO_LOG_LEVEL_INFO, L"SetAudioSystemEffectState - effect: " GUID_FORMAT_STRING L", state: %i", effectInfo.id, effectInfo.state); + m_apoLoggingService->ApoLog(APO_LOG_LEVEL_INFO, L"CSwapAPOMFX::SetAudioSystemEffectState - effect: " GUID_FORMAT_STRING L", state: %i", effectInfo.id, effectInfo.state); } m_EffectsLock.Leave(); @@ -772,8 +801,6 @@ HRESULT CSwapAPOMFX::GetApoNotificationRegistrationInfo(_Out_writes_(*count) APO *apoNotifications = nullptr; *count = 0; - RETURN_HR_IF_NULL(E_FAIL, m_device); - // Let the OS know what notifications we are interested in by returning an array of // APO_NOTIFICATION_DESCRIPTORs. constexpr DWORD numDescriptors = 1; @@ -785,7 +812,7 @@ HRESULT CSwapAPOMFX::GetApoNotificationRegistrationInfo(_Out_writes_(*count) APO // Our APO wants to get notified when a endpoint property changes on the audio endpoint. apoNotificationDescriptors[0].type = APO_NOTIFICATION_TYPE_ENDPOINT_PROPERTY_CHANGE; - (void)m_device.query_to(&apoNotificationDescriptors[0].audioEndpointPropertyChange.device); + (void)m_audioEndpoint.query_to(&apoNotificationDescriptors[0].audioEndpointPropertyChange.device); *apoNotifications = apoNotificationDescriptors.release(); *count = numDescriptors; @@ -811,7 +838,7 @@ void CSwapAPOMFX::HandleNotification(APO_NOTIFICATION *apoNotification) {PKEY_Endpoint_Enable_Channel_Swap_MFX, &m_fEnableSwapMFX}, }; - m_apoLoggingService->ApoLog(APO_LOG_LEVEL_INFO, L"HandleNotification - pkey: " GUID_FORMAT_STRING L" %d", GUID_FORMAT_ARGS(apoNotification->audioEndpointPropertyChange.propertyKey.fmtid), apoNotification->audioEndpointPropertyChange.propertyKey.pid); + m_apoLoggingService->ApoLog(APO_LOG_LEVEL_INFO, L"CSwapAPOMFX::HandleNotification - pkey: " GUID_FORMAT_STRING L" %d", GUID_FORMAT_ARGS(apoNotification->audioEndpointPropertyChange.propertyKey.fmtid), apoNotification->audioEndpointPropertyChange.propertyKey.pid); for (int i = 0; i < ARRAYSIZE(controls); i++) { @@ -847,11 +874,11 @@ HRESULT CSwapAPOMFX::ProprietaryCommunicationWithDriver(IMMDeviceCollection *pDe } // Get the target IMMDevice - hr = pDeviceCollection->Item(nSoftwareIoDeviceInCollection, &m_device); + hr = pDeviceCollection->Item(nSoftwareIoDeviceInCollection, &m_deviceTopologyMMDevice); IF_FAILED_JUMP(hr, Exit); // Instantiate a device topology instance - hr = m_device->Activate(__uuidof(IDeviceTopology), CLSCTX_ALL, NULL, (void**)&spMyDeviceTopology); + hr = m_deviceTopologyMMDevice->Activate(__uuidof(IDeviceTopology), CLSCTX_ALL, NULL, (void**)&spMyDeviceTopology); IF_FAILED_JUMP(hr, Exit); // retrieve connect instance @@ -859,7 +886,7 @@ HRESULT CSwapAPOMFX::ProprietaryCommunicationWithDriver(IMMDeviceCollection *pDe IF_FAILED_JUMP(hr, Exit); // activate IKsControl on the IMMDevice - hr = m_device->Activate(__uuidof(IKsControl), CLSCTX_INPROC_SERVER, NULL, (void**)&spKsControl); + hr = m_deviceTopologyMMDevice->Activate(__uuidof(IKsControl), CLSCTX_INPROC_SERVER, NULL, (void**)&spKsControl); IF_FAILED_JUMP(hr, Exit); // get KS pin id diff --git a/audio/sysvad/APO/SwapAPO/swapaposfx.cpp b/audio/sysvad/APO/SwapAPO/swapaposfx.cpp index 8483d8df..ef418f75 100644 --- a/audio/sysvad/APO/SwapAPO/swapaposfx.cpp +++ b/audio/sysvad/APO/SwapAPO/swapaposfx.cpp @@ -297,48 +297,48 @@ HRESULT CSwapAPOSFX::Initialize(UINT32 cbDataSize, BYTE* pbyData) hr = papoSysFxInit3->pServiceProvider->QueryService(SID_AudioProcessingObjectLoggingService, IID_PPV_ARGS(&m_apoLoggingService)); IF_FAILED_JUMP(hr, Exit); - // SampleApo supports the new IAudioSystemEffects3 interface so it will receive APOInitSystemEffects3 + // SampleApo supports the new IAudioSystemEffects3 interface so it will receive APOInitSystemEffects3 // in pbyData if the audio driver has declared support for this. + // Windows should pass a valid collection. + ATLASSERT(papoSysFxInit3->pDeviceCollection != nullptr); + IF_TRUE_ACTION_JUMP(papoSysFxInit3->pDeviceCollection == nullptr, hr = E_INVALIDARG, Exit); + // Use IMMDevice to activate IAudioSystemEffectsPropertyStore that contains the default, user and // volatile settings. IMMDeviceCollection* deviceCollection = reinterpret_cast(pbyData)->pDeviceCollection; - if (deviceCollection != nullptr) - { - UINT32 numDevices; - wil::com_ptr_nothrow endpoint; + UINT32 numDevices; + // Get the endpoint on which this APO has been created + // (It is the last device in the device collection) + hr = deviceCollection->GetCount(&numDevices); + IF_FAILED_JUMP(hr, Exit); - // Get the endpoint on which this APO has been created - // (It is the last device in the device collection) - if (SUCCEEDED(deviceCollection->GetCount(&numDevices)) && numDevices > 0 && - SUCCEEDED(deviceCollection->Item(numDevices - 1, &endpoint))) - { - wil::unique_prop_variant activationParam; - hr = InitPropVariantFromCLSID(SWAP_APO_SFX_CONTEXT, &activationParam); - IF_FAILED_JUMP(hr, Exit); - - wil::com_ptr_nothrow effectsPropertyStore; - hr = endpoint->Activate(__uuidof(effectsPropertyStore), CLSCTX_ALL, &activationParam, effectsPropertyStore.put_void()); - IF_FAILED_JUMP(hr, Exit); - - // This is where an APO might want to open the volatile or default property stores as well - // Use STGM_READWRITE if IPropertyStore::SetValue is needed. - hr = effectsPropertyStore->OpenUserPropertyStore(STGM_READ, m_userStore.put()); - IF_FAILED_JUMP(hr, Exit); - } - } + hr = numDevices > 0 ? S_OK : E_UNEXPECTED; + IF_FAILED_JUMP(hr, Exit); - // Windows should pass a valid collection. - ATLASSERT(papoSysFxInit2->pDeviceCollection != nullptr); - IF_TRUE_ACTION_JUMP(papoSysFxInit3->pDeviceCollection == nullptr, hr = E_INVALIDARG, Exit); + hr = deviceCollection->Item(numDevices - 1, &m_audioEndpoint); + IF_FAILED_JUMP(hr, Exit); + + wil::unique_prop_variant activationParam; + hr = InitPropVariantFromCLSID(SWAP_APO_SFX_CONTEXT, &activationParam); + IF_FAILED_JUMP(hr, Exit); + + wil::com_ptr_nothrow effectsPropertyStore; + hr = m_audioEndpoint->Activate(__uuidof(effectsPropertyStore), CLSCTX_ALL, &activationParam, effectsPropertyStore.put_void()); + IF_FAILED_JUMP(hr, Exit); + + // This is where an APO might want to open the volatile or default property stores as well + // Use STGM_READWRITE if IPropertyStore::SetValue is needed. + hr = effectsPropertyStore->OpenUserPropertyStore(STGM_READ, m_userStore.put()); + IF_FAILED_JUMP(hr, Exit); // Get the IDeviceTopology and IConnector interfaces to communicate with this // APO's counterpart audio driver. This can be used for any proprietary // communication. - hr = papoSysFxInit3->pDeviceCollection->Item(papoSysFxInit3->nSoftwareIoDeviceInCollection, &m_device); + hr = papoSysFxInit3->pDeviceCollection->Item(papoSysFxInit3->nSoftwareIoDeviceInCollection, &m_deviceTopologyMMDevice); IF_FAILED_JUMP(hr, Exit); - hr = m_device->Activate(__uuidof(IDeviceTopology), CLSCTX_ALL, NULL, (void**)&spMyDeviceTopology); + hr = m_deviceTopologyMMDevice->Activate(__uuidof(IDeviceTopology), CLSCTX_ALL, NULL, (void**)&spMyDeviceTopology); IF_FAILED_JUMP(hr, Exit); hr = spMyDeviceTopology->GetConnector(papoSysFxInit3->nSoftwareIoConnectorIndex, &spMyConnector); @@ -365,10 +365,10 @@ HRESULT CSwapAPOSFX::Initialize(UINT32 cbDataSize, BYTE* pbyData) // Get the IDeviceTopology and IConnector interfaces to communicate with this // APO's counterpart audio driver. This can be used for any proprietary // communication. - hr = papoSysFxInit2->pDeviceCollection->Item(papoSysFxInit2->nSoftwareIoDeviceInCollection, &m_device); + hr = papoSysFxInit2->pDeviceCollection->Item(papoSysFxInit2->nSoftwareIoDeviceInCollection, &m_deviceTopologyMMDevice); IF_FAILED_JUMP(hr, Exit); - hr = m_device->Activate(__uuidof(IDeviceTopology), CLSCTX_ALL, NULL, (void**)&spMyDeviceTopology); + hr = m_deviceTopologyMMDevice->Activate(__uuidof(IDeviceTopology), CLSCTX_ALL, NULL, (void**)&spMyDeviceTopology); IF_FAILED_JUMP(hr, Exit); hr = spMyDeviceTopology->GetConnector(papoSysFxInit2->nSoftwareIoConnectorIndex, &spMyConnector); @@ -407,7 +407,8 @@ HRESULT CSwapAPOSFX::Initialize(UINT32 cbDataSize, BYTE* pbyData) processingMode != AUDIO_SIGNALPROCESSINGMODE_COMMUNICATIONS && processingMode != AUDIO_SIGNALPROCESSINGMODE_SPEECH && processingMode != AUDIO_SIGNALPROCESSINGMODE_MEDIA && - processingMode != AUDIO_SIGNALPROCESSINGMODE_MOVIE), hr = E_INVALIDARG, Exit); + processingMode != AUDIO_SIGNALPROCESSINGMODE_MOVIE && + processingMode != AUDIO_SIGNALPROCESSINGMODE_NOTIFICATION), hr = E_INVALIDARG, Exit); m_AudioProcessingMode = processingMode; // @@ -640,7 +641,7 @@ HRESULT CSwapAPOSFX::SetAudioSystemEffectState(GUID effectId, AUDIO_SYSTEMEFFECT if (oldState != effectInfo.state) { SetEvent(m_hEffectsChangedEvent); - m_apoLoggingService->ApoLog(APO_LOG_LEVEL_INFO, L"SetAudioSystemEffectState - effect: " GUID_FORMAT_STRING L", state: %i", effectInfo.id, effectInfo.state); + m_apoLoggingService->ApoLog(APO_LOG_LEVEL_INFO, L"CSwapAPOSFX::SetAudioSystemEffectState - effect: " GUID_FORMAT_STRING L", state: %i", effectInfo.id, effectInfo.state); } m_EffectsLock.Leave(); @@ -733,8 +734,6 @@ HRESULT CSwapAPOSFX::GetApoNotificationRegistrationInfo(_Out_writes_(*count) APO *apoNotifications = nullptr; *count = 0; - RETURN_HR_IF_NULL(E_FAIL, m_device); - // Let the OS know what notifications we are interested in by returning an array of // APO_NOTIFICATION_DESCRIPTORs. constexpr DWORD numDescriptors = 1; @@ -746,7 +745,7 @@ HRESULT CSwapAPOSFX::GetApoNotificationRegistrationInfo(_Out_writes_(*count) APO // Our APO wants to get notified when a endpoint property changes on the audio endpoint. apoNotificationDescriptors[0].type = APO_NOTIFICATION_TYPE_ENDPOINT_PROPERTY_CHANGE; - (void)m_device.query_to(&apoNotificationDescriptors[0].audioEndpointPropertyChange.device); + (void)m_audioEndpoint.query_to(&apoNotificationDescriptors[0].audioEndpointPropertyChange.device); *apoNotifications = apoNotificationDescriptors.release(); *count = numDescriptors; @@ -772,7 +771,7 @@ void CSwapAPOSFX::HandleNotification(APO_NOTIFICATION *apoNotification) {PKEY_Endpoint_Enable_Channel_Swap_SFX, &m_fEnableSwapSFX}, }; - m_apoLoggingService->ApoLog(APO_LOG_LEVEL_INFO, L"HandleNotification - pkey: " GUID_FORMAT_STRING L" %d", GUID_FORMAT_ARGS(apoNotification->audioEndpointPropertyChange.propertyKey.fmtid), apoNotification->audioEndpointPropertyChange.propertyKey.pid); + m_apoLoggingService->ApoLog(APO_LOG_LEVEL_INFO, L"CSwapAPOSFX::HandleNotification - pkey: " GUID_FORMAT_STRING L" %d", GUID_FORMAT_ARGS(apoNotification->audioEndpointPropertyChange.propertyKey.fmtid), apoNotification->audioEndpointPropertyChange.propertyKey.pid); for (int i = 0; i < ARRAYSIZE(controls); i++) { diff --git a/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj b/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj index 5b819cf3..4c59e3c1 100644 --- a/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj +++ b/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj @@ -38,7 +38,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -62,7 +62,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -70,7 +70,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -78,7 +78,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary diff --git a/audio/sysvad/EndpointsCommon/mintopo.cpp b/audio/sysvad/EndpointsCommon/mintopo.cpp index c1e4bc14..9fb2cc21 100644 --- a/audio/sysvad/EndpointsCommon/mintopo.cpp +++ b/audio/sysvad/EndpointsCommon/mintopo.cpp @@ -578,6 +578,100 @@ Return Value: return ntStatus; } +//============================================================================= +#pragma code_seg("PAGE") +NTSTATUS +CMiniportTopology::PropertyHandlerJackDescription3 +( + _In_ PPCPROPERTY_REQUEST PropertyRequest, + _In_ ULONG cJackDescriptions, + _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION * JackDescriptions, + _In_ ULONG ConfigId +) +/*++ + +Routine Description: + + Handles ( KSPROPSETID_Jack, KSPROPERTY_JACK_DESCRIPTION3 ) + +Arguments: + + PropertyRequest - + cJackDescriptions - # of elements in the jack descriptions array. + JackDescriptions - Array of jack descriptions pointers. + ConfigId - Current endpoint config id + +Return Value: + + NT status code. + +--*/ +{ + PAGED_CODE(); + + ASSERT(PropertyRequest); + + DPF_ENTER(("[PropertyHandlerJackDescription3]")); + + NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; + ULONG nPinId = (ULONG)-1; + + if (PropertyRequest->InstanceSize >= sizeof(ULONG)) + { + nPinId = *(PULONG(PropertyRequest->Instance)); + + if ((nPinId < cJackDescriptions) && (JackDescriptions[nPinId] != NULL)) + { + if (PropertyRequest->Verb & KSPROPERTY_TYPE_BASICSUPPORT) + { + ntStatus = + PropertyHandler_BasicSupport + ( + PropertyRequest, + KSPROPERTY_TYPE_BASICSUPPORT | KSPROPERTY_TYPE_GET, + VT_ILLEGAL + ); + } + else + { + ULONG cbNeeded = sizeof(KSMULTIPLE_ITEM) + sizeof(KSJACK_DESCRIPTION3); + + if (PropertyRequest->ValueSize == 0) + { + PropertyRequest->ValueSize = cbNeeded; + ntStatus = STATUS_BUFFER_OVERFLOW; + } + else if (PropertyRequest->ValueSize < cbNeeded) + { + ntStatus = STATUS_BUFFER_TOO_SMALL; + } + else + { + if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) + { + PKSMULTIPLE_ITEM pMI = (PKSMULTIPLE_ITEM)PropertyRequest->Value; + PKSJACK_DESCRIPTION3 pDesc = (PKSJACK_DESCRIPTION3)(pMI+1); + + pMI->Size = cbNeeded; + pMI->Count = 1; + + RtlZeroMemory(pDesc, sizeof(KSJACK_DESCRIPTION3)); + + // + // hardware config id + // + pDesc->ConfigId = ConfigId; + + ntStatus = STATUS_SUCCESS; + } + } + } + } + } + + return ntStatus; +} + //============================================================================= #pragma code_seg("PAGE") NTSTATUS diff --git a/audio/sysvad/EndpointsCommon/mintopo.h b/audio/sysvad/EndpointsCommon/mintopo.h index 596e13b1..f0bae44d 100644 --- a/audio/sysvad/EndpointsCommon/mintopo.h +++ b/audio/sysvad/EndpointsCommon/mintopo.h @@ -100,6 +100,14 @@ public: _In_ DWORD JackCapabilities ); + NTSTATUS PropertyHandlerJackDescription3 + ( + _In_ PPCPROPERTY_REQUEST PropertyRequest, + _In_ ULONG cJackDescriptions, + _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION *JackDescriptions, + _In_ ULONG ConfigId + ); + NTSTATUS PropertyHandlerAudioResourceGroup ( _In_ PPCPROPERTY_REQUEST PropertyRequest diff --git a/audio/sysvad/EndpointsCommon/minwavert.cpp b/audio/sysvad/EndpointsCommon/minwavert.cpp index bd81c110..c6b8e8c3 100644 --- a/audio/sysvad/EndpointsCommon/minwavert.cpp +++ b/audio/sysvad/EndpointsCommon/minwavert.cpp @@ -3452,7 +3452,8 @@ NTSTATUS CKeywordDetector::ReadKeywordTimestampRegistry() PAGED_CODE(); NTSTATUS ntStatus; - UNICODE_STRING parametersPath; + PDRIVER_OBJECT DriverObject; + HANDLE DriverKey; RTL_QUERY_REGISTRY_TABLE paramTable[] = { // QueryRoutine Flags Name EntryContext DefaultType DefaultData DefaultLength @@ -3461,30 +3462,37 @@ NTSTATUS CKeywordDetector::ReadKeywordTimestampRegistry() { NULL, 0, NULL, NULL, 0, NULL, 0 } }; - RtlInitUnicodeString(¶metersPath, NULL); + DriverObject = WdfDriverWdmGetDriverObject(WdfGetDriver()); + DriverKey = NULL; + ntStatus = IoOpenDriverRegistryKey(DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &DriverKey); - // The sizeof(WCHAR) is added to the maximum length, for allowing a space for null termination of the string. - parametersPath.MaximumLength = - g_RegistryPath.Length + sizeof(L"\\Parameters") + sizeof(WCHAR); - - parametersPath.Buffer = (PWCH)ExAllocatePool2(POOL_FLAG_PAGED, parametersPath.MaximumLength, MINWAVERT_POOLTAG); - if (parametersPath.Buffer == NULL) + if (!NT_SUCCESS(ntStatus)) { - return STATUS_INSUFFICIENT_RESOURCES; + return ntStatus; } - RtlAppendUnicodeToString(¶metersPath, g_RegistryPath.Buffer); - RtlAppendUnicodeToString(¶metersPath, L"\\Parameters"); + ntStatus = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PCWSTR) DriverKey, + ¶mTable[0], + NULL, + NULL); - ntStatus = RtlQueryRegistryValues( - RTL_REGISTRY_ABSOLUTE | RTL_REGISTRY_OPTIONAL, - parametersPath.Buffer, - ¶mTable[0], - NULL, - NULL - ); + if (!NT_SUCCESS(ntStatus)) + { + DPF(D_VERBOSE, ("RtlQueryRegistryValues failed, using default values, 0x%x", ntStatus)); + // + // Don't return error because we will operate with default values. + // + } - ExFreePool(parametersPath.Buffer); + if (DriverKey) + { + ZwClose(DriverKey); + } return ntStatus; } diff --git a/audio/sysvad/EndpointsCommon/minwavertstream.cpp b/audio/sysvad/EndpointsCommon/minwavertstream.cpp index 08467e05..adea0c82 100644 --- a/audio/sysvad/EndpointsCommon/minwavertstream.cpp +++ b/audio/sysvad/EndpointsCommon/minwavertstream.cpp @@ -121,7 +121,8 @@ NTSTATUS CMiniportWaveRTStream::ReadRegistrySettings() PAGED_CODE(); NTSTATUS ntStatus; - UNICODE_STRING parametersPath; + PDRIVER_OBJECT DriverObject; + HANDLE DriverKey; RTL_QUERY_REGISTRY_TABLE paramTable[] = { // QueryRoutine Flags Name EntryContext DefaultType DefaultData DefaultLength @@ -136,30 +137,37 @@ NTSTATUS CMiniportWaveRTStream::ReadRegistrySettings() { NULL, 0, NULL, NULL, 0, NULL, 0 } }; - RtlInitUnicodeString(¶metersPath, NULL); + DriverObject = WdfDriverWdmGetDriverObject(WdfGetDriver()); + DriverKey = NULL; + ntStatus = IoOpenDriverRegistryKey(DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &DriverKey); - // The sizeof(WCHAR) is added to the maximum length, for allowing a space for null termination of the string. - parametersPath.MaximumLength = - g_RegistryPath.Length + sizeof(L"\\Parameters") + sizeof(WCHAR); - - parametersPath.Buffer = (PWCH)ExAllocatePool2(POOL_FLAG_PAGED, parametersPath.MaximumLength, MINWAVERT_POOLTAG); - if (parametersPath.Buffer == NULL) + if (!NT_SUCCESS(ntStatus)) { - return STATUS_INSUFFICIENT_RESOURCES; + return ntStatus; } - RtlAppendUnicodeToString(¶metersPath, g_RegistryPath.Buffer); - RtlAppendUnicodeToString(¶metersPath, L"\\Parameters"); + ntStatus = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PCWSTR) DriverKey, + ¶mTable[0], + NULL, + NULL); - ntStatus = RtlQueryRegistryValues( - RTL_REGISTRY_ABSOLUTE | RTL_REGISTRY_OPTIONAL, - parametersPath.Buffer, - ¶mTable[0], - NULL, - NULL - ); + if (!NT_SUCCESS(ntStatus)) + { + DPF(D_VERBOSE, ("RtlQueryRegistryValues failed, using default values, 0x%x", ntStatus)); + // + // Don't return error because we will operate with default values. + // + } - ExFreePool(parametersPath.Buffer); + if (DriverKey) + { + ZwClose(DriverKey); + } return ntStatus; } diff --git a/audio/sysvad/EndpointsCommon/speakertopo.cpp b/audio/sysvad/EndpointsCommon/speakertopo.cpp index fba72036..002b1174 100644 --- a/audio/sysvad/EndpointsCommon/speakertopo.cpp +++ b/audio/sysvad/EndpointsCommon/speakertopo.cpp @@ -75,6 +75,15 @@ Return Value: 0 // jack capabilities ); } + else if (PropertyRequest->PropertyItem->Id == KSPROPERTY_JACK_DESCRIPTION3) + { + ntStatus = pMiniport->PropertyHandlerJackDescription3( + PropertyRequest, + ARRAYSIZE(SpeakerJackDescriptions), + SpeakerJackDescriptions, + 42 // jack config id + ); + } } else if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_AudioResourceManagement)) { diff --git a/audio/sysvad/EndpointsCommon/speakertoptable.h b/audio/sysvad/EndpointsCommon/speakertoptable.h index 3d31d7a4..ea3890f7 100644 --- a/audio/sysvad/EndpointsCommon/speakertoptable.h +++ b/audio/sysvad/EndpointsCommon/speakertoptable.h @@ -141,6 +141,13 @@ PCPROPERTY_ITEM PropertiesSpeakerTopoFilter[] = KSPROPERTY_TYPE_BASICSUPPORT, PropertyHandler_SpeakerTopoFilter }, + { + &KSPROPSETID_Jack, + KSPROPERTY_JACK_DESCRIPTION3, + KSPROPERTY_TYPE_GET | + KSPROPERTY_TYPE_BASICSUPPORT, + PropertyHandler_SpeakerTopoFilter + }, { &KSPROPSETID_AudioResourceManagement, KSPROPERTY_AUDIORESOURCEMANAGEMENT_RESOURCEGROUP, diff --git a/audio/sysvad/KeywordDetectorAdapter/KeywordDetectorContosoAdapter.vcxproj b/audio/sysvad/KeywordDetectorAdapter/KeywordDetectorContosoAdapter.vcxproj index d1675201..7151399e 100644 --- a/audio/sysvad/KeywordDetectorAdapter/KeywordDetectorContosoAdapter.vcxproj +++ b/audio/sysvad/KeywordDetectorAdapter/KeywordDetectorContosoAdapter.vcxproj @@ -1,4 +1,4 @@ - + @@ -39,7 +39,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -47,7 +47,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -55,7 +55,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -63,7 +63,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -71,7 +71,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -79,7 +79,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/audio/sysvad/TabletAudioSample/ComponentizedApoSample.inx b/audio/sysvad/TabletAudioSample/ComponentizedApoSample.inx index 28069e1c..34b8401a 100644 Binary files a/audio/sysvad/TabletAudioSample/ComponentizedApoSample.inx and b/audio/sysvad/TabletAudioSample/ComponentizedApoSample.inx differ diff --git a/audio/sysvad/TabletAudioSample/ComponentizedAudioSampleExtension.inx b/audio/sysvad/TabletAudioSample/ComponentizedAudioSampleExtension.inx index 70cd79b8..4afba224 100644 Binary files a/audio/sysvad/TabletAudioSample/ComponentizedAudioSampleExtension.inx and b/audio/sysvad/TabletAudioSample/ComponentizedAudioSampleExtension.inx differ diff --git a/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj b/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj index 6e4e4c44..fe70dacf 100644 --- a/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj +++ b/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj @@ -40,7 +40,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -56,7 +56,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -64,7 +64,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -72,7 +72,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -80,7 +80,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/audio/sysvad/TabletAudioSample/tabletaudiosample.inx b/audio/sysvad/TabletAudioSample/tabletaudiosample.inx deleted file mode 100644 index 29c74cfb..00000000 Binary files a/audio/sysvad/TabletAudioSample/tabletaudiosample.inx and /dev/null differ diff --git a/audio/sysvad/adapter.cpp b/audio/sysvad/adapter.cpp index ef48e5f4..0f44c593 100644 --- a/audio/sysvad/adapter.cpp +++ b/audio/sysvad/adapter.cpp @@ -246,10 +246,10 @@ _Dispatch_type_(IRP_MJ_PNP) DRIVER_DISPATCH PnpHandler; // -// Rendering streams are saved to a file by default. Use the registry value -// DoNotCreateDataFiles (DWORD) > 0 to override this default. +// Rendering streams are not saved to a file by default. Use the registry value +// DoNotCreateDataFiles (DWORD) = 0 to override this default. // -DWORD g_DoNotCreateDataFiles = 0; // default is off. +DWORD g_DoNotCreateDataFiles = 1; // default is off. DWORD g_DisableToneGenerator = 0; // default is to generate tones. UNICODE_STRING g_RegistryPath; // This is used to store the registry settings path for the driver @@ -425,7 +425,8 @@ Returns: { NTSTATUS ntStatus; - UNICODE_STRING parametersPath; + PDRIVER_OBJECT DriverObject; + HANDLE DriverKey; RTL_QUERY_REGISTRY_TABLE paramTable[] = { // QueryRoutine Flags Name EntryContext DefaultType DefaultData DefaultLength { NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_TYPECHECK, L"DoNotCreateDataFiles", &g_DoNotCreateDataFiles, (REG_DWORD << RTL_QUERY_REGISTRY_TYPECHECK_SHIFT) | REG_DWORD, &g_DoNotCreateDataFiles, sizeof(ULONG)}, @@ -441,29 +442,27 @@ Returns: DPF(D_TERSE, ("[GetRegistrySettings]")); - PAGED_CODE(); - - RtlInitUnicodeString(¶metersPath, NULL); + PAGED_CODE(); + UNREFERENCED_PARAMETER(RegistryPath); - parametersPath.MaximumLength = - RegistryPath->Length + sizeof(L"\\Parameters") + sizeof(WCHAR); + DriverObject = WdfDriverWdmGetDriverObject(WdfGetDriver()); + DriverKey = NULL; + ntStatus = IoOpenDriverRegistryKey(DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &DriverKey); - parametersPath.Buffer = (PWCH) ExAllocatePool2(POOL_FLAG_PAGED, parametersPath.MaximumLength, MINADAPTER_POOLTAG); - if (parametersPath.Buffer == NULL) + if (!NT_SUCCESS(ntStatus)) { - return STATUS_INSUFFICIENT_RESOURCES; + return ntStatus; } - RtlAppendUnicodeToString(¶metersPath, RegistryPath->Buffer); - RtlAppendUnicodeToString(¶metersPath, L"\\Parameters"); - - ntStatus = RtlQueryRegistryValues( - RTL_REGISTRY_ABSOLUTE | RTL_REGISTRY_OPTIONAL, - parametersPath.Buffer, - ¶mTable[0], - NULL, - NULL - ); + ntStatus = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PCWSTR) DriverKey, + ¶mTable[0], + NULL, + NULL); if (!NT_SUCCESS(ntStatus)) { @@ -485,10 +484,10 @@ Returns: DPF(D_VERBOSE, ("DisableUsbSideband: %u", g_DisableUsbSideband)); #endif // SYSVAD_USB_SIDEBAND - // - // Cleanup. - // - ExFreePool(parametersPath.Buffer); + if (DriverKey) + { + ZwClose(DriverKey); + } return STATUS_SUCCESS; } @@ -537,15 +536,6 @@ Return Value: ntStatus, DPF(D_ERROR, ("Registry path copy error 0x%x", ntStatus)), Done); - - // - // Get registry configuration. - // - ntStatus = GetRegistrySettings(RegistryPathName); - IF_FAILED_ACTION_JUMP( - ntStatus, - DPF(D_ERROR, ("Registry Configuration error 0x%x", ntStatus)), - Done); WDF_DRIVER_CONFIG_INIT(&config, WDF_NO_EVENT_CALLBACK); // @@ -568,6 +558,15 @@ Return Value: DPF(D_ERROR, ("WdfDriverCreate failed, 0x%x", ntStatus)), Done); + // + // Get registry configuration. + // + ntStatus = GetRegistrySettings(RegistryPathName); + IF_FAILED_ACTION_JUMP( + ntStatus, + DPF(D_ERROR, ("Registry Configuration error 0x%x", ntStatus)), + Done); + // // Tell the class driver to initialize the driver. // diff --git a/audio/sysvad/common.cpp b/audio/sysvad/common.cpp index 9bc3e644..1334411e 100644 --- a/audio/sysvad/common.cpp +++ b/audio/sysvad/common.cpp @@ -50,7 +50,6 @@ Abstract: // CSaveData statics //----------------------------------------------------------------------------- -PSAVEWORKER_PARAM CSaveData::m_pWorkItems = NULL; PDEVICE_OBJECT CSaveData::m_pDeviceObject = NULL; //============================================================================= // Classes @@ -642,8 +641,6 @@ Return Value: delete m_pHW; m_pHW = NULL; } - - CSaveData::DestroyWorkItems(); SAFE_RELEASE(m_pPortClsEtwHelper); SAFE_RELEASE(m_pServiceGroupWave); @@ -841,8 +838,6 @@ Return Value: // Initialize SaveData class. // CSaveData::SetDeviceObject(DeviceObject); //device object is needed by CSaveData - ntStatus = CSaveData::InitializeWorkItems(DeviceObject); - IF_FAILED_JUMP(ntStatus, Done); Done: return ntStatus; diff --git a/audio/sysvad/savedata.cpp b/audio/sysvad/savedata.cpp index cb5f5cfc..39789f3b 100644 --- a/audio/sysvad/savedata.cpp +++ b/audio/sysvad/savedata.cpp @@ -47,12 +47,13 @@ Abstract: #define DEFAULT_FRAME_SIZE PAGE_SIZE * 4 #define DEFAULT_BUFFER_SIZE DEFAULT_FRAME_SIZE * DEFAULT_FRAME_COUNT -#define DEFAULT_FILE_NAME L"\\DosDevices\\C:\\STREAM" -#define OSDATA_FILE_NAME L"\\DosDevices\\O:\\STREAM" +#define DEFAULT_FILE_FOLDER1 L"\\DriverData\\Audio_Samples" +#define DEFAULT_FILE_FOLDER2 L"\\DriverData\\Audio_Samples\\Sysvad" +#define DEFAULT_FILE_NAME L"\\DriverData\\Audio_Samples\\Sysvad\\STREAM" #define OFFLOAD_FILE_NAME L"OFFLOAD" #define HOST_FILE_NAME L"HOST" -#define MAX_WORKER_ITEM_COUNT 15 +#define MAX_WORKER_ITEM_COUNT 8 //============================================================================= // Statics @@ -91,6 +92,7 @@ CSaveData::CSaveData() m_DataHeader.dwData = DATA_TAG; m_DataHeader.dwDataLength = 0; + RtlZeroMemory(&m_FileName, sizeof(m_FileName)); RtlZeroMemory(&m_objectAttributes, sizeof(m_objectAttributes)); } // CSaveData @@ -101,6 +103,12 @@ CSaveData::~CSaveData() DPF_ENTER(("[CSaveData::~CSaveData]")); + // + // All write activity is done at this point (see acquire->stop stream transition). + // Safe to call even if the Initialize function failed. + // + DestroyWorkItems(); + // Update the wave header in data file with real file size. // if(m_pFilePtr) @@ -415,6 +423,7 @@ CSaveData::GetNewWorkItem { LARGE_INTEGER timeOut = { 0 }; NTSTATUS ntStatus; + PSAVEWORKER_PARAM saveWorker = NULL; for (int i = 0; i < MAX_WORKER_ITEM_COUNT; i++) { @@ -430,13 +439,16 @@ CSaveData::GetNewWorkItem if (STATUS_SUCCESS == ntStatus) { if (m_pWorkItems[i].WorkItem) - return &(m_pWorkItems[i]); - else - return NULL; + { + saveWorker = &(m_pWorkItems[i]); + KeResetEvent(&saveWorker->EventDone); + break; + } } } - return NULL; + + return saveWorker; } // GetNewWorkItem #pragma code_seg("PAGE") @@ -449,13 +461,13 @@ CSaveData::Initialize { PAGED_CODE(); - NTSTATUS ntStatus = STATUS_SUCCESS; - WCHAR szTemp[MAX_PATH]; - size_t cLen; - OBJECT_ATTRIBUTES objectAttributes; - UNICODE_STRING osDataVolumeString; - HANDLE osDataFileHandle = NULL; - IO_STATUS_BLOCK ioStatusBlock; + NTSTATUS ntStatus = STATUS_SUCCESS; + WCHAR szTemp[MAX_PATH]; + size_t cLen = 0; + IO_STATUS_BLOCK ioStatusBlock = {0}; + HANDLE fileHandle; + OBJECT_ATTRIBUTES objectAttributes; + UNICODE_STRING fileName; DPF_ENTER(("[CSaveData::Initialize]")); @@ -468,47 +480,74 @@ CSaveData::Initialize m_ulStreamId++; } - // Probe if OSData volume exists. - // - RtlStringCchPrintfW(szTemp, MAX_PATH, L"%s_probe.txt", OSDATA_FILE_NAME); - RtlInitUnicodeString(&osDataVolumeString, szTemp); - InitializeObjectAttributes - ( - &objectAttributes, - &osDataVolumeString, - OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, - NULL, - NULL - ); - - ntStatus = - ZwCreateFile - ( - &osDataFileHandle, - GENERIC_WRITE | SYNCHRONIZE, + RtlInitUnicodeString(&fileName, DEFAULT_FILE_FOLDER1); + InitializeObjectAttributes( + &objectAttributes, + &fileName, + OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + // Create the folder. + ntStatus = ZwCreateFile( + &fileHandle, + 0, &objectAttributes, &ioStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, 0, - FILE_OVERWRITE_IF, - FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, + FILE_OPEN_IF, + FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, NULL, - 0 - ); + 0); + + if (NT_SUCCESS(ntStatus)) + { + ZwClose(fileHandle); + fileHandle = NULL; + + RtlInitUnicodeString(&fileName, DEFAULT_FILE_FOLDER2); + InitializeObjectAttributes( + &objectAttributes, + &fileName, + OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + // Create the folder. + ntStatus = ZwCreateFile( + &fileHandle, + 0, + &objectAttributes, + &ioStatusBlock, + NULL, + FILE_ATTRIBUTE_NORMAL, + 0, + FILE_OPEN_IF, + FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, + NULL, + 0); + + if (NT_SUCCESS(ntStatus)) + { + ZwClose(fileHandle); + fileHandle = NULL; + } + } + if (NT_SUCCESS(ntStatus)) { - ZwClose(osDataFileHandle); + // Allocate data file name. + // + RtlStringCchPrintfW(szTemp, MAX_PATH, L"%s_%s_%d.wav", DEFAULT_FILE_NAME, _bOffloaded ? OFFLOAD_FILE_NAME : HOST_FILE_NAME, _bOffloaded ? m_ulOffloadStreamId : m_ulStreamId); + m_FileName.Length = 0; + ntStatus = RtlStringCchLengthW (szTemp, sizeof(szTemp)/sizeof(szTemp[0]), &cLen); } - // Allocate data file name. - // - RtlStringCchPrintfW(szTemp, MAX_PATH, L"%s_%s_%d.wav", NT_SUCCESS(ntStatus) ? OSDATA_FILE_NAME : DEFAULT_FILE_NAME, _bOffloaded ? OFFLOAD_FILE_NAME : HOST_FILE_NAME, _bOffloaded ? m_ulOffloadStreamId : m_ulStreamId); - m_FileName.Length = 0; - ntStatus = RtlStringCchLengthW (szTemp, sizeof(szTemp)/sizeof(szTemp[0]), &cLen); if (NT_SUCCESS(ntStatus)) { - m_FileName.MaximumLength = (USHORT)((cLen * sizeof(WCHAR)) + sizeof(WCHAR));//convert to wchar and add room for NULL + m_FileName.MaximumLength = (USHORT)((cLen * sizeof(WCHAR)) + sizeof(WCHAR));//convert to wchar and add room for NULL m_FileName.Buffer = (PWSTR) ExAllocatePool2 ( @@ -572,6 +611,13 @@ CSaveData::Initialize // KeInitializeMutex( &m_FileSync, 1 ) ; + // Allocate work-items. + // + if (NT_SUCCESS(ntStatus)) + { + ntStatus = InitializeWorkItems(m_pDeviceObject); + } + // Open the data file. // if (NT_SUCCESS(ntStatus)) @@ -586,7 +632,7 @@ CSaveData::Initialize ( &m_objectAttributes, &m_FileName, - OBJ_CASE_INSENSITIVE|OBJ_KERNEL_HANDLE, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL ); @@ -896,7 +942,6 @@ CSaveData::SaveFrame pParam->ulFrameNo = ulFrameNo; pParam->ulDataSize = ulDataSize; pParam->pData = m_pDataBuffer + ulFrameNo * m_ulFrameSize; - KeResetEvent(&pParam->EventDone); IoQueueWorkItem(pParam->WorkItem, SaveFrameWorkerCallback, CriticalWorkQueue, (PVOID)pParam); } diff --git a/audio/sysvad/savedata.h b/audio/sysvad/savedata.h index a1525bda..94221025 100644 --- a/audio/sysvad/savedata.h +++ b/audio/sysvad/savedata.h @@ -98,7 +98,7 @@ protected: static PDEVICE_OBJECT m_pDeviceObject; static ULONG m_ulStreamId; static ULONG m_ulOffloadStreamId; - static PSAVEWORKER_PARAM m_pWorkItems; + PSAVEWORKER_PARAM m_pWorkItems; BOOL m_fWriteDisabled; @@ -108,11 +108,11 @@ public: CSaveData(); ~CSaveData(); - static NTSTATUS InitializeWorkItems + NTSTATUS InitializeWorkItems ( _In_ PDEVICE_OBJECT DeviceObject ); - static void DestroyWorkItems + void DestroyWorkItems ( void ); @@ -120,7 +120,7 @@ public: ( _In_ BOOL fDisable ); - static PSAVEWORKER_PARAM GetNewWorkItem + PSAVEWORKER_PARAM GetNewWorkItem ( void ); -- cgit v1.3.1 From 177192185e6ad176087849b7046411167954fb39 Mon Sep 17 00:00:00 2001 From: kahashimoto-ms <117399367+kahashimoto-ms@users.noreply.github.com> Date: Fri, 3 Feb 2023 11:42:35 -0800 Subject: mspassthroughext Driver compatibility violations (#846) * Add PnpLockdown to the version section of the INF * Add segments to DriverVer * Change DIRID from 12 to 13 --- network/ndis/extension/samples/passthrough/mspassthroughext.inf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/network/ndis/extension/samples/passthrough/mspassthroughext.inf b/network/ndis/extension/samples/passthrough/mspassthroughext.inf index 09985132..6a5e0915 100644 --- a/network/ndis/extension/samples/passthrough/mspassthroughext.inf +++ b/network/ndis/extension/samples/passthrough/mspassthroughext.inf @@ -8,7 +8,8 @@ Class = NetService ClassGUID = {4D36E974-E325-11CE-BFC1-08002BE10318} Provider = %ProviderString% CatalogFile = mspassthroughext.cat -DriverVer = 08/29/2011,1.0 +DriverVer = 08/29/2011,1.0.0.0 +PnpLockdown = 1 [Manufacturer] %ManufacturerName%=Standard,NTx86,NTia64,NTamd64 @@ -38,8 +39,8 @@ Copyfiles = MSPassthroughExt.copyfiles.sys MSPassthroughExt.sys=1 [DestinationDirs] -DefaultDestDir=12 -MSPassthroughExt.copyfiles.sys=12 +DefaultDestDir=13 +MSPassthroughExt.copyfiles.sys=13 [MSPassthroughExt.copyfiles.sys] MSPassthroughExt.sys,,,2 @@ -71,7 +72,7 @@ DisplayName = %MSPassthroughExt_Desc% ServiceType = 1 ;SERVICE_KERNEL_DRIVER StartType = 1 ;SERVICE_SYSTEM_START ErrorControl = 1 ;SERVICE_ERROR_NORMAL -ServiceBinary = %12%\MSPassthroughExt.sys +ServiceBinary = %13%\MSPassthroughExt.sys LoadOrderGroup = NDIS Description = %MSPassthroughExt_Desc% -- cgit v1.3.1 From 9ab70a3207b3586eeef00298911b05e425d5a3a9 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 7 Feb 2023 10:30:40 -0800 Subject: Clean up a few misc things after merge of main into develop (#859) Co-authored-by: Jason Knichel --- general/toaster/toastpkg/inf/toastpkg.inf | 3 --- general/toaster/toastpkg/toastcd/toastpkg.inf | 3 --- usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx | Bin 5022 -> 4988 bytes 3 files changed, 6 deletions(-) diff --git a/general/toaster/toastpkg/inf/toastpkg.inf b/general/toaster/toastpkg/inf/toastpkg.inf index 21d376de..1011794d 100644 --- a/general/toaster/toastpkg/inf/toastpkg.inf +++ b/general/toaster/toastpkg/inf/toastpkg.inf @@ -39,9 +39,6 @@ CoInstaller_CopyFiles = 11 [SourceDisksNames.x86] 1 = %DiskId1%, toastpkg.tag,,\i386 -[SourceDisksNames.ia64] -1 = %DiskId1%, toastpkg.tag,,\ia64 - [SourceDisksNames.amd64] 1 = %DiskId1%, toastpkg.tag,,\amd64 diff --git a/general/toaster/toastpkg/toastcd/toastpkg.inf b/general/toaster/toastpkg/toastcd/toastpkg.inf index 21d376de..1011794d 100644 --- a/general/toaster/toastpkg/toastcd/toastpkg.inf +++ b/general/toaster/toastpkg/toastcd/toastpkg.inf @@ -39,9 +39,6 @@ CoInstaller_CopyFiles = 11 [SourceDisksNames.x86] 1 = %DiskId1%, toastpkg.tag,,\i386 -[SourceDisksNames.ia64] -1 = %DiskId1%, toastpkg.tag,,\ia64 - [SourceDisksNames.amd64] 1 = %DiskId1%, toastpkg.tag,,\amd64 diff --git a/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx index b0c5f923..5d97c8c4 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx differ -- cgit v1.3.1 From 208b227667182dfcd7bdf3ab4f5090aa823cf477 Mon Sep 17 00:00:00 2001 From: JakobL-MSFT <110699333+JakobL-MSFT@users.noreply.github.com> Date: Tue, 7 Feb 2023 15:36:48 -0800 Subject: Enable CodeQL to work thru reasonable workarounds. (#857) --- .github/workflows/Code-Scanning.yml | 7 ++++--- .github/workflows/ci-pr.yml | 4 ++-- .github/workflows/ci.yml | 4 ++-- Build-AllSamples.ps1 | 20 +++++++++++--------- Build-Sample.ps1 | 6 ++++++ Build-SampleSet.ps1 | 32 ++++++++++++++++++-------------- Building-Locally.md | 9 +++------ 7 files changed, 46 insertions(+), 36 deletions(-) diff --git a/.github/workflows/Code-Scanning.yml b/.github/workflows/Code-Scanning.yml index 86be1ef0..1ba4c660 100644 --- a/.github/workflows/Code-Scanning.yml +++ b/.github/workflows/Code-Scanning.yml @@ -48,10 +48,11 @@ jobs: - name: Retrieve and build all available solutions id: build-all-samples run: | - .\Build-AllSamples.ps1 -Verbose + .\Build-AllSamples.ps1 -Verbose -ThrottleLimit 1 env: - Configuration: Debug - Platform: x64 + WDS_Configuration: Debug + WDS_Platform: x64 + WDS_WipeOutputs: ${{ true }} - name: Perform CodeQL analysis uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index c701bd23..fa115e25 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -36,5 +36,5 @@ jobs: $changedFiles = "${{ steps.get-changed-files.outputs.all_changed_files }}".Split(',') .\.github\scripts\Build-ChangedSamples.ps1 -ChangedFiles $changedFiles -Verbose env: - Configuration: ${{ matrix.configuration }} - Platform: ${{ matrix.platform }} + WDS_Configuration: ${{ matrix.configuration }} + WDS_Platform: ${{ matrix.platform }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8063d6e..6b97cfff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,5 +29,5 @@ jobs: run: | .\Build-AllSamples.ps1 -Verbose env: - Configuration: ${{ matrix.configuration }} - Platform: ${{ matrix.platform }} + WDS_Configuration: ${{ matrix.configuration }} + WDS_Platform: ${{ matrix.platform }} diff --git a/Build-AllSamples.ps1 b/Build-AllSamples.ps1 index fb876d99..2cf7f403 100644 --- a/Build-AllSamples.ps1 +++ b/Build-AllSamples.ps1 @@ -9,14 +9,17 @@ This script searches for all available Visual Studio Solutions (.sln files) and A regular expression matching the samples to be built. Default is '' that matches all samples. Examples include '^tools.' or '.dchu'. .PARAMETER Configurations -A list of configurations to build samples under. Values available are 'Debug' and 'Release'. By default, $env:Configuration will be used as the sole configuration to build for. If this environment variable is not set the default is 'Debug' and 'Release'. +A list of configurations to build samples under. Values available are 'Debug' and 'Release'. By default, $env:WDS_Configuration will be used as the sole configuration to build for. If this environment variable is not set the default is 'Debug' and 'Release'. .PARAMETER Platforms -A list of platforms to build samples under (e.g. 'x64', 'arm64'). By default, $env:Platform will be used as the sole platform to build for. If this environment variable is not set the default is 'x64' and'arm64'. +A list of platforms to build samples under (e.g. 'x64', 'arm64'). By default, $env:WDS_Platform will be used as the sole platform to build for. If this environment variable is not set the default is 'x64' and'arm64'. .PARAMETER LogFilesDirectory Path to a directory where the log files will be written to. If not provided, outputs will be logged to the '_logs' directory within the current working directory. +.PARAMETER ThrottleLimit +An integer indicating how many combinations to build in parallel. If 0 or not provided this defaults to 5 x number of logical processors. + .INPUTS None. @@ -27,16 +30,17 @@ None. .\Build-AllSamples .EXAMPLE -.\Build-AllSamples -Samples '^tools.' -Configurations 'Debug','Release' -Platforms 'x64','arm64' -LogFilesDirectory .\_logs +.\Build-AllSamples -Samples '^tools.' -Configurations 'Debug','Release' -Platforms 'x64','arm64' #> [CmdletBinding()] param( [string]$Samples = "", - [string[]]$Configurations = @([string]::IsNullOrEmpty($env:Configuration) ? ('Debug','Release') : $env:Configuration), - [string[]]$Platforms = @([string]::IsNullOrEmpty($env:Platform) ? ('x64','arm64') : $env:Platform), - [string]$LogFilesDirectory = (Join-Path (Get-Location) "_logs") + [string[]]$Configurations = @([string]::IsNullOrEmpty($env:WDS_Configuration) ? ('Debug','Release') : $env:WDS_Configuration), + [string[]]$Platforms = @([string]::IsNullOrEmpty($env:WDS_Platform) ? ('x64','arm64') : $env:WDS_Platform), + [string]$LogFilesDirectory = (Join-Path (Get-Location) "_logs"), + [int]$ThrottleLimit ) $Verbose = $false @@ -63,6 +67,4 @@ foreach ($file in $solutionFiles) { } } - - -.\Build-SampleSet -SampleSet $sampleSet -Configurations $Configurations -Platform $Platforms -LogFilesDirectory $LogFilesDirectory -Verbose:$Verbose +.\Build-SampleSet -SampleSet $sampleSet -Configurations $Configurations -Platform $Platforms -LogFilesDirectory $LogFilesDirectory -Verbose:$Verbose -ThrottleLimit $ThrottleLimit diff --git a/Build-Sample.ps1 b/Build-Sample.ps1 index 57f0ce7e..4f8f5b0b 100644 --- a/Build-Sample.ps1 +++ b/Build-Sample.ps1 @@ -140,6 +140,12 @@ $OutLogFilePath = "$LogFilesDirectory\$SampleName.$Configuration.$Platform.out" Write-Verbose "Building Sample: $SampleName; Configuration: $Configuration; Platform: $Platform {" msbuild $solutionFile -clp:Verbosity=m -t:clean,build -property:Configuration=$Configuration -property:Platform=$Platform -p:TargetVersion=Windows10 -p:InfVerif_AdditionalOptions="/msft /sw1205 /sw1324 /sw1420 /sw1421" -p:SignToolWS=/fdws -p:DriverCFlagAddOn=/wd4996 -flp1:errorsonly`;logfile=$errorLogFilePath -flp2:WarningsOnly`;logfile=$warnLogFilePath -noLogo > $OutLogFilePath +if ($env:WDS_WipeOutputs -ne $null) +{ + Write-Verbose ("WipeOutputs: "+$Directory+" "+(((Get-Volume ($DriveLetter=(Get-Item ".").PSDrive.Name)).SizeRemaining/1GB))) + Get-ChildItem -path $Directory -Recurse -Include x64|Remove-Item -Recurse + Get-ChildItem -path $Directory -Recurse -Include arm64|Remove-Item -Recurse +} if ($LASTEXITCODE -ne 0) { diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index 3295c8b4..3ef00efe 100644 --- a/Build-SampleSet.ps1 +++ b/Build-SampleSet.ps1 @@ -1,11 +1,16 @@ [CmdletBinding()] param( [hashtable]$SampleSet, - [string[]]$Configurations = @([string]::IsNullOrEmpty($env:Configuration) ? "Debug" : $env:Configuration), - [string[]]$Platforms = @([string]::IsNullOrEmpty($env:Platform) ? "x64" : $env:Platform), - $LogFilesDirectory = (Get-Location) + [string[]]$Configurations = @([string]::IsNullOrEmpty($env:WDS_Configuration) ? "Debug" : $env:WDS_Configuration), + [string[]]$Platforms = @([string]::IsNullOrEmpty($env:WDS_Platform) ? "x64" : $env:WDS_Platform), + $LogFilesDirectory = (Get-Location), + [int]$ThrottleLimit ) +$ThrottleFactor = 5 +$LogicalProcessors = (Get-CIMInstance -Class 'CIM_Processor' -Verbose:$false).NumberOfLogicalProcessors +$ThrottleLimit = $ThrottleLimit -eq 0 ? ($ThrottleFactor * $LogicalProcessors) : $ThrottleLimit + $Verbose = $false if ($PSBoundParameters.ContainsKey('Verbose')) { $Verbose = $PsBoundParameters.Get_Item('Verbose') @@ -18,10 +23,6 @@ $sampleBuilderFilePath = "$LogFilesDirectory\overview.htm" Remove-Item -Recurse -Path $LogFilesDirectory 2>&1 | Out-Null New-Item -ItemType Directory -Force -Path $LogFilesDirectory | Out-Null -$NumberOfLogicalProcessors = (Get-CIMInstance -Class 'CIM_Processor' -Verbose:$false).NumberOfLogicalProcessors -$Throttlefactor = 5 -$SolutionsInParallel = $Throttlefactor * $NumberOfLogicalProcessors - $oldPreference = $ErrorActionPreference $ErrorActionPreference = "stop" try { @@ -58,9 +59,11 @@ Write-Output ("Samples: "+$sampleSet.Count) Write-Output ("Configurations: "+$Configurations.Count+" ("+$Configurations+")") Write-Output ("Platforms: "+$Platforms.Count+" ("+$Platforms+")") Write-Output "Combinations: $SolutionsTotal" -Write-Output "Logical Processors: $NumberOfLogicalProcessors" -Write-Output "Throttle factor: $Throttlefactor" -Write-Output "Throttle limit: $SolutionsInParallel" +Write-Output "LogicalProcessors: $LogicalProcessors" +Write-Output "ThrottleFactor: $ThrottleFactor" +Write-Output "ThrottleLimit: $ThrottleLimit" +Write-Output "WDS_WipeOutputs: $env:WDS_WipeOutputs" +Write-Output ("Disk Remaining (GB): "+(((Get-Volume ($DriveLetter=(Get-Item ".").PSDrive.Name)).SizeRemaining/1GB))) Write-Output "" Write-Output "T: Combinations" Write-Output "B: Built" @@ -78,7 +81,7 @@ $Results = @() $sw = [Diagnostics.Stopwatch]::StartNew() -$SampleSet.GetEnumerator() | ForEach-Object -ThrottleLimit $SolutionsInParallel -Parallel { +$SampleSet.GetEnumerator() | ForEach-Object -ThrottleLimit $ThrottleLimit -Parallel { $LogFilesDirectory = $using:LogFilesDirectory $exclusionsSet = $using:exclusionsSet $Configurations = $using:Configurations @@ -133,11 +136,11 @@ $SampleSet.GetEnumerator() | ForEach-Object -ThrottleLimit $SolutionsInParallel ($using:jresult).SolutionsUnsupported += $thisunsupported ($using:jresult).SolutionsFailed += $thisfailed $SolutionsTotal = $using:SolutionsTotal - $SolutionsInParallel = $using:SolutionsInParallel + $ThrottleLimit = $using:ThrottleLimit $SolutionsBuilt = ($using:jresult).SolutionsBuilt $SolutionsRemaining = $SolutionsTotal - $SolutionsBuilt - $SolutionsRunning = $SolutionsRemaining -ge $SolutionsInParallel ? ($SolutionsInParallel) : ($SolutionsRemaining) - $SolutionsPending = $SolutionsRemaining -ge $SolutionsInParallel ? ($SolutionsRemaining - $SolutionsInParallel) : (0) + $SolutionsRunning = $SolutionsRemaining -ge $ThrottleLimit ? ($ThrottleLimit) : ($SolutionsRemaining) + $SolutionsPending = $SolutionsRemaining -ge $ThrottleLimit ? ($SolutionsRemaining - $ThrottleLimit) : (0) $SolutionsBuiltPercent = [Math]::Round(100 * ($SolutionsBuilt / $using:SolutionsTotal)) $TBRP = "T:" + ($SolutionsTotal) + "; B:" + (($using:jresult).SolutionsBuilt) + "; R:" + ($SolutionsRunning) + "; P:" + ($SolutionsPending) $rstr = "S:" + (($using:jresult).SolutionsSucceeded) + "; E:" + (($using:jresult).SolutionsExcluded) + "; U:" + (($using:jresult).SolutionsUnsupported) + "; F:" + (($using:jresult).SolutionsFailed) @@ -181,6 +184,7 @@ Write-Output "" Write-Output "Built all combinations." Write-Output "" Write-Output "Elapsed time: $min minutes, $seconds seconds." +Write-Output ("Disk Remaining (GB): "+(((Get-Volume ($DriveLetter=(Get-Item ".").PSDrive.Name)).SizeRemaining/1GB))) Write-Output ("Samples: "+$sampleSet.Count) Write-Output ("Configurations: "+$Configurations.Count+" ("+$Configurations+")") Write-Output ("Platforms: "+$Platforms.Count+" ("+$Platforms+")") diff --git a/Building-Locally.md b/Building-Locally.md index 294ecae8..8f62a609 100644 --- a/Building-Locally.md +++ b/Building-Locally.md @@ -15,10 +15,7 @@ You can also just download and mount the EWDK as well and in the following examp * Mount ISO image * Open a terminal * `.\LaunchBuildEnv` - * `set PLATFORM=` - -Note: The last command to clear the PLATFORM variable is added so as to allow the next part to iterate over all platforms automatically without having to add explicit arguments. - + ## Step 3: Clone Windows Driver Samples and checkout main branch ``` @@ -33,12 +30,12 @@ cd Windows-driver-samples pwsh .\Build-AllSamples ``` -Above builds all samples for all configurations and archictures. +Above builds all samples for all configurations and platforms. You can refine, for example as follows: ``` pwsh -.\Build-AllSamples -Samples 'tools.' -Configurations 'Debug','Release' -Platforms 'x64','arm64' -LogFilesDirectory .\_logs +.\Build-AllSamples -Samples '^tools.' -Configurations 'Debug','Release' -Platforms 'x64','arm64' ``` Expected output: -- cgit v1.3.1 From ced42ffc4109cba578e0c35a568a74710d50b2b8 Mon Sep 17 00:00:00 2001 From: jk Date: Tue, 7 Feb 2023 15:44:24 -0800 Subject: Change the locking scheme in DMFT to unlock in setoutputstreamstate (#810) A change in device transform manager brought about a deadlock scenario in DMFT sample. The sample now behaves like we have in the rest of the pipeline i.e. we release the lock and wait for the operations on the input pins to complete. This hang is responsible for AMD hangs. --- avstream/sampledevicemft/basepin.cpp | 53 ++++++------ avstream/sampledevicemft/basepin.h | 14 ++-- avstream/sampledevicemft/common.h | 6 +- avstream/sampledevicemft/multipinmft.cpp | 57 +++++-------- avstream/sampledevicemft/multipinmft.h | 4 +- avstream/sampledevicemft/multipinmfthelpers.cpp | 105 +++++++++++------------- avstream/sampledevicemft/multipinmfthelpers.h | 13 ++- avstream/sampledevicemft/stdafx.h | 4 +- 8 files changed, 118 insertions(+), 138 deletions(-) diff --git a/avstream/sampledevicemft/basepin.cpp b/avstream/sampledevicemft/basepin.cpp index 563ff610..471bbca7 100644 --- a/avstream/sampledevicemft/basepin.cpp +++ b/avstream/sampledevicemft/basepin.cpp @@ -37,12 +37,6 @@ CBasePin::CBasePin( _In_ ULONG id, _In_ CMultipinMft *parent) : CBasePin::~CBasePin() { - - for ( ULONG ulIndex = 0, ulSize = (ULONG)m_listOfMediaTypes.size(); ulIndex < ulSize; ulIndex++ ) - { - ComPtr spMediaType; - spMediaType.Attach(m_listOfMediaTypes[ulIndex]); // Releases the previously stored pointer - } m_listOfMediaTypes.clear(); m_spAttributes = nullptr; } @@ -68,7 +62,6 @@ HRESULT CBasePin::AddMediaType( _Inout_ DWORD *pos, _In_ IMFMediaType *pMediaTyp m_listOfMediaTypes.push_back(pMediaType); }); DMFTCHECKHR_GOTO(hr, done); - pMediaType->AddRef(); if (pos) { *pos = (DWORD)(m_listOfMediaTypes.size() - 1); @@ -89,7 +82,8 @@ HRESULT CBasePin::GetMediaTypeAt( _In_ DWORD pos, _Outptr_result_maybenull_ IMFM { DMFTCHECKHR_GOTO(MF_E_NO_MORE_TYPES,done); } - spMediaType = m_listOfMediaTypes[pos]; + DMFTCHECKHR_GOTO(MFCreateMediaType(spMediaType.GetAddressOf()), done); + DMFTCHECKHR_GOTO(m_listOfMediaTypes[pos]->CopyAllItems(spMediaType.Get()), done); *ppMediaType = spMediaType.Detach(); done: return hr; @@ -129,8 +123,10 @@ STDMETHODIMP_(BOOL) CBasePin::IsMediaTypeSupported { bFound = TRUE; if (ppIMFMediaTypeFull) { - *ppIMFMediaTypeFull = m_listOfMediaTypes[uIIndex]; - (*ppIMFMediaTypeFull)->AddRef(); + ComPtr spMediaType; + DMFTCHECKHR_GOTO(MFCreateMediaType(spMediaType.GetAddressOf()), done); + DMFTCHECKHR_GOTO(m_listOfMediaTypes[uIIndex]->CopyAllItems(spMediaType.Get()), done); + *ppIMFMediaTypeFull = spMediaType.Detach(); } break; } @@ -219,7 +215,7 @@ CInPin::~CInPin() } STDMETHODIMP CInPin::Init( - _In_ IMFTransform* pTransform + _In_ IMFDeviceTransform* pTransform ) { @@ -239,7 +235,7 @@ STDMETHODIMP CInPin::Init( m_waitInputMediaTypeWaiter = CreateEvent( NULL, FALSE, FALSE, - TEXT("MediaTypeWaiter") + nullptr ); DMFTCHECKNULL_GOTO( m_waitInputMediaTypeWaiter, done, E_OUTOFMEMORY ); @@ -275,7 +271,7 @@ HRESULT CInPin::GenerateMFMediaTypeListFromDevice( ComPtr spMediaType; DWORD pos = 0; - hr = m_spSourceTransform->MFTGetOutputAvailableType(uiStreamId, iMediaType, spMediaType.GetAddressOf()); + hr = m_spSourceTransform->GetOutputAvailableType(uiStreamId, iMediaType, spMediaType.GetAddressOf()); if (hr != S_OK) break; @@ -813,11 +809,6 @@ STDMETHODIMP CTranslateOutPin::AddMediaType( DMFTCHECKHR_GOTO(pMediaType->GetGUID(MF_MT_SUBTYPE, &guidSubType), done); // @@@@ README the below lines show how to exclude mediatypes which we don't want - /* if ((guidSubType != MFVideoFormat_H264)) - { - hr = S_FALSE; - goto done; - }*/ if (needTranslation(pMediaType)) { @@ -829,9 +820,21 @@ STDMETHODIMP CTranslateOutPin::AddMediaType( DMFTCHECKHR_GOTO(MFCalculateImageSize(translatedGUID, uiWidth, uiHeight, &uiImageSize), done); DMFTCHECKHR_GOTO(pNewMediaType->SetGUID(MF_MT_SUBTYPE, translatedGUID), done); DMFTCHECKHR_GOTO(pNewMediaType->SetUINT32(MF_MT_SAMPLE_SIZE, uiImageSize), done); + + (void)pNewMediaType->DeleteItem(MF_MT_COMPRESSED); + (void)pNewMediaType->DeleteItem(MF_MT_SAMPLE_SIZE); + (void)pNewMediaType->DeleteItem(MF_MT_AVG_BITRATE); + (void)pNewMediaType->DeleteItem(MF_MT_MPEG2_PROFILE); + (void)pNewMediaType->DeleteItem(MF_MT_MPEG2_LEVEL); + + (void)pNewMediaType->DeleteItem(MF_MT_VIDEO_ROTATION); + (void)pNewMediaType->DeleteItem(MF_MT_MINIMUM_DISPLAY_APERTURE); + + DMFTCHECKHR_GOTO(pNewMediaType->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE), done); + DMFTCHECKHR_GOTO(pNewMediaType->SetUINT32(MF_MT_VIDEO_NOMINAL_RANGE, MFNominalRange_0_255), done); hr = ExceptionBoundary([&]() { - m_TranslatedMediaTypes.insert(std::pair( pNewMediaType.Get(), pMediaType)); + m_TranslatedMediaTypes.insert(std::pair, ComPtr>( pNewMediaType.Get(), pMediaType)); }); DMFTCHECKHR_GOTO(hr, done); } @@ -858,18 +861,22 @@ STDMETHODIMP_(BOOL) CTranslateOutPin::IsMediaTypeSupported( { DWORD dwFlags = 0, dwMatchedFlags = (MF_MEDIATYPE_EQUAL_MAJOR_TYPES | MF_MEDIATYPE_EQUAL_FORMAT_TYPES | MF_MEDIATYPE_EQUAL_FORMAT_DATA); - std::map::iterator found = std::find_if(m_TranslatedMediaTypes.begin(), m_TranslatedMediaTypes.end(), - [&](std::pair p) + auto found = std::find_if(m_TranslatedMediaTypes.begin(), m_TranslatedMediaTypes.end(), + [&](std::pair, ComPtr> p) { - return (SUCCEEDED(pMediaType->IsEqual(p.first, &dwFlags)) + return (SUCCEEDED(pMediaType->IsEqual(p.first.Get(), &dwFlags)) && ((dwFlags & dwMatchedFlags) == (dwMatchedFlags))); }); if (found != m_TranslatedMediaTypes.end()) { - ComPtr spMediaType = (*found).second; + ComPtr spMediaType; if (ppIMFMediaTypeFull) { + if (FAILED(MFCreateMediaType(spMediaType.GetAddressOf()))|| FAILED((*found).second->CopyAllItems(spMediaType.Get()))) + { + return false; + } *ppIMFMediaTypeFull = spMediaType.Detach(); } return true; diff --git a/avstream/sampledevicemft/basepin.h b/avstream/sampledevicemft/basepin.h index cce17d0b..d3e45c93 100644 --- a/avstream/sampledevicemft/basepin.h +++ b/avstream/sampledevicemft/basepin.h @@ -458,10 +458,10 @@ private: class CInPin: public CBasePin{ public: CInPin( _In_opt_ IMFAttributes*, _In_ ULONG ulPinId = 0, _In_ CMultipinMft *pParent=NULL); - ~CInPin(); + virtual ~CInPin(); STDMETHOD ( Init )( - _In_ IMFTransform * + _In_ IMFDeviceTransform * ); STDMETHOD_( VOID, ConnectPin)( _In_ CBasePin * @@ -514,7 +514,7 @@ public: STDMETHOD_( VOID, ShutdownPin)(); protected: - ComPtr m_spSourceTransform; /*Source Transform i.e. DevProxy*/ + ComPtr m_spSourceTransform; /*Source Transform i.e. DevProxy*/ GUID m_stStreamType; /*GUID representing the GUID*/ ComPtr m_outpin; //Only one output pin connected per input pin. There can be multiple pins connected and this could be a list DeviceStreamState m_preferredStreamState; @@ -541,7 +541,7 @@ public: , _In_ MFSampleAllocatorUsage allocatorUsage = MFSampleAllocatorUsage_DoesNotAllocate #endif ); - ~COutPin(); + virtual ~COutPin(); STDMETHODIMP FlushQueues(); STDMETHODIMP AddPin( _In_ DWORD pinId @@ -619,7 +619,7 @@ public: Init(); } STDMETHOD_(VOID, ShutdownPin)(); - ~CAsyncInPin() + virtual ~CAsyncInPin() { FlushQueues(); } @@ -663,10 +663,10 @@ public: _In_ IMFMediaType *pInMediatype, _In_ IMFMediaType* pOutMediaType, _In_ DeviceStreamState state); - + virtual ~CTranslateOutPin() {} protected: - map m_TranslatedMediaTypes; + map, ComPtr> m_TranslatedMediaTypes; }; diff --git a/avstream/sampledevicemft/common.h b/avstream/sampledevicemft/common.h index bc6bbf28..57126378 100644 --- a/avstream/sampledevicemft/common.h +++ b/avstream/sampledevicemft/common.h @@ -230,9 +230,9 @@ typedef enum _DMFT_conversion_type{ DeviceMftTransformTypeIllegal // We cannot satisfy the input and output combination }DMFT_conversion_type,*PDMFT_conversion_type; -typedef std::vector< IMFMediaType *> IMFMediaTypeArray; -typedef std::vector< CBasePin *> CBasePinArray; -typedef std::vector< IMFSample *> IMFSampleList; +typedef std::vector > IMFMediaTypeArray; +typedef std::vector > CBasePinArray; +typedef std::vector > IMFSampleList; typedef std::pair< std::multimap::iterator, std::multimap::iterator > MMFTMMAPITERATOR; diff --git a/avstream/sampledevicemft/multipinmft.cpp b/avstream/sampledevicemft/multipinmft.cpp index 30c0463f..b171338a 100644 --- a/avstream/sampledevicemft/multipinmft.cpp +++ b/avstream/sampledevicemft/multipinmft.cpp @@ -54,21 +54,10 @@ done: CMultipinMft::~CMultipinMft( ) { - - - for ( ULONG ulIndex = 0, ulSize = (ULONG) m_InPins.size(); ulIndex < ulSize; ulIndex++ ) - { - SAFERELEASE(m_InPins[ ulIndex ]); - } m_InPins.clear(); - for (ULONG ulIndex = 0, ulSize = (ULONG) m_OutPins.size(); ulIndex < ulSize; ulIndex++) - { - SAFERELEASE(m_OutPins[ ulIndex ]); - } m_OutPins.clear(); SAFE_ARRAYDELETE(m_SymbolicLink); m_spSourceTransform = nullptr; - } STDMETHODIMP_(ULONG) CMultipinMft::AddRef( @@ -205,7 +194,7 @@ STDMETHODIMP CMultipinMft::InitializeTransform ( DMFTCHECKHR_GOTO( m_spSourceTransform.As( &m_spIkscontrol ), done ); - DMFTCHECKHR_GOTO( m_spSourceTransform->MFTGetStreamCount( &inputStreams, &outputStreams ), done ); + DMFTCHECKHR_GOTO( m_spSourceTransform->GetStreamCount( &inputStreams, &outputStreams ), done ); spFilterUnk = nullptr; @@ -222,7 +211,7 @@ STDMETHODIMP CMultipinMft::InitializeTransform ( pcOutputStreams = new (std::nothrow) DWORD[ outputStreams ]; DMFTCHECKNULL_GOTO( pcOutputStreams, done, E_OUTOFMEMORY ); - DMFTCHECKHR_GOTO( m_spSourceTransform->MFTGetStreamIDs( inputStreams, pcInputStreams, + DMFTCHECKHR_GOTO( m_spSourceTransform->GetStreamIDs( inputStreams, pcInputStreams, outputStreams, pcOutputStreams ),done ); @@ -252,7 +241,6 @@ STDMETHODIMP CMultipinMft::InitializeTransform ( }); DMFTCHECKHR_GOTO(hr, done); DMFTCHECKHR_GOTO( spInPin->Init(m_spSourceTransform.Get() ), done); - spInPin.Detach(); } // @@ -263,7 +251,7 @@ STDMETHODIMP CMultipinMft::InitializeTransform ( ComPtr spoPin; BOOL bCustom = FALSE; - ComPtr spiPin = ( CInPin * )m_InPins[ ulIndex ]; + ComPtr spiPin = ( CInPin * )m_InPins[ ulIndex ].Get(); if (spiPin.Get()) { @@ -292,7 +280,6 @@ STDMETHODIMP CMultipinMft::InitializeTransform ( { m_OutPins.push_back(spoPin.Get()); }), done); - spoPin.Detach(); ulOutPinIndex++; hr = S_OK; } @@ -329,15 +316,7 @@ done: if ( FAILED( hr ) ) { //Release the pins and the resources acquired - for (ULONG ulIndex = 0, ulSize = (ULONG)m_InPins.size(); ulIndex < ulSize; ulIndex++) - { - SAFERELEASE(m_InPins[ulIndex]); - } m_InPins.clear(); - for (ULONG ulIndex = 0, ulSize = (ULONG)m_OutPins.size(); ulIndex < ulSize; ulIndex++) - { - SAFERELEASE(m_OutPins[ulIndex]); - } m_OutPins.clear(); // // Simply clear the custom pins since the input pins must have deleted the pin @@ -461,7 +440,7 @@ STDMETHODIMP CMultipinMft::GetInputAvailableType( ) { HRESULT hr = S_OK; - + CAutoLock lock(m_critSec); ComPtr spiPin = GetInPin( dwInputStreamID ); DMFTCHECKNULL_GOTO(ppMediaType, done, E_INVALIDARG); DMFTCHECKNULL_GOTO( spiPin, done, MF_E_INVALIDSTREAMNUMBER ); @@ -721,7 +700,7 @@ STDMETHODIMP CMultipinMft::ProcessInput( { HRESULT hr = S_OK; UNREFERENCED_PARAMETER( dwFlags ); - + CAutoLock lock(m_critSec); ComPtr spInPin = GetInPin( dwInputStreamID ); DMFTCHECKNULL_GOTO(spInPin, done, MF_E_INVALIDSTREAMNUMBER); @@ -762,6 +741,7 @@ output pins and populate the corresponding MFT_OUTPUT_DATA_BUFFER with the sampl HRESULT hr = S_OK; BOOL gotOne = false; ComPtr spOpin; + CAutoLock _lock(m_critSec); UNREFERENCED_PARAMETER( dwFlags ); if (cOutputBufferCount > m_OutputPinCount ) @@ -774,7 +754,6 @@ output pins and populate the corresponding MFT_OUTPUT_DATA_BUFFER with the sampl { DWORD dwStreamID = pOutputSamples[i].dwStreamID; { - CAutoLock _lock(m_critSec); spOpin = nullptr; spOpin = GetOutPin(dwStreamID); GUID pinGuid = GUID_NULL; @@ -828,7 +807,7 @@ STDMETHODIMP CMultipinMft::GetInputStreamAttributes( { HRESULT hr = S_OK; ComPtr spIPin; - + CAutoLock Lock(m_critSec); DMFTCHECKNULL_GOTO( ppAttributes, done, E_INVALIDARG ); *ppAttributes = nullptr; @@ -857,7 +836,7 @@ STDMETHODIMP CMultipinMft::GetOutputStreamAttributes( { HRESULT hr = S_OK; ComPtr spoPin; - + CAutoLock Lock(m_critSec); DMFTCHECKNULL_GOTO(ppAttributes, done, E_INVALIDARG); *ppAttributes = nullptr; @@ -893,6 +872,7 @@ STDMETHODIMP CMultipinMft::SetInputStreamState( --*/ { HRESULT hr = S_OK; + CAutoLock Lock(m_critSec); ComPtr spiPin = GetInPin(dwStreamID); DMFTCHECKNULL_GOTO(spiPin, done, MF_E_INVALIDSTREAMNUMBER); @@ -909,6 +889,7 @@ STDMETHODIMP CMultipinMft::GetInputStreamState( ) { HRESULT hr = S_OK; + CAutoLock Lock(m_critSec); ComPtr piPin = GetInPin(dwStreamID); DMFTCHECKNULL_GOTO(piPin, done, MF_E_INVALIDSTREAMNUMBER); @@ -994,6 +975,7 @@ STDMETHODIMP CMultipinMft::GetInputStreamPreferredState( --*/ { HRESULT hr = S_OK; + CAutoLock lock(m_critSec); ComPtr spiPin = GetInPin(dwStreamID); DMFTCHECKNULL_GOTO(ppMediaType, done, E_INVALIDARG); DMFTCHECKNULL_GOTO(spiPin, done, MF_E_INVALIDSTREAMNUMBER); @@ -1061,7 +1043,7 @@ STDMETHODIMP_(VOID) CMultipinMft::FlushAllStreams( CAutoLock Lock(m_critSec); for ( DWORD dwIndex = 0, dwSize = (DWORD)m_OutPins.size(); dwIndex < dwSize; dwIndex++ ) { - ComPtr spoPin = (COutPin *)m_OutPins[dwIndex]; + ComPtr spoPin = (COutPin *)m_OutPins[dwIndex].Get(); oldState = spoPin->SetState(DeviceStreamState_Disabled); spoPin->FlushQueues(); // @@ -1391,7 +1373,7 @@ CInPin* CMultipinMft::GetInPin( CInPin *inPin = NULL; for (DWORD dwIndex = 0, dwSize = (DWORD)m_InPins.size(); dwIndex < dwSize; dwIndex++) { - inPin = (CInPin *)m_InPins[dwIndex]; + inPin = (CInPin *)m_InPins[dwIndex].Get(); if (dwStreamId == inPin->streamId()) { break; @@ -1408,7 +1390,7 @@ COutPin* CMultipinMft::GetOutPin( COutPin *outPin = NULL; for ( DWORD dwIndex = 0, dwSize = (DWORD) m_OutPins.size(); dwIndex < dwSize; dwIndex++ ) { - outPin = ( COutPin * )m_OutPins[ dwIndex ]; + outPin = ( COutPin * )m_OutPins[ dwIndex ].Get(); if ( dwStreamId == outPin->streamId() ) { @@ -1509,7 +1491,10 @@ HRESULT CMultipinMft::ChangeMediaTypeEx( // // The media type will be set on the input pin by the time we return from the wait // - DMFTCHECKHR_GOTO(spinPin->WaitForSetInputPinMediaChange(), done); + m_critSec.Unlock(); + hr = spinPin->WaitForSetInputPinMediaChange(); + m_critSec.Lock(); + DMFTCHECKHR_GOTO(hr, done); // Change the media type on the output.. DMFTCHECKHR_GOTO(spoPin->ChangeMediaTypeFromInpin(pFullType.Get(), pMediaType , reqState), done); // @@ -1728,10 +1713,8 @@ STDMETHODIMP CMultipinMft::Shutdown( for (ULONG ulIndex = 0, ulSize = (ULONG)m_InPins.size(); ulIndex < ulSize; ulIndex++ ) { - CInPin *pInPin = static_cast(m_InPins[ulIndex]); - // Deref on the connected outpins to break reference loop - (VOID)pInPin->ShutdownPin(); + (VOID)((CInPin*)m_InPins[ulIndex].Get())->ShutdownPin(); } #if defined (MF_DEVICEMFT_ALLOW_MFT0_LOAD) && defined (MFT_UNIQUE_METHOD_NAMES) for (ULONG ulIndex = 0, ulSize = (ULONG)m_OutPins.size(); ulIndex < ulSize; ulIndex++) @@ -1833,7 +1816,7 @@ HRESULT CMultipinMft::SetStreamingStateCustomPins( for (ULONG ulIndex = 0; ulIndex < m_InPins.size(); ulIndex++) { BOOL isCustom = false; - CInPin* pInPin = static_cast(m_InPins[ulIndex]); + CInPin* pInPin = static_cast(m_InPins[ulIndex].Get()); if ( SUCCEEDED( CheckCustomPin(pInPin, &isCustom) ) && ( isCustom ) ) diff --git a/avstream/sampledevicemft/multipinmft.h b/avstream/sampledevicemft/multipinmft.h index 70367f1d..be86d66b 100644 --- a/avstream/sampledevicemft/multipinmft.h +++ b/avstream/sampledevicemft/multipinmft.h @@ -377,7 +377,7 @@ protected: //Inline functions // - __inline IMFTransform* Parent() + __inline IMFDeviceTransform* Parent() { return m_spSourceTransform.Get(); } @@ -406,7 +406,7 @@ private: long m_nRefCount; // Reference count CCritSec m_critSec; // Control lock.. taken only durign state change operations ComPtr m_spDeviceManagerUnk; // D3D Manager set, when MFT_MESSAGE_SET_D3D_MANAGER is called through ProcessMessage - ComPtr m_spSourceTransform; // The sources transform. This is the pipeline DevProxy + ComPtr m_spSourceTransform; // The sources transform. This is the pipeline DevProxy MFSHUTDOWN_STATUS m_eShutdownStatus; DWORD m_dwWorkQueueId; LONG m_lWorkQueuePriority; diff --git a/avstream/sampledevicemft/multipinmfthelpers.cpp b/avstream/sampledevicemft/multipinmfthelpers.cpp index 34cebe8b..0d720c3d 100644 --- a/avstream/sampledevicemft/multipinmfthelpers.cpp +++ b/avstream/sampledevicemft/multipinmfthelpers.cpp @@ -38,7 +38,6 @@ Description: --*/ STDMETHODIMP_(VOID) CPinQueue::InsertInternal( _In_ IMFSample *pSample ) { - pSample->AddRef(); HRESULT hr = ExceptionBoundary([&]() { m_sampleList.push_back(pSample); @@ -52,8 +51,6 @@ STDMETHODIMP_(VOID) CPinQueue::InsertInternal( _In_ IMFSample *pSample ) if (FAILED(hr)) { DMFTRACE(DMFT_GENERAL, TRACE_LEVEL_INFORMATION, "%!FUNC! exiting %x = %!HRESULT!", hr, hr); - // There is a bug in the pipeline that doesn't release the sample fed from processinput. We have to explicitly release the sample here - SAFE_RELEASE(pSample); } } @@ -78,7 +75,7 @@ STDMETHODIMP CPinQueue::Remove( _Outptr_result_maybenull_ IMFSample **ppSample) if ( !m_sampleList.empty() ) { - *ppSample = m_sampleList.front(); + *ppSample = m_sampleList.front().Detach(); } DMFTCHECKNULL_GOTO( *ppSample, done, MF_E_TRANSFORM_NEED_MORE_INPUT ); @@ -177,33 +174,31 @@ STDMETHODIMP CPinQueue::RecreateTeeByAllocatorMode( Ctee::ReleaseTee(m_spTeer);// Should release the reference - wistd::unique_ptr nulltee = wil::make_unique_nothrow(this); - RETURN_IF_NULL_ALLOC(nulltee); + ComPtr spNulltee = new (std::nothrow) CNullTee(this); + DMFTCHECKNULL_GOTO(spNulltee.Get(), done, E_OUTOFMEMORY); if (allocatorUsage == MFSampleAllocatorUsage_DoesNotAllocate) { - m_spTeer.Attach(nulltee.release()); /*A simple passthrough*/ + m_spTeer = spNulltee.Get(); } else { - wistd::unique_ptr sampleCopytee; - RETURN_IF_NULL_ALLOC(sampleCopytee); - (void)sampleCopytee->SetD3DManager(punkManager); - + ComPtr spSampleCopytee; if (allocatorUsage == MFSampleAllocatorUsage_UsesProvidedAllocator) { RETURN_HR_IF_NULL(E_INVALIDARG, pAllocator); - sampleCopytee = wil::make_unique_nothrow(nulltee.release(), pinCategory(), pAllocator); + spSampleCopytee = new (std::nothrow) CSampleCopytee(spNulltee.Get(), pinCategory(), pAllocator); } else { - sampleCopytee = wil::make_unique_nothrow(nulltee.release(), pinCategory(), nullptr); + spSampleCopytee = new (std::nothrow) CSampleCopytee(spNulltee.Get(), pinCategory(), nullptr); } - - RETURN_IF_FAILED(sampleCopytee->SetMediaTypes(inMediatype, outMediatype)); - m_spTeer.Attach(sampleCopytee.release()); + DMFTCHECKNULL_GOTO(spSampleCopytee.Get(), done, E_OUTOFMEMORY); + (void)spSampleCopytee->SetD3DManager(punkManager); + RETURN_IF_FAILED(spSampleCopytee->SetMediaTypes(inMediatype, outMediatype)); + m_spTeer = spSampleCopytee.Get(); } - +done: return hr; } #endif // ((defined NTDDI_WIN10_VB) && (NTDDI_VERSION >= NTDDI_WIN10_VB)) @@ -283,28 +278,13 @@ this path traversed. This function feeds the sample to the XVP or the decoding T STDMETHODIMP CWrapTee::PassThrough( _In_ IMFSample* pInSample ) { HRESULT hr = S_OK; - IMFSample* pOutSample = nullptr; - bool newSample = false; + ComPtr spOutSample = nullptr; DMFTCHECKNULL_GOTO(pInSample, done, S_OK); // pass through for no sample - DMFTCHECKHR_GOTO(Do(pInSample, &pOutSample,newSample),done); + DMFTCHECKHR_GOTO(Do(pInSample, spOutSample.ReleaseAndGetAddressOf()), done); if (m_spObjectWrapped) { - if (SUCCEEDED(hr = m_spObjectWrapped->PassThrough( pOutSample ))) - { - //@@@@README There is a very bad bug in the pipeline that the device transform manager - // is not releasing the reference on the sample when it is passed to the device MFT so any - // sample produced has to be referenced matched in the deviceMFT so that the net reference remains one - // This goes against the ownership rules in Com, but this bug has existed in the pipeline so far, - // so until we rev the interface we will have to live with it - // - if (newSample) - { - // If we produce the sample, then we have to release the sample - SAFE_RELEASE(pOutSample); - } - } - + DMFTCHECKHR_GOTO(m_spObjectWrapped->PassThrough(spOutSample.Get()), done); } done: @@ -326,7 +306,7 @@ HRESULT CVideoProcTee::SetMediaTypes(_In_ IMFMediaType* pInMediaType, _In_ IMFMe ComPtr spTransform; DMFTCHECKHR_GOTO(CWrapTee::SetMediaTypes(pInMediaType, pOutMediaType),done); DMFTCHECKHR_GOTO(Configure(pInMediaType, pOutMediaType, spTransform.GetAddressOf()), done); - m_spVideoProcessor = spTransform.Detach(); + m_spVideoProcessor = spTransform; // // Start streaming // @@ -380,6 +360,15 @@ HRESULT CVideoProcTee::CreateAllocator() return hr; } +CVideoProcTee::~CVideoProcTee() +{ + if (m_spPrivateAllocator.Get()) + { + (VOID)m_spPrivateAllocator->UninitializeSampleAllocator(); + m_spPrivateAllocator = nullptr; + } +} + // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@// // @@@@ README: Video Processor functions below // @@ -412,10 +401,9 @@ HRESULT CXvptee::StopStreaming() HRESULT hr = S_OK; CAutoLock Lock(m_Lock); SetAsyncStatus(MF_E_SHUTDOWN); - DMFTCHECKHR_GOTO(Transform()->MFTProcessMessage(MFT_MESSAGE_COMMAND_FLUSH, 0), done); // Flush the stream - DMFTCHECKHR_GOTO(Transform()->MFTProcessMessage(MFT_MESSAGE_NOTIFY_END_OF_STREAM, 0), done); // Notify end of stream - DMFTCHECKHR_GOTO(Transform()->MFTProcessMessage(MFT_MESSAGE_NOTIFY_END_STREAMING, 0), done); // Notify end of streaming -done: + Transform()->MFTProcessMessage(MFT_MESSAGE_COMMAND_FLUSH, 0); // Flush the stream + Transform()->MFTProcessMessage(MFT_MESSAGE_NOTIFY_END_OF_STREAM, 0); // Notify end of stream + Transform()->MFTProcessMessage(MFT_MESSAGE_NOTIFY_END_STREAMING, 0); // Notify end of streaming return hr; } @@ -429,7 +417,7 @@ outpin should be in Open state for the sample to reach the XVP and consequetivel Output Pin. --*/ -STDMETHODIMP CXvptee::Do(_In_ IMFSample *pSample, _Outptr_ IMFSample** ppOutSample, _Inout_ bool &newSample) +STDMETHODIMP CXvptee::Do(_In_ IMFSample *pSample, _Outptr_ IMFSample** ppOutSample) { HRESULT hr = S_OK; MFT_OUTPUT_DATA_BUFFER outputSample; @@ -474,7 +462,6 @@ STDMETHODIMP CXvptee::Do(_In_ IMFSample *pSample, _Outptr_ IMFSample** ppOutSamp if (spXVPOutputSample.Get()) { - newSample = true; *ppOutSample = spXVPOutputSample.Detach(); } done: @@ -554,11 +541,6 @@ CDecoderTee::~CDecoderTee() { (VOID)StopStreaming(); MFUnlockWorkQueue(m_dwCameraStreamWorkQueueId); - if (m_spPrivateAllocator) - { - m_spPrivateAllocator->UninitializeSampleAllocator(); - m_spPrivateAllocator = nullptr; - } } HRESULT CDecoderTee::StartStreaming() @@ -584,9 +566,9 @@ HRESULT CDecoderTee::StopStreaming() if (spTransform.Get()) { ComPtr spShutdown; - DMFTCHECKHR_GOTO(spTransform->MFTProcessMessage(MFT_MESSAGE_NOTIFY_END_OF_STREAM, m_dwMFTInputId), done); - DMFTCHECKHR_GOTO(spTransform->MFTProcessMessage(MFT_MESSAGE_COMMAND_FLUSH, 0), done); - DMFTCHECKHR_GOTO(spTransform->MFTProcessMessage(MFT_MESSAGE_NOTIFY_END_STREAMING, 0), done); + spTransform->MFTProcessMessage(MFT_MESSAGE_NOTIFY_END_OF_STREAM, m_dwMFTInputId); + spTransform->MFTProcessMessage(MFT_MESSAGE_COMMAND_FLUSH, 0); + spTransform->MFTProcessMessage(MFT_MESSAGE_NOTIFY_END_STREAMING, 0); // Shut it down if (SUCCEEDED(spTransform->QueryInterface(IID_PPV_ARGS(&spShutdown)))) { @@ -595,7 +577,6 @@ HRESULT CDecoderTee::StopStreaming() spTransform = nullptr; } -done: return hr; } @@ -675,14 +656,13 @@ done: } -STDMETHODIMP CDecoderTee::Do(_In_ IMFSample* pSample, _Outptr_ IMFSample **ppoutSample, _Inout_ bool &newSample) +STDMETHODIMP CDecoderTee::Do(_In_ IMFSample* pSample, _Outptr_ IMFSample **ppoutSample) { HRESULT hr = S_OK; ComPtr spOutputSample; CAutoLock lock(m_Lock); ComPtr spTransform = Transform(); - newSample = false; DMFTCHECKNULL_GOTO(ppoutSample, done, E_INVALIDARG); *ppoutSample = nullptr; DMFTCHECKHR_GOTO(GetAsyncStatus(), done); @@ -983,6 +963,7 @@ HRESULT CDecoderTee::ConfigDecoder(_In_ IMFTransform* pTransform, _In_ GUID guid GUID guidMajorType; GUID guidSubtype; DWORD dwMediaTypeIndex = 0; + DWORD dwFlags = 0; ComPtr spDxgiManager; UNREFERENCED_PARAMETER(guidSubType); DMFTCHECKNULL_GOTO(pTransform, done, E_INVALIDARG); @@ -1050,6 +1031,18 @@ HRESULT CDecoderTee::ConfigDecoder(_In_ IMFTransform* pTransform, _In_ GUID guid // Try to set output type on the MJPG decoder. DMFTCHECKHR_GOTO(pTransform->MFTSetOutputType(m_dwMFTOutputId, spMediaType.Get(), 0), done); + if (S_OK != (spMediaType->IsEqual(m_pOutputMediaType.Get(), &dwFlags))) + { + ComPtr spXvpTee = new (std::nothrow) CXvptee(m_spObjectWrapped.Get(), m_streamCategory); + DMFTCHECKNULL_GOTO(spXvpTee.Get(), done, E_OUTOFMEMORY); + (VOID)spXvpTee->SetD3DManager(m_spDeviceManagerUnk.Get()); + DMFTCHECKHR_GOTO(spXvpTee->SetMediaTypes(spMediaType.Get(), m_pOutputMediaType.Get()), done); + m_spObjectWrapped = spXvpTee; + m_pOutputMediaType = spMediaType; + //Recreate the Allocator + DMFTCHECKHR_GOTO(CreateAllocator(), done); + m_bXvpAdded = TRUE; + } done: if (FAILED(hr)) { @@ -1125,7 +1118,7 @@ VOID CDecoderTee::ShutdownTee() CGrayTee::CGrayTee(_In_ Ctee *tee) : CWrapTee(tee),m_transformfn(nullptr) { } -STDMETHODIMP CGrayTee::Do(_In_ IMFSample *pSample, _Outptr_ IMFSample** ppOutSample, _Inout_ bool &newSample) +STDMETHODIMP CGrayTee::Do(_In_ IMFSample *pSample, _Outptr_ IMFSample** ppOutSample) { HRESULT hr = S_OK; ComPtr spOutputSample; @@ -1190,7 +1183,6 @@ STDMETHODIMP CGrayTee::Do(_In_ IMFSample *pSample, _Outptr_ IMFSample** ppOutSam } if (spOutputSample.Get()) { - newSample = true; *ppOutSample = spOutputSample.Detach(); } done: @@ -1275,7 +1267,7 @@ HRESULT CSampleCopytee::StopStreaming() return S_OK; } -STDMETHODIMP CSampleCopytee::Do(_In_ IMFSample *pSample, _Outptr_ IMFSample** ppOutSample, _Inout_ bool &newSample) +STDMETHODIMP CSampleCopytee::Do(_In_ IMFSample *pSample, _Outptr_ IMFSample** ppOutSample) { HRESULT hr = S_OK; @@ -1318,7 +1310,6 @@ STDMETHODIMP CSampleCopytee::Do(_In_ IMFSample *pSample, _Outptr_ IMFSample** pp if (spXVPOutputSample.Get()) { - newSample = true; *ppOutSample = spXVPOutputSample.Detach(); } diff --git a/avstream/sampledevicemft/multipinmfthelpers.h b/avstream/sampledevicemft/multipinmfthelpers.h index 681ca071..4237dbf4 100644 --- a/avstream/sampledevicemft/multipinmfthelpers.h +++ b/avstream/sampledevicemft/multipinmfthelpers.h @@ -326,7 +326,7 @@ public: } STDMETHODIMP PassThrough ( _In_ IMFSample* ); - virtual STDMETHODIMP Do ( _In_ IMFSample* pSample, _Out_ IMFSample ** , _Inout_ bool &newSample) = 0; + virtual STDMETHODIMP Do ( _In_ IMFSample* pSample, _Out_ IMFSample **) = 0; STDMETHODIMP SetMediaTypes(_In_ IMFMediaType* pInMediaType, _In_ IMFMediaType* pOutMediaType); // // Inline functions @@ -395,8 +395,7 @@ public: } return hr; } - virtual ~CVideoProcTee() - {} + virtual ~CVideoProcTee(); protected: CCritSec m_Lock; __inline VOID SetAsyncStatus(_In_ HRESULT hrStatus) @@ -426,7 +425,7 @@ public: virtual ~CXvptee(); STDMETHOD(StartStreaming)(); STDMETHOD(StopStreaming)(); - STDMETHODIMP Do ( _In_ IMFSample* pSample, _Outptr_ IMFSample **, _Inout_ bool &newSample); + STDMETHODIMP Do ( _In_ IMFSample* pSample, _Outptr_ IMFSample **); STDMETHODIMP Configure ( _In_opt_ IMFMediaType *, _In_opt_ IMFMediaType *, _Outptr_ IMFTransform** ); }; @@ -453,7 +452,7 @@ public: } virtual ~CDecoderTee(); - STDMETHODIMP Do(_In_ IMFSample* pSample, _Outptr_ IMFSample **, _Inout_ bool &newSample); + STDMETHODIMP Do(_In_ IMFSample* pSample, _Outptr_ IMFSample **); STDMETHODIMP Configure(_In_opt_ IMFMediaType *, _In_opt_ IMFMediaType *, _Outptr_ IMFTransform**); STDMETHODIMP Invoke(_In_ IMFAsyncResult*); protected: @@ -491,7 +490,7 @@ public: ~CSampleCopytee(); STDMETHOD(StartStreaming)(); STDMETHOD(StopStreaming)(); - STDMETHODIMP Do(_In_ IMFSample* pSample, _Outptr_ IMFSample **, _Inout_ bool &newSample); + STDMETHODIMP Do(_In_ IMFSample* pSample, _Outptr_ IMFSample **); STDMETHODIMP Configure(_In_opt_ IMFMediaType *, _In_opt_ IMFMediaType *, _Outptr_ IMFTransform**); }; @@ -502,7 +501,7 @@ public: ~CGrayTee() { } - STDMETHODIMP Do(_In_ IMFSample* pSample, _Out_ IMFSample **, , _Inout_ bool &newSample); + STDMETHODIMP Do(_In_ IMFSample* pSample, _Out_ IMFSample **); STDMETHODIMP Configure(_In_opt_ IMFMediaType *, _In_opt_ IMFMediaType *, _Outptr_ IMFTransform**); private: // Function pointer for the function that transforms the image. diff --git a/avstream/sampledevicemft/stdafx.h b/avstream/sampledevicemft/stdafx.h index 657208cd..a76118c0 100644 --- a/avstream/sampledevicemft/stdafx.h +++ b/avstream/sampledevicemft/stdafx.h @@ -54,8 +54,8 @@ using namespace Microsoft::WRL; // //#define MF_DEVICEMFT_ADD_GRAYSCALER_ 1 #define MF_DEVICEMFT_ASYNCPIN_NEEDED 1 -//#define MF_DEVICEMFT_DECODING_MEDIATYPE_NEEDED 0 -#define MF_DEVICEMFT_SET_SPHERICAL_ATTRIBUTES 1 +//#define MF_DEVICEMFT_DECODING_MEDIATYPE_NEEDED 1 +//#define MF_DEVICEMFT_SET_SPHERICAL_ATTRIBUTES 1 //#define MF_DEVICEMFT_ENUM_HW_DECODERS 1 -- cgit v1.3.1 From fe1031f76b5d4c851a3dbf1edb658815f75d25d3 Mon Sep 17 00:00:00 2001 From: tenglu83 Date: Wed, 8 Feb 2023 10:08:15 -0800 Subject: Update NFC sample driver for Windows Driver Compliance (#851) * Install driver to driver store. Include reference to wudfrd.inf * Update windows-drivertemplate-nfc.inf Save the INF file in UTF-8 code. * Update windows-drivertemplate-nfc.inf Remove WUDFRD_ServiceInstall from INF * Remove unnecessary CoInstallers * Change INF coding to UTF-16 LE --------- Co-authored-by: Teng Lu --- .../windows-drivertemplate-nfc.inf | Bin 3862 -> 3264 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/nfc/NfcCxSample/windows-drivertemplate-nfc/windows-drivertemplate-nfc.inf b/nfc/NfcCxSample/windows-drivertemplate-nfc/windows-drivertemplate-nfc.inf index 2c26ad5b..d1fb92b8 100644 Binary files a/nfc/NfcCxSample/windows-drivertemplate-nfc/windows-drivertemplate-nfc.inf and b/nfc/NfcCxSample/windows-drivertemplate-nfc/windows-drivertemplate-nfc.inf differ -- cgit v1.3.1 From 4618ec0b08c943b0f45ad7fed89cc22c615a054e Mon Sep 17 00:00:00 2001 From: Hiroshi Yoshioka <40815708+hyoshioka0128@users.noreply.github.com> Date: Thu, 9 Feb 2023 04:05:45 +0900 Subject: Typo "accpeted"→"accepted" (#838) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/microsoft/Windows-driver-samples/blob/main/pofx/PEP/acpi/acpispecific.c #PingMSFTDocs --- pofx/PEP/acpi/acpispecific.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pofx/PEP/acpi/acpispecific.c b/pofx/PEP/acpi/acpispecific.c index 0e501ad3..7160622b 100644 --- a/pofx/PEP/acpi/acpispecific.c +++ b/pofx/PEP/acpi/acpispecific.c @@ -30,7 +30,7 @@ Environment: #endif // -// To add new devices that will be accpeted by the platform extension, +// To add new devices that will be accepted by the platform extension, // follow to the example below. // @@ -50,9 +50,9 @@ Environment: // // The common library will consume the PepDeviceMatchArray to determine -// whether a device should be accpeted by the platform extension. +// whether a device should be accepted by the platform extension. // And then the common library will consult PepDeviceDefinitionArray for -// the native methods and device-specific notification handlers of the accpeted +// the native methods and device-specific notification handlers of the accepted // devices. // -- cgit v1.3.1 From d4b1a007860a45650a81be4ca773a4cb93631f42 Mon Sep 17 00:00:00 2001 From: naruto0426 <64766327+naruto0426@users.noreply.github.com> Date: Thu, 9 Feb 2023 03:21:33 +0800 Subject: fix the characters that are not unicode to build without problem (#784) --- audio/sysvad/EndpointsCommon/MiniportAudioEngineNode.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/audio/sysvad/EndpointsCommon/MiniportAudioEngineNode.cpp b/audio/sysvad/EndpointsCommon/MiniportAudioEngineNode.cpp index 34477606..8c3979f2 100644 --- a/audio/sysvad/EndpointsCommon/MiniportAudioEngineNode.cpp +++ b/audio/sysvad/EndpointsCommon/MiniportAudioEngineNode.cpp @@ -57,9 +57,9 @@ Remarks: } KSAUDIOENGINE_DESCRIPTOR, *PKSAUDIOENGINE_DESCRIPTOR; The fields are defined as: - nHostPinId – The ID of the pin factory connected to the audio engine node that is intended for host processed audio data. This is the pin factory on which a software audio engine will run. - nOffloadPinId – The ID of the pin factory connected to the audio engine node that is intended for offloaded streams. - nLoopbackPinId – The ID of the pin factory connected to the audio engine that is intended for supplying a post-mix loopback or reference stream. + nHostPinId - The ID of the pin factory connected to the audio engine node that is intended for host processed audio data. This is the pin factory on which a software audio engine will run. + nOffloadPinId - The ID of the pin factory connected to the audio engine node that is intended for offloaded streams. + nLoopbackPinId - The ID of the pin factory connected to the audio engine that is intended for supplying a post-mix loopback or reference stream. All pin ids need to be unique for each audio engine node. -- cgit v1.3.1 From 387bec9ffc8439b5a331500ca0baf7b7f4b19d14 Mon Sep 17 00:00:00 2001 From: astro <68482847+vxcute@users.noreply.github.com> Date: Wed, 8 Feb 2023 23:57:25 +0200 Subject: Remove un-used macro NULL_FILTER_FILTER_NAME (#641) Update nullFilter.c --- filesys/miniFilter/nullFilter/nullFilter.c | 1 - 1 file changed, 1 deletion(-) diff --git a/filesys/miniFilter/nullFilter/nullFilter.c b/filesys/miniFilter/nullFilter/nullFilter.c index 9944db13..6b75c1f5 100644 --- a/filesys/miniFilter/nullFilter/nullFilter.c +++ b/filesys/miniFilter/nullFilter/nullFilter.c @@ -28,7 +28,6 @@ Environment: // Global variables //--------------------------------------------------------------------------- -#define NULL_FILTER_FILTER_NAME L"NullFilter" typedef struct _NULL_FILTER_DATA { -- cgit v1.3.1 From c48bf7dd5c31141b4ea5a355801b9f5a5ee36113 Mon Sep 17 00:00:00 2001 From: Rod Widdowson Date: Wed, 8 Feb 2023 22:02:54 +0000 Subject: Fix typo in comment (#557) The code grabs the FCB SHARED, not Ex --- filesys/fastfat/lockctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filesys/fastfat/lockctrl.c b/filesys/fastfat/lockctrl.c index 58aacdca..1cb183fb 100644 --- a/filesys/fastfat/lockctrl.c +++ b/filesys/fastfat/lockctrl.c @@ -666,7 +666,7 @@ Return Value: } // - // Acquire exclusive access to the Fcb and enqueue the Irp if we didn't + // Acquire shared access to the Fcb and enqueue the Irp if we didn't // get access // -- cgit v1.3.1 From 8b16c8bf22a36f757ed0eda94e07aadff747bac6 Mon Sep 17 00:00:00 2001 From: Hanwool Park Date: Thu, 9 Feb 2023 07:06:49 +0900 Subject: Update filter.h (#544) --- network/ndis/filter/filter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network/ndis/filter/filter.h b/network/ndis/filter/filter.h index bf8da200..c21248d2 100644 --- a/network/ndis/filter/filter.h +++ b/network/ndis/filter/filter.h @@ -115,7 +115,7 @@ typedef struct _QUEUE_HEADER { PQUEUE_ENTRY Head; PQUEUE_ENTRY Tail; -} QUEUE_HEADER, PQUEUE_HEADER; +} QUEUE_HEADER, *PQUEUE_HEADER; #if TRACK_RECEIVES -- cgit v1.3.1 From f0282ae24f7559771c78d7ba5b8e660329fbef51 Mon Sep 17 00:00:00 2001 From: Shiselster Date: Thu, 9 Feb 2023 00:08:56 +0200 Subject: Update README.md (#530) In order to launch the Device Manager, the command is **devmgmt.msc** and not simply **devmgmt**. --- general/toaster/umdf2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/general/toaster/umdf2/README.md b/general/toaster/umdf2/README.md index fb3741c6..a2e6c7c0 100644 --- a/general/toaster/umdf2/README.md +++ b/general/toaster/umdf2/README.md @@ -50,7 +50,7 @@ Before you manually deploy a driver, you must turn on test signing and install a ### View the root enumerated driver in Device Manager -On the target computer, in a Command Prompt window, enter **devmgmt** to open Device Manager. In Device Manager, on the **View** menu, choose **Devices by type**. In the device tree, locate **Sample WDF Toaster Service + Filter** (for example, this might be under the **Toaster** node). +On the target computer, in a Command Prompt window, enter **devmgmt.msc** to open Device Manager. In Device Manager, on the **View** menu, choose **Devices by type**. In the device tree, locate **Sample WDF Toaster Service + Filter** (for example, this might be under the **Toaster** node). In Device Manager, on the **View** menu, choose **Devices by connection**. Locate **Sample WDF Toaster Service + Filter** as a child of the root node of the device tree. -- cgit v1.3.1 From 1e3a4568571dc5bc3bee31e2b741917ee6900cce Mon Sep 17 00:00:00 2001 From: Gerrit Swaneveld <55601905+gerritsMSFT@users.noreply.github.com> Date: Wed, 8 Feb 2023 17:05:01 -0800 Subject: Update Camera Public Samples to use target platform of 'Windows Drivers' (#864) * Remove invalid INF DeviceInstall32 Removes from the sample an invalid API call. * Update to SimpleMediaSource.inf Fixes to use public installation path * Fix to Public Samples to be Windows Drivers compliant Update AvsCamera, AvsCameraMFT0, Avshws, Avsamp, and MultipinMFT samples to be Windows Driver Compliant * Filters Edit Fix Filters files autogenerated by VS --- avstream/avscamera/mft0/AvsCameraMft0.vcxproj | 8 ++++---- avstream/avscamera/sys/AvsCamera.vcxproj | 10 +++++----- avstream/avscamera/sys/AvsCamera.vcxproj.Filters | 15 ++++++++++++++- avstream/avscamera/sys/avscamera.inx | Bin 25260 -> 25302 bytes avstream/avshws/avshws.vcxproj | 16 ++++++++-------- avstream/avshws/avshws.vcxproj.Filters | 12 +++++++++++- avstream/avssamp/avssamp.vcxproj | 8 ++++---- avstream/avssamp/avssamp.vcxproj.Filters | 20 +------------------- avstream/sampledevicemft/multipinmft.vcxproj | 8 ++++---- 9 files changed, 51 insertions(+), 46 deletions(-) diff --git a/avstream/avscamera/mft0/AvsCameraMft0.vcxproj b/avstream/avscamera/mft0/AvsCameraMft0.vcxproj index 518a324f..f1c67d95 100644 --- a/avstream/avscamera/mft0/AvsCameraMft0.vcxproj +++ b/avstream/avscamera/mft0/AvsCameraMft0.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -39,7 +39,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -47,7 +47,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -55,7 +55,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/avstream/avscamera/sys/AvsCamera.vcxproj b/avstream/avscamera/sys/AvsCamera.vcxproj index 5456ee7a..74cada21 100644 --- a/avstream/avscamera/sys/AvsCamera.vcxproj +++ b/avstream/avscamera/sys/AvsCamera.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -39,7 +39,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -47,7 +47,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -55,7 +55,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -256,4 +256,4 @@ - + \ No newline at end of file diff --git a/avstream/avscamera/sys/AvsCamera.vcxproj.Filters b/avstream/avscamera/sys/AvsCamera.vcxproj.Filters index 8d9ec469..1c346b6c 100644 --- a/avstream/avscamera/sys/AvsCamera.vcxproj.Filters +++ b/avstream/avscamera/sys/AvsCamera.vcxproj.Filters @@ -1,4 +1,4 @@ - + @@ -97,10 +97,23 @@ Source Files + + Source Files + Resource Files + + + Header Files + + + + + Driver Files + + \ No newline at end of file diff --git a/avstream/avscamera/sys/avscamera.inx b/avstream/avscamera/sys/avscamera.inx index f6f1e846..a8507243 100644 Binary files a/avstream/avscamera/sys/avscamera.inx and b/avstream/avscamera/sys/avscamera.inx differ diff --git a/avstream/avshws/avshws.vcxproj b/avstream/avshws/avshws.vcxproj index 407048b7..11fb4c39 100644 --- a/avstream/avshws/avshws.vcxproj +++ b/avstream/avshws/avshws.vcxproj @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -61,7 +61,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -69,7 +69,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -77,7 +77,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -85,7 +85,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -93,7 +93,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -101,7 +101,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/avstream/avshws/avshws.vcxproj.Filters b/avstream/avshws/avshws.vcxproj.Filters index 4e32a73f..bc11045f 100644 --- a/avstream/avshws/avshws.vcxproj.Filters +++ b/avstream/avshws/avshws.vcxproj.Filters @@ -1,4 +1,4 @@ - + @@ -43,4 +43,14 @@ Resource Files + + + Header Files + + + + + Driver Files + + \ No newline at end of file diff --git a/avstream/avssamp/avssamp.vcxproj b/avstream/avssamp/avssamp.vcxproj index 58d7992d..dfe36af7 100644 --- a/avstream/avssamp/avssamp.vcxproj +++ b/avstream/avssamp/avssamp.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/avstream/avssamp/avssamp.vcxproj.Filters b/avstream/avssamp/avssamp.vcxproj.Filters index 8d345831..5a9d5e00 100644 --- a/avstream/avssamp/avssamp.vcxproj.Filters +++ b/avstream/avssamp/avssamp.vcxproj.Filters @@ -1,4 +1,4 @@ - + @@ -53,24 +53,6 @@ Header Files - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - diff --git a/avstream/sampledevicemft/multipinmft.vcxproj b/avstream/sampledevicemft/multipinmft.vcxproj index f13ed67d..a236b1ad 100644 --- a/avstream/sampledevicemft/multipinmft.vcxproj +++ b/avstream/sampledevicemft/multipinmft.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary -- cgit v1.3.1 -- cgit v1.3.1 From ff0af974e1045f62cae76cb9dc4b204a5b53ad44 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 13 Feb 2023 09:27:15 -0800 Subject: Fix biometric sample to only install on OS versions it can support (#867) Co-authored-by: Jason Knichel --- biometrics/driver/WudfBioUsbSample.inx | Bin 10500 -> 10552 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/biometrics/driver/WudfBioUsbSample.inx b/biometrics/driver/WudfBioUsbSample.inx index bd32c0dc..22e8e1cf 100644 Binary files a/biometrics/driver/WudfBioUsbSample.inx and b/biometrics/driver/WudfBioUsbSample.inx differ -- cgit v1.3.1 From 13b58897edadaca87ffff979bbf3283258c447e5 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 13 Feb 2023 09:43:55 -0800 Subject: Update VhidminiUm.inf to only target OS versions it works on (#868) Co-authored-by: Jason Knichel --- hid/vhidmini2/driver/umdf2/VhidminiUm.inx | Bin 4814 -> 4850 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/hid/vhidmini2/driver/umdf2/VhidminiUm.inx b/hid/vhidmini2/driver/umdf2/VhidminiUm.inx index 582e044c..1911cfba 100644 Binary files a/hid/vhidmini2/driver/umdf2/VhidminiUm.inx and b/hid/vhidmini2/driver/umdf2/VhidminiUm.inx differ -- cgit v1.3.1 From d3a40cb5025ad7f529b496ebc28f4f5a2b9a2643 Mon Sep 17 00:00:00 2001 From: Adonais Romero González Date: Tue, 14 Feb 2023 14:59:33 -0800 Subject: Fix logging when there are errors (#881) --- Build-SampleSet.ps1 | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index 3ef00efe..2c97f31a 100644 --- a/Build-SampleSet.ps1 +++ b/Build-SampleSet.ps1 @@ -40,7 +40,6 @@ finally { # TODO: Make exclusion more granular; allow for configuration|platform exclusions $exclusionsSet = @{} -$failSet = @() Import-Csv 'exclusions.csv' | ForEach-Object { $exclusionsSet[$_.Path.Replace($root, '').Trim('\').Replace('\', '.').ToLower()] = $_.Reason } @@ -50,6 +49,7 @@ $jresult = @{ SolutionsExcluded = 0 SolutionsFailed = 0 Results = @() + FailSet = @() lock = [System.Threading.Mutex]::new($false) } @@ -100,6 +100,7 @@ $SampleSet.GetEnumerator() | ForEach-Object -ThrottleLimit $ThrottleLimit -Paral $thisexcluded = 0 $thissucceeded = 0 $thisresult = "Not run" + $thisfailset = @() if ($exclusionsSet.ContainsKey($sampleName)) { # Verbose @@ -116,7 +117,7 @@ $SampleSet.GetEnumerator() | ForEach-Object -ThrottleLimit $ThrottleLimit -Paral $thisresult = "Succeeded" } elseif ($LASTEXITCODE -eq 1) { - $failSet += "$sampleName $configuration|$platform" + $thisfailset += "$sampleName $configuration|$platform" $thisfailed += 1 $thisresult = "Failed" } @@ -135,6 +136,7 @@ $SampleSet.GetEnumerator() | ForEach-Object -ThrottleLimit $ThrottleLimit -Paral ($using:jresult).SolutionsExcluded += $thisexcluded ($using:jresult).SolutionsUnsupported += $thisunsupported ($using:jresult).SolutionsFailed += $thisfailed + ($using:jresult).FailSet += $thisfailset $SolutionsTotal = $using:SolutionsTotal $ThrottleLimit = $using:ThrottleLimit $SolutionsBuilt = ($using:jresult).SolutionsBuilt @@ -162,10 +164,16 @@ $SampleSet.GetEnumerator() | ForEach-Object -ThrottleLimit $ThrottleLimit -Paral $sw.Stop() -if ($failSet.Count -gt 0) { +if ($jresult.FailSet.Count -gt 0) { Write-Output "Some combinations were built with errors:" - foreach ($failedSample in $failSet) { - Write-Output "$failedSample" + foreach ($failedSample in $jresult.FailSet) { + $failedSample -match "^(.*) (\w*)\|(\w*)$" | Out-Null + $failName = $Matches[1] + $failConfiguration = $Matches[2] + $failPlatform = $Matches[3] + Write-Output "Build errors in Sample $failName; Configuration: $failConfiguration; Platform: $failPlatform {" + Get-Content "$LogFilesDirectory\$failName.$failConfiguration.$failPlatform.err" | Write-Output + Write-Output "} $failedSample" } Write-Error "Some combinations were built with errors." } -- cgit v1.3.1 From 500494c4871b3c3ecc42414d9f75a4078cd9e613 Mon Sep 17 00:00:00 2001 From: JakobL-MSFT <110699333+JakobL-MSFT@users.noreply.github.com> Date: Tue, 14 Feb 2023 15:40:42 -0800 Subject: Enable the CodeQL workflow to pull submodules similar to the regular workflow. (#883) user-jakobl-codeql-submodules --- .github/workflows/Code-Scanning.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Code-Scanning.yml b/.github/workflows/Code-Scanning.yml index 1ba4c660..c3094b4b 100644 --- a/.github/workflows/Code-Scanning.yml +++ b/.github/workflows/Code-Scanning.yml @@ -35,7 +35,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 with: - fetch-depth: 0 + submodules: 'recursive' - name: Initialize CodeQL uses: github/codeql-action/init@v2 -- cgit v1.3.1 From 2a557292b6cc8487f370275d5323fce3d86ddda7 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 14 Feb 2023 16:52:04 -0800 Subject: Update DCHU sample INFs to restrict themselves to only OS versions they work on (#884) Co-authored-by: Jason Knichel --- general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx | 4 ++-- .../osrfx2_DCHU_component/osrfx2_DCHU_component.inx | 4 ++-- .../osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx | 4 ++-- .../osrfx2_DCHU_component/osrfx2_DCHU_component.inx | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx index 73b6d10e..1e72c7ee 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx @@ -26,9 +26,9 @@ CatalogFile = osrfx2_DCHU_base.cat PnpLockDown = 1 [Manufacturer] -%ManufacturerName% = OsrBase, NT$ARCH$ +%ManufacturerName% = OsrBase, NT$ARCH$.10.0...19041 -[OsrBase.NT$ARCH$] +[OsrBase.NT$ARCH$.10.0...19041] %OsrFx2DeviceName% = OsrFx2_Install, USB\VID_0547&PID_1002 [SourceDisksFiles] diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx index 62c305cb..fefa0931 100644 --- a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx @@ -27,9 +27,9 @@ CatalogFile = osrfx2_DCHU_component.cat PnpLockdown = 1 [Manufacturer] -%ManufacturerName% = OsrFx2Component, NT$ARCH$ +%ManufacturerName% = OsrFx2Component, NT$ARCH$.10.0...15063 -[OsrFx2Component.NT$ARCH$] +[OsrFx2Component.NT$ARCH$.10.0...15063] %DeviceName% = OsrFx2Component_Install, SWC\VID_045e&PID_94ab [SourceDisksFiles] diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx index 29b8e8ec..d824d08b 100644 --- a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx @@ -28,9 +28,9 @@ DriverVer = 05/16/2017,15.14.36.721 PnpLockdown = 1 [Manufacturer] -%ManufacturerName% = OsrFx2Extension, NT$ARCH$ +%ManufacturerName% = OsrFx2Extension, NT$ARCH$.10.0...15063 -[OsrFx2Extension.NT$ARCH$] +[OsrFx2Extension.NT$ARCH$.10.0...15063] %OsrFx2.ExtensionDesc% = OsrFx2Extension_Install, USB\Vid_0547&PID_1002&REV_0000 [OsrFx2Extension_Install.NT] diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx index 62c305cb..fefa0931 100644 --- a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx @@ -27,9 +27,9 @@ CatalogFile = osrfx2_DCHU_component.cat PnpLockdown = 1 [Manufacturer] -%ManufacturerName% = OsrFx2Component, NT$ARCH$ +%ManufacturerName% = OsrFx2Component, NT$ARCH$.10.0...15063 -[OsrFx2Component.NT$ARCH$] +[OsrFx2Component.NT$ARCH$.10.0...15063] %DeviceName% = OsrFx2Component_Install, SWC\VID_045e&PID_94ab [SourceDisksFiles] -- cgit v1.3.1 From 7a69a1a22bd533200c8725683f46b014cd1339cd Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 15 Feb 2023 10:28:26 -0800 Subject: Fix InfVerif 1235 errors in some sample INFs (#885) Co-authored-by: Jason Knichel --- .../WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf | 2518 ++++++++++---------- .../wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf | 2 +- .../WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf | 2518 ++++++++++---------- 3 files changed, 2519 insertions(+), 2519 deletions(-) diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf index e18bf510..fdd046e4 100644 --- a/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf +++ b/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf @@ -1,1259 +1,1259 @@ -;; netrtwlans.inf -;; -;; Realtek Wireless 802.11b/g/n SDIO Network Adapter -;; -;; Copyright (C) 2012 Realtek Semiconductor Corp. -;; -;; This release is primarily for WHQL test. -;; - -;; FOR XP/Vista/Win7/Win8 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} -Provider = %Realtek% -CatalogFile.NT = netrtwlans.cat ;; for WHQL certified -DriverVer = 11/23/2015,3008.22.1030.2015 - -[Manufacturer] -%Realtek% = Realtek,NTArm.10.0 - -[ControlFlags] -ExcludeFromSelect = * - -[Realtek.NTArm.10.0] -;; For 8723 RTK common ================================================================ - -;; For 8723 RTK common ================================================================ -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_8753 -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_B723 -;; Acer -%RTL8723bs.DeviceDesc% = ACER8723bs.ndi, SD\VID_024C&PID_0623 -;; HP -%RTL8723bs.DeviceDesc% = HP8723bs.ndi, SD\VID_024C&PID_0523 -;; ECS -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0524 -;; bestbuy -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0240 -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0241 -;; For Braswell platform -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0626 -;; Reserved -%RTL8723bs.DeviceDesc% = RSVD8723bs.ndi, SD\VID_024C&PID_0624 - -;; For 8188E RTK common ================================================================ -%RTL8188es.DeviceDesc% = RTL8188es.ndi, SD\VID_024C&PID_8188 -%RTL8188es.DeviceDesc% = RTL8188es.ndi, SD\VID_024C&PID_8179 - -;; For 8812A RTK common ================================================================ - -;; For 8814A RTK common ================================================================ -%RTL8814as.DeviceDesc% = RTL8814as.ndi, SD\VID_024C&PID_8813 - -;; For 8821A RTK common ================================================================ -%RTL8821as.DeviceDesc% = RTL8821as.ndi, SD\VID_024C&PID_8821 - -;; For 8192ES RTK common ================================================================ -%RTL8192es.DeviceDesc% = RTL8192es.ndi, SD\VID_024C&PID_818B - - -;; For 8703 RTK common ================================================================ -%RTL8703bs.DeviceDesc% = RTL8703bs.ndi, SD\VID_024C&PID_B703 - -;; For 8188 RTK common ================================================================ -%RTL8188fs.DeviceDesc% = RTL8188fs.ndi, SD\VID_024C&PID_F179 - -;; For 8822B RTK common ================================================================ -%RTL8822bs.DeviceDesc% = RTL8822bs.ndi, SD\VID_024C&PID_B822 - -;; For 8723D RTK common ================================================================ -%RTL8723ds.DeviceDesc% = RTL8723ds.ndi, SD\VID_024C&PID_D723 - -;;---------------------------------------------------------------------------- -;; Realtek 8723as default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8723as.ndi.NT] -AddReg = NDIS_64.reg, RTL8723as.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8723as.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8723as.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8723bs default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8723bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, MCC.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8723bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8723bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration -;;---------------------------------------------------------------------------- -;; Acer 8723bs installation -;;---------------------------------------------------------------------------- - - - - - -[ACER8723bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, RSSI2GridMode_2.reg, MCC.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[ACER8723bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[ACER8723bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration -;;---------------------------------------------------------------------------- -;; HP 8723bs installation -;;---------------------------------------------------------------------------- - - - - - -[HP8723bs.ndi.NT] -AddReg = NDIS_64.reg, HP8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[HP8723bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[HP8723bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; RSVD 8723bs installation -;;---------------------------------------------------------------------------- - - - - - -[RSVD8723bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, WowlanDisable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RSVD8723bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RSVD8723bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8188eu default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8188es.ndi.NT] -AddReg = NDIS_64.reg, RTLWLAN.reg, 11nWirelessMode.reg, Ndis6Set.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8188es.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8188es.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8821as default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8821as.ndi.NT] -AddReg = NDIS_64.reg, RTL8821as.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8821as.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8821as.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8814as default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8814as.ndi.NT] -AddReg = NDIS_64.reg, RTL8814as.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8814as.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8814as.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8192es default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8192es.ndi.NT] -AddReg = NDIS_64.reg, RTL8192es.common.reg, RTLWLAN.reg, 11nWirelessMode.reg, Ndis6Set.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8192es.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8192es.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8703bs default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8703bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8703bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, KFREE_COMMON.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8703bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8703bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8188fs default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8188fs.ndi.NT] -AddReg = NDIS_64.reg, RTL8703bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, CIHVS.reg, PnpPreTransOn.reg, AutoChnlSelon.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8188fs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8188fs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - -;;---------------------------------------------------------------------------- -;; Realtek 8822bs default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8822bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8822bs.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8822bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8822bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8723ds default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8723ds.ndi.NT] -AddReg = NDIS_64.reg, RTL8723ds.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, CIHVS.reg, PnpPreTransOn.reg, AutoChnlSelon.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8723ds.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8723ds.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - -;;---------------------------------------------------------------------------- -;; OS relative registry. -;;---------------------------------------------------------------------------- -[NDIS_64.reg] -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5,mdcwifi" -HKR, Ndi\Interfaces, LowerRange, 0, "wlan,ethernet,vwifi" -HKR, Ndi, Service, 0, "RtlWlans" -;; -;; OS relative service. -;; -[RtlWlans.Service] -DisplayName = %RtlWlans.DeviceDesc.DispName% -ServiceType = 1 ; %SERVICE_KERNEL_DRIVER% -StartType = 3 ; %SERRVICE_DEMAND_START% -ErrorControl = 1 ; %SERRVICE_ERROR_NORMAL% -ServiceBinary = %12%\rtwlans.sys -LoadOrderGroup = NDIS - -;; -;; OS relative event log. -;; -[RtlWlans.EventLog] -AddReg = RtlWlans.AddEventLog.reg - -[RtlWlans.AddEventLog.reg] -HKR, , EventMessageFile, 0x00020000, "%%SystemRoot%%\System32\netevent.dll" -HKR, , TypesSupported , 0x00010001, 7 - -[CIHVS.reg] -HKR, Ndi\IHVExtensions, ExtensibilityDLL, 0, "%SystemRoot%\system32\Rtlihvs.dll" -HKR, Ndi\IHVExtensions, UIExtensibilityCLSID, 0, "{6C2A8CCA-B2A2-4d81-A3B2-4E15F445C312}" -HKR, Ndi\IHVExtensions, GroupName, 0, "Realtek CCX SDK IHV Service" -HKR, Ndi\IHVExtensions, AdapterOUI, 0x00010001, 0x00e04c - -;******************************************************************************* -; WAPI section -;******************************************************************************* -[wapi.reg] -HKR,defaults,WapiSupport,0,"1" -HKR,,WapiSupport,0,"1" - -;******************************************************************************* -; RTL8723as common paramters -;******************************************************************************* -[RTL8723as.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - - -;******************************************************************************* -; RTL8723bs common paramters -;******************************************************************************* -[RTL8723bs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,RomDLFwEnable,0,"1" -HKR,,RomDLFwEnable,0,"1" - -HKR,defaults,bFwCtrlPwrOff,0,"1" -HKR,,bFwCtrlPwrOff,0,"1" - -;;HKR,defaults,EnableAdaptivity,0,"0" -;;HKR,,EnableAdaptivity,0,"0" - -HKR,defaults,EnableCarrierSense,0,"0" -HKR,,EnableCarrierSense,0,"0" - -; AOAC reconnect -HKR,defaults,PnpKeepLink,0,"1" -HKR,,PnpKeepLink,0,"1" - -;; $$ End of RTL8723bs.common.reg - -[HP8723bs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,RomDLFwEnable,0,"1" -HKR,,RomDLFwEnable,0,"1" - -HKR,defaults,bFwCtrlPwrOff,0,"1" -HKR,,bFwCtrlPwrOff,0,"1" - -; Enable Adaptivity -;;HKR,defaults,EnableAdaptivity,0,"1" -;;HKR,,EnableAdaptivity,0,"1" - -HKR,defaults,EnableCarrierSense,0,"0" -HKR,,EnableCarrierSense,0,"0" - -; Enable Customeized PowerLimit Table -HKR,,EnableTxPowerLimit,0,"1" -HKR,,DecryptCustomFile,,"1" -HKR,,PwrLimitFile,0,"TXPWR_LMT_IEC0921_Enc.txt" - -; Regulation WorldWide -HKR,defaults,PwrTblSel,0,"4" -HKR,,PwrTblSel,0,"4" - -; AOAC reconnect -HKR,defaults,PnpKeepLink,0,"1" -HKR,,PnpKeepLink,0,"1" - -;; $$ End of HP8723bs.common.reg - -;******************************************************************************* -; RTL8703bs common paramters -;******************************************************************************* -[RTL8703bs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,RomDLFwEnable,0,"1" -HKR,,RomDLFwEnable,0,"1" - -HKR,defaults,bFwCtrlPwrOff,0,"1" -HKR,,bFwCtrlPwrOff,0,"1" - - -;******************************************************************************* -; RTL8188Fs common paramters -;******************************************************************************* -[RTL8188fs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,RomDLFwEnable,0,"0" -HKR,,RomDLFwEnable,0,"0" - -HKR,defaults,bFwCtrlPwrOff,0,"1" -HKR,,bFwCtrlPwrOff,0,"1" - - -;******************************************************************************* -; RTL8821as common paramters -;******************************************************************************* -[RTL8821as.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -HKR,,StbcCap,0,"17" -HKR,,LdpcCap,0,"34" -HKR,,BeamformCap,0,"34" - - -;******************************************************************************* -; RTL8814as common paramters -;******************************************************************************* -[RTL8814as.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -;; Add for 8814AS, based on 8821AS's modification -HKR,,StbcCap,0,"17" -HKR,,LdpcCap,0,"34" -HKR,,BeamformCap,0,"34" - - -;******************************************************************************* -; RTL8192es common paramters -;******************************************************************************* -[RTL8192es.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -;******************************************************************************* -; RTL8822bs common paramters -;******************************************************************************* -[RTL8822bs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -HKR,,StbcCap,0,"17" -HKR,,LdpcCap,0,"34" -HKR,,BeamformCap,0,"34" -HKR,,ValidRFPath,0,"51" -HKR,,PreInitMem,0,"1" - - -;******************************************************************************* -; RTL8723ds common paramters -;******************************************************************************* -[RTL8723ds.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -HKR,defaults,LdpcCap,0,"0" - - -;;---------------------------------------------------------------------------- -;; Realtek WLAN NIC parameters -;;---------------------------------------------------------------------------- -[RTLWLAN.reg] - -; Enable Adaptivity -HKR,,EnableAdaptivity,0,"1" - -HKR,defaults,Channel,0,"1" -HKR,,Channel,0,"1" - -;; Antenna Diversity Type -HKR,defaults,AntennaDivType,0,"0" -HKR,,AntennaDivType,0,"0" - -HKR,defaults,NetworkType,0,"1" -HKR,,NetworkType,0,"1" - -HKR,defaults,StaUapsd,0,"0" -HKR,,StaUapsd,0,"0" - -; For B/G mode and B/G/N mode switch, we will use different wireless mode registry in later section -HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% -HKR,Ndi\params\WirelessMode, type, 0, "enum" -HKR,Ndi\params\WirelessMode, default, 0, "8" -HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% -HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% -HKR,Ndi\params\WirelessMode\enum, "8", 0, %IEEE_802_11BGN_STR% -HKR,defaults,WirelessMode, 0, "8" -HKR,,WirelessMode, 0, "8" - - -;; For WiFi test, 1: WiFi Config and 0: Performance Config -HKR,defaults,WiFiConfg,0,"0" -HKR,,WiFiConfg,0,"0" - -HKR,defaults,RxReorder,0,"1" -HKR,,RxReorder,0,"1" - -HKR,,DefaultKeyID,,"0" -HKR,,DefaultKey0,,"" -HKR,,DefaultKey1,,"" -HKR,,DefaultKey2,,"" -HKR,,DefaultKey3,,"" - -;Inactive Power Save -HKR,defaults,InactivePs,0,"0" -HKR,,InactivePs,0,"0" - -;Leisure Power Save -HKR,defaults,bLeisurePs,0,"2" -HKR,,bLeisurePs,0,"2" - -;Fw Control LPS -HKR,defaults,bFwCtrlLPS,0,"1" -HKR,,bFwCtrlLPS,0,"1" - -;; LPS Interval -;HKR,defaults,LPSIntvl,0,"3" -HKR,,LPSIntvl,0,"3" - -HKR,,WEPinNmode,0,"0" - -HKR,defaults,RxSC,0,"0" -HKR,,RxSC,0,"0" - -HKR,defaults,TxSC,0,"0" -HKR,,TxSC,0,"0" - -HKR,defaults,NblRacingWA,0,"1" -HKR,,NblRacingWA,0,"1" - -HKR,defaults,SuspendTimerInLowPwr,0,"1" -HKR,,SuspendTimerInLowPwr,0,"1" - -;; Rx reorder pending time -HKR,,RxReorder_PendTime,0,"100" - -;Antenna Diversity -HKR,Ndi\params\AntDiv, ParamDesc, 0, "Antenna Diversity" -HKR,Ndi\params\AntDiv, default, 0, "0" -HKR,Ndi\params\AntDiv, type, 0, "enum" -HKR,Ndi\params\AntDiv\enum, "0", 0, %DISABLED_STR% -HKR,Ndi\params\AntDiv\enum, "1", 0, %ENABLED_STR% - -HKLM, SYSTEM\CurrentControlSet\Services\RtlWlans\Parameters, "BtAntennaInHw", 0x00010001,2 - -[Ndis5Set.reg] -HKR,Ndi\params\PSPXlinkMode, ParamDesc, 0, %PSP_XLINK_STR% -HKR,Ndi\params\PSPXlinkMode, type, 0, "enum" -HKR,Ndi\params\PSPXlinkMode, default, 0, "0" -HKR,Ndi\params\PSPXlinkMode\enum, "0", 0, %DISABLE_STR% -HKR,Ndi\params\PSPXlinkMode\enum, "1", 0, %ENABLE_STR% -HKR,defaults,PSPXlinkMode,0,"0" -HKR,,PSPXlinkMode,0,"0" - -;Inactive Power Save -HKR,defaults,InactivePs,0,"0" -HKR,,InactivePs,0,"0" - - -[Ndis6Set.reg] -;Inactive Power Save -HKR,defaults,InactivePs,0,"2" -HKR,,InactivePs,0,"2" - - -;;---------------------------------------------------------------------------- -;; Wireless mode option parameters -;;---------------------------------------------------------------------------- -[11nWirelessMode.reg] -HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% -HKR,Ndi\params\WirelessMode, type, 0, "enum" -HKR,Ndi\params\WirelessMode, default, 0, "8" -HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% -HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% -HKR,Ndi\params\WirelessMode\enum, "8", 0, %IEEE_802_11BGN_STR% -HKR,defaults,WirelessMode, 0, "8" -HKR,,WirelessMode, 0, "8" - -;; 40MHz Support in 11n -HKR,Ndi\params\BWSetting, ParamDesc, 0, "Bandwidth" -HKR,Ndi\params\BWSetting, type, 0, "enum" -HKR,Ndi\params\BWSetting, default, 0, "1" -HKR,Ndi\params\BWSetting\enum, "0", 0, "20MHz Only" -HKR,Ndi\params\BWSetting\enum, "1", 0, "20_40MHz" -HKR,defaults,BWSetting,0,"1" -HKR,,BWSetting,0,"1" -HKR,,BWSetting,,"1" - -HKR,,Channel,0,"10" - -[11gWirelessMode.reg] -HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% -HKR,Ndi\params\WirelessMode, type, 0, "enum" -HKR,Ndi\params\WirelessMode, default, 0, "8" -HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% -HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% -HKR,defaults,WirelessMode, 0, "4" -HKR,,WirelessMode, 0, "4" - -HKR,,BWSetting,0,"0" - -HKR,,Channel,0,"10" - -[11acWirelessMode.reg] -HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% -HKR,Ndi\params\WirelessMode, type, 0, "enum" -HKR,Ndi\params\WirelessMode, default, 0, "8" -HKR,Ndi\params\WirelessMode\enum, "8", 0, %AUTO_STR% -HKR,Ndi\params\WirelessMode\enum, "1", 0, %IEEE_802_11A_STR% -HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% -HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% -HKR,Ndi\params\WirelessMode\enum, "16", 0, %IEEE_802_11BGN_STR% -HKR,Ndi\params\WirelessMode\enum, "32", 0, %IEEE_802_11AN_STR% -HKR,Ndi\params\WirelessMode\enum, "64", 0, %IEEE_802_11ANAC_STR% -HKR,defaults,WirelessMode, 0, "8" -HKR,,WirelessMode, 0, "8" - -HKR,,Channel,0,"36" - -;; RF Type -HKR,,RFType,0,"15" - - -HKR,defaults,BWSetting,0,"2" -HKR,,BWSetting,0,"2" - -;;---------------------------------------------------------------------------- -;; LPS 32k Control Parameters -;;---------------------------------------------------------------------------- -[32kEnable.reg] -HKR,,bLowPowerEnable,0,"1" -[32kDisable.reg] -HKR,,bLowPowerEnable,0,"0" - -;------------------------------------------------------------------------------- -; PnP pre-transition handling -;------------------------------------------------------------------------------- -[PnpPreTransOn.reg] -HKR,,PreTransPnP,0,"1" -[PnpPreTransOff.reg] -HKR,,PreTransPnP,0,"0" - -;;---------------------------------------------------------------------------- -;; WOWLAN Control Parameters -;;---------------------------------------------------------------------------- -[WowlanAllEnable.reg] -HKR,,WoWLANLPSLevel,0,"2" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"1" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "1" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"1" - -[WowlanDisable.reg] -HKR,,WoWLANLPSLevel,0,"0" -HKR,,ARPOffloadEnable,0,"0" -HKR,,GTKOffloadEnable,0,"0" - -[WowlanAllEnableNoLPS.reg] -HKR,,WoWLANLPSLevel,0,"0" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"1" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "1" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"1" - -[WowlanEnableNoPatternMatch.reg] -HKR,,WoWLANLPSLevel,0,"2" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"1" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "0" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"0" - -[WowlanEnableNoLPSNoPatternMatch.reg] -HKR,,WoWLANLPSLevel,0,"0" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"1" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "0" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"0" - -[ConnectedStandbyEnable.reg] -HKR,,WoWLANLPSLevel,0,"2" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" -HKR,,D2ListenIntvl,0,"4" -HKR,,NSOffloadEnable,0,"1" -HKR,,NLOEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "0" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"0" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "1" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"1" - -;; Packet coalescing should be enabled in WHCK test -HKR,defaults,*PacketCoalescing,0,"0" -HKR,,*PacketCoalescing,0,"0" - -;------------------------------------------------------------------------------- -; Auto Channel Selection -;------------------------------------------------------------------------------- -[AutoChnlSelon.reg] -HKR,,AutoChnlSel,0,"1" -[AutoChnlSeloff.reg] -HKR,,AutoChnlSel,0,"0" - -;;---------------------------------------------------------------------------- -;; RSSI to Grid Mode Parameters -;;---------------------------------------------------------------------------- -[RSSI2GridRealMode.reg] -HKR,,RSSI2GridMode,0,"1" -[RSSI2GridMode_2.reg] -HKR,,RSSI2GridMode,0,"2" -[RSSI2GridMode_4.reg] -HKR,,RSSI2GridMode,0,"4" - -;;---------------------------------------------------------------------------- -;; KFREE parameters -;;---------------------------------------------------------------------------- -[KFREE_COMMON.reg] -HKR,,RfKFreeEnable,0,"0" - -;******************************************************************************* -; Customer reg section -;******************************************************************************* -[ScanType.reg] -HKR,defaults,PassiveScan, 0, "0" -HKR,,PassiveScan, 0, "0" - -;******************************************************************************* -; Multi-Channel Concurrent section -;******************************************************************************* -[MCC.reg] -HKR,Ndi\params\MultiChannelFcsMode, ParamDesc, 0, %MCC_STR% -HKR,Ndi\params\MultiChannelFcsMode, type, 0, "enum" -HKR,Ndi\params\MultiChannelFcsMode, default, 0, "0" -HKR,Ndi\params\MultiChannelFcsMode\enum, "0", 0, %DISABLED_STR% -HKR,Ndi\params\MultiChannelFcsMode\enum, "4", 0, %ENABLED_STR% -HKR,defaults,MultiChannelFcsMode, 0, "0" -HKR,,MultiChannelFcsMode, 0, "0" - -;******************************************************************************* -; Destination Directory -;******************************************************************************* -[RTWlanS.CopyFiles] -rtwlans.sys,,,2 - -[DestinationDirs] -DefaultDestDir = 11 -RTWlanS.CopyFiles = 12 -CIHVS.CopyFiles = 11 -RtlUI2.CopyFiles = 10 - -;;**************************************************************************** -;; Source Files -;;**************************************************************************** -[CIHVS.CopyFiles] -Rtlihvs.dll,,,2 - -[RegisterUIExt] -11,,RtlExtUI.dll,1 - -[RtlUI2.CopyFiles] -RtlUI2.exe,,,2 - -[SourceDisksFiles] -rtwlans.sys = 1 -Rtlihvs.dll = 1 - -[SourceDisksNames] -1=%DISKNAME%,,, - - -;******************************************************************************* -; Strings -;******************************************************************************* -[Strings] -SSID_STR = "SSID" -CHANNEL_STR = "Channel" -NETWORK_TYPE_STR = "Network Type" -LED_CONTROL_STR = "LED Control" -POWER_SAVE_STR = "Power Save Mode" -WIFI_IBSS_STR = "IBSS Default 11b Mode" -RATE_ADAPTIVE_STR = "Rate Adaptive" -QOS_STR = "QoS" -WiFiConfg_STR = "WiFiConfg" -WMM_APSD = "WMM APSD" -CCX_RM_STR = "CCX Radio Measurement" -CCX_OFF_LINE_DUR_UP_LIMIT_STR = "CCX Max Off-Line Measurement (0: unlimited)" -FORCE_PRIORITY_STR = "Forced Priority" -HW_PARA_STR = "Init from HwParaFile" -THREE_WIRE_MODE_STR = "Three Wire Programming Mode" -BOARD_TYPE_STR = "Board Type" -PROTECTION_MODE_STR = "Protection Mode" -TPC_STR = "Transmit Power Control" -TPC_POLARITY_STR = "TPC Polarity Select" -HIGH_POWER_STR = "High Power Mechanism" -INIT_GAIN_STR = "Initial Gain State" -CW_MAX_MIN_STR = "Contention Window" -PSP_XLINK_STR = "PSP XLink Mode" -DISABLE_STR = "Disable" -ENABLE_STR = "Enable" -DISABLED_STR = "Disabled" -ENABLED_STR = "Enabled" -AUTO_STR = "Auto" -AD_HOC_STR = "Ad Hoc" -INFRASTRUCTURE_STR = "Infrastructure" -AUTO_SELECT = "Auto select" -WL_MODE_STR = "Wireless Mode" -RX_REORDER_STR = "Rx Reorder" -CAM_STR = "CAM" -MAX_PSP_STR = "MAX_PSP" -Fast_PSP_STR = "Fast_PSP" -NO_AC_STR = "No AC (Disable)" -ALL_AC_STR = "ALL AC" -IEEE_802_11A_STR = "IEEE 802.11a" -IEEE_802_11B_STR = "IEEE 802.11b" -IEEE_802_11BG_STR = "IEEE 802.11b/g" -IEEE_802_11BGN_STR = "IEEE 802.11b/g/n" -IEEE_802_11AN_STR = "IEEE 802.11a/n" -IEEE_802_11ANAC_STR = "IEEE 802.11a/n/ac" -IEEE_802_11AC_STR = "IEEE 802.11 ac" -WakeOnMagicPacket = "Wake on Magic Packet" -WakeOnPattern = "Wake on Pattern Match" -MCC_STR = "Multi-Channel Concurrent" - -;******************************************************************************* -; manufacture description -;******************************************************************************* -Realtek = "Realtek Semiconductor Corp." - - -;******************************************************************************* -; Source disk name -;******************************************************************************* -DISKNAME = "Realtek Wireless LAN 802.11n SDIO Network Adapter Driver Disk" -RtlWlans.DeviceDesc = "Realtek Wireless LAN 802.11n SDIO Network Adapter" -RtlWlans.DeviceDesc.DispName = "Realtek Wireless LAN 802.11n SDIO Network Adapter" - -;******************************************************************************* -; RTL8723as Device description -;******************************************************************************* -RTL8723as.DeviceDesc = "Realtek RTL8723AS Wireless LAN 802.11n SDIO Network Adapter" -RTL8723as.DeviceDesc.DispName = "Realtek RTL8723AS Wireless LAN 802.11n SDIO Network Adapter" - - - -;******************************************************************************* -; RTL8723bs Device description -;******************************************************************************* -RTL8723bs.DeviceDesc = "Realtek RTL8723BS Wireless LAN 802.11n SDIO Network Adapter" -RTL8723bs.DeviceDesc.DispName = "Realtek RTL8723BS Wireless LAN 802.11n SDIO Network Adapter" - -;******************************************************************************* -; RTL8814as Device description -;******************************************************************************* -RTL8814as.DeviceDesc = "Realtek RTL8814AS Wireless LAN 802.11ac SDIO Network Adapter" -RTL8814as.DeviceDesc.DispName = "Realtek RTL8814AS Wireless LAN 802.11ac SDIO Network Adapter" - -;******************************************************************************* -; RTL8188ES Device description -;******************************************************************************* -RTL8188es.DeviceDesc = "Realtek RTL8189ES Wireless LAN 802.11n USB 2.0 Network Adapter" -RTL8188es.DeviceDesc.DispName = "Realtek RTL8189ES Wireless LAN 802.11n USB 2.0 Network Adapter" -;******************************************************************************* -; RTL8821as Device description -;******************************************************************************* -RTL8821as.DeviceDesc = "Realtek RTL8821AS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" -RTL8821as.DeviceDesc.DispName = "Realtek RTL8821AS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" -;******************************************************************************* -; RTL8192E Device description -;******************************************************************************* -RTL8192es.DeviceDesc = "Realtek RTL8192ES Wireless LAN 802.11n USB 2.0 Network Adapter" -RTL8192es.DeviceDesc.DispName = "Realtek RTL8192ES Wireless LAN 802.11n USB 2.0 Network Adapter" - -;******************************************************************************* -; RTL8703bs Device description -;******************************************************************************* -RTL8703bs.DeviceDesc = "Realtek RTL8703BS Wireless LAN 802.11n SDIO Network Adapter" -RTL8703bs.DeviceDesc.DispName = "Realtek RTL8703BS Wireless LAN 802.11n SDIO Network Adapter" - -;******************************************************************************* -; RTL8188Fs Device description -;******************************************************************************* -RTL8188fs.DeviceDesc = "Realtek RTL8189FTV Wireless LAN 802.11n SDIO Network Adapter" -RTL8188fs.DeviceDesc.DispName = "Realtek RTL8189FTV Wireless LAN 802.11n SDIO Network Adapter" -;******************************************************************************* -; RTL8822bs Device description -;******************************************************************************* -RTL8822bs.DeviceDesc = "Realtek RTL8822BS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" -RTL8822bs.DeviceDesc.DispName = "Realtek RTL8822BS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" - -;******************************************************************************* -; RTL8723ds Device description -;******************************************************************************* -RTL8723ds.DeviceDesc = "Realtek RTL8723DS Wireless LAN 802.11n SDIO Network Adapter" -RTL8723ds.DeviceDesc.DispName = "Realtek RTL8723DS Wireless LAN 802.11n SDIO Network Adapter" +;; netrtwlans.inf +;; +;; Realtek Wireless 802.11b/g/n SDIO Network Adapter +;; +;; Copyright (C) 2012 Realtek Semiconductor Corp. +;; +;; This release is primarily for WHQL test. +;; + +;; FOR XP/Vista/Win7/Win8 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} +Provider = %Realtek% +CatalogFile.NT = netrtwlans.cat ;; for WHQL certified +DriverVer = 11/23/2015,3008.22.1030.2015 + +[Manufacturer] +%Realtek% = Realtek,NTArm.10.0 + +[ControlFlags] +ExcludeFromSelect = * + +[Realtek.NTArm.10.0] +;; For 8723 RTK common ================================================================ + +;; For 8723 RTK common ================================================================ +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_8753 +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_B723 +;; Acer +%RTL8723bs.DeviceDesc% = ACER8723bs.ndi, SD\VID_024C&PID_0623 +;; HP +%RTL8723bs.DeviceDesc% = HP8723bs.ndi, SD\VID_024C&PID_0523 +;; ECS +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0524 +;; bestbuy +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0240 +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0241 +;; For Braswell platform +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0626 +;; Reserved +%RTL8723bs.DeviceDesc% = RSVD8723bs.ndi, SD\VID_024C&PID_0624 + +;; For 8188E RTK common ================================================================ +%RTL8188es.DeviceDesc% = RTL8188es.ndi, SD\VID_024C&PID_8188 +%RTL8188es.DeviceDesc% = RTL8188es.ndi, SD\VID_024C&PID_8179 + +;; For 8812A RTK common ================================================================ + +;; For 8814A RTK common ================================================================ +%RTL8814as.DeviceDesc% = RTL8814as.ndi, SD\VID_024C&PID_8813 + +;; For 8821A RTK common ================================================================ +%RTL8821as.DeviceDesc% = RTL8821as.ndi, SD\VID_024C&PID_8821 + +;; For 8192ES RTK common ================================================================ +%RTL8192es.DeviceDesc% = RTL8192es.ndi, SD\VID_024C&PID_818B + + +;; For 8703 RTK common ================================================================ +%RTL8703bs.DeviceDesc% = RTL8703bs.ndi, SD\VID_024C&PID_B703 + +;; For 8188 RTK common ================================================================ +%RTL8188fs.DeviceDesc% = RTL8188fs.ndi, SD\VID_024C&PID_F179 + +;; For 8822B RTK common ================================================================ +%RTL8822bs.DeviceDesc% = RTL8822bs.ndi, SD\VID_024C&PID_B822 + +;; For 8723D RTK common ================================================================ +%RTL8723ds.DeviceDesc% = RTL8723ds.ndi, SD\VID_024C&PID_D723 + +;;---------------------------------------------------------------------------- +;; Realtek 8723as default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8723as.ndi.NT] +AddReg = NDIS_64.reg, RTL8723as.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8723as.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8723as.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8723bs default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8723bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, MCC.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8723bs.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8723bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration +;;---------------------------------------------------------------------------- +;; Acer 8723bs installation +;;---------------------------------------------------------------------------- + + + + + +[ACER8723bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, RSSI2GridMode_2.reg, MCC.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[ACER8723bs.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[ACER8723bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration +;;---------------------------------------------------------------------------- +;; HP 8723bs installation +;;---------------------------------------------------------------------------- + + + + + +[HP8723bs.ndi.NT] +AddReg = NDIS_64.reg, HP8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[HP8723bs.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[HP8723bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; RSVD 8723bs installation +;;---------------------------------------------------------------------------- + + + + + +[RSVD8723bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, WowlanDisable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RSVD8723bs.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RSVD8723bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8188eu default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8188es.ndi.NT] +AddReg = NDIS_64.reg, RTLWLAN.reg, 11nWirelessMode.reg, Ndis6Set.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8188es.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8188es.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8821as default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8821as.ndi.NT] +AddReg = NDIS_64.reg, RTL8821as.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8821as.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8821as.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8814as default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8814as.ndi.NT] +AddReg = NDIS_64.reg, RTL8814as.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8814as.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8814as.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8192es default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8192es.ndi.NT] +AddReg = NDIS_64.reg, RTL8192es.common.reg, RTLWLAN.reg, 11nWirelessMode.reg, Ndis6Set.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8192es.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8192es.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8703bs default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8703bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8703bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, KFREE_COMMON.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8703bs.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8703bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8188fs default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8188fs.ndi.NT] +AddReg = NDIS_64.reg, RTL8703bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, CIHVS.reg, PnpPreTransOn.reg, AutoChnlSelon.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8188fs.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8188fs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + +;;---------------------------------------------------------------------------- +;; Realtek 8822bs default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8822bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8822bs.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8822bs.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8822bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8723ds default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8723ds.ndi.NT] +AddReg = NDIS_64.reg, RTL8723ds.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, CIHVS.reg, PnpPreTransOn.reg, AutoChnlSelon.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8723ds.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8723ds.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + +;;---------------------------------------------------------------------------- +;; OS relative registry. +;;---------------------------------------------------------------------------- +[NDIS_64.reg] +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5,mdcwifi" +HKR, Ndi\Interfaces, LowerRange, 0, "wlan,ethernet,vwifi" +HKR, Ndi, Service, 0, "RtlWlans" +;; +;; OS relative service. +;; +[RtlWlans.Service] +DisplayName = %RtlWlans.DeviceDesc.DispName% +ServiceType = 1 ; %SERVICE_KERNEL_DRIVER% +StartType = 3 ; %SERRVICE_DEMAND_START% +ErrorControl = 1 ; %SERRVICE_ERROR_NORMAL% +ServiceBinary = %12%\rtwlans.sys +LoadOrderGroup = NDIS + +;; +;; OS relative event log. +;; +[RtlWlans.EventLog] +AddReg = RtlWlans.AddEventLog.reg + +[RtlWlans.AddEventLog.reg] +HKR, , EventMessageFile, 0x00020000, "%%SystemRoot%%\System32\netevent.dll" +HKR, , TypesSupported , 0x00010001, 7 + +[CIHVS.reg] +HKR, Ndi\IHVExtensions, ExtensibilityDLL, 0, "%%SystemRoot%%\system32\Rtlihvs.dll" +HKR, Ndi\IHVExtensions, UIExtensibilityCLSID, 0, "{6C2A8CCA-B2A2-4d81-A3B2-4E15F445C312}" +HKR, Ndi\IHVExtensions, GroupName, 0, "Realtek CCX SDK IHV Service" +HKR, Ndi\IHVExtensions, AdapterOUI, 0x00010001, 0x00e04c + +;******************************************************************************* +; WAPI section +;******************************************************************************* +[wapi.reg] +HKR,defaults,WapiSupport,0,"1" +HKR,,WapiSupport,0,"1" + +;******************************************************************************* +; RTL8723as common paramters +;******************************************************************************* +[RTL8723as.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + + +;******************************************************************************* +; RTL8723bs common paramters +;******************************************************************************* +[RTL8723bs.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,RomDLFwEnable,0,"1" +HKR,,RomDLFwEnable,0,"1" + +HKR,defaults,bFwCtrlPwrOff,0,"1" +HKR,,bFwCtrlPwrOff,0,"1" + +;;HKR,defaults,EnableAdaptivity,0,"0" +;;HKR,,EnableAdaptivity,0,"0" + +HKR,defaults,EnableCarrierSense,0,"0" +HKR,,EnableCarrierSense,0,"0" + +; AOAC reconnect +HKR,defaults,PnpKeepLink,0,"1" +HKR,,PnpKeepLink,0,"1" + +;; $$ End of RTL8723bs.common.reg + +[HP8723bs.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,RomDLFwEnable,0,"1" +HKR,,RomDLFwEnable,0,"1" + +HKR,defaults,bFwCtrlPwrOff,0,"1" +HKR,,bFwCtrlPwrOff,0,"1" + +; Enable Adaptivity +;;HKR,defaults,EnableAdaptivity,0,"1" +;;HKR,,EnableAdaptivity,0,"1" + +HKR,defaults,EnableCarrierSense,0,"0" +HKR,,EnableCarrierSense,0,"0" + +; Enable Customeized PowerLimit Table +HKR,,EnableTxPowerLimit,0,"1" +HKR,,DecryptCustomFile,,"1" +HKR,,PwrLimitFile,0,"TXPWR_LMT_IEC0921_Enc.txt" + +; Regulation WorldWide +HKR,defaults,PwrTblSel,0,"4" +HKR,,PwrTblSel,0,"4" + +; AOAC reconnect +HKR,defaults,PnpKeepLink,0,"1" +HKR,,PnpKeepLink,0,"1" + +;; $$ End of HP8723bs.common.reg + +;******************************************************************************* +; RTL8703bs common paramters +;******************************************************************************* +[RTL8703bs.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,RomDLFwEnable,0,"1" +HKR,,RomDLFwEnable,0,"1" + +HKR,defaults,bFwCtrlPwrOff,0,"1" +HKR,,bFwCtrlPwrOff,0,"1" + + +;******************************************************************************* +; RTL8188Fs common paramters +;******************************************************************************* +[RTL8188fs.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,RomDLFwEnable,0,"0" +HKR,,RomDLFwEnable,0,"0" + +HKR,defaults,bFwCtrlPwrOff,0,"1" +HKR,,bFwCtrlPwrOff,0,"1" + + +;******************************************************************************* +; RTL8821as common paramters +;******************************************************************************* +[RTL8821as.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +HKR,,StbcCap,0,"17" +HKR,,LdpcCap,0,"34" +HKR,,BeamformCap,0,"34" + + +;******************************************************************************* +; RTL8814as common paramters +;******************************************************************************* +[RTL8814as.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +;; Add for 8814AS, based on 8821AS's modification +HKR,,StbcCap,0,"17" +HKR,,LdpcCap,0,"34" +HKR,,BeamformCap,0,"34" + + +;******************************************************************************* +; RTL8192es common paramters +;******************************************************************************* +[RTL8192es.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +;******************************************************************************* +; RTL8822bs common paramters +;******************************************************************************* +[RTL8822bs.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +HKR,,StbcCap,0,"17" +HKR,,LdpcCap,0,"34" +HKR,,BeamformCap,0,"34" +HKR,,ValidRFPath,0,"51" +HKR,,PreInitMem,0,"1" + + +;******************************************************************************* +; RTL8723ds common paramters +;******************************************************************************* +[RTL8723ds.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +HKR,defaults,LdpcCap,0,"0" + + +;;---------------------------------------------------------------------------- +;; Realtek WLAN NIC parameters +;;---------------------------------------------------------------------------- +[RTLWLAN.reg] + +; Enable Adaptivity +HKR,,EnableAdaptivity,0,"1" + +HKR,defaults,Channel,0,"1" +HKR,,Channel,0,"1" + +;; Antenna Diversity Type +HKR,defaults,AntennaDivType,0,"0" +HKR,,AntennaDivType,0,"0" + +HKR,defaults,NetworkType,0,"1" +HKR,,NetworkType,0,"1" + +HKR,defaults,StaUapsd,0,"0" +HKR,,StaUapsd,0,"0" + +; For B/G mode and B/G/N mode switch, we will use different wireless mode registry in later section +HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% +HKR,Ndi\params\WirelessMode, type, 0, "enum" +HKR,Ndi\params\WirelessMode, default, 0, "8" +HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% +HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% +HKR,Ndi\params\WirelessMode\enum, "8", 0, %IEEE_802_11BGN_STR% +HKR,defaults,WirelessMode, 0, "8" +HKR,,WirelessMode, 0, "8" + + +;; For WiFi test, 1: WiFi Config and 0: Performance Config +HKR,defaults,WiFiConfg,0,"0" +HKR,,WiFiConfg,0,"0" + +HKR,defaults,RxReorder,0,"1" +HKR,,RxReorder,0,"1" + +HKR,,DefaultKeyID,,"0" +HKR,,DefaultKey0,,"" +HKR,,DefaultKey1,,"" +HKR,,DefaultKey2,,"" +HKR,,DefaultKey3,,"" + +;Inactive Power Save +HKR,defaults,InactivePs,0,"0" +HKR,,InactivePs,0,"0" + +;Leisure Power Save +HKR,defaults,bLeisurePs,0,"2" +HKR,,bLeisurePs,0,"2" + +;Fw Control LPS +HKR,defaults,bFwCtrlLPS,0,"1" +HKR,,bFwCtrlLPS,0,"1" + +;; LPS Interval +;HKR,defaults,LPSIntvl,0,"3" +HKR,,LPSIntvl,0,"3" + +HKR,,WEPinNmode,0,"0" + +HKR,defaults,RxSC,0,"0" +HKR,,RxSC,0,"0" + +HKR,defaults,TxSC,0,"0" +HKR,,TxSC,0,"0" + +HKR,defaults,NblRacingWA,0,"1" +HKR,,NblRacingWA,0,"1" + +HKR,defaults,SuspendTimerInLowPwr,0,"1" +HKR,,SuspendTimerInLowPwr,0,"1" + +;; Rx reorder pending time +HKR,,RxReorder_PendTime,0,"100" + +;Antenna Diversity +HKR,Ndi\params\AntDiv, ParamDesc, 0, "Antenna Diversity" +HKR,Ndi\params\AntDiv, default, 0, "0" +HKR,Ndi\params\AntDiv, type, 0, "enum" +HKR,Ndi\params\AntDiv\enum, "0", 0, %DISABLED_STR% +HKR,Ndi\params\AntDiv\enum, "1", 0, %ENABLED_STR% + +HKLM, SYSTEM\CurrentControlSet\Services\RtlWlans\Parameters, "BtAntennaInHw", 0x00010001,2 + +[Ndis5Set.reg] +HKR,Ndi\params\PSPXlinkMode, ParamDesc, 0, %PSP_XLINK_STR% +HKR,Ndi\params\PSPXlinkMode, type, 0, "enum" +HKR,Ndi\params\PSPXlinkMode, default, 0, "0" +HKR,Ndi\params\PSPXlinkMode\enum, "0", 0, %DISABLE_STR% +HKR,Ndi\params\PSPXlinkMode\enum, "1", 0, %ENABLE_STR% +HKR,defaults,PSPXlinkMode,0,"0" +HKR,,PSPXlinkMode,0,"0" + +;Inactive Power Save +HKR,defaults,InactivePs,0,"0" +HKR,,InactivePs,0,"0" + + +[Ndis6Set.reg] +;Inactive Power Save +HKR,defaults,InactivePs,0,"2" +HKR,,InactivePs,0,"2" + + +;;---------------------------------------------------------------------------- +;; Wireless mode option parameters +;;---------------------------------------------------------------------------- +[11nWirelessMode.reg] +HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% +HKR,Ndi\params\WirelessMode, type, 0, "enum" +HKR,Ndi\params\WirelessMode, default, 0, "8" +HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% +HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% +HKR,Ndi\params\WirelessMode\enum, "8", 0, %IEEE_802_11BGN_STR% +HKR,defaults,WirelessMode, 0, "8" +HKR,,WirelessMode, 0, "8" + +;; 40MHz Support in 11n +HKR,Ndi\params\BWSetting, ParamDesc, 0, "Bandwidth" +HKR,Ndi\params\BWSetting, type, 0, "enum" +HKR,Ndi\params\BWSetting, default, 0, "1" +HKR,Ndi\params\BWSetting\enum, "0", 0, "20MHz Only" +HKR,Ndi\params\BWSetting\enum, "1", 0, "20_40MHz" +HKR,defaults,BWSetting,0,"1" +HKR,,BWSetting,0,"1" +HKR,,BWSetting,,"1" + +HKR,,Channel,0,"10" + +[11gWirelessMode.reg] +HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% +HKR,Ndi\params\WirelessMode, type, 0, "enum" +HKR,Ndi\params\WirelessMode, default, 0, "8" +HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% +HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% +HKR,defaults,WirelessMode, 0, "4" +HKR,,WirelessMode, 0, "4" + +HKR,,BWSetting,0,"0" + +HKR,,Channel,0,"10" + +[11acWirelessMode.reg] +HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% +HKR,Ndi\params\WirelessMode, type, 0, "enum" +HKR,Ndi\params\WirelessMode, default, 0, "8" +HKR,Ndi\params\WirelessMode\enum, "8", 0, %AUTO_STR% +HKR,Ndi\params\WirelessMode\enum, "1", 0, %IEEE_802_11A_STR% +HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% +HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% +HKR,Ndi\params\WirelessMode\enum, "16", 0, %IEEE_802_11BGN_STR% +HKR,Ndi\params\WirelessMode\enum, "32", 0, %IEEE_802_11AN_STR% +HKR,Ndi\params\WirelessMode\enum, "64", 0, %IEEE_802_11ANAC_STR% +HKR,defaults,WirelessMode, 0, "8" +HKR,,WirelessMode, 0, "8" + +HKR,,Channel,0,"36" + +;; RF Type +HKR,,RFType,0,"15" + + +HKR,defaults,BWSetting,0,"2" +HKR,,BWSetting,0,"2" + +;;---------------------------------------------------------------------------- +;; LPS 32k Control Parameters +;;---------------------------------------------------------------------------- +[32kEnable.reg] +HKR,,bLowPowerEnable,0,"1" +[32kDisable.reg] +HKR,,bLowPowerEnable,0,"0" + +;------------------------------------------------------------------------------- +; PnP pre-transition handling +;------------------------------------------------------------------------------- +[PnpPreTransOn.reg] +HKR,,PreTransPnP,0,"1" +[PnpPreTransOff.reg] +HKR,,PreTransPnP,0,"0" + +;;---------------------------------------------------------------------------- +;; WOWLAN Control Parameters +;;---------------------------------------------------------------------------- +[WowlanAllEnable.reg] +HKR,,WoWLANLPSLevel,0,"2" +HKR,,ARPOffloadEnable,0,"1" +HKR,,GTKOffloadEnable,0,"1" + +HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% +HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" +HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" +HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnMagicPacket,0,"1" + +HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% +HKR, Ndi\params\*WakeOnPattern, default, 0, "1" +HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" +HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnPattern,0,"1" + +[WowlanDisable.reg] +HKR,,WoWLANLPSLevel,0,"0" +HKR,,ARPOffloadEnable,0,"0" +HKR,,GTKOffloadEnable,0,"0" + +[WowlanAllEnableNoLPS.reg] +HKR,,WoWLANLPSLevel,0,"0" +HKR,,ARPOffloadEnable,0,"1" +HKR,,GTKOffloadEnable,0,"1" + +HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% +HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" +HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" +HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnMagicPacket,0,"1" + +HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% +HKR, Ndi\params\*WakeOnPattern, default, 0, "1" +HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" +HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnPattern,0,"1" + +[WowlanEnableNoPatternMatch.reg] +HKR,,WoWLANLPSLevel,0,"2" +HKR,,ARPOffloadEnable,0,"1" +HKR,,GTKOffloadEnable,0,"1" + +HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% +HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" +HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" +HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnMagicPacket,0,"1" + +HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% +HKR, Ndi\params\*WakeOnPattern, default, 0, "0" +HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" +HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnPattern,0,"0" + +[WowlanEnableNoLPSNoPatternMatch.reg] +HKR,,WoWLANLPSLevel,0,"0" +HKR,,ARPOffloadEnable,0,"1" +HKR,,GTKOffloadEnable,0,"1" + +HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% +HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" +HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" +HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnMagicPacket,0,"1" + +HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% +HKR, Ndi\params\*WakeOnPattern, default, 0, "0" +HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" +HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnPattern,0,"0" + +[ConnectedStandbyEnable.reg] +HKR,,WoWLANLPSLevel,0,"2" +HKR,,ARPOffloadEnable,0,"1" +HKR,,GTKOffloadEnable,0,"1" +HKR,,D2ListenIntvl,0,"4" +HKR,,NSOffloadEnable,0,"1" +HKR,,NLOEnable,0,"1" + +HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% +HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "0" +HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" +HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnMagicPacket,0,"0" + +HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% +HKR, Ndi\params\*WakeOnPattern, default, 0, "1" +HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" +HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnPattern,0,"1" + +;; Packet coalescing should be enabled in WHCK test +HKR,defaults,*PacketCoalescing,0,"0" +HKR,,*PacketCoalescing,0,"0" + +;------------------------------------------------------------------------------- +; Auto Channel Selection +;------------------------------------------------------------------------------- +[AutoChnlSelon.reg] +HKR,,AutoChnlSel,0,"1" +[AutoChnlSeloff.reg] +HKR,,AutoChnlSel,0,"0" + +;;---------------------------------------------------------------------------- +;; RSSI to Grid Mode Parameters +;;---------------------------------------------------------------------------- +[RSSI2GridRealMode.reg] +HKR,,RSSI2GridMode,0,"1" +[RSSI2GridMode_2.reg] +HKR,,RSSI2GridMode,0,"2" +[RSSI2GridMode_4.reg] +HKR,,RSSI2GridMode,0,"4" + +;;---------------------------------------------------------------------------- +;; KFREE parameters +;;---------------------------------------------------------------------------- +[KFREE_COMMON.reg] +HKR,,RfKFreeEnable,0,"0" + +;******************************************************************************* +; Customer reg section +;******************************************************************************* +[ScanType.reg] +HKR,defaults,PassiveScan, 0, "0" +HKR,,PassiveScan, 0, "0" + +;******************************************************************************* +; Multi-Channel Concurrent section +;******************************************************************************* +[MCC.reg] +HKR,Ndi\params\MultiChannelFcsMode, ParamDesc, 0, %MCC_STR% +HKR,Ndi\params\MultiChannelFcsMode, type, 0, "enum" +HKR,Ndi\params\MultiChannelFcsMode, default, 0, "0" +HKR,Ndi\params\MultiChannelFcsMode\enum, "0", 0, %DISABLED_STR% +HKR,Ndi\params\MultiChannelFcsMode\enum, "4", 0, %ENABLED_STR% +HKR,defaults,MultiChannelFcsMode, 0, "0" +HKR,,MultiChannelFcsMode, 0, "0" + +;******************************************************************************* +; Destination Directory +;******************************************************************************* +[RTWlanS.CopyFiles] +rtwlans.sys,,,2 + +[DestinationDirs] +DefaultDestDir = 11 +RTWlanS.CopyFiles = 12 +CIHVS.CopyFiles = 11 +RtlUI2.CopyFiles = 10 + +;;**************************************************************************** +;; Source Files +;;**************************************************************************** +[CIHVS.CopyFiles] +Rtlihvs.dll,,,2 + +[RegisterUIExt] +11,,RtlExtUI.dll,1 + +[RtlUI2.CopyFiles] +RtlUI2.exe,,,2 + +[SourceDisksFiles] +rtwlans.sys = 1 +Rtlihvs.dll = 1 + +[SourceDisksNames] +1=%DISKNAME%,,, + + +;******************************************************************************* +; Strings +;******************************************************************************* +[Strings] +SSID_STR = "SSID" +CHANNEL_STR = "Channel" +NETWORK_TYPE_STR = "Network Type" +LED_CONTROL_STR = "LED Control" +POWER_SAVE_STR = "Power Save Mode" +WIFI_IBSS_STR = "IBSS Default 11b Mode" +RATE_ADAPTIVE_STR = "Rate Adaptive" +QOS_STR = "QoS" +WiFiConfg_STR = "WiFiConfg" +WMM_APSD = "WMM APSD" +CCX_RM_STR = "CCX Radio Measurement" +CCX_OFF_LINE_DUR_UP_LIMIT_STR = "CCX Max Off-Line Measurement (0: unlimited)" +FORCE_PRIORITY_STR = "Forced Priority" +HW_PARA_STR = "Init from HwParaFile" +THREE_WIRE_MODE_STR = "Three Wire Programming Mode" +BOARD_TYPE_STR = "Board Type" +PROTECTION_MODE_STR = "Protection Mode" +TPC_STR = "Transmit Power Control" +TPC_POLARITY_STR = "TPC Polarity Select" +HIGH_POWER_STR = "High Power Mechanism" +INIT_GAIN_STR = "Initial Gain State" +CW_MAX_MIN_STR = "Contention Window" +PSP_XLINK_STR = "PSP XLink Mode" +DISABLE_STR = "Disable" +ENABLE_STR = "Enable" +DISABLED_STR = "Disabled" +ENABLED_STR = "Enabled" +AUTO_STR = "Auto" +AD_HOC_STR = "Ad Hoc" +INFRASTRUCTURE_STR = "Infrastructure" +AUTO_SELECT = "Auto select" +WL_MODE_STR = "Wireless Mode" +RX_REORDER_STR = "Rx Reorder" +CAM_STR = "CAM" +MAX_PSP_STR = "MAX_PSP" +Fast_PSP_STR = "Fast_PSP" +NO_AC_STR = "No AC (Disable)" +ALL_AC_STR = "ALL AC" +IEEE_802_11A_STR = "IEEE 802.11a" +IEEE_802_11B_STR = "IEEE 802.11b" +IEEE_802_11BG_STR = "IEEE 802.11b/g" +IEEE_802_11BGN_STR = "IEEE 802.11b/g/n" +IEEE_802_11AN_STR = "IEEE 802.11a/n" +IEEE_802_11ANAC_STR = "IEEE 802.11a/n/ac" +IEEE_802_11AC_STR = "IEEE 802.11 ac" +WakeOnMagicPacket = "Wake on Magic Packet" +WakeOnPattern = "Wake on Pattern Match" +MCC_STR = "Multi-Channel Concurrent" + +;******************************************************************************* +; manufacture description +;******************************************************************************* +Realtek = "Realtek Semiconductor Corp." + + +;******************************************************************************* +; Source disk name +;******************************************************************************* +DISKNAME = "Realtek Wireless LAN 802.11n SDIO Network Adapter Driver Disk" +RtlWlans.DeviceDesc = "Realtek Wireless LAN 802.11n SDIO Network Adapter" +RtlWlans.DeviceDesc.DispName = "Realtek Wireless LAN 802.11n SDIO Network Adapter" + +;******************************************************************************* +; RTL8723as Device description +;******************************************************************************* +RTL8723as.DeviceDesc = "Realtek RTL8723AS Wireless LAN 802.11n SDIO Network Adapter" +RTL8723as.DeviceDesc.DispName = "Realtek RTL8723AS Wireless LAN 802.11n SDIO Network Adapter" + + + +;******************************************************************************* +; RTL8723bs Device description +;******************************************************************************* +RTL8723bs.DeviceDesc = "Realtek RTL8723BS Wireless LAN 802.11n SDIO Network Adapter" +RTL8723bs.DeviceDesc.DispName = "Realtek RTL8723BS Wireless LAN 802.11n SDIO Network Adapter" + +;******************************************************************************* +; RTL8814as Device description +;******************************************************************************* +RTL8814as.DeviceDesc = "Realtek RTL8814AS Wireless LAN 802.11ac SDIO Network Adapter" +RTL8814as.DeviceDesc.DispName = "Realtek RTL8814AS Wireless LAN 802.11ac SDIO Network Adapter" + +;******************************************************************************* +; RTL8188ES Device description +;******************************************************************************* +RTL8188es.DeviceDesc = "Realtek RTL8189ES Wireless LAN 802.11n USB 2.0 Network Adapter" +RTL8188es.DeviceDesc.DispName = "Realtek RTL8189ES Wireless LAN 802.11n USB 2.0 Network Adapter" +;******************************************************************************* +; RTL8821as Device description +;******************************************************************************* +RTL8821as.DeviceDesc = "Realtek RTL8821AS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" +RTL8821as.DeviceDesc.DispName = "Realtek RTL8821AS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" +;******************************************************************************* +; RTL8192E Device description +;******************************************************************************* +RTL8192es.DeviceDesc = "Realtek RTL8192ES Wireless LAN 802.11n USB 2.0 Network Adapter" +RTL8192es.DeviceDesc.DispName = "Realtek RTL8192ES Wireless LAN 802.11n USB 2.0 Network Adapter" + +;******************************************************************************* +; RTL8703bs Device description +;******************************************************************************* +RTL8703bs.DeviceDesc = "Realtek RTL8703BS Wireless LAN 802.11n SDIO Network Adapter" +RTL8703bs.DeviceDesc.DispName = "Realtek RTL8703BS Wireless LAN 802.11n SDIO Network Adapter" + +;******************************************************************************* +; RTL8188Fs Device description +;******************************************************************************* +RTL8188fs.DeviceDesc = "Realtek RTL8189FTV Wireless LAN 802.11n SDIO Network Adapter" +RTL8188fs.DeviceDesc.DispName = "Realtek RTL8189FTV Wireless LAN 802.11n SDIO Network Adapter" +;******************************************************************************* +; RTL8822bs Device description +;******************************************************************************* +RTL8822bs.DeviceDesc = "Realtek RTL8822BS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" +RTL8822bs.DeviceDesc.DispName = "Realtek RTL8822BS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" + +;******************************************************************************* +; RTL8723ds Device description +;******************************************************************************* +RTL8723ds.DeviceDesc = "Realtek RTL8723DS Wireless LAN 802.11n SDIO Network Adapter" +RTL8723ds.DeviceDesc.DispName = "Realtek RTL8723DS Wireless LAN 802.11n SDIO Network Adapter" diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf index 59166e9e..bfbbcc1a 100644 --- a/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf +++ b/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf @@ -1873,7 +1873,7 @@ HKR, , EventMessageFile, 0x00020000, "%%SystemRoot%%\System32\netevent.dll" HKR, , TypesSupported , 0x00010001, 7 [CIHVS.reg] -HKR, Ndi\IHVExtensions, ExtensibilityDLL, 0, "%SystemRoot%\system32\Rtlihvs.dll" +HKR, Ndi\IHVExtensions, ExtensibilityDLL, 0, "%%SystemRoot%%\system32\Rtlihvs.dll" HKR, Ndi\IHVExtensions, UIExtensibilityCLSID, 0, "{6C2A8CCA-B2A2-4d81-A3B2-4E15F445C312}" HKR, Ndi\IHVExtensions, GroupName, 0, "Realtek CCX SDK IHV Service" HKR, Ndi\IHVExtensions, AdapterOUI, 0x00010001, 0x00e04c diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf index 5e6b284b..0b40143e 100644 --- a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf +++ b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf @@ -1,1259 +1,1259 @@ -;; netrtwlans.inf -;; -;; Realtek Wireless 802.11b/g/n SDIO Network Adapter -;; -;; Copyright (C) 2012 Realtek Semiconductor Corp. -;; -;; This release is primarily for WHQL test. -;; - -;; FOR XP/Vista/Win7/Win8 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} -Provider = %Realtek% -CatalogFile.NT = netrtwlans.cat ;; for WHQL certified -DriverVer = 11/23/2015,3008.22.1030.2015 - -[Manufacturer] -%Realtek% = Realtek,NTx86.10.0 - -[ControlFlags] -ExcludeFromSelect = * - -[Realtek.NTx86.10.0] -;; For 8723 RTK common ================================================================ - -;; For 8723 RTK common ================================================================ -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_8753 -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_B723 -;; Acer -%RTL8723bs.DeviceDesc% = ACER8723bs.ndi, SD\VID_024C&PID_0623 -;; HP -%RTL8723bs.DeviceDesc% = HP8723bs.ndi, SD\VID_024C&PID_0523 -;; ECS -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0524 -;; bestbuy -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0240 -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0241 -;; For Braswell platform -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0626 -;; Reserved -%RTL8723bs.DeviceDesc% = RSVD8723bs.ndi, SD\VID_024C&PID_0624 - -;; For 8188E RTK common ================================================================ -%RTL8188es.DeviceDesc% = RTL8188es.ndi, SD\VID_024C&PID_8188 -%RTL8188es.DeviceDesc% = RTL8188es.ndi, SD\VID_024C&PID_8179 - -;; For 8812A RTK common ================================================================ - -;; For 8814A RTK common ================================================================ -%RTL8814as.DeviceDesc% = RTL8814as.ndi, SD\VID_024C&PID_8813 - -;; For 8821A RTK common ================================================================ -%RTL8821as.DeviceDesc% = RTL8821as.ndi, SD\VID_024C&PID_8821 - -;; For 8192ES RTK common ================================================================ -%RTL8192es.DeviceDesc% = RTL8192es.ndi, SD\VID_024C&PID_818B - - -;; For 8703 RTK common ================================================================ -%RTL8703bs.DeviceDesc% = RTL8703bs.ndi, SD\VID_024C&PID_B703 - -;; For 8188 RTK common ================================================================ -%RTL8188fs.DeviceDesc% = RTL8188fs.ndi, SD\VID_024C&PID_F179 - -;; For 8822B RTK common ================================================================ -%RTL8822bs.DeviceDesc% = RTL8822bs.ndi, SD\VID_024C&PID_B822 - -;; For 8723D RTK common ================================================================ -%RTL8723ds.DeviceDesc% = RTL8723ds.ndi, SD\VID_024C&PID_D723 - -;;---------------------------------------------------------------------------- -;; Realtek 8723as default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8723as.ndi.NT] -AddReg = NDIS_64.reg, RTL8723as.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8723as.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8723as.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8723bs default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8723bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, MCC.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8723bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8723bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration -;;---------------------------------------------------------------------------- -;; Acer 8723bs installation -;;---------------------------------------------------------------------------- - - - - - -[ACER8723bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, RSSI2GridMode_2.reg, MCC.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[ACER8723bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[ACER8723bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration -;;---------------------------------------------------------------------------- -;; HP 8723bs installation -;;---------------------------------------------------------------------------- - - - - - -[HP8723bs.ndi.NT] -AddReg = NDIS_64.reg, HP8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[HP8723bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[HP8723bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; RSVD 8723bs installation -;;---------------------------------------------------------------------------- - - - - - -[RSVD8723bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, WowlanDisable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RSVD8723bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RSVD8723bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8188eu default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8188es.ndi.NT] -AddReg = NDIS_64.reg, RTLWLAN.reg, 11nWirelessMode.reg, Ndis6Set.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8188es.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8188es.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8821as default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8821as.ndi.NT] -AddReg = NDIS_64.reg, RTL8821as.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8821as.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8821as.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8814as default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8814as.ndi.NT] -AddReg = NDIS_64.reg, RTL8814as.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8814as.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8814as.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8192es default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8192es.ndi.NT] -AddReg = NDIS_64.reg, RTL8192es.common.reg, RTLWLAN.reg, 11nWirelessMode.reg, Ndis6Set.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8192es.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8192es.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8703bs default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8703bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8703bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, KFREE_COMMON.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8703bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8703bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8188fs default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8188fs.ndi.NT] -AddReg = NDIS_64.reg, RTL8703bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, CIHVS.reg, PnpPreTransOn.reg, AutoChnlSelon.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8188fs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8188fs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - -;;---------------------------------------------------------------------------- -;; Realtek 8822bs default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8822bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8822bs.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8822bs.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8822bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - - -;;---------------------------------------------------------------------------- -;; Realtek 8723ds default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8723ds.ndi.NT] -AddReg = NDIS_64.reg, RTL8723ds.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, CIHVS.reg, PnpPreTransOn.reg, AutoChnlSelon.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8723ds.ndi.NT.Services] -AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8723ds.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration - -;;---------------------------------------------------------------------------- -;; OS relative registry. -;;---------------------------------------------------------------------------- -[NDIS_64.reg] -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5,mdcwifi" -HKR, Ndi\Interfaces, LowerRange, 0, "wlan,ethernet,vwifi" -HKR, Ndi, Service, 0, "RtlWlans" -;; -;; OS relative service. -;; -[RtlWlans.Service] -DisplayName = %RtlWlans.DeviceDesc.DispName% -ServiceType = 1 ; %SERVICE_KERNEL_DRIVER% -StartType = 3 ; %SERRVICE_DEMAND_START% -ErrorControl = 1 ; %SERRVICE_ERROR_NORMAL% -ServiceBinary = %12%\rtwlans.sys -LoadOrderGroup = NDIS - -;; -;; OS relative event log. -;; -[RtlWlans.EventLog] -AddReg = RtlWlans.AddEventLog.reg - -[RtlWlans.AddEventLog.reg] -HKR, , EventMessageFile, 0x00020000, "%%SystemRoot%%\System32\netevent.dll" -HKR, , TypesSupported , 0x00010001, 7 - -[CIHVS.reg] -HKR, Ndi\IHVExtensions, ExtensibilityDLL, 0, "%SystemRoot%\system32\Rtlihvs.dll" -HKR, Ndi\IHVExtensions, UIExtensibilityCLSID, 0, "{6C2A8CCA-B2A2-4d81-A3B2-4E15F445C312}" -HKR, Ndi\IHVExtensions, GroupName, 0, "Realtek CCX SDK IHV Service" -HKR, Ndi\IHVExtensions, AdapterOUI, 0x00010001, 0x00e04c - -;******************************************************************************* -; WAPI section -;******************************************************************************* -[wapi.reg] -HKR,defaults,WapiSupport,0,"1" -HKR,,WapiSupport,0,"1" - -;******************************************************************************* -; RTL8723as common paramters -;******************************************************************************* -[RTL8723as.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - - -;******************************************************************************* -; RTL8723bs common paramters -;******************************************************************************* -[RTL8723bs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,RomDLFwEnable,0,"1" -HKR,,RomDLFwEnable,0,"1" - -HKR,defaults,bFwCtrlPwrOff,0,"1" -HKR,,bFwCtrlPwrOff,0,"1" - -;;HKR,defaults,EnableAdaptivity,0,"0" -;;HKR,,EnableAdaptivity,0,"0" - -HKR,defaults,EnableCarrierSense,0,"0" -HKR,,EnableCarrierSense,0,"0" - -; AOAC reconnect -HKR,defaults,PnpKeepLink,0,"1" -HKR,,PnpKeepLink,0,"1" - -;; $$ End of RTL8723bs.common.reg - -[HP8723bs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,RomDLFwEnable,0,"1" -HKR,,RomDLFwEnable,0,"1" - -HKR,defaults,bFwCtrlPwrOff,0,"1" -HKR,,bFwCtrlPwrOff,0,"1" - -; Enable Adaptivity -;;HKR,defaults,EnableAdaptivity,0,"1" -;;HKR,,EnableAdaptivity,0,"1" - -HKR,defaults,EnableCarrierSense,0,"0" -HKR,,EnableCarrierSense,0,"0" - -; Enable Customeized PowerLimit Table -HKR,,EnableTxPowerLimit,0,"1" -HKR,,DecryptCustomFile,,"1" -HKR,,PwrLimitFile,0,"TXPWR_LMT_IEC0921_Enc.txt" - -; Regulation WorldWide -HKR,defaults,PwrTblSel,0,"4" -HKR,,PwrTblSel,0,"4" - -; AOAC reconnect -HKR,defaults,PnpKeepLink,0,"1" -HKR,,PnpKeepLink,0,"1" - -;; $$ End of HP8723bs.common.reg - -;******************************************************************************* -; RTL8703bs common paramters -;******************************************************************************* -[RTL8703bs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,RomDLFwEnable,0,"1" -HKR,,RomDLFwEnable,0,"1" - -HKR,defaults,bFwCtrlPwrOff,0,"1" -HKR,,bFwCtrlPwrOff,0,"1" - - -;******************************************************************************* -; RTL8188Fs common paramters -;******************************************************************************* -[RTL8188fs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,RomDLFwEnable,0,"0" -HKR,,RomDLFwEnable,0,"0" - -HKR,defaults,bFwCtrlPwrOff,0,"1" -HKR,,bFwCtrlPwrOff,0,"1" - - -;******************************************************************************* -; RTL8821as common paramters -;******************************************************************************* -[RTL8821as.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -HKR,,StbcCap,0,"17" -HKR,,LdpcCap,0,"34" -HKR,,BeamformCap,0,"34" - - -;******************************************************************************* -; RTL8814as common paramters -;******************************************************************************* -[RTL8814as.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -;; Add for 8814AS, based on 8821AS's modification -HKR,,StbcCap,0,"17" -HKR,,LdpcCap,0,"34" -HKR,,BeamformCap,0,"34" - - -;******************************************************************************* -; RTL8192es common paramters -;******************************************************************************* -[RTL8192es.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -;******************************************************************************* -; RTL8822bs common paramters -;******************************************************************************* -[RTL8822bs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -HKR,,StbcCap,0,"17" -HKR,,LdpcCap,0,"34" -HKR,,BeamformCap,0,"34" -HKR,,ValidRFPath,0,"51" -HKR,,PreInitMem,0,"1" - - -;******************************************************************************* -; RTL8723ds common paramters -;******************************************************************************* -[RTL8723ds.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -HKR,defaults,LdpcCap,0,"0" - - -;;---------------------------------------------------------------------------- -;; Realtek WLAN NIC parameters -;;---------------------------------------------------------------------------- -[RTLWLAN.reg] - -; Enable Adaptivity -HKR,,EnableAdaptivity,0,"1" - -HKR,defaults,Channel,0,"1" -HKR,,Channel,0,"1" - -;; Antenna Diversity Type -HKR,defaults,AntennaDivType,0,"0" -HKR,,AntennaDivType,0,"0" - -HKR,defaults,NetworkType,0,"1" -HKR,,NetworkType,0,"1" - -HKR,defaults,StaUapsd,0,"0" -HKR,,StaUapsd,0,"0" - -; For B/G mode and B/G/N mode switch, we will use different wireless mode registry in later section -HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% -HKR,Ndi\params\WirelessMode, type, 0, "enum" -HKR,Ndi\params\WirelessMode, default, 0, "8" -HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% -HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% -HKR,Ndi\params\WirelessMode\enum, "8", 0, %IEEE_802_11BGN_STR% -HKR,defaults,WirelessMode, 0, "8" -HKR,,WirelessMode, 0, "8" - - -;; For WiFi test, 1: WiFi Config and 0: Performance Config -HKR,defaults,WiFiConfg,0,"0" -HKR,,WiFiConfg,0,"0" - -HKR,defaults,RxReorder,0,"1" -HKR,,RxReorder,0,"1" - -HKR,,DefaultKeyID,,"0" -HKR,,DefaultKey0,,"" -HKR,,DefaultKey1,,"" -HKR,,DefaultKey2,,"" -HKR,,DefaultKey3,,"" - -;Inactive Power Save -HKR,defaults,InactivePs,0,"0" -HKR,,InactivePs,0,"0" - -;Leisure Power Save -HKR,defaults,bLeisurePs,0,"2" -HKR,,bLeisurePs,0,"2" - -;Fw Control LPS -HKR,defaults,bFwCtrlLPS,0,"1" -HKR,,bFwCtrlLPS,0,"1" - -;; LPS Interval -;HKR,defaults,LPSIntvl,0,"3" -HKR,,LPSIntvl,0,"3" - -HKR,,WEPinNmode,0,"0" - -HKR,defaults,RxSC,0,"0" -HKR,,RxSC,0,"0" - -HKR,defaults,TxSC,0,"0" -HKR,,TxSC,0,"0" - -HKR,defaults,NblRacingWA,0,"1" -HKR,,NblRacingWA,0,"1" - -HKR,defaults,SuspendTimerInLowPwr,0,"1" -HKR,,SuspendTimerInLowPwr,0,"1" - -;; Rx reorder pending time -HKR,,RxReorder_PendTime,0,"100" - -;Antenna Diversity -HKR,Ndi\params\AntDiv, ParamDesc, 0, "Antenna Diversity" -HKR,Ndi\params\AntDiv, default, 0, "0" -HKR,Ndi\params\AntDiv, type, 0, "enum" -HKR,Ndi\params\AntDiv\enum, "0", 0, %DISABLED_STR% -HKR,Ndi\params\AntDiv\enum, "1", 0, %ENABLED_STR% - -HKLM, SYSTEM\CurrentControlSet\Services\RtlWlans\Parameters, "BtAntennaInHw", 0x00010001,2 - -[Ndis5Set.reg] -HKR,Ndi\params\PSPXlinkMode, ParamDesc, 0, %PSP_XLINK_STR% -HKR,Ndi\params\PSPXlinkMode, type, 0, "enum" -HKR,Ndi\params\PSPXlinkMode, default, 0, "0" -HKR,Ndi\params\PSPXlinkMode\enum, "0", 0, %DISABLE_STR% -HKR,Ndi\params\PSPXlinkMode\enum, "1", 0, %ENABLE_STR% -HKR,defaults,PSPXlinkMode,0,"0" -HKR,,PSPXlinkMode,0,"0" - -;Inactive Power Save -HKR,defaults,InactivePs,0,"0" -HKR,,InactivePs,0,"0" - - -[Ndis6Set.reg] -;Inactive Power Save -HKR,defaults,InactivePs,0,"2" -HKR,,InactivePs,0,"2" - - -;;---------------------------------------------------------------------------- -;; Wireless mode option parameters -;;---------------------------------------------------------------------------- -[11nWirelessMode.reg] -HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% -HKR,Ndi\params\WirelessMode, type, 0, "enum" -HKR,Ndi\params\WirelessMode, default, 0, "8" -HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% -HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% -HKR,Ndi\params\WirelessMode\enum, "8", 0, %IEEE_802_11BGN_STR% -HKR,defaults,WirelessMode, 0, "8" -HKR,,WirelessMode, 0, "8" - -;; 40MHz Support in 11n -HKR,Ndi\params\BWSetting, ParamDesc, 0, "Bandwidth" -HKR,Ndi\params\BWSetting, type, 0, "enum" -HKR,Ndi\params\BWSetting, default, 0, "1" -HKR,Ndi\params\BWSetting\enum, "0", 0, "20MHz Only" -HKR,Ndi\params\BWSetting\enum, "1", 0, "20_40MHz" -HKR,defaults,BWSetting,0,"1" -HKR,,BWSetting,0,"1" -HKR,,BWSetting,,"1" - -HKR,,Channel,0,"10" - -[11gWirelessMode.reg] -HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% -HKR,Ndi\params\WirelessMode, type, 0, "enum" -HKR,Ndi\params\WirelessMode, default, 0, "8" -HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% -HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% -HKR,defaults,WirelessMode, 0, "4" -HKR,,WirelessMode, 0, "4" - -HKR,,BWSetting,0,"0" - -HKR,,Channel,0,"10" - -[11acWirelessMode.reg] -HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% -HKR,Ndi\params\WirelessMode, type, 0, "enum" -HKR,Ndi\params\WirelessMode, default, 0, "8" -HKR,Ndi\params\WirelessMode\enum, "8", 0, %AUTO_STR% -HKR,Ndi\params\WirelessMode\enum, "1", 0, %IEEE_802_11A_STR% -HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% -HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% -HKR,Ndi\params\WirelessMode\enum, "16", 0, %IEEE_802_11BGN_STR% -HKR,Ndi\params\WirelessMode\enum, "32", 0, %IEEE_802_11AN_STR% -HKR,Ndi\params\WirelessMode\enum, "64", 0, %IEEE_802_11ANAC_STR% -HKR,defaults,WirelessMode, 0, "8" -HKR,,WirelessMode, 0, "8" - -HKR,,Channel,0,"36" - -;; RF Type -HKR,,RFType,0,"15" - - -HKR,defaults,BWSetting,0,"2" -HKR,,BWSetting,0,"2" - -;;---------------------------------------------------------------------------- -;; LPS 32k Control Parameters -;;---------------------------------------------------------------------------- -[32kEnable.reg] -HKR,,bLowPowerEnable,0,"1" -[32kDisable.reg] -HKR,,bLowPowerEnable,0,"0" - -;------------------------------------------------------------------------------- -; PnP pre-transition handling -;------------------------------------------------------------------------------- -[PnpPreTransOn.reg] -HKR,,PreTransPnP,0,"1" -[PnpPreTransOff.reg] -HKR,,PreTransPnP,0,"0" - -;;---------------------------------------------------------------------------- -;; WOWLAN Control Parameters -;;---------------------------------------------------------------------------- -[WowlanAllEnable.reg] -HKR,,WoWLANLPSLevel,0,"2" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"1" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "1" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"1" - -[WowlanDisable.reg] -HKR,,WoWLANLPSLevel,0,"0" -HKR,,ARPOffloadEnable,0,"0" -HKR,,GTKOffloadEnable,0,"0" - -[WowlanAllEnableNoLPS.reg] -HKR,,WoWLANLPSLevel,0,"0" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"1" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "1" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"1" - -[WowlanEnableNoPatternMatch.reg] -HKR,,WoWLANLPSLevel,0,"2" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"1" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "0" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"0" - -[WowlanEnableNoLPSNoPatternMatch.reg] -HKR,,WoWLANLPSLevel,0,"0" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"1" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "0" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"0" - -[ConnectedStandbyEnable.reg] -HKR,,WoWLANLPSLevel,0,"2" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" -HKR,,D2ListenIntvl,0,"4" -HKR,,NSOffloadEnable,0,"1" -HKR,,NLOEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "0" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"0" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "1" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"1" - -;; Packet coalescing should be enabled in WHCK test -HKR,defaults,*PacketCoalescing,0,"0" -HKR,,*PacketCoalescing,0,"0" - -;------------------------------------------------------------------------------- -; Auto Channel Selection -;------------------------------------------------------------------------------- -[AutoChnlSelon.reg] -HKR,,AutoChnlSel,0,"1" -[AutoChnlSeloff.reg] -HKR,,AutoChnlSel,0,"0" - -;;---------------------------------------------------------------------------- -;; RSSI to Grid Mode Parameters -;;---------------------------------------------------------------------------- -[RSSI2GridRealMode.reg] -HKR,,RSSI2GridMode,0,"1" -[RSSI2GridMode_2.reg] -HKR,,RSSI2GridMode,0,"2" -[RSSI2GridMode_4.reg] -HKR,,RSSI2GridMode,0,"4" - -;;---------------------------------------------------------------------------- -;; KFREE parameters -;;---------------------------------------------------------------------------- -[KFREE_COMMON.reg] -HKR,,RfKFreeEnable,0,"0" - -;******************************************************************************* -; Customer reg section -;******************************************************************************* -[ScanType.reg] -HKR,defaults,PassiveScan, 0, "0" -HKR,,PassiveScan, 0, "0" - -;******************************************************************************* -; Multi-Channel Concurrent section -;******************************************************************************* -[MCC.reg] -HKR,Ndi\params\MultiChannelFcsMode, ParamDesc, 0, %MCC_STR% -HKR,Ndi\params\MultiChannelFcsMode, type, 0, "enum" -HKR,Ndi\params\MultiChannelFcsMode, default, 0, "0" -HKR,Ndi\params\MultiChannelFcsMode\enum, "0", 0, %DISABLED_STR% -HKR,Ndi\params\MultiChannelFcsMode\enum, "4", 0, %ENABLED_STR% -HKR,defaults,MultiChannelFcsMode, 0, "0" -HKR,,MultiChannelFcsMode, 0, "0" - -;******************************************************************************* -; Destination Directory -;******************************************************************************* -[RTWlanS.CopyFiles] -rtwlans.sys,,,2 - -[DestinationDirs] -DefaultDestDir = 11 -RTWlanS.CopyFiles = 12 -CIHVS.CopyFiles = 11 -RtlUI2.CopyFiles = 10 - -;;**************************************************************************** -;; Source Files -;;**************************************************************************** -[CIHVS.CopyFiles] -Rtlihvs.dll,,,2 - -[RegisterUIExt] -11,,RtlExtUI.dll,1 - -[RtlUI2.CopyFiles] -RtlUI2.exe,,,2 - -[SourceDisksFiles] -rtwlans.sys = 1 -Rtlihvs.dll = 1 - -[SourceDisksNames] -1=%DISKNAME%,,, - - -;******************************************************************************* -; Strings -;******************************************************************************* -[Strings] -SSID_STR = "SSID" -CHANNEL_STR = "Channel" -NETWORK_TYPE_STR = "Network Type" -LED_CONTROL_STR = "LED Control" -POWER_SAVE_STR = "Power Save Mode" -WIFI_IBSS_STR = "IBSS Default 11b Mode" -RATE_ADAPTIVE_STR = "Rate Adaptive" -QOS_STR = "QoS" -WiFiConfg_STR = "WiFiConfg" -WMM_APSD = "WMM APSD" -CCX_RM_STR = "CCX Radio Measurement" -CCX_OFF_LINE_DUR_UP_LIMIT_STR = "CCX Max Off-Line Measurement (0: unlimited)" -FORCE_PRIORITY_STR = "Forced Priority" -HW_PARA_STR = "Init from HwParaFile" -THREE_WIRE_MODE_STR = "Three Wire Programming Mode" -BOARD_TYPE_STR = "Board Type" -PROTECTION_MODE_STR = "Protection Mode" -TPC_STR = "Transmit Power Control" -TPC_POLARITY_STR = "TPC Polarity Select" -HIGH_POWER_STR = "High Power Mechanism" -INIT_GAIN_STR = "Initial Gain State" -CW_MAX_MIN_STR = "Contention Window" -PSP_XLINK_STR = "PSP XLink Mode" -DISABLE_STR = "Disable" -ENABLE_STR = "Enable" -DISABLED_STR = "Disabled" -ENABLED_STR = "Enabled" -AUTO_STR = "Auto" -AD_HOC_STR = "Ad Hoc" -INFRASTRUCTURE_STR = "Infrastructure" -AUTO_SELECT = "Auto select" -WL_MODE_STR = "Wireless Mode" -RX_REORDER_STR = "Rx Reorder" -CAM_STR = "CAM" -MAX_PSP_STR = "MAX_PSP" -Fast_PSP_STR = "Fast_PSP" -NO_AC_STR = "No AC (Disable)" -ALL_AC_STR = "ALL AC" -IEEE_802_11A_STR = "IEEE 802.11a" -IEEE_802_11B_STR = "IEEE 802.11b" -IEEE_802_11BG_STR = "IEEE 802.11b/g" -IEEE_802_11BGN_STR = "IEEE 802.11b/g/n" -IEEE_802_11AN_STR = "IEEE 802.11a/n" -IEEE_802_11ANAC_STR = "IEEE 802.11a/n/ac" -IEEE_802_11AC_STR = "IEEE 802.11 ac" -WakeOnMagicPacket = "Wake on Magic Packet" -WakeOnPattern = "Wake on Pattern Match" -MCC_STR = "Multi-Channel Concurrent" - -;******************************************************************************* -; manufacture description -;******************************************************************************* -Realtek = "Realtek Semiconductor Corp." - - -;******************************************************************************* -; Source disk name -;******************************************************************************* -DISKNAME = "Realtek Wireless LAN 802.11n SDIO Network Adapter Driver Disk" -RtlWlans.DeviceDesc = "Realtek Wireless LAN 802.11n SDIO Network Adapter" -RtlWlans.DeviceDesc.DispName = "Realtek Wireless LAN 802.11n SDIO Network Adapter" - -;******************************************************************************* -; RTL8723as Device description -;******************************************************************************* -RTL8723as.DeviceDesc = "Realtek RTL8723AS Wireless LAN 802.11n SDIO Network Adapter" -RTL8723as.DeviceDesc.DispName = "Realtek RTL8723AS Wireless LAN 802.11n SDIO Network Adapter" - - - -;******************************************************************************* -; RTL8723bs Device description -;******************************************************************************* -RTL8723bs.DeviceDesc = "Realtek RTL8723BS Wireless LAN 802.11n SDIO Network Adapter" -RTL8723bs.DeviceDesc.DispName = "Realtek RTL8723BS Wireless LAN 802.11n SDIO Network Adapter" - -;******************************************************************************* -; RTL8814as Device description -;******************************************************************************* -RTL8814as.DeviceDesc = "Realtek RTL8814AS Wireless LAN 802.11ac SDIO Network Adapter" -RTL8814as.DeviceDesc.DispName = "Realtek RTL8814AS Wireless LAN 802.11ac SDIO Network Adapter" - -;******************************************************************************* -; RTL8188ES Device description -;******************************************************************************* -RTL8188es.DeviceDesc = "Realtek RTL8189ES Wireless LAN 802.11n USB 2.0 Network Adapter" -RTL8188es.DeviceDesc.DispName = "Realtek RTL8189ES Wireless LAN 802.11n USB 2.0 Network Adapter" -;******************************************************************************* -; RTL8821as Device description -;******************************************************************************* -RTL8821as.DeviceDesc = "Realtek RTL8821AS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" -RTL8821as.DeviceDesc.DispName = "Realtek RTL8821AS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" -;******************************************************************************* -; RTL8192E Device description -;******************************************************************************* -RTL8192es.DeviceDesc = "Realtek RTL8192ES Wireless LAN 802.11n USB 2.0 Network Adapter" -RTL8192es.DeviceDesc.DispName = "Realtek RTL8192ES Wireless LAN 802.11n USB 2.0 Network Adapter" - -;******************************************************************************* -; RTL8703bs Device description -;******************************************************************************* -RTL8703bs.DeviceDesc = "Realtek RTL8703BS Wireless LAN 802.11n SDIO Network Adapter" -RTL8703bs.DeviceDesc.DispName = "Realtek RTL8703BS Wireless LAN 802.11n SDIO Network Adapter" - -;******************************************************************************* -; RTL8188Fs Device description -;******************************************************************************* -RTL8188fs.DeviceDesc = "Realtek RTL8189FTV Wireless LAN 802.11n SDIO Network Adapter" -RTL8188fs.DeviceDesc.DispName = "Realtek RTL8189FTV Wireless LAN 802.11n SDIO Network Adapter" -;******************************************************************************* -; RTL8822bs Device description -;******************************************************************************* -RTL8822bs.DeviceDesc = "Realtek RTL8822BS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" -RTL8822bs.DeviceDesc.DispName = "Realtek RTL8822BS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" - -;******************************************************************************* -; RTL8723ds Device description -;******************************************************************************* -RTL8723ds.DeviceDesc = "Realtek RTL8723DS Wireless LAN 802.11n SDIO Network Adapter" -RTL8723ds.DeviceDesc.DispName = "Realtek RTL8723DS Wireless LAN 802.11n SDIO Network Adapter" +;; netrtwlans.inf +;; +;; Realtek Wireless 802.11b/g/n SDIO Network Adapter +;; +;; Copyright (C) 2012 Realtek Semiconductor Corp. +;; +;; This release is primarily for WHQL test. +;; + +;; FOR XP/Vista/Win7/Win8 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} +Provider = %Realtek% +CatalogFile.NT = netrtwlans.cat ;; for WHQL certified +DriverVer = 11/23/2015,3008.22.1030.2015 + +[Manufacturer] +%Realtek% = Realtek,NTx86.10.0 + +[ControlFlags] +ExcludeFromSelect = * + +[Realtek.NTx86.10.0] +;; For 8723 RTK common ================================================================ + +;; For 8723 RTK common ================================================================ +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_8753 +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_B723 +;; Acer +%RTL8723bs.DeviceDesc% = ACER8723bs.ndi, SD\VID_024C&PID_0623 +;; HP +%RTL8723bs.DeviceDesc% = HP8723bs.ndi, SD\VID_024C&PID_0523 +;; ECS +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0524 +;; bestbuy +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0240 +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0241 +;; For Braswell platform +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0626 +;; Reserved +%RTL8723bs.DeviceDesc% = RSVD8723bs.ndi, SD\VID_024C&PID_0624 + +;; For 8188E RTK common ================================================================ +%RTL8188es.DeviceDesc% = RTL8188es.ndi, SD\VID_024C&PID_8188 +%RTL8188es.DeviceDesc% = RTL8188es.ndi, SD\VID_024C&PID_8179 + +;; For 8812A RTK common ================================================================ + +;; For 8814A RTK common ================================================================ +%RTL8814as.DeviceDesc% = RTL8814as.ndi, SD\VID_024C&PID_8813 + +;; For 8821A RTK common ================================================================ +%RTL8821as.DeviceDesc% = RTL8821as.ndi, SD\VID_024C&PID_8821 + +;; For 8192ES RTK common ================================================================ +%RTL8192es.DeviceDesc% = RTL8192es.ndi, SD\VID_024C&PID_818B + + +;; For 8703 RTK common ================================================================ +%RTL8703bs.DeviceDesc% = RTL8703bs.ndi, SD\VID_024C&PID_B703 + +;; For 8188 RTK common ================================================================ +%RTL8188fs.DeviceDesc% = RTL8188fs.ndi, SD\VID_024C&PID_F179 + +;; For 8822B RTK common ================================================================ +%RTL8822bs.DeviceDesc% = RTL8822bs.ndi, SD\VID_024C&PID_B822 + +;; For 8723D RTK common ================================================================ +%RTL8723ds.DeviceDesc% = RTL8723ds.ndi, SD\VID_024C&PID_D723 + +;;---------------------------------------------------------------------------- +;; Realtek 8723as default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8723as.ndi.NT] +AddReg = NDIS_64.reg, RTL8723as.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8723as.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8723as.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8723bs default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8723bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, MCC.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8723bs.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8723bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration +;;---------------------------------------------------------------------------- +;; Acer 8723bs installation +;;---------------------------------------------------------------------------- + + + + + +[ACER8723bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, RSSI2GridMode_2.reg, MCC.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[ACER8723bs.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[ACER8723bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration +;;---------------------------------------------------------------------------- +;; HP 8723bs installation +;;---------------------------------------------------------------------------- + + + + + +[HP8723bs.ndi.NT] +AddReg = NDIS_64.reg, HP8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[HP8723bs.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[HP8723bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; RSVD 8723bs installation +;;---------------------------------------------------------------------------- + + + + + +[RSVD8723bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, WowlanDisable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RSVD8723bs.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RSVD8723bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8188eu default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8188es.ndi.NT] +AddReg = NDIS_64.reg, RTLWLAN.reg, 11nWirelessMode.reg, Ndis6Set.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8188es.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8188es.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8821as default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8821as.ndi.NT] +AddReg = NDIS_64.reg, RTL8821as.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8821as.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8821as.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8814as default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8814as.ndi.NT] +AddReg = NDIS_64.reg, RTL8814as.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8814as.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8814as.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8192es default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8192es.ndi.NT] +AddReg = NDIS_64.reg, RTL8192es.common.reg, RTLWLAN.reg, 11nWirelessMode.reg, Ndis6Set.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8192es.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8192es.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8703bs default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8703bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8703bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, KFREE_COMMON.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8703bs.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8703bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8188fs default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8188fs.ndi.NT] +AddReg = NDIS_64.reg, RTL8703bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, CIHVS.reg, PnpPreTransOn.reg, AutoChnlSelon.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8188fs.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8188fs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + +;;---------------------------------------------------------------------------- +;; Realtek 8822bs default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8822bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8822bs.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8822bs.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8822bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + + +;;---------------------------------------------------------------------------- +;; Realtek 8723ds default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8723ds.ndi.NT] +AddReg = NDIS_64.reg, RTL8723ds.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, CIHVS.reg, PnpPreTransOn.reg, AutoChnlSelon.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8723ds.ndi.NT.Services] +AddService = RtlWlans, 2, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8723ds.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration + +;;---------------------------------------------------------------------------- +;; OS relative registry. +;;---------------------------------------------------------------------------- +[NDIS_64.reg] +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5,mdcwifi" +HKR, Ndi\Interfaces, LowerRange, 0, "wlan,ethernet,vwifi" +HKR, Ndi, Service, 0, "RtlWlans" +;; +;; OS relative service. +;; +[RtlWlans.Service] +DisplayName = %RtlWlans.DeviceDesc.DispName% +ServiceType = 1 ; %SERVICE_KERNEL_DRIVER% +StartType = 3 ; %SERRVICE_DEMAND_START% +ErrorControl = 1 ; %SERRVICE_ERROR_NORMAL% +ServiceBinary = %12%\rtwlans.sys +LoadOrderGroup = NDIS + +;; +;; OS relative event log. +;; +[RtlWlans.EventLog] +AddReg = RtlWlans.AddEventLog.reg + +[RtlWlans.AddEventLog.reg] +HKR, , EventMessageFile, 0x00020000, "%%SystemRoot%%\System32\netevent.dll" +HKR, , TypesSupported , 0x00010001, 7 + +[CIHVS.reg] +HKR, Ndi\IHVExtensions, ExtensibilityDLL, 0, "%%SystemRoot%%\system32\Rtlihvs.dll" +HKR, Ndi\IHVExtensions, UIExtensibilityCLSID, 0, "{6C2A8CCA-B2A2-4d81-A3B2-4E15F445C312}" +HKR, Ndi\IHVExtensions, GroupName, 0, "Realtek CCX SDK IHV Service" +HKR, Ndi\IHVExtensions, AdapterOUI, 0x00010001, 0x00e04c + +;******************************************************************************* +; WAPI section +;******************************************************************************* +[wapi.reg] +HKR,defaults,WapiSupport,0,"1" +HKR,,WapiSupport,0,"1" + +;******************************************************************************* +; RTL8723as common paramters +;******************************************************************************* +[RTL8723as.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + + +;******************************************************************************* +; RTL8723bs common paramters +;******************************************************************************* +[RTL8723bs.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,RomDLFwEnable,0,"1" +HKR,,RomDLFwEnable,0,"1" + +HKR,defaults,bFwCtrlPwrOff,0,"1" +HKR,,bFwCtrlPwrOff,0,"1" + +;;HKR,defaults,EnableAdaptivity,0,"0" +;;HKR,,EnableAdaptivity,0,"0" + +HKR,defaults,EnableCarrierSense,0,"0" +HKR,,EnableCarrierSense,0,"0" + +; AOAC reconnect +HKR,defaults,PnpKeepLink,0,"1" +HKR,,PnpKeepLink,0,"1" + +;; $$ End of RTL8723bs.common.reg + +[HP8723bs.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,RomDLFwEnable,0,"1" +HKR,,RomDLFwEnable,0,"1" + +HKR,defaults,bFwCtrlPwrOff,0,"1" +HKR,,bFwCtrlPwrOff,0,"1" + +; Enable Adaptivity +;;HKR,defaults,EnableAdaptivity,0,"1" +;;HKR,,EnableAdaptivity,0,"1" + +HKR,defaults,EnableCarrierSense,0,"0" +HKR,,EnableCarrierSense,0,"0" + +; Enable Customeized PowerLimit Table +HKR,,EnableTxPowerLimit,0,"1" +HKR,,DecryptCustomFile,,"1" +HKR,,PwrLimitFile,0,"TXPWR_LMT_IEC0921_Enc.txt" + +; Regulation WorldWide +HKR,defaults,PwrTblSel,0,"4" +HKR,,PwrTblSel,0,"4" + +; AOAC reconnect +HKR,defaults,PnpKeepLink,0,"1" +HKR,,PnpKeepLink,0,"1" + +;; $$ End of HP8723bs.common.reg + +;******************************************************************************* +; RTL8703bs common paramters +;******************************************************************************* +[RTL8703bs.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,RomDLFwEnable,0,"1" +HKR,,RomDLFwEnable,0,"1" + +HKR,defaults,bFwCtrlPwrOff,0,"1" +HKR,,bFwCtrlPwrOff,0,"1" + + +;******************************************************************************* +; RTL8188Fs common paramters +;******************************************************************************* +[RTL8188fs.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,RomDLFwEnable,0,"0" +HKR,,RomDLFwEnable,0,"0" + +HKR,defaults,bFwCtrlPwrOff,0,"1" +HKR,,bFwCtrlPwrOff,0,"1" + + +;******************************************************************************* +; RTL8821as common paramters +;******************************************************************************* +[RTL8821as.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +HKR,,StbcCap,0,"17" +HKR,,LdpcCap,0,"34" +HKR,,BeamformCap,0,"34" + + +;******************************************************************************* +; RTL8814as common paramters +;******************************************************************************* +[RTL8814as.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +;; Add for 8814AS, based on 8821AS's modification +HKR,,StbcCap,0,"17" +HKR,,LdpcCap,0,"34" +HKR,,BeamformCap,0,"34" + + +;******************************************************************************* +; RTL8192es common paramters +;******************************************************************************* +[RTL8192es.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +;******************************************************************************* +; RTL8822bs common paramters +;******************************************************************************* +[RTL8822bs.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +HKR,,StbcCap,0,"17" +HKR,,LdpcCap,0,"34" +HKR,,BeamformCap,0,"34" +HKR,,ValidRFPath,0,"51" +HKR,,PreInitMem,0,"1" + + +;******************************************************************************* +; RTL8723ds common paramters +;******************************************************************************* +[RTL8723ds.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +HKR,defaults,LdpcCap,0,"0" + + +;;---------------------------------------------------------------------------- +;; Realtek WLAN NIC parameters +;;---------------------------------------------------------------------------- +[RTLWLAN.reg] + +; Enable Adaptivity +HKR,,EnableAdaptivity,0,"1" + +HKR,defaults,Channel,0,"1" +HKR,,Channel,0,"1" + +;; Antenna Diversity Type +HKR,defaults,AntennaDivType,0,"0" +HKR,,AntennaDivType,0,"0" + +HKR,defaults,NetworkType,0,"1" +HKR,,NetworkType,0,"1" + +HKR,defaults,StaUapsd,0,"0" +HKR,,StaUapsd,0,"0" + +; For B/G mode and B/G/N mode switch, we will use different wireless mode registry in later section +HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% +HKR,Ndi\params\WirelessMode, type, 0, "enum" +HKR,Ndi\params\WirelessMode, default, 0, "8" +HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% +HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% +HKR,Ndi\params\WirelessMode\enum, "8", 0, %IEEE_802_11BGN_STR% +HKR,defaults,WirelessMode, 0, "8" +HKR,,WirelessMode, 0, "8" + + +;; For WiFi test, 1: WiFi Config and 0: Performance Config +HKR,defaults,WiFiConfg,0,"0" +HKR,,WiFiConfg,0,"0" + +HKR,defaults,RxReorder,0,"1" +HKR,,RxReorder,0,"1" + +HKR,,DefaultKeyID,,"0" +HKR,,DefaultKey0,,"" +HKR,,DefaultKey1,,"" +HKR,,DefaultKey2,,"" +HKR,,DefaultKey3,,"" + +;Inactive Power Save +HKR,defaults,InactivePs,0,"0" +HKR,,InactivePs,0,"0" + +;Leisure Power Save +HKR,defaults,bLeisurePs,0,"2" +HKR,,bLeisurePs,0,"2" + +;Fw Control LPS +HKR,defaults,bFwCtrlLPS,0,"1" +HKR,,bFwCtrlLPS,0,"1" + +;; LPS Interval +;HKR,defaults,LPSIntvl,0,"3" +HKR,,LPSIntvl,0,"3" + +HKR,,WEPinNmode,0,"0" + +HKR,defaults,RxSC,0,"0" +HKR,,RxSC,0,"0" + +HKR,defaults,TxSC,0,"0" +HKR,,TxSC,0,"0" + +HKR,defaults,NblRacingWA,0,"1" +HKR,,NblRacingWA,0,"1" + +HKR,defaults,SuspendTimerInLowPwr,0,"1" +HKR,,SuspendTimerInLowPwr,0,"1" + +;; Rx reorder pending time +HKR,,RxReorder_PendTime,0,"100" + +;Antenna Diversity +HKR,Ndi\params\AntDiv, ParamDesc, 0, "Antenna Diversity" +HKR,Ndi\params\AntDiv, default, 0, "0" +HKR,Ndi\params\AntDiv, type, 0, "enum" +HKR,Ndi\params\AntDiv\enum, "0", 0, %DISABLED_STR% +HKR,Ndi\params\AntDiv\enum, "1", 0, %ENABLED_STR% + +HKLM, SYSTEM\CurrentControlSet\Services\RtlWlans\Parameters, "BtAntennaInHw", 0x00010001,2 + +[Ndis5Set.reg] +HKR,Ndi\params\PSPXlinkMode, ParamDesc, 0, %PSP_XLINK_STR% +HKR,Ndi\params\PSPXlinkMode, type, 0, "enum" +HKR,Ndi\params\PSPXlinkMode, default, 0, "0" +HKR,Ndi\params\PSPXlinkMode\enum, "0", 0, %DISABLE_STR% +HKR,Ndi\params\PSPXlinkMode\enum, "1", 0, %ENABLE_STR% +HKR,defaults,PSPXlinkMode,0,"0" +HKR,,PSPXlinkMode,0,"0" + +;Inactive Power Save +HKR,defaults,InactivePs,0,"0" +HKR,,InactivePs,0,"0" + + +[Ndis6Set.reg] +;Inactive Power Save +HKR,defaults,InactivePs,0,"2" +HKR,,InactivePs,0,"2" + + +;;---------------------------------------------------------------------------- +;; Wireless mode option parameters +;;---------------------------------------------------------------------------- +[11nWirelessMode.reg] +HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% +HKR,Ndi\params\WirelessMode, type, 0, "enum" +HKR,Ndi\params\WirelessMode, default, 0, "8" +HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% +HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% +HKR,Ndi\params\WirelessMode\enum, "8", 0, %IEEE_802_11BGN_STR% +HKR,defaults,WirelessMode, 0, "8" +HKR,,WirelessMode, 0, "8" + +;; 40MHz Support in 11n +HKR,Ndi\params\BWSetting, ParamDesc, 0, "Bandwidth" +HKR,Ndi\params\BWSetting, type, 0, "enum" +HKR,Ndi\params\BWSetting, default, 0, "1" +HKR,Ndi\params\BWSetting\enum, "0", 0, "20MHz Only" +HKR,Ndi\params\BWSetting\enum, "1", 0, "20_40MHz" +HKR,defaults,BWSetting,0,"1" +HKR,,BWSetting,0,"1" +HKR,,BWSetting,,"1" + +HKR,,Channel,0,"10" + +[11gWirelessMode.reg] +HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% +HKR,Ndi\params\WirelessMode, type, 0, "enum" +HKR,Ndi\params\WirelessMode, default, 0, "8" +HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% +HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% +HKR,defaults,WirelessMode, 0, "4" +HKR,,WirelessMode, 0, "4" + +HKR,,BWSetting,0,"0" + +HKR,,Channel,0,"10" + +[11acWirelessMode.reg] +HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% +HKR,Ndi\params\WirelessMode, type, 0, "enum" +HKR,Ndi\params\WirelessMode, default, 0, "8" +HKR,Ndi\params\WirelessMode\enum, "8", 0, %AUTO_STR% +HKR,Ndi\params\WirelessMode\enum, "1", 0, %IEEE_802_11A_STR% +HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% +HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% +HKR,Ndi\params\WirelessMode\enum, "16", 0, %IEEE_802_11BGN_STR% +HKR,Ndi\params\WirelessMode\enum, "32", 0, %IEEE_802_11AN_STR% +HKR,Ndi\params\WirelessMode\enum, "64", 0, %IEEE_802_11ANAC_STR% +HKR,defaults,WirelessMode, 0, "8" +HKR,,WirelessMode, 0, "8" + +HKR,,Channel,0,"36" + +;; RF Type +HKR,,RFType,0,"15" + + +HKR,defaults,BWSetting,0,"2" +HKR,,BWSetting,0,"2" + +;;---------------------------------------------------------------------------- +;; LPS 32k Control Parameters +;;---------------------------------------------------------------------------- +[32kEnable.reg] +HKR,,bLowPowerEnable,0,"1" +[32kDisable.reg] +HKR,,bLowPowerEnable,0,"0" + +;------------------------------------------------------------------------------- +; PnP pre-transition handling +;------------------------------------------------------------------------------- +[PnpPreTransOn.reg] +HKR,,PreTransPnP,0,"1" +[PnpPreTransOff.reg] +HKR,,PreTransPnP,0,"0" + +;;---------------------------------------------------------------------------- +;; WOWLAN Control Parameters +;;---------------------------------------------------------------------------- +[WowlanAllEnable.reg] +HKR,,WoWLANLPSLevel,0,"2" +HKR,,ARPOffloadEnable,0,"1" +HKR,,GTKOffloadEnable,0,"1" + +HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% +HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" +HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" +HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnMagicPacket,0,"1" + +HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% +HKR, Ndi\params\*WakeOnPattern, default, 0, "1" +HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" +HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnPattern,0,"1" + +[WowlanDisable.reg] +HKR,,WoWLANLPSLevel,0,"0" +HKR,,ARPOffloadEnable,0,"0" +HKR,,GTKOffloadEnable,0,"0" + +[WowlanAllEnableNoLPS.reg] +HKR,,WoWLANLPSLevel,0,"0" +HKR,,ARPOffloadEnable,0,"1" +HKR,,GTKOffloadEnable,0,"1" + +HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% +HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" +HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" +HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnMagicPacket,0,"1" + +HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% +HKR, Ndi\params\*WakeOnPattern, default, 0, "1" +HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" +HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnPattern,0,"1" + +[WowlanEnableNoPatternMatch.reg] +HKR,,WoWLANLPSLevel,0,"2" +HKR,,ARPOffloadEnable,0,"1" +HKR,,GTKOffloadEnable,0,"1" + +HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% +HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" +HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" +HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnMagicPacket,0,"1" + +HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% +HKR, Ndi\params\*WakeOnPattern, default, 0, "0" +HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" +HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnPattern,0,"0" + +[WowlanEnableNoLPSNoPatternMatch.reg] +HKR,,WoWLANLPSLevel,0,"0" +HKR,,ARPOffloadEnable,0,"1" +HKR,,GTKOffloadEnable,0,"1" + +HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% +HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "1" +HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" +HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnMagicPacket,0,"1" + +HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% +HKR, Ndi\params\*WakeOnPattern, default, 0, "0" +HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" +HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnPattern,0,"0" + +[ConnectedStandbyEnable.reg] +HKR,,WoWLANLPSLevel,0,"2" +HKR,,ARPOffloadEnable,0,"1" +HKR,,GTKOffloadEnable,0,"1" +HKR,,D2ListenIntvl,0,"4" +HKR,,NSOffloadEnable,0,"1" +HKR,,NLOEnable,0,"1" + +HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% +HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "0" +HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" +HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnMagicPacket,0,"0" + +HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% +HKR, Ndi\params\*WakeOnPattern, default, 0, "1" +HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" +HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnPattern,0,"1" + +;; Packet coalescing should be enabled in WHCK test +HKR,defaults,*PacketCoalescing,0,"0" +HKR,,*PacketCoalescing,0,"0" + +;------------------------------------------------------------------------------- +; Auto Channel Selection +;------------------------------------------------------------------------------- +[AutoChnlSelon.reg] +HKR,,AutoChnlSel,0,"1" +[AutoChnlSeloff.reg] +HKR,,AutoChnlSel,0,"0" + +;;---------------------------------------------------------------------------- +;; RSSI to Grid Mode Parameters +;;---------------------------------------------------------------------------- +[RSSI2GridRealMode.reg] +HKR,,RSSI2GridMode,0,"1" +[RSSI2GridMode_2.reg] +HKR,,RSSI2GridMode,0,"2" +[RSSI2GridMode_4.reg] +HKR,,RSSI2GridMode,0,"4" + +;;---------------------------------------------------------------------------- +;; KFREE parameters +;;---------------------------------------------------------------------------- +[KFREE_COMMON.reg] +HKR,,RfKFreeEnable,0,"0" + +;******************************************************************************* +; Customer reg section +;******************************************************************************* +[ScanType.reg] +HKR,defaults,PassiveScan, 0, "0" +HKR,,PassiveScan, 0, "0" + +;******************************************************************************* +; Multi-Channel Concurrent section +;******************************************************************************* +[MCC.reg] +HKR,Ndi\params\MultiChannelFcsMode, ParamDesc, 0, %MCC_STR% +HKR,Ndi\params\MultiChannelFcsMode, type, 0, "enum" +HKR,Ndi\params\MultiChannelFcsMode, default, 0, "0" +HKR,Ndi\params\MultiChannelFcsMode\enum, "0", 0, %DISABLED_STR% +HKR,Ndi\params\MultiChannelFcsMode\enum, "4", 0, %ENABLED_STR% +HKR,defaults,MultiChannelFcsMode, 0, "0" +HKR,,MultiChannelFcsMode, 0, "0" + +;******************************************************************************* +; Destination Directory +;******************************************************************************* +[RTWlanS.CopyFiles] +rtwlans.sys,,,2 + +[DestinationDirs] +DefaultDestDir = 11 +RTWlanS.CopyFiles = 12 +CIHVS.CopyFiles = 11 +RtlUI2.CopyFiles = 10 + +;;**************************************************************************** +;; Source Files +;;**************************************************************************** +[CIHVS.CopyFiles] +Rtlihvs.dll,,,2 + +[RegisterUIExt] +11,,RtlExtUI.dll,1 + +[RtlUI2.CopyFiles] +RtlUI2.exe,,,2 + +[SourceDisksFiles] +rtwlans.sys = 1 +Rtlihvs.dll = 1 + +[SourceDisksNames] +1=%DISKNAME%,,, + + +;******************************************************************************* +; Strings +;******************************************************************************* +[Strings] +SSID_STR = "SSID" +CHANNEL_STR = "Channel" +NETWORK_TYPE_STR = "Network Type" +LED_CONTROL_STR = "LED Control" +POWER_SAVE_STR = "Power Save Mode" +WIFI_IBSS_STR = "IBSS Default 11b Mode" +RATE_ADAPTIVE_STR = "Rate Adaptive" +QOS_STR = "QoS" +WiFiConfg_STR = "WiFiConfg" +WMM_APSD = "WMM APSD" +CCX_RM_STR = "CCX Radio Measurement" +CCX_OFF_LINE_DUR_UP_LIMIT_STR = "CCX Max Off-Line Measurement (0: unlimited)" +FORCE_PRIORITY_STR = "Forced Priority" +HW_PARA_STR = "Init from HwParaFile" +THREE_WIRE_MODE_STR = "Three Wire Programming Mode" +BOARD_TYPE_STR = "Board Type" +PROTECTION_MODE_STR = "Protection Mode" +TPC_STR = "Transmit Power Control" +TPC_POLARITY_STR = "TPC Polarity Select" +HIGH_POWER_STR = "High Power Mechanism" +INIT_GAIN_STR = "Initial Gain State" +CW_MAX_MIN_STR = "Contention Window" +PSP_XLINK_STR = "PSP XLink Mode" +DISABLE_STR = "Disable" +ENABLE_STR = "Enable" +DISABLED_STR = "Disabled" +ENABLED_STR = "Enabled" +AUTO_STR = "Auto" +AD_HOC_STR = "Ad Hoc" +INFRASTRUCTURE_STR = "Infrastructure" +AUTO_SELECT = "Auto select" +WL_MODE_STR = "Wireless Mode" +RX_REORDER_STR = "Rx Reorder" +CAM_STR = "CAM" +MAX_PSP_STR = "MAX_PSP" +Fast_PSP_STR = "Fast_PSP" +NO_AC_STR = "No AC (Disable)" +ALL_AC_STR = "ALL AC" +IEEE_802_11A_STR = "IEEE 802.11a" +IEEE_802_11B_STR = "IEEE 802.11b" +IEEE_802_11BG_STR = "IEEE 802.11b/g" +IEEE_802_11BGN_STR = "IEEE 802.11b/g/n" +IEEE_802_11AN_STR = "IEEE 802.11a/n" +IEEE_802_11ANAC_STR = "IEEE 802.11a/n/ac" +IEEE_802_11AC_STR = "IEEE 802.11 ac" +WakeOnMagicPacket = "Wake on Magic Packet" +WakeOnPattern = "Wake on Pattern Match" +MCC_STR = "Multi-Channel Concurrent" + +;******************************************************************************* +; manufacture description +;******************************************************************************* +Realtek = "Realtek Semiconductor Corp." + + +;******************************************************************************* +; Source disk name +;******************************************************************************* +DISKNAME = "Realtek Wireless LAN 802.11n SDIO Network Adapter Driver Disk" +RtlWlans.DeviceDesc = "Realtek Wireless LAN 802.11n SDIO Network Adapter" +RtlWlans.DeviceDesc.DispName = "Realtek Wireless LAN 802.11n SDIO Network Adapter" + +;******************************************************************************* +; RTL8723as Device description +;******************************************************************************* +RTL8723as.DeviceDesc = "Realtek RTL8723AS Wireless LAN 802.11n SDIO Network Adapter" +RTL8723as.DeviceDesc.DispName = "Realtek RTL8723AS Wireless LAN 802.11n SDIO Network Adapter" + + + +;******************************************************************************* +; RTL8723bs Device description +;******************************************************************************* +RTL8723bs.DeviceDesc = "Realtek RTL8723BS Wireless LAN 802.11n SDIO Network Adapter" +RTL8723bs.DeviceDesc.DispName = "Realtek RTL8723BS Wireless LAN 802.11n SDIO Network Adapter" + +;******************************************************************************* +; RTL8814as Device description +;******************************************************************************* +RTL8814as.DeviceDesc = "Realtek RTL8814AS Wireless LAN 802.11ac SDIO Network Adapter" +RTL8814as.DeviceDesc.DispName = "Realtek RTL8814AS Wireless LAN 802.11ac SDIO Network Adapter" + +;******************************************************************************* +; RTL8188ES Device description +;******************************************************************************* +RTL8188es.DeviceDesc = "Realtek RTL8189ES Wireless LAN 802.11n USB 2.0 Network Adapter" +RTL8188es.DeviceDesc.DispName = "Realtek RTL8189ES Wireless LAN 802.11n USB 2.0 Network Adapter" +;******************************************************************************* +; RTL8821as Device description +;******************************************************************************* +RTL8821as.DeviceDesc = "Realtek RTL8821AS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" +RTL8821as.DeviceDesc.DispName = "Realtek RTL8821AS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" +;******************************************************************************* +; RTL8192E Device description +;******************************************************************************* +RTL8192es.DeviceDesc = "Realtek RTL8192ES Wireless LAN 802.11n USB 2.0 Network Adapter" +RTL8192es.DeviceDesc.DispName = "Realtek RTL8192ES Wireless LAN 802.11n USB 2.0 Network Adapter" + +;******************************************************************************* +; RTL8703bs Device description +;******************************************************************************* +RTL8703bs.DeviceDesc = "Realtek RTL8703BS Wireless LAN 802.11n SDIO Network Adapter" +RTL8703bs.DeviceDesc.DispName = "Realtek RTL8703BS Wireless LAN 802.11n SDIO Network Adapter" + +;******************************************************************************* +; RTL8188Fs Device description +;******************************************************************************* +RTL8188fs.DeviceDesc = "Realtek RTL8189FTV Wireless LAN 802.11n SDIO Network Adapter" +RTL8188fs.DeviceDesc.DispName = "Realtek RTL8189FTV Wireless LAN 802.11n SDIO Network Adapter" +;******************************************************************************* +; RTL8822bs Device description +;******************************************************************************* +RTL8822bs.DeviceDesc = "Realtek RTL8822BS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" +RTL8822bs.DeviceDesc.DispName = "Realtek RTL8822BS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" + +;******************************************************************************* +; RTL8723ds Device description +;******************************************************************************* +RTL8723ds.DeviceDesc = "Realtek RTL8723DS Wireless LAN 802.11n SDIO Network Adapter" +RTL8723ds.DeviceDesc.DispName = "Realtek RTL8723DS Wireless LAN 802.11n SDIO Network Adapter" -- cgit v1.3.1 From 3e34aa0baad89cab3adec1d2194694a4fe832263 Mon Sep 17 00:00:00 2001 From: Adonais Romero González Date: Thu, 16 Feb 2023 16:19:48 -0800 Subject: Rename build instructions file to avoid conflicts with root README + small fix --- .github/Build-with-GitHub.md | 35 +++++++++++++++++++++++++++++++++++ .github/README.md | 35 ----------------------------------- 2 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 .github/Build-with-GitHub.md delete mode 100644 .github/README.md diff --git a/.github/Build-with-GitHub.md b/.github/Build-with-GitHub.md new file mode 100644 index 00000000..8fe67c5f --- /dev/null +++ b/.github/Build-with-GitHub.md @@ -0,0 +1,35 @@ +# Using GitHub actions for building drivers + +If you use GitHub to host your code, you can leverage [GitHub Actions](https://docs.github.com/en/actions) to create automated workflows to build your driver projects. + +`windows-2022` runner (provided by `windows-latest`) is configured with Windows Driver Kit version 22H2 and Visual Studio 2022 off the box, so most solutions can be built directly running `msbuild` directly. + +```yaml +name: Build all driver samples +on: + push: + branches: + - main +jobs: + build: + strategy: + matrix: + configuration: [Debug, Release] + platform: [x64] + runs-on: windows-2022 + env: + Solution_Path: path\to\driver\solution.sln + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v1.0.2 + + - name: Build solution + run: | + msbuild ${{ env.Solution_Path }} -p:Configuration:${{ env.Configuration }} -p:Platform:${{ env.Platform }} + env: + Configuration: ${{ matrix.configuration }} + Platform: ${{ matrix.platform }} +``` diff --git a/.github/README.md b/.github/README.md deleted file mode 100644 index b7569139..00000000 --- a/.github/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# Using GitHub actions for building drivers - -If you use GitHub to host your code, you can leverage [GitHub Actions](https://docs.github.com/en/actions) to create automated workflows to build your driver projects. - -`windows-2022` runner (provided by `windows-latest`) is configured with Windows Driver Kit version 22H2 and Visual Studio 2022 off the box, so most solutions can be built directly running `msbuild` directly. - -```yaml -name: Build all driver samples -on: - push: - branches: - - main -jobs: - build: - strategy: - matrix: - configuration: [Debug, Release] - platform: [x64] - runs-on: windows-2022 - env: - Solution_Path: path\to\driver\solution.sln - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.0.2 - - - name: Build solution - run: | - msbuild $${{ env.Solution_Path }} -p:Configuration:${{ env.Configuration }} -p:Platform:${{ env.Platform }} - env: - Configuration: ${{ matrix.configuration }} - Platform: ${{ matrix.platform }} -``` -- cgit v1.3.1 From 708d8c438537aa83673a1d6ba4cf05667c487ae0 Mon Sep 17 00:00:00 2001 From: zlockard Date: Wed, 22 Feb 2023 14:46:57 -0800 Subject: Fix file encoding and driverver format --- gpio/samples/simdevice/umdf/simdeviceumdf.inx | Bin 1842 -> 3684 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/gpio/samples/simdevice/umdf/simdeviceumdf.inx b/gpio/samples/simdevice/umdf/simdeviceumdf.inx index 3c0def96..1c3386a1 100644 Binary files a/gpio/samples/simdevice/umdf/simdeviceumdf.inx and b/gpio/samples/simdevice/umdf/simdeviceumdf.inx differ -- cgit v1.3.1 From c3c819984f2cfbbddff42c747efe65e5c1aea7f7 Mon Sep 17 00:00:00 2001 From: Wei Mao Date: Mon, 27 Feb 2023 17:23:46 -0800 Subject: [usb/UcmUcsiAcpiSample] Missing PAGED_CODE() macros --- usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Acpi.h | 1 + usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Fdo.cpp | 1 + usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Ppm.cpp | 3 +++ 3 files changed, 5 insertions(+) diff --git a/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Acpi.h b/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Acpi.h index 469fbb0a..7fcadc51 100644 --- a/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Acpi.h +++ b/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Acpi.h @@ -113,6 +113,7 @@ public: _In_ PACPI_NOTIFICATION_CALLBACK_CONTEXT CallbackConext ) { + PAGED_CODE(); return RegisterNotificationCallbackInternal(CallbackConext); } diff --git a/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Fdo.cpp b/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Fdo.cpp index 2b01bb02..7133c8d6 100644 --- a/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Fdo.cpp +++ b/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Fdo.cpp @@ -372,6 +372,7 @@ VOID Fdo::DestroyPpmObject() { TRACE_FUNC_ENTRY(TRACE_FLAG_FDO); + PAGED_CODE(); WDFDEVICE device = GetObjectHandle(); diff --git a/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Ppm.cpp b/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Ppm.cpp index c04931a0..a0acee7a 100644 --- a/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Ppm.cpp +++ b/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/Ppm.cpp @@ -160,6 +160,7 @@ Ppm::PreparePpmConfig( ) { TRACE_FUNC_ENTRY(TRACE_FLAG_PPM); + PAGED_CODE(); NTSTATUS status; bool IsUsbDeviceControllerEnabled; @@ -500,6 +501,7 @@ Ppm::EvtSendData( ) { TRACE_FUNC_ENTRY(TRACE_FLAG_PPM); + PAGED_CODE(); NTSTATUS status; PUCMUCSI_PPM_SEND_UCSI_DATA_BLOCK_IN_PARAMS inParams; @@ -533,6 +535,7 @@ Ppm::EvtReceiveData( ) { TRACE_FUNC_ENTRY(TRACE_FLAG_PPM); + PAGED_CODE(); NTSTATUS status; -- cgit v1.3.1 From 94211c3b2ecac957923bbfa22031f96d8fe5e0c7 Mon Sep 17 00:00:00 2001 From: Matthew Williams Date: Tue, 28 Feb 2023 17:51:15 -0800 Subject: serenum sample: Use ExAllocatePool2 instead of ExAllocatePoolWithTag --- serial/serenum/enum.c | 4 ++-- serial/serenum/log.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/serial/serenum/enum.c b/serial/serenum/enum.c index feb6f4af..35ebe2ce 100644 --- a/serial/serenum/enum.c +++ b/serial/serenum/enum.c @@ -230,7 +230,7 @@ SerenumDoEnumProtocol( LOGENTRY(LOG_ENUM, 'SDEP', PFdoData, PpBuf, PDSRMissing); - pReadBuf = ExAllocatePoolWithTag(NonPagedPoolNx, MAX_DEVNODE_NAME + sizeof(CHAR) ,SERENUM_POOL_TAG); + pReadBuf = ExAllocatePoolZero(NonPagedPoolNx, MAX_DEVNODE_NAME + sizeof(CHAR) ,SERENUM_POOL_TAG); if (pReadBuf == NULL) { status = STATUS_INSUFFICIENT_RESOURCES; @@ -1580,7 +1580,7 @@ Return Value: length = sizeof(KEY_VALUE_FULL_INFORMATION) + KeyNameStringLength + DataLength; - fullInfo = ExAllocatePoolWithTag(PagedPool, length,SERENUM_POOL_TAG); + fullInfo = ExAllocatePoolZero(PagedPool, length,SERENUM_POOL_TAG); if (ActualLength != NULL) { *ActualLength = 0; diff --git a/serial/serenum/log.c b/serial/serenum/log.c index 693bb698..ad834d4b 100644 --- a/serial/serenum/log.c +++ b/serial/serenum/log.c @@ -146,7 +146,7 @@ Return Value: KeInitializeSpinLock(&LogSpinLock); - SerenumLStart = ExAllocatePoolWithTag(NonPagedPoolNx, logSize, 'mneS'); + SerenumLStart = ExAllocatePoolZero(NonPagedPoolNx, logSize, 'mneS'); if (SerenumLStart) { SerenumLPtr = SerenumLStart; -- cgit v1.3.1 From 800278d3a66158b2f0f7eb6e9ce880bedb54def3 Mon Sep 17 00:00:00 2001 From: katiezb <115045945+katiezb@users.noreply.github.com> Date: Wed, 1 Mar 2023 10:32:28 -0800 Subject: Archiving storage/sfloppy sample (#903) The following sample is being archived but can still be accessed using: git checkout win11-22h2 or by accessing this link: https://github.com/microsoft/Windows-driver-samples/tree/win11-22h2 --- storage/sfloppy/README.md | 23 - storage/sfloppy/sfloppy.sln | 28 - storage/sfloppy/src/floppy.c | 3428 --------------------------- storage/sfloppy/src/sfloppy.inf | 88 - storage/sfloppy/src/sfloppy.rc | 23 - storage/sfloppy/src/sfloppy.vcxproj | 192 -- storage/sfloppy/src/sfloppy.vcxproj.Filters | 36 - 7 files changed, 3818 deletions(-) delete mode 100644 storage/sfloppy/README.md delete mode 100644 storage/sfloppy/sfloppy.sln delete mode 100644 storage/sfloppy/src/floppy.c delete mode 100644 storage/sfloppy/src/sfloppy.inf delete mode 100644 storage/sfloppy/src/sfloppy.rc delete mode 100644 storage/sfloppy/src/sfloppy.vcxproj delete mode 100644 storage/sfloppy/src/sfloppy.vcxproj.Filters diff --git a/storage/sfloppy/README.md b/storage/sfloppy/README.md deleted file mode 100644 index d05748df..00000000 --- a/storage/sfloppy/README.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -page_type: sample -description: "A sample class driver for Super Floppy disk drives." -languages: -- cpp -products: -- windows -- windows-wdk ---- - -# Super Floppy (sfloppy) Storage Class Driver - -The sfloppy sample is a super floppy driver. This driver is a class driver for Super Floppy disk drives. - -## Universal Windows Driver Compliant - -This sample builds a Universal Windows Driver. It uses only APIs and DDIs that are included in OneCoreUAP. - -## Installation and Operation - -This sample sits a level above the port driver (ATAPI, USB, and so on) in the driver stack and controls communication between the application level and the port driver. The floppy driver takes requests from file system drivers and then sends the appropriate [**SCSI\_REQUEST\_BLOCK**](https://docs.microsoft.com/windows-hardware/drivers/ddi/content/srb/ns-srb-_scsi_request_block) (SRB) to the port driver. - -For more information, see [Introduction to Storage Class Drivers](https://docs.microsoft.com/windows-hardware/drivers/storage/introduction-to-storage-class-drivers) in the storage technologies design guide. diff --git a/storage/sfloppy/sfloppy.sln b/storage/sfloppy/sfloppy.sln deleted file mode 100644 index ad9d60c3..00000000 --- a/storage/sfloppy/sfloppy.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0 -MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfloppy", "src\sfloppy.vcxproj", "{97D2E67D-8E5F-43CD-B8EB-C5DBB43C7EB7}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {97D2E67D-8E5F-43CD-B8EB-C5DBB43C7EB7}.Debug|Win32.ActiveCfg = Debug|Win32 - {97D2E67D-8E5F-43CD-B8EB-C5DBB43C7EB7}.Debug|Win32.Build.0 = Debug|Win32 - {97D2E67D-8E5F-43CD-B8EB-C5DBB43C7EB7}.Release|Win32.ActiveCfg = Release|Win32 - {97D2E67D-8E5F-43CD-B8EB-C5DBB43C7EB7}.Release|Win32.Build.0 = Release|Win32 - {97D2E67D-8E5F-43CD-B8EB-C5DBB43C7EB7}.Debug|x64.ActiveCfg = Debug|x64 - {97D2E67D-8E5F-43CD-B8EB-C5DBB43C7EB7}.Debug|x64.Build.0 = Debug|x64 - {97D2E67D-8E5F-43CD-B8EB-C5DBB43C7EB7}.Release|x64.ActiveCfg = Release|x64 - {97D2E67D-8E5F-43CD-B8EB-C5DBB43C7EB7}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/storage/sfloppy/src/floppy.c b/storage/sfloppy/src/floppy.c deleted file mode 100644 index 282885a6..00000000 --- a/storage/sfloppy/src/floppy.c +++ /dev/null @@ -1,3428 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, 1991 - 1999 - -Module Name: - - floppy.c - -Abstract: - - SCSI floppy class driver - -Author: - - Jeff Havens (jhavens) - -Environment: - - kernel mode only - -Notes: - -Revision History: -02/28/96 georgioc Merged this code with code developed by compaq in - parallel with microsoft, for 120MB floppy support. - -01/17/96 georgioc Made code PNP aware (uses the new \storage\classpnp/scsiport) - ---*/ - -#pragma warning(disable:4214) // nonstandard extension used : bit field types other than int -#pragma warning(disable:4201) // nonstandard extension used : nameless struct/union - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define MODE_DATA_SIZE 192 -#define SCSI_FLOPPY_TIMEOUT 20 -#define SFLOPPY_SRB_LIST_SIZE 4 -#define SFLOPPY_TAG 'poFS' -// -// Define all possible drive/media combinations, given drives listed above -// and media types in ntdddisk.h. -// -// These values are used to index the DriveMediaConstants table. -// - -#define NUMBER_OF_DRIVE_TYPES 7 -#define DRIVE_TYPE_120M 4 //120MB Floptical -#define DRIVE_TYPE_NONE NUMBER_OF_DRIVE_TYPES - -// -// This array describes all media types we support. -// It should be arranged in the increasing order of density -// -// For a given drive, we list all the mediatypes that will -// work with that drive. For instance, a 120MB drive will -// take 720KB media, 1.44MB media, and 120MB media. -// -// Note that, DriveMediaConstants given below is grouped -// as drive and media combination -// -typedef enum _DRIVE_MEDIA_TYPE { - Drive360Media160, // 5.25" 360k drive; 160k media - Drive360Media180, // 5.25" 360k drive; 180k media - Drive360Media320, // 5.25" 360k drive; 320k media - Drive360Media32X, // 5.25" 360k drive; 320k 1k secs - Drive360Media360, // 5.25" 360k drive; 360k media - Drive720Media720, // 3.5" 720k drive; 720k media - Drive120Media160, // 5.25" 1.2Mb drive; 160k media - Drive120Media180, // 5.25" 1.2Mb drive; 180k media - Drive120Media320, // 5.25" 1.2Mb drive; 320k media - Drive120Media32X, // 5.25" 1.2Mb drive; 320k 1k secs - Drive120Media360, // 5.25" 1.2Mb drive; 360k media - Drive120Media120, // 5.25" 1.2Mb drive; 1.2Mb media - Drive144Media720, // 3.5" 1.44Mb drive; 720k media - Drive144Media144, // 3.5" 1.44Mb drive; 1.44Mb media - Drive288Media720, // 3.5" 2.88Mb drive; 720k media - Drive288Media144, // 3.5" 2.88Mb drive; 1.44Mb media - Drive288Media288, // 3.5" 2.88Mb drive; 2.88Mb media - Drive2080Media720, // 3.5" 20.8Mb drive; 720k media - Drive2080Media144, // 3.5" 20.8Mb drive; 1.44Mb media - Drive2080Media2080, // 3.5" 20.8Mb drive; 20.8Mb media - Drive32MMedia32M, // 3.5" 32Mb drive; 32MB media - Drive120MMedia720, // 3.5" 120Mb drive; 720k media - Drive120MMedia144, // 3.5" 120Mb drive; 1.44Mb media - Drive120MMedia120M, // 3.5" 120Mb drive; 120Mb media - Drive240MMedia144M, // 3.5" 240Mb drive; 1.44Mb media - Drive240MMedia120M, // 3.5" 240Mb drive; 120Mb media - Drive240MMedia240M // 3.5" 240Mb drive; 240Mb media -} DRIVE_MEDIA_TYPE; - -// -// When we want to determine the media type in a drive, we will first -// guess that the media with highest possible density is in the drive, -// and keep trying lower densities until we can successfully read from -// the drive. -// -// These values are used to select a DRIVE_MEDIA_TYPE value. -// -// The following table defines ranges that apply to the DRIVE_MEDIA_TYPE -// enumerated values when trying media types for a particular drive type. -// Note that for this to work, the DRIVE_MEDIA_TYPE values must be sorted -// by ascending densities within drive types. Also, for maximum track -// size to be determined properly, the drive types must be in ascending -// order. -// - -typedef struct _DRIVE_MEDIA_LIMITS { - DRIVE_MEDIA_TYPE HighestDriveMediaType; - DRIVE_MEDIA_TYPE LowestDriveMediaType; -} DRIVE_MEDIA_LIMITS, *PDRIVE_MEDIA_LIMITS; - -#if 0 -DRIVE_MEDIA_LIMITS DriveMediaLimits[NUMBER_OF_DRIVE_TYPES] = { - - { Drive360Media360, Drive360Media160 }, // DRIVE_TYPE_0360 - { Drive120Media120, Drive120Media160 }, // DRIVE_TYPE_1200 - { Drive720Media720, Drive720Media720 }, // DRIVE_TYPE_0720 - { Drive144Media144, Drive144Media720 }, // DRIVE_TYPE_1440 - { Drive288Media288, Drive288Media720 }, // DRIVE_TYPE_2880 - { Drive2080Media2080, Drive2080Media720 } -}; -#else -DRIVE_MEDIA_LIMITS DriveMediaLimits[NUMBER_OF_DRIVE_TYPES] = { - - { Drive720Media720, Drive720Media720 }, // DRIVE_TYPE_0720 - { Drive144Media144, Drive144Media720}, // DRIVE_TYPE_1440 - { Drive288Media288, Drive288Media720}, // DRIVE_TYPE_2880 - { Drive2080Media2080, Drive2080Media720 }, - { Drive32MMedia32M, Drive32MMedia32M }, // DRIVE_TYPE_32M - { Drive120MMedia120M, Drive120MMedia720 }, // DRIVE_TYPE_120M - { Drive240MMedia240M, Drive240MMedia144M } // DRIVE_TYPE_240M -}; - -#endif -// -// For each drive/media combination, define important constants. -// - -typedef struct _DRIVE_MEDIA_CONSTANTS { - MEDIA_TYPE MediaType; - USHORT BytesPerSector; - UCHAR SectorsPerTrack; - USHORT MaximumTrack; - UCHAR NumberOfHeads; -} DRIVE_MEDIA_CONSTANTS, *PDRIVE_MEDIA_CONSTANTS; - -// -// Magic value to add to the SectorLengthCode to use it as a shift value -// to determine the sector size. -// - -#define SECTORLENGTHCODE_TO_BYTESHIFT 7 - -// -// The following values were gleaned from many different sources, which -// often disagreed with each other. Where numbers were in conflict, I -// chose the more conservative or most-often-selected value. -// - -DRIVE_MEDIA_CONSTANTS DriveMediaConstants[] = - { - - { F5_160_512, 0x200, 0x08, 0x27, 0x1 }, - { F5_180_512, 0x200, 0x09, 0x27, 0x1 }, - { F5_320_1024, 0x400, 0x04, 0x27, 0x2 }, - { F5_320_512, 0x200, 0x08, 0x27, 0x2 }, - { F5_360_512, 0x200, 0x09, 0x27, 0x2 }, - - { F3_720_512, 0x200, 0x09, 0x4f, 0x2 }, - - { F5_160_512, 0x200, 0x08, 0x27, 0x1 }, - { F5_180_512, 0x200, 0x09, 0x27, 0x1 }, - { F5_320_1024, 0x400, 0x04, 0x27, 0x2 }, - { F5_320_512, 0x200, 0x08, 0x27, 0x2 }, - { F5_360_512, 0x200, 0x09, 0x27, 0x2 }, - { F5_1Pt2_512, 0x200, 0x0f, 0x4f, 0x2 }, - - { F3_720_512, 0x200, 0x09, 0x4f, 0x2 }, - { F3_1Pt44_512, 0x200, 0x12, 0x4f, 0x2 }, - - { F3_720_512, 0x200, 0x09, 0x4f, 0x2 }, - { F3_1Pt44_512, 0x200, 0x12, 0x4f, 0x2 }, - { F3_2Pt88_512, 0x200, 0x24, 0x4f, 0x2 }, - - { F3_720_512, 0x200, 0x09, 0x4f, 0x2 }, - { F3_1Pt44_512, 0x200, 0x12, 0x4f, 0x2 }, - { F3_20Pt8_512, 0x200, 0x1b, 0xfa, 0x6 }, - - { F3_32M_512, 0x200, 0x20, 0x3ff,0x2}, - - { F3_720_512, 0x200, 0x09, 0x4f, 0x2 }, - { F3_1Pt44_512, 0x200, 0x12, 0x4f, 0x2 }, - { F3_120M_512, 0x200, 0x20, 0x3c2,0x8 }, - - { F3_1Pt44_512, 0x200, 0x12, 0x4f, 0x2 }, - { F3_120M_512, 0x200, 0x20, 0x3c2,0x8 }, - { F3_240M_512, 0x200, 0x38, 0x105,0x20} -}; - - -#define NUMBER_OF_DRIVE_MEDIA_COMBINATIONS sizeof(DriveMediaConstants)/sizeof(DRIVE_MEDIA_CONSTANTS) - -// -// floppy device data -// - -typedef struct _DISK_DATA { - ULONG DriveType; - BOOLEAN IsDMF; - // BOOLEAN EnableDMF; - UNICODE_STRING FloppyInterfaceString; -} DISK_DATA, *PDISK_DATA; - -// -// The FloppyCapacities and FloppyGeometries arrays are used by the -// USBFlopGetMediaTypes() and USBFlopFormatTracks() routines. - -// The FloppyCapacities and FloppyGeometries arrays must be kept in 1:1 sync, -// i.e. each FloppyGeometries[i] must correspond to each FloppyCapacities[i]. - -// Also, the arrays must be kept in sorted ascending order so that they -// are returned in sorted ascending order by IOCTL_DISK_GET_MEDIA_TYPES. -// - -typedef struct _FORMATTED_CAPACITY -{ - ULONG NumberOfBlocks; - - ULONG BlockLength; - - BOOLEAN CanFormat; // return for IOCTL_DISK_GET_MEDIA_TYPES ? - -} FORMATTED_CAPACITY, *PFORMATTED_CAPACITY; - - -FORMATTED_CAPACITY FloppyCapacities[] = -{ - // Blocks BlockLen CanFormat H T B/S S/T - {0x000500, 0x0200, TRUE}, // 2 80 512 8 640 KB F5_640_512 - {0x0005A0, 0x0200, TRUE}, // 2 80 512 9 720 KB F3_720_512 - {0x000960, 0x0200, TRUE}, // 2 80 512 15 1.20 MB F3_1Pt2_512 (Toshiba) - {0x0004D0, 0x0400, TRUE}, // 2 77 1024 8 1.23 MB F3_1Pt23_1024 (NEC) - {0x000B40, 0x0200, TRUE}, // 2 80 512 18 1.44 MB F3_1Pt44_512 - {0x000D20, 0x0200, FALSE}, // 2 80 512 21 1.70 MB DMF - {0x010000, 0x0200, TRUE}, // 2 1024 512 32 32 MB F3_32M_512 - {0x03C300, 0x0200, TRUE}, // 8 963 512 32 120 MB F3_120M_512 - {0x0600A4, 0x0200, TRUE}, // 13 890 512 34 200 MB F3_200Mb_512 (HiFD) - {0x072A00, 0x0200, TRUE} // 32 262 512 56 240 MB F3_240M_512 -}; - -DISK_GEOMETRY FloppyGeometries[] = -{ - // Cyl MediaType Trk/Cyl Sec/Trk Bytes/Sec - {{80,0}, F3_640_512, 2, 8, 512}, - {{80,0}, F3_720_512, 2, 9, 512}, - {{80,0}, F3_1Pt2_512, 2, 15, 512}, - {{77,0}, F3_1Pt23_1024, 2, 8, 1024}, - {{80,0}, F3_1Pt44_512, 2, 18, 512}, - {{80,0}, F3_1Pt44_512, 2, 21, 512}, // DMF -> F3_1Pt44_512 - {{1024,0}, F3_32M_512, 2, 32, 512}, - {{963,0}, F3_120M_512, 8, 32, 512}, - {{890,0}, F3_200Mb_512, 13, 34, 512}, - {{262,0}, F3_240M_512, 32, 56, 512} -}; - -#define FLOPPY_CAPACITIES (sizeof(FloppyCapacities)/sizeof(FloppyCapacities[0])) - -C_ASSERT((sizeof(FloppyGeometries)/sizeof(FloppyGeometries[0])) == FLOPPY_CAPACITIES); - -// -// The following structures are used by USBFlopFormatTracks() -// - -#pragma pack (push, 1) - -typedef struct _CDB12FORMAT -{ - UCHAR OperationCode; - UCHAR DefectListFormat : 3; - UCHAR CmpList : 1; - UCHAR FmtData : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR TrackNumber; - UCHAR InterleaveMsb; - UCHAR InterleaveLsb; - UCHAR Reserved1[2]; - UCHAR ParameterListLengthMsb; - UCHAR ParameterListLengthLsb; - UCHAR Reserved2[3]; -} CDB12FORMAT, *PCDB12FORMAT; - - -typedef struct _DEFECT_LIST_HEADER -{ - UCHAR Reserved1; - UCHAR Side : 1; - UCHAR Immediate : 1; - UCHAR Reserved2 : 2; - UCHAR SingleTrack : 1; - UCHAR DisableCert : 1; - UCHAR Reserved3 : 1; - UCHAR FormatOptionsValid : 1; - UCHAR DefectListLengthMsb; - UCHAR DefectListLengthLsb; -} DEFECT_LIST_HEADER, *PDEFECT_LIST_HEADER; - -typedef struct _FORMAT_UNIT_PARAMETER_LIST -{ - DEFECT_LIST_HEADER DefectListHeader; - FORMATTED_CAPACITY_DESCRIPTOR FormatDescriptor; -} FORMAT_UNIT_PARAMETER_LIST, *PFORMAT_UNIT_PARAMETER_LIST; - -#pragma pack (pop) - -DRIVER_INITIALIZE DriverEntry; - -DRIVER_UNLOAD ScsiFlopUnload; - -DRIVER_ADD_DEVICE ScsiFlopAddDevice; - -NTSTATUS -ScsiFlopInitDevice( - IN PDEVICE_OBJECT Fdo - ); - -NTSTATUS -ScsiFlopStartDevice( - IN PDEVICE_OBJECT Fdo - ); - -NTSTATUS -ScsiFlopRemoveDevice( - IN PDEVICE_OBJECT Fdo, - IN UCHAR Type - ); - -NTSTATUS -ScsiFlopStopDevice( - IN PDEVICE_OBJECT Fdo, - IN UCHAR Type - ); - -BOOLEAN -FindScsiFlops( - IN PDRIVER_OBJECT DriverObject, - IN PUNICODE_STRING RegistryPath, - IN PCLASS_INIT_DATA InitializationData, - IN PDEVICE_OBJECT PortDeviceObject, - IN ULONG PortNumber - ); - -NTSTATUS -ScsiFlopReadWriteVerification( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); - -NTSTATUS -ScsiFlopDeviceControl( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); - -BOOLEAN -IsFloppyDevice( - PDEVICE_OBJECT DeviceObject - ); - -NTSTATUS -CreateFlopDeviceObject( - IN PDRIVER_OBJECT DriverObject, - IN PDEVICE_OBJECT PortDeviceObject, - IN ULONG DeviceCount - ); - -NTSTATUS -DetermineMediaType( - PDEVICE_OBJECT DeviceObject - ); - -ULONG -DetermineDriveType( - PDEVICE_OBJECT DeviceObject - ); - -BOOLEAN -FlCheckFormatParameters( - IN PDEVICE_OBJECT DeviceObject, - IN PFORMAT_PARAMETERS FormatParameters - ); - -NTSTATUS -FormatMedia( - PDEVICE_OBJECT DeviceObject, - MEDIA_TYPE MediaType - ); - -NTSTATUS -FlopticalFormatMedia( - PDEVICE_OBJECT DeviceObject, - PFORMAT_PARAMETERS Format - ); - -VOID -ScsiFlopProcessError( - PDEVICE_OBJECT DeviceObject, - PSCSI_REQUEST_BLOCK Srb, - NTSTATUS *Status, - BOOLEAN *Retry - ); - -NTSTATUS -USBFlopGetMediaTypes( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); - -NTSTATUS -USBFlopFormatTracks( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); - -#ifdef ALLOC_PRAGMA -#pragma alloc_text(INIT, DriverEntry) - -#pragma alloc_text(PAGE, ScsiFlopUnload) -#pragma alloc_text(PAGE, ScsiFlopAddDevice) -#pragma alloc_text(PAGE, CreateFlopDeviceObject) -#pragma alloc_text(PAGE, ScsiFlopStartDevice) -#pragma alloc_text(PAGE, ScsiFlopRemoveDevice) -#pragma alloc_text(PAGE, IsFloppyDevice) -#pragma alloc_text(PAGE, DetermineMediaType) -#pragma alloc_text(PAGE, DetermineDriveType) -#pragma alloc_text(PAGE, FlCheckFormatParameters) -#pragma alloc_text(PAGE, FormatMedia) -#pragma alloc_text(PAGE, FlopticalFormatMedia) -#pragma alloc_text(PAGE, USBFlopGetMediaTypes) -#pragma alloc_text(PAGE, USBFlopFormatTracks) - -#endif - - -NTSTATUS -DriverEntry( - IN PDRIVER_OBJECT DriverObject, - IN PUNICODE_STRING RegistryPath - ) -/*++ - -Routine Description: - - This is the system initialization routine for installable drivers. - It calls the SCSI class driver initialization routine. - -Arguments: - - DriverObject - Pointer to driver object created by system. - -Return Value: - - NTSTATUS - ---*/ - -{ - CLASS_INIT_DATA InitializationData; - - // - // Zero InitData - // - - RtlZeroMemory (&InitializationData, sizeof(CLASS_INIT_DATA)); - - // - // Set sizes - // - - InitializationData.InitializationDataSize = sizeof(CLASS_INIT_DATA); - InitializationData.FdoData.DeviceExtensionSize = - sizeof(FUNCTIONAL_DEVICE_EXTENSION) + sizeof(DISK_DATA); - - InitializationData.FdoData.DeviceType = FILE_DEVICE_DISK; - InitializationData.FdoData.DeviceCharacteristics = FILE_REMOVABLE_MEDIA | FILE_FLOPPY_DISKETTE; - - // - // Set entry points - // - - InitializationData.FdoData.ClassInitDevice = ScsiFlopInitDevice; - InitializationData.FdoData.ClassStartDevice = ScsiFlopStartDevice; - InitializationData.FdoData.ClassStopDevice = ScsiFlopStopDevice; - InitializationData.FdoData.ClassRemoveDevice = ScsiFlopRemoveDevice; - - InitializationData.FdoData.ClassReadWriteVerification = ScsiFlopReadWriteVerification; - InitializationData.FdoData.ClassDeviceControl = ScsiFlopDeviceControl; - - InitializationData.FdoData.ClassShutdownFlush = NULL; - InitializationData.FdoData.ClassCreateClose = NULL; - InitializationData.FdoData.ClassError = ScsiFlopProcessError; - InitializationData.ClassStartIo = NULL; - - InitializationData.ClassAddDevice = ScsiFlopAddDevice; - InitializationData.ClassUnload = ScsiFlopUnload; - // - // Call the class init routine - // - - return ClassInitialize( DriverObject, RegistryPath, &InitializationData); - - -} // end DriverEntry() - -VOID -ScsiFlopUnload( - IN PDRIVER_OBJECT DriverObject - ) -{ - PAGED_CODE(); - UNREFERENCED_PARAMETER(DriverObject); - return; -} - -// -// AddDevice operation is performed in CreateFlopDeviceObject function which -// is called by ScsiFlopAddDevice (The AddDevice routine for sfloppy.sys). -// DO_DEVICE_INITIALIZING flag is cleard upon successfully processing AddDevice -// operation in CreateFlopDeviceObject. But PREFAST is currently unable to -// detect that DO_DEVICE_INITIALIZING is indeed cleard in CreateFlopDeviceObject -// and it raises Warning 28152 (The return from an AddDevice-like function -// unexpectedly did not clear DO_DEVICE_INITIALIZING). Suppress that warning -// using #pragma. -// -#pragma warning(push) -#pragma warning(disable:28152) - -NTSTATUS -ScsiFlopAddDevice ( - IN PDRIVER_OBJECT DriverObject, - IN PDEVICE_OBJECT Pdo - ) -/*++ - -Routine Description: - - This routine creates and initializes a new FDO for the corresponding - PDO. It may perform property queries on the FDO but cannot do any - media access operations. - -Arguments: - - DriverObject - Scsiscan class driver object. - - Pdo - the physical device object we are being added to - -Return Value: - - status - ---*/ -{ - NTSTATUS status; - ULONG floppyCount = IoGetConfigurationInformation()->FloppyCount; - - PAGED_CODE(); - - // - // Get the number of disks already initialized. - // - - status = CreateFlopDeviceObject(DriverObject, Pdo, floppyCount); - - if (NT_SUCCESS(status)) { - - // - // Increment system floppy device count. - // - - IoGetConfigurationInformation()->FloppyCount++; - } - - return status; -} - -NTSTATUS -CreateFlopDeviceObject( - IN PDRIVER_OBJECT DriverObject, - IN PDEVICE_OBJECT Pdo, - IN ULONG DeviceCount - ) - -/*++ - -Routine Description: - - This routine creates an object for the device and then calls the - SCSI port driver for media capacity and sector size. - -Arguments: - - DriverObject - Pointer to driver object created by system. - PortDeviceObject - to connect to SCSI port driver. - DeviceCount - Number of previously installed Floppys. - AdapterDescriptor - Pointer to structure returned by SCSI port - driver describing adapter capabilites (and limitations). - DeviceDescriptor - Pointer to configuration information for this device. - -Return Value: - ---*/ -{ - NTSTATUS status; - PDEVICE_OBJECT deviceObject = NULL; - PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = NULL; - PDISK_DATA diskData; - - PAGED_CODE(); - - DebugPrint((3,"CreateFlopDeviceObject: Enter routine\n")); - - // - // Try to claim the device. - // - - status = ClassClaimDevice(Pdo,FALSE); - - if (!NT_SUCCESS(status)) { - return(status); - } - - DeviceCount--; - - do { - UCHAR name[256]; - - // - // Create device object for this device. - // - - DeviceCount++; - - status = RtlStringCbPrintfA((PCCHAR) name, - sizeof(name), - "\\Device\\Floppy%u", - DeviceCount); - if (NT_SUCCESS(status)) { - - status = ClassCreateDeviceObject(DriverObject, - (PCCHAR) name, - Pdo, - TRUE, - &deviceObject); - } - } while ((status == STATUS_OBJECT_NAME_COLLISION) || - (status == STATUS_OBJECT_NAME_EXISTS)); - - if (!NT_SUCCESS(status)) { - DebugPrint((1,"CreateFlopDeviceObjects: Can not create device\n")); - goto CreateFlopDeviceObjectExit; - } - - // - // Indicate that IRPs should include MDLs. - // - - deviceObject->Flags |= DO_DIRECT_IO; - - fdoExtension = deviceObject->DeviceExtension; - - // - // Back pointer to device object. - // - - fdoExtension->CommonExtension.DeviceObject = deviceObject; - - // - // This is the physical device. - // - - fdoExtension->CommonExtension.PartitionZeroExtension = fdoExtension; - - // - // Reset the drive type. - // - - diskData = (PDISK_DATA) fdoExtension->CommonExtension.DriverData; - diskData->DriveType = DRIVE_TYPE_NONE; - diskData->IsDMF = FALSE; - // diskData->EnableDMF = TRUE; - - // - // Initialize lock count to zero. The lock count is used to - // disable the ejection mechanism when media is mounted. - // - - fdoExtension->LockCount = 0; - - // - // Save system floppy number - // - - fdoExtension->DeviceNumber = DeviceCount; - - // - // Set the alignment requirements for the device based on the - // host adapter requirements - // - - if (Pdo->AlignmentRequirement > deviceObject->AlignmentRequirement) { - deviceObject->AlignmentRequirement = Pdo->AlignmentRequirement; - } - - // - // Clear the SrbFlags and disable synchronous transfers - // - - fdoExtension->SrbFlags = SRB_FLAGS_DISABLE_SYNCH_TRANSFER; - - // - // Finally, attach to the PDO - // - - fdoExtension->LowerPdo = Pdo; - - fdoExtension->CommonExtension.LowerDeviceObject = - IoAttachDeviceToDeviceStack(deviceObject, Pdo); - - if(fdoExtension->CommonExtension.LowerDeviceObject == NULL) { - - status = STATUS_UNSUCCESSFUL; - goto CreateFlopDeviceObjectExit; - } - - deviceObject->StackSize++; - - // - // The device is initialized properly - mark it as such. - // - - deviceObject->Flags &= ~DO_DEVICE_INITIALIZING; - - return STATUS_SUCCESS; - -CreateFlopDeviceObjectExit: - - if (deviceObject != NULL) { - IoDeleteDevice(deviceObject); - } - - return status; - -} // end CreateFlopDeviceObject() -#pragma warning(pop) - -NTSTATUS -ScsiFlopInitDevice( - IN PDEVICE_OBJECT Fdo - ) -{ - PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = Fdo->DeviceExtension; - PCOMMON_DEVICE_EXTENSION commonExtension = Fdo->DeviceExtension; - PDISK_DATA diskData = commonExtension->DriverData; - - PVOID senseData = NULL; - ULONG timeOut; - - NTSTATUS status = STATUS_SUCCESS; - - // - // Allocate request sense buffer. - // - - senseData = ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED, - SENSE_BUFFER_SIZE, - SFLOPPY_TAG); - - if (senseData == NULL) { - - // - // The buffer cannot be allocated. - // - - status = STATUS_INSUFFICIENT_RESOURCES; - return status; - } - - // - // Set the sense data pointer in the device extension. - // - - fdoExtension->SenseData = senseData; - - // - // Build the lookaside list for srb's for this device. - // - - ClassInitializeSrbLookasideList((PCOMMON_DEVICE_EXTENSION)fdoExtension, - SFLOPPY_SRB_LIST_SIZE); - - // - // Register for media change notification - // - ClassInitializeMediaChangeDetection(fdoExtension, - (PUCHAR) "SFloppy"); - - // - // Set timeout value in seconds. - // - - timeOut = ClassQueryTimeOutRegistryValue(Fdo); - if (timeOut) { - fdoExtension->TimeOutValue = timeOut; - } else { - fdoExtension->TimeOutValue = SCSI_FLOPPY_TIMEOUT; - } - - // - // Floppies are not partitionable so starting offset is 0. - // - - fdoExtension->CommonExtension.StartingOffset.QuadPart = (LONGLONG)0; - -#if 0 - if (!IsFloppyDevice(Fdo) || - !(Fdo->Characteristics & FILE_REMOVABLE_MEDIA) || - (fdoExtension->DeviceDescriptor->DeviceType != DIRECT_ACCESS_DEVICE)) { - - ExFreePool(senseData); - status = STATUS_NO_SUCH_DEVICE; - return status; - } -#endif - - RtlZeroMemory(&(fdoExtension->DiskGeometry), - sizeof(DISK_GEOMETRY)); - - // - // Determine the media type if possible. Set the current media type to - // Unknown so that determine media type will check the media. - // - - fdoExtension->DiskGeometry.MediaType = Unknown; - - // - // Register interfaces for this device. - // - - { - UNICODE_STRING interfaceName; - - RtlInitUnicodeString(&interfaceName, NULL); - - status = IoRegisterDeviceInterface(fdoExtension->LowerPdo, - (LPGUID) &GUID_DEVINTERFACE_FLOPPY, - NULL, - &interfaceName); - - if(NT_SUCCESS(status)) { - diskData->FloppyInterfaceString = interfaceName; - } else { - RtlInitUnicodeString(&(diskData->FloppyInterfaceString), NULL); - DebugPrint((1, "ScsiFlopStartDevice: Unable to register device " - "interface for fdo %p [%08lx]\n", - Fdo, status)); - } - } - - return (STATUS_SUCCESS); -} - -#pragma warning(suppress:6262) // This function uses 1096 bytes of stack which exceed default value of 1024 bytes used by Code Analysis for flagging as warning -NTSTATUS ScsiFlopStartDevice( - IN PDEVICE_OBJECT Fdo - ) -{ - PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = Fdo->DeviceExtension; - PCOMMON_DEVICE_EXTENSION commonExtension = Fdo->DeviceExtension; - - PIRP irp; - IO_STATUS_BLOCK ioStatus; - - SCSI_ADDRESS scsiAddress; - - WCHAR ntNameBuffer[256]; - UNICODE_STRING ntUnicodeString; - - WCHAR arcNameBuffer[256]; - UNICODE_STRING arcUnicodeString; - - KEVENT event; - - NTSTATUS status = STATUS_SUCCESS; - - PAGED_CODE(); - - KeInitializeEvent(&event,SynchronizationEvent,FALSE); - - DetermineMediaType(Fdo); // ignore unsuccessful here - - // - // Create device object for this device. - // - - RtlStringCbPrintfW(ntNameBuffer, - sizeof(ntNameBuffer), - L"\\Device\\Floppy%u", - fdoExtension->DeviceNumber); - - // - // Create local copy of unicode string - // - RtlInitUnicodeString(&ntUnicodeString,ntNameBuffer); - - // - // Create a symbolic link from the disk name to the corresponding - // ARC name, to be used if we're booting off the disk. This will - // fail if it's not system initialization time; that's fine. The - // ARC name looks something like \ArcName\scsi(0)Flop(0)fdisk(0). - // In order to get the address, we need to send a IOCTL_SCSI_GET_ADDRESS... - // - - irp = IoBuildDeviceIoControlRequest(IOCTL_SCSI_GET_ADDRESS, - Fdo, - NULL, - 0, - &scsiAddress, - sizeof(scsiAddress), - FALSE, - &event, - &ioStatus); - - if (irp == NULL) { - return STATUS_INSUFFICIENT_RESOURCES; - } - - status = IoCallDriver(fdoExtension->CommonExtension.LowerDeviceObject, irp); - - if (status == STATUS_PENDING) { - KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL); - status = ioStatus.Status; - } - - // - // IOCTL_SCSI_GET_ADDRESS might not be supported by the port driver and - // hence may fail. But it is not a fatal error. Do not fail PnP start - // if this IOCTL fails. - // - if (NT_SUCCESS(status)) { - - RtlStringCbPrintfW(arcNameBuffer, - sizeof(arcNameBuffer), - L"\\ArcName\\scsi(%u)disk(%u)fdisk(%u)", - scsiAddress.PortNumber, - scsiAddress.TargetId, - scsiAddress.Lun); - - RtlInitUnicodeString(&arcUnicodeString, arcNameBuffer); - - IoAssignArcName(&arcUnicodeString, &ntUnicodeString); - } - - status = STATUS_SUCCESS; - - // - // Create the multi() arc name -- Create the "fake" - // name of multi(0)disk(0)fdisk(#) to handle the case where the - // SCSI floppy is the only floppy in the system. If this fails - // it doesn't matter because the previous scsi() based ArcName - // will work. This name is necessary for installation. - // - - RtlStringCbPrintfW(arcNameBuffer, - sizeof(arcNameBuffer), - L"\\ArcName\\multi(%u)disk(%u)fdisk(%u)", - 0, - 0, - fdoExtension->DeviceNumber); - - RtlInitUnicodeString(&arcUnicodeString, arcNameBuffer); - - IoAssignArcName(&arcUnicodeString, &ntUnicodeString); - - // - // Set our interface state. - // - - { - PDISK_DATA diskData = commonExtension->DriverData; - - if(diskData->FloppyInterfaceString.Buffer != NULL) { - - status = IoSetDeviceInterfaceState( - &(diskData->FloppyInterfaceString), - TRUE); - - if(!NT_SUCCESS(status)) { - DebugPrint((1, "ScsiFlopStartDevice: Unable to set device " - "interface state to TRUE for fdo %p " - "[%08lx]\n", - Fdo, status)); - } - } - } - - return STATUS_SUCCESS; -} - - -NTSTATUS -ScsiFlopReadWriteVerification( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ) - -/*++ - -Routine Description: - -Arguments: - -Return Value: - - NT Status - ---*/ - -{ - PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = DeviceObject->DeviceExtension; - PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation(Irp); - NTSTATUS status = STATUS_SUCCESS; - - // - // Make sure that the number of bytes to transfer is a multiple of the sector size - // - if ((irpSp->Parameters.Read.Length & (fdoExtension->DiskGeometry.BytesPerSector - 1)) != 0) - { - status = STATUS_INVALID_PARAMETER; - } - - Irp->IoStatus.Status = status; - - return status; -} - - -NTSTATUS -ScsiFlopDeviceControl( - PDEVICE_OBJECT DeviceObject, - PIRP Irp - ) - -/*++ - -Routine Description: - -Arguments: - -Return Value: - - Status is returned. - ---*/ - -{ - KIRQL currentIrql; - PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation(Irp); - PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = DeviceObject->DeviceExtension; - PSCSI_REQUEST_BLOCK srb; - PCDB cdb; - NTSTATUS status; - PDISK_GEOMETRY outputBuffer; - ULONG outputBufferLength; - ULONG i; - DRIVE_MEDIA_TYPE lowestDriveMediaType; - DRIVE_MEDIA_TYPE highestDriveMediaType; - PFORMAT_PARAMETERS formatParameters; - PMODE_PARAMETER_HEADER modeData; - ULONG length; - - // - // Initialize the information field - // - Irp->IoStatus.Information = 0; - - srb = ExAllocatePool2(POOL_FLAG_NON_PAGED, - SCSI_REQUEST_BLOCK_SIZE, - SFLOPPY_TAG); - - if (srb == NULL) { - - Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; - if (IoIsErrorUserInduced(Irp->IoStatus.Status)) { - - IoSetHardErrorOrVerifyDevice(Irp, DeviceObject); - } - - KeRaiseIrql(DISPATCH_LEVEL, ¤tIrql); - ClassReleaseRemoveLock(DeviceObject, Irp); - ClassCompleteRequest(DeviceObject, Irp, 0); - KeLowerIrql(currentIrql); - - return(STATUS_INSUFFICIENT_RESOURCES); - } - - // - // Write zeros to Srb. - // - - RtlZeroMemory(srb, SCSI_REQUEST_BLOCK_SIZE); - - cdb = (PCDB)srb->Cdb; - - switch (irpStack->Parameters.DeviceIoControl.IoControlCode) { - - - case IOCTL_DISK_VERIFY: { - - PVERIFY_INFORMATION verifyInfo = Irp->AssociatedIrp.SystemBuffer; - LARGE_INTEGER byteOffset; - ULONG sectorOffset; - USHORT sectorCount; - - // - // Validate buffer length. - // - - if (irpStack->Parameters.DeviceIoControl.InputBufferLength < - sizeof(VERIFY_INFORMATION)) { - - status = STATUS_INFO_LENGTH_MISMATCH; - break; - } - - // - // Perform a bounds check on the sector range - // - if ((verifyInfo->StartingOffset.QuadPart > fdoExtension->CommonExtension.PartitionLength.QuadPart) || - (verifyInfo->StartingOffset.QuadPart < 0)) - { - status = STATUS_NONEXISTENT_SECTOR; - break; - } - else - { - ULONGLONG bytesRemaining = fdoExtension->CommonExtension.PartitionLength.QuadPart - verifyInfo->StartingOffset.QuadPart; - - if ((ULONGLONG)verifyInfo->Length > bytesRemaining) - { - status = STATUS_NONEXISTENT_SECTOR; - break; - } - } - - // - // Verify sectors - // - - srb->CdbLength = 10; - - cdb->CDB10.OperationCode = SCSIOP_VERIFY; - - // - // Add disk offset to starting sector. - // - - byteOffset.QuadPart = fdoExtension->CommonExtension.StartingOffset.QuadPart + - verifyInfo->StartingOffset.QuadPart; - - // - // Convert byte offset to sector offset. - // - - sectorOffset = (ULONG)(byteOffset.QuadPart >> fdoExtension->SectorShift); - - // - // Convert ULONG byte count to USHORT sector count. - // - - sectorCount = (USHORT)(verifyInfo->Length >> fdoExtension->SectorShift); - - // - // Move little endian values into CDB in big endian format. - // - - cdb->CDB10.LogicalBlockByte0 = ((PFOUR_BYTE)§orOffset)->Byte3; - cdb->CDB10.LogicalBlockByte1 = ((PFOUR_BYTE)§orOffset)->Byte2; - cdb->CDB10.LogicalBlockByte2 = ((PFOUR_BYTE)§orOffset)->Byte1; - cdb->CDB10.LogicalBlockByte3 = ((PFOUR_BYTE)§orOffset)->Byte0; - - cdb->CDB10.TransferBlocksMsb = ((PFOUR_BYTE)§orCount)->Byte1; - cdb->CDB10.TransferBlocksLsb = ((PFOUR_BYTE)§orCount)->Byte0; - - // - // The verify command is used by the NT FORMAT utility and - // requests are sent down for 5% of the volume size. The - // request timeout value is calculated based on the number of - // sectors verified. - // - - srb->TimeOutValue = ((sectorCount + 0x7F) >> 7) * - fdoExtension->TimeOutValue; - - status = ClassSendSrbAsynchronous(DeviceObject, - srb, - Irp, - NULL, - 0, - FALSE); - return(status); - - } - - case IOCTL_DISK_GET_PARTITION_INFO: { - - if (fdoExtension->AdapterDescriptor->BusType == BusTypeUsb) { - - USBFlopGetMediaTypes(DeviceObject, NULL); - - // Don't need to propagate any error if one occurs - // - status = STATUS_SUCCESS; - - } else { - - status = DetermineMediaType(DeviceObject); - } - - if (!NT_SUCCESS(status)) { - // so will propogate error - NOTHING; - } else if (fdoExtension->DiskGeometry.MediaType == F3_120M_512) { - //so that the format code will not try to partition it. - status = STATUS_INVALID_DEVICE_REQUEST; - } else { - // - // Free the Srb, since it is not needed. - // - - ExFreePool(srb); - - // - // Pass the request to the common device control routine. - // - - return(ClassDeviceControl(DeviceObject, Irp)); - } - break; - } - - case IOCTL_DISK_GET_DRIVE_GEOMETRY: { - - DebugPrint((3,"ScsiDeviceIoControl: Get drive geometry\n")); - - if (fdoExtension->AdapterDescriptor->BusType == BusTypeUsb) - { - status = USBFlopGetMediaTypes(DeviceObject, - Irp); - break; - } - - // - // If there's not enough room to write the - // data, then fail the request. - // - - if ( irpStack->Parameters.DeviceIoControl.OutputBufferLength < - sizeof( DISK_GEOMETRY ) ) { - - status = STATUS_INVALID_PARAMETER; - break; - } - - status = DetermineMediaType(DeviceObject); - - if (!NT_SUCCESS(status)) { - - Irp->IoStatus.Information = 0; - Irp->IoStatus.Status = status; - - } else { - - // - // Copy drive geometry information from device extension. - // - - RtlMoveMemory(Irp->AssociatedIrp.SystemBuffer, - &(fdoExtension->DiskGeometry), - sizeof(DISK_GEOMETRY)); - - Irp->IoStatus.Information = sizeof(DISK_GEOMETRY); - status = STATUS_SUCCESS; - - } - - break; - } - - case IOCTL_DISK_GET_MEDIA_TYPES: { - - if (fdoExtension->AdapterDescriptor->BusType == BusTypeUsb) - { - status = USBFlopGetMediaTypes(DeviceObject, - Irp); - break; - } - - i = DetermineDriveType(DeviceObject); - - if (i == DRIVE_TYPE_NONE) { - status = STATUS_UNRECOGNIZED_MEDIA; - break; - } - - lowestDriveMediaType = DriveMediaLimits[i].LowestDriveMediaType; - highestDriveMediaType = DriveMediaLimits[i].HighestDriveMediaType; - - outputBufferLength = - irpStack->Parameters.DeviceIoControl.OutputBufferLength; - - // - // Make sure that the input buffer has enough room to return - // at least one descriptions of a supported media type. - // - - if ( outputBufferLength < ( sizeof( DISK_GEOMETRY ) ) ) { - - status = STATUS_BUFFER_TOO_SMALL; - break; - } - - // - // Assume success, although we might modify it to a buffer - // overflow warning below (if the buffer isn't big enough - // to hold ALL of the media descriptions). - // - - status = STATUS_SUCCESS; - - if (outputBufferLength < ( sizeof( DISK_GEOMETRY ) * - ( highestDriveMediaType - lowestDriveMediaType + 1 ) ) ) { - - // - // The buffer is too small for all of the descriptions; - // calculate what CAN fit in the buffer. - // - - status = STATUS_BUFFER_OVERFLOW; - - highestDriveMediaType = (DRIVE_MEDIA_TYPE)( ( lowestDriveMediaType - 1 ) + - ( outputBufferLength / - sizeof( DISK_GEOMETRY ) ) ); - } - - outputBuffer = (PDISK_GEOMETRY) Irp->AssociatedIrp.SystemBuffer; - - for (i = (UCHAR)lowestDriveMediaType;i <= (UCHAR)highestDriveMediaType;i++ ) { - - outputBuffer->MediaType = DriveMediaConstants[i].MediaType; - outputBuffer->Cylinders.LowPart = - DriveMediaConstants[i].MaximumTrack + 1; - outputBuffer->Cylinders.HighPart = 0; - outputBuffer->TracksPerCylinder = - DriveMediaConstants[i].NumberOfHeads; - outputBuffer->SectorsPerTrack = - DriveMediaConstants[i].SectorsPerTrack; - outputBuffer->BytesPerSector = - DriveMediaConstants[i].BytesPerSector; - outputBuffer++; - - Irp->IoStatus.Information += sizeof( DISK_GEOMETRY ); - } - - break; - } - - case IOCTL_DISK_FORMAT_TRACKS: { - - if (fdoExtension->AdapterDescriptor->BusType == BusTypeUsb) - { - status = USBFlopFormatTracks(DeviceObject, - Irp); - break; - } - - // - // Make sure that we got all the necessary format parameters. - // - - if ( irpStack->Parameters.DeviceIoControl.InputBufferLength AssociatedIrp.SystemBuffer; - - // - // Make sure the parameters we got are reasonable. - // - - if ( !FlCheckFormatParameters(DeviceObject, formatParameters)) { - - status = STATUS_INVALID_PARAMETER; - break; - } - - // - // If this request is for a 20.8 MB floppy then call a special - // floppy format routine. - // - - if (formatParameters->MediaType == F3_20Pt8_512) { - status = FlopticalFormatMedia(DeviceObject, - formatParameters - ); - - break; - } - - // - // All the work is done in the pass. If this is not the first pass, - // then complete the request and return; - // - - if (formatParameters->StartCylinderNumber != 0 || formatParameters->StartHeadNumber != 0) { - - status = STATUS_SUCCESS; - break; - } - - status = FormatMedia( DeviceObject, formatParameters->MediaType); - break; - } - - case IOCTL_DISK_IS_WRITABLE: { - - if ((fdoExtension->DiskGeometry.MediaType) == F3_32M_512) { - - // - // 32MB media is READ ONLY. Just return - // STATUS_MEDIA_WRITE_PROTECTED - // - - status = STATUS_MEDIA_WRITE_PROTECTED; - - break; - } - - // - // Determine if the device is writable. - // - - modeData = ExAllocatePool(NonPagedPoolNxCacheAligned, MODE_DATA_SIZE); - - if (modeData == NULL) { - status = STATUS_INSUFFICIENT_RESOURCES; - break; - } - - RtlZeroMemory(modeData, MODE_DATA_SIZE); - - length = ClassModeSense(DeviceObject, - (PCHAR) modeData, - MODE_DATA_SIZE, - MODE_SENSE_RETURN_ALL); - - if (length < sizeof(MODE_PARAMETER_HEADER)) { - - // - // Retry the request in case of a check condition. - // - - length = ClassModeSense(DeviceObject, - (PCHAR) modeData, - MODE_DATA_SIZE, - MODE_SENSE_RETURN_ALL); - - if (length < sizeof(MODE_PARAMETER_HEADER)) { - status = STATUS_IO_DEVICE_ERROR; - ExFreePool(modeData); - break; - } - } - - if (modeData->DeviceSpecificParameter & MODE_DSP_WRITE_PROTECT) { - status = STATUS_MEDIA_WRITE_PROTECTED; - } else { - status = STATUS_SUCCESS; - } - - DebugPrint((2,"IOCTL_DISK_IS_WRITABLE returns %08X\n", status)); - - ExFreePool(modeData); - break; - } - - default: { - - DebugPrint((3,"ScsiIoDeviceControl: Unsupported device IOCTL\n")); - - // - // Free the Srb, since it is not needed. - // - - ExFreePool(srb); - - // - // Pass the request to the common device control routine. - // - - return(ClassDeviceControl(DeviceObject, Irp)); - - break; - } - - } // end switch( ... - - // - // Check if SL_OVERRIDE_VERIFY_VOLUME flag is set in the IRP. - // If so, do not return STATUS_VERIFY_REQUIRED - // - if ((status == STATUS_VERIFY_REQUIRED) && - (TEST_FLAG(irpStack->Flags, SL_OVERRIDE_VERIFY_VOLUME))) { - - status = STATUS_IO_DEVICE_ERROR; - - } - - Irp->IoStatus.Status = status; - - if (!NT_SUCCESS(status) && IoIsErrorUserInduced(status)) { - - IoSetHardErrorOrVerifyDevice(Irp, DeviceObject); - } - - KeRaiseIrql(DISPATCH_LEVEL, ¤tIrql); - ClassReleaseRemoveLock(DeviceObject, Irp); - ClassCompleteRequest(DeviceObject, Irp, 0); - KeLowerIrql(currentIrql); - - ExFreePool(srb); - - return status; - -} // end ScsiFlopDeviceControl() - -#if 0 - -BOOLEAN -IsFloppyDevice( - PDEVICE_OBJECT DeviceObject - ) -/*++ - -Routine Description: - - The routine performs the necessary funcitons to deterime if the device is - really a floppy rather than a harddisk. This is done by a mode sense - command. First a check is made to see if the medimum type is set. Second - a check is made for the flexible parameters mode page. - -Arguments: - - DeviceObject - Supplies the device object to be tested. - -Return Value: - - Return TRUE if the indicated device is a floppy. - ---*/ -{ - - PVOID modeData; - PUCHAR pageData; - ULONG length; - - modeData = ExAllocatePool(NonPagedPoolNxCacheAligned, MODE_DATA_SIZE); - - if (modeData == NULL) { - return(FALSE); - } - - RtlZeroMemory(modeData, MODE_DATA_SIZE); - - length = ClassModeSense(DeviceObject, modeData, MODE_DATA_SIZE, MODE_SENSE_RETURN_ALL); - - if (length < sizeof(MODE_PARAMETER_HEADER)) { - - // - // Retry the request in case of a check condition. - // - - length = ClassModeSense(DeviceObject, - modeData, - MODE_DATA_SIZE, - MODE_SENSE_RETURN_ALL); - - if (length < sizeof(MODE_PARAMETER_HEADER)) { - - ExFreePool(modeData); - return(FALSE); - - } - } - -#if 0 - // - // Some drives incorrectly report this. In particular the SONY RMO-S350 - // when in disk mode. - // - - if (((PMODE_PARAMETER_HEADER) modeData)->MediumType >= MODE_FD_SINGLE_SIDE - && ((PMODE_PARAMETER_HEADER) modeData)->MediumType <= MODE_FD_MAXIMUM_TYPE) { - - DebugPrint((1, "ScsiFlop: MediumType value %2x, This is a floppy.\n", ((PMODE_PARAMETER_HEADER) modeData)->MediumType)); - ExFreePool(modeData); - return(TRUE); - } - -#endif - - // - // If the length is greater than length indiated by the mode data reset - // the data to the mode data. - // - if (length > (ULONG)((PMODE_PARAMETER_HEADER) modeData)->ModeDataLength + 1) { - length = (ULONG)((PMODE_PARAMETER_HEADER) modeData)->ModeDataLength + 1; - - } - - // - // Look for the flexible disk mode page. - // - - pageData = ClassFindModePage( modeData, length, MODE_PAGE_FLEXIBILE, TRUE); - - if (pageData != NULL) { - - DebugPrint((1, "ScsiFlop: Flexible disk page found, This is a floppy.\n")); - - // - // As a special case for the floptical driver do a magic mode sense to - // enable the drive. - // - - ClassModeSense(DeviceObject, modeData, 0x2a, 0x2e); - - ExFreePool(modeData); - return(TRUE); - - } - - ExFreePool(modeData); - return(FALSE); - -} -#endif - - -NTSTATUS -DetermineMediaType( - PDEVICE_OBJECT DeviceObject - ) -/*++ - -Routine Description: - - This routine determines the floppy media type based on the size of the - device. The geometry information is set for the device object. - -Arguments: - - DeviceObject - Supplies the device object to be tested. - -Return Value: - - None - ---*/ -{ - PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = DeviceObject->DeviceExtension; - PDISK_GEOMETRY geometry; - LONG index; - NTSTATUS status; - - PAGED_CODE(); - - geometry = &(fdoExtension->DiskGeometry); - - // - // Issue ReadCapacity to update device extension - // with information for current media. - // - - status = ClassReadDriveCapacity(DeviceObject); - - if (!NT_SUCCESS(status)) { - - // - // Set the media type to unknow and zero the geometry information. - // - - geometry->MediaType = Unknown; - - return status; - - } - - // - // Look at the capcity of disk to determine its type. - // - - for (index = NUMBER_OF_DRIVE_MEDIA_COMBINATIONS - 1; index >= 0; index--) { - - // - // Walk the table backward untill the drive capacity holds all of the - // data and the bytes per setor are equal - // - - if ((ULONG) (DriveMediaConstants[index].NumberOfHeads * - (DriveMediaConstants[index].MaximumTrack + 1) * - DriveMediaConstants[index].SectorsPerTrack * - DriveMediaConstants[index].BytesPerSector) <= - fdoExtension->CommonExtension.PartitionLength.LowPart && - DriveMediaConstants[index].BytesPerSector == - geometry->BytesPerSector) { - - geometry->MediaType = DriveMediaConstants[index].MediaType; - geometry->TracksPerCylinder = DriveMediaConstants[index].NumberOfHeads; - geometry->SectorsPerTrack = DriveMediaConstants[index].SectorsPerTrack; - geometry->Cylinders.LowPart = DriveMediaConstants[index].MaximumTrack+1; - break; - } - } - - if (index == -1) { - - // - // Set the media type to unknow and zero the geometry information. - // - - geometry->MediaType = Unknown; - - - } else { - // - // DMF check breaks the insight SCSI floppy, so its disabled for that case - // - PDISK_DATA diskData = (PDISK_DATA) fdoExtension->CommonExtension.DriverData; - - // if (diskData->EnableDMF == TRUE) { - - // - //check to see if DMF - // - - PSCSI_REQUEST_BLOCK srb; - PVOID readData; - - // - // Allocate a Srb for the read command. - // - - readData = ExAllocatePool(NonPagedPoolNx, geometry->BytesPerSector); - if (readData == NULL) { - return STATUS_NO_MEMORY; - } - - srb = ExAllocatePool(NonPagedPoolNx, SCSI_REQUEST_BLOCK_SIZE); - - if (srb == NULL) { - - ExFreePool(readData); - return STATUS_NO_MEMORY; - } - - RtlZeroMemory(readData, geometry->BytesPerSector); - RtlZeroMemory(srb, SCSI_REQUEST_BLOCK_SIZE); - - srb->CdbLength = 10; - srb->Cdb[0] = SCSIOP_READ; - srb->Cdb[5] = 0; - srb->Cdb[8] = (UCHAR) 1; - - // - // Set timeout value. - // - - srb->TimeOutValue = fdoExtension->TimeOutValue; - - // - // Send the mode select data. - // - - status = ClassSendSrbSynchronous(DeviceObject, - srb, - readData, - geometry->BytesPerSector, - FALSE - ); - - if (NT_SUCCESS(status)) { - char *pchar = (char *)readData; - - pchar += 3; //skip 3 bytes jump code - - // If the MSDMF3. signature is there then mark it as DMF diskette - if (RtlCompareMemory(pchar, "MSDMF3.", 7) == 7) { - diskData->IsDMF = TRUE; - } - - } - ExFreePool(readData); - ExFreePool(srb); - // }// else - } - return status; -} - -ULONG -DetermineDriveType( - PDEVICE_OBJECT DeviceObject - ) -/*++ - -Routine Description: - - The routine determines the device type so that the supported medias can be - determined. It does a mode sense for the default parameters. This code - assumes that the returned values are for the maximum device size. - -Arguments: - - DeviceObject - Supplies the device object to be tested. - -Return Value: - - None - ---*/ -{ - PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = DeviceObject->DeviceExtension; - PVOID modeData; - PDISK_DATA diskData = (PDISK_DATA) fdoExtension->CommonExtension.DriverData; - PMODE_FLEXIBLE_DISK_PAGE pageData; - ULONG length; - LONG index; - UCHAR numberOfHeads; - UCHAR sectorsPerTrack; - USHORT maximumTrack; - BOOLEAN applyFix = FALSE; - - PAGED_CODE(); - - if (diskData->DriveType != DRIVE_TYPE_NONE) { - return(diskData->DriveType); - } - - modeData = ExAllocatePool(NonPagedPoolNxCacheAligned, MODE_DATA_SIZE); - - if (modeData == NULL) { - return(DRIVE_TYPE_NONE); - } - - RtlZeroMemory(modeData, MODE_DATA_SIZE); - - length = ClassModeSense(DeviceObject, - modeData, - MODE_DATA_SIZE, - MODE_PAGE_FLEXIBILE); - - if (length < sizeof(MODE_PARAMETER_HEADER)) { - - // - // Retry the request one more time - // in case of a check condition. - // - length = ClassModeSense(DeviceObject, - modeData, - MODE_DATA_SIZE, - MODE_PAGE_FLEXIBILE); - - if (length < sizeof(MODE_PARAMETER_HEADER)) { - - ExFreePool(modeData); - return(DRIVE_TYPE_NONE); - } - } - - // - // Look for the flexible disk mode page. - // - - pageData = ClassFindModePage( modeData, - length, - MODE_PAGE_FLEXIBILE, - TRUE); - - // - // Make sure the page is returned and is large enough. - // - - if ((pageData != NULL) && - (pageData->PageLength + 2 >= - (UCHAR)offsetof(MODE_FLEXIBLE_DISK_PAGE, StartWritePrecom))) { - - // - // Pull out the heads, cylinders, and sectors. - // - - numberOfHeads = pageData->NumberOfHeads; - maximumTrack = pageData->NumberOfCylinders[1]; - maximumTrack |= pageData->NumberOfCylinders[0] << 8; - sectorsPerTrack = pageData->SectorsPerTrack; - - - // - // Convert from number of cylinders to maximum track. - // - - maximumTrack--; - - // - // Search for the maximum supported media. Based on the number of heads, - // sectors per track and number of cylinders - // - for (index = 0; index < NUMBER_OF_DRIVE_MEDIA_COMBINATIONS; index++) { - - // - // Walk the table forward until the drive capacity holds all of the - // data and the bytes per setor are equal - // - - if (DriveMediaConstants[index].NumberOfHeads == numberOfHeads && - DriveMediaConstants[index].MaximumTrack == maximumTrack && - DriveMediaConstants[index].SectorsPerTrack ==sectorsPerTrack) { - - ExFreePool(modeData); - - // - // index is now a drive media combination. Compare this to - // the maximum drive media type in the drive media table. - // - - for (length = 0; length < NUMBER_OF_DRIVE_TYPES; length++) { - - if (DriveMediaLimits[length].HighestDriveMediaType == index) { - return(length); - } - } - return(DRIVE_TYPE_NONE); - } - } - - // If the maximum track is greater than 8 bits then divide the - // number of tracks by 3 and multiply the number of heads by 3. - // This is a special case for the 20.8 MB floppy. - // - - if (!applyFix && maximumTrack >= 0x0100) { - maximumTrack++; - maximumTrack /= 3; - maximumTrack--; - numberOfHeads *= 3; - } else { - ExFreePool(modeData); - return(DRIVE_TYPE_NONE); - } - - } - - ExFreePool(modeData); - return(DRIVE_TYPE_NONE); -} - - -BOOLEAN -FlCheckFormatParameters( - IN PDEVICE_OBJECT DeviceObject, - IN PFORMAT_PARAMETERS FormatParameters - ) - -/*++ - -Routine Description: - - This routine checks the supplied format parameters to make sure that - they'll work on the drive to be formatted. - -Arguments: - - DeviceObject - Pointer to the device object to be formated. - - FormatParameters - a pointer to the caller's parameters for the FORMAT. - -Return Value: - - TRUE if parameters are OK. - FALSE if the parameters are bad. - ---*/ - -{ - PDRIVE_MEDIA_CONSTANTS driveMediaConstants; - DRIVE_MEDIA_TYPE driveMediaType; - ULONG index; - - PAGED_CODE(); - - // - // Get the device type. - // - - index = DetermineDriveType(DeviceObject); - - if (index == DRIVE_TYPE_NONE) { - - // - // If the determine device type failed then just use the media type - // and try the parameters. - // - - driveMediaType = Drive360Media160; - - while (( DriveMediaConstants[driveMediaType].MediaType != - FormatParameters->MediaType ) && - ( driveMediaType < Drive288Media288) ) { - - driveMediaType++; - } - - } else { - - // - // Figure out which entry in the DriveMediaConstants table to use. - // - - driveMediaType = - DriveMediaLimits[index].HighestDriveMediaType; - - while ( ( DriveMediaConstants[driveMediaType].MediaType != - FormatParameters->MediaType ) && - ( driveMediaType > DriveMediaLimits[index]. - LowestDriveMediaType ) ) { - - driveMediaType--; - } - - } - - - // driveMediaType is bounded below by DriveMediaLimits[].LowestDriveMediaType -#pragma warning(push) -#pragma warning(disable:33010) // 33010: Enum used as array index may be negative - if ( DriveMediaConstants[driveMediaType].MediaType != - FormatParameters->MediaType ) { - return FALSE; - - } else { - - driveMediaConstants = &DriveMediaConstants[driveMediaType]; - - if ( ( FormatParameters->StartHeadNumber > - (ULONG)( driveMediaConstants->NumberOfHeads - 1 ) ) || - ( FormatParameters->EndHeadNumber > - (ULONG)( driveMediaConstants->NumberOfHeads - 1 ) ) || - ( FormatParameters->StartCylinderNumber > - driveMediaConstants->MaximumTrack ) || - ( FormatParameters->EndCylinderNumber > - driveMediaConstants->MaximumTrack ) || - ( FormatParameters->EndCylinderNumber < - FormatParameters->StartCylinderNumber ) ) { - - return FALSE; - - } else { - - return TRUE; - } - } -#pragma warning(pop) -} - -NTSTATUS -FormatMedia( - PDEVICE_OBJECT DeviceObject, - MEDIA_TYPE MediaType - ) -/*++ - -Routine Description: - - This routine formats the floppy disk. The entire floppy is formated in - one shot. - -Arguments: - - DeviceObject - Supplies the device object to be tested. - - Irp - Supplies a pointer to the requesting Irp. - - MediaType - Supplies the media type format the device for. - -Return Value: - - Returns a status for the operation. - ---*/ -{ - PVOID modeData; - PSCSI_REQUEST_BLOCK srb; - PMODE_FLEXIBLE_DISK_PAGE pageData; - DRIVE_MEDIA_TYPE driveMediaType; - PDRIVE_MEDIA_CONSTANTS driveMediaConstants; - ULONG length; - NTSTATUS status; - - PAGED_CODE(); - - modeData = ExAllocatePool(NonPagedPoolNxCacheAligned, MODE_DATA_SIZE); - - if (modeData == NULL) { - return(STATUS_INSUFFICIENT_RESOURCES); - } - - RtlZeroMemory(modeData, MODE_DATA_SIZE); - - length = ClassModeSense(DeviceObject, - modeData, - MODE_DATA_SIZE, - MODE_PAGE_FLEXIBILE); - - if (length < sizeof(MODE_PARAMETER_HEADER)) { - ExFreePool(modeData); - return(STATUS_INVALID_DEVICE_REQUEST); - } - - // - // Look for the flexible disk mode page. - // - - pageData = ClassFindModePage( modeData, length, MODE_PAGE_FLEXIBILE, TRUE); - - // - // Make sure the page is returned and is large enough. - // - - if ((pageData == NULL) || - (pageData->PageLength + 2 < - (UCHAR)offsetof(MODE_FLEXIBLE_DISK_PAGE, StartWritePrecom))) { - - ExFreePool(modeData); - return(STATUS_INVALID_DEVICE_REQUEST); - - } - - // - // Look for a drive media type which matches the requested media type. - // - // - //start from Drive120MMedia120M instead of Drive2080Media2080 - // - for (driveMediaType = Drive120MMedia120M; - DriveMediaConstants[driveMediaType].MediaType != MediaType; - driveMediaType--) { - if (driveMediaType == Drive360Media160) { - - ExFreePool(modeData); - return(STATUS_INVALID_PARAMETER); - - } - } - - driveMediaConstants = &DriveMediaConstants[driveMediaType]; - - if ((pageData->NumberOfHeads != driveMediaConstants->NumberOfHeads) || - (pageData->SectorsPerTrack != driveMediaConstants->SectorsPerTrack) || - ((pageData->NumberOfCylinders[0] != (UCHAR)((driveMediaConstants->MaximumTrack+1) >> 8)) && - (pageData->NumberOfCylinders[1] != (UCHAR)driveMediaConstants->MaximumTrack+1)) || - (pageData->BytesPerSector[0] != driveMediaConstants->BytesPerSector >> 8 )) { - - // - // Update the flexible parameters page with the new parameters. - // - - pageData->NumberOfHeads = driveMediaConstants->NumberOfHeads; - pageData->SectorsPerTrack = driveMediaConstants->SectorsPerTrack; - pageData->NumberOfCylinders[0] = (UCHAR)((driveMediaConstants->MaximumTrack+1) >> 8); - pageData->NumberOfCylinders[1] = (UCHAR)driveMediaConstants->MaximumTrack+1; - pageData->BytesPerSector[0] = driveMediaConstants->BytesPerSector >> 8; - - // - // Clear the mode parameter header. - // - - RtlZeroMemory(modeData, sizeof(MODE_PARAMETER_HEADER)); - - // - // Set the length equal to the length returned for the flexible page. - // - - length = pageData->PageLength + 2; - - // - // Copy the page after the mode parameter header. - // - - RtlMoveMemory((PCHAR) modeData + sizeof(MODE_PARAMETER_HEADER), - pageData, - length - ); - length += sizeof(MODE_PARAMETER_HEADER); - - - // - // Allocate a Srb for the format command. - // - - srb = ExAllocatePool(NonPagedPoolNx, SCSI_REQUEST_BLOCK_SIZE); - - if (srb == NULL) { - - ExFreePool(modeData); - return(STATUS_INSUFFICIENT_RESOURCES); - } - - RtlZeroMemory(srb, SCSI_REQUEST_BLOCK_SIZE); - - srb->CdbLength = 6; - srb->Cdb[0] = SCSIOP_MODE_SELECT; - srb->Cdb[4] = (UCHAR) length; - - // - // Set the PF bit. - // - - srb->Cdb[1] |= 0x10; - - // - // Set timeout value. - // - - srb->TimeOutValue = 2; - - // - // Send the mode select data. - // - - status = ClassSendSrbSynchronous(DeviceObject, - srb, - modeData, - length, - TRUE - ); - - // - // The mode data not needed any more so free it. - // - - ExFreePool(modeData); - - if (!NT_SUCCESS(status)) { - ExFreePool(srb); - return(status); - } - - } else { - - // - // The mode data not needed any more so free it. - // - - ExFreePool(modeData); - - // - // Allocate a Srb for the format command. - // - - srb = ExAllocatePool(NonPagedPoolNx, SCSI_REQUEST_BLOCK_SIZE); - - if (srb == NULL) { - return(STATUS_INSUFFICIENT_RESOURCES); - } - - } - - RtlZeroMemory(srb, SCSI_REQUEST_BLOCK_SIZE); - - srb->CdbLength = 6; - - srb->Cdb[0] = SCSIOP_FORMAT_UNIT; - - // - // Set timeout value. - // - - srb->TimeOutValue = 10 * 60; - - status = ClassSendSrbSynchronous(DeviceObject, - srb, - NULL, - 0, - FALSE - ); - ExFreePool(srb); - - return(status); - -} - -VOID -ScsiFlopProcessError( - PDEVICE_OBJECT DeviceObject, - PSCSI_REQUEST_BLOCK Srb, - NTSTATUS *Status, - BOOLEAN *Retry - ) -/*++ - -Routine Description: - - This routine checks the type of error. If the error indicate the floppy - controller needs to be reinitialize a command is made to do it. - -Arguments: - - DeviceObject - Supplies a pointer to the device object. - - Srb - Supplies a pointer to the failing Srb. - - Status - Status with which the IRP will be completed. - - Retry - Indication of whether the request will be retried. - -Return Value: - - None. - ---*/ - -{ - PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = DeviceObject->DeviceExtension; - PDISK_DATA diskData = (PDISK_DATA) fdoExtension->CommonExtension.DriverData; - PSENSE_DATA senseBuffer = Srb->SenseInfoBuffer; - PIO_STACK_LOCATION irpStack; - PIRP irp; - PSCSI_REQUEST_BLOCK srb; - LARGE_INTEGER largeInt; - PCOMPLETION_CONTEXT context; - PCDB cdb; - ULONG_PTR alignment; - ULONG majorFunction; - - UNREFERENCED_PARAMETER(Status); - UNREFERENCED_PARAMETER(Retry); - - largeInt.QuadPart = 1; - - // - // Check the status. The initialization command only needs to be sent - // if UNIT ATTENTION or LUN NOT READY is returned. - // - - if (!(Srb->SrbStatus & SRB_STATUS_AUTOSENSE_VALID)) { - - // - // The drive does not require reinitialization. - // - - return; - } - - // - // Reset the drive type. - // - - diskData->DriveType = DRIVE_TYPE_NONE; - diskData->IsDMF = FALSE; - - fdoExtension->DiskGeometry.MediaType = Unknown; - - if (fdoExtension->AdapterDescriptor->BusType == BusTypeUsb) { - - // FLPYDISK.SYS never returns a non-zero value for the ChangeCount - // on an IOCTL_DISK_CHECK_VERIFY. Some things seem to work better - // if we do the same. In particular, FatVerifyVolume() can exit between - // the IOCTL_DISK_CHECK_VERIFY and the IOCTL_DISK_GET_DRIVE_GEOMETRY - // if a non-zero ChangeCount is returned, and this appears to cause - // issues formatting unformatted media in some situations. - // - // This is something that should probably be revisited at some point. - // - fdoExtension->MediaChangeCount = 0; - - if (((senseBuffer->SenseKey & 0xf) == SCSI_SENSE_UNIT_ATTENTION) && - (senseBuffer->AdditionalSenseCode == SCSI_ADSENSE_MEDIUM_CHANGED)) { - - struct _START_STOP *startStopCdb; - - DebugPrint((2,"Sending SCSIOP_START_STOP_UNIT\n")); - - context = ExAllocatePool(NonPagedPoolNx, - sizeof(COMPLETION_CONTEXT)); - - if (context == NULL) { - - return; - } -#if (NTDDI_VERSION >= NTDDI_WIN8) - srb = &context->Srb.Srb; -#else - srb = &context->Srb; -#endif - - RtlZeroMemory(srb, SCSI_REQUEST_BLOCK_SIZE); - - srb->SrbFlags = SRB_FLAGS_DISABLE_AUTOSENSE; - - srb->CdbLength = 6; - - startStopCdb = (struct _START_STOP *)srb->Cdb; - - startStopCdb->OperationCode = SCSIOP_START_STOP_UNIT; - startStopCdb->Start = 1; - - // A Start Stop Unit request has no transfer buffer. - // Set the request to IRP_MJ_FLUSH_BUFFERS when calling - // IoBuildAsynchronousFsdRequest() so that it ignores - // the buffer pointer and buffer length parameters. - // - majorFunction = IRP_MJ_FLUSH_BUFFERS; - - } else if ((senseBuffer->SenseKey & 0xf) == SCSI_SENSE_MEDIUM_ERROR) { - - // Return ERROR_UNRECOGNIZED_MEDIA instead of - // STATUS_DEVICE_DATA_ERROR to make shell happy. - // - *Status = STATUS_UNRECOGNIZED_MEDIA; - return; - - } else { - - return; - } - - } else if (((senseBuffer->SenseKey & 0xf) == SCSI_SENSE_NOT_READY) && - senseBuffer->AdditionalSenseCodeQualifier == SCSI_SENSEQ_INIT_COMMAND_REQUIRED || - (senseBuffer->SenseKey & 0xf) == SCSI_SENSE_UNIT_ATTENTION) { - - ULONG sizeNeeded; - ULONG tmpSize; - BOOLEAN overFlow; - - DebugPrint((1, "ScsiFlopProcessError: Reinitializing the floppy.\n")); - - // - // Send the special mode sense command to enable writes on the - // floptical drive. - // - - alignment = DeviceObject->AlignmentRequirement ? - DeviceObject->AlignmentRequirement : 1; - - sizeNeeded = 0; - overFlow = TRUE; - if (SUCCEEDED(ULongAdd(sizeof(COMPLETION_CONTEXT), 0x2a, &tmpSize))) { - - if (SUCCEEDED(ULongAdd(tmpSize, (ULONG) alignment, &sizeNeeded))) { - overFlow = FALSE; - } - } - - context = NULL; - - if (!overFlow) { - context = ExAllocatePool(NonPagedPoolNx, sizeNeeded); - } - - if (context == NULL) { - - // - // If there is not enough memory to fulfill this request, - // simply return. A subsequent retry will fail and another - // chance to start the unit. - // - - return; - } - -#if (NTDDI_VERSION >= NTDDI_WIN8) - srb = &context->Srb.Srb; -#else - srb = &context->Srb; -#endif - - RtlZeroMemory(srb, SCSI_REQUEST_BLOCK_SIZE); - - // - // Set the transfer length. - // - - srb->DataTransferLength = 0x2a; - srb->SrbFlags = SRB_FLAGS_DATA_IN | SRB_FLAGS_DISABLE_AUTOSENSE | SRB_FLAGS_DISABLE_SYNCH_TRANSFER; - - // - // The data buffer must be aligned. - // - - srb->DataBuffer = (PVOID) (((ULONG_PTR) (context + 1) + (alignment - 1)) & - ~(alignment - 1)); - - - // - // Build the start unit CDB. - // - - srb->CdbLength = 6; - cdb = (PCDB)srb->Cdb; - cdb->MODE_SENSE.OperationCode = SCSIOP_MODE_SENSE; - cdb->MODE_SENSE.PageCode = 0x2e; - cdb->MODE_SENSE.AllocationLength = 0x2a; - - majorFunction = IRP_MJ_READ; - - } else { - - return; - } - - context->DeviceObject = DeviceObject; - - // - // Write length to SRB. - // - - srb->Length = SCSI_REQUEST_BLOCK_SIZE; - - srb->Function = SRB_FUNCTION_EXECUTE_SCSI; - srb->TimeOutValue = fdoExtension->TimeOutValue; - - // - // Build the asynchronous request - // to be sent to the port driver. - // - - irp = IoBuildAsynchronousFsdRequest(majorFunction, - DeviceObject, - srb->DataBuffer, - srb->DataTransferLength, - &largeInt, - NULL); - - if(irp == NULL) { - ExFreePool(context); - return; - } - - - IoSetCompletionRoutine(irp, - (PIO_COMPLETION_ROUTINE)ClassAsynchronousCompletion, - context, - TRUE, - TRUE, - TRUE); - - ClassAcquireRemoveLock(DeviceObject, irp); - - irpStack = IoGetNextIrpStackLocation(irp); - - irpStack->MajorFunction = IRP_MJ_SCSI; - - srb->OriginalRequest = irp; - - // - // Save SRB address in next stack for port driver. - // - - irpStack->Parameters.Others.Argument1 = (PVOID)srb; - - // - // Can't release the remove lock yet - let ClassAsynchronousCompletion - // take care of that for us. - // - - (VOID)IoCallDriver(fdoExtension->CommonExtension.LowerDeviceObject, irp); - - return; -} - -NTSTATUS -FlopticalFormatMedia( - PDEVICE_OBJECT DeviceObject, - PFORMAT_PARAMETERS Format - ) -/*++ - -Routine Description: - - This routine is used to do perform a format tracks for the 20.8 MB - floppy. Because the device does not support format tracks and the full - format takes a long time a write of zeros is done instead. - -Arguments: - - DeviceObject - Supplies the device object to be tested. - - Format - Supplies the format parameters. - -Return Value: - - Returns a status for the operation. - ---*/ -{ - IO_STATUS_BLOCK ioStatus; - PIRP irp; - KEVENT event; - LARGE_INTEGER offset; - ULONG length; - PVOID buffer; - PDRIVE_MEDIA_CONSTANTS driveMediaConstants; - NTSTATUS status; - - PAGED_CODE(); - - driveMediaConstants = &DriveMediaConstants[Drive2080Media2080]; - - // - // Calculate the length of the buffer. - // - - length = ((Format->EndCylinderNumber - Format->StartCylinderNumber) * - driveMediaConstants->NumberOfHeads + - Format->EndHeadNumber - Format->StartHeadNumber + 1) * - driveMediaConstants->SectorsPerTrack * - driveMediaConstants->BytesPerSector; - - buffer = ExAllocatePool(NonPagedPoolNxCacheAligned, length); - - if (buffer == NULL) { - return(STATUS_INSUFFICIENT_RESOURCES); - } - - RtlZeroMemory(buffer, length); - - offset.QuadPart = - (Format->StartCylinderNumber * driveMediaConstants->NumberOfHeads + - Format->StartHeadNumber) * driveMediaConstants->SectorsPerTrack * - driveMediaConstants->BytesPerSector; - - // - // Set the event object to the unsignaled state. - // It will be used to signal request completion. - // - - KeInitializeEvent(&event, NotificationEvent, FALSE); - - // - // Build the synchronous request with data transfer. - // - - irp = IoBuildSynchronousFsdRequest( - IRP_MJ_WRITE, - DeviceObject, - buffer, - length, - &offset, - &event, - &ioStatus); - - if (irp != NULL) { - status = IoCallDriver(DeviceObject, irp); - - if (status == STATUS_PENDING) { - - // - // Wait for the request to complete if necessary. - // - - KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL); - } - - // - // If the call driver suceeded then set the status to the status block. - // - - if (NT_SUCCESS(status)) { - status = ioStatus.Status; - } - } else { - status = STATUS_INSUFFICIENT_RESOURCES; - } - - ExFreePool(buffer); - - return(status); - -} - - -NTSTATUS -ScsiFlopRemoveDevice( - IN PDEVICE_OBJECT DeviceObject, - IN UCHAR Type - ) -/*++ - -Routine Description: - - This routine is responsible for releasing any resources in use by the - sfloppy driver. This routine is called - when all outstanding requests have been completed and the driver has - disappeared - no requests may be issued to the lower drivers. - -Arguments: - - DeviceObject - the device object being removed - - Type - the type of remove operation (QUERY, REMOVE or CANCEL) - -Return Value: - - for a query - success if the device can be removed or a failure code - indiciating why not. - - for a remove or cancel - STATUS_SUCCESS - ---*/ - -{ - PFUNCTIONAL_DEVICE_EXTENSION deviceExtension = - DeviceObject->DeviceExtension; - PDISK_DATA diskData = deviceExtension->CommonExtension.DriverData; - NTSTATUS status; - - PAGED_CODE(); - - if((Type == IRP_MN_QUERY_REMOVE_DEVICE) || - (Type == IRP_MN_CANCEL_REMOVE_DEVICE)) { - return STATUS_SUCCESS; - } - - if (Type == IRP_MN_REMOVE_DEVICE){ - if(deviceExtension->DeviceDescriptor) { - ExFreePool(deviceExtension->DeviceDescriptor); - deviceExtension->DeviceDescriptor = NULL; - } - - if(deviceExtension->AdapterDescriptor) { - ExFreePool(deviceExtension->AdapterDescriptor); - deviceExtension->AdapterDescriptor = NULL; - } - - if(deviceExtension->SenseData) { - ExFreePool(deviceExtension->SenseData); - deviceExtension->SenseData = NULL; - } - - ClassDeleteSrbLookasideList(&deviceExtension->CommonExtension); - } - - if(diskData->FloppyInterfaceString.Buffer != NULL) { - - status = IoSetDeviceInterfaceState( - &(diskData->FloppyInterfaceString), - FALSE); - - if (!NT_SUCCESS(status)) { - // Failed to disable device interface during removal. Not a fatal error. - DebugPrint((1, "ScsiFlopRemoveDevice: Unable to set device " - "interface state to FALSE for fdo %p " - "[%08lx]\n", - DeviceObject, status)); - } - - RtlFreeUnicodeString(&(diskData->FloppyInterfaceString)); - RtlInitUnicodeString(&(diskData->FloppyInterfaceString), NULL); - } - - if(Type == IRP_MN_REMOVE_DEVICE) { - IoGetConfigurationInformation()->FloppyCount--; - } - - return STATUS_SUCCESS; -} - - -NTSTATUS -ScsiFlopStopDevice( - IN PDEVICE_OBJECT DeviceObject, - IN UCHAR Type - ) -{ - UNREFERENCED_PARAMETER(DeviceObject); - UNREFERENCED_PARAMETER(Type); - - return STATUS_SUCCESS; -} - - -NTSTATUS -USBFlopGetMediaTypes( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ) -{ -/*++ - -Routine Description: - - This routines determines the current or default geometry of the drive - for IOCTL_DISK_GET_DRIVE_GEOMETRY, or all currently supported geometries - of the drive (which is determined by its currently inserted media) for - IOCTL_DISK_GET_MEDIA_TYPES. - - The returned geometries are determined by issuing a Read Format Capacities - request and then matching the returned {Number of Blocks, Block Length} - pairs in a table of known floppy geometries. - -Arguments: - - DeviceObject - Supplies the device object. - - Irp - A IOCTL_DISK_GET_DRIVE_GEOMETRY or a IOCTL_DISK_GET_MEDIA_TYPES Irp. - If NULL, the device geometry is updated with the current device - geometry. - -Return Value: - - Status is returned. - ---*/ - PFUNCTIONAL_DEVICE_EXTENSION fdoExtension; - PIO_STACK_LOCATION irpStack; - ULONG ioControlCode; - PDISK_GEOMETRY outputBuffer; - PDISK_GEOMETRY outputBufferEnd; - ULONG outputBufferLength; - PSCSI_REQUEST_BLOCK srb; - PVOID dataBuffer; - ULONG dataTransferLength; - struct _READ_FORMATTED_CAPACITIES *cdb; - PFORMATTED_CAPACITY_LIST capList; - NTSTATUS status; - - PAGED_CODE(); - - fdoExtension = DeviceObject->DeviceExtension; - - if (Irp != NULL) { - - // Get the Irp parameters - // - irpStack = IoGetCurrentIrpStackLocation(Irp); - - ioControlCode = irpStack->Parameters.DeviceIoControl.IoControlCode; - - Irp->IoStatus.Information = 0; - - outputBuffer = (PDISK_GEOMETRY) Irp->AssociatedIrp.SystemBuffer; - - outputBufferLength = irpStack->Parameters.DeviceIoControl.OutputBufferLength; - - if (outputBufferLength < sizeof(DISK_GEOMETRY)) - { - return STATUS_BUFFER_TOO_SMALL; - } - - // Pointer arithmetic to allow multiple DISK_GEOMETRY's to be returned. - // Rounds BufferEnd down to integral multiple of DISK_GEOMETRY structs. - // - outputBufferEnd = outputBuffer + - outputBufferLength / sizeof(DISK_GEOMETRY); - - } else { - - // No Irp to return the result in, just update the current geometry - // in the device extension. - // - ioControlCode = IOCTL_DISK_GET_DRIVE_GEOMETRY; - - outputBuffer = NULL; - - outputBufferEnd = NULL; - - outputBufferLength = 0; - } - - if (ioControlCode == IOCTL_DISK_GET_DRIVE_GEOMETRY) { - - fdoExtension->DiskGeometry.MediaType = Unknown; - - status = ClassReadDriveCapacity(DeviceObject); - - if (!NT_SUCCESS(status)) - { - // If the media is not recongized, we want to return the default - // geometry so that the media can be formatted. Unrecognized media - // causes SCSI_SENSE_MEDIUM_ERROR, which gets reported as - // STATUS_DEVICE_DATA_ERROR. Ignore these errors, but return other - // errors, such as STATUS_NO_MEDIA_IN_DEVICE. - // - if (status != STATUS_UNRECOGNIZED_MEDIA) - { - DebugPrint((2,"IOCTL_DISK_GET_DRIVE_GEOMETRY returns %08X\n", status)); - - return status; - } - } - } - - // Allocate an SRB for the SCSIOP_READ_FORMATTED_CAPACITY request - // - srb = ExAllocatePool(NonPagedPoolNx, SCSI_REQUEST_BLOCK_SIZE); - - if (srb == NULL) - { - return STATUS_INSUFFICIENT_RESOURCES; - } - - // Allocate a transfer buffer for the SCSIOP_READ_FORMATTED_CAPACITY request - // The length of the returned descriptor array is limited to a byte field - // in the capacity list header. - // - dataTransferLength = sizeof(FORMATTED_CAPACITY_LIST) + - 31 * sizeof(FORMATTED_CAPACITY_DESCRIPTOR); - - ASSERT(dataTransferLength < 0x100); - - dataBuffer = ExAllocatePool(NonPagedPoolNx, dataTransferLength); - - if (dataBuffer == NULL) - { - ExFreePool(srb); - return STATUS_INSUFFICIENT_RESOURCES; - } - - // Initialize the SRB and CDB - // - RtlZeroMemory(srb, SCSI_REQUEST_BLOCK_SIZE); - - RtlZeroMemory(dataBuffer, dataTransferLength); - - srb->CdbLength = sizeof(struct _READ_FORMATTED_CAPACITIES); - - srb->TimeOutValue = fdoExtension->TimeOutValue; - - cdb = (struct _READ_FORMATTED_CAPACITIES *)srb->Cdb; - - cdb->OperationCode = SCSIOP_READ_FORMATTED_CAPACITY; - cdb->AllocationLength[1] = (UCHAR)dataTransferLength; - - // - // Send down the SCSIOP_READ_FORMATTED_CAPACITY request - // - status = ClassSendSrbSynchronous(DeviceObject, - srb, - dataBuffer, - dataTransferLength, - FALSE); - - capList = (PFORMATTED_CAPACITY_LIST)dataBuffer; - - // If we don't get as much data as requested, it is not an error. - // - if (SRB_STATUS(srb->SrbStatus) == SRB_STATUS_DATA_OVERRUN) - { - status = STATUS_SUCCESS; - } - - if (NT_SUCCESS(status) && - srb->DataTransferLength >= sizeof(FORMATTED_CAPACITY_LIST) && - capList->CapacityListLength && - capList->CapacityListLength % sizeof(FORMATTED_CAPACITY_DESCRIPTOR) == 0) - { - ULONG NumberOfBlocks; - ULONG BlockLength; - ULONG count; - ULONG i, j; - LONG currentGeometry; - BOOLEAN capacityMatches[FLOPPY_CAPACITIES]; - - // Subtract the size of the Capacity List Header to get - // just the size of the Capacity List Descriptor array. - // - srb->DataTransferLength -= sizeof(FORMATTED_CAPACITY_LIST); - - // Only look at the Capacity List Descriptors that were actually - // returned. - // - if (srb->DataTransferLength < capList->CapacityListLength) - { - count = srb->DataTransferLength / - sizeof(FORMATTED_CAPACITY_DESCRIPTOR); - } - else - { - count = capList->CapacityListLength / - sizeof(FORMATTED_CAPACITY_DESCRIPTOR); - } - - // Updated only if a match is found for the first Capacity List - // Descriptor returned by the device. - // - currentGeometry = -1; - - // Initialize the array of capacities that hit a match. - // - RtlZeroMemory(capacityMatches, sizeof(capacityMatches)); - - // Iterate over each Capacity List Descriptor returned from the device - // and record matching capacities in the capacity match array. - // - for (i = 0; i < count; i++) - { - NumberOfBlocks = (capList->Descriptors[i].NumberOfBlocks[0] << 24) + - (capList->Descriptors[i].NumberOfBlocks[1] << 16) + - (capList->Descriptors[i].NumberOfBlocks[2] << 8) + - (capList->Descriptors[i].NumberOfBlocks[3]); - - BlockLength = (capList->Descriptors[i].BlockLength[0] << 16) + - (capList->Descriptors[i].BlockLength[1] << 8) + - (capList->Descriptors[i].BlockLength[2]); - - // Given the {NumberOfBlocks, BlockLength} from this Capacity List - // Descriptor, find a matching entry in FloppyCapacities[]. - // - for (j = 0; j < FLOPPY_CAPACITIES; j++) - { - if (NumberOfBlocks == FloppyCapacities[j].NumberOfBlocks && - BlockLength == FloppyCapacities[j].BlockLength) - { - // A matching capacity was found, record it. - // - capacityMatches[j] = TRUE; - - // A match was found for the first Capacity List - // Descriptor returned by the device. - // - if (i == 0) - { - currentGeometry = j; - } - } else if ((capList->Descriptors[i].Valid) && - (BlockLength == FloppyCapacities[j].BlockLength)) { - - ULONG inx; - ULONG mediaInx; - - // - // Check if this is 32MB media type. 32MB media - // reports variable NumberOfBlocks. So we cannot - // use that to determine the drive type - // - inx = DetermineDriveType(DeviceObject); - if (inx != DRIVE_TYPE_NONE) { - mediaInx = DriveMediaLimits[inx].HighestDriveMediaType; - if ((DriveMediaConstants[mediaInx].MediaType) - == F3_32M_512) { - capacityMatches[j] = TRUE; - - if (i == 0) { - currentGeometry = j; - } - } - } - } - } - } - - // Default status is STATUS_UNRECOGNIZED_MEDIA, unless we return - // either STATUS_SUCCESS or STATUS_BUFFER_OVERFLOW. - // - status = STATUS_UNRECOGNIZED_MEDIA; - - if (ioControlCode == IOCTL_DISK_GET_DRIVE_GEOMETRY) { - - if (currentGeometry != -1) - { - // Update the current device geometry - // - fdoExtension->DiskGeometry = FloppyGeometries[currentGeometry]; - - // - // Calculate sector to byte shift. - // - - WHICH_BIT(fdoExtension->DiskGeometry.BytesPerSector, - fdoExtension->SectorShift); - - fdoExtension->CommonExtension.PartitionLength.QuadPart = - (LONGLONG)FloppyCapacities[currentGeometry].NumberOfBlocks * - FloppyCapacities[currentGeometry].BlockLength; - - DebugPrint((2,"geometry is: %3d %2d %d %2d %4d %2d %08X\n", - fdoExtension->DiskGeometry.Cylinders.LowPart, - fdoExtension->DiskGeometry.MediaType, - fdoExtension->DiskGeometry.TracksPerCylinder, - fdoExtension->DiskGeometry.SectorsPerTrack, - fdoExtension->DiskGeometry.BytesPerSector, - fdoExtension->SectorShift, - fdoExtension->CommonExtension.PartitionLength.LowPart)); - - // Return the current device geometry - // - if (Irp != NULL) - { - *outputBuffer = FloppyGeometries[currentGeometry]; - - Irp->IoStatus.Information = sizeof(DISK_GEOMETRY); - } - - status = STATUS_SUCCESS; - } - - } else { - - // Iterate over the capacities and return the geometry - // corresponding to each matching Capacity List Descriptor - // returned from the device. - // - // The resulting list should be in sorted ascending order, - // assuming that the FloppyGeometries[] array is in sorted - // ascending order. - // - for (i = 0; i < FLOPPY_CAPACITIES; i++) - { - if (capacityMatches[i] && FloppyCapacities[i].CanFormat) - { - if (outputBuffer < outputBufferEnd) - { - *outputBuffer++ = FloppyGeometries[i]; - - Irp->IoStatus.Information += sizeof(DISK_GEOMETRY); - - DebugPrint((2,"geometry : %3d %2d %d %2d %4d\n", - FloppyGeometries[i].Cylinders.LowPart, - FloppyGeometries[i].MediaType, - FloppyGeometries[i].TracksPerCylinder, - FloppyGeometries[i].SectorsPerTrack, - FloppyGeometries[i].BytesPerSector)); - - status = STATUS_SUCCESS; - } - else - { - // We ran out of output buffer room before we ran out - // geometries to return. - // - status = STATUS_BUFFER_OVERFLOW; - } - } - } - } - } - else if (NT_SUCCESS(status)) - { - // The SCSIOP_READ_FORMATTED_CAPACITY request was successful, but - // returned data does not appear valid. - // - status = STATUS_UNSUCCESSFUL; - } - - ExFreePool(dataBuffer); - ExFreePool(srb); - - return status; -} - - -NTSTATUS -USBFlopFormatTracks( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ) -{ -/*++ - -Routine Description: - - This routines formats the specified tracks. If multiple tracks are - specified, each is formatted with a separate Format Unit request. - -Arguments: - - DeviceObject - Supplies the device object. - - Irp - A IOCTL_DISK_FORMAT_TRACKS Irp. - -Return Value: - - Status is returned. - ---*/ - PFUNCTIONAL_DEVICE_EXTENSION fdoExtension; - PIO_STACK_LOCATION irpStack; - PFORMAT_PARAMETERS formatParameters; - PDISK_GEOMETRY geometry; - PFORMATTED_CAPACITY capacity; - PSCSI_REQUEST_BLOCK srb; - PFORMAT_UNIT_PARAMETER_LIST parameterList; - PCDB12FORMAT cdb; - ULONG i; - ULONG cylinder, head; - NTSTATUS status = STATUS_SUCCESS; - - PAGED_CODE(); - - fdoExtension = DeviceObject->DeviceExtension; - - // Get the Irp parameters - // - irpStack = IoGetCurrentIrpStackLocation(Irp); - - if (irpStack->Parameters.DeviceIoControl.InputBufferLength < - sizeof(FORMAT_PARAMETERS)) - { - return STATUS_INVALID_PARAMETER; - } - - formatParameters = (PFORMAT_PARAMETERS)Irp->AssociatedIrp.SystemBuffer; - - // Find the geometry / capacity entries corresponding to the format - // parameters MediaType - // - geometry = NULL; - capacity = NULL; - - for (i=0; iMediaType) - { - geometry = &FloppyGeometries[i]; - capacity = &FloppyCapacities[i]; - - break; - } - } - - if (geometry == NULL) - { - return STATUS_INVALID_PARAMETER; - } - - // Check if the format parameters are valid - // - if ((formatParameters->StartCylinderNumber > - geometry->Cylinders.LowPart - 1) || - - (formatParameters->EndCylinderNumber > - geometry->Cylinders.LowPart - 1) || - - (formatParameters->StartHeadNumber > - geometry->TracksPerCylinder - 1) || - - (formatParameters->EndHeadNumber > - geometry->TracksPerCylinder - 1) || - - (formatParameters->StartCylinderNumber > - formatParameters->EndCylinderNumber) || - - (formatParameters->StartHeadNumber > - formatParameters->EndHeadNumber)) - { - return STATUS_INVALID_PARAMETER; - } - - // Don't low level format LS-120 media, Imation says it's best to not - // do this. - // - if ((formatParameters->MediaType == F3_120M_512) || - (formatParameters->MediaType == F3_240M_512) || - (formatParameters->MediaType == F3_32M_512)) - { - return STATUS_SUCCESS; - } - - // Allocate an SRB for the SCSIOP_FORMAT_UNIT request - // - srb = ExAllocatePool(NonPagedPoolNx, SCSI_REQUEST_BLOCK_SIZE); - - if (srb == NULL) - { - return STATUS_INSUFFICIENT_RESOURCES; - } - - // Allocate a transfer buffer for the SCSIOP_FORMAT_UNIT parameter list - // - parameterList = ExAllocatePool(NonPagedPoolNx, - sizeof(FORMAT_UNIT_PARAMETER_LIST)); - - if (parameterList == NULL) - { - ExFreePool(srb); - return STATUS_INSUFFICIENT_RESOURCES; - } - - // Initialize the parameter list - // - RtlZeroMemory(parameterList, sizeof(FORMAT_UNIT_PARAMETER_LIST)); - - parameterList->DefectListHeader.SingleTrack = 1; - parameterList->DefectListHeader.DisableCert = 1; // TEAC requires this set - parameterList->DefectListHeader.FormatOptionsValid = 1; - parameterList->DefectListHeader.DefectListLengthLsb = 8; - - parameterList->FormatDescriptor.NumberOfBlocks[0] = - (UCHAR)((capacity->NumberOfBlocks >> 24) & 0xFF); - - parameterList->FormatDescriptor.NumberOfBlocks[1] = - (UCHAR)((capacity->NumberOfBlocks >> 16) & 0xFF); - - parameterList->FormatDescriptor.NumberOfBlocks[2] = - (UCHAR)((capacity->NumberOfBlocks >> 8) & 0xFF); - - parameterList->FormatDescriptor.NumberOfBlocks[3] = - (UCHAR)(capacity->NumberOfBlocks & 0xFF); - - parameterList->FormatDescriptor.BlockLength[0] = - (UCHAR)((capacity->BlockLength >> 16) & 0xFF); - - parameterList->FormatDescriptor.BlockLength[1] = - (UCHAR)((capacity->BlockLength >> 8) & 0xFF); - - parameterList->FormatDescriptor.BlockLength[2] = - (UCHAR)(capacity->BlockLength & 0xFF); - - - for (cylinder = formatParameters->StartCylinderNumber; - cylinder <= formatParameters->EndCylinderNumber; - cylinder++) - { - for (head = formatParameters->StartHeadNumber; - head <= formatParameters->EndHeadNumber; - head++) - { - // Initialize the SRB and CDB - // - RtlZeroMemory(srb, SCSI_REQUEST_BLOCK_SIZE); - - srb->CdbLength = sizeof(CDB12FORMAT); - - srb->TimeOutValue = fdoExtension->TimeOutValue; - - cdb = (PCDB12FORMAT)srb->Cdb; - - cdb->OperationCode = SCSIOP_FORMAT_UNIT; - cdb->DefectListFormat = 7; - cdb->FmtData = 1; - cdb->TrackNumber = (UCHAR)cylinder; - cdb->ParameterListLengthLsb = sizeof(FORMAT_UNIT_PARAMETER_LIST); - - parameterList->DefectListHeader.Side = (UCHAR)head; - - // - // Send down the SCSIOP_FORMAT_UNIT request - // - status = ClassSendSrbSynchronous(DeviceObject, - srb, - parameterList, - sizeof(FORMAT_UNIT_PARAMETER_LIST), - TRUE); - - if (!NT_SUCCESS(status)) - { - break; - } - } - if (!NT_SUCCESS(status)) - { - break; - } - } - - if (NT_SUCCESS(status) && formatParameters->StartCylinderNumber == 0) - { - // Update the device geometry - // - - DebugPrint((2,"geometry was: %3d %2d %d %2d %4d %2d %08X\n", - fdoExtension->DiskGeometry.Cylinders.LowPart, - fdoExtension->DiskGeometry.MediaType, - fdoExtension->DiskGeometry.TracksPerCylinder, - fdoExtension->DiskGeometry.SectorsPerTrack, - fdoExtension->DiskGeometry.BytesPerSector, - fdoExtension->SectorShift, - fdoExtension->CommonExtension.PartitionLength.LowPart)); - - fdoExtension->DiskGeometry = *geometry; - - // - // Calculate sector to byte shift. - // - - WHICH_BIT(fdoExtension->DiskGeometry.BytesPerSector, - fdoExtension->SectorShift); - - fdoExtension->CommonExtension.PartitionLength.QuadPart = - (LONGLONG)capacity->NumberOfBlocks * - capacity->BlockLength; - - DebugPrint((2,"geometry is: %3d %2d %d %2d %4d %2d %08X\n", - fdoExtension->DiskGeometry.Cylinders.LowPart, - fdoExtension->DiskGeometry.MediaType, - fdoExtension->DiskGeometry.TracksPerCylinder, - fdoExtension->DiskGeometry.SectorsPerTrack, - fdoExtension->DiskGeometry.BytesPerSector, - fdoExtension->SectorShift, - fdoExtension->CommonExtension.PartitionLength.LowPart)); - } - - // Free everything we allocated - // - ExFreePool(parameterList); - ExFreePool(srb); - - return status; -} diff --git a/storage/sfloppy/src/sfloppy.inf b/storage/sfloppy/src/sfloppy.inf deleted file mode 100644 index 2f5c4bbd..00000000 --- a/storage/sfloppy/src/sfloppy.inf +++ /dev/null @@ -1,88 +0,0 @@ -; sfloppy.inf -; -; Installation inf for the Floppy Disk Driver (DDK Sample). -; -; (c) Copyright 2002 Microsoft -; -[Version] -Signature="$WINDOWS NT$" -Class=FloppyDisk -ClassGuid={4D36E980-E325-11CE-BFC1-08002BE10318} -Provider=%ProviderString% -CatalogFile=ddk_sample.cat -DriverVer=05/17/2002,5.2.3635.0 -PnpLockdown=1 - -;You must specify which platform is supported by each SourceDisksNames section -;Valid platform identifiers include .x86, .ia64, .alpha, .axp64 -[SourceDisksNames] -12=%floppyClassName%,,, - -;You must also specify which platform is supported by each SourceDisksFiles section -;Valid platform identifiers include .x86, .ia64, .alpha, .axp64 -[SourceDisksFiles] -sfloppy.sys=12 - -[ControlFlags] -ExcludeFromSelect=* - -[DestinationDirs] -sfloppy_copyfiles=12 -DefaultDestDir=12 - -[Manufacturer] -%ManufacturerName%=floppy_device,NTx86,NTia64,NTamd64 - -[floppy_device.NTx86] -%sfloppy_devdesc%=sfloppy_install,GenSFloppy -%sfloppy_devdesc%=sfloppy_install,SCSI\DiskMATSHITALS-120_COSM___04 -%sfloppy_devdesc%=sfloppy_install,SCSI\DiskCOMPAQ__LS-120_VER5___AB -%sfloppy_devdesc%=sfloppy_install,SCSI\DiskCOMPAQ__LS-120_HIMA___01 -%sfloppy_devdesc%=sfloppy_install,SCSI\DiskMATSHITALS-120_VER5___00 - -[floppy_device.NTia64] -%sfloppy_devdesc%=sfloppy_install,GenSFloppy -%sfloppy_devdesc%=sfloppy_install,SCSI\DiskMATSHITALS-120_COSM___04 -%sfloppy_devdesc%=sfloppy_install,SCSI\DiskCOMPAQ__LS-120_VER5___AB -%sfloppy_devdesc%=sfloppy_install,SCSI\DiskCOMPAQ__LS-120_HIMA___01 -%sfloppy_devdesc%=sfloppy_install,SCSI\DiskMATSHITALS-120_VER5___00 - -[floppy_device.NTamd64] -%sfloppy_devdesc%=sfloppy_install,GenSFloppy -%sfloppy_devdesc%=sfloppy_install,SCSI\DiskMATSHITALS-120_COSM___04 -%sfloppy_devdesc%=sfloppy_install,SCSI\DiskCOMPAQ__LS-120_VER5___AB -%sfloppy_devdesc%=sfloppy_install,SCSI\DiskCOMPAQ__LS-120_HIMA___01 -%sfloppy_devdesc%=sfloppy_install,SCSI\DiskMATSHITALS-120_VER5___00 - -;; -;; super floppy -;; -[sfloppy_install.NT] -CopyFiles=sfloppy_copyfiles - -[sfloppy_copyfiles] -sfloppy.sys - -[sfloppy_install.NT.Services] -AddService=sfloppy,2,sfloppy_ServiceInstallSection - -[sfloppy_ServiceInstallSection] -DisplayName=%sfloppy_devdesc% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary = %12%\sfloppy.sys - -[sfloppy_install.NT.HW] -AddReg=sfloppyEnable.RegHW - -[sfloppyEnable.RegHW] -HKR,,SuperFloppy,%REG_DWORD%,0x00000001 - -[Strings] -ProviderString="TODO-Set-Provider" -ManufacturerName="TODO-Set-Manufacturer" -floppyClassName="Floppy disk drives" -sfloppy_devdesc="High-Capacity Floppy Disk Drive" - -REG_DWORD=0x00010001 diff --git a/storage/sfloppy/src/sfloppy.rc b/storage/sfloppy/src/sfloppy.rc deleted file mode 100644 index efe6c05c..00000000 --- a/storage/sfloppy/src/sfloppy.rc +++ /dev/null @@ -1,23 +0,0 @@ -//+------------------------------------------------------------------------- -// -// Microsoft Windows -// -// Copyright (C) Microsoft Corporation, 1997 - 1999 -// -// File: sfloppy.rc -// -//-------------------------------------------------------------------------- - -#include - -#include - -#define VER_FILETYPE VFT_DRV -#define VER_FILESUBTYPE VFT2_DRV_SYSTEM -#define VER_FILEDESCRIPTION_STR "SCSI Floppy Driver" -#define VER_INTERNALNAME_STR "sfloppy.sys" -#define VER_ORIGINALFILENAME_STR "sfloppy.sys" -#define VER_LANGNEUTRAL - -#include "common.ver" - diff --git a/storage/sfloppy/src/sfloppy.vcxproj b/storage/sfloppy/src/sfloppy.vcxproj deleted file mode 100644 index abcc78d0..00000000 --- a/storage/sfloppy/src/sfloppy.vcxproj +++ /dev/null @@ -1,192 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {97D2E67D-8E5F-43CD-B8EB-C5DBB43C7EB7} - $(MSBuildProjectName) - false - Debug - Win32 - {6B097D1A-972A-41E8-A5C4-3691455FBB8B} - - - - Windows10 - False - Universal - WDM - WindowsKernelModeDriver10.0 - Driver - - - Windows10 - True - Universal - WDM - WindowsKernelModeDriver10.0 - Driver - - - Windows10 - False - Universal - WDM - WindowsKernelModeDriver10.0 - Driver - - - Windows10 - True - Universal - WDM - WindowsKernelModeDriver10.0 - Driver - - - - $(IntDir) - - - - - - - - - - - - - - - - sfloppy - - - sfloppy - - - sfloppy - - - sfloppy - - - - %(AdditionalDependencies);$(DDK_LIB_PATH)\classpnp.lib - - - %(AdditionalIncludeDirectories);..\inc - - - %(AdditionalIncludeDirectories);..\inc - true - Level4 - - - - - %(AdditionalIncludeDirectories);..\inc - - - sha256 - - - - - %(AdditionalDependencies);$(DDK_LIB_PATH)\classpnp.lib - - - %(AdditionalIncludeDirectories);..\inc - - - %(AdditionalIncludeDirectories);..\inc - true - Level4 - - - - - %(AdditionalIncludeDirectories);..\inc - - - sha256 - - - - - %(AdditionalDependencies);$(DDK_LIB_PATH)\classpnp.lib - - - %(AdditionalIncludeDirectories);..\inc - - - %(AdditionalIncludeDirectories);..\inc - true - Level4 - - - - - %(AdditionalIncludeDirectories);..\inc - - - sha256 - - - - - %(AdditionalDependencies);$(DDK_LIB_PATH)\classpnp.lib - - - %(AdditionalIncludeDirectories);..\inc - - - %(AdditionalIncludeDirectories);..\inc - true - Level4 - - - - - %(AdditionalIncludeDirectories);..\inc - - - sha256 - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/storage/sfloppy/src/sfloppy.vcxproj.Filters b/storage/sfloppy/src/sfloppy.vcxproj.Filters deleted file mode 100644 index c1d47f3d..00000000 --- a/storage/sfloppy/src/sfloppy.vcxproj.Filters +++ /dev/null @@ -1,36 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {4BC320E9-22F6-4E58-8E7B-B87F90A2226B} - - - h;hpp;hxx;hm;inl;inc;xsd - {1B1144FD-B9FD-45E0-846D-0C0A89430459} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {BC1B1BDB-FAE7-4C16-A4B2-EBDC273AB7BC} - - - inf;inv;inx;mof;mc; - {3AF8BBF9-34B1-4CEA-8BC6-305FB857F626} - - - - - Source Files - - - - - Resource Files - - - - - Driver Files - - - \ No newline at end of file -- cgit v1.3.1 From e4fec231def3b751b0f717855737317a4a2edbac Mon Sep 17 00:00:00 2001 From: katiezb <115045945+katiezb@users.noreply.github.com> Date: Wed, 1 Mar 2023 10:34:21 -0800 Subject: Archiving storage\class\cdrom sample (#904) The following sample is being archived but can still be accessed using: git checkout win11-22h2 or by accessing this link: https://github.com/microsoft/Windows-driver-samples/tree/win11-22h2 --- storage/class/cdrom/README.md | 74 - storage/class/cdrom/cdrom.sln | 28 - storage/class/cdrom/src/aacs.c | 1481 ---- storage/class/cdrom/src/autorun.c | 3072 --------- storage/class/cdrom/src/cdrom.c | 4225 ------------ storage/class/cdrom/src/cdrom.h | 1609 ----- storage/class/cdrom/src/cdrom.inf | Bin 8366 -> 0 bytes storage/class/cdrom/src/cdrom.rc | 23 - storage/class/cdrom/src/cdrom.vcxproj | 168 - storage/class/cdrom/src/cdrom.vcxproj.Filters | 72 - storage/class/cdrom/src/cdromp.h | 383 -- storage/class/cdrom/src/common.c | 3872 ----------- storage/class/cdrom/src/data.c | 283 - storage/class/cdrom/src/guid.c | 16 - storage/class/cdrom/src/init.c | 2740 -------- storage/class/cdrom/src/ioctl.c | 9132 ------------------------- storage/class/cdrom/src/ioctl.h | 847 --- storage/class/cdrom/src/localwpp.ini | 17 - storage/class/cdrom/src/mmc.c | 1629 ----- storage/class/cdrom/src/mmc.h | 122 - storage/class/cdrom/src/pnppower.c | 684 -- storage/class/cdrom/src/scratch.c | 1463 ---- storage/class/cdrom/src/scratch.h | 187 - storage/class/cdrom/src/sense.c | 2600 ------- storage/class/cdrom/src/zpodd.c | 823 --- 25 files changed, 35550 deletions(-) delete mode 100644 storage/class/cdrom/README.md delete mode 100644 storage/class/cdrom/cdrom.sln delete mode 100644 storage/class/cdrom/src/aacs.c delete mode 100644 storage/class/cdrom/src/autorun.c delete mode 100644 storage/class/cdrom/src/cdrom.c delete mode 100644 storage/class/cdrom/src/cdrom.h delete mode 100644 storage/class/cdrom/src/cdrom.inf delete mode 100644 storage/class/cdrom/src/cdrom.rc delete mode 100644 storage/class/cdrom/src/cdrom.vcxproj delete mode 100644 storage/class/cdrom/src/cdrom.vcxproj.Filters delete mode 100644 storage/class/cdrom/src/cdromp.h delete mode 100644 storage/class/cdrom/src/common.c delete mode 100644 storage/class/cdrom/src/data.c delete mode 100644 storage/class/cdrom/src/guid.c delete mode 100644 storage/class/cdrom/src/init.c delete mode 100644 storage/class/cdrom/src/ioctl.c delete mode 100644 storage/class/cdrom/src/ioctl.h delete mode 100644 storage/class/cdrom/src/localwpp.ini delete mode 100644 storage/class/cdrom/src/mmc.c delete mode 100644 storage/class/cdrom/src/mmc.h delete mode 100644 storage/class/cdrom/src/pnppower.c delete mode 100644 storage/class/cdrom/src/scratch.c delete mode 100644 storage/class/cdrom/src/scratch.h delete mode 100644 storage/class/cdrom/src/sense.c delete mode 100644 storage/class/cdrom/src/zpodd.c diff --git a/storage/class/cdrom/README.md b/storage/class/cdrom/README.md deleted file mode 100644 index 4b081014..00000000 --- a/storage/class/cdrom/README.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -page_type: sample -description: "Provide access to CD, DVD and Blu-ray drives, supports Plug and Play, Power Management, and AutoRun (media change notification)." -languages: -- cpp -products: -- windows -- windows-wdk ---- - -# CDROM Storage Class Driver - -The CD ROM driver is used to provide access to CD, DVD and Blu-ray drives. It supports Plug and Play, Power Management, and AutoRun (media change notification). - -## Build the sample - -You can build the sample in two ways: using Microsoft Visual Studio or the command line (*MSBuild*). - -> [!NOTE] -> When building in Visual Studio, INFVerifer will throw errors. This is intended. Fix those errors with your custom values to build successfully. - -## Building a Driver Using Visual Studio - -You build a driver the same way you build any project or solution in Visual Studio. When you create a new driver project using a Windows driver template, the template defines a default (active) project configuration and a default (active) solution build configuration. When you create a project from existing driver sources or convert existing driver code that was built with previous versions of the WDK, the conversion process preserves the target version information (operating systems and platform). - -The default Solution build configuration is Visual Studio Debug and Win32. - -1. Open the driver project or solution in Visual Studio (find *samplename*.sln or *samplename*.vcxproj). - -1. Right-click the solution in the **Solutions Explorer** and select **Configuration Manager**. - -1. From the **Configuration Manager**, select the **Active Solution Configuration** (for example, Debug or Release) and the **Active Solution Platform** (for example, Win32) that correspond to the type of build you are interested in. - -1. From the Build menu, click **Build Solution** (Ctrl+Shift+B). - -## Building a Driver Using the Command Line (MSBuild) - -You can build a driver from the command line using the Visual Studio Command Prompt window and the Microsoft Build Engine (MSBuild.exe) Previous versions of the WDK used the Windows Build utility (Build.exe) and provided separate build environment windows for each of the supported build configurations. You can now use the Visual Studio Command Prompt window for all build configurations. - -1. Open a Visual Studio Command Prompt window at the **Start** screen. From this window you can use MsBuild.exe to build any Visual Studio project by specifying the project (.VcxProj) or solutions (.Sln) file. - -1. Navigate to the project directory and enter the **MSbuild** command for your target. For example, to perform a clean build of a Visual Studio driver project called *filtername*.vcxproj, navigate to the project directory and enter the following MSBuild command: - - `msbuild /t:clean /t:build .\.vcxproj` - -## Installation and Operation - -The in-box CD ROM driver is protected by the system, and thus a normal device driver update attempt through the Device Manager will fail. Users are not encouraged to replace the in-box CD ROM driver. The following work-around is provided in case there is a need, but the users are warned that this may harm the system. - -1. Locate the "cdrom.inf" file in the binary output directory, and update the file by replacing all "cdrom.sys" occurrences with "mycdrom.sys". - -1. Rename the "cdrom.inf" file to "mycdrom.inf". - -1. Copy "mycdrom.sys" and "mycdrom.inf" from the binary output directory to the test machine, if applicable. - -1. Launch the Device Manager - -1. Select the appropriate device under the "DVD/CD-ROM drives" category. - -1. On the right-click menu, select "Update Driver Software...". - -1. Select "Browse my computer for driver software". - -1. Select "Let me pick from a list of device drivers on my computer". - -1. Click "Have Disk...", and point to the directory that contains "mycdrom.inf" and "mycdrom.sys". - -1. Click "Next". If you get a warning dialog about installing unsigned driver, click "Yes". - -1. Click "Next" to complete the driver upgrade. - -1. After installation completes successfully, "mycdrom.sys" will be the effective driver for the device, "cdrom.sys" will no longer be used. - -For more information, see [CD-ROM Drivers](https://docs.microsoft.com/windows-hardware/drivers/storage/cd-rom-drivers) in the storage technologies design guide. diff --git a/storage/class/cdrom/cdrom.sln b/storage/class/cdrom/cdrom.sln deleted file mode 100644 index 4516f3dc..00000000 --- a/storage/class/cdrom/cdrom.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0 -MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdrom", "src\cdrom.vcxproj", "{9DB6E759-C294-4E18-9013-82FD8F3DD5E6}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9DB6E759-C294-4E18-9013-82FD8F3DD5E6}.Debug|Win32.ActiveCfg = Debug|Win32 - {9DB6E759-C294-4E18-9013-82FD8F3DD5E6}.Debug|Win32.Build.0 = Debug|Win32 - {9DB6E759-C294-4E18-9013-82FD8F3DD5E6}.Release|Win32.ActiveCfg = Release|Win32 - {9DB6E759-C294-4E18-9013-82FD8F3DD5E6}.Release|Win32.Build.0 = Release|Win32 - {9DB6E759-C294-4E18-9013-82FD8F3DD5E6}.Debug|x64.ActiveCfg = Debug|x64 - {9DB6E759-C294-4E18-9013-82FD8F3DD5E6}.Debug|x64.Build.0 = Debug|x64 - {9DB6E759-C294-4E18-9013-82FD8F3DD5E6}.Release|x64.ActiveCfg = Release|x64 - {9DB6E759-C294-4E18-9013-82FD8F3DD5E6}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/storage/class/cdrom/src/aacs.c b/storage/class/cdrom/src/aacs.c deleted file mode 100644 index 191ba6b0..00000000 --- a/storage/class/cdrom/src/aacs.c +++ /dev/null @@ -1,1481 +0,0 @@ -/*-- - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - aacs.c - -Abstract: - - The CDROM class driver implementation of handling AACS IOCTLs. - -Environment: - - kernel mode only - -Notes: - - -Revision History: - ---*/ - -#include "stddef.h" -#include "string.h" - -#include "ntddk.h" -#include "ntddstor.h" -#include "cdrom.h" -#include "ioctl.h" -#include "scratch.h" - -#ifdef DEBUG_USE_WPP -#include "aacs.tmh" -#endif - -#ifdef ALLOC_PRAGMA - -#pragma alloc_text(PAGE, DeviceHandleAacsReadMediaKeyBlock) -#pragma alloc_text(PAGE, DeviceHandleAacsStartSession) -#pragma alloc_text(PAGE, DeviceHandleAacsEndSession) -#pragma alloc_text(PAGE, DeviceHandleAacsSendCertificate) -#pragma alloc_text(PAGE, DeviceHandleAacsGetCertificate) -#pragma alloc_text(PAGE, DeviceHandleAacsGetChallengeKey) -#pragma alloc_text(PAGE, DeviceHandleAacsReadSerialNumber) -#pragma alloc_text(PAGE, DeviceHandleAacsReadMediaId) -#pragma alloc_text(PAGE, DeviceHandleAacsReadBindingNonce) -#pragma alloc_text(PAGE, DeviceHandleAacsGenerateBindingNonce) -#pragma alloc_text(PAGE, DeviceHandleReadVolumeId) -#pragma alloc_text(PAGE, DeviceHandleSendChallengeKey) - -#endif - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsReadMediaKeyBlock( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - This routine is used to process IOCTLs: - IOCTL_AACS_READ_MEDIA_KEY_BLOCK_SIZE - IOCTL_AACS_READ_MEDIA_KEY_BLOCK -Arguments: - DeviceExtension - device context - - Request - the request that will be formatted - - RequestParameters - request parameter structur - - DataLength - data transferred length - -Return Value: - NTSTATUS - - --*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PAACS_LAYER_NUMBER layerNumber = NULL; - PVOID outputBuffer = NULL; - ULONG transferSize = sizeof(READ_DVD_STRUCTURES_HEADER); - - PAGED_CODE(); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&layerNumber, - NULL); - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - (PVOID*)&outputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (RequestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_AACS_READ_MEDIA_KEY_BLOCK) - { - // maximum size for this transfer is one pack + header - transferSize += AACS_MKB_PACK_SIZE; - } - - if (transferSize > DeviceExtension->ScratchContext.ScratchBufferSize) - { - // rare case. normally the size of scratch buffer is 64k. - status = STATUS_INTERNAL_ERROR; - } - } - - if (NT_SUCCESS(status)) - { - UCHAR rmdBlockNumber = 0; - BOOLEAN sendChangedCommand = TRUE; - BOOLEAN shouldRetry = TRUE; - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.READ_DVD_STRUCTURE.OperationCode = SCSIOP_READ_DVD_STRUCTURE; - // cdb->AsByte[1] = 0x01; // AACS sub-command not required for this - - cdb.READ_DVD_STRUCTURE.LayerNumber = (UCHAR)(*layerNumber); - cdb.READ_DVD_STRUCTURE.Format = 0x83; // MKB - cdb.READ_DVD_STRUCTURE.AllocationLength[0] = (UCHAR)(transferSize >> (8*1)); - cdb.READ_DVD_STRUCTURE.AllocationLength[1] = (UCHAR)(transferSize >> (8*0)); - - while (sendChangedCommand) - { - // RMDBlockNumber is set to zero.... - // RMDBlockNumber[3] maybe changed for other blocks. - cdb.READ_DVD_STRUCTURE.RMDBlockNumber[3] = rmdBlockNumber; - - if (shouldRetry) - { - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, transferSize, TRUE, &cdb, 12); - } - - #ifdef ENABLE_AACS_TESTING - if (RequestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_AACS_READ_MEDIA_KEY_BLOCK_SIZE) - { - static const UCHAR results[] = { 0x80, 0x02, 0x00, 0x02 }; - RtlCopyMemory(DeviceExtension->ScratchContext.ScratchBuffer, results, SIZEOF_ARRAY(results)); - status = STATUS_SUCCESS; - } - else if (RequestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_AACS_READ_MEDIA_KEY_BLOCK) - { - static const UCHAR results[] = { 0x80, 0x02, 0x00, 0x02 }; - static const UCHAR defaultFill = 0x30; // '0' - RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x8004, defaultFill); - RtlCopyMemory(DeviceExtension->ScratchContext.ScratchBuffer, results, SIZEOF_ARRAY(results)); - status = STATUS_SUCCESS; - } - #endif //ENABLE_AACS_TESTING - - if (NT_SUCCESS(status)) - { - // command succeeded, process data... - PDVD_DESCRIPTOR_HEADER header = DeviceExtension->ScratchContext.ScratchBuffer; - UCHAR thisPackNumber = cdb.READ_DVD_STRUCTURE.RMDBlockNumber[3]; - UCHAR otherPacks = header->Reserved[1]; - - // validate and zero-base the otherPacks - if (otherPacks == 0) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "AACS: Device is reporting zero total packs (invalid)\n")); - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - else - { - otherPacks--; - - if (RequestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_AACS_READ_MEDIA_KEY_BLOCK_SIZE) - { - // if not already requested last pack, do so now - if (otherPacks != thisPackNumber) - { - // re-send the command for the other pack number. - // this is safe here because NT_SUCCESS() is TRUE, - // and all the rest of this routine does is SetHardError() - // and release of resources we're still about to use. - - // re-zero the output buffer - RtlZeroMemory(DeviceExtension->ScratchContext.ScratchBuffer, sizeof(READ_DVD_STRUCTURES_HEADER)); - - // modify the CDB to get the very last pack of the MKB - rmdBlockNumber = otherPacks; - - transferSize = sizeof(READ_DVD_STRUCTURES_HEADER); - - // keep items clean - ScratchBuffer_ResetItems(DeviceExtension, TRUE); - - // make sure the loop will be executed for modified command. - sendChangedCommand = TRUE; - shouldRetry = TRUE; - } - else - { - // this request already got the last pack - // so just interpret the data - REVERSE_SHORT(&header->Length); - if (header->Length < sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length)) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - else - { - ULONG totalSize = header->Length; - // subtract out any remaining bytes in the header - // to get the number of usable bytes in this pack - totalSize -= sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length); - totalSize += otherPacks * AACS_MKB_PACK_SIZE; - - // save the result and complete the request - *((PULONG)outputBuffer) = totalSize; - *DataLength = sizeof(ULONG); - status = STATUS_SUCCESS; - } - // This will exit the loop of sendChangedCommand - sendChangedCommand = FALSE; - shouldRetry = FALSE; - } - } - else if (RequestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_AACS_READ_MEDIA_KEY_BLOCK) - { - // make length field native byte ordering - REVERSE_SHORT(&header->Length); - - // exit if getting invalid data from the drive - if (header->Length < sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length)) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - else - { - // success, how many bytes to copy for this pack? - ULONG totalSize = header->Length; - size_t originalBufferSize; - - // subtract out any remaining bytes in the header - // to get the number of usable bytes in this pack - totalSize -= sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length); - - // if not the final pack, this should be a full transfer per spec - NT_ASSERT( (totalSize == AACS_MKB_PACK_SIZE) || (thisPackNumber == otherPacks) ); - - // validate the user's buffer is large enough to accept the full data - originalBufferSize = RequestParameters.Parameters.DeviceIoControl.OutputBufferLength; - - if (originalBufferSize < (totalSize + (AACS_MKB_PACK_SIZE*thisPackNumber))) - { - // just return a slightly bigger-than-normal size - *DataLength = (otherPacks + 1)*AACS_MKB_PACK_SIZE; - status = STATUS_BUFFER_TOO_SMALL; - } - else - { - PUCHAR whereToCopy; - // determine where to copy to the user's memory - whereToCopy = outputBuffer; - whereToCopy += AACS_MKB_PACK_SIZE * thisPackNumber; - - RtlCopyMemory(whereToCopy, header->Data, totalSize); - - // update the Information field here because we already - // have calculated the size of the block - *DataLength = totalSize + (AACS_MKB_PACK_SIZE * thisPackNumber); - status = STATUS_SUCCESS; - - // if there are more packs to get from the device, send it again.... - if (thisPackNumber != otherPacks) - { - // re-send the command for the next pack number. - // this is safe here because NT_SUCCESS() is TRUE, - // and all the rest of this routine does is SetHardError() - // and release of resources we're still about to use. - - // re-zero the output buffer - RtlZeroMemory(DeviceExtension->ScratchContext.ScratchBuffer, sizeof(READ_DVD_STRUCTURES_HEADER)); - - // modify the CDB to get the next pack of the MKB - rmdBlockNumber = cdb.READ_DVD_STRUCTURE.RMDBlockNumber[3]++; - - // modify the SRB to be resent - // - transferSize = AACS_MKB_PACK_SIZE + sizeof(READ_DVD_STRUCTURES_HEADER); - - // keep items clean - ScratchBuffer_ResetItems(DeviceExtension, FALSE); - - // make sure the loop will be executed for modified command. - sendChangedCommand = TRUE; - shouldRetry = TRUE; - } - else - { - // else, that was the end of the transfer, so just complete the request - sendChangedCommand = FALSE; - } - } - } - - } // end of IOCTL_AACS_READ_MEDIA_KEY_BLOCK - } - } // end of NT_SUCCESS(status) - - if (!NT_SUCCESS(status)) - { - // command failed. - sendChangedCommand = FALSE; - } - } //end of while (sendChangedCommand) - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsStartSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - This routine is used to process IOCTL: - IOCTL_AACS_START_SESSION -Arguments: - DeviceExtension - device context - - Request - the request that will be formatted - - RequestParameters - request parameter structur - - DataLength - data transferred length - -Return Value: - NTSTATUS - - --*/ -{ - //AacsGetAgid - - NTSTATUS status = STATUS_SUCCESS; - PDVD_SESSION_ID sessionId = NULL; - - PAGED_CODE(); - - *DataLength = 0; - - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - (PVOID*)&sessionId, - NULL); - - if (NT_SUCCESS(status)) - { - ULONG dataTransferLength = sizeof(CDVD_KEY_HEADER) + sizeof(CDVD_REPORT_AGID_DATA); - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.REPORT_KEY.OperationCode = SCSIOP_REPORT_KEY; - cdb.AsByte[7] = 0x02; // AACS key class - cdb.REPORT_KEY.AllocationLength[0] = (UCHAR)(dataTransferLength >> (8*1)); - cdb.REPORT_KEY.AllocationLength[1] = (UCHAR)(dataTransferLength >> (8*0)); - cdb.REPORT_KEY.KeyFormat = 0x00; // DVD_REPORT_AGID? - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, dataTransferLength, TRUE, &cdb, 12); - -#ifdef ENABLE_AACS_TESTING - static const UCHAR results[] = { 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0 }; - RtlCopyMemory(DeviceExtension->ScratchContext.ScratchBuffer, results, SIZEOF_ARRAY(results)); - status = STATUS_SUCCESS; -#endif - if (NT_SUCCESS(status)) - { - PCDVD_KEY_HEADER keyHeader = DeviceExtension->ScratchContext.ScratchBuffer; - PCDVD_REPORT_AGID_DATA keyData = (PCDVD_REPORT_AGID_DATA)keyHeader->Data; - - *sessionId = (DVD_SESSION_ID)(keyData->AGID); - *DataLength = sizeof(DVD_SESSION_ID); - } - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsEndSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - This routine is used to process IOCTL: - IOCTL_AACS_END_SESSION -Arguments: - DeviceExtension - device context - - Request - the request that will be formatted - - RequestParameters - request parameter structur - - DataLength - data transferred length - -Return Value: - NTSTATUS - - --*/ -{ - //AacsReleaseAgid - - NTSTATUS status = STATUS_SUCCESS; - PDVD_SESSION_ID sessionId = NULL; - - PAGED_CODE(); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&sessionId, - NULL); - - if (NT_SUCCESS(status)) - { - ULONG transferSize = 0; - CDB cdb; - DVD_SESSION_ID currentSession = 0; - DVD_SESSION_ID limitSession = 0; - - if(*sessionId == DVD_END_ALL_SESSIONS) - { - currentSession = 0; - limitSession = MAX_COPY_PROTECT_AGID - 1; - } - else - { - currentSession = *sessionId; - limitSession = *sessionId; - } - - ScratchBuffer_BeginUse(DeviceExtension); - - do - { - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.SEND_KEY.OperationCode = SCSIOP_SEND_KEY; - cdb.AsByte[7] = 0x02; // AACS key class - cdb.SEND_KEY.AGID = (UCHAR)(currentSession); - cdb.SEND_KEY.KeyFormat = DVD_INVALIDATE_AGID; - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, transferSize, FALSE, &cdb, 12); - - currentSession++; - } while ((currentSession <= limitSession) && NT_SUCCESS(status)); - -#ifdef ENABLE_AACS_TESTING - status = STATUS_SUCCESS; -#endif - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsSendCertificate( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - This routine is used to process IOCTL: - IOCTL_AACS_SEND_CERTIFICATE -Arguments: - DeviceExtension - device context - - Request - the request that will be formatted - - RequestParameters - request parameter structur - - DataLength - data transferred length - -Return Value: - NTSTATUS - - --*/ -{ - //AacsSendHostCertificate - - NTSTATUS status = STATUS_SUCCESS; - PAACS_SEND_CERTIFICATE input = NULL; - - PAGED_CODE(); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&input, - NULL); - - if (NT_SUCCESS(status)) - { - ULONG dataTransferLength = sizeof(CDVD_KEY_HEADER) + sizeof(AACS_CERTIFICATE); - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - // copy the input buffer to the data buffer for the transfer - { - PCDVD_KEY_HEADER header = (PCDVD_KEY_HEADER)DeviceExtension->ScratchContext.ScratchBuffer; - ULONG tmp = dataTransferLength; - - tmp -= RTL_SIZEOF_THROUGH_FIELD(CDVD_KEY_HEADER, DataLength); - - header->DataLength[0] = (UCHAR)(tmp >> (8*1)); - header->DataLength[1] = (UCHAR)(tmp >> (8*0)); - RtlCopyMemory(header->Data, &(input->Certificate), sizeof(AACS_CERTIFICATE)); - } - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.SEND_KEY.OperationCode = SCSIOP_SEND_KEY; - cdb.AsByte[7] = 0x02; // AACS key class - cdb.SEND_KEY.ParameterListLength[0] = (UCHAR)(dataTransferLength >> (8*1)); - cdb.SEND_KEY.ParameterListLength[1] = (UCHAR)(dataTransferLength >> (8*0)); - cdb.SEND_KEY.AGID = (UCHAR)( input->SessionId ); - cdb.SEND_KEY.KeyFormat = 0x01; // Send Host Challenge Certificate - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, dataTransferLength, FALSE, &cdb, 12); - -#ifdef ENABLE_AACS_TESTING - status = STATUS_SUCCESS; -#endif - if (NT_SUCCESS(status)) - { - *DataLength = 0; - } - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsGetCertificate( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - This routine is used to process IOCTL: - IOCTL_AACS_GET_CERTIFICATE -Arguments: - DeviceExtension - device context - - Request - the request that will be formatted - - RequestParameters - request parameter structur - - DataLength - data transferred length - -Return Value: - NTSTATUS - - --*/ -{ - //AacsGetDriveCertificate - - NTSTATUS status = STATUS_SUCCESS; - PDVD_SESSION_ID input = NULL; - PVOID outputBuffer = NULL; - - PAGED_CODE(); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&input, - NULL); - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - (PVOID*)&outputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - ULONG dataTransferLength = sizeof(CDVD_KEY_HEADER) + sizeof(AACS_CERTIFICATE); - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.REPORT_KEY.OperationCode = SCSIOP_REPORT_KEY; - cdb.AsByte[7] = 0x02; // AACS key class - cdb.REPORT_KEY.AllocationLength[0] = (UCHAR)(dataTransferLength >> (8*1)); - cdb.REPORT_KEY.AllocationLength[1] = (UCHAR)(dataTransferLength >> (8*0)); - cdb.REPORT_KEY.AGID = (UCHAR)(*input); - cdb.REPORT_KEY.KeyFormat = 0x01; // Return a drive certificate challenge - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, dataTransferLength, TRUE, &cdb, 12); - -#ifdef ENABLE_AACS_TESTING - static const UCHAR results[] = { 0x00, 0x72, 0x00, 0x00 }; - static const UCHAR defaultFill = 0x31; // '1' - RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x0074, defaultFill); - RtlCopyMemory(DeviceExtension->ScratchContext.ScratchBuffer, results, SIZEOF_ARRAY(results)); - status = STATUS_SUCCESS; -#endif - if (NT_SUCCESS(status)) - { - PDVD_DESCRIPTOR_HEADER header = DeviceExtension->ScratchContext.ScratchBuffer; - ULONG dataLengthToCopy = sizeof(AACS_CERTIFICATE); - - // make length field native byte ordering - REVERSE_SHORT(&header->Length); - - // exit if getting invalid data from the drive - if (header->Length < (sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length))) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - - if (NT_SUCCESS(status)) - { - // adjust data length to reflect only the addition data - header->Length -= sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length); - - // exit if the drive is returning an unexpected data size - if (header->Length != dataLengthToCopy) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - } - - if (NT_SUCCESS(status)) - { - // else copy the data to the user's buffer - RtlCopyMemory(outputBuffer, header->Data, dataLengthToCopy); - *DataLength = dataLengthToCopy; - } - } - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsGetChallengeKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - This routine is used to process IOCTL: - IOCTL_AACS_GET_CHALLENGE_KEY -Arguments: - DeviceExtension - device context - - Request - the request that will be formatted - - RequestParameters - request parameter structur - - DataLength - data transferred length - -Return Value: - NTSTATUS - - --*/ -{ - //AacsGetChallengeKey - - NTSTATUS status = STATUS_SUCCESS; - PDVD_SESSION_ID input = NULL; - PVOID outputBuffer = NULL; - - PAGED_CODE(); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&input, - NULL); - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - (PVOID*)&outputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - ULONG dataTransferLength = sizeof(CDVD_KEY_HEADER) + sizeof(AACS_CHALLENGE_KEY); - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.REPORT_KEY.OperationCode = SCSIOP_REPORT_KEY; - cdb.AsByte[7] = 0x02; // AACS key class - cdb.REPORT_KEY.AllocationLength[0] = (UCHAR)(dataTransferLength >> (8*1)); - cdb.REPORT_KEY.AllocationLength[1] = (UCHAR)(dataTransferLength >> (8*0)); - cdb.REPORT_KEY.AGID = (UCHAR)(*input); - cdb.REPORT_KEY.KeyFormat = 0x02; // Return a drive certificate challenge - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, dataTransferLength, TRUE, &cdb, 12); - -#ifdef ENABLE_AACS_TESTING - static const UCHAR results[] = { 0x00, 0x52, 0x00, 0x00 }; - static const UCHAR defaultFill = 0x32; // '2' - RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x0054, defaultFill); - RtlCopyMemory(DeviceExtension->ScratchContext.ScratchBuffer, results, SIZEOF_ARRAY(results)); - status = STATUS_SUCCESS; -#endif - if (NT_SUCCESS(status)) - { - PDVD_DESCRIPTOR_HEADER header = DeviceExtension->ScratchContext.ScratchBuffer; - ULONG dataLengthToCopy = sizeof(AACS_CHALLENGE_KEY); - - // make length field native byte ordering - REVERSE_SHORT(&header->Length); - - // exit if getting invalid data from the drive - if (header->Length < sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length)) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - - if (NT_SUCCESS(status)) - { - // adjust data length to reflect only the addition data - header->Length -= sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length); - - // exit if the drive is returning an unexpected data size - if (header->Length != dataLengthToCopy) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - } - - if (NT_SUCCESS(status)) - { - // else copy the data to the user's buffer - RtlCopyMemory(outputBuffer, header->Data, dataLengthToCopy); - *DataLength = dataLengthToCopy; - } - } - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleSendChallengeKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - This routine is used to process IOCTL: - IOCTL_AACS_SEND_CHALLENGE_KEY -Arguments: - DeviceExtension - device context - - Request - the request that will be formatted - - RequestParameters - request parameter structur - - DataLength - data transferred length - -Return Value: - NTSTATUS - - --*/ -{ - //AacsSendChallengeKey - - NTSTATUS status = STATUS_SUCCESS; - PAACS_SEND_CHALLENGE_KEY input = NULL; - - PAGED_CODE(); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&input, - NULL); - - if (NT_SUCCESS(status)) - { - ULONG dataTransferLength = sizeof(CDVD_KEY_HEADER) + sizeof(AACS_CHALLENGE_KEY); - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - // copy the input buffer to the data buffer for the transfer - { - PCDVD_KEY_HEADER header = DeviceExtension->ScratchContext.ScratchBuffer; - ULONG tmp = dataTransferLength; - tmp -= RTL_SIZEOF_THROUGH_FIELD(CDVD_KEY_HEADER, DataLength); - - header->DataLength[0] = (UCHAR)(tmp >> (8*1)); - header->DataLength[1] = (UCHAR)(tmp >> (8*0)); - RtlCopyMemory(header->Data, &(input->ChallengeKey), sizeof(AACS_CHALLENGE_KEY)); - } - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.SEND_KEY.OperationCode = SCSIOP_SEND_KEY; - cdb.AsByte[7] = 0x02; // AACS key class - cdb.SEND_KEY.ParameterListLength[0] = (UCHAR)(dataTransferLength >> (8*1)); - cdb.SEND_KEY.ParameterListLength[1] = (UCHAR)(dataTransferLength >> (8*0)); - cdb.SEND_KEY.AGID = (UCHAR)( input->SessionId ); - cdb.SEND_KEY.KeyFormat = 0x02; // Send Host Challenge Certificate - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, dataTransferLength, FALSE, &cdb, 12); - -#ifdef ENABLE_AACS_TESTING - status = STATUS_SUCCESS; -#endif - if (NT_SUCCESS(status)) - { - *DataLength = 0; - } - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleReadVolumeId( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - This routine is used to process IOCTL: - IOCTL_AACS_READ_VOLUME_ID -Arguments: - DeviceExtension - device context - - Request - the request that will be formatted - - RequestParameters - request parameter structur - - DataLength - data transferred length - -Return Value: - NTSTATUS - - --*/ -{ - //AacsReadVolumeID - - NTSTATUS status = STATUS_SUCCESS; - PDVD_SESSION_ID input = NULL; - PVOID outputBuffer = NULL; - - PAGED_CODE(); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&input, - NULL); - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - (PVOID*)&outputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - ULONG dataTransferLength = sizeof(CDVD_KEY_HEADER) + sizeof(AACS_VOLUME_ID); - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.READ_DVD_STRUCTURE.OperationCode = SCSIOP_READ_DVD_STRUCTURE; - cdb.READ_DVD_STRUCTURE.Format = 0x80; // Return the AACS volumeID - cdb.READ_DVD_STRUCTURE.AllocationLength[0] = (UCHAR)(dataTransferLength >> (8*1)); - cdb.READ_DVD_STRUCTURE.AllocationLength[1] = (UCHAR)(dataTransferLength >> (8*0)); - cdb.READ_DVD_STRUCTURE.AGID = (UCHAR)(*input); - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, dataTransferLength, TRUE, &cdb, 12); - -#ifdef ENABLE_AACS_TESTING - static const UCHAR results[] = { 0x00, 0x22, 0x00, 0x00 }; - static const UCHAR defaultFill = 0x33; // '3' - RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x0024, defaultFill); - RtlCopyMemory(DeviceExtension->ScratchContext.ScratchBuffer, results, SIZEOF_ARRAY(results)); - status = STATUS_SUCCESS; -#endif - if (NT_SUCCESS(status)) - { - PDVD_DESCRIPTOR_HEADER header = DeviceExtension->ScratchContext.ScratchBuffer; - ULONG dataLengthToCopy = sizeof(AACS_VOLUME_ID); - - // make length field native byte ordering - REVERSE_SHORT(&header->Length); - - // exit if getting invalid data from the drive - if (header->Length < sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length)) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - - if (NT_SUCCESS(status)) - { - // adjust data length to reflect only the addition data - header->Length -= sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length); - - // exit if the drive is returning an unexpected data size - if (header->Length != dataLengthToCopy) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - } - - if (NT_SUCCESS(status)) - { - // else copy the data to the user's buffer - RtlCopyMemory(outputBuffer, header->Data, dataLengthToCopy); - *DataLength = dataLengthToCopy; - } - } - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsReadSerialNumber( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - This routine is used to process IOCTL: - IOCTL_AACS_READ_SERIAL_NUMBER -Arguments: - DeviceExtension - device context - - Request - the request that will be formatted - - RequestParameters - request parameter structur - - DataLength - data transferred length - -Return Value: - NTSTATUS - - --*/ -{ - //AacsReadSerialNumber - - NTSTATUS status = STATUS_SUCCESS; - PDVD_SESSION_ID input = NULL; - PVOID outputBuffer = NULL; - - PAGED_CODE(); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&input, - NULL); - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - (PVOID*)&outputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - ULONG dataTransferLength = sizeof(CDVD_KEY_HEADER) + sizeof(AACS_SERIAL_NUMBER); - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.READ_DVD_STRUCTURE.OperationCode = SCSIOP_READ_DVD_STRUCTURE; - cdb.READ_DVD_STRUCTURE.Format = 0x81; // Return the AACS volumeID - cdb.READ_DVD_STRUCTURE.AllocationLength[0] = (UCHAR)(dataTransferLength >> (8*1)); - cdb.READ_DVD_STRUCTURE.AllocationLength[1] = (UCHAR)(dataTransferLength >> (8*0)); - cdb.READ_DVD_STRUCTURE.AGID = (UCHAR)(*input); - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, dataTransferLength, TRUE, &cdb, 12); - -#ifdef ENABLE_AACS_TESTING - static const UCHAR results[] = { 0x00, 0x22, 0x00, 0x00 }; - static const UCHAR defaultFill = 0x34; // '4' - RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x0024, defaultFill); - RtlCopyMemory(DeviceExtension->ScratchContext.ScratchBuffer, results, SIZEOF_ARRAY(results)); - status = STATUS_SUCCESS; -#endif - if (NT_SUCCESS(status)) - { - PDVD_DESCRIPTOR_HEADER header = DeviceExtension->ScratchContext.ScratchBuffer; - ULONG dataLengthToCopy = sizeof(AACS_SERIAL_NUMBER); - - // make length field native byte ordering - REVERSE_SHORT(&header->Length); - - // exit if getting invalid data from the drive - if (header->Length < sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length)) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - - if (NT_SUCCESS(status)) - { - // adjust data length to reflect only the addition data - header->Length -= sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length); - - // exit if the drive is returning an unexpected data size - if (header->Length != dataLengthToCopy) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - } - - if (NT_SUCCESS(status)) - { - // else copy the data to the user's buffer - RtlCopyMemory(outputBuffer, header->Data, dataLengthToCopy); - *DataLength = dataLengthToCopy; - } - } - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsReadMediaId( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - This routine is used to process IOCTL: - IOCTL_AACS_READ_MEDIA_ID -Arguments: - DeviceExtension - device context - - Request - the request that will be formatted - - RequestParameters - request parameter structur - - DataLength - data transferred length - -Return Value: - NTSTATUS - - --*/ -{ - //AacsReadMediaID - - NTSTATUS status = STATUS_SUCCESS; - PDVD_SESSION_ID input = NULL; - PVOID outputBuffer = NULL; - - PAGED_CODE(); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&input, - NULL); - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - (PVOID*)&outputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - ULONG dataTransferLength = sizeof(CDVD_KEY_HEADER) + sizeof(AACS_MEDIA_ID); - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.READ_DVD_STRUCTURE.OperationCode = SCSIOP_READ_DVD_STRUCTURE; - cdb.READ_DVD_STRUCTURE.Format = 0x82; // Return the AACS volumeID - cdb.READ_DVD_STRUCTURE.AllocationLength[0] = (UCHAR)(dataTransferLength >> (8*1)); - cdb.READ_DVD_STRUCTURE.AllocationLength[1] = (UCHAR)(dataTransferLength >> (8*0)); - cdb.READ_DVD_STRUCTURE.AGID = (UCHAR)(*input); - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, dataTransferLength, TRUE, &cdb, 12); - -#ifdef ENABLE_AACS_TESTING - static const UCHAR results[] = { 0x00, 0x22, 0x00, 0x00 }; - static const UCHAR defaultFill = 0x35; // '5' - RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x0024, defaultFill); - RtlCopyMemory(DeviceExtension->ScratchContext.ScratchBuffer, results, SIZEOF_ARRAY(results)); - status = STATUS_SUCCESS; -#endif - if (NT_SUCCESS(status)) - { - PDVD_DESCRIPTOR_HEADER header = DeviceExtension->ScratchContext.ScratchBuffer; - ULONG dataLengthToCopy = sizeof(AACS_MEDIA_ID); - - // make length field native byte ordering - REVERSE_SHORT(&header->Length); - - // exit if getting invalid data from the drive - if (header->Length < sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length)) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - - if (NT_SUCCESS(status)) - { - // adjust data length to reflect only the addition data - header->Length -= sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length); - - // exit if the drive is returning an unexpected data size - if (header->Length != dataLengthToCopy) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - } - - if (NT_SUCCESS(status)) - { - // else copy the data to the user's buffer - RtlCopyMemory(outputBuffer, header->Data, dataLengthToCopy); - *DataLength = dataLengthToCopy; - } - } - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsReadBindingNonce( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - This routine is used to process IOCTL: - IOCTL_AACS_READ_BINDING_NONCE -Arguments: - DeviceExtension - device context - - Request - the request that will be formatted - - RequestParameters - request parameter structur - - DataLength - data transferred length - -Return Value: - NTSTATUS - - --*/ -{ - //AacsReadBindingNonce - - NTSTATUS status = STATUS_SUCCESS; - PAACS_READ_BINDING_NONCE input = NULL; - PVOID outputBuffer = NULL; - - PAGED_CODE(); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&input, - NULL); - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - (PVOID*)&outputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - ULONG dataTransferLength = sizeof(CDVD_KEY_HEADER) + sizeof(AACS_BINDING_NONCE); - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.REPORT_KEY.OperationCode = SCSIOP_REPORT_KEY; - cdb.REPORT_KEY.LogicalBlockAddress[0] = (UCHAR)( input->StartLba >> (3*8) ); - cdb.REPORT_KEY.LogicalBlockAddress[1] = (UCHAR)( input->StartLba >> (2*8) ); - cdb.REPORT_KEY.LogicalBlockAddress[2] = (UCHAR)( input->StartLba >> (1*8) ); - cdb.REPORT_KEY.LogicalBlockAddress[3] = (UCHAR)( input->StartLba >> (0*8) ); - cdb.AsByte[6] = (UCHAR)( input->NumberOfSectors ); - cdb.AsByte[7] = 0x02; // AACS key class - cdb.REPORT_KEY.AllocationLength[0] = (UCHAR)(dataTransferLength >> (8*1)); - cdb.REPORT_KEY.AllocationLength[1] = (UCHAR)(dataTransferLength >> (8*0)); - cdb.REPORT_KEY.AGID = (UCHAR)( input->SessionId ); - cdb.REPORT_KEY.KeyFormat = 0x21; // Return an existing binding nonce - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, dataTransferLength, TRUE, &cdb, 12); - -#ifdef ENABLE_AACS_TESTING - static const UCHAR results[] = { 0x00, 0x22, 0x00, 0x00 }; - static const UCHAR defaultFill = 0x36; // '6' - RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x0024, defaultFill); - RtlCopyMemory(DeviceExtension->ScratchContext.ScratchBuffer, results, SIZEOF_ARRAY(results)); - status = STATUS_SUCCESS; -#endif - if (NT_SUCCESS(status)) - { - PDVD_DESCRIPTOR_HEADER header = DeviceExtension->ScratchContext.ScratchBuffer; - ULONG dataLengthToCopy = sizeof(AACS_BINDING_NONCE); - - // make length field native byte ordering - REVERSE_SHORT(&header->Length); - - // exit if getting invalid data from the drive - if (header->Length < sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length)) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - - if (NT_SUCCESS(status)) - { - // adjust data length to reflect only the addition data - header->Length -= sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length); - - // exit if the drive is returning an unexpected data size - if (header->Length != dataLengthToCopy) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - } - - if (NT_SUCCESS(status)) - { - // else copy the data to the user's buffer - RtlCopyMemory(outputBuffer, header->Data, dataLengthToCopy); - *DataLength = dataLengthToCopy; - } - } - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsGenerateBindingNonce( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - This routine is used to process IOCTL: - IOCTL_AACS_GENERATE_BINDING_NONCE -Arguments: - DeviceExtension - device context - - Request - the request that will be formatted - - RequestParameters - request parameter structur - - DataLength - data transferred length - -Return Value: - NTSTATUS - - --*/ -{ - //AacsGenerateBindingNonce - - NTSTATUS status = STATUS_SUCCESS; - PAACS_READ_BINDING_NONCE input = NULL; - PVOID outputBuffer = NULL; - - PAGED_CODE(); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&input, - NULL); - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - (PVOID*)&outputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - ULONG dataTransferLength = sizeof(CDVD_KEY_HEADER) + sizeof(AACS_BINDING_NONCE); - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, dataTransferLength, TRUE, &cdb, 12); - -#ifdef ENABLE_AACS_TESTING - static const UCHAR results[] = { 0x00, 0x22, 0x00, 0x00 }; - static const UCHAR defaultFill = 0x37; // '7' - RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x0024, defaultFill); - RtlCopyMemory(DeviceExtension->ScratchContext.ScratchBuffer, results, SIZEOF_ARRAY(results)); - status = STATUS_SUCCESS; -#endif - if (NT_SUCCESS(status)) - { - PDVD_DESCRIPTOR_HEADER header = DeviceExtension->ScratchContext.ScratchBuffer; - ULONG dataLengthToCopy = sizeof(AACS_BINDING_NONCE); - - // make length field native byte ordering - REVERSE_SHORT(&header->Length); - - // exit if getting invalid data from the drive - if (header->Length < sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length)) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - - if (NT_SUCCESS(status)) - { - // adjust data length to reflect only the addition data - header->Length -= sizeof(DVD_DESCRIPTOR_HEADER) - RTL_SIZEOF_THROUGH_FIELD(DVD_DESCRIPTOR_HEADER, Length); - - // exit if the drive is returning an unexpected data size - if (header->Length != dataLengthToCopy) - { - *DataLength = 0; - status = STATUS_IO_DEVICE_ERROR; - } - } - - if (NT_SUCCESS(status)) - { - // else copy the data to the user's buffer - RtlCopyMemory(outputBuffer, header->Data, dataLengthToCopy); - *DataLength = dataLengthToCopy; - } - } - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - diff --git a/storage/class/cdrom/src/autorun.c b/storage/class/cdrom/src/autorun.c deleted file mode 100644 index 57bacec5..00000000 --- a/storage/class/cdrom/src/autorun.c +++ /dev/null @@ -1,3072 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - autorun.c - -Abstract: - - Code for support of media change detection in the cd/dvd driver - -Environment: - - kernel mode only - -Notes: - - -Revision History: - ---*/ - -#include "stddef.h" -#include "string.h" - -#include "ntddk.h" -#include "ntddstor.h" -#include "cdrom.h" -#include "mmc.h" -#include "ioctl.h" - -#include "ntstrsafe.h" - -#ifdef DEBUG_USE_WPP -#include "autorun.tmh" -#endif - -#define GESN_TIMEOUT_VALUE (0x4) -#define GESN_BUFFER_SIZE (0x8) -#define GESN_DEVICE_BUSY_LOWER_THRESHOLD_100_MS (2) - -#define MAXIMUM_IMMEDIATE_MCN_RETRIES (0x20) -#define MCN_REG_SUBKEY_NAME (L"MediaChangeNotification") -#define MCN_REG_AUTORUN_DISABLE_INSTANCE_NAME (L"AlwaysDisableMCN") -#define MCN_REG_AUTORUN_ENABLE_INSTANCE_NAME (L"AlwaysEnableMCN") - -// -// Only send polling irp when device is fully powered up and a -// power down irp is not in progress. -// -// NOTE: This helps close a window in time where a polling irp could cause -// a drive to spin up right after it has powered down. The problem is -// that SCSIPORT, ATAPI and SBP2 will be in the process of powering -// down (which may take a few seconds), but won't know that. It would -// then get a polling irp which will be put into its queue since it -// the disk isn't powered down yet. Once the disk is powered down it -// will find the polling irp in the queue and then power up the -// device to do the poll. They do not want to check if the polling -// irp has the SRB_NO_KEEP_AWAKE flag here since it is in a critical -// path and would slow down all I/Os. A better way to fix this -// would be to serialize the polling and power down irps so that -// only one of them is sent to the device at a time. -// - -_IRQL_requires_max_(PASSIVE_LEVEL) -BOOLEAN -DeviceIsMediaChangeDisabledDueToHardwareLimitation( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -BOOLEAN -DeviceIsMediaChangeDisabledForClass( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceMediaChangeDeviceInstanceOverride( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Out_ PBOOLEAN Enabled - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceInitializeMcn( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN AllowDriveToSleep - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceInitializeGesn( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -GesnDataInterpret( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PNOTIFICATION_EVENT_STATUS_HEADER Header, - _Out_ PBOOLEAN ResendImmediately - ); - -RTL_QUERY_REGISTRY_ROUTINE DeviceMediaChangeRegistryCallBack; - -EVT_WDF_WORKITEM DeviceDisableGesn; - -#if ALLOC_PRAGMA - -#pragma alloc_text(PAGE, DeviceInitializeMediaChangeDetection) -#pragma alloc_text(PAGE, DeviceEnableMediaChangeDetection) -#pragma alloc_text(PAGE, DeviceDisableMediaChangeDetection) -#pragma alloc_text(PAGE, DeviceSendDelayedMediaChangeNotifications) -#pragma alloc_text(PAGE, DeviceReleaseMcnResources) -#pragma alloc_text(PAGE, DeviceMediaChangeRegistryCallBack) -#pragma alloc_text(PAGE, DeviceInitializeMcn) -#pragma alloc_text(PAGE, DeviceDisableGesn) - -#pragma alloc_text(PAGE, DeviceIsMediaChangeDisabledDueToHardwareLimitation) -#pragma alloc_text(PAGE, DeviceMediaChangeDeviceInstanceOverride) -#pragma alloc_text(PAGE, DeviceIsMediaChangeDisabledForClass) - -#pragma alloc_text(PAGE, DeviceDisableMainTimer) - -#pragma alloc_text(PAGE, GesnDataInterpret) - -#pragma alloc_text(PAGE, RequestSetupMcnRequest) -#pragma alloc_text(PAGE, RequestPostWorkMcnRequest) -#pragma alloc_text(PAGE, RequestSendMcnRequest) - -// -// DeviceEnableMainTimer is called by EvtDeviceD0Entry which can't be made pageable -// so neither is DeviceEnableMainTimer -// -//#pragma alloc_text(PAGE, DeviceEnableMainTimer) - -#pragma alloc_text(PAGE, DeviceInitializeGesn) - -#pragma alloc_text(PAGE, RequestHandleMcnControl) - -#endif - -#pragma warning(push) -#pragma warning(disable:4152) // nonstandard extension, function/data pointer conversion in expression - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -GesnDataInterpret( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PNOTIFICATION_EVENT_STATUS_HEADER Header, - _Out_ PBOOLEAN ResendImmediately - ) -/*++ - -Routine Description: - - This routine will interpret the data returned for a GESN command, and - (if appropriate) set the media change event, and broadcast the - appropriate events to user mode for applications who care. - -Arguments: - - DeviceExtension - the device extension - - Header - the resulting data from a GESN event. - requires at least EIGHT valid bytes (header == 4, data == 4) - - ResendImmediately - whether or not to immediately resend the request. - this should be FALSE if there was no event, FALSE if the reported - event was of the DEVICE BUSY class, else true. - -Return Value: - - STATUS_SUCCESS if successful, an error code otherwise - -Notes: - - DataBuffer must be at least four bytes of valid data (header == 4 bytes), - and have at least eight bytes of allocated memory (all events == 4 bytes). - - The call to StartNextPacket may occur before this routine is completed. - the operational change notifications are informational in nature, and - while useful, are not neccessary to ensure proper operation. For example, - if the device morphs to no longer supporting WRITE commands, all further - write commands will fail. There exists a small timing window wherein - IOCTL_IS_DISK_WRITABLE may be called and get an incorrect response. If - a device supports software write protect, it is expected that the - application can handle such a case. - - NOTE: perhaps setting the updaterequired byte to one should be done here. - if so, it relies upon the setting of a 32-byte value to be an atomic - operation. unfortunately, there is no simple way to notify a class driver - which wants to know that the device behavior requires updating. - - Not ready events may be sent every second. For example, if we were - to minimize the number of asynchronous notifications, an application may - register just after a large busy time was reported. This would then - prevent the application from knowing the device was busy until some - arbitrarily chosen timeout has occurred. Also, the GESN request would - have to still occur, since it checks for non-busy events (such as user - keybutton presses and media change events) as well. The specification - states that the lower-numered events get reported first, so busy events, - while repeating, will only be reported when all other events have been - cleared from the device. - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PMEDIA_CHANGE_DETECTION_INFO info = DeviceExtension->MediaChangeDetectionInfo; - LONG dataLength = 0; - LONG requiredLength = 0; - BOOLEAN inHomePosition = FALSE; - - PAGED_CODE(); - - // note: don't allocate anything in this routine so that we can - // always just 'return'. - *ResendImmediately = FALSE; - - if (Header->NEA) - { - return status; - } - if (Header->NotificationClass == NOTIFICATION_NO_CLASS_EVENTS) - { - return status; - } - - // HACKHACK - REF #0001 - // This loop is only taken initially, due to the inability to reliably - // auto-detect drives that report events correctly at boot. When we - // detect this behavior during the normal course of running, we will - // disable the hack, allowing more efficient use of the system. This - // should occur "nearly" instantly, as the drive should have multiple - // events queue'd (ie. power, morphing, media). - if (info->Gesn.HackEventMask) - { - // all events use the low four bytes of zero to indicate - // that there was no change in status. - UCHAR thisEvent = Header->ClassEventData[0] & 0xf; - UCHAR lowestSetBit; - UCHAR thisEventBit = (1 << Header->NotificationClass); - - if (!TEST_FLAG(info->Gesn.EventMask, thisEventBit)) - { - // The drive is reporting an event that wasn't requested - return STATUS_DEVICE_PROTOCOL_ERROR; - } - - // some bit magic here... this results in the lowest set bit only - lowestSetBit = info->Gesn.EventMask; - lowestSetBit &= (info->Gesn.EventMask - 1); - lowestSetBit ^= (info->Gesn.EventMask); - - if (thisEventBit != lowestSetBit) - { - // HACKHACK - REF #0001 - // the first time we ever see an event set that is not the lowest - // set bit in the request (iow, highest priority), we know that the - // hack is no longer required, as the device is ignoring "no change" - // events when a real event is waiting in the other requested queues. - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN::NONE: Compliant drive found, " - "removing GESN hack (%x, %x)\n", - thisEventBit, info->Gesn.EventMask)); - - info->Gesn.HackEventMask = FALSE; - } - else if (thisEvent == 0) // NOTIFICATION_*_EVENT_NO_CHANGE - { - // HACKHACK - REF #0001 - // note: this hack prevents poorly implemented firmware from constantly - // returning "No Event". we do this by cycling through the - // supported list of events here. - SET_FLAG(info->Gesn.NoChangeEventMask, thisEventBit); - CLEAR_FLAG(info->Gesn.EventMask, thisEventBit); - - // if we have cycled through all supported event types, then - // we need to reset the events we are asking about. else we - // want to resend this request immediately in case there was - // another event pending. - if (info->Gesn.EventMask == 0) - { - info->Gesn.EventMask = info->Gesn.NoChangeEventMask; - info->Gesn.NoChangeEventMask = 0; - } - else - { - *ResendImmediately = TRUE; - } - return status; - } - - } // end if (info->Gesn.HackEventMask) - - dataLength = (Header->EventDataLength[0] << 8) | - (Header->EventDataLength[1] & 0xff); - dataLength -= 2; - requiredLength = 4; // all events are four bytes - - if (dataLength < requiredLength) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_MCN, - "error - GESN returned only %x bytes data for fdo %p\n", - dataLength, DeviceExtension->DeviceObject)); - - return STATUS_DEVICE_PROTOCOL_ERROR; - } - - if (dataLength > requiredLength) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_MCN, - "error - GESN returned too many (%x) bytes data for fdo %p\n", - dataLength, DeviceExtension->DeviceObject)); - } - - if ((Header->ClassEventData[0] & 0xf) == 0) - { - // a zero event is a "no change event, so do not retry - return status; - } - - // because a event other than "no change" occurred, - // we should immediately resend this request. - *ResendImmediately = TRUE; - - switch (Header->NotificationClass) - { - - case NOTIFICATION_OPERATIONAL_CHANGE_CLASS_EVENTS: // 0x01 - { - PNOTIFICATION_OPERATIONAL_STATUS opChangeInfo = - (PNOTIFICATION_OPERATIONAL_STATUS)(Header->ClassEventData); - ULONG event; - - if (opChangeInfo->OperationalEvent == NOTIFICATION_OPERATIONAL_EVENT_CHANGE_REQUESTED) - { - break; - } - - event = (opChangeInfo->Operation[0] << 8) | - (opChangeInfo->Operation[1] ) ; - - // Workaround some hardware that is buggy but prevalent in the market - // This hardware has the property that it will report OpChange events repeatedly, - // causing us to retry immediately so quickly that we will eventually disable - // GESN to prevent an infinite loop. - // (only one valid OpChange event type now, only two ever defined) - if (info->MediaChangeRetryCount >= 4) - { - // - // HACKHACK - REF #0002 - // Some drives incorrectly report OpChange/Change (001b/0001h) events - // continuously when the tray has been ejected. This causes this routine - // to set ResendImmediately to "TRUE", and that results in our cycling - // 32 times immediately resending. At that point, we give up detecting - // the infinite retry loop, and disable GESN on these drives. This - // prevents Media Eject Request (from eject button) from being reported. - // Thus, instead we should attempt to workaround this issue by detecting - // this behavior. - // - - static UCHAR const OpChangeMask = 0x02; - - // At least one device reports "temporarily busy" (which is useless) on eject - // At least one device reports "OpChange" repeatedly when re-inserting media - // All seem to work well using this workaround - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_MCN, - "GESN OpChange events are broken. Working around this problem in software (for WDFDEVICE %p)\n", - DeviceExtension->Device)); - - // OpChange is not the only bit set -- Media class is required.... - NT_ASSERT(CountOfSetBitsUChar(info->Gesn.EventMask) != 1); - - // Force the use of the hackhack (ref #0001) to workaround the - // issue noted this hackhack (ref #0002). - SET_FLAG(info->Gesn.NoChangeEventMask, OpChangeMask); - CLEAR_FLAG(info->Gesn.EventMask, OpChangeMask); - info->Gesn.HackEventMask = TRUE; - - // don't request the opChange event again. use the method - // defined by hackhack (ref #0001) as the workaround. - if (info->Gesn.EventMask == 0) - { - info->Gesn.EventMask = info->Gesn.NoChangeEventMask; - info->Gesn.NoChangeEventMask = 0; - *ResendImmediately = FALSE; - } - else - { - *ResendImmediately = TRUE; - } - - break; - } - - - if ((event == NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_ADDED) | - (event == NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_CHANGE)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN says features added/changed for WDFDEVICE %p\n", - DeviceExtension->Device)); - - // don't notify that new media arrived, just set the - // DO_VERIFY to force a FS reload. - - if (IsVolumeMounted(DeviceExtension->DeviceObject)) - { - SET_FLAG(DeviceExtension->DeviceObject->Flags, DO_VERIFY_VOLUME); - } - - // Call error handler with - // a "fake" media change error in case it needs to update - // internal structures as though a media change occurred. - { - SCSI_REQUEST_BLOCK srb = {0}; - SENSE_DATA sense = {0}; - NTSTATUS tempStatus; - BOOLEAN retry; - - tempStatus = STATUS_MEDIA_CHANGED; - retry = FALSE; - - srb.CdbLength = 6; - srb.Length = sizeof(SCSI_REQUEST_BLOCK); - srb.SrbStatus = SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_ERROR; - srb.SenseInfoBuffer = &sense; - srb.SenseInfoBufferLength = sizeof(SENSE_DATA); - - sense.AdditionalSenseLength = sizeof(SENSE_DATA) - - RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseLength); - - sense.SenseKey = SCSI_SENSE_UNIT_ATTENTION; - sense.AdditionalSenseCode = SCSI_ADSENSE_MEDIUM_CHANGED; - - if (DeviceExtension->DeviceAdditionalData.ErrorHandler) - { - DeviceExtension->DeviceAdditionalData.ErrorHandler(DeviceExtension, - &srb, - &tempStatus, - &retry); - } - } // end error handler - - } - break; - } - - case NOTIFICATION_EXTERNAL_REQUEST_CLASS_EVENTS: // 0x3 - { - PNOTIFICATION_EXTERNAL_STATUS externalInfo = - (PNOTIFICATION_EXTERNAL_STATUS)(Header->ClassEventData); - DEVICE_EVENT_EXTERNAL_REQUEST externalData = {0}; - - // unfortunately, due to time constraints, we will only notify - // about keys being pressed, and not released. this makes keys - // single-function, but simplifies the code significantly. - if (externalInfo->ExternalEvent != NOTIFICATION_EXTERNAL_EVENT_BUTTON_DOWN) - { - break; - } - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN::EXTERNAL: Event: %x Status %x Req %x\n", - externalInfo->ExternalEvent, externalInfo->ExternalStatus, - (externalInfo->Request[0] << 8) | externalInfo->Request[1] - )); - - externalData.Version = 1; - externalData.DeviceClass = 0; - externalData.ButtonStatus = externalInfo->ExternalEvent; - externalData.Request = (externalInfo->Request[0] << 8) | - (externalInfo->Request[1] & 0xff); - KeQuerySystemTime(&(externalData.SystemTime)); - externalData.SystemTime.QuadPart *= (LONGLONG)KeQueryTimeIncrement(); - - DeviceSendNotification(DeviceExtension, - &GUID_IO_DEVICE_EXTERNAL_REQUEST, - sizeof(DEVICE_EVENT_EXTERNAL_REQUEST), - &externalData); - - return status; - } - - case NOTIFICATION_MEDIA_STATUS_CLASS_EVENTS: // 0x4 - { - PNOTIFICATION_MEDIA_STATUS mediaInfo = - (PNOTIFICATION_MEDIA_STATUS)(Header->ClassEventData); - - if ((mediaInfo->MediaEvent == NOTIFICATION_MEDIA_EVENT_NEW_MEDIA) || - (mediaInfo->MediaEvent == NOTIFICATION_MEDIA_EVENT_MEDIA_CHANGE)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN::MEDIA ARRIVAL, Status %x\n", - mediaInfo->MediaStatus)); - - if (IsVolumeMounted(DeviceExtension->DeviceObject)) - { - SET_FLAG(DeviceExtension->DeviceObject->Flags, DO_VERIFY_VOLUME); - } - DeviceSetMediaChangeStateEx(DeviceExtension, - MediaPresent, - NULL); - - // If media is inserted into slot loading type, mark the device active - // to not power off. - if ((DeviceExtension->ZeroPowerODDInfo != NULL) && - (DeviceExtension->ZeroPowerODDInfo->LoadingMechanism == LOADING_MECHANISM_CADDY) && - (DeviceExtension->ZeroPowerODDInfo->Load == 0)) // Slot - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "GesnDataInterpret: MediaArrival event detected, device marked as active\n")); - - DeviceMarkActive(DeviceExtension, TRUE, FALSE); - } - } - else if (mediaInfo->MediaEvent == NOTIFICATION_MEDIA_EVENT_MEDIA_REMOVAL) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN::MEDIA REMOVAL, Status %x\n", - mediaInfo->MediaStatus)); - - DeviceSetMediaChangeStateEx(DeviceExtension, - MediaNotPresent, - NULL); - - // If media is removed from slot loading type, start powering off the device - // if it is ZPODD capable. - if ((DeviceExtension->ZeroPowerODDInfo != NULL) && - (DeviceExtension->ZeroPowerODDInfo->LoadingMechanism == LOADING_MECHANISM_CADDY) && - (DeviceExtension->ZeroPowerODDInfo->Load == 0)) // Slot - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "GesnDataInterpret: MediaRemoval event detected, device marked as idle\n")); - - DeviceMarkActive(DeviceExtension, FALSE, FALSE); - } - } - else if (mediaInfo->MediaEvent == NOTIFICATION_MEDIA_EVENT_EJECT_REQUEST) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN::MEDIA EJECTION, Status %x\n", - mediaInfo->MediaStatus)); - - DeviceSendNotification(DeviceExtension, - &GUID_IO_MEDIA_EJECT_REQUEST, - 0, - NULL); - } - - break; - } - - case NOTIFICATION_DEVICE_BUSY_CLASS_EVENTS: // lowest priority events... - { - PNOTIFICATION_BUSY_STATUS busyInfo = - (PNOTIFICATION_BUSY_STATUS)(Header->ClassEventData); - DEVICE_EVENT_BECOMING_READY busyData = {0}; - - // else we want to report the approximated time till it's ready. - busyData.Version = 1; - busyData.Reason = busyInfo->DeviceBusyStatus; - busyData.Estimated100msToReady = (busyInfo->Time[0] << 8) | - (busyInfo->Time[1] & 0xff); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN::BUSY: Event: %x Status %x Time %x\n", - busyInfo->DeviceBusyEvent, busyInfo->DeviceBusyStatus, - busyData.Estimated100msToReady - )); - - // Ignore the notification if the time is small - if (busyData.Estimated100msToReady >= GESN_DEVICE_BUSY_LOWER_THRESHOLD_100_MS) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GesnDataInterpret: media BECOMING_READY\n")); - - DeviceSendNotification(DeviceExtension, - &GUID_IO_DEVICE_BECOMING_READY, - sizeof(DEVICE_EVENT_BECOMING_READY), - &busyData); - } - - // If manual loading operation is observed for slot loading type, start powering off the device - // if it is ZPODD capable. - if ((DeviceExtension->ZeroPowerODDInfo != NULL) && - (DeviceExtension->ZeroPowerODDInfo->LoadingMechanism == LOADING_MECHANISM_TRAY) && - (DeviceExtension->ZeroPowerODDInfo->Load == 0) && // Drawer - (busyInfo->DeviceBusyEvent == NOTIFICATION_BUSY_EVENT_LO_CHANGE) && - (busyInfo->DeviceBusyStatus == NOTIFICATION_BUSY_STATUS_NO_EVENT)) - { - inHomePosition = DeviceZPODDIsInHomePosition(DeviceExtension); - - if (inHomePosition == FALSE) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "GesnDataInterpret: LoChange event detected, device marked as active\n")); - - DeviceMarkActive(DeviceExtension, TRUE, FALSE); - } - else - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "GesnDataInterpret: LoChange event detected, device marked as idle\n")); - - DeviceMarkActive(DeviceExtension, FALSE, FALSE); - } - } - - break; - } - - default: - { - break; - } - - } // end switch on notification class - - return status; -} - - -VOID -DeviceInternalSetMediaChangeState( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ MEDIA_CHANGE_DETECTION_STATE NewState, - _Inout_opt_ PMEDIA_CHANGE_DETECTION_STATE OldState - ) -/*++ - -Routine Description: - - This routine will (if appropriate) set the media change event for the - device. The event will be set if the media state is changed and - media change events are enabled. Otherwise the media state will be - tracked but the event will not be set. - - This routine will lock out the other media change routines if possible - but if not a media change notification may be lost after the enable has - been completed. - -Arguments: - - DeviceExtension - the device extension - - NewState - new state for setting - - OldState - optional storage for the old state - -Return Value: - - none - ---*/ -{ -#if DBG - LPCSTR states[] = {"Unknown", "Present", "Not Present", "Unavailable"}; -#endif - MEDIA_CHANGE_DETECTION_STATE oldMediaState; - PMEDIA_CHANGE_DETECTION_INFO info = DeviceExtension->MediaChangeDetectionInfo; - CLASS_MEDIA_CHANGE_CONTEXT mcnContext; - - if (!((NewState >= MediaUnknown) && (NewState <= MediaUnavailable))) - { - return; - } - - if (info == NULL) - { - return; - } - - oldMediaState = info->LastKnownMediaDetectionState; - if (OldState) - { - *OldState = oldMediaState; - } - - info->LastKnownMediaDetectionState = NewState; - - // Increment MediaChangeCount on transition to MediaPresent - if (NewState == MediaPresent && oldMediaState != NewState) - { - InterlockedIncrement((PLONG)&DeviceExtension->MediaChangeCount); - } - - if (info->MediaChangeDetectionDisableCount != 0) - { -#if DBG - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceInternalSetMediaChangeState: MCN not enabled, state " - "changed from %s to %s\n", - states[oldMediaState], states[NewState])); -#endif - return; - } -#if DBG - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceInternalSetMediaChangeState: State change from %s to %s\n", - states[oldMediaState], states[NewState])); -#endif - - if (info->LastReportedMediaDetectionState == info->LastKnownMediaDetectionState) - { - // Media is in the same state as we reported last time, no need to report again. - return; - } - - // make the data useful -- it used to always be zero. - mcnContext.MediaChangeCount = DeviceExtension->MediaChangeCount; - mcnContext.NewState = NewState; - - if (NewState == MediaPresent) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceInternalSetMediaChangeState: Reporting media ARRIVAL\n")); - - DeviceSendNotification(DeviceExtension, - &GUID_IO_MEDIA_ARRIVAL, - sizeof(CLASS_MEDIA_CHANGE_CONTEXT), - &mcnContext); - } - else if ((NewState == MediaNotPresent) || (NewState == MediaUnavailable)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceInternalSetMediaChangeState: Reporting media REMOVAL\n")); - DeviceSendNotification(DeviceExtension, - &GUID_IO_MEDIA_REMOVAL, - sizeof(CLASS_MEDIA_CHANGE_CONTEXT), - &mcnContext); - } - else - { - // Don't notify of changed going to unknown. - return; - } - - info->LastReportedMediaDetectionState = info->LastKnownMediaDetectionState; - - return; -} // end DeviceInternalSetMediaChangeState() - - -VOID -DeviceSetMediaChangeStateEx( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ MEDIA_CHANGE_DETECTION_STATE NewState, - _Inout_opt_ PMEDIA_CHANGE_DETECTION_STATE OldState - ) -/*++ - -Routine Description: - - This routine will (if appropriate) set the media change event for the - device. The event will be set if the media state is changed and - media change events are enabled. Otherwise the media state will be - tracked but the event will not be set. - -Arguments: - - DeviceExtension - the device extension - - NewState - new state for setting - - OldState - optional storage for the old state - -Return Value: - - none - ---*/ -{ - PMEDIA_CHANGE_DETECTION_INFO info = DeviceExtension->MediaChangeDetectionInfo; - LARGE_INTEGER zero; - NTSTATUS status; - - // timeout value must be 0, as this function can be called at DISPATCH_LEVEL. - zero.QuadPart = 0; - - if (info == NULL) - { - return; - } - - status = KeWaitForMutexObject(&info->MediaChangeMutex, - Executive, - KernelMode, - FALSE, - &zero); - - if (status == STATUS_TIMEOUT) - { - // Someone else is in the process of setting the media state. - return; - } - - // Change the media present state and signal an event, if applicable - DeviceInternalSetMediaChangeState(DeviceExtension, NewState, OldState); - - KeReleaseMutex(&info->MediaChangeMutex, FALSE); - - return; -} // end DeviceSetMediaChangeStateEx() - - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceSendDelayedMediaChangeNotifications( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - This routine sends the so-called delayed media change notifications. - These notifications get accumulated while the MCN mechanism is disabled - and need to be sent to the application on MCN enabling, if MCN enabling - happens as a part of exclusive access unlock and the application has not - requested us explicitly to not send the delayed notifications. - -Arguments: - - DeviceExtension - the device extension - -Return Value: - - none - ---*/ -{ - PMEDIA_CHANGE_DETECTION_INFO info = DeviceExtension->MediaChangeDetectionInfo; - LARGE_INTEGER zero; - NTSTATUS status; - - PAGED_CODE(); - - zero.QuadPart = 0; - - if (info == NULL) - { - return; - } - - status = KeWaitForMutexObject(&info->MediaChangeMutex, - Executive, - KernelMode, - FALSE, - &zero); - - if (status == STATUS_TIMEOUT) - { - // Someone else is in the process of setting the media state. - // That's totally okay, we'll send delayed notifications later. - return; - } - - // If the last reported state and the last known state are different and - // MCN is enabled, generate a notification based on the last known state. - if ((info->LastKnownMediaDetectionState != info->LastReportedMediaDetectionState) && - (info->MediaChangeDetectionDisableCount == 0)) - { - DeviceInternalSetMediaChangeState(DeviceExtension, info->LastKnownMediaDetectionState, NULL); - } - - KeReleaseMutex(&info->MediaChangeMutex, FALSE); - - return; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestSetupMcnRequest( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN UseGesn -) -/*++ - -Routine Description: - - This routine sets up the fields of the request for MCN - -Arguments: - DeviceExtension - device context - - UseGesn - If TRUE, the device supports GESN and it's currently the mechanism for MCN - -Return Value: - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PSCSI_REQUEST_BLOCK srb; - PIRP irp; - PIO_STACK_LOCATION nextIrpStack; - PCDB cdb; - PVOID buffer; - WDF_REQUEST_REUSE_PARAMS params; - PMEDIA_CHANGE_DETECTION_INFO info = DeviceExtension->MediaChangeDetectionInfo; - - PAGED_CODE(); - - irp = WdfRequestWdmGetIrp(info->MediaChangeRequest); - NT_ASSERT(irp != NULL); - - // deassign the MdlAddress, this is the value we assign explicitly. - // this is to prevent WdfRequestReuse to release the Mdl unexpectly. - if (irp->MdlAddress) - { - irp->MdlAddress = NULL; - } - - if (NT_SUCCESS(status)) - { - // Setup the IRP to perform a test unit ready. - WDF_REQUEST_REUSE_PARAMS_INIT(¶ms, - WDF_REQUEST_REUSE_NO_FLAGS, - STATUS_NOT_SUPPORTED); - - status = WdfRequestReuse(info->MediaChangeRequest, ¶ms); - } - - if (NT_SUCCESS(status)) - { - // Format the request. - status = WdfIoTargetFormatRequestForInternalIoctlOthers(DeviceExtension->IoTarget, - info->MediaChangeRequest, - IOCTL_SCSI_EXECUTE_IN, - NULL, NULL, - NULL, NULL, - NULL, NULL); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "RequestSetupMcnRequest: WdfIoTargetFormatRequestForInternalIoctlOthers failed, %!STATUS!\n", - status)); - } - } - - if (NT_SUCCESS(status)) - { - RequestClearSendTime(info->MediaChangeRequest); - - nextIrpStack = IoGetNextIrpStackLocation(irp); - - nextIrpStack->Flags = SL_OVERRIDE_VERIFY_VOLUME; - nextIrpStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; - nextIrpStack->Parameters.Scsi.Srb = &(info->MediaChangeSrb); - - // Prepare the SRB for execution. - srb = nextIrpStack->Parameters.Scsi.Srb; - buffer = info->SenseBuffer; - RtlZeroMemory(srb, sizeof(SCSI_REQUEST_BLOCK)); - RtlZeroMemory(buffer, SENSE_BUFFER_SIZE); - - srb->QueueTag = SP_UNTAGGED; - srb->QueueAction = SRB_SIMPLE_TAG_REQUEST; - srb->Length = sizeof(SCSI_REQUEST_BLOCK); - srb->Function = SRB_FUNCTION_EXECUTE_SCSI; - srb->SenseInfoBuffer = buffer; - srb->SrbStatus = 0; - srb->ScsiStatus = 0; - srb->OriginalRequest = irp; - srb->SenseInfoBufferLength = SENSE_BUFFER_SIZE; - - srb->SrbFlags = DeviceExtension->SrbFlags; - SET_FLAG(srb->SrbFlags, info->SrbFlags); - - if (!UseGesn) - { - srb->TimeOutValue = CDROM_TEST_UNIT_READY_TIMEOUT; - srb->CdbLength = 6; - srb->DataTransferLength = 0; - SET_FLAG(srb->SrbFlags, SRB_FLAGS_NO_DATA_TRANSFER); - nextIrpStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_SCSI_EXECUTE_NONE; - srb->DataBuffer = NULL; - srb->DataTransferLength = 0; - irp->MdlAddress = NULL; - - cdb = (PCDB) &srb->Cdb[0]; - cdb->CDB6GENERIC.OperationCode = SCSIOP_TEST_UNIT_READY; - } - else - { - NT_ASSERT(info->Gesn.Buffer); - - srb->TimeOutValue = GESN_TIMEOUT_VALUE; // much shorter timeout for GESN - - srb->CdbLength = 10; - SET_FLAG(srb->SrbFlags, SRB_FLAGS_DATA_IN); - nextIrpStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_SCSI_EXECUTE_IN; - srb->DataBuffer = info->Gesn.Buffer; - srb->DataTransferLength = info->Gesn.BufferSize; - irp->MdlAddress = info->Gesn.Mdl; - - cdb = (PCDB) &srb->Cdb[0]; - cdb->GET_EVENT_STATUS_NOTIFICATION.OperationCode = SCSIOP_GET_EVENT_STATUS; - cdb->GET_EVENT_STATUS_NOTIFICATION.Immediate = 1; - cdb->GET_EVENT_STATUS_NOTIFICATION.EventListLength[0] = (UCHAR)((info->Gesn.BufferSize) >> 8); - cdb->GET_EVENT_STATUS_NOTIFICATION.EventListLength[1] = (UCHAR)((info->Gesn.BufferSize) & 0xff); - cdb->GET_EVENT_STATUS_NOTIFICATION.NotificationClassRequest = info->Gesn.EventMask; - } - } - - return status; -} - - -VOID -DeviceDisableGesn( - _In_ WDFWORKITEM WorkItem - ) -/*++ - -Routine Description: - - Work item routine to set the hack flag in the registry to disable GESN - This routine is invoked when the device reports TOO many events that affects system - -Arguments: - WorkItem - the work item be perfromed. - -Return Value: - None - ---*/ -{ - WDFDEVICE device = WdfWorkItemGetParentObject(WorkItem); - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(device); - - PAGED_CODE(); - - // - // Set the hack flag in the registry - // - DeviceSetParameter(deviceExtension, - CLASSP_REG_SUBKEY_NAME, - CLASSP_REG_MMC_DETECTION_VALUE_NAME, - CdromDetectionUnsupported); - - WdfObjectDelete(WorkItem); - - return; -} - -_IRQL_requires_max_(APC_LEVEL) -BOOLEAN -RequestPostWorkMcnRequest( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - This routine handles the completion of the test unit ready irps used to - determine if the media has changed. If the media has changed, this code - signals the named event to wake up other system services that react to - media change (aka AutoPlay). - -Arguments: - - DeviceExtension - the device context - -Return Value: - - BOOLEAN - TRUE (needs retry); FALSE (shoule not retry) - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PMEDIA_CHANGE_DETECTION_INFO info = DeviceExtension->MediaChangeDetectionInfo; - PIRP irp; - BOOLEAN retryImmediately = FALSE; - - PAGED_CODE(); - - NT_ASSERT(info->MediaChangeRequest != NULL); - irp = WdfRequestWdmGetIrp(info->MediaChangeRequest); - - NT_ASSERT(!TEST_FLAG(info->MediaChangeSrb.SrbStatus, SRB_STATUS_QUEUE_FROZEN)); - - // use InterpretSenseInfo routine to check for media state, and also - // to call ClassError() with correct parameters. - if (SRB_STATUS(info->MediaChangeSrb.SrbStatus) != SRB_STATUS_SUCCESS) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_MCN, "MCN request - failed - srb status=%x, sense=%x/%x/%x.\n", - info->MediaChangeSrb.SrbStatus, - ((PSENSE_DATA)(info->MediaChangeSrb.SenseInfoBuffer))->SenseKey, - ((PSENSE_DATA)(info->MediaChangeSrb.SenseInfoBuffer))->AdditionalSenseCode, - ((PSENSE_DATA)(info->MediaChangeSrb.SenseInfoBuffer))->AdditionalSenseCodeQualifier)); - - if (SRB_STATUS(info->MediaChangeSrb.SrbStatus) != SRB_STATUS_NOT_POWERED) - { - // Release the queue if it is frozen. - if (info->MediaChangeSrb.SrbStatus & SRB_STATUS_QUEUE_FROZEN) - { - DeviceReleaseQueue(DeviceExtension->Device); - } - - RequestSenseInfoInterpret(DeviceExtension, - info->MediaChangeRequest, - &info->MediaChangeSrb, - 0, - &status, - NULL); - } - } - else - { - DeviceExtension->PrivateFdoData->LoggedTURFailureSinceLastIO = FALSE; - - if (!info->Gesn.Supported) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "MCN request - succeeded (GESN NOT supported, setting MediaPresent).\n")); - - // success != media for GESN case - DeviceSetMediaChangeStateEx(DeviceExtension, - MediaPresent, - NULL); - } - else - { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_MCN, - "MCN request - succeeded (GESN supported).\n")); - } - } - - if (info->Gesn.Supported) - { - if (status == STATUS_DATA_OVERRUN) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, "MCN Request - Data Overrun\n")); - status = STATUS_SUCCESS; - } - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, "MCN Request: GESN failed with status %x\n", status)); - } - else - { - // for GESN, need to interpret the results of the data. - // this may also require an immediate retry - if (irp->IoStatus.Information == 8 ) - { - GesnDataInterpret(DeviceExtension, - (PVOID)info->Gesn.Buffer, - &retryImmediately); - } - - } // end of NT_SUCCESS(status) - - } // end of Info->Gesn.Supported - - // free port-allocated sense buffer, if any. - if (PORT_ALLOCATED_SENSE(DeviceExtension, &info->MediaChangeSrb)) - { - FREE_PORT_ALLOCATED_SENSE_BUFFER(DeviceExtension, &info->MediaChangeSrb); - } - - // Remember the IRP and SRB for use the next time. - NT_ASSERT(IoGetNextIrpStackLocation(irp)); - IoGetNextIrpStackLocation(irp)->Parameters.Scsi.Srb = &info->MediaChangeSrb; - - // run a sanity check to make sure we're not recursing continuously - if (retryImmediately) - { - info->MediaChangeRetryCount++; - - if (info->MediaChangeRetryCount > MAXIMUM_IMMEDIATE_MCN_RETRIES) - { - // Disable GESN on this device. - // Create a work item to set the value in the registry - WDF_OBJECT_ATTRIBUTES attributes; - WDF_WORKITEM_CONFIG workitemConfig; - WDFWORKITEM workItem; - - WDF_OBJECT_ATTRIBUTES_INIT(&attributes); - attributes.ParentObject = DeviceExtension->Device; - - WDF_WORKITEM_CONFIG_INIT(&workitemConfig, DeviceDisableGesn); - workitemConfig.AutomaticSerialization = FALSE; - - status = WdfWorkItemCreate(&workitemConfig, - &attributes, - &workItem); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, "MCN Request: Disabling GESN for WDFDEVICE %p\n", DeviceExtension->Device)); - - if (NT_SUCCESS(status)) - { - WdfWorkItemEnqueue(workItem); - } - - info->Gesn.Supported = FALSE; - info->Gesn.EventMask = 0; - info->Gesn.BufferSize = 0; - info->MediaChangeRetryCount = 0; - retryImmediately = FALSE; - // should we log an error in event log? - } - } - else - { - info->MediaChangeRetryCount = 0; - } - - return retryImmediately; -} - - -_IRQL_requires_max_(APC_LEVEL) -BOOLEAN -RequestSendMcnRequest( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - This routine sends the formatted MCN request sychronizely to lower driver. - -Arguments: - - DeviceExtension - the device context - -Return Value: - BOOLEAN - TRUE (requst successfully sent); FALSE (request failed to send) - ---*/ -{ - BOOLEAN requestSent = FALSE; - PMEDIA_CHANGE_DETECTION_INFO info = DeviceExtension->MediaChangeDetectionInfo; - - PAGED_CODE(); - - RequestSend(DeviceExtension, - info->MediaChangeRequest, - DeviceExtension->IoTarget, - WDF_REQUEST_SEND_OPTION_SYNCHRONOUS, - &requestSent); - - return requestSent; -} // end RequestSendMcnRequest() - - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceInitializeMcn( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN AllowDriveToSleep - ) -/*++ - -Routine Description: - - This routine initialize the contents of MCN structure. - -Arguments: - - DeviceExtension - the device extension - - AllowDriveToSleep - for CDROM, this parameter should be always FALSE - -Return Value: - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PMEDIA_CHANGE_DETECTION_INFO mediaChangeInfo = NULL; - PIRP irp = NULL; - PVOID senseBuffer = NULL; - WDF_OBJECT_ATTRIBUTES attributes; - - PAGED_CODE(); - - if (DeviceExtension->MediaChangeDetectionInfo != NULL) - { - //Already initialized. - return STATUS_SUCCESS; - } - - DeviceExtension->KernelModeMcnContext.FileObject = (PVOID)-1; - DeviceExtension->KernelModeMcnContext.DeviceObject = (PVOID)-1; - DeviceExtension->KernelModeMcnContext.LockCount = 0; - DeviceExtension->KernelModeMcnContext.McnDisableCount = 0; - - mediaChangeInfo = ExAllocatePool2(POOL_FLAG_NON_PAGED, - sizeof(MEDIA_CHANGE_DETECTION_INFO), - CDROM_TAG_MEDIA_CHANGE_DETECTION); - - if (mediaChangeInfo == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - - if (NT_SUCCESS(status)) - { - if ((DeviceExtension->PowerDescriptor != NULL) && - (DeviceExtension->PowerDescriptor->AsynchronousNotificationSupported != FALSE) && - (!TEST_FLAG(DeviceExtension->PrivateFdoData->HackFlags, FDO_HACK_NO_ASYNCHRONOUS_NOTIFICATION))) - { - mediaChangeInfo->AsynchronousNotificationSupported = TRUE; - } - } - - // Allocate an IRP to carry the IOCTL_MCN_SYNC_FAKE_IOCTL. - if (NT_SUCCESS(status)) - { - irp = IoAllocateIrp(DeviceExtension->DeviceObject->StackSize, FALSE); - - if (irp == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - } - - if (NT_SUCCESS(status)) - { - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, - CDROM_REQUEST_CONTEXT); - attributes.ParentObject = DeviceExtension->Device; - status = WdfRequestCreate(&attributes, - DeviceExtension->IoTarget, - &mediaChangeInfo->MediaChangeRequest); - } - - if (NT_SUCCESS(status)) - { - // Preformat the media change request. With this being done, we never need to worry about - // WdfIoTargetFormatRequestForInternalIoctlOthers ever failing later. - status = WdfIoTargetFormatRequestForInternalIoctlOthers(DeviceExtension->IoTarget, - mediaChangeInfo->MediaChangeRequest, - IOCTL_SCSI_EXECUTE_IN, - NULL, NULL, - NULL, NULL, - NULL, NULL); - } - - if (NT_SUCCESS(status)) - { - senseBuffer = ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED, - SENSE_BUFFER_SIZE, - CDROM_TAG_MEDIA_CHANGE_DETECTION); - if (senseBuffer == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - } - - if (NT_SUCCESS(status)) - { - mediaChangeInfo->MediaChangeSyncIrp = irp; - mediaChangeInfo->SenseBuffer = senseBuffer; - - // Set default values for the media change notification - // configuration. - mediaChangeInfo->MediaChangeDetectionDisableCount = 0; - - // Assume that there is initially no media in the device - // only notify upper layers if there is something there - mediaChangeInfo->LastKnownMediaDetectionState = MediaUnknown; - mediaChangeInfo->LastReportedMediaDetectionState = MediaUnknown; - - // setup all extra flags we'll be setting for this irp - mediaChangeInfo->SrbFlags = 0; - - SET_FLAG(mediaChangeInfo->SrbFlags, SRB_CLASS_FLAGS_LOW_PRIORITY); - SET_FLAG(mediaChangeInfo->SrbFlags, SRB_FLAGS_NO_QUEUE_FREEZE); - SET_FLAG(mediaChangeInfo->SrbFlags, SRB_FLAGS_DISABLE_SYNCH_TRANSFER); - - if (AllowDriveToSleep) //FALSE for CD/DVD devices - { - SET_FLAG(mediaChangeInfo->SrbFlags, SRB_FLAGS_NO_KEEP_AWAKE); - } - - KeInitializeMutex(&mediaChangeInfo->MediaChangeMutex, 0x100); - - // It is ok to support media change events on this device. - DeviceExtension->MediaChangeDetectionInfo = mediaChangeInfo; - - // check the device supports GESN or not, initialize GESN structure if it supports. - { - // This is only valid for type5 devices. - NTSTATUS tempStatus = STATUS_SUCCESS; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceInitializeMcn: Testing for GESN\n")); - tempStatus = DeviceInitializeGesn(DeviceExtension); - - if (NT_SUCCESS(tempStatus)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceInitializeMcn: GESN available for %p\n", - DeviceExtension->DeviceObject)); - NT_ASSERT(mediaChangeInfo->Gesn.Supported ); - NT_ASSERT(mediaChangeInfo->Gesn.Buffer != NULL); - NT_ASSERT(mediaChangeInfo->Gesn.BufferSize != 0); - NT_ASSERT(mediaChangeInfo->Gesn.EventMask != 0); - } - else - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceInitializeMcn: GESN *NOT* available for %p\n", - DeviceExtension->DeviceObject)); - NT_ASSERT(!mediaChangeInfo->Gesn.Supported); - NT_ASSERT(mediaChangeInfo->Gesn.Buffer == NULL); - NT_ASSERT(mediaChangeInfo->Gesn.BufferSize == 0); - NT_ASSERT(mediaChangeInfo->Gesn.EventMask == 0); - mediaChangeInfo->Gesn.Supported = FALSE; // just in case.... - } - } - } - - if (NT_SUCCESS(status)) - { - // Register for display state change on AOAC capable systems so we can put the - // device to low power state when not required. - if (mediaChangeInfo->DisplayStateCallbackHandle == NULL) - { - POWER_PLATFORM_INFORMATION PlatformInfo = {0}; - - status = ZwPowerInformation(PlatformInformation, - NULL, - 0, - &PlatformInfo, - sizeof(PlatformInfo)); - - if (NT_SUCCESS(status) && PlatformInfo.AoAc) - { - PoRegisterPowerSettingCallback(DeviceExtension->DeviceObject, - &GUID_CONSOLE_DISPLAY_STATE, - &DevicePowerSettingCallback, - DeviceExtension, - &mediaChangeInfo->DisplayStateCallbackHandle); - } - - // Ignore any failures above. - status = STATUS_SUCCESS; - } - } - - if (!NT_SUCCESS(status)) - { - if (irp != NULL) - { - IoFreeIrp(irp); - } - FREE_POOL(senseBuffer); - FREE_POOL(mediaChangeInfo); - } - - return status; - -} // end DeviceInitializeMcn() - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceInitializeGesn( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - This routine initialize the contents of GESN structure. - -Arguments: - - DeviceExtension - the device extension - -Return Value: - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PNOTIFICATION_EVENT_STATUS_HEADER header = NULL; - CDROM_DETECTION_STATE detectionState = CdromDetectionUnknown; - PSTORAGE_DEVICE_DESCRIPTOR deviceDescriptor = DeviceExtension->DeviceDescriptor; - BOOLEAN retryImmediately = TRUE; - ULONG i = 0; - ULONG atapiResets = 0; - PMEDIA_CHANGE_DETECTION_INFO info = DeviceExtension->MediaChangeDetectionInfo; - - PAGED_CODE(); - - NT_ASSERT(info != NULL); - - // read if we already know the abilities of the device - DeviceGetParameter(DeviceExtension, - CLASSP_REG_SUBKEY_NAME, - CLASSP_REG_MMC_DETECTION_VALUE_NAME, - (PULONG)&detectionState); - - if (detectionState == CdromDetectionUnsupported) - { - status = STATUS_NOT_SUPPORTED; - } - - // check if the device has a hack flag saying never to try this. - if (NT_SUCCESS(status) && - (TEST_FLAG(DeviceExtension->PrivateFdoData->HackFlags, FDO_HACK_GESN_IS_BAD)) ) - { - DeviceSetParameter(DeviceExtension, - CLASSP_REG_SUBKEY_NAME, - CLASSP_REG_MMC_DETECTION_VALUE_NAME, - CdromDetectionUnsupported); - status = STATUS_NOT_SUPPORTED; - } - - // else go through the process since we allocate buffers and - // get all sorts of device settings. - if (NT_SUCCESS(status)) - { - if (info->Gesn.Buffer == NULL) - { - info->Gesn.Buffer = ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED, - GESN_BUFFER_SIZE, - CDROM_TAG_GESN); - } - - if (info->Gesn.Buffer == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - } - - if (NT_SUCCESS(status)) - { - if (info->Gesn.Mdl != NULL) - { - IoFreeMdl(info->Gesn.Mdl); - } - - info->Gesn.Mdl = IoAllocateMdl(info->Gesn.Buffer, - GESN_BUFFER_SIZE, - FALSE, - FALSE, - NULL); - if (info->Gesn.Mdl == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - } - - if (NT_SUCCESS(status)) - { - MmBuildMdlForNonPagedPool(info->Gesn.Mdl); - info->Gesn.BufferSize = GESN_BUFFER_SIZE; - info->Gesn.EventMask = 0; - - // all items are prepared to use GESN (except the event mask, so don't - // optimize this part out!). - // - // now see if it really works. we have to loop through this because - // many SAMSUNG (and one COMPAQ) drives timeout when requesting - // NOT_READY events, even when the IMMEDIATE bit is set. :( - // - // using a drive list is cumbersome, so this might fix the problem. - for (i = 0; (i < 16) && retryImmediately; i++) - { - status = RequestSetupMcnRequest(DeviceExtension, TRUE); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_MCN, - "Setup Mcn request failed %x for WDFDEVICE %p\n", - status, DeviceExtension->Device)); - break; - } - - NT_ASSERT(TEST_FLAG(info->MediaChangeSrb.SrbFlags, SRB_FLAGS_NO_QUEUE_FREEZE)); - - status = DeviceSendRequestSynchronously(DeviceExtension->Device, info->MediaChangeRequest, TRUE); - - if (SRB_STATUS(info->MediaChangeSrb.SrbStatus) != SRB_STATUS_SUCCESS) - { - // Release the queue if it is frozen. - if (info->MediaChangeSrb.SrbStatus & SRB_STATUS_QUEUE_FROZEN) - { - DeviceReleaseQueue(DeviceExtension->Device); - } - - RequestSenseInfoInterpret(DeviceExtension, - info->MediaChangeRequest, - &(info->MediaChangeSrb), - 0, - &status, - NULL); - } - - if ((deviceDescriptor->BusType == BusTypeAtapi) && - (info->MediaChangeSrb.SrbStatus == SRB_STATUS_BUS_RESET)) - { - // - // ATAPI unfortunately returns SRB_STATUS_BUS_RESET instead - // of SRB_STATUS_TIMEOUT, so we cannot differentiate between - // the two. if we get this status four time consecutively, - // stop trying this command. it is too late to change ATAPI - // at this point, so special-case this here. (07/10/2001) - // NOTE: any value more than 4 may cause the device to be - // marked missing. - // - atapiResets++; - if (atapiResets >= 4) - { - status = STATUS_IO_DEVICE_ERROR; - break; - } - } - - if (status == STATUS_DATA_OVERRUN) - { - status = STATUS_SUCCESS; - } - - if ((status == STATUS_INVALID_DEVICE_REQUEST) || - (status == STATUS_TIMEOUT) || - (status == STATUS_IO_DEVICE_ERROR) || - (status == STATUS_IO_TIMEOUT)) - { - // with these error codes, we don't ever want to try this command - // again on this device, since it reacts poorly. - DeviceSetParameter( DeviceExtension, - CLASSP_REG_SUBKEY_NAME, - CLASSP_REG_MMC_DETECTION_VALUE_NAME, - CdromDetectionUnsupported); - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_MCN, - "GESN test failed %x for WDFDEVICE %p\n", - status, DeviceExtension->Device)); - break; - } - - if (!NT_SUCCESS(status)) - { - // this may be other errors that should not disable GESN - // for all future start_device calls. - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_MCN, - "GESN test failed %x for WDFDEVICE %p\n", - status, DeviceExtension->Device)); - break; - } - else if (i == 0) - { - // the first time, the request was just retrieving a mask of - // available bits. use this to mask future requests. - header = (PNOTIFICATION_EVENT_STATUS_HEADER)(info->Gesn.Buffer); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "WDFDEVICE %p supports event mask %x\n", - DeviceExtension->Device, header->SupportedEventClasses)); - - if (TEST_FLAG(header->SupportedEventClasses, - NOTIFICATION_MEDIA_STATUS_CLASS_MASK)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN supports MCN\n")); - } - if (TEST_FLAG(header->SupportedEventClasses, - NOTIFICATION_DEVICE_BUSY_CLASS_MASK)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN supports DeviceBusy\n")); - } - if (TEST_FLAG(header->SupportedEventClasses, - NOTIFICATION_OPERATIONAL_CHANGE_CLASS_MASK)) - { - if (TEST_FLAG(DeviceExtension->PrivateFdoData->HackFlags, - FDO_HACK_GESN_IGNORE_OPCHANGE)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN supports OpChange, but must ignore these events for compatibility\n")); - CLEAR_FLAG(header->SupportedEventClasses, - NOTIFICATION_OPERATIONAL_CHANGE_CLASS_MASK); - } - else - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN supports OpChange\n")); - } - } - info->Gesn.EventMask = header->SupportedEventClasses; - - // - // realistically, we are only considering the following events: - // EXTERNAL REQUEST - this is being tested for play/stop/etc. - // MEDIA STATUS - autorun and ejection requests. - // DEVICE BUSY - to allow us to predict when media will be ready. - // therefore, we should not bother querying for the other, - // unknown events. clear all but the above flags. - // - info->Gesn.EventMask &= NOTIFICATION_OPERATIONAL_CHANGE_CLASS_MASK | - NOTIFICATION_EXTERNAL_REQUEST_CLASS_MASK | - NOTIFICATION_MEDIA_STATUS_CLASS_MASK | - NOTIFICATION_DEVICE_BUSY_CLASS_MASK ; - - - // - // HACKHACK - REF #0001 - // Some devices will *never* report an event if we've also requested - // that it report lower-priority events. this is due to a - // misunderstanding in the specification wherein a "No Change" is - // interpreted to be a real event. what should occur is that the - // device should ignore "No Change" events when multiple event types - // are requested unless there are no other events waiting. this - // greatly reduces the number of requests that the host must send - // to determine if an event has occurred. Since we must work on all - // drives, default to enabling the hack until we find evidence of - // proper firmware. - // - if (info->Gesn.EventMask == 0) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN supported, but not mask we care about (%x) for FDO %p\n", - header->SupportedEventClasses, - DeviceExtension->DeviceObject)); - // NOTE: the status is still status_sucess. - break; - } - else if (CountOfSetBitsUChar(info->Gesn.EventMask) == 1) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN hack not required for FDO %p\n", - DeviceExtension->DeviceObject)); - } - else - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN hack enabled for FDO %p\n", - DeviceExtension->DeviceObject)); - info->Gesn.HackEventMask = 1; - } - } - else - { - // i > 0; not the first time looping through, so interpret the results. - status = GesnDataInterpret(DeviceExtension, - (PVOID)info->Gesn.Buffer, - &retryImmediately); - - if (!NT_SUCCESS(status)) - { - // This drive does not support GESN correctly - DeviceSetParameter( DeviceExtension, - CLASSP_REG_SUBKEY_NAME, - CLASSP_REG_MMC_DETECTION_VALUE_NAME, - CdromDetectionUnsupported); - break; - } - } - } // end 'for' loop of GESN requests.... - } - - if (NT_SUCCESS(status)) - { - // - // we can only use this if it can be relied upon for media changes, - // since we are (by definition) no longer going to be polling via - // a TEST_UNIT_READY irp, and drives will not report UNIT ATTENTION - // for this command (although a filter driver, such as one for burning - // cd's, might still fake those errors). - // - // since we also rely upon NOT_READY events to change the cursor - // into a "wait" cursor; GESN is still more reliable than other - // methods, and includes eject button requests, so we'll use it - // without DEVICE_BUSY in Windows Vista. - // - - if (TEST_FLAG(info->Gesn.EventMask, NOTIFICATION_MEDIA_STATUS_CLASS_MASK)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "Enabling GESN support for WDFDEVICE %p\n", - DeviceExtension->Device)); - info->Gesn.Supported = TRUE; - - DeviceSetParameter( DeviceExtension, - CLASSP_REG_SUBKEY_NAME, - CLASSP_REG_MMC_DETECTION_VALUE_NAME, - CdromDetectionSupported); - } - else - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "GESN available but not enabled for WDFDEVICE %p\n", - DeviceExtension->Device)); - status = STATUS_NOT_SUPPORTED; - } - } - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_MCN, - "GESN support detection failed for WDFDEVICE %p with status %08x\n", - DeviceExtension->Device, status)); - - if (info->Gesn.Mdl) - { - PIRP irp = WdfRequestWdmGetIrp(info->MediaChangeRequest); - - IoFreeMdl(info->Gesn.Mdl); - info->Gesn.Mdl = NULL; - irp->MdlAddress = NULL; - } - - FREE_POOL(info->Gesn.Buffer); - info->Gesn.Supported = FALSE; - info->Gesn.EventMask = 0; - info->Gesn.BufferSize = 0; - } - - return status; -} - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceInitializeMediaChangeDetection( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - This routine checks to see if it is safe to initialize MCN (the back end - to autorun) for a given device. It will then check the device-type wide - key "Autorun" in the service key (for legacy reasons), and then look in - the device-specific key to potentially override that setting. - - If MCN is to be enabled, all neccessary structures and memory are - allocated and initialized. - - This routine MUST be called only from the DeviceInit...() . - -Arguments: - - DeviceExtension - the device to initialize MCN for, if appropriate - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - BOOLEAN disabled = FALSE; - BOOLEAN instanceOverride; - - PAGED_CODE(); - - // NOTE: This assumes that DeviceInitializeMediaChangeDetection is always - // called in the context of the DeviceInitDevicePhase2. If called - // after then this check will have already been made and the - // once a second timer will not have been enabled. - - disabled = DeviceIsMediaChangeDisabledDueToHardwareLimitation(DeviceExtension); - - if (disabled) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceInitializeMediaChangeDetection: Disabled due to hardware" - "limitations for this device\n")); - } - else - { - // autorun should now be enabled by default for all media types. - disabled = DeviceIsMediaChangeDisabledForClass(DeviceExtension); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceInitializeMediaChangeDetection: MCN is %s\n", - (disabled ? "disabled" : "enabled"))); - - status = DeviceMediaChangeDeviceInstanceOverride(DeviceExtension, - &instanceOverride); // default value - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceInitializeMediaChangeDetection: Instance using default\n")); - } - else - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceInitializeMediaChangeDetection: Instance override: %s MCN\n", - (instanceOverride ? "Enabling" : "Disabling"))); - disabled = !instanceOverride; - } - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceInitializeMediaChangeDetection: Instance MCN is %s\n", - (disabled ? "disabled" : "enabled"))); - } - - if (!disabled) - { - // if the drive is not a CDROM, allow the drive to sleep - status = DeviceInitializeMcn(DeviceExtension, FALSE); - } - - return status; -} // end DeviceInitializeMediaChangeDetection() - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceMediaChangeDeviceInstanceOverride( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Out_ PBOOLEAN Enabled - ) -/*++ - -Routine Description: - - The user can override the global setting to enable or disable Autorun on a - specific cdrom device via the control panel. This routine checks and/or - sets this value. - -Arguments: - - DeviceExtension - the device to set/get the value for - - Enabled - TRUE (Autorun is enabled) - FALSE (Autorun is disabled) -Return Value: - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_UNSUCCESSFUL; - WDFKEY deviceKey = NULL; - WDFKEY subKey = NULL; - - UNICODE_STRING subkeyName; - UNICODE_STRING enableMcnValueName; - UNICODE_STRING disableMcnValueName; - ULONG alwaysEnable = 0; - ULONG alwaysDisable = 0; - - PAGED_CODE(); - - status = WdfDeviceOpenRegistryKey(DeviceExtension->Device, - PLUGPLAY_REGKEY_DEVICE, - KEY_ALL_ACCESS, - WDF_NO_OBJECT_ATTRIBUTES, - &deviceKey); - if (!NT_SUCCESS(status)) - { - // this can occur when a new device is added to the system - // this is due to cdrom.sys being an 'essential' driver - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceMediaChangeDeviceInstanceOverride: " - "Could not open device registry key [%lx]\n", status)); - } - else - { - RtlInitUnicodeString(&subkeyName, MCN_REG_SUBKEY_NAME); - - status = WdfRegistryOpenKey(deviceKey, - &subkeyName, - KEY_READ, - WDF_NO_OBJECT_ATTRIBUTES, - &subKey); - } - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceMediaChangeDeviceInstanceOverride: " - "subkey could not be created. %lx\n", status)); - } - else - { - // Default to not changing autorun behavior, based upon setting - // registryValue to zero. - RtlInitUnicodeString(&enableMcnValueName, MCN_REG_AUTORUN_ENABLE_INSTANCE_NAME); - RtlInitUnicodeString(&disableMcnValueName, MCN_REG_AUTORUN_DISABLE_INSTANCE_NAME); - - // Ignore failures on reading of subkeys - (VOID) WdfRegistryQueryULong(subKey, - &enableMcnValueName, - &alwaysEnable); - (VOID) WdfRegistryQueryULong(subKey, - &disableMcnValueName, - &alwaysDisable); - } - - // set return value and cleanup - - if (subKey != NULL) - { - WdfRegistryClose(subKey); - } - - if (deviceKey != NULL) - { - WdfRegistryClose(deviceKey); - } - - if (alwaysEnable && alwaysDisable) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceMediaChangeDeviceInstanceOverride: %s selected\n", - "Both Enable and Disable set -- DISABLE")); - NT_ASSERT(NT_SUCCESS(status)); - status = STATUS_SUCCESS; - *Enabled = FALSE; - } - else if (alwaysDisable) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceMediaChangeDeviceInstanceOverride: %s selected\n", - "DISABLE")); - NT_ASSERT(NT_SUCCESS(status)); - status = STATUS_SUCCESS; - *Enabled = FALSE; - } - else if (alwaysEnable) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceMediaChangeDeviceInstanceOverride: %s selected\n", - "ENABLE")); - NT_ASSERT(NT_SUCCESS(status)); - status = STATUS_SUCCESS; - *Enabled = TRUE; - } - else - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceMediaChangeDeviceInstanceOverride: %s selected\n", - "DEFAULT")); - status = STATUS_UNSUCCESSFUL; - } - - return status; -} // end DeviceMediaChangeDeviceInstanceOverride() - - -NTSTATUS -DeviceMediaChangeRegistryCallBack( - _In_z_ PWSTR ValueName, - _In_ ULONG ValueType, - _In_reads_bytes_opt_(ValueLength) PVOID ValueData, - _In_ ULONG ValueLength, - _In_opt_ PVOID Context, - _In_opt_ PVOID EntryContext - ) -/*++ - -Routine Description: - - This callback for a registry SZ or MULTI_SZ is called once for each - SZ in the value. It will attempt to match the data with the - UNICODE_STRING passed in as Context, and modify EntryContext if a - match is found. Written for ClasspCheckRegistryForMediaChangeCompletion - -Arguments: - - ValueName - name of the key that was opened - ValueType - type of data stored in the value (REG_SZ for this routine) - ValueData - data in the registry, in this case a wide string - ValueLength - length of the data including the terminating null - Context - unicode string to compare against ValueData - EntryContext - should be initialized to 0, will be set to 1 if match found - -Return Value: - - STATUS_SUCCESS - EntryContext will be 1 if found - ---*/ -{ - PULONG valueFound; - PUNICODE_STRING deviceString; - PWSTR keyValue; - - PAGED_CODE(); - - UNREFERENCED_PARAMETER(ValueName); - - if ((Context == NULL) || (EntryContext == NULL)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_MCN, - "DeviceMediaChangeRegistryCallBack: NULL context should never be passed to registry call-back!\n")); - - return STATUS_SUCCESS; - } - - // if we have already set the value to true, exit - valueFound = EntryContext; - if ((*valueFound) != 0) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceMediaChangeRegistryCallBack: already set to true\n")); - return STATUS_SUCCESS; - } - - if (ValueLength == sizeof(WCHAR)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_MCN, - "DeviceMediaChangeRegistryCallBack: NULL string should never be passed to registry call-back!\n")); - return STATUS_SUCCESS; - } - - // if the data is not a terminated string, exit - if (ValueType != REG_SZ) - { - return STATUS_SUCCESS; - } - - deviceString = Context; - keyValue = ValueData; - ValueLength -= sizeof(WCHAR); // ignore the null character - - // do not compare more memory than is in deviceString - if (ValueLength > deviceString->Length) - { - ValueLength = deviceString->Length; - } - - if (keyValue == NULL) - { - return STATUS_SUCCESS; - } - - // if the strings match, disable autorun - if (RtlCompareMemory(deviceString->Buffer, keyValue, ValueLength) == ValueLength) - { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_MCN, "DeviceMediaChangeRegistryCallBack: Match found\n")); - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_MCN, "DeviceMediaChangeRegistryCallBack: DeviceString at %p\n", - deviceString->Buffer)); - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_MCN, - "DeviceMediaChangeRegistryCallBack: KeyValue at %p\n", - keyValue)); - (*valueFound) = TRUE; - } - - return STATUS_SUCCESS; -} // end DeviceMediaChangeRegistryCallBack() - - -_IRQL_requires_max_(PASSIVE_LEVEL) -BOOLEAN -DeviceIsMediaChangeDisabledDueToHardwareLimitation( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - The key AutoRunAlwaysDisable contains a MULTI_SZ of hardware IDs for - which to never enable MediaChangeNotification. - - The user can override the global setting to enable or disable Autorun on a - specific cdrom device via the control panel. - - NOTE: It's intended that not use WdfRegistryQueryMultiString in this funciton, - as it's much more complicated.(needs WDFCOLLECTION, WDFSTRING other than - UNICODE_STRING) - -Arguments: - - FdoExtension - - RegistryPath - pointer to the unicode string inside - ...\CurrentControlSet\Services\Cdrom - -Return Value: - - TRUE - no autorun. - FALSE - Autorun may be enabled - ---*/ -{ - NTSTATUS status; - - PSTORAGE_DEVICE_DESCRIPTOR deviceDescriptor = DeviceExtension->DeviceDescriptor; - WDFKEY wdfKey; - HANDLE serviceKey = NULL; - RTL_QUERY_REGISTRY_TABLE parameters[2] = {0}; - - UNICODE_STRING deviceUnicodeString = {0}; - ANSI_STRING deviceString = {0}; - ULONG mediaChangeNotificationDisabled = 0; - - PAGED_CODE(); - - // open the service key. - status = WdfDriverOpenParametersRegistryKey(WdfGetDriver(), - KEY_ALL_ACCESS, - WDF_NO_OBJECT_ATTRIBUTES, - &wdfKey); - - if(!NT_SUCCESS(status)) - { - NT_ASSERT(FALSE); - - // always take the safe path. if we can't open the service key, disable autorun - return TRUE; - } - - if(NT_SUCCESS(status)) - { - // Determine if drive is in a list of those requiring - // autorun to be disabled. this is stored in a REG_MULTI_SZ - // named AutoRunAlwaysDisable. this is required as some autochangers - // must load the disc to reply to ChkVerify request, causing them - // to cycle discs continuously. - - PWSTR nullMultiSz; - PUCHAR vendorId = NULL; - PUCHAR productId = NULL; - PUCHAR revisionId = NULL; - size_t length; - size_t offset; - - deviceString.Buffer = NULL; - deviceUnicodeString.Buffer = NULL; - - serviceKey = WdfRegistryWdmGetHandle(wdfKey); - - // there may be nothing to check against - if ((deviceDescriptor->VendorIdOffset == 0) && - (deviceDescriptor->ProductIdOffset == 0)) - { - // no valid data in device extension. - status = STATUS_INTERNAL_ERROR; - } - - // build deviceString using VendorId, Model and Revision. - // this string will be used to checked if it's one of devices in registry disable list. - if (NT_SUCCESS(status)) - { - length = 0; - - if (deviceDescriptor->VendorIdOffset == 0) - { - vendorId = NULL; - } - else - { - vendorId = (PUCHAR) deviceDescriptor + deviceDescriptor->VendorIdOffset; - length = strlen((LPCSTR)vendorId); - } - - if ( deviceDescriptor->ProductIdOffset == 0 ) - { - productId = NULL; - } - else - { - productId = (PUCHAR) deviceDescriptor + deviceDescriptor->ProductIdOffset; - length += strlen((LPCSTR)productId); - } - - if ( deviceDescriptor->ProductRevisionOffset == 0 ) - { - revisionId = NULL; - } - else - { - revisionId = (PUCHAR) deviceDescriptor + deviceDescriptor->ProductRevisionOffset; - length += strlen((LPCSTR)revisionId); - } - - // allocate a buffer for the string - deviceString.Length = (USHORT)( length ); - deviceString.MaximumLength = deviceString.Length + 1; - deviceString.Buffer = (PCHAR)ExAllocatePool2(POOL_FLAG_NON_PAGED, - deviceString.MaximumLength, - CDROM_TAG_AUTORUN_DISABLE - ); - if (deviceString.Buffer == NULL) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceIsMediaChangeDisabledDueToHardwareLimitation: Unable to alloc string buffer\n" )); - status = STATUS_INTERNAL_ERROR; - } - } - - if (NT_SUCCESS(status)) - { - // copy strings to the buffer - offset = 0; - - if (vendorId != NULL) - { - RtlCopyMemory(deviceString.Buffer + offset, - vendorId, - strlen((LPCSTR)vendorId)); - offset += strlen((LPCSTR)vendorId); - } - - if ( productId != NULL ) - { - RtlCopyMemory(deviceString.Buffer + offset, - productId, - strlen((LPCSTR)productId)); - offset += strlen((LPCSTR)productId); - } - if ( revisionId != NULL ) - { - RtlCopyMemory(deviceString.Buffer + offset, - revisionId, - strlen((LPCSTR)revisionId)); - offset += strlen((LPCSTR)revisionId); - } - - NT_ASSERT(offset == deviceString.Length); - - #pragma warning(suppress:6386) // Not an issue as deviceString.Buffer is of size deviceString.MaximumLength, which is equal to (deviceString.Length + 1) - deviceString.Buffer[deviceString.Length] = '\0'; // Null-terminated - - // convert to unicode as registry deals with unicode strings - status = RtlAnsiStringToUnicodeString( &deviceUnicodeString, - &deviceString, - TRUE - ); - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceIsMediaChangeDisabledDueToHardwareLimitation: cannot convert " - "to unicode %lx\n", status)); - } - } - - if (NT_SUCCESS(status)) - { - // query the value, setting valueFound to true if found - nullMultiSz = L"\0"; - parameters[0].QueryRoutine = DeviceMediaChangeRegistryCallBack; - parameters[0].Flags = RTL_QUERY_REGISTRY_REQUIRED; - parameters[0].Name = L"AutoRunAlwaysDisable"; - parameters[0].EntryContext = &mediaChangeNotificationDisabled; - parameters[0].DefaultType = REG_MULTI_SZ; - parameters[0].DefaultData = nullMultiSz; - parameters[0].DefaultLength = 0; - - status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, - serviceKey, - parameters, - &deviceUnicodeString, - NULL); - UNREFERENCED_PARAMETER(status); //defensive coding, avoid PREFAST warning. - } - } - - // Cleanup - { - - FREE_POOL( deviceString.Buffer ); - if (deviceUnicodeString.Buffer != NULL) - { - RtlFreeUnicodeString( &deviceUnicodeString ); - } - - // handle serviceKey will be closed by framework while it closes registry key. - WdfRegistryClose(wdfKey); - } - - if (mediaChangeNotificationDisabled > 0) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceIsMediaChangeDisabledDueToHardwareLimitation: Device is on MCN disable list\n")); - } - - return (mediaChangeNotificationDisabled > 0); - -} // end DeviceIsMediaChangeDisabledDueToHardwareLimitation() - - -_IRQL_requires_max_(PASSIVE_LEVEL) -BOOLEAN -DeviceIsMediaChangeDisabledForClass( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - The user must specify that AutoPlay is to run on the platform - by setting the registry value HKEY_LOCAL_MACHINE\System\CurrentControlSet\ - Services\\Autorun:REG_DWORD:1. - - The user can override the global setting to enable or disable Autorun on a - specific cdrom device via the control panel. - -Arguments: - - DeviceExtension - device extension - -Return Value: - - TRUE - Autorun is disabled for this class - FALSE - Autorun is enabled for this class - ---*/ -{ - NTSTATUS status; - WDFKEY serviceKey = NULL; - WDFKEY parametersKey = NULL; - - UNICODE_STRING parameterKeyName; - UNICODE_STRING valueName; - - // Default to ENABLING MediaChangeNotification (!) - ULONG mcnRegistryValue = 1; - - PAGED_CODE(); - - // open the service key. - status = WdfDriverOpenParametersRegistryKey(WdfGetDriver(), - KEY_ALL_ACCESS, - WDF_NO_OBJECT_ATTRIBUTES, - &serviceKey); - if(!NT_SUCCESS(status)) - { - // return the default value, which is the inverse of the registry setting default - // since this routine asks if it's disabled - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceIsMediaChangeDisabledForClass: Defaulting to %s\n", - (mcnRegistryValue ? "Enabled" : "Disabled"))); - return (BOOLEAN)(mcnRegistryValue == 0); - } - else - { - // Open the parameters key (if any) beneath the services key. - RtlInitUnicodeString(¶meterKeyName, L"Parameters"); - - status = WdfRegistryOpenKey(serviceKey, - ¶meterKeyName, - KEY_READ, - WDF_NO_OBJECT_ATTRIBUTES, - ¶metersKey); - } - - if (!NT_SUCCESS(status)) - { - parametersKey = NULL; - } - - RtlInitUnicodeString(&valueName, L"Autorun"); - // ignore failures - status = WdfRegistryQueryULong(serviceKey, - &valueName, - &mcnRegistryValue); - - if (NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_MCN, - "DeviceIsMediaChangeDisabledForClass: /Autorun flag = %d\n", - mcnRegistryValue)); - } - - if (parametersKey != NULL) - { - status = WdfRegistryQueryULong(parametersKey, - &valueName, - &mcnRegistryValue); - - if (NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_MCN, - "DeviceIsMediaChangeDisabledForClass: /Parameters/Autorun flag = %d\n", - mcnRegistryValue)); - } - - WdfRegistryClose(parametersKey); - } - - WdfRegistryClose(serviceKey); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceIsMediaChangeDisabledForClass: Autoplay for device %p is %s\n", - DeviceExtension->DeviceObject, - (mcnRegistryValue ? "on" : "off") - )); - - // return if it is _disabled_, which is the - // inverse of the registry setting - - return (BOOLEAN)(!mcnRegistryValue); -} // end DeviceIsMediaChangeDisabledForClass() - - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceEnableMediaChangeDetection( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Inout_ PFILE_OBJECT_CONTEXT FileObjectContext, - _In_ BOOLEAN IgnorePreviousMediaChanges - ) -/*++ - -Routine Description: - - When the disable count decrease to 0, enable the MCN - -Arguments: - - DeviceExtension - the device context - - FileObjectContext - the file object context - - IgnorePreviousMediaChanges - ignore all previous media changes - -Return Value: - None. - ---*/ -{ - PMEDIA_CHANGE_DETECTION_INFO info = DeviceExtension->MediaChangeDetectionInfo; - LONG oldCount; - - PAGED_CODE(); - - if (FileObjectContext) - { - InterlockedDecrement((PLONG)&(FileObjectContext->McnDisableCount)); - } - - if (info == NULL) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceEnableMediaChangeDetection: not initialized\n")); - return; - } - - (VOID) KeWaitForMutexObject(&info->MediaChangeMutex, - UserRequest, - KernelMode, - FALSE, - NULL); - - oldCount = --info->MediaChangeDetectionDisableCount; - - NT_ASSERT(oldCount >= 0); - - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_MCN, - "DeviceEnableMediaChangeDetection: Disable count reduced to %d - \n", - info->MediaChangeDetectionDisableCount)); - - if (oldCount == 0) - { - if (IgnorePreviousMediaChanges) - { - info->LastReportedMediaDetectionState = info->LastKnownMediaDetectionState; - } - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, "MCN is enabled\n")); - } - else - { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_MCN, "MCD still disabled\n")); - } - - // Let something else run. - KeReleaseMutex(&info->MediaChangeMutex, FALSE); - - return; -} // end DeviceEnableMediaChangeDetection() - - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceDisableMediaChangeDetection( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Inout_ PFILE_OBJECT_CONTEXT FileObjectContext - ) -/*++ - -Routine Description: - - Increase the disable count. - -Arguments: - - DeviceExtension - the device context - - FileObjectContext - the file object context - -Return Value: - None. - ---*/ -{ - PMEDIA_CHANGE_DETECTION_INFO info = DeviceExtension->MediaChangeDetectionInfo; - - PAGED_CODE(); - - if (FileObjectContext) - { - InterlockedIncrement((PLONG)&(FileObjectContext->McnDisableCount)); - } - - if (info == NULL) - { - return; - } - - (VOID) KeWaitForMutexObject(&info->MediaChangeMutex, - UserRequest, - KernelMode, - FALSE, - NULL); - - info->MediaChangeDetectionDisableCount++; - - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_MCN, - "DisableMediaChangeDetection: disable count is %d\n", - info->MediaChangeDetectionDisableCount)); - - KeReleaseMutex(&info->MediaChangeMutex, FALSE); - - return; -} // end DeviceDisableMediaChangeDetection() - - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceReleaseMcnResources( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - This routine will cleanup any resources allocated for MCN. It is called - by classpnp during remove device, and therefore is not typically required - by external drivers. - -Arguments: - - DeviceExtension - the device context - -Return Value: - None. - ---*/ -{ - PMEDIA_CHANGE_DETECTION_INFO info = DeviceExtension->MediaChangeDetectionInfo; - - PAGED_CODE() - - if(info == NULL) - { - return; - } - - if (info->Gesn.Mdl) - { - PIRP irp = WdfRequestWdmGetIrp(info->MediaChangeRequest); - IoFreeMdl(info->Gesn.Mdl); - irp->MdlAddress = NULL; - } - IoFreeIrp(info->MediaChangeSyncIrp); - FREE_POOL(info->Gesn.Buffer); - FREE_POOL(info->SenseBuffer); - - if (info->DisplayStateCallbackHandle) - { - PoUnregisterPowerSettingCallback(info->DisplayStateCallbackHandle); - info->DisplayStateCallbackHandle = NULL; - } - - FREE_POOL(info); - - DeviceExtension->MediaChangeDetectionInfo = NULL; - - return; -} // end DeviceReleaseMcnResources() - - -IO_COMPLETION_ROUTINE RequestMcnSyncIrpCompletion; - -NTSTATUS -RequestMcnSyncIrpCompletion( - _In_ PDEVICE_OBJECT DeviceObject, - _In_ PIRP Irp, - _In_reads_opt_(_Inexpressible_("varies")) PVOID Context - ) -/*++ - -Routine Description: - - The MCN work finishes, reset the fields to allow another MCN request - be scheduled. - -Arguments: - - DeviceObject - device that the completion routine fires on. - - Irp - The irp to be completed. - - Context - IRP context - -Return Value: - NTSTATUS - ---*/ -{ - PCDROM_DEVICE_EXTENSION DeviceExtension = NULL; - PMEDIA_CHANGE_DETECTION_INFO info = NULL; - - if (Context == NULL) - { - // this will never happen, but code must be there to prevent OACR warnings. - return STATUS_MORE_PROCESSING_REQUIRED; - } - - DeviceExtension = (PCDROM_DEVICE_EXTENSION) Context; - info = DeviceExtension->MediaChangeDetectionInfo; - -#ifndef DEBUG - UNREFERENCED_PARAMETER(Irp); -#endif - UNREFERENCED_PARAMETER(DeviceObject); - - NT_ASSERT(Irp == info->MediaChangeSyncIrp); - - IoReuseIrp(info->MediaChangeSyncIrp, STATUS_NOT_SUPPORTED); - - // reset the value to let timer routine be able to send the next request. - InterlockedCompareExchange((PLONG)&(info->MediaChangeRequestInUse), 0, 1); - - return STATUS_MORE_PROCESSING_REQUIRED; -} - - -VOID -RequestSetupMcnSyncIrp( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - setup the MCN synchronization irp. - -Arguments: - - DeviceExtension - the device context - -Return Value: - None - ---*/ -{ - PIRP irp = NULL; - PIO_STACK_LOCATION irpStack = NULL; - PIO_STACK_LOCATION nextIrpStack = NULL; - - irp = DeviceExtension->MediaChangeDetectionInfo->MediaChangeSyncIrp; - NT_ASSERT(irp != NULL); - - // - // For the driver that creates an IRP, there is no 'current' stack location. - // Step down one IRP stack location so that the extra top one - // becomes our 'current' one. - // - IoSetNextIrpStackLocation(irp); - - /* - * Cache our device object in the extra top IRP stack location - * so we have it in our completion routine. - */ - irpStack = IoGetCurrentIrpStackLocation(irp); - irpStack->DeviceObject = DeviceExtension->DeviceObject; - - // - // If the irp is sent down when the volume needs to be - // verified, CdRomUpdateGeometryCompletion won't complete - // it since it's not associated with a thread. Marking - // it to override the verify causes it always be sent - // to the port driver - // - nextIrpStack = IoGetNextIrpStackLocation(irp); - - SET_FLAG(nextIrpStack->Flags, SL_OVERRIDE_VERIFY_VOLUME); - - nextIrpStack->MajorFunction = IRP_MJ_DEVICE_CONTROL; - // pick up this IOCTL code as it's not normaly seen for CD/DVD drive and does not require input. - // set other fields to make this IOCTL recognizable by CDROM.SYS - nextIrpStack->Parameters.Others.Argument1 = RequestSetupMcnSyncIrp; - nextIrpStack->Parameters.Others.Argument2 = RequestSetupMcnSyncIrp; - nextIrpStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_MCN_SYNC_FAKE_IOCTL; //Argument3. - nextIrpStack->Parameters.Others.Argument4 = RequestSetupMcnSyncIrp; - - IoSetCompletionRoutine(irp, - RequestMcnSyncIrpCompletion, - DeviceExtension, - TRUE, - TRUE, - TRUE); - - return; -} - - -VOID -DeviceMainTimerTickHandler( - _In_ WDFTIMER Timer - ) -/*++ - -Routine Description: - - This routine setup a sync irp and send it to the serial queue. - Serial queue will process MCN when receive this sync irp. - -Arguments: - - Timer - the timer object that fires. - -Return Value: - None - ---*/ -{ - PCDROM_DEVICE_EXTENSION deviceExtension = NULL; - size_t dataLength = 0; - - deviceExtension = WdfObjectGetTypedContext(WdfTimerGetParentObject(Timer), CDROM_DEVICE_EXTENSION); - - (void) RequestHandleEventNotification(deviceExtension, NULL, NULL, &dataLength); - - return; -} // end DeviceMainTimerTickHandler() - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceEnableMainTimer( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - This routine will allocate timer related resources on the first time call. - Start the timer. - -Arguments: - - DeviceExtension - the device context - -Return Value: - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - if ((DeviceExtension->MediaChangeDetectionInfo == NULL) || - (DeviceExtension->MediaChangeDetectionInfo->AsynchronousNotificationSupported != FALSE)) - { - // Asynchronous Notification is enabled, timer not needed. - return status; - } - - if (DeviceExtension->MainTimer == NULL) - { - //create main timer object. - WDF_TIMER_CONFIG timerConfig; - WDF_OBJECT_ATTRIBUTES timerAttributes; - - WDF_TIMER_CONFIG_INIT(&timerConfig, DeviceMainTimerTickHandler); - - // Polling frequently on virtual optical devices created by Hyper-V will - // cause a significant perf / power hit. These devices need to be polled - // less frequently for device state changes. - if (TEST_FLAG(DeviceExtension->DeviceAdditionalData.HackFlags, CDROM_HACK_MSFT_VIRTUAL_ODD)) - { - timerConfig.Period = 2000; // 2 seconds, in milliseconds. - } - else - { - timerConfig.Period = 1000; // 1 second, in milliseconds. - } - - timerConfig.TolerableDelay = 500; // 0.5 seconds, in milliseconds - - //Set the autoSerialization to FALSE, as the parent device's - //execute level is WdfExecutionLevelPassive. - timerConfig.AutomaticSerialization = FALSE; - - WDF_OBJECT_ATTRIBUTES_INIT(&timerAttributes); - timerAttributes.ParentObject = DeviceExtension->Device; - timerAttributes.ExecutionLevel = WdfExecutionLevelInheritFromParent; - - status = WdfTimerCreate(&timerConfig, - &timerAttributes, - &DeviceExtension->MainTimer); - } - - if (NT_SUCCESS(status)) - { - WdfTimerStart(DeviceExtension->MainTimer,WDF_REL_TIMEOUT_IN_MS(100)); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceEnableMainTimer: Once a second timer enabled for WDFDEVICE %p\n", - DeviceExtension->Device)); - } - else - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceEnableMainTimer: WDFDEVICE %p, Status %lx initializing timer\n", - DeviceExtension->Device, status)); - } - - return status; -} // end DeviceEnableMainTimer() - - -_IRQL_requires_max_(PASSIVE_LEVEL) -VOID -DeviceDisableMainTimer( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - stop the timer. - -Arguments: - - DeviceExtension - device context - -Return Value: - None - ---*/ -{ - PAGED_CODE(); - - if ((DeviceExtension->MediaChangeDetectionInfo == NULL) || - (DeviceExtension->MediaChangeDetectionInfo->AsynchronousNotificationSupported != FALSE)) - { - // Asynchronous Notification is enabled, timer not needed. - return; - } - - if (DeviceExtension->MainTimer != NULL) - { - // - // we are only going to stop the actual timer in remove device routine. - // it is the responsibility of the code within the timer routine to - // check if the device is removed and not processing io for the final - // call. - // this keeps the code clean and prevents lots of bugs. - // - WdfTimerStop(DeviceExtension->MainTimer,TRUE); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "DeviceDisableMainTimer: Once a second timer disabled for device %p\n", - DeviceExtension->Device)); - } - else - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_MCN, - "DeviceDisableMainTimer: Timer never enabled\n")); - } - - return; -} // end DeviceDisableMainTimer() - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleMcnControl( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - This routine handles the process of IOCTL_STORAGE_MCN_CONTROL - -Arguments: - - DeviceExtension - device context - - Request - request object - - RequestParameters - request parameters - - DataLength - data transferred - -Return Value: - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - WDFFILEOBJECT fileObject = NULL; - PFILE_OBJECT_CONTEXT fileObjectContext = NULL; - PPREVENT_MEDIA_REMOVAL mediaRemoval = NULL; - - PAGED_CODE(); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - sizeof(PREVENT_MEDIA_REMOVAL), - &mediaRemoval, - NULL); - - if (NT_SUCCESS(status)) - { - fileObject = WdfRequestGetFileObject(Request); - - // Check to make sure we have a file object extension to keep track of this - // request. If not we'll fail it before synchronizing. - if (fileObject != NULL) - { - fileObjectContext = FileObjectGetContext(fileObject); - } - - if ((fileObjectContext == NULL) && - (WdfRequestGetRequestorMode(Request) == KernelMode)) - { - fileObjectContext = &DeviceExtension->KernelModeMcnContext; - } - - if (fileObjectContext == NULL) - { - // This handle isn't setup correctly. We can't let the - // operation go. - status = STATUS_INVALID_PARAMETER; - } - } - - if (NT_SUCCESS(status)) - { - if (mediaRemoval->PreventMediaRemoval) - { - // This is a lock command. Reissue the command in case bus or - // device was reset and the lock was cleared. - DeviceDisableMediaChangeDetection(DeviceExtension, fileObjectContext); - } - else - { - if (fileObjectContext->McnDisableCount == 0) - { - status = STATUS_INVALID_DEVICE_STATE; - } - else - { - DeviceEnableMediaChangeDetection(DeviceExtension, fileObjectContext, TRUE); - } - } - } - - return status; -} // end RequestHandleMcnControl() - -#pragma warning(pop) // un-sets any local warning changes - diff --git a/storage/class/cdrom/src/cdrom.c b/storage/class/cdrom/src/cdrom.c deleted file mode 100644 index fccf4a0e..00000000 --- a/storage/class/cdrom/src/cdrom.c +++ /dev/null @@ -1,4225 +0,0 @@ -/*-- - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - cdrom.c - -Abstract: - - The CDROM class driver tranlates IRPs to SRBs with embedded CDBs - and sends them to its devices through the port driver. - -Environment: - - kernel mode only - -Notes: - - -Revision History: - ---*/ - -// this definition is used to link _StorDebugPrint() function. -#define DEBUG_MAIN_SOURCE 1 - - -#include "ntddk.h" -#include "ntstrsafe.h" - -#include "ntddstor.h" -#include "ntddtape.h" -#include "wdfcore.h" -#include "devpkey.h" - -#include "cdrom.h" -#include "ioctl.h" -#include "mmc.h" -#include "scratch.h" - - -#ifdef DEBUG_USE_WPP -#include "cdrom.tmh" -#endif - -BOOLEAN -BootEnvironmentIsWinPE( - VOID - ); - -#ifdef ALLOC_PRAGMA - -#pragma alloc_text(INIT, DriverEntry) -#pragma alloc_text(INIT, BootEnvironmentIsWinPE) - -#pragma alloc_text(PAGE, DriverEvtCleanup) -#pragma alloc_text(PAGE, DriverEvtDeviceAdd) -#pragma alloc_text(PAGE, DeviceEvtCleanup) -#pragma alloc_text(PAGE, DeviceEvtSelfManagedIoCleanup) -#pragma alloc_text(PAGE, DeviceEvtD0Exit) -#pragma alloc_text(PAGE, CreateQueueEvtIoDefault) -#pragma alloc_text(PAGE, DeviceEvtFileClose) -#pragma alloc_text(PAGE, DeviceCleanupProtectedLocks) -#pragma alloc_text(PAGE, DeviceCleanupDisableMcn) -#pragma alloc_text(PAGE, RequestProcessSerializedIoctl) -#pragma alloc_text(PAGE, ReadWriteWorkItemRoutine) -#pragma alloc_text(PAGE, IoctlWorkItemRoutine) -#pragma alloc_text(PAGE, DeviceEvtSurpriseRemoval) - -#endif - -NTSTATUS -DriverEntry( - _In_ PDRIVER_OBJECT DriverObject, - _In_ PUNICODE_STRING RegistryPath - ) -/*++ - -Routine Description: - - Installable driver initialization entry point. - This entry point is called directly by the I/O system. - -Arguments: - - DriverObject - pointer to the driver object - - RegistryPath - pointer to a unicode string representing the path, - to driver-specific key in the registry. - -Return Value: - - STATUS_SUCCESS if successful, - STATUS_UNSUCCESSFUL otherwise. - ---*/ -{ - NTSTATUS status; - WDF_DRIVER_CONFIG config; - WDF_OBJECT_ATTRIBUTES attributes; - WDFDRIVER driverObject = NULL; - - PAGED_CODE(); - - // Initialize WPP Tracing - WPP_INIT_TRACING(DriverObject, RegistryPath); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "CDROM.SYS DriverObject %p loading\n", - DriverObject)); - - // Register DeviceAdd and DriverEvtCleanup callback. - // WPP_CLEANUP will be called in DriverEvtCleanup - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, CDROM_DRIVER_EXTENSION); - attributes.EvtCleanupCallback = DriverEvtCleanup; - - WDF_DRIVER_CONFIG_INIT(&config, DriverEvtDeviceAdd); - - status = WdfDriverCreate(DriverObject, - RegistryPath, - &attributes, - &config, - &driverObject); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_INIT, - "WdfDriverCreate failed. %x\n", - status)); - - // Cleanup tracing here because DriverUnload will not be called - // as we have failed to create WDFDRIVER object itself. - WPP_CLEANUP(DriverObject); - - } - else - { - PCDROM_DRIVER_EXTENSION driverExtension = DriverGetExtension(driverObject); - - // Copy the registry path into the driver extension so we can use it later - driverExtension->Version = 0x01; - driverExtension->DriverObject = DriverObject; - - if (BootEnvironmentIsWinPE()) { - - SET_FLAG(driverExtension->Flags, CDROM_FLAG_WINPE_MODE); - } - - } - - return status; -} - - -BOOLEAN -BootEnvironmentIsWinPE( - VOID - ) -/*++ - -Routine Description: - - This routine determines if the boot enviroment is WinPE - -Arguments: - - None - -Return Value: - - BOOLEAN - TRUE if the environment is WinPE; FALSE otherwise - ---*/ -{ - NTSTATUS status; - WDFKEY registryKey = NULL; - - DECLARE_CONST_UNICODE_STRING(registryKeyName, WINPE_REG_KEY_NAME); - - PAGED_CODE(); - - status = WdfRegistryOpenKey(NULL, - ®istryKeyName, - KEY_READ, - WDF_NO_OBJECT_ATTRIBUTES, - ®istryKey); - - if (!NT_SUCCESS(status)) - { - return FALSE; - } - - WdfRegistryClose(registryKey); - return TRUE; -} // end BootEnvironmentIsWinPE() - - -VOID -DriverEvtCleanup( - _In_ WDFOBJECT Driver - ) -/*++ -Routine Description: - - Free all the resources allocated in DriverEntry. - -Arguments: - - Driver - handle to a WDF Driver object. - -Return Value: - - VOID. - ---*/ -{ - WDFDRIVER driver = (WDFDRIVER)Driver; - - PAGED_CODE (); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "CDROM.SYS DriverObject %p cleanup. Will be unloaded soon\n", - driver)); - - // Stop WPP Tracing - WPP_CLEANUP( WdfDriverWdmGetDriverObject(driver) ); - - - return; -} - - -NTSTATUS -DriverEvtDeviceAdd( - _In_ WDFDRIVER Driver, - _Inout_ PWDFDEVICE_INIT DeviceInit - ) -/*++ - -Routine Description: - - EvtDeviceAdd is called by the framework in response to AddDevice - call from the PnP manager. - - -Arguments: - - Driver - Handle to a framework driver object created in DriverEntry - - DeviceInit - Pointer to a framework-allocated WDFDEVICE_INIT structure. - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DRIVER_EXTENSION driverExtension = NULL; - WDFDEVICE device = NULL; - PCDROM_DEVICE_EXTENSION deviceExtension = NULL; - BOOLEAN deviceClaimed = FALSE; - - WDF_OBJECT_ATTRIBUTES attributes; - WDF_FILEOBJECT_CONFIG fileObjectConfig; - WDF_IO_TARGET_OPEN_PARAMS ioTargetOpenParams; - WDF_IO_QUEUE_CONFIG queueConfig; - WDF_PNPPOWER_EVENT_CALLBACKS pnpPowerCallbacks; - WDF_REMOVE_LOCK_OPTIONS removeLockOptions; - PWCHAR wideDeviceName = NULL; - UNICODE_STRING unicodeDeviceName; - PDEVICE_OBJECT lowerPdo = NULL; - ULONG deviceNumber = 0; - ULONG devicePropertySessionId = INVALID_SESSION; - ULONG devicePropertySize = 0; - DEVPROPTYPE devicePropertyType = DEVPROP_TYPE_EMPTY; - - PAGED_CODE(); - - driverExtension = DriverGetExtension(Driver); - - // 0. Initialize the objects that we're going to use - RtlInitUnicodeString(&unicodeDeviceName, NULL); - - // 1. Register PnP&Power callbacks for any we are interested in. - // If a callback isn't set, Framework will take the default action by itself. - { - // Zero out the PnpPowerCallbacks structure. - WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks); - - // Use this callback to init resources that are used by the device and only needs to be called once. - pnpPowerCallbacks.EvtDeviceSelfManagedIoInit = DeviceEvtSelfManagedIoInit; - - // Use this callback to prepare device for coming back from a lower power mode to D0. - pnpPowerCallbacks.EvtDeviceD0Entry = DeviceEvtD0Entry; - - // Use this callback to prepare device for entering into a lower power mode. - pnpPowerCallbacks.EvtDeviceD0Exit = DeviceEvtD0Exit; - - // Use this callback to free any resources used by device and will be called when the device is - // powered down. - pnpPowerCallbacks.EvtDeviceSelfManagedIoCleanup = DeviceEvtSelfManagedIoCleanup; - - pnpPowerCallbacks.EvtDeviceSurpriseRemoval = DeviceEvtSurpriseRemoval; - - // Register the PnP and power callbacks. - WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &pnpPowerCallbacks); - } - - // 2. Register the EvtIoInCallerContext to deal with IOCTLs that need to stay in original context. - WdfDeviceInitSetIoInCallerContextCallback(DeviceInit, - DeviceEvtIoInCallerContext); - - // 3. Register PreprocessCallback for IRP_MJ_POWER, IRP_MJ_FLUSH_BUFFERS and IRP_MJ_SHUTDOWN - { - UCHAR minorFunctions[1]; - - minorFunctions[0] = IRP_MN_SET_POWER; - - status = WdfDeviceInitAssignWdmIrpPreprocessCallback(DeviceInit, - RequestProcessSetPower, - IRP_MJ_POWER, - minorFunctions, - RTL_NUMBER_OF(minorFunctions)); - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_PNP, - "DriverEvtDeviceAdd: Assign IrpPreprocessCallback for IRP_MJ_POWER failed, " - "status: 0x%X\n", status)); - - goto Exit; - } - - status = WdfDeviceInitAssignWdmIrpPreprocessCallback(DeviceInit, - RequestProcessShutdownFlush, - IRP_MJ_FLUSH_BUFFERS, - NULL, - 0); - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_PNP, - "DriverEvtDeviceAdd: Assign IrpPreprocessCallback for IRP_MJ_FLUSH_BUFFERS failed, " - "status: 0x%X\n", status)); - - goto Exit; - } - - status = WdfDeviceInitAssignWdmIrpPreprocessCallback(DeviceInit, - RequestProcessShutdownFlush, - IRP_MJ_SHUTDOWN, - NULL, - 0); - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_PNP, - "DriverEvtDeviceAdd: Assign IrpPreprocessCallback for IRP_MJ_SHUTDOWN failed, " - "status: 0x%X\n", status)); - - goto Exit; - } - } - - // 4. Set attributes to create Request Context area. - { - //Reuse this structure. - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, - CDROM_REQUEST_CONTEXT); - attributes.EvtCleanupCallback = RequestEvtCleanup; - - WdfDeviceInitSetRequestAttributes(DeviceInit, - &attributes); - } - - // 5. Register FileObject related callbacks - { - // Add FILE_OBJECT_EXTENSION as the context to the file object. - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, FILE_OBJECT_CONTEXT); - - // Set Entry points for Create and Close.. - - // The framework doesn't sync the file create requests with pnp/power - // state. Re-direct all the file create requests to a dedicated - // queue, which will be purged manually during removal. - WDF_FILEOBJECT_CONFIG_INIT(&fileObjectConfig, - NULL, //CreateQueueEvtIoDefault, - DeviceEvtFileClose, - WDF_NO_EVENT_CALLBACK); // No callback for Cleanup - - fileObjectConfig.FileObjectClass = WdfFileObjectWdfCannotUseFsContexts; - - // Since we are registering file events and fowarding create request - // ourself, we must also set AutoForwardCleanupClose so that cleanup - // and close can also get forwarded. - fileObjectConfig.AutoForwardCleanupClose = WdfTrue; - attributes.SynchronizationScope = WdfSynchronizationScopeNone; - attributes.ExecutionLevel = WdfExecutionLevelPassive; - - // Indicate that file object is optional. - fileObjectConfig.FileObjectClass |= WdfFileObjectCanBeOptional; - - WdfDeviceInitSetFileObjectConfig(DeviceInit, - &fileObjectConfig, - &attributes); - } - - // 6. Initialize device-wide attributes - { - // Declare ourselves as NOT owning power policy. - // The power policy owner in storage stack is port driver. - WdfDeviceInitSetPowerPolicyOwnership(DeviceInit, FALSE); - - // Set other DeviceInit attributes. - WdfDeviceInitSetExclusive(DeviceInit, FALSE); - WdfDeviceInitSetDeviceType(DeviceInit, FILE_DEVICE_CD_ROM); - WdfDeviceInitSetCharacteristics(DeviceInit, FILE_REMOVABLE_MEDIA, FALSE); - WdfDeviceInitSetIoType(DeviceInit, WdfDeviceIoDirect); - WdfDeviceInitSetPowerPageable(DeviceInit); - - // We require the framework to acquire a remove lock before delivering all IRP types - WDF_REMOVE_LOCK_OPTIONS_INIT(&removeLockOptions, - WDF_REMOVE_LOCK_OPTION_ACQUIRE_FOR_IO); - - WdfDeviceInitSetRemoveLockOptions(DeviceInit, &removeLockOptions); - - // save the PDO for later reference - lowerPdo = WdfFdoInitWdmGetPhysicalDevice(DeviceInit); - - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, - CDROM_DEVICE_EXTENSION); - - // We have a parallel queue, so WdfSynchronizationScopeNone is our only choice. - attributes.SynchronizationScope = WdfSynchronizationScopeNone; - attributes.ExecutionLevel = WdfExecutionLevelDispatch; - - // Provide a cleanup callback which will release memory allocated with ExAllocatePool* - attributes.EvtCleanupCallback = DeviceEvtCleanup; - } - - // 7. Now, the device can be created. - { - wideDeviceName = ExAllocatePool2(POOL_FLAG_NON_PAGED, - 64 * sizeof(WCHAR), - CDROM_TAG_STRINGS); - - if (wideDeviceName == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - goto Exit; - } - - // Find the lowest device number currently available. - do { - status = RtlStringCchPrintfW((NTSTRSAFE_PWSTR)wideDeviceName, - 64, - L"\\Device\\CdRom%d", - deviceNumber); - - if (!NT_SUCCESS(status)) { - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_PNP, - "DriverEvtDeviceAdd: Format device name failed with error: 0x%X\n", status)); - - goto Exit; - } - - RtlInitUnicodeString(&unicodeDeviceName, wideDeviceName); - - status = WdfDeviceInitAssignName(DeviceInit, &unicodeDeviceName); - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_PNP, - "DriverEvtDeviceAdd: WdfDeviceInitAssignName() failed with error: 0x%X\n", status)); - - goto Exit; - } - - status = WdfDeviceCreate(&DeviceInit, &attributes, &device); - - deviceNumber++; - - } while (status == STATUS_OBJECT_NAME_COLLISION); - - // When this loop exits the count is inflated by one - fix that. - deviceNumber--; - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_PNP, - "DriverEvtDeviceAdd: Can not create a new device, status: 0x%X\n", - status)); - - goto Exit; - } - } - - // 8. Fill up basic Device Extension settings and create a remote I/O target for the next-lower driver. - // The reason why we do not use the local I/O target is because we want to be able to close the - // I/O target on surprise removal. - { - deviceExtension = DeviceGetExtension(device); - - deviceExtension->Version = 0x01; - deviceExtension->Size = sizeof(CDROM_DEVICE_EXTENSION); - - deviceExtension->DeviceObject = WdfDeviceWdmGetDeviceObject(device); - deviceExtension->Device = device; - deviceExtension->DriverExtension = driverExtension; - - deviceExtension->LowerPdo = lowerPdo; - - deviceExtension->DeviceType = FILE_DEVICE_CD_ROM; //Always a FILE_DEVICE_CD_ROM for all device it manages. - deviceExtension->DeviceName = unicodeDeviceName; - - deviceExtension->DeviceNumber = deviceNumber; - } - { - WDF_OBJECT_ATTRIBUTES_INIT(&attributes); - attributes.ParentObject = deviceExtension->Device; - - status = WdfIoTargetCreate(deviceExtension->Device, - &attributes, - &deviceExtension->IoTarget); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_PNP, - "DriverEvtDeviceAdd: Can not create a remote I/O target object, status: 0x%X\n", - status)); - goto Exit; - } - - WDF_IO_TARGET_OPEN_PARAMS_INIT_EXISTING_DEVICE(&ioTargetOpenParams, - WdfDeviceWdmGetAttachedDevice(deviceExtension->Device)); - - status = WdfIoTargetOpen(deviceExtension->IoTarget, - &ioTargetOpenParams); - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_PNP, - "DriverEvtDeviceAdd: Can not open a remote I/O target for the next-lower device, status: 0x%X\n", - status)); - - WdfObjectDelete(deviceExtension->IoTarget); - deviceExtension->IoTarget = NULL; - - goto Exit; - } - } - - // 9. Claim the device, so that port driver will only accept the commands from CDROM.SYS for this device. - // NOTE: The I/O should be issued after the device is started. But we would like to claim - // the device as soon as possible, so this legacy behavior is kept. - status = DeviceClaimRelease(deviceExtension, FALSE); - - if (!NT_SUCCESS(status)) - { - // Someone already had this device - we're in trouble - goto Exit; - } - else - { - deviceClaimed = TRUE; - } - - // - // CDROM Queueing Structure - // - // a. EvtIoInCallerContext (prior to queueing): - // This event will be used ONLY to forward down IOCTLs that come in at PASSIVE LEVEL - // and need to be forwarded down the stack in the original context. - // - // b. Main input queue: serial queue for main dispatching - // This queue will be used to do all dispatching of requests to serialize - // access to the device. Any request that was previously completed in - // the Dispatch routines will be completed here. Anything requiring device - // I/O will be sent through the serial I/O queue. - // - // 10. Set up IO queues after device being created. - // - { - WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&queueConfig, - WdfIoQueueDispatchSequential); - - queueConfig.PowerManaged = WdfFalse; - -#pragma prefast(push) -#pragma prefast(disable: 28155, "a joint handler for read/write cannot be EVT_WDF_IO_QUEUE_IO_READ and EVT_WDF_IO_QUEUE_IO_WRITE simultaneously") -#pragma prefast(disable: 28023, "a joint handler for read/write cannot be EVT_WDF_IO_QUEUE_IO_READ and EVT_WDF_IO_QUEUE_IO_WRITE simultaneously") - queueConfig.EvtIoRead = SequentialQueueEvtIoReadWrite; - queueConfig.EvtIoWrite = SequentialQueueEvtIoReadWrite; -#pragma prefast(pop) - - queueConfig.EvtIoDeviceControl = SequentialQueueEvtIoDeviceControl; - queueConfig.EvtIoCanceledOnQueue = SequentialQueueEvtCanceledOnQueue; - - status = WdfIoQueueCreate(device, - &queueConfig, - WDF_NO_OBJECT_ATTRIBUTES, - &(deviceExtension->SerialIOQueue)); - if (!NT_SUCCESS(status)) - { - goto Exit; - } - - // this queue is dedicated for file create requests. - WDF_IO_QUEUE_CONFIG_INIT(&queueConfig, WdfIoQueueDispatchParallel); - - queueConfig.PowerManaged = WdfFalse; - queueConfig.EvtIoDefault = CreateQueueEvtIoDefault; - - //Reuse this structure. - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, - CDROM_REQUEST_CONTEXT); - - attributes.SynchronizationScope = WdfSynchronizationScopeNone; - attributes.ExecutionLevel = WdfExecutionLevelPassive; - - status = WdfIoQueueCreate(device, - &queueConfig, - &attributes, - &(deviceExtension->CreateQueue)); - - if (!NT_SUCCESS(status)) - { - goto Exit; - } - - // Configure the device to use driver created queue for dispatching create. - status = WdfDeviceConfigureRequestDispatching(device, - deviceExtension->CreateQueue, - WdfRequestTypeCreate); - - if (!NT_SUCCESS(status)) - { - goto Exit; - } - } - - // 11. Set the alignment requirements for the device based on the host adapter requirements. - // - // NOTE: this should have been set when device is attached on device stack, - // by keeping this legacy code, we could avoid issue that this value was not correctly set at that time. - if (deviceExtension->LowerPdo->AlignmentRequirement > deviceExtension->DeviceObject->AlignmentRequirement) - { - WdfDeviceSetAlignmentRequirement(deviceExtension->Device, - deviceExtension->LowerPdo->AlignmentRequirement); - } - - // 12. Initialization of miscellaneous internal properties - - // CDROMs are not partitionable so starting offset is 0. - deviceExtension->StartingOffset.LowPart = 0; - deviceExtension->StartingOffset.HighPart = 0; - - // Set the default geometry for the cdrom to match what NT 4 used. - // these values will be used to compute the cylinder count rather - // than using it's NT 5.0 defaults. - deviceExtension->DiskGeometry.MediaType = RemovableMedia; - deviceExtension->DiskGeometry.TracksPerCylinder = 0x40; - deviceExtension->DiskGeometry.SectorsPerTrack = 0x20; - - deviceExtension->DeviceAdditionalData.ReadWriteRetryDelay100nsUnits = WRITE_RETRY_DELAY_DVD_1x; - - // Clear the SrbFlags and disable synchronous transfers - deviceExtension->SrbFlags = SRB_FLAGS_DISABLE_SYNCH_TRANSFER; - - // Set timeout value in seconds. - deviceExtension->TimeOutValue = DeviceGetTimeOutValueFromRegistry(); - if ((deviceExtension->TimeOutValue > 30 * 60) || // longer than 30 minutes - (deviceExtension->TimeOutValue == 0)) - { - deviceExtension->TimeOutValue = SCSI_CDROM_TIMEOUT; - } - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DriverEvtDeviceAdd: device timeout is set to %x seconds", - deviceExtension->TimeOutValue - )); - -#if (NTDDI_VERSION >= NTDDI_WIN8) - deviceExtension->IsVolumeOnlinePending = TRUE; - - WDF_IO_QUEUE_CONFIG_INIT(&queueConfig, WdfIoQueueDispatchManual); - - queueConfig.PowerManaged = WdfFalse; - - status = WdfIoQueueCreate(device, - &queueConfig, - WDF_NO_OBJECT_ATTRIBUTES, - &deviceExtension->ManualVolumeReadyQueue); - - if (!NT_SUCCESS(status)) - { - goto Exit; - } -#endif - - // 13. Initialize the stuff related to media locking - WDF_OBJECT_ATTRIBUTES_INIT(&attributes); - attributes.ParentObject = deviceExtension->Device; - status = WdfWaitLockCreate(&attributes, - &deviceExtension->EjectSynchronizationLock); - - deviceExtension->LockCount = 0; - - // 14. Initialize context structures needed for asynchronous release queue and power requests - - if (NT_SUCCESS(status)) - { - status = DeviceInitReleaseQueueContext(deviceExtension); - } - - if (NT_SUCCESS(status)) - { - status = DeviceInitPowerContext(deviceExtension); - } - - // 15. Create external access points other than device name. - if (NT_SUCCESS(status)) - { - status = DeviceCreateWellKnownName(deviceExtension); - } - - // 16. Query session id from the PDO. - if (NT_SUCCESS(status)) - { - status = IoGetDevicePropertyData(deviceExtension->LowerPdo, - &DEVPKEY_Device_SessionId, - 0, - 0, - sizeof(devicePropertySessionId), - &devicePropertySessionId, - &devicePropertySize, - &devicePropertyType); - - if (!NT_SUCCESS(status)) - { - // The device is global. - devicePropertySessionId = INVALID_SESSION; - status = STATUS_SUCCESS; - } - } - - // 17. Register interfaces for this device. - if (NT_SUCCESS(status)) - { - status = DeviceRegisterInterface(deviceExtension, CdRomDeviceInterface); - } - - if (NT_SUCCESS(status)) - { - // If this is a per-session DO, don't register for mount interface so that - // mountmgr will not automatically assign a drive letter. - if (devicePropertySessionId == INVALID_SESSION) - { - status = DeviceRegisterInterface(deviceExtension, MountedDeviceInterface); - } - } - - // 18. Initialize the shutdown/flush lock - if (NT_SUCCESS(status)) - { - WDF_OBJECT_ATTRIBUTES_INIT(&attributes); - attributes.ParentObject = deviceExtension->Device; - - status = WdfWaitLockCreate(&attributes, &deviceExtension->ShutdownFlushWaitLock); - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_PNP, - "DriverEvtDeviceAdd: Cannot create shutdown/flush waitlock, status: 0x%X\n", - status)); - } - } - - // 19. Initialize the work item that is used to initiate asynchronous reads/writes - if (NT_SUCCESS(status)) - { - WDF_WORKITEM_CONFIG workItemConfig; - WDF_OBJECT_ATTRIBUTES workItemAttributes; - - WDF_WORKITEM_CONFIG_INIT(&workItemConfig, - ReadWriteWorkItemRoutine - ); - - WDF_OBJECT_ATTRIBUTES_INIT(&workItemAttributes); - workItemAttributes.ParentObject = deviceExtension->Device; - - status = WdfWorkItemCreate(&workItemConfig, - &workItemAttributes, - &deviceExtension->ReadWriteWorkItem - ); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_INIT, - "DriverEvtDeviceAdd: Cannot create read/write work item, status: 0x%X\n", - status)); - } - } - - // 20. Initialize the work item that is used to process most IOCTLs at PASSIVE_LEVEL. - if (NT_SUCCESS(status)) - { - WDF_WORKITEM_CONFIG workItemConfig; - WDF_OBJECT_ATTRIBUTES workItemAttributes; - - WDF_WORKITEM_CONFIG_INIT(&workItemConfig, - IoctlWorkItemRoutine - ); - - WDF_OBJECT_ATTRIBUTES_INIT(&workItemAttributes); - workItemAttributes.ParentObject = deviceExtension->Device; - - status = WdfWorkItemCreate(&workItemConfig, - &workItemAttributes, - &deviceExtension->IoctlWorkItem - ); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_INIT, - "DriverEvtDeviceAdd: Cannot create ioctl work item, status: 0x%X\n", - status)); - } - } - - -Exit: - - if (!NT_SUCCESS(status)) - { - FREE_POOL(wideDeviceName); - - if (deviceExtension != NULL) - { - RtlInitUnicodeString(&deviceExtension->DeviceName, NULL); - } - - // Release the device with the port driver, if it was claimed - if ((deviceExtension != NULL) && deviceClaimed) - { - DeviceClaimRelease(deviceExtension, TRUE); - } - deviceClaimed = FALSE; - } - - return status; -} - - -VOID -DeviceEvtCleanup( - _In_ WDFOBJECT Device - ) -/*++ -Routine Description: - - Free all the resources allocated in DriverEvtDeviceAdd. - -Arguments: - - Device - handle to a WDF Device object. - -Return Value: - - VOID. - ---*/ -{ - WDFDEVICE device = (WDFDEVICE)Device; - PCDROM_DEVICE_EXTENSION deviceExtension = NULL; - - PAGED_CODE (); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "WDFDEVICE %p cleanup: The device is about to be destroyed.\n", - device)); - - deviceExtension = DeviceGetExtension(device); - - FREE_POOL(deviceExtension->DeviceName.Buffer); - RtlInitUnicodeString(&deviceExtension->DeviceName, NULL); - - if (deviceExtension->DeviceAdditionalData.WellKnownName.Buffer != NULL) - { - IoDeleteSymbolicLink(&deviceExtension->DeviceAdditionalData.WellKnownName); - } - - FREE_POOL(deviceExtension->DeviceAdditionalData.WellKnownName.Buffer); - RtlInitUnicodeString(&deviceExtension->DeviceAdditionalData.WellKnownName, NULL); - - return; -} - - -VOID -DeviceEvtSelfManagedIoCleanup( - _In_ WDFDEVICE Device - ) -/*++ - -Routine Description: - - this function is called when the device is removed. - release the ownership of the device, release allocated resources. - -Arguments: - - Device - Handle to device object - -Return Value: - - None. - ---*/ -{ - NTSTATUS status; - PCDROM_DEVICE_EXTENSION deviceExtension = NULL; - - PAGED_CODE (); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_PNP, - "DeviceEvtSelfManagedIoCleanup: WDFDEVICE %p is being stopped.\n", - Device)); - - // extract the device and driver extensions - deviceExtension = DeviceGetExtension(Device); - - // Purge unprocessed requests, stop the IO queues. - // Incoming request will be completed with STATUS_INVALID_DEVICE_STATE status. - WdfIoQueuePurge(deviceExtension->SerialIOQueue, WDF_NO_EVENT_CALLBACK, WDF_NO_CONTEXT); - WdfIoQueuePurge(deviceExtension->CreateQueue, WDF_NO_EVENT_CALLBACK, WDF_NO_CONTEXT); - - // Close the IoTarget so that we are sure there are no outstanding I/Os in the stack. - if (deviceExtension->IoTarget) - { - WdfIoTargetClose(deviceExtension->IoTarget); - } - - // Release the device - if (!deviceExtension->SurpriseRemoved) - { - status = DeviceClaimRelease(deviceExtension, TRUE); //status is mainly for debugging. we don't really care. - UNREFERENCED_PARAMETER(status); //defensive coding, avoid PREFAST warning. - } - - // Be sure to flush the DPCs as the READ/WRITE timer routine may still be running - // during device removal. This call may take a while to complete. - KeFlushQueuedDpcs(); - - // Release all the memory that we have allocated. - - DeviceDeallocateMmcResources(Device); - ScratchBuffer_Deallocate(deviceExtension); - RtlZeroMemory(&(deviceExtension->DeviceAdditionalData.Mmc), sizeof(CDROM_MMC_EXTENSION)); - - FREE_POOL(deviceExtension->DeviceDescriptor); - FREE_POOL(deviceExtension->AdapterDescriptor); - FREE_POOL(deviceExtension->PowerDescriptor); - FREE_POOL(deviceExtension->SenseData); - - if (deviceExtension->DeviceAdditionalData.CachedInquiryData != NULL) - { - FREE_POOL(deviceExtension->DeviceAdditionalData.CachedInquiryData); - deviceExtension->DeviceAdditionalData.CachedInquiryDataByteCount = 0; - } - - FREE_POOL(deviceExtension->PrivateFdoData); - - DeviceReleaseMcnResources(deviceExtension); - - DeviceReleaseZPODDResources(deviceExtension); - - // Keep the system-wide CDROM count accurate, as programs use this info to - // know when they have found all the cdroms in a system. - IoGetConfigurationInformation()->CdRomCount--; - - deviceExtension->PartitionLength.QuadPart = 0; - - // All WDF objects related to Device will be automatically released - // when the root object is deleted. No need to release them manually. - - return; -} - -NTSTATUS -DeviceEvtD0Entry( - _In_ WDFDEVICE Device, - _In_ WDF_POWER_DEVICE_STATE PreviousState - ) -/*++ - -Routine Description: - - This function is called when the device is coming back from a lower power state to D0. - This function cannot be placed in a pageable section. - -Arguments: - - Device - Handle to device object - PreviousState - Power state the device was in. - -Return Value: - - NTSTATUS: alway STATUS_SUCCESS - ---*/ -{ - PCDROM_DEVICE_EXTENSION deviceExtension; - NTSTATUS status = STATUS_SUCCESS; - PZERO_POWER_ODD_INFO zpoddInfo = NULL; - STORAGE_IDLE_POWERUP_REASON powerupReason = {0}; - - UNREFERENCED_PARAMETER(PreviousState); - deviceExtension = DeviceGetExtension(Device); - - // Make certain not to do anything before properly initialized - if (deviceExtension->IsInitialized) - { - zpoddInfo = deviceExtension->ZeroPowerODDInfo; - - if (zpoddInfo != NULL) - { - if (zpoddInfo->InZeroPowerState != FALSE) - { - // We just woke up from Zero Power state - zpoddInfo->InZeroPowerState = FALSE; - zpoddInfo->RetryFirstCommand = TRUE; - zpoddInfo->BecomingReadyRetryCount = BECOMING_READY_RETRY_COUNT; - - status = DeviceZPODDGetPowerupReason(deviceExtension, &powerupReason); - - if (NT_SUCCESS(status) && - (powerupReason.PowerupReason == StoragePowerupDeviceAttention)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "DeviceEvtD0Entry: Device has left zero power state due to eject button pressed\n" - )); - - // This wake-up is caused by user pressing the eject button. - // In case of drawer type, we need to soft eject the tray to emulate the effect. - // Note that the first command to the device after power resumed will - // be terminated with CHECK CONDITION status with sense code 6/29/00, - // but we already have a retry logic to handle this. - if ((zpoddInfo->LoadingMechanism == LOADING_MECHANISM_TRAY) && (zpoddInfo->Load == 0)) // Drawer - { - DeviceSendIoctlAsynchronously(deviceExtension, IOCTL_STORAGE_EJECT_MEDIA, deviceExtension->DeviceObject); - } - } - else - { - // This wake-up is caused by non-cached CDB received or a 3rd-party driver - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "DeviceEvtD0Entry: Device has left zero power state due to IO received\n" - )); - - } - } - } - - DeviceEnableMainTimer(deviceExtension); - } - - return STATUS_SUCCESS; -} - -NTSTATUS -DeviceEvtD0Exit( - _In_ WDFDEVICE Device, - _In_ WDF_POWER_DEVICE_STATE TargetState - ) -/*++ - -Routine Description: - - This function is called when the device is entering lower powe state from D0 or it's removed. - We only care about the case of device entering D3. - The purpose of this function is to send SYNC CACHE command and STOP UNIT command if it's necessary. - -Arguments: - - Device - Handle to device object - TargetState - Power state the device is entering. - -Return Value: - - NTSTATUS: alway STATUS_SUCCESS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = NULL; - PZERO_POWER_ODD_INFO zpoddInfo = NULL; - - PAGED_CODE (); - - deviceExtension = DeviceGetExtension(Device); - zpoddInfo = deviceExtension->ZeroPowerODDInfo; - - // we only process the situation that the device is going into D3. - if ((TargetState != WdfPowerDeviceD3) && - (TargetState != WdfPowerDeviceD3Final)) - { - return STATUS_SUCCESS; - } - - // Stop the main timer - DeviceDisableMainTimer(deviceExtension); - - // note: do not stop CreateQueue as the create request can be handled by port driver even the device is in D3 status. - - // If initialization was not finished or the device was removed, we cannot interact - // with it device, so we have to exit - if ((!deviceExtension->IsInitialized) || deviceExtension->SurpriseRemoved) - { - return STATUS_SUCCESS; - } - - -#ifdef DBG - #if (WINVER >= 0x0601) - // this API is introduced in Windows7 - { - ULONG secondsRemaining = 0; - BOOLEAN watchdogTimeSupported = FALSE; - - watchdogTimeSupported = PoQueryWatchdogTime(deviceExtension->LowerPdo, &secondsRemaining); - UNREFERENCED_PARAMETER(watchdogTimeSupported); - } - #endif -#endif - - deviceExtension->PowerDownInProgress = TRUE; - - status = PowerContextBeginUse(deviceExtension); - - deviceExtension->PowerContext.Options.PowerDown = TRUE; - - // Step 1. LOCK QUEUE - if (NT_SUCCESS(status) && - (TargetState != WdfPowerDeviceD3Final)) - { - status = DeviceSendPowerDownProcessRequest(deviceExtension, NULL, NULL); - - if (NT_SUCCESS(status)) - { - deviceExtension->PowerContext.Options.LockQueue = TRUE; - } - - // Ignore failure. - status = STATUS_SUCCESS; - } - - deviceExtension->PowerContext.PowerChangeState.PowerDown++; - - // Step 2. QUIESCE QUEUE - if (NT_SUCCESS(status) && - (TargetState != WdfPowerDeviceD3Final)) - { - status = DeviceSendPowerDownProcessRequest(deviceExtension, NULL, NULL); - UNREFERENCED_PARAMETER(status); - // We don't care about the status. - status = STATUS_SUCCESS; - } - - deviceExtension->PowerContext.PowerChangeState.PowerDown++; - - // Step 3. SYNC CACHE command should be sent to drive if the media is currently writable. - if (NT_SUCCESS(status) && - deviceExtension->DeviceAdditionalData.Mmc.WriteAllowed) - { - status = DeviceSendPowerDownProcessRequest(deviceExtension, NULL, NULL); - UNREFERENCED_PARAMETER(status); - status = STATUS_SUCCESS; - } - - deviceExtension->PowerContext.PowerChangeState.PowerDown++; - - // Step 4. STOP UNIT - if (NT_SUCCESS(status) && - !TEST_FLAG(deviceExtension->ScanForSpecialFlags, CDROM_SPECIAL_DISABLE_SPIN_DOWN)) - { - status = DeviceSendPowerDownProcessRequest(deviceExtension, NULL, NULL); - UNREFERENCED_PARAMETER(status); - status = STATUS_SUCCESS; - } - - if (TargetState == WdfPowerDeviceD3Final) - { - // We're done with the power context. - PowerContextEndUse(deviceExtension); - } - - // Bumping the media change count will force the file system to verify the volume when we resume - SET_FLAG(deviceExtension->DeviceObject->Flags, DO_VERIFY_VOLUME); - InterlockedIncrement((PLONG)&deviceExtension->MediaChangeCount); - - // If this power down is caused by Zero Power ODD, we should mark the device as in ZPODD mode. - if (zpoddInfo != NULL) - { - zpoddInfo->InZeroPowerState = TRUE; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "Device has entered zero power state\n" - )); - } - - deviceExtension->PowerDownInProgress = FALSE; - - return STATUS_SUCCESS; -} - - -VOID -DeviceEvtSurpriseRemoval( - _In_ WDFDEVICE Device - ) -/*++ - -Routine Description: - - this function is called when the device is surprisely removed. - Stop all IO queues so that there will be no more request being sent down. - -Arguments: - - Device - Handle to device object - -Return Value: - - None. - ---*/ -{ - PCDROM_DEVICE_EXTENSION deviceExtension = NULL; - - PAGED_CODE(); - - deviceExtension = DeviceGetExtension(Device); - - deviceExtension->SurpriseRemoved = TRUE; - - // Stop the main timer - DeviceDisableMainTimer(deviceExtension); - - // legacy behavior to set partition length to be 0. - deviceExtension->PartitionLength.QuadPart = 0; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "Surprisely remove a WDFDEVICE %p\n", Device)); - - return; -} - - -VOID -CreateQueueEvtIoDefault( - _In_ WDFQUEUE Queue, - _In_ WDFREQUEST Request - ) -/*++ - -Routine Description: - - this function is called when CREATE irp comes. - setup FileObject context fields, so it can be used to track MCN or exclusive lock/unlock. - -Arguments: - - Queue - Handle to device queue - - Request - the creation request - -Return Value: - - None - ---*/ -{ - WDFFILEOBJECT fileObject = WdfRequestGetFileObject(Request); - WDFDEVICE device = WdfIoQueueGetDevice(Queue); - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(device); - PFILE_OBJECT_CONTEXT fileObjectContext = NULL; - - PAGED_CODE(); - - if (fileObject == NULL) { - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_QUEUE, - "Error: received a file create request with file object set to NULL\n")); - - RequestCompletion(deviceExtension, Request, STATUS_INTERNAL_ERROR, 0); - return; - } - - fileObjectContext = FileObjectGetContext(fileObject); - - // Initialize this WDFFILEOBJECT's context - fileObjectContext->DeviceObject = device; - fileObjectContext->FileObject = fileObject; - fileObjectContext->LockCount = 0; - fileObjectContext->McnDisableCount = 0; - fileObjectContext->EnforceStreamingRead = FALSE; - fileObjectContext->EnforceStreamingWrite = FALSE; - - // send down the create synchronously - status = DeviceSendRequestSynchronously(device, Request, FALSE); - - // Need to complete the request in this routine. - RequestCompletion(deviceExtension, Request, status, WdfRequestGetInformation(Request)); - - return; -} - -VOID -DeviceEvtFileClose( - _In_ WDFFILEOBJECT FileObject - ) -/*++ - -Routine Description: - - this function is called when CLOSE irp comes. - clean up MCN / Lock if necessary - -Arguments: - - FileObject - WDF file object created for the irp. - -Return Value: - - None - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - PAGED_CODE(); - - if (FileObject != NULL) - { - WDFDEVICE device = WdfFileObjectGetDevice(FileObject); - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(device); - PCDROM_DATA cdData = &(deviceExtension->DeviceAdditionalData); - PFILE_OBJECT_CONTEXT fileObjectContext = FileObjectGetContext(FileObject); - - // cleanup locked media tray - status = DeviceCleanupProtectedLocks(deviceExtension, fileObjectContext); - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "Failed to cleanup protected locks for WDFDEVICE %p, %!STATUS!\n", device, status)); - } - - // cleanup disabled MCN - status = DeviceCleanupDisableMcn(deviceExtension, fileObjectContext); - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "Failed to disable MCN for WDFDEVICE %p, %!STATUS!\n", device, status)); - } - - // cleanup exclusive access - if (EXCLUSIVE_MODE(cdData) && EXCLUSIVE_OWNER(cdData, FileObject)) - { - status = DeviceUnlockExclusive(deviceExtension, FileObject, FALSE); - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "Failed to release exclusive lock for WDFDEVICE %p, %!STATUS!\n", device, status)); - } - } - } - - return; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceCleanupProtectedLocks( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PFILE_OBJECT_CONTEXT FileObjectContext - ) -/*++ - -Routine Description: - - this function removes protected locks for the handle - -Arguments: - - DeviceExtension - device context - - FileObject - WDF file object created for the irp. - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - PAGED_CODE(); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "CleanupProtectedLocks called for WDFDEVICE %p, WDFFILEOBJECT %p, locked %d times.\n", - DeviceExtension->Device, FileObjectContext->FileObject, FileObjectContext->LockCount)); - - // Synchronize with ejection and ejection control requests. - WdfWaitLockAcquire(DeviceExtension->EjectSynchronizationLock, NULL); - - // For each secure lock on this handle decrement the secured lock count - // for the FDO. Keep track of the new value. - if (FileObjectContext->LockCount != 0) - { - DeviceExtension->ProtectedLockCount -= FileObjectContext->LockCount; - FileObjectContext->LockCount = 0; - - // If the new lock count has been dropped to zero then issue a lock - // command to the device. - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "FDO secured lock count = %d " - "lock count = %d\n", - DeviceExtension->ProtectedLockCount, - DeviceExtension->LockCount)); - - if ((DeviceExtension->ProtectedLockCount == 0) && (DeviceExtension->LockCount == 0)) - { - SCSI_REQUEST_BLOCK srb = {0}; - PCDB cdb = (PCDB) &(srb.Cdb); - - srb.CdbLength = 6; - - cdb->MEDIA_REMOVAL.OperationCode = SCSIOP_MEDIUM_REMOVAL; - - // TRUE - prevent media removal. - // FALSE - allow media removal. - cdb->MEDIA_REMOVAL.Prevent = FALSE; - - // Set timeout value. - srb.TimeOutValue = DeviceExtension->TimeOutValue; - status = DeviceSendSrbSynchronously(DeviceExtension->Device, - &srb, - NULL, - 0, - FALSE, - NULL); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "Allow media removal (unlock) request to drive returned %!STATUS!\n", - status)); - } - } - - WdfWaitLockRelease(DeviceExtension->EjectSynchronizationLock); - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceCleanupDisableMcn( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PFILE_OBJECT_CONTEXT FileObjectContext - ) -/*++ - -Routine Description: - - cleanup the MCN disable count for the handle - -Arguments: - - DeviceExtension - device context - - FileObject - WDF file object created for the irp. - -Return Value: - - NTSTATUS - ---*/ -{ - PAGED_CODE(); - - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CleanupDisableMcn called for WDFDEVICE %p, WDFFILEOBJECT %p, locked %d times.\n", - DeviceExtension->Device, FileObjectContext->FileObject, FileObjectContext->McnDisableCount)); - - // For each secure lock on this handle decrement the secured lock count - // for the FDO. Keep track of the new value. - while (FileObjectContext->McnDisableCount != 0) - { - DeviceEnableMediaChangeDetection(DeviceExtension, FileObjectContext, TRUE); - } - - return STATUS_SUCCESS; -} - -VOID -NormalizeIoctl( - _Inout_ PWDF_REQUEST_PARAMETERS requestParameters - ) -{ - ULONG ioctlCode; - ULONG baseCode; - ULONG functionCode; - - // if this is a class driver ioctl then we need to change the base code - // to IOCTL_STORAGE_BASE so that the switch statement can handle it. - // - // WARNING - currently the scsi class ioctl function codes are between - // 0x200 & 0x300. this routine depends on that fact - ioctlCode = requestParameters->Parameters.DeviceIoControl.IoControlCode; - baseCode = DEVICE_TYPE_FROM_CTL_CODE(ioctlCode); - functionCode = (ioctlCode & (~0xffffc003)) >> 2; - - if ((baseCode == IOCTL_SCSI_BASE) || - (baseCode == IOCTL_DISK_BASE) || - (baseCode == IOCTL_TAPE_BASE) || - (baseCode == IOCTL_DVD_BASE) || - (baseCode == IOCTL_CDROM_BASE)) - //IOCTL_STORAGE_BASE does not need to be converted. - { - if((functionCode >= 0x200) && (functionCode <= 0x300)) - { - ioctlCode = (ioctlCode & 0x0000ffff) | CTL_CODE(IOCTL_STORAGE_BASE, 0, 0, 0); - - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL, - "IOCTL code recalibrate, New ioctl code is %lx\n", - ioctlCode)); - - // Set the code into request parameters, then "requestParameters" needs to be used for dispatch functions. - requestParameters->Parameters.DeviceIoControl.IoControlCode = ioctlCode; - } - } -} - -VOID -DeviceEvtIoInCallerContext( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ) -/*++ -Routine Description: - - Responds to EvtIoInCallerContext events from KMDF - It calls different functions to process different type of IOCTLs. - -Arguments: - - Device - handle to a WDF Device object - - Request - handle to the incoming WDF Request object - -Return Value: - - VOID. - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request); - WDF_REQUEST_PARAMETERS requestParameters; - - requestContext->DeviceExtension = deviceExtension; - - // set the received time - RequestSetReceivedTime(Request); - - // get the request parameters - WDF_REQUEST_PARAMETERS_INIT(&requestParameters); - WdfRequestGetParameters(Request, &requestParameters); - - if (requestParameters.Type == WdfRequestTypeDeviceControl) - { - BOOLEAN processed = FALSE; - PCDROM_DATA cdData = &(deviceExtension->DeviceAdditionalData); - PMEDIA_CHANGE_DETECTION_INFO info = deviceExtension->MediaChangeDetectionInfo; - - if (requestParameters.Parameters.DeviceIoControl.IoControlCode != IOCTL_MCN_SYNC_FAKE_IOCTL) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "Receiving IOCTL: %lx\n", - requestParameters.Parameters.DeviceIoControl.IoControlCode)); - } - else - { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL, - "Receiving IOCTL: %lx\n", - requestParameters.Parameters.DeviceIoControl.IoControlCode)); - } - - // If the device is in exclusive mode, check whether the request is from - // the handle that locked the device. - if (EXCLUSIVE_MODE(cdData) && !EXCLUSIVE_OWNER(cdData, WdfRequestGetFileObject(Request))) - { - BOOLEAN isBlocked = FALSE; - - status = RequestIsIoctlBlockedByExclusiveAccess(Request, &isBlocked); - UNREFERENCED_PARAMETER(status); //defensive coding, avoid PREFAST warning. - - if (isBlocked) - { - if ((requestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_STORAGE_EVENT_NOTIFICATION) && - (info != NULL) && (info->AsynchronousNotificationSupported != FALSE)) - { - // If AN is supported and we receive a signal but we can't send down GESN - // due to exclusive lock, we should save it and fire a GESN when it's unlocked. - // We just need true/false here and don't need count because we will keep sending - // GESN until we deplete all events. - info->ANSignalPendingDueToExclusiveLock = TRUE; - } - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "Access Denied! Device in exclusive mode.Failing Ioctl %lx\n", - requestParameters.Parameters.DeviceIoControl.IoControlCode)); - RequestCompletion(deviceExtension, Request, STATUS_ACCESS_DENIED, 0); - - return; - } - } - - NormalizeIoctl(&requestParameters); - - // 1. All requests that don't need to access device can be processed immediately - if (!processed) - { - processed = RequestDispatchProcessDirectly(Device, Request, requestParameters); - } - - // 2. Requests that should be put in sequential queue. - if (!processed) - { - processed = RequestDispatchToSequentialQueue(Device, Request, requestParameters); - } - - // 3. Requests that need to be processed sequentially and in caller's context. - if (!processed) - { - processed = RequestDispatchSyncWithSequentialQueue(Device, Request, requestParameters); - } - - // 4. Special requests that needs different process in different cases. - if (!processed) - { - processed = RequestDispatchSpecialIoctls(Device, Request, requestParameters); - } - - // 5. This is default behavior for unknown IOCTLs. To pass it to lower level. - if (!processed) - { - processed = RequestDispatchUnknownRequests(Device, Request, requestParameters); - } - - // All requests should be processed already. - NT_ASSERT(processed); - UNREFERENCED_PARAMETER(processed); //defensive coding, avoid PREFAST warning. - } - else if (requestParameters.Type == WdfRequestTypeDeviceControlInternal) - { - RequestProcessInternalDeviceControl(Request, deviceExtension); - } - else - { - // Requests other than IOCTLs will be forwarded to default queue. - status = WdfDeviceEnqueueRequest(Device, Request); - if (!NT_SUCCESS(status)) - { - RequestCompletion(deviceExtension, Request, status, WdfRequestGetInformation(Request)); - } - } - - return; -} - - -BOOLEAN -RequestDispatchProcessDirectly( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters - ) -/*++ -Routine Description: - - These requests can be processed in a non-serialized manner, most of them don't need to access device. - -Arguments: - - Device - handle to a WDF Device object - - Request - handle to the incoming WDF Request object - - RequestParameters - request parameters - -Return Value: - - BOOLEAN - TRUE (request processed); FALSE (request is not processed in this function). - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - BOOLEAN processed = FALSE; - size_t dataLength = 0; - - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - ULONG ioctlCode = RequestParameters.Parameters.DeviceIoControl.IoControlCode; - - switch (ioctlCode) - { - - case IOCTL_CDROM_GET_INQUIRY_DATA: - { - status = RequestHandleGetInquiryData(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; // complete the irp - } - - case IOCTL_STORAGE_GET_MEDIA_TYPES_EX: - { - status = RequestHandleGetMediaTypeEx(deviceExtension, Request, &dataLength); - - processed = TRUE; - break; // complete the irp - } - - case IOCTL_MOUNTDEV_QUERY_UNIQUE_ID: - { - status = RequestHandleMountQueryUniqueId(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; // complete the irp - } - - case IOCTL_MOUNTDEV_QUERY_DEVICE_NAME: - { - status = RequestHandleMountQueryDeviceName(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; // complete the irp - } - - case IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME: - { - status = RequestHandleMountQuerySuggestedLinkName(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; // complete the irp - } - - case IOCTL_STORAGE_GET_DEVICE_NUMBER: - { - status = RequestHandleGetDeviceNumber(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; // complete the irp - } - - case IOCTL_STORAGE_GET_HOTPLUG_INFO: - { - status = RequestHandleGetHotPlugInfo(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; // complete the irp - } - - case IOCTL_STORAGE_SET_HOTPLUG_INFO: - { - status = RequestHandleSetHotPlugInfo(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; // complete the irp - } - - case IOCTL_STORAGE_EVENT_NOTIFICATION: - { - status = RequestHandleEventNotification(deviceExtension, Request, &RequestParameters, &dataLength); - - processed = TRUE; - break; // complete the irp - } - -#if (NTDDI_VERSION >= NTDDI_WIN8) - case IOCTL_VOLUME_ONLINE: - { - // - // Mount manager and volume manager will - // follow this online with a post online - // but other callers may not. In those - // cases, we process this request right - // away. We approximate that these other - // callers are from user mode - // - - if (WdfRequestGetRequestorMode(Request) == KernelMode) - { - processed = TRUE; - } - break; - } -#endif - - default: - { - processed = FALSE; - break; - } - - } //end of switch (ioctlCode) - - if (processed) - { - UCHAR currentStackLocationFlags = 0; - currentStackLocationFlags = RequestGetCurrentStackLocationFlags(Request); - - if ((status == STATUS_VERIFY_REQUIRED) && - (currentStackLocationFlags & SL_OVERRIDE_VERIFY_VOLUME)) - { - // If the status is verified required and this request - // should bypass verify required then retry the request. - status = STATUS_IO_DEVICE_ERROR; - UNREFERENCED_PARAMETER(status); // disables prefast warning; defensive coding... - - processed = RequestDispatchProcessDirectly(Device, Request, RequestParameters); - } - else - { - // Complete the request after processing it. - RequestCompletion(deviceExtension, Request, status, dataLength); - } - } - - return processed; -} - - -BOOLEAN -RequestDispatchToSequentialQueue( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters - ) -/*++ -Routine Description: - - These requests can be processed in a non-serialized manner, most of them don't need to access device. - -Arguments: - - Device - handle to a WDF Device object - - Request - handle to the incoming WDF Request object - - RequestParameters - request parameters - -Return Value: - - BOOLEAN - TRUE (request processed); FALSE (request is not processed in this function). - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - BOOLEAN processed = FALSE; - size_t dataLength = 0; - BOOLEAN inZeroPowerState = FALSE; - - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - ULONG ioctlCode = RequestParameters.Parameters.DeviceIoControl.IoControlCode; - PZERO_POWER_ODD_INFO zpoddInfo = deviceExtension->ZeroPowerODDInfo; - - if ((zpoddInfo != NULL) && - (zpoddInfo->InZeroPowerState != FALSE)) - { - inZeroPowerState = TRUE; - } - - switch (ioctlCode) - { - - case IOCTL_CDROM_RAW_READ: - { - status = RequestValidateRawRead(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_DISK_GET_DRIVE_GEOMETRY_EX: - case IOCTL_CDROM_GET_DRIVE_GEOMETRY_EX: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: Get drive geometryEx\n")); - if ( RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - (ULONG)FIELD_OFFSET(DISK_GEOMETRY_EX, Data)) - { - status = STATUS_BUFFER_TOO_SMALL; - dataLength = FIELD_OFFSET(DISK_GEOMETRY_EX, Data); - } - else if (inZeroPowerState != FALSE) - { - status = STATUS_NO_MEDIA_IN_DEVICE; - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; - } - - case IOCTL_DISK_GET_DRIVE_GEOMETRY: - case IOCTL_CDROM_GET_DRIVE_GEOMETRY: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: Get drive geometry\n")); - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - sizeof(DISK_GEOMETRY)) - { - status = STATUS_BUFFER_TOO_SMALL; - dataLength = sizeof(DISK_GEOMETRY); - } - else if (inZeroPowerState != FALSE) - { - status = STATUS_NO_MEDIA_IN_DEVICE; - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; - } - - case IOCTL_CDROM_READ_TOC_EX: - { - status = RequestValidateReadTocEx(deviceExtension, Request, RequestParameters, &dataLength); - - if (inZeroPowerState != FALSE) - { - status = STATUS_NO_MEDIA_IN_DEVICE; - } - - processed = TRUE; - break; - } - - case IOCTL_CDROM_READ_TOC: - { - status = RequestValidateReadToc(deviceExtension, RequestParameters, &dataLength); - - if (inZeroPowerState != FALSE) - { - status = STATUS_NO_MEDIA_IN_DEVICE; - } - - processed = TRUE; - break; - } - - case IOCTL_CDROM_GET_LAST_SESSION: - { - status = RequestValidateGetLastSession(deviceExtension, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_CDROM_PLAY_AUDIO_MSF: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: Play audio MSF\n")); - - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(CDROM_PLAY_AUDIO_MSF)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; - } - - case IOCTL_CDROM_SEEK_AUDIO_MSF: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: Seek audio MSF\n")); - - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(CDROM_SEEK_AUDIO_MSF)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; - } - - case IOCTL_CDROM_PAUSE_AUDIO: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: Pause audio\n")); - - status = STATUS_SUCCESS; - processed = TRUE; - break; - } - - case IOCTL_CDROM_RESUME_AUDIO: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: Resume audio\n")); - - status = STATUS_SUCCESS; - processed = TRUE; - break; - } - - case IOCTL_CDROM_READ_Q_CHANNEL: - { - status = RequestValidateReadQChannel(Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_CDROM_GET_VOLUME: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: Get volume control\n")); - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - sizeof(VOLUME_CONTROL)) - { - status = STATUS_BUFFER_TOO_SMALL; - dataLength = sizeof(VOLUME_CONTROL); - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; - } - - case IOCTL_CDROM_SET_VOLUME: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: Set volume control\n")); - - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(VOLUME_CONTROL)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; - } - - case IOCTL_CDROM_STOP_AUDIO: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: Stop audio\n")); - - status = STATUS_SUCCESS; - processed = TRUE; - break; - } - - case IOCTL_STORAGE_CHECK_VERIFY: - case IOCTL_STORAGE_CHECK_VERIFY2: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: [%p] Check Verify\n", Request)); - - // Following check will let the condition "OutputBufferLength == 0" pass. - // Since it's legacy behavior in classpnp, we need to keep it. - if ((RequestParameters.Parameters.DeviceIoControl.OutputBufferLength > 0) && - (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < sizeof(ULONG))) - { - status = STATUS_BUFFER_TOO_SMALL; - dataLength = sizeof(ULONG); - } - else if (inZeroPowerState != FALSE) - { - status = STATUS_NO_MEDIA_IN_DEVICE; - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; - } - - case IOCTL_DVD_GET_REGION: - { - // validation will be done when process it. - status = STATUS_SUCCESS; - processed = TRUE; - break; - } - - case IOCTL_DVD_READ_STRUCTURE: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: [%p] IOCTL_DVD_READ_STRUCTURE\n", Request)); - - status = RequestValidateDvdReadStructure(deviceExtension, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_DVD_READ_KEY: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: [%p] IOCTL_DVD_READ_KEY\n", Request)); - - status = RequestValidateDvdReadKey(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_DVD_START_SESSION: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: [%p] IOCTL_DVD_START_SESSION\n", Request)); - - status = RequestValidateDvdStartSession(deviceExtension, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_DVD_SEND_KEY: - case IOCTL_DVD_SEND_KEY2: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: [%p] IOCTL_DVD_SEND_KEY\n", Request)); - - status = RequestValidateDvdSendKey(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_STORAGE_SET_READ_AHEAD: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: [%p] SetReadAhead\n", Request)); - - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(STORAGE_SET_READ_AHEAD)) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; - } - - case IOCTL_DISK_IS_WRITABLE: - { - status = STATUS_SUCCESS; - - processed = TRUE; - break; - } - - case IOCTL_DISK_GET_DRIVE_LAYOUT: - { - ULONG requiredSize = 0; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: Get drive layout\n")); - - requiredSize = FIELD_OFFSET(DRIVE_LAYOUT_INFORMATION, PartitionEntry[1]); - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - requiredSize) - { - status = STATUS_BUFFER_TOO_SMALL; - dataLength = requiredSize; - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; - } - - case IOCTL_DISK_GET_DRIVE_LAYOUT_EX: - { - ULONG requiredSize = 0; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: Get drive layoutEx\n")); - - requiredSize = FIELD_OFFSET(DRIVE_LAYOUT_INFORMATION_EX, PartitionEntry[1]); - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - requiredSize) - { - status = STATUS_BUFFER_TOO_SMALL; - dataLength = requiredSize; - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; - } - - case IOCTL_DISK_GET_PARTITION_INFO: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: Get Partition Info\n")); - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - sizeof(PARTITION_INFORMATION)) - { - status = STATUS_BUFFER_TOO_SMALL; - dataLength = sizeof(PARTITION_INFORMATION); - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; - } - - case IOCTL_DISK_GET_PARTITION_INFO_EX: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: Get Partition InfoEx\n")); - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - sizeof(PARTITION_INFORMATION_EX)) - { - status = STATUS_BUFFER_TOO_SMALL; - dataLength = sizeof(PARTITION_INFORMATION_EX); - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; - } - - case IOCTL_DISK_VERIFY: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: IOCTL_DISK_VERIFY to device %p through request %p\n", - Device, - Request)); - - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(VERIFY_INFORMATION)) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; - } - - case IOCTL_DISK_GET_LENGTH_INFO: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: Disk Get Length InfoEx\n")); - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - sizeof(GET_LENGTH_INFORMATION)) - { - status = STATUS_BUFFER_TOO_SMALL; - dataLength = sizeof(GET_LENGTH_INFORMATION); - } - else if (inZeroPowerState != FALSE) - { - status = STATUS_NO_MEDIA_IN_DEVICE; - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; - } - - case IOCTL_CDROM_GET_CONFIGURATION: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: [%p] IOCTL_CDROM_GET_CONFIGURATION\n", Request)); - - status = RequestValidateGetConfiguration(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_CDROM_SET_SPEED: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: [%p] IOCTL_CDROM_SET_SPEED\n", Request)); - - status = RequestValidateSetSpeed(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_DVD_END_SESSION: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: [%p] IOCTL_DVD_END_SESSION\n", Request)); - - status = RequestValidateDvdEndSession(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_AACS_END_SESSION: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: [%p] IOCTL_AACS_END_SESSION\n", Request)); - - status = RequestValidateAacsEndSession(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_AACS_READ_MEDIA_KEY_BLOCK: - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "AACS: Querying full MKB with bufferSize of %x bytes\n", - (int)RequestParameters.Parameters.DeviceIoControl.OutputBufferLength - )); - - status = RequestValidateAacsReadMediaKeyBlock(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_AACS_START_SESSION: - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "AACS: Requesting AGID\n" - )); - - status = RequestValidateAacsStartSession(deviceExtension, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_AACS_SEND_CERTIFICATE: - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "AACS: Sending host certificate to drive\n" - )); - - status = RequestValidateAacsSendCertificate(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_AACS_GET_CERTIFICATE: - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "AACS: Querying drive certificate\n" - )); - - status = RequestValidateAacsGetCertificate(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_AACS_GET_CHALLENGE_KEY: - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "AACS: Querying drive challenge key\n" - )); - - status = RequestValidateAacsGetChallengeKey(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_AACS_SEND_CHALLENGE_KEY: - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "AACS: Sending drive challenge key\n" - )); - - status = RequestValidateAacsSendChallengeKey(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_AACS_READ_VOLUME_ID: - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "AACS: Reading volume ID\n" - )); - - status = RequestValidateAacsReadVolumeId(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_AACS_READ_SERIAL_NUMBER: - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "AACS: Reading Serial Number\n" - )); - - status = RequestValidateAacsReadSerialNumber(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_AACS_READ_MEDIA_ID: - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "AACS: Reading media ID\n" - )); - - status = RequestValidateAacsReadMediaId(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_AACS_READ_BINDING_NONCE: - case IOCTL_AACS_GENERATE_BINDING_NONCE: - { - if (ioctlCode == IOCTL_AACS_GENERATE_BINDING_NONCE) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "AACS: Generating new binding nonce\n" - )); - } - else - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "AACS: Reading existing binding nonce\n" - )); - } - - status = RequestValidateAacsBindingNonce(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_CDROM_ENABLE_STREAMING: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: [%p] IOCTL_CDROM_ENABLE_STREAMING\n", Request)); - - status = RequestValidateEnableStreaming(Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_CDROM_SEND_OPC_INFORMATION: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: [%p] IOCTL_CDROM_SEND_OPC_INFORMATION\n", Request)); - - status = RequestValidateSendOpcInformation(Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_CDROM_GET_PERFORMANCE: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestDispatchToSequentialQueue: [%p] IOCTL_CDROM_GET_PERFORMANCE\n", Request)); - - status = RequestValidateGetPerformance(Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_STORAGE_MEDIA_REMOVAL: - case IOCTL_STORAGE_EJECTION_CONTROL: - { - if(RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(PREVENT_MEDIA_REMOVAL)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; // complete the irp - } - - case IOCTL_STORAGE_MCN_CONTROL: - { - if(RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(PREVENT_MEDIA_REMOVAL)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; // complete the irp - } - - case IOCTL_STORAGE_RESERVE: - case IOCTL_STORAGE_RELEASE: - { - // there is no validate check currently. - status = STATUS_SUCCESS; - processed = TRUE; - break; - } - - case IOCTL_STORAGE_PERSISTENT_RESERVE_IN: - case IOCTL_STORAGE_PERSISTENT_RESERVE_OUT: - { - status = RequestValidatePersistentReserve(deviceExtension, Request, RequestParameters, &dataLength); - - processed = TRUE; - break; - } - - case IOCTL_STORAGE_EJECT_MEDIA: - case IOCTL_STORAGE_LOAD_MEDIA: - case IOCTL_STORAGE_LOAD_MEDIA2: - { - status = STATUS_SUCCESS; - - processed = TRUE; - break; // complete the irp - } - - case IOCTL_STORAGE_FIND_NEW_DEVICES: - { - // process it. - IoInvalidateDeviceRelations(deviceExtension->LowerPdo, BusRelations); - - status = STATUS_SUCCESS; - - processed = TRUE; - break; // complete the irp - } - - case IOCTL_STORAGE_READ_CAPACITY: - { - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < sizeof(STORAGE_READ_CAPACITY)) - { - dataLength = sizeof(STORAGE_READ_CAPACITY); - status = STATUS_BUFFER_TOO_SMALL; - } - else if (inZeroPowerState != FALSE) - { - status = STATUS_NO_MEDIA_IN_DEVICE; - } - else - { - status = STATUS_SUCCESS; - } - - processed = TRUE; - break; // complete the irp - } - - case IOCTL_STORAGE_CHECK_PRIORITY_HINT_SUPPORT: - { - // for disk.sys only in original classpnp - status = STATUS_NOT_SUPPORTED; - - processed = TRUE; - break; // complete the irp - } - -#if (NTDDI_VERSION >= NTDDI_WIN8) - case IOCTL_DISK_ARE_VOLUMES_READY: - { - // this request doesn't access device at all, so seemingly it can be processed - // directly; however, in case volume online is not received, we will need to - // park these requests in a queue, and the only way a request can be queued is - // if the request came out of another queue. - status = STATUS_SUCCESS; - - processed = TRUE; - break; - } - - case IOCTL_VOLUME_ONLINE: - case IOCTL_VOLUME_POST_ONLINE: - { - status = STATUS_SUCCESS; - - processed = TRUE; - break; - } -#endif - - default: - { - processed = FALSE; - break; - } - } //end of switch (ioctlCode) - - if (processed) - { - UCHAR currentStackLocationFlags = 0; - currentStackLocationFlags = RequestGetCurrentStackLocationFlags(Request); - - if ((status == STATUS_VERIFY_REQUIRED) && - (currentStackLocationFlags & SL_OVERRIDE_VERIFY_VOLUME)) - { - // If the status is verified required and this request - // should bypass verify required then retry the request. - status = STATUS_IO_DEVICE_ERROR; - UNREFERENCED_PARAMETER(status); // disables prefast warning; defensive coding... - - processed = RequestDispatchToSequentialQueue(Device, Request, RequestParameters); - } - else - { - if (NT_SUCCESS(status)) - { - // Forward the request to serialized queue. - status = WdfDeviceEnqueueRequest(Device, Request); - } - - if (!NT_SUCCESS(status)) - { - // Validation failed / forward failed, complete the request. - RequestCompletion(deviceExtension, Request, status, dataLength); - } - } - } - - return processed; -} - - -BOOLEAN -RequestDispatchSyncWithSequentialQueue( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters - ) -/*++ -Routine Description: - - These requests need to stay in caller's context and be processed in serialized manner. - -Arguments: - - Device - handle to a WDF Device object - - Request - handle to the incoming WDF Request object - - RequestParameters - request parameters - -Return Value: - - BOOLEAN - TRUE (request processed); FALSE (request is not processed in this function). - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - BOOLEAN processed = FALSE; - size_t dataLength = 0; - - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - ULONG ioctlCode = RequestParameters.Parameters.DeviceIoControl.IoControlCode; - - switch (ioctlCode) - { - - case IOCTL_CDROM_EXCLUSIVE_ACCESS: - { - //1. Validate - status = RequestValidateExclusiveAccess(Request, RequestParameters, &dataLength); - - //2. keep the request in serialized manner and stay in user's context. - if (NT_SUCCESS(status)) - { - PCDROM_EXCLUSIVE_ACCESS exclusiveAccess = NULL; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &exclusiveAccess, - NULL); - - if (NT_SUCCESS(status)) - { - // do not need to check "status" as it passed validation and cannot fail in WdfRequestRetrieveInputBuffer() - switch (exclusiveAccess->RequestType) - { - - case ExclusiveAccessQueryState: - { - status = RequestSetContextFields(Request, RequestHandleExclusiveAccessQueryLockState); - break; - } - - case ExclusiveAccessLockDevice: - { - status = RequestSetContextFields(Request, RequestHandleExclusiveAccessLockDevice); - break; - } - - case ExclusiveAccessUnlockDevice: - { - status = RequestSetContextFields(Request, RequestHandleExclusiveAccessUnlockDevice); - break; - } - default: - { - // already valicated in RequestValidateExclusiveAccess() - NT_ASSERT(FALSE); - break; - } - } - } - - if (NT_SUCCESS(status)) - { - // now, put the special synchronization information into the context - status = RequestSynchronizeProcessWithSerialQueue(Device, Request); - - // "status" is used for debugging in above statement, reset to success to avoid further work in this function. - status = STATUS_SUCCESS; - } - } - - processed = TRUE; - break; // complete the irp - } - - default: - { - processed = FALSE; - break; - } - } //end of switch (ioctlCode) - - // Following process is only valid if the request is not really processed. (failed in validation) - if (processed && !NT_SUCCESS(status)) - { - UCHAR currentStackLocationFlags = 0; - currentStackLocationFlags = RequestGetCurrentStackLocationFlags(Request); - - if ((status == STATUS_VERIFY_REQUIRED) && - (currentStackLocationFlags & SL_OVERRIDE_VERIFY_VOLUME)) - { - // - // If the status is verified required and this request - // should bypass verify required then retry the request. - // - status = STATUS_IO_DEVICE_ERROR; - UNREFERENCED_PARAMETER(status); // disables prefast warning; defensive coding... - - processed = RequestDispatchSyncWithSequentialQueue(Device, Request, RequestParameters); - } - else - { - // Validation failed / forward failed, complete the request. - RequestCompletion(deviceExtension, Request, status, dataLength); - } - } - - return processed; -} - - -BOOLEAN -RequestDispatchSpecialIoctls( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters - ) -/*++ -Routine Description: - - These requests need to be processed in different manner according to input parameters - -Arguments: - - Device - handle to a WDF Device object - - Request - handle to the incoming WDF Request object - - RequestParameters - request parameters - -Return Value: - - BOOLEAN - TRUE (request processed); FALSE (request is not processed in this function). - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - BOOLEAN processed = FALSE; - size_t dataLength = 0; - BOOLEAN requestCompleted = FALSE; - - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PCDROM_DATA cdData = &(deviceExtension->DeviceAdditionalData); - ULONG ioctlCode = RequestParameters.Parameters.DeviceIoControl.IoControlCode; - - switch (ioctlCode) - { - case IOCTL_SCSI_PASS_THROUGH: - case IOCTL_SCSI_PASS_THROUGH_DIRECT: - case IOCTL_SCSI_PASS_THROUGH_EX: - case IOCTL_SCSI_PASS_THROUGH_DIRECT_EX: - { - // SPTI is considered special case as we need to set the MinorFunction before pass to low level. - -#if defined (_WIN64) - if (WdfRequestIsFrom32BitProcess(Request)) - { - if ((ioctlCode == IOCTL_SCSI_PASS_THROUGH) || (ioctlCode == IOCTL_SCSI_PASS_THROUGH_DIRECT)) - { - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < sizeof(SCSI_PASS_THROUGH32)) - { - status = STATUS_INVALID_PARAMETER; - } - } - else - { - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < sizeof(SCSI_PASS_THROUGH32_EX)) - { - status = STATUS_INVALID_PARAMETER; - } - } - } - else -#endif - { - if ((ioctlCode == IOCTL_SCSI_PASS_THROUGH) || (ioctlCode == IOCTL_SCSI_PASS_THROUGH_DIRECT)) - { - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < sizeof(SCSI_PASS_THROUGH)) - { - status = STATUS_INVALID_PARAMETER; - } - } - else - { - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < sizeof(SCSI_PASS_THROUGH_EX)) - { - status = STATUS_INVALID_PARAMETER; - } - } - } - - if (!NT_SUCCESS(status)) - { - // validation failed. - RequestCompletion(deviceExtension, Request, status, dataLength); - } - else - { - // keep the request in serialized manner and stay in user's context. - status = RequestSetContextFields(Request, RequestHandleScsiPassThrough); - - if (NT_SUCCESS(status)) - { - status = RequestSynchronizeProcessWithSerialQueue(Device, Request); - } - else - { - RequestCompletion(deviceExtension, Request, status, 0); - } - } - - requestCompleted = TRUE; - processed = TRUE; - break; - } - - case IOCTL_STORAGE_QUERY_PROPERTY: - { - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < sizeof(STORAGE_PROPERTY_QUERY)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - PSTORAGE_PROPERTY_QUERY inputBuffer = NULL; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - - if (NT_SUCCESS(status)) - { - if (!EXCLUSIVE_MODE(cdData) || // not locked - EXCLUSIVE_OWNER(cdData, WdfRequestGetFileObject(Request)) || // request is from lock owner - (inputBuffer->QueryType == PropertyExistsQuery)) // request not access device - { - if (inputBuffer->PropertyId == StorageDeviceUniqueIdProperty) - { - // previously handled in classpnp - // keep the request in serialized manner and stay in user's context. - status = RequestSetContextFields(Request, RequestHandleQueryPropertyDeviceUniqueId); - - if (NT_SUCCESS(status)) - { - status = RequestSynchronizeProcessWithSerialQueue(Device, Request); - // remeber that the request has been completed. - requestCompleted = TRUE; - } - } - else if (inputBuffer->PropertyId == StorageDeviceWriteCacheProperty) - { - // previously handled in classpnp - // keep the request in serialized manner and stay in user's context. - status = RequestSetContextFields(Request, RequestHandleQueryPropertyWriteCache); - - if (NT_SUCCESS(status)) - { - status = RequestSynchronizeProcessWithSerialQueue(Device, Request); - // remeber that the request has been completed. - requestCompleted = TRUE; - } - } - else - { - // Pass to port driver for handling - RequestDispatchUnknownRequests(Device, Request, RequestParameters); - - // remeber that the request has been completed. - requestCompleted = TRUE; - } - } - else - { - // If cached data exists, return cached data. Otherwise, fail the request. - if ((inputBuffer->QueryType == PropertyStandardQuery) && - ((inputBuffer->PropertyId == StorageDeviceProperty) || (inputBuffer->PropertyId == StorageAdapterProperty)) ) - { - status = RequestHandleQueryPropertyRetrieveCachedData(deviceExtension, Request, RequestParameters, &dataLength); - } - else - { - status = STATUS_ACCESS_DENIED; - } - } - } - } - - processed = TRUE; - break; - } - - // this IOCTL is a fake one, used for MCN process sync-ed with serial queue. - case IOCTL_MCN_SYNC_FAKE_IOCTL: - { - PIRP irp = WdfRequestWdmGetIrp(Request); - - if ((deviceExtension->MediaChangeDetectionInfo != NULL) && - (irp == deviceExtension->MediaChangeDetectionInfo->MediaChangeSyncIrp) && - (WdfRequestGetRequestorMode(Request) == KernelMode) && - (RequestParameters.Parameters.Others.Arg1 == RequestSetupMcnSyncIrp) && - (RequestParameters.Parameters.Others.Arg2 == RequestSetupMcnSyncIrp) && - (RequestParameters.Parameters.Others.Arg4 == RequestSetupMcnSyncIrp)) - { - // This is the requset we use to sync Media Change Detection with sequential queue. - status = WdfDeviceEnqueueRequest(Device, Request); - - if (!NT_SUCCESS(status)) - { - RequestCompletion(deviceExtension, Request, status, dataLength); - } - - requestCompleted = TRUE; - processed = TRUE; - } - else - { - // process as an unknown request. - processed = FALSE; - } - break; - } - - default: - { - processed = FALSE; - break; - } - } //end of switch (ioctlCode) - - if (processed && !requestCompleted) - { - UCHAR currentStackLocationFlags = 0; - currentStackLocationFlags = RequestGetCurrentStackLocationFlags(Request); - - if ((status == STATUS_VERIFY_REQUIRED) && - (currentStackLocationFlags & SL_OVERRIDE_VERIFY_VOLUME)) - { - // If the status is verified required and this request - // should bypass verify required then retry the request. - status = STATUS_IO_DEVICE_ERROR; - UNREFERENCED_PARAMETER(status); // disables prefast warning; defensive coding... - - processed = RequestDispatchSpecialIoctls(Device, Request, RequestParameters); - } - else - { - RequestCompletion(deviceExtension, Request, status, dataLength); - } - } - - return processed; -} - - -BOOLEAN -RequestDispatchUnknownRequests( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters - ) -/*++ -Routine Description: - - All unknown requests will be pass to lower level driver. - If IRQL is PASSIVE_LEVEL, the request will be serialized; - Otherwise, it'll be sent and forget. - -Arguments: - - Device - handle to a WDF Device object - - Request - handle to the incoming WDF Request object - - RequestParameters - request parameters - -Return Value: - - BOOLEAN - TRUE (request processed); FALSE (request is not processed in this function). - ---*/ -{ - NTSTATUS status = STATUS_UNSUCCESSFUL; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - - ULONG baseCode = DEVICE_TYPE_FROM_CTL_CODE(RequestParameters.Parameters.DeviceIoControl.IoControlCode); - - if ((KeGetCurrentIrql() != PASSIVE_LEVEL) || - (baseCode == FILE_DEVICE_ACPI)) - { - // 1. When IRQL is higher than PASSIVE_LEVEL, - // 2. ataport sends IOCTL_ACPI_ASYNC_EVAL_METHOD before queue starts, - // send request directly to lower driver. - status = RequestHandleUnknownIoctl(Device, Request); - } - else - { - // keep the request in serialized manner and stay in user's context. - status = RequestSetContextFields(Request, RequestHandleUnknownIoctl); - - if (NT_SUCCESS(status)) - { - status = RequestSynchronizeProcessWithSerialQueue(Device, Request); - } - else - { - RequestCompletion(deviceExtension, Request, status, 0); - } - } - - UNREFERENCED_PARAMETER(status); //defensive coding, avoid PREFAST warning. - - // All unknown IOCTLs are processed in this function. - return TRUE; //processed -} - -VOID -RequestProcessInternalDeviceControl( - _In_ WDFREQUEST Request, - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ -Routine Description: - - all internal IOCTL will be send to lower driver asynchronously. - -Arguments: - - Request - handle to the incoming WDF Request object - DeviceExtension - device extension structure - -Return Value: - - None - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PIRP irp = NULL; - PIO_STACK_LOCATION irpStack = NULL; - PIO_STACK_LOCATION nextStack = NULL; - BOOLEAN requestSent = FALSE; - - irp = WdfRequestWdmGetIrp(Request); - irpStack = IoGetCurrentIrpStackLocation(irp); - nextStack = IoGetNextIrpStackLocation(irp); - - // Set the parameters in the next stack location. - nextStack->Parameters.Scsi.Srb = irpStack->Parameters.Scsi.Srb; - nextStack->MajorFunction = IRP_MJ_SCSI; - nextStack->MinorFunction = IRP_MN_SCSI_CLASS; - - WdfRequestSetCompletionRoutine(Request, RequestDummyCompletionRoutine, NULL); - - status = RequestSend(DeviceExtension, - Request, - DeviceExtension->IoTarget, - 0, - &requestSent); - - // send the request straight down (asynchronously) - if (!requestSent) - { - // fail the request - RequestCompletion(DeviceExtension, Request, status, WdfRequestGetInformation(Request)); - } - - return; -} - - - -// -// Serial I/O Queue Event callbacks -// - -VOID -SequentialQueueEvtIoReadWrite( - _In_ WDFQUEUE Queue, - _In_ WDFREQUEST Request, - _In_ size_t Length - ) -/*++ -Routine Description: - - validate and process read/write request. - -Arguments: - - Queue - parallel queue itself - - Request - handle to the incoming WDF Request object - - Length - read / write lenght - -Return Value: - - None - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - WDFDEVICE device = WdfIoQueueGetDevice(Queue); - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(device); - WDF_REQUEST_PARAMETERS requestParameters; - PIRP wdmIrp = WdfRequestWdmGetIrp(Request); - PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(wdmIrp); - PCDROM_DATA cdData = &(deviceExtension->DeviceAdditionalData); - - // Get the request parameters - WDF_REQUEST_PARAMETERS_INIT(&requestParameters); - WdfRequestGetParameters(Request, &requestParameters); - - if (requestParameters.Type == WdfRequestTypeRead) - { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_GENERAL, - "Receiving READ, Length %Ix\n", (ULONG) Length)); - } - else - { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_GENERAL, - "Receiving WRITE, Length %Ix\n", (ULONG) Length)); - } - - // Check if a verify is required before a READ/WRITE - if (TEST_FLAG(deviceExtension->DeviceObject->Flags, DO_VERIFY_VOLUME) && - (requestParameters.MinorFunction != CDROM_VOLUME_VERIFY_CHECKED) && - !TEST_FLAG(currentIrpStack->Flags, SL_OVERRIDE_VERIFY_VOLUME)) - { - // DO_VERIFY_VOLUME is set for the device object, - // but this request is not itself a verify request. - // So fail this request. - RequestCompletion(deviceExtension, Request, STATUS_VERIFY_REQUIRED, 0); - } - else - { - // Since we've bypassed the verify-required tests we don't need to repeat - // them with this IRP - in particular we don't want to worry about - // hitting them at the partition 0 level if the request has come through - // a non-zero partition. - currentIrpStack->MinorFunction = CDROM_VOLUME_VERIFY_CHECKED; - - // Fail READ/WRITE requests when music is playing - if (deviceExtension->DeviceAdditionalData.PlayActive) - { - RequestCompletion(deviceExtension, Request, STATUS_DEVICE_BUSY, 0); - - return; - } - - // Fail READ/WRITE requests from non-owners if the drive is locked - if (EXCLUSIVE_MODE(cdData) && !EXCLUSIVE_OWNER(cdData, WdfRequestGetFileObject(Request))) - { - RequestCompletion(deviceExtension, Request, STATUS_ACCESS_DENIED, 0); - - return; - } - - // Succeed READ/WRITE requests of length 0 - if (Length == 0) - { - // Several parts of the code turn 0 into 0xffffffff, - // so don't process a zero-length request any further. - RequestCompletion(deviceExtension, Request, STATUS_SUCCESS, Length); - - return; - } - - // If there is an unexpected write request, we want to rediscover MMC capabilities - if (!deviceExtension->DeviceAdditionalData.Mmc.WriteAllowed && - (requestParameters.Type == WdfRequestTypeWrite)) - { - // Schedule MMC capabilities update now, but perform it later in a work item - deviceExtension->DeviceAdditionalData.Mmc.UpdateState = CdromMmcUpdateRequired; - } - - // If MMC capabilities update is required, we create a separate work item to avoid blocking - // the current thread; otherwise, we initiate an async read/write in the current thread. - if (DeviceIsMmcUpdateRequired(deviceExtension->Device)) - { - deviceExtension->ReadWriteWorkItemContext.OriginalRequest = Request; - WdfWorkItemEnqueue(deviceExtension->ReadWriteWorkItem); - - status = STATUS_SUCCESS; - } - else - { - status = RequestValidateReadWrite(deviceExtension, Request, requestParameters); - - if (NT_SUCCESS(status)) - { - status = RequestHandleReadWrite(deviceExtension, Request, requestParameters); - } - } - - if (!NT_SUCCESS(status)) - { - RequestCompletion(deviceExtension, Request, status, 0); - } - } - - return; -} - - -VOID -ReadWriteWorkItemRoutine( - _In_ WDFWORKITEM WorkItem - ) -/*++ - -Routine Description: - - Work item routine for validating and initiating read and write requests. - The reason why we do that from a work item is because we may need to update MMC - capabilities before validating a read/write request and that is a sync operation. - -Arguments: - - WorkItem - WDF work item - -Return Value: - - none - ---*/ -{ - PCDROM_DEVICE_EXTENSION deviceExtension = NULL; - WDFREQUEST readWriteRequest = NULL; - WDF_REQUEST_PARAMETERS readWriteRequestParameters; - NTSTATUS status = STATUS_SUCCESS; - - PAGED_CODE (); - - deviceExtension = WdfObjectGetTypedContext(WdfWorkItemGetParentObject(WorkItem), CDROM_DEVICE_EXTENSION); - readWriteRequest = deviceExtension->ReadWriteWorkItemContext.OriginalRequest; - deviceExtension->ReadWriteWorkItemContext.OriginalRequest = NULL; - - WDF_REQUEST_PARAMETERS_INIT(&readWriteRequestParameters); - WdfRequestGetParameters(readWriteRequest, &readWriteRequestParameters); - - if (DeviceIsMmcUpdateRequired(deviceExtension->Device)) - { - // Issue command to update the drive capabilities. - // The failure of MMC update is not considered critical, so we'll - // continue to process the request even if MMC update fails. - (VOID) DeviceUpdateMmcCapabilities(deviceExtension->Device); - } - - // Now verify and process the request - if (NT_SUCCESS(status)) - { - status = RequestValidateReadWrite(deviceExtension, readWriteRequest, readWriteRequestParameters); - } - if (NT_SUCCESS(status)) - { - status = RequestHandleReadWrite(deviceExtension, readWriteRequest, readWriteRequestParameters); - } - - // Complete the request immediately on failure - if (!NT_SUCCESS(status)) - { - RequestCompletion(deviceExtension, readWriteRequest, status, 0); - } -} - - -VOID -SequentialQueueEvtIoDeviceControl( - _In_ WDFQUEUE Queue, - _In_ WDFREQUEST Request, - _In_ size_t OutputBufferLength, - _In_ size_t InputBufferLength, - _In_ ULONG IoControlCode - ) -/*++ -Routine Description: - - validate and process IOCTL request. - -Arguments: - - Queue - sequential queue - - Request - handle to the incoming WDF Request object - -Return Value: - - None - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - WDFDEVICE device = WdfIoQueueGetDevice(Queue); - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(device); - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request); - PCDROM_DATA cdData = &(deviceExtension->DeviceAdditionalData); - WDF_REQUEST_PARAMETERS requestParameters; - - UNREFERENCED_PARAMETER(OutputBufferLength); - UNREFERENCED_PARAMETER(InputBufferLength); - UNREFERENCED_PARAMETER(IoControlCode); - - // get the request parameters - WDF_REQUEST_PARAMETERS_INIT(&requestParameters); - WdfRequestGetParameters(Request, &requestParameters); - - // If the device is in exclusive mode, check whether the request is from - // the handle that locked the device - if (EXCLUSIVE_MODE(cdData) && !EXCLUSIVE_OWNER(cdData, WdfRequestGetFileObject(Request))) - { - BOOLEAN isBlocked = FALSE; - - status = RequestIsIoctlBlockedByExclusiveAccess(Request, &isBlocked); - if (NT_SUCCESS(status) && isBlocked) - { - if (requestContext->SyncRequired) - { - // set the following event, so RequestSynchronizeProcessWithSerialQueue() can contintue run to process the real request. - // this function will wait for the request process finishes. - KeSetEvent(requestContext->SyncEvent, IO_CD_ROM_INCREMENT, FALSE); - } - else - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "DeviceEvtIoInCallerContext: Access Denied! Device in exclusive mode.Failing Ioctl %lx\n", - requestParameters.Parameters.DeviceIoControl.IoControlCode)); - RequestCompletion(deviceExtension, Request, STATUS_ACCESS_DENIED, 0); - } - - return; - } - } - - if (!cdData->Mmc.WriteAllowed && - ((requestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_DISK_IS_WRITABLE) || - (requestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_DISK_VERIFY))) - { - cdData->Mmc.UpdateState = CdromMmcUpdateRequired; - } - - // check if this is a synchronized ioctl - if (requestContext->SyncRequired) - { - // set the following event, so RequestSynchronizeProcessWithSerialQueue() can contintue run to process the real request. - // this function will wait for the request process finishes. - KeSetEvent(requestContext->SyncEvent, IO_CD_ROM_INCREMENT, FALSE); - } - else - { - deviceExtension->IoctlWorkItemContext.OriginalRequest = Request; - - // all other IOCTL processing is currently processed via a - // work item running at PASSIVE_LEVEL. - WdfWorkItemEnqueue(deviceExtension->IoctlWorkItem); - } - - return; -} - - -VOID -IoctlWorkItemRoutine( - _In_ WDFWORKITEM WorkItem - ) -/*++ - -Routine Description: - - Work item routine for processing ioctl requests. - This is needed because event callbacks are called at DISPATCH_LEVEL and ioctl - requests are currently processed synchronously and not asynchronously. - -Arguments: - - WorkItem - WDF work item - -Return Value: - - none - ---*/ -{ - PCDROM_DEVICE_EXTENSION deviceExtension = NULL; - - PAGED_CODE (); - - deviceExtension = WdfObjectGetTypedContext(WdfWorkItemGetParentObject(WorkItem), CDROM_DEVICE_EXTENSION); - - if (DeviceIsMmcUpdateRequired(deviceExtension->Device)) - { - // Issue command to update the drive capabilities. - // The failure of MMC update is not considered critical, - // so that we'll continue to process I/O even MMC update fails. - DeviceUpdateMmcCapabilities(deviceExtension->Device); - } - - RequestProcessSerializedIoctl(deviceExtension, deviceExtension->IoctlWorkItemContext.OriginalRequest); -} - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -RequestProcessSerializedIoctl( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request - ) -/*++ -Routine Description: - - a dispatch routine for all functions to process IOCTLs. - -Arguments: - - DeviceExtension - device context - - Request - handle to the incoming WDF Request object - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - size_t information = 0; - WDF_REQUEST_PARAMETERS requestParameters; - BOOLEAN completeRequest = TRUE; - - PAGED_CODE (); - - // Get the Request parameters - WDF_REQUEST_PARAMETERS_INIT(&requestParameters); - WdfRequestGetParameters(Request, &requestParameters); - - NormalizeIoctl(&requestParameters); - - // process IOCTLs - switch (requestParameters.Parameters.DeviceIoControl.IoControlCode) - { - case IOCTL_CDROM_READ_TOC: - case IOCTL_CDROM_GET_LAST_SESSION: - status = RequestHandleReadTOC(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_CDROM_READ_TOC_EX: - status = RequestHandleReadTocEx(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_CDROM_GET_CONFIGURATION: - status = RequestHandleGetConfiguration(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_CDROM_RAW_READ: - status = DeviceHandleRawRead(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_DISK_GET_LENGTH_INFO: - case IOCTL_DISK_GET_DRIVE_GEOMETRY: - case IOCTL_DISK_GET_DRIVE_GEOMETRY_EX: - case IOCTL_CDROM_GET_DRIVE_GEOMETRY: - case IOCTL_CDROM_GET_DRIVE_GEOMETRY_EX: - case IOCTL_STORAGE_READ_CAPACITY: - status = RequestHandleGetDriveGeometry(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_DISK_VERIFY: - status = RequestHandleDiskVerify(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_STORAGE_CHECK_VERIFY: - // IOCTL_STORAGE_CHECK_VERIFY2 was processed including send a Test Unit Read - // with srb flag SRB_CLASS_FLAGS_LOW_PRIORITY to port driver asynchronizelly. - // The original request was completed after TUR finishes. - // As CDROM.SYS serializes IOs need accessing device, it's not a big difference from above behavior to - // just process it in serialized manner. So I put it here and treat it as same as IOCTL_STORAGE_CHECK_VERIFY. - case IOCTL_STORAGE_CHECK_VERIFY2: - status = RequestHandleCheckVerify(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_DISK_GET_DRIVE_LAYOUT: - case IOCTL_DISK_GET_DRIVE_LAYOUT_EX: - case IOCTL_DISK_GET_PARTITION_INFO: - case IOCTL_DISK_GET_PARTITION_INFO_EX: - status = RequestHandleFakePartitionInfo(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_DISK_IS_WRITABLE: - // - // Even though this media is writable, the requester of this IOCTL really - // wants to know if thw media behaves like any other disk or not. This is - // so if FeatureDefectManagement and FeatureRandomWritable are current on - // the drive-represented by the FeatureDefectManagement validation schema - // - if (DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed && - (DeviceExtension->DeviceAdditionalData.Mmc.ValidationSchema == FeatureDefectManagement)) - { - status = STATUS_SUCCESS; - } - else - { - status = STATUS_MEDIA_WRITE_PROTECTED; - } - information = 0; - break; - - case IOCTL_CDROM_PLAY_AUDIO_MSF: - status = DeviceHandlePlayAudioMsf(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_CDROM_READ_Q_CHANNEL: - status = DeviceHandleReadQChannel(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_CDROM_PAUSE_AUDIO: - status = DeviceHandlePauseAudio(DeviceExtension, Request, &information); - break; - - case IOCTL_CDROM_RESUME_AUDIO: - status = DeviceHandleResumeAudio(DeviceExtension, Request, &information); - break; - - case IOCTL_CDROM_SEEK_AUDIO_MSF: - status = DeviceHandleSeekAudioMsf(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_CDROM_STOP_AUDIO: - status = DeviceHandleStopAudio(DeviceExtension, Request, &information); - break; - - case IOCTL_CDROM_GET_VOLUME: - case IOCTL_CDROM_SET_VOLUME: - status = DeviceHandleGetSetVolume(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_DVD_GET_REGION: - status = RequestHandleGetDvdRegion(DeviceExtension, Request, &information); - break; - - case IOCTL_DVD_READ_STRUCTURE: - status = DeviceHandleReadDvdStructure(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_DVD_END_SESSION: - status = DeviceHandleDvdEndSession(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_DVD_START_SESSION: - case IOCTL_DVD_READ_KEY: - status = DeviceHandleDvdStartSessionReadKey(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_DVD_SEND_KEY: - case IOCTL_DVD_SEND_KEY2: - status = DeviceHandleDvdSendKey(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_STORAGE_SET_READ_AHEAD: - status = DeviceHandleSetReadAhead(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_CDROM_SET_SPEED: - status = DeviceHandleSetSpeed(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_AACS_READ_MEDIA_KEY_BLOCK_SIZE: - case IOCTL_AACS_READ_MEDIA_KEY_BLOCK: - status = DeviceHandleAacsReadMediaKeyBlock(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_AACS_START_SESSION: - status = DeviceHandleAacsStartSession(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_AACS_END_SESSION: - status = DeviceHandleAacsEndSession(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_AACS_SEND_CERTIFICATE: - status = DeviceHandleAacsSendCertificate(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_AACS_GET_CERTIFICATE: - status = DeviceHandleAacsGetCertificate(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_AACS_GET_CHALLENGE_KEY: - status = DeviceHandleAacsGetChallengeKey(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_AACS_SEND_CHALLENGE_KEY: - status = DeviceHandleSendChallengeKey(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_AACS_READ_VOLUME_ID: - status = DeviceHandleReadVolumeId(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_AACS_READ_SERIAL_NUMBER: - status = DeviceHandleAacsReadSerialNumber(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_AACS_READ_MEDIA_ID: - status = DeviceHandleAacsReadMediaId(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_AACS_READ_BINDING_NONCE: - status = DeviceHandleAacsReadBindingNonce(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_AACS_GENERATE_BINDING_NONCE: - status = DeviceHandleAacsGenerateBindingNonce(DeviceExtension, Request, requestParameters, &information); - break; - - case IOCTL_CDROM_ENABLE_STREAMING: - status = RequestHandleEnableStreaming(DeviceExtension, Request, &information); - break; - - case IOCTL_CDROM_SEND_OPC_INFORMATION: - status = RequestHandleSendOpcInformation(DeviceExtension, Request, &information); - break; - - case IOCTL_CDROM_GET_PERFORMANCE: - status = RequestHandleGetPerformance(DeviceExtension, Request, requestParameters, &information); - break; - - // This IOCTL is a fake one, used for MCN process sync-ed with serial queue. - case IOCTL_MCN_SYNC_FAKE_IOCTL: - status = RequestHandleMcnSyncFakeIoctl(DeviceExtension, &information); - break; - - case IOCTL_STORAGE_MEDIA_REMOVAL: - case IOCTL_STORAGE_EJECTION_CONTROL: - { - status = RequestHandleEjectionControl(DeviceExtension, Request, requestParameters, &information); - - break; - } - - case IOCTL_STORAGE_EJECT_MEDIA: - case IOCTL_STORAGE_LOAD_MEDIA: - case IOCTL_STORAGE_LOAD_MEDIA2: - { - status = RequestHandleLoadEjectMedia(DeviceExtension, Request, requestParameters, &information); - - break; - } - - case IOCTL_STORAGE_MCN_CONTROL: - { - status = RequestHandleMcnControl(DeviceExtension, Request, &information); - - break; - } - - case IOCTL_STORAGE_RESERVE: - case IOCTL_STORAGE_RELEASE: - { - status = RequestHandleReserveRelease(DeviceExtension, Request, requestParameters, &information); - - break; - } - - case IOCTL_STORAGE_PERSISTENT_RESERVE_IN: - case IOCTL_STORAGE_PERSISTENT_RESERVE_OUT: - { - status = RequestHandlePersistentReserve(DeviceExtension, Request, requestParameters, &information); - - break; - } - -#if (NTDDI_VERSION >= NTDDI_WIN8) - case IOCTL_DISK_ARE_VOLUMES_READY: - { - status = RequestHandleAreVolumesReady(DeviceExtension, Request, requestParameters, &information); - - completeRequest = FALSE; - - break; - } - - case IOCTL_VOLUME_ONLINE: - case IOCTL_VOLUME_POST_ONLINE: - { - status = RequestHandleVolumeOnline(DeviceExtension, Request, requestParameters, &information); - - break; - } -#endif - - default: - { - status = STATUS_ACCESS_DENIED; - break; - } - } // end of switch(ioctl) - - if (completeRequest) - { - RequestCompletion(DeviceExtension, Request, status, information); - } - - return status; -} - -VOID -SequentialQueueEvtCanceledOnQueue( - _In_ WDFQUEUE Queue, - _In_ WDFREQUEST Request - ) -/*++ -Routine Description: - - Perform cancellation when request is still in queue. - - If request is sych-ed in another thread, signal the event to let that thread be able to complete the request. - Otherwise, complete the request. - -Arguments: - - Queue - serial queue - Request - handle to the incoming WDF Request object - -Return Value: - - None - ---*/ -{ - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request); - - if (requestContext->SyncRequired) - { - KeSetEvent(requestContext->SyncEvent, IO_CD_ROM_INCREMENT, FALSE); - } - else - { - PCDROM_DEVICE_EXTENSION deviceExtension = NULL; - WDFDEVICE device = WdfIoQueueGetDevice(Queue); - - deviceExtension = DeviceGetExtension(device); - - RequestCompletion(deviceExtension, Request, STATUS_CANCELLED, 0); - - } - - return; -} - - -NTSTATUS -RequestSynchronizeProcessWithSerialQueue( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ) -/*++ -Routine Description: - - This is the mechanism to sync a request process in original thread with serialize queue. - initialize a EVENT and put the request inot serialize queue; - waiting for serialize queue processes to this request and signal the EVENT; - call the request handler to process this request. - -Arguments: - - DeviceExtension - device context - - Request - handle to the incoming WDF Request object - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request); - PKEVENT bufferToFree = requestContext->SyncEvent; - - if (KeGetCurrentIrql() >= DISPATCH_LEVEL) { - // cannot block at or above DISPATCH_LEVEL - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestSynchronousProcessWithSerialQueue called at DISPATCH_LEVEL or above")); - NT_ASSERT(FALSE); - RequestCompletion(deviceExtension, Request, STATUS_INVALID_LEVEL, 0); - return STATUS_INVALID_LEVEL; - } - - // init the synchronization event - KeInitializeEvent(requestContext->SyncEvent, NotificationEvent, FALSE); - - // do we still need to do something like this? - // SET_FLAG(nextStack->Flags, SL_OVERRIDE_VERIFY_VOLUME); - - // NOTE: this mechanism relies on that KMDF will not complete request by itself. - // Doing that will cause the syncEvent not fired thus this thread will stuck. - // This should not really happen: our EvtCanceledOnQueue callbacks should be - // called even if queues are purged for some reason. The only case when these - // callbacks are not called is when a request is owned by the driver (i.e. has - // already been passed to one of the registered handlers). In this case, it is - // our responsibility to cancel such requests properly. - status = WdfDeviceEnqueueRequest(Device, Request); - - if (!NT_SUCCESS(status)) - { - // Failed to forward request! Pretend the sync event already occured, otherwise we'll hit - // an assert in RequestEvtCleanup. - KeSetEvent(requestContext->SyncEvent, IO_CD_ROM_INCREMENT, FALSE); - RequestCompletion(deviceExtension, Request, status, WdfRequestGetInformation(Request)); - } - else - { - NTSTATUS waitStatus = STATUS_UNSUCCESSFUL; - PCDROM_DATA cdData = &(deviceExtension->DeviceAdditionalData); - BOOLEAN fCallSyncCallback = FALSE; - PIRP irp = WdfRequestWdmGetIrp(Request); - - // ok, now wait on the event - while (waitStatus != STATUS_SUCCESS) - { - waitStatus = KeWaitForSingleObject(requestContext->SyncEvent, Executive, KernelMode, TRUE, NULL); - if (waitStatus == STATUS_SUCCESS) // must check equality -- STATUS_ALERTED is success code - { - // do nothing - } - else if (waitStatus != STATUS_ALERTED) - { - // do nothing - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_IOCTL, - "Request %p on device object %p had a non-alert, non-success result from wait (%!HRESULT!)\n", - Request, Device, waitStatus)); - NT_ASSERT(FALSE); - } - else if (PsIsThreadTerminating(PsGetCurrentThread())) - { - // the thread was alerted and is terminating, so cancel the irp - // this will cause EvtIoCanceledOnQueue to be called, which will signal the event, - // so we will get out of the while loop and eventually complete the request. - if (IoCancelIrp(irp)) - { - // cancellation routine was called - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "Sychronize Ioctl: request %p cancelled from device %p\n", - Request, Device)); - } - else - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "Sychronize Ioctl: request %p could not be cancelled from device %p\n", - Request, Device)); - } - } - else - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "SPURIOUS ALERT waiting for Request %p on device %p (%!STATUS!)\n", - Request, Device, status)); - } - } // end of wait loop on the event - - // because we've waited an unknown amount of time, should check - // the cancelled flag to immediately fail the irp as appropriate - if (WdfRequestIsCanceled(Request)) - { - // the request was cancelled, thus we should always stop - // processing here if possible. - status = STATUS_CANCELLED; - RequestCompletion(deviceExtension, Request, status, 0); - } - else if (EXCLUSIVE_MODE(cdData) && !EXCLUSIVE_OWNER(cdData, WdfRequestGetFileObject(Request))) - { - WDF_REQUEST_PARAMETERS requestParameters; - BOOLEAN isBlocked = FALSE; - - // get the request parameters - WDF_REQUEST_PARAMETERS_INIT(&requestParameters); - WdfRequestGetParameters(Request, &requestParameters); - - status = RequestIsIoctlBlockedByExclusiveAccess(Request, &isBlocked); - if (isBlocked) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "Access Denied! Device in exclusive mode.Failing Ioctl %lx\n", - requestParameters.Parameters.DeviceIoControl.IoControlCode)); - RequestCompletion(deviceExtension, Request, STATUS_ACCESS_DENIED, 0); - } - else - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "Ioctl %lx not blocked by cdrom being in exclusive mode\n", - requestParameters.Parameters.DeviceIoControl.IoControlCode)); - fCallSyncCallback = TRUE; - } - } - else - { - fCallSyncCallback = TRUE; - } - - if (fCallSyncCallback) - { - // Synchronization completed successfully. Call the requested routine - status = requestContext->SyncCallback(Device, Request); - } - } - - // The next SequentialQueue evt routine will not be triggered until the current request is completed. - - // clean up the request context setting. - FREE_POOL(bufferToFree); - - return status; -} - -NTSTATUS -RequestIsIoctlBlockedByExclusiveAccess( - _In_ WDFREQUEST Request, - _Out_ PBOOLEAN IsBlocked - ) -/*++ -Routine Description: - - Check if the IOCTL request should be blocked or not according to - the exclusive lock stat. - -Arguments: - - Request - handle to the incoming WDF Request object - -Return Value: - - NTSTATUS - - IsBlocked - TRUE (be blocked); FALSE (not blocked) - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - ULONG ioctlCode = 0; - ULONG baseCode = 0; - WDF_REQUEST_PARAMETERS requestParameters; - - // Get the Request parameters - WDF_REQUEST_PARAMETERS_INIT(&requestParameters); - WdfRequestGetParameters(Request, &requestParameters); - - // check and initialize parameter - if (IsBlocked == NULL) - { - //This is an internal function and this parameter must be supplied. - NT_ASSERT(FALSE); - - return STATUS_INVALID_PARAMETER; - } - else - { - *IsBlocked = FALSE; - } - - // check if this is an IOCTL - if ((requestParameters.Type == WdfRequestTypeDeviceControl) || - (requestParameters.Type == WdfRequestTypeDeviceControlInternal)) - { - // - // Allow minimum set of commands that are required for the disk manager - // to show the CD device, while in exclusive mode. - // Note: These commands should not generate any requests to the device, - // and thus must be handled directly in StartIO during exclusive - // access (except for the exclusive owner, of course). - // - ioctlCode = requestParameters.Parameters.DeviceIoControl.IoControlCode; - baseCode = DEVICE_TYPE_FROM_CTL_CODE(ioctlCode); - - if (ioctlCode == IOCTL_SCSI_GET_ADDRESS || - ioctlCode == IOCTL_STORAGE_GET_HOTPLUG_INFO || - ioctlCode == IOCTL_STORAGE_GET_DEVICE_NUMBER || - ioctlCode == IOCTL_STORAGE_GET_MEDIA_TYPES_EX || - ioctlCode == IOCTL_CDROM_EXCLUSIVE_ACCESS || - ioctlCode == IOCTL_CDROM_GET_INQUIRY_DATA - ) - { - *IsBlocked = FALSE; - } - - // - // Handle IOCTL_STORAGE_QUERY_PROPERTY special because: - // (1) PropertyExistsQuery should not generate device i/o - // (2) Queries for StorageDeviceProperty and StorageAdapterDescriptor - // will return cache'd data - else if (ioctlCode == IOCTL_STORAGE_QUERY_PROPERTY) - { - PSTORAGE_PROPERTY_QUERY query = NULL; - status = WdfRequestRetrieveInputBuffer(Request, - requestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&query, - NULL); - - if (NT_SUCCESS(status)) - { - if (query != NULL) - { - if (query->QueryType == PropertyExistsQuery) - { - *IsBlocked = FALSE; - } - else if ((query->QueryType == PropertyStandardQuery) && - ((query->PropertyId == StorageDeviceProperty) || - (query->PropertyId == StorageAdapterProperty))) - { - *IsBlocked = FALSE; - } - } - } - } - - // Return TRUE for unknown IOCTLs with STORAGE bases - else if (baseCode == IOCTL_SCSI_BASE || - baseCode == IOCTL_DISK_BASE || - baseCode == IOCTL_CDROM_BASE || - baseCode == IOCTL_STORAGE_BASE || - baseCode == IOCTL_DVD_BASE ) - { - *IsBlocked = TRUE; - } - } - else - { - // this should only be called with an IOCTL - NT_ASSERT(FALSE); - - status = STATUS_INVALID_PARAMETER; - } - - return status; -} - -BOOLEAN -DeviceIsMmcUpdateRequired( - _In_ WDFDEVICE Device - ) -/*++ -Routine Description: - - Check if the device needs to update its MMC information. - -Arguments: - - Device - device to be checked. - -Return Value: - - TRUE (require update); FALSE (not require update) - ---*/ -{ - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PCDROM_DATA cdData = &(deviceExtension->DeviceAdditionalData); - - if ((cdData->Mmc.IsMmc) && - (cdData->Mmc.UpdateState == CdromMmcUpdateRequired)) - { - return TRUE; - } - else - { - // no update required: just proceed - return FALSE; - } -} - -VOID -RequestEvtCleanup( - _In_ WDFOBJECT Request - ) -/*++ -Routine Description: - - Request cleanup callback. - -Arguments: - - Request - request to clean up. - -Return Value: - - None - ---*/ -{ - WDFREQUEST request = (WDFREQUEST)Request; - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(request); - - if (requestContext->SyncRequired) - { - // the event should have been signaled, just check that - NT_ASSERT(KeReadStateEvent(requestContext->SyncEvent) != 0); - } -} - diff --git a/storage/class/cdrom/src/cdrom.h b/storage/class/cdrom/src/cdrom.h deleted file mode 100644 index 472e240e..00000000 --- a/storage/class/cdrom/src/cdrom.h +++ /dev/null @@ -1,1609 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - cdrom.h - -Abstract: - - Main header file for cdrom.sys. - This contains structure and function declarations as well as constant values. - -Author: - -Environment: - - kernel mode only - -Notes: - - -Revision History: - ---*/ - -#ifndef __CDROM_H__ -#define __CDROM_H__ - -#pragma warning(push) -#pragma warning(disable:4201) // nonstandard extension used : nameless struct/union -#pragma warning(disable:4214) // nonstandard extension used : bit field types other than int -#pragma warning(disable:4152) // nonstandard extension, function/data pointer conversion in expression - -#include "wdf.h" -#include "ntddmmc.h" -#include "ntddcdvd.h" -#include "ntddcdrm.h" -#include "ntdddisk.h" -#include "ntddtape.h" -#include "ntddscsi.h" -#include "ntddvol.h" -#include "specstrings.h" -#include "cdromp.h" - -// Set component ID for DbgPrintEx calls -#ifndef DEBUG_COMP_ID - #define DEBUG_COMP_ID DPFLTR_CDROM_ID -#endif - -// Include initguid.h so GUID_CONSOLE_DISPLAY_STATE is declared -#include - -// Include header file and setup GUID for tracing -#include -#define WPP_GUID_CDROM (A4196372, C3C4, 42d5, 87BF, 7EDB2E9BCC27) -#ifndef WPP_CONTROL_GUIDS - #define WPP_CONTROL_GUIDS WPP_CONTROL_GUIDS_NORMAL_FLAGS(WPP_GUID_CDROM) -#endif - -// This prototype is needed because, although NTIFS.H is now shipping with -// the WDK, can't include both it and the other headers we already use. -_IRQL_requires_max_(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -PsIsThreadTerminating( - _In_ PETHREAD Thread - ); - -// -// -extern CDROM_SCAN_FOR_SPECIAL_INFO CdromHackItems[]; - -#define CDROM_HACK_DEC_RRD (0x00000001) -#define CDROM_HACK_FUJITSU_FMCD_10x (0x00000002) -//#define CDROM_HACK_HITACHI_1750 (0x00000004) -- obsolete -#define CDROM_HACK_HITACHI_GD_2000 (0x00000008) -#define CDROM_HACK_TOSHIBA_SD_W1101 (0x00000010) -//#define CDROM_HACK_TOSHIBA_XM_3xx (0x00000020) -- obsolete -//#define CDROM_HACK_NEC_CDDA (0x00000040) -- obsolete -//#define CDROM_HACK_PLEXTOR_CDDA (0x00000080) -- obsolete -#define CDROM_HACK_BAD_GET_CONFIG_SUPPORT (0x00000100) -//#define CDROM_HACK_FORCE_READ_CD_DETECTION (0x00000200) -- obsolete -//#define CDROM_HACK_READ_CD_SUPPORTED (0x00000400) -- obsolete -#define CDROM_HACK_BAD_TYPE_ONE_GET_CONFIG (0x00000800) -#define CDROM_HACK_BAD_VENDOR_PROFILES (0x00001000) -#define CDROM_HACK_MSFT_VIRTUAL_ODD (0x00002000) -#define CDROM_HACK_LOCKED_PAGES (0x80000000) // not a valid flag to save - -#define CDROM_HACK_VALID_FLAGS (0x00003fff) -#define CDROM_HACK_INVALID_FLAGS (~CDROM_HACK_VALID_FLAGS) - - -// A 64k buffer to be written takes the following amount of time: -// 1x CD == 75 sectors/sec == 0.4266667 seconds == 4266667 100ns units -// 4x CD == 300 sectors/sec == 0.1066667 seconds == 1066667 100ns units -// 10x CD == 300 sectors/sec == 0.0426667 seconds == 426667 100ns units -// 1x DVD == 676 sectors/sec == 0.0473373 seconds == 473373 100ns units -// 16x DVD == 10,816 sectors/sec == 0.0029586 seconds == 29586 100ns units -// 1x HDDVD == 2,230 sectors/sec == 0.0143498 seconds == 143498 100ns units -#define WRITE_RETRY_DELAY_CD_1x ((LONGLONG)4266667) -#define WRITE_RETRY_DELAY_CD_4x ((LONGLONG)1066667) -#define WRITE_RETRY_DELAY_CD_10x ((LONGLONG) 426667) -#define WRITE_RETRY_DELAY_DVD_1x ((LONGLONG) 473373) -#define WRITE_RETRY_DELAY_DVD_4x ((LONGLONG) 118343) -#define WRITE_RETRY_DELAY_DVD_16x ((LONGLONG) 29586) -#define WRITE_RETRY_DELAY_HDDVD_1x ((LONGLONG) 143498) - -// -#define MAXIMUM_RETRIES 4 - -#define CDROM_GET_CONFIGURATION_TIMEOUT (0x4) -#define CDROM_READ_DISC_INFORMATION_TIMEOUT (0x4) -#define CDROM_TEST_UNIT_READY_TIMEOUT (0x14) -#define CDROM_GET_PERFORMANCE_TIMEOUT (0x14) -#define CDROM_READ_CAPACITY_TIMEOUT (0x14) - -#define START_UNIT_TIMEOUT (60 * 4) - -// Used to detect the loss of the autorun irp. -#define MEDIA_CHANGE_TIMEOUT_TIME 300 - -// Indicates whether is is safe to send StartUnit commands -// to this device. It will only be off for some removeable devices. -#define DEV_SAFE_START_UNIT 0x00000004 - -// Indicates that the device is connected to a backup power supply -// and hence write-through and synch cache requests may be ignored -#define DEV_POWER_PROTECTED 0x00000010 - -// The following CDROM_SPECIAL_ flags are set in ScanForSpecialFlags -// in the Device Extension - -// Never Spin Up/Down the drive (may not handle properly) -#define CDROM_SPECIAL_DISABLE_SPIN_DOWN 0x00000001 -//#define CDROM_SPECIAL_DISABLE_SPIN_UP 0x00000002 - -// Don't bother to lock the queue when powering down -// (used mostly to send a quick stop to a cdrom to abort audio playback) -//#define CDROM_SPECIAL_NO_QUEUE_LOCK 0x00000008 - -// Disable write cache due to known bugs -#define CDROM_SPECIAL_DISABLE_WRITE_CACHE 0x00000010 - -// Used to indicate that this request shouldn't invoke any power type operations -// like spinning up the drive. - -#define SRB_CLASS_FLAGS_LOW_PRIORITY 0x10000000 - -// Used to indicate that an SRB is the result of a paging operation. -#define SRB_CLASS_FLAGS_PAGING 0x40000000 - -typedef struct _ERROR_RECOVERY_DATA { - MODE_PARAMETER_HEADER Header; - MODE_PARAMETER_BLOCK BlockDescriptor; - MODE_READ_RECOVERY_PAGE ReadRecoveryPage; -} ERROR_RECOVERY_DATA, *PERROR_RECOVERY_DATA; - -// A compile-time check of the 30,000 limit not overflowing ULONG size... -// Note that it is not expected that a release (FRE) driver will normally -// have such a large history, instead using the compression function. -#define CDROM_INTERPRET_SENSE_INFO2_MAXIMUM_HISTORY_COUNT 30000 -C_ASSERT( (MAXULONG - sizeof(SRB_HISTORY)) / 30000 >= sizeof(SRB_HISTORY_ITEM) ); - -// Intended to reuse a defined IOCTL code that not seen in Optical stack and does not require input parameter. -// This fake IOCTL is used used for MCN process sync-ed with serial queue. -#define IOCTL_MCN_SYNC_FAKE_IOCTL IOCTL_DISK_UPDATE_DRIVE_SIZE - -/*++//////////////////////////////////////////////////////////////////////////// - -PCDROM_ERROR_HANDLER() - -Routine Description: - - This routine is a callback into the driver to handle errors. The queue - shall not be unfrozen when this error handler is called, even though the - SRB flags may mark the queue as having been frozen due to this SRB. - -Irql: - - This routine will be called at KIRQL <= DISPATCH_LEVEL - -Arguments: - - DeviceObject is the device object the error occurred on. - - Srb is the Srb that was being processed when the error occurred. - - Status may be overwritten by the routine if it decides that the error - was benign, or otherwise wishes to change the returned status code - for this command - - Retry may be overwritten to specify that this command should or should - not be retried (if the callee supports retrying commands) - -Return Value: - - status - ---*/ -struct _CDROM_DEVICE_EXTENSION; // *PCDROM_DEVICE_EXTENSION; -typedef struct _CDROM_DEVICE_EXTENSION - CDROM_DEVICE_EXTENSION, - *PCDROM_DEVICE_EXTENSION; - -typedef -VOID -(*PCDROM_ERROR_HANDLER) ( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSCSI_REQUEST_BLOCK Srb, - _Inout_ PNTSTATUS Status, - _Inout_ PBOOLEAN Retry - ); - -// CdRom driver extension -typedef struct _CDROM_DRIVER_EXTENSION { - ULONG Version; - PDRIVER_OBJECT DriverObject; - ULONG Flags; - -} CDROM_DRIVER_EXTENSION, *PCDROM_DRIVER_EXTENSION; - -#define CDROM_FLAG_WINPE_MODE 0x00000001 - -WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(CDROM_DRIVER_EXTENSION, DriverGetExtension) - -#define CdromMmcUpdateComplete 0 -#define CdromMmcUpdateRequired 1 -#define CdromMmcUpdateStarted 2 - -typedef struct _CDROM_MMC_EXTENSION { - - BOOLEAN IsMmc; // mmc device - BOOLEAN IsAACS; // aacs compatible device - BOOLEAN IsWriter; // the drive is a writer or not - BOOLEAN WriteAllowed; // currently allow write request or not - - BOOLEAN IsCssDvd; // A CSS protected DVD or CPPM-protected DVDAudio media in Drive. - BOOLEAN StreamingReadSupported; // the drive supports streaming for reads - BOOLEAN StreamingWriteSupported; // the drive supports streaming for writes - - LONG UpdateState; - - // The feature number defines the level and form of - // validation that needs to be performed on Io requests - FEATURE_NUMBER ValidationSchema; - ULONG Blocking; - - SCSI_REQUEST_BLOCK CapabilitiesSrb; - PIRP CapabilitiesIrp; - WDFREQUEST CapabilitiesRequest; - SENSE_DATA CapabilitiesSenseData; - _Field_size_bytes_(CapabilitiesBufferSize) - PGET_CONFIGURATION_HEADER CapabilitiesBuffer; - ULONG CapabilitiesBufferSize; - PMDL CapabilitiesMdl; - - BOOLEAN ReadCdC2Pointers; - BOOLEAN ReadCdSubCode; - -} CDROM_MMC_EXTENSION, *PCDROM_MMC_EXTENSION; - -typedef struct _CDROM_SCRATCH_READ_WRITE_CONTEXT { - - // Information about the data that we need to read/write - ULONG PacketsCount; - ULONG TransferedBytes; - ULONG EntireXferLen; - ULONG MaxLength; - PUCHAR DataBuffer; - LARGE_INTEGER StartingOffset; - BOOLEAN IsRead; - - // A pointer to the SRB history item to be filled upon completion - PSRB_HISTORY_ITEM SrbHistoryItem; - -} CDROM_SCRATCH_READ_WRITE_CONTEXT, *PCDROM_SCRATCH_READ_WRITE_CONTEXT; - -// Many commands get double-buffered. Since the max -// transfer size is typically 64k, most of these requests -// can be handled with a single pre-allocated buffer. -typedef struct _CDROM_SCRATCH_CONTEXT { - - _Field_range_(4*1024, 64*1024) ULONG ScratchBufferSize; // 0x1000..0x10000 (4k..64k) - _Field_size_bytes_(ScratchBufferSize) PVOID ScratchBuffer; // used to get data for clients - - PMDL ScratchBufferMdl; // used to get data for clients - - WDFREQUEST ScratchRequest; - PSCSI_REQUEST_BLOCK ScratchSrb; - PSENSE_DATA ScratchSense; - PSRB_HISTORY ScratchHistory; - - // This MDL is used to performed the request whose required transfer size is bigger than adaptor's max. - PMDL PartialMdl; - BOOLEAN PartialMdlIsBuilt; - - // For debugging, set/clear this field when using the scratch buffer/request - PVOID ScratchInUse; - PCSTR ScratchInUseFileName; - ULONG ScratchInUseLineNumber; - - // Stuff for asynchronous retrying of the transfer. - ULONG NumRetries; - - // Read Write context - CDROM_SCRATCH_READ_WRITE_CONTEXT ScratchReadWriteContext; - -} CDROM_SCRATCH_CONTEXT, *PCDROM_SCRATCH_CONTEXT; - -// Context structure for the IOCTL work item -typedef struct _CDROM_IOCTL_CONTEXT { - - WDFREQUEST OriginalRequest; - -} CDROM_IOCTL_CONTEXT, *PCDROM_IOCTL_CONTEXT; - -// Context structure for the read/write work item -typedef struct _CDROM_READ_WRITE_CONTEXT { - - WDFREQUEST OriginalRequest; - -} CDROM_READ_WRITE_CONTEXT, *PCDROM_READ_WRITE_CONTEXT; - -typedef struct _CDROM_DATA { - - CDROM_MMC_EXTENSION Mmc; - - // hack flags for ScanForSpecial routines - ULONG_PTR HackFlags; - - // the error handling routines need to be per-device, not per-driver.... - PCDROM_ERROR_HANDLER ErrorHandler; - - // Indicates whether an audio play operation is currently being performed. - // Only thing this does is prevent reads and toc requests while playing audio. - BOOLEAN PlayActive; - - // indicate we need to pick a default dvd region for the user if we can - ULONG PickDvdRegion; - - // The well known name link for this device. - UNICODE_STRING WellKnownName; - - // We need to distinguish between the two... - ULONG MaxPageAlignedTransferBytes; - ULONG MaxUnalignedTransferBytes; - - // Indicates that this is a DEC RRD cdrom. - // This drive requires software to fix responses from the faulty firmware - BOOLEAN IsDecRrd; - - // Storage for the error recovery page. This is used as the method - // to switch block sizes for some drive-specific error recovery routines. - // ERROR_RECOVERY_DATA recoveryData; //obsolete along with error process for TOSHIBA_XM_3xx - - // Indicates that the device is in exclusive mode and only - // the requests from the exclusive owner will be processed. - WDFFILEOBJECT ExclusiveOwner; - - // Caller name of the owner, if the device is in exclusive mode. - UCHAR CallerName[CDROM_EXCLUSIVE_CALLER_LENGTH]; - - // Indicates that the device speed should be set to - // default value on the next media change. - BOOLEAN RestoreDefaults; - - // How long to wait between retries if a READ/WRITE irp - // gets a LWIP (2/4/7, 2/4/8)? - LONGLONG ReadWriteRetryDelay100nsUnits; - - // Cached Device Type information. Maybe FILE_DEVICE_CD_ROM or FILE_DEVICE_DVD - // CommonExtension.DevInfo->DeviceType maybe FILE_DEVICE_CD_ROM when this field is FILE_DEVICE_DVD - DEVICE_TYPE DriveDeviceType; - - _Field_size_bytes_(CachedInquiryDataByteCount) - PINQUIRYDATA CachedInquiryData; - ULONG CachedInquiryDataByteCount; - -} CDROM_DATA, *PCDROM_DATA; - - -typedef struct _CDROM_POWER_OPTIONS { - ULONG PowerDown : 1; - ULONG LockQueue : 1; - ULONG HandleSpinDown : 1; - ULONG HandleSpinUp : 1; - ULONG Reserved : 27; -} CDROM_POWER_OPTIONS, *PCDROM_POWER_OPTIONS; - -// this is a private enum, but must be kept here -// to properly compile size of CDROM_DEVICE_EXTENSION -typedef enum { - PowerDownDeviceInitial, - PowerDownDeviceLocked, - PowerDownDeviceQuiesced, - PowerDownDeviceFlushed, - PowerDownDeviceStopped, - PowerDownDeviceOff, - PowerDownDeviceUnlocked -} CDROM_POWER_DOWN_STATE; - -// this is a private enum, but must be kept here -// to properly compile size of CDROM_DEVICE_EXTENSION -typedef enum { - PowerUpDeviceInitial, - PowerUpDeviceLocked, - PowerUpDeviceOn, - PowerUpDeviceStarted, - PowerUpDeviceUnlocked -} CDROM_POWER_UP_STATE; - -// this is a private structure, but must be kept here -// to properly compile size of CDROM_DEVICE_EXTENSION -typedef struct _CDROM_POWER_CONTEXT { - - BOOLEAN InUse; - - LARGE_INTEGER StartTime; - LARGE_INTEGER Step1CompleteTime; // for SYNC CACHE in power down case - LARGE_INTEGER CompleteTime; - - union { - CDROM_POWER_DOWN_STATE PowerDown; - CDROM_POWER_UP_STATE PowerUp; // currently not used. - } PowerChangeState; - - CDROM_POWER_OPTIONS Options; - - WDFREQUEST PowerRequest; - - SCSI_REQUEST_BLOCK Srb; - SENSE_DATA SenseData; - - ULONG RetryCount; - LONGLONG RetryIntervalIn100ns; - -} CDROM_POWER_CONTEXT, *PCDROM_POWER_CONTEXT; - -// device extension structure -typedef struct _CDROM_DEVICE_EXTENSION { - - // Version control field - ULONG Version; - - // structure size - ULONG Size; - - // the structure is fully ready to use - BOOLEAN IsInitialized; - - // the device is active - BOOLEAN IsActive; - - // the device is surprise removed. - BOOLEAN SurpriseRemoved; - - // Back pointer to device object - WDFDEVICE Device; - - // Save IoTarget here, do not retrieve anytime. - WDFIOTARGET IoTarget; - - // Additional WDF queue for serial I/O processing - WDFQUEUE SerialIOQueue; - - // A separate queue for all the create file requests in sync with device - // removal - WDFQUEUE CreateQueue; - - //Main timer of driver, will do Mcn work. (once per second) - WDFTIMER MainTimer; - - // Pointer to the initialization data for this driver. This is more - // efficient than constantly getting the driver extension. - PCDROM_DRIVER_EXTENSION DriverExtension; - - // WDM device information - PDEVICE_OBJECT DeviceObject; - - // Pointer to the physical device object we attached to - PDEVICE_OBJECT LowerPdo; - - // FILE_DEVICE_CD_ROM -- 2 - DEVICE_TYPE DeviceType; - - // The name of the object - UNICODE_STRING DeviceName; - - // System device number - ULONG DeviceNumber; - - // Values for the flags are below. - USHORT DeviceFlags; - - // Flags for special behaviour required by different hardware, - // such as never spinning down or disabling advanced features such as write cache - ULONG ScanForSpecialFlags; - - // Add default Srb Flags. - ULONG SrbFlags; - - // Request timeout in seconds; - ULONG TimeOutValue; - - //The SCSI address of the device. - SCSI_ADDRESS ScsiAddress; - - // Buffer for drive parameters returned in IO device control. - DISK_GEOMETRY DiskGeometry; - - // Log2 of sector size - UCHAR SectorShift; - - // Length of partition in bytes - LARGE_INTEGER PartitionLength; - - // Number of bytes before start of partition - LARGE_INTEGER StartingOffset; - - // Interface name string returned by IoRegisterDeviceInterface. - UNICODE_STRING MountedDeviceInterfaceName; - - // Device capabilities - PSTORAGE_DEVICE_DESCRIPTOR DeviceDescriptor; - - // SCSI port driver capabilities - PSTORAGE_ADAPTER_DESCRIPTOR AdapterDescriptor; - - // Device power properties - PDEVICE_POWER_DESCRIPTOR PowerDescriptor; - - // Request Sense Buffer - PSENSE_DATA SenseData; - - // Total number of SCSI protocol errors on the device. - ULONG ErrorCount; - - // Lock count for removable media. - LONG LockCount; - LONG ProtectedLockCount; - LONG InternalLockCount; - - KEVENT EjectSynchronizationEvent; - WDFWAITLOCK EjectSynchronizationLock; - - // Indicates that the necessary data structures for media change - // detection have been initialized. - PMEDIA_CHANGE_DETECTION_INFO MediaChangeDetectionInfo; - - // Contains necessary data structures for ZPODD support. - PZERO_POWER_ODD_INFO ZeroPowerODDInfo; - - // File system context. Used for kernel-mode requests to disable autorun. - FILE_OBJECT_CONTEXT KernelModeMcnContext; - - // Count of media changes. This field is only valid for the root partition - // (ie. if PhysicalDevice == NULL). - ULONG MediaChangeCount; - - // Storage for a release queue request. - WDFSPINLOCK ReleaseQueueSpinLock; - WDFREQUEST ReleaseQueueRequest; - SCSI_REQUEST_BLOCK ReleaseQueueSrb; - WDFMEMORY ReleaseQueueInputMemory; //This is a wrapper of ReleaseQueueSrb - BOOLEAN ReleaseQueueNeeded; - BOOLEAN ReleaseQueueInProgress; - - // Context structure for power operations. Since we can only have - // one D irp at any time in the stack we don't need to worry about - // allocating multiple of these structures. - CDROM_POWER_CONTEXT PowerContext; - BOOLEAN PowerDownInProgress; - -#if (NTDDI_VERSION >= NTDDI_WIN8) - BOOLEAN IsVolumeOnlinePending; - WDFQUEUE ManualVolumeReadyQueue; -#endif - - // Lock for Shutdown/Flush operations that need to stop/start the queue - WDFWAITLOCK ShutdownFlushWaitLock; - - // device specific data area - CDROM_DATA DeviceAdditionalData; - - // scratch buffer related fields. - CDROM_SCRATCH_CONTEXT ScratchContext; - - // Hold new private data that only classpnp should modify - // in this structure. - PCDROM_PRIVATE_FDO_DATA PrivateFdoData; - - // Work item for async reads and writes and its context - WDFWORKITEM ReadWriteWorkItem; - CDROM_READ_WRITE_CONTEXT ReadWriteWorkItemContext; - - // Auxiliary WDF object for processing ioctl requests that need to go down - // to the port driver. - WDFWORKITEM IoctlWorkItem; - CDROM_IOCTL_CONTEXT IoctlWorkItemContext; - -} CDROM_DEVICE_EXTENSION, *PCDROM_DEVICE_EXTENSION; - -WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(CDROM_DEVICE_EXTENSION, DeviceGetExtension) - -// a type definition for functions to be called after synchronization -typedef -NTSTATUS -SYNC_HANDLER ( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ); - -typedef SYNC_HANDLER *PSYNC_HANDLER ; - -typedef struct _CDROM_REQUEST_CONTEXT { - PCDROM_DEVICE_EXTENSION DeviceExtension; - - WDFREQUEST OriginalRequest; - - LARGE_INTEGER TimeReceived; - LARGE_INTEGER TimeSentDownFirstTime; - LARGE_INTEGER TimeSentDownLasttTime; - - - ULONG RetriedCount; - - // Used to send down an incoming IOCTL in the original context - BOOLEAN SyncRequired; - PKEVENT SyncEvent; - PSYNC_HANDLER SyncCallback; - - // - // Used for READ/WRITE requests. - // The reason why kernel primitives are used for the spinlock and - // the timer instead of WDF object is there is a race condition - // between the cancel callback and the timer routine. - // Because of this, the timer and the spin lock need to be associated - // per request rather than using shared memory in the device extension - // and it is possible for the WDF object initialization to fail whereas - // the kernel primitives initialize provided memory. Initializing the - // kernel primitives will never fail. Since READ/WRITE is a critical - // code path, it is not desired for READs or WRITEs to fail due to - // an allocation failure that can be avoided and because it is not - // uncommon to see a failure during a READ or WRITE that may not - // occur upon a retry. - // - KSPIN_LOCK ReadWriteCancelSpinLock; - KTIMER ReadWriteTimer; - KDPC ReadWriteDpc; - BOOLEAN ReadWriteIsCompleted; - BOOLEAN ReadWriteRetryInitialized; - -} CDROM_REQUEST_CONTEXT, *PCDROM_REQUEST_CONTEXT; - -WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(CDROM_REQUEST_CONTEXT, RequestGetContext) - -// Define context structure for asynchronous completions. -typedef struct _COMPLETION_CONTEXT { - WDFDEVICE Device; - SCSI_REQUEST_BLOCK Srb; -} COMPLETION_CONTEXT, *PCOMPLETION_CONTEXT; - - -// -#define SCSI_CDROM_TIMEOUT 10 -#define SCSI_CHANGER_BONUS_TIMEOUT 10 - -// -// This value is used as the upper limit for all commands CDROM sends down -// to device, unless the default timeout value is overriden by registry value -// "TimeOutValue" and it is larger than this value. -// -#define SCSI_CDROM_OPC_TIMEOUT 260 - -#define HITACHI_MODE_DATA_SIZE 12 -#define MODE_DATA_SIZE 64 - -#define RAW_SECTOR_SIZE 2352 -#define COOKED_SECTOR_SIZE 2048 - -#define CDROM_SRB_LIST_SIZE 4 - -#define PLAY_ACTIVE(x) (x->DeviceAdditionalData.PlayActive) - -#define MSF_TO_LBA(Minutes,Seconds,Frames) \ - (ULONG)((60 * 75 * (Minutes)) + (75 * (Seconds)) + ((Frames) - 150)) - -// Sector types for READ_CD - -#define ANY_SECTOR 0 -#define CD_DA_SECTOR 1 -#define YELLOW_MODE1_SECTOR 2 -#define YELLOW_MODE2_SECTOR 3 -#define FORM2_MODE1_SECTOR 4 -#define FORM2_MODE2_SECTOR 5 - -#define MAX_COPY_PROTECT_AGID 4 - -#ifdef ExAllocatePool - #undef ExAllocatePool - #define ExAllocatePool #assert(FALSE) -#endif - -// memory allocation tags -// Sc?? - Mass storage driver tags -// ScC - Class driver misc allocations -// ScC? - CdRom - -#define CDROM_TAG_AUTORUN_DISABLE 'ACcS' // "ScCA" - Autorun disable functionality -#define CDROM_TAG_MEDIA_CHANGE_DETECTION 'aCcS' // "ScCa" - Media change detection - -#define CDROM_TAG_SCRATCH 'BCcS' // "ScSB" - Scratch buffer (usually 64k) -#define CDROM_TAG_GET_CONFIG 'CCcS' // "ScCC" - Ioctl GET_CONFIGURATION -#define CDROM_TAG_COMPLETION_CONTEXT 'cCcS' // "ScCc" - Context of completion routine -#define CDROM_TAG_DESCRIPTOR 'DCcS' // "ScCD" - Adaptor & Device descriptor buffer -#define CDROM_TAG_DISC_INFO 'dCcS' // "ScCd" - Disc information -#define CDROM_TAG_SYNC_EVENT 'eCcS' // "ScCe" - Request sync event -#define CDROM_TAG_FEATURE 'FCcS' // "ScCF" - Feature descriptor -#define CDROM_TAG_GESN 'GCcS' // "ScCG" - GESN buffer -#define CDROM_TAG_SENSE_INFO 'ICcS' // "ScCI" - Sense info buffers -#define CDROM_TAG_INQUIRY 'iCcS' // "ScCi" - Cached inquiry buffer -#define CDROM_TAG_MODE_DATA 'MCcS' // "ScCM" - Mode data buffer -#define CDROM_TAG_STREAM 'OCCS' // "SCCO" - Set stream buffer -#define CDROM_TAG_NOTIFICATION 'oCcS' // "ScCo" - Device Notification buffer -#define CDROM_TAG_PLAY_ACTIVE 'pCcS' // "ScCp" - Play active checks -#define CDROM_TAG_REGISTRY 'rCcS' // "ScCr" - Registry string -#define CDROM_TAG_SRB 'SCcS' // "ScCS" - Srb allocation -#define CDROM_TAG_STRINGS 'sCcS' // "ScCs" - Assorted string data -#define CDROM_TAG_UPDATE_CAP 'UCcS' // "ScCU" - Update capacity path -#define CDROM_TAG_ZERO_POWER_ODD 'ZCcS' // "ScCZ" - Zero Power ODD - -#define DVD_TAG_READ_KEY 'uCcS' // "ScCu" - Read buffer for dvd key -#define DVD_TAG_RPC2_CHECK 'VCcS' // "ScCV" - Read buffer for dvd/rpc2 check -#define DVD_TAG_DVD_REGION 'vCcS' // "ScCv" - Read buffer for rpc2 check -#define DVD_TAG_SECURITY 'XCcS' // "ScCX" - Security descriptor - - -// registry keys and data entry names. -#define CDROM_SUBKEY_NAME (L"CdRom") // store new settings here -#define CDROM_READ_CD_NAME (L"ReadCD") // READ_CD support previously detected -#define CDROM_NON_MMC_DRIVE_NAME (L"NonMmc") // MMC commands hang -#define CDROM_TYPE_ONE_GET_CONFIG_NAME (L"NoTypeOneGetConfig") // Type One Get Config commands not supported -#define CDROM_NON_MMC_VENDOR_SPECIFIC_PROFILE (L"NonMmcVendorSpecificProfile") // GET_CONFIG returns vendor specific header - // profiles that are not per spec (length divisible by 4) -#define DVD_DEFAULT_REGION (L"DefaultDvdRegion") // this is init. by the dvd class installer -#define DVD_MAX_REGION 8 - -// AACS defines -#define AACS_MKB_PACK_SIZE 0x8000 // does not include header - -//enumeration of device interfaces need to be registered. -typedef enum { - CdRomDeviceInterface = 0, // CdRomClassGuid - MountedDeviceInterface // MOUNTDEV_MOUNTED_DEVICE_GUID -} CDROM_DEVICE_INTERFACES, *PCDROM_DEVICE_INTERFACES; - - -typedef -VOID -(*PCDROM_SCAN_FOR_SPECIAL_HANDLER) ( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ ULONG_PTR Data - ); - -// Rountines Definition - -#define FREE_POOL(_PoolPtr) \ - if (_PoolPtr != NULL) { \ - ExFreePool(_PoolPtr); \ - _PoolPtr = NULL; \ - } - -#define EXCLUSIVE_MODE(_CdData) (_CdData->ExclusiveOwner != NULL) -#define EXCLUSIVE_OWNER(_CdData, _FileObject) (_CdData->ExclusiveOwner == _FileObject) - -#define IS_SCSIOP_READ(opCode) \ - ((opCode == SCSIOP_READ6) || \ - (opCode == SCSIOP_READ) || \ - (opCode == SCSIOP_READ12) || \ - (opCode == SCSIOP_READ16)) - -#define IS_SCSIOP_WRITE(opCode) \ - ((opCode == SCSIOP_WRITE6) || \ - (opCode == SCSIOP_WRITE) || \ - (opCode == SCSIOP_WRITE12) || \ - (opCode == SCSIOP_WRITE16)) - -#define IS_SCSIOP_READWRITE(opCode) (IS_SCSIOP_READ(opCode) || IS_SCSIOP_WRITE(opCode)) - -// Bit Flag Macros -#define SET_FLAG(Flags, Bit) ((Flags) |= (Bit)) -#define CLEAR_FLAG(Flags, Bit) ((Flags) &= ~(Bit)) -#define TEST_FLAG(Flags, Bit) (((Flags) & (Bit)) != 0) - -__inline -BOOLEAN -ValidChar(UCHAR Ch) -{ - if (((Ch >= '0') && (Ch <= '9')) || - (((Ch|0x20) >= 'a') && ((Ch|0x20) <= 'z')) || - (strchr(" .,:;_-", Ch) != NULL)) - { - return TRUE; - } - return FALSE; -} - -// could be #define, but this allows typechecking -__inline -BOOLEAN -PORT_ALLOCATED_SENSE( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSCSI_REQUEST_BLOCK Srb - ) -{ - UNREFERENCED_PARAMETER(DeviceExtension); - return (BOOLEAN)((TEST_FLAG(Srb->SrbFlags, SRB_FLAGS_PORT_DRIVER_ALLOCSENSE) && - TEST_FLAG(Srb->SrbFlags, SRB_FLAGS_FREE_SENSE_BUFFER)) - ); -} - -__inline -VOID -FREE_PORT_ALLOCATED_SENSE_BUFFER( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSCSI_REQUEST_BLOCK Srb - ) -{ -#ifndef DEBUG - UNREFERENCED_PARAMETER(DeviceExtension); -#endif - NT_ASSERT(TEST_FLAG(Srb->SrbFlags, SRB_FLAGS_PORT_DRIVER_ALLOCSENSE)); - NT_ASSERT(TEST_FLAG(Srb->SrbFlags, SRB_FLAGS_FREE_SENSE_BUFFER)); - NT_ASSERT(Srb->SenseInfoBuffer != DeviceExtension->SenseData); - - ExFreePool(Srb->SenseInfoBuffer); - Srb->SenseInfoBuffer = NULL; - Srb->SenseInfoBufferLength = 0; - CLEAR_FLAG(Srb->SrbFlags, SRB_FLAGS_FREE_SENSE_BUFFER); - return; -} - -// Standard driver entry function -DRIVER_INITIALIZE DriverEntry; - -// Driver Event callbacks -EVT_WDF_DRIVER_DEVICE_ADD DriverEvtDeviceAdd; - -EVT_WDF_OBJECT_CONTEXT_CLEANUP DriverEvtCleanup; - -// Device Event callbacks - -EVT_WDF_OBJECT_CONTEXT_CLEANUP DeviceEvtCleanup; - -EVT_WDF_FILE_CLOSE DeviceEvtFileClose; - -EVT_WDF_IO_IN_CALLER_CONTEXT DeviceEvtIoInCallerContext; - -EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT DeviceEvtSelfManagedIoInit; - -EVT_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP DeviceEvtSelfManagedIoCleanup; - -EVT_WDF_DEVICE_D0_ENTRY DeviceEvtD0Entry; - -EVT_WDF_DEVICE_D0_EXIT DeviceEvtD0Exit; - -EVT_WDF_DEVICE_SURPRISE_REMOVAL DeviceEvtSurpriseRemoval; - -// Create Queue Event callbacks - -EVT_WDF_IO_QUEUE_IO_DEFAULT CreateQueueEvtIoDefault; - -// Sequential Queue Event callbacks - -// We do not use KMDF annotation for the following function, because it handles -// both read and write requests and there is no single annotation for that. -VOID -SequentialQueueEvtIoReadWrite( - _In_ WDFQUEUE Queue, - _In_ WDFREQUEST Request, - _In_ size_t Length - ); - -EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL SequentialQueueEvtIoDeviceControl; - -EVT_WDF_IO_QUEUE_IO_CANCELED_ON_QUEUE SequentialQueueEvtCanceledOnQueue; - -// Miscellaneous request callbacks - -EVT_WDF_OBJECT_CONTEXT_CLEANUP RequestEvtCleanup; - -EVT_WDFDEVICE_WDM_IRP_PREPROCESS RequestProcessShutdownFlush; - -EVT_WDFDEVICE_WDM_IRP_PREPROCESS RequestProcessSetPower; - - -// helper functions - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceClaimRelease( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN Release - ); - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceReleaseMcnResources( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceRetrieveDescriptor( - _In_ WDFDEVICE Device, - _In_ PSTORAGE_PROPERTY_ID PropertyId, - _Outptr_ PSTORAGE_DESCRIPTOR_HEADER* Descriptor - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -VOID -DeviceRetrieveHackFlagsFromRegistry( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceHackFlagsScan( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ ULONG_PTR Data - ); - -_IRQL_requires_max_(APC_LEVEL) -BOOLEAN -StringsAreMatched( - _In_opt_z_ PCHAR StringToMatch, - _In_z_ PCHAR TargetString - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -VOID -DeviceGetParameter( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ PWSTR SubkeyName, - _In_ PWSTR ParameterName, - _Inout_ PULONG ParameterValue // also default value - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceSetParameter( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_z_ PWSTR SubkeyName, - _In_ PWSTR ParameterName, - _In_ ULONG ParameterValue - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -ULONG -DeviceGetTimeOutValueFromRegistry(); - -_IRQL_requires_max_(APC_LEVEL) -VOID -ScanForSpecialHandler( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ ULONG_PTR HackFlags - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceSendSrbSynchronously( - _In_ WDFDEVICE Device, - _In_ PSCSI_REQUEST_BLOCK Srb, - _In_opt_ PVOID BufferAddress, - _In_ ULONG BufferLength, - _In_ BOOLEAN WriteToDevice, - _In_opt_ WDFREQUEST OriginalRequest - ); - -BOOLEAN -RequestSenseInfoInterpret( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, // get IRP MJ code, IoControlCode from it (or attached original request) - _In_ PSCSI_REQUEST_BLOCK Srb, - _In_ ULONG RetriedCount, - _Out_ NTSTATUS* Status, - _Out_opt_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) - LONGLONG* RetryIntervalIn100ns - ); - -VOID -RequestSetReceivedTime( - _In_ WDFREQUEST Request - ); - -VOID -RequestSetSentTime( - _In_ WDFREQUEST Request - ); - -VOID -RequestClearSendTime( - _In_ WDFREQUEST Request - ); - -BOOLEAN -RequestSenseInfoInterpretForScratchBuffer( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ ULONG RetriedCount, - _Out_ NTSTATUS* Status, - _Out_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) - LONGLONG* RetryIntervalIn100ns - ); - - -VOID -DeviceSendNotification( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ const GUID* Guid, - _In_ ULONG ExtraDataSize, - _In_opt_ PVOID ExtraData - ); - -VOID -DeviceSendStartUnit( - _In_ WDFDEVICE Device - ); - -EVT_WDF_REQUEST_COMPLETION_ROUTINE DeviceAsynchronousCompletion; - -VOID -DeviceReleaseQueue( - _In_ WDFDEVICE Device - ); - -EVT_WDF_REQUEST_COMPLETION_ROUTINE DeviceReleaseQueueCompletion; - -VOID -DevicePerfIncrementErrorCount( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceCacheDeviceInquiryData( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceCacheGetConfigurationData( - _In_ WDFDEVICE Device - ); - -_IRQL_requires_max_(APC_LEVEL) -PVOID -DeviceFindFeaturePage( - _In_reads_bytes_(Length) PGET_CONFIGURATION_HEADER FeatureBuffer, - _In_ ULONG const Length, - _In_ FEATURE_NUMBER const Feature - ); - -_IRQL_requires_max_(APC_LEVEL) -VOID -DevicePrintAllFeaturePages( - _In_reads_bytes_(Usable) PGET_CONFIGURATION_HEADER Buffer, - _In_ ULONG const Usable - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceSetRawReadInfo( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -MediaReadCapacity( - _In_ WDFDEVICE Device - ); - -_IRQL_requires_max_(APC_LEVEL) -VOID -MediaReadCapacityDataInterpret( - _In_ WDFDEVICE Device, - _In_ PREAD_CAPACITY_DATA ReadCapacityBuffer - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceInitReleaseQueueContext( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceInitPowerContext( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceCreateWellKnownName( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceInitializeDvd( - _In_ WDFDEVICE Device - ); - -_IRQL_requires_max_(APC_LEVEL) -VOID -DevicePickDvdRegion( - _In_ WDFDEVICE Device - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceRegisterInterface( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ CDROM_DEVICE_INTERFACES InterfaceType - ); - -_IRQL_requires_max_(DISPATCH_LEVEL) -NTSTATUS -DeviceSendPowerDownProcessRequest( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine, - _In_opt_ WDFCONTEXT Context - ); - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceScanForSpecial( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ CDROM_SCAN_FOR_SPECIAL_INFO DeviceList[], - _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceInitializeHotplugInfo( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -NTSTATUS -DeviceErrorHandlerForMmc( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSCSI_REQUEST_BLOCK Srb, - _Inout_ PNTSTATUS Status, - _Inout_ PBOOLEAN Retry - ); - -NTSTATUS -DeviceErrorHandlerForHitachiGD2000( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSCSI_REQUEST_BLOCK Srb, - _Inout_ PNTSTATUS Status, - _Inout_ PBOOLEAN Retry - ); - -EVT_WDF_WORKITEM DeviceRestoreDefaultSpeed; - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceInitializeMediaChangeDetection( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -VOID -DeviceSetMediaChangeStateEx( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ MEDIA_CHANGE_DETECTION_STATE NewState, - _Inout_opt_ PMEDIA_CHANGE_DETECTION_STATE OldState - ); - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceSendDelayedMediaChangeNotifications( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -NTSTATUS -RequestSynchronizeProcessWithSerialQueue( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceCleanupProtectedLocks( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PFILE_OBJECT_CONTEXT FileObjectContext - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceCleanupDisableMcn( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PFILE_OBJECT_CONTEXT FileObjectContext - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceUnlockExclusive( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFFILEOBJECT FileObject, - _In_ BOOLEAN IgnorePreviousMediaChanges - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -RequestProcessSerializedIoctl( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request - ); - -NTSTATUS -RequestIsIoctlBlockedByExclusiveAccess( - _In_ WDFREQUEST Request, - _Out_ PBOOLEAN IsBlocked - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceSendRequestSynchronously( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request, - _In_ BOOLEAN RequestFormated - ); - -VOID -DeviceSendIoctlAsynchronously( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ ULONG IoControlCode, - _In_ PDEVICE_OBJECT TargetDeviceObject - ); - -IO_COMPLETION_ROUTINE RequestAsynchronousIrpCompletion; - -// MMC Update functions - -BOOLEAN -DeviceIsMmcUpdateRequired( - _In_ WDFDEVICE Device - ); - -// Helper functions - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceEnableMediaChangeDetection( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Inout_ PFILE_OBJECT_CONTEXT FileObjectContext, - _In_ BOOLEAN IgnorePreviousMediaChanges - ); - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceDisableMediaChangeDetection( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Inout_ PFILE_OBJECT_CONTEXT FileObjectContext - ); - -NTSTATUS -RequestSetContextFields( - _In_ WDFREQUEST Request, - _In_ PSYNC_HANDLER Handler - ); - -_IRQL_requires_max_(APC_LEVEL) -BOOLEAN -DeviceIsPlayActive( - _In_ WDFDEVICE Device - ); - -NTSTATUS -RequestDuidGetDeviceIdProperty( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestDuidGetDeviceProperty( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -ULONG -DeviceRetrieveModeSenseUsingScratch( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_reads_bytes_(Length) PCHAR ModeSenseBuffer, - _In_ ULONG Length, - _In_ UCHAR PageCode, - _In_ UCHAR PageControl - ); - -_IRQL_requires_max_(APC_LEVEL) -PVOID -ModeSenseFindSpecificPage( - _In_reads_bytes_(Length) PCHAR ModeSenseBuffer, - _In_ size_t Length, - _In_ UCHAR PageMode, - _In_ BOOLEAN Use6Byte - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -PerformEjectionControl( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ MEDIA_LOCK_TYPE LockType, - _In_ BOOLEAN Lock - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -VOID -DeviceDisableMainTimer( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceEnableMainTimer( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -EVT_WDF_TIMER DeviceMainTimerTickHandler; - -VOID -RequestSetupMcnSyncIrp( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestSetupMcnRequest( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN UseGesn - ); - -_IRQL_requires_max_(APC_LEVEL) -BOOLEAN -RequestSendMcnRequest( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(APC_LEVEL) -BOOLEAN -RequestPostWorkMcnRequest( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(DISPATCH_LEVEL) -NTSTATUS -PowerContextReuseRequest( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(DISPATCH_LEVEL) -NTSTATUS -PowerContextBeginUse( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(DISPATCH_LEVEL) -NTSTATUS -PowerContextEndUse( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -POWER_SETTING_CALLBACK DevicePowerSettingCallback; - -// Zero Power ODD functions - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceInitializeZPODD( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceReleaseZPODDResources( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -NTSTATUS -DeviceZPODDGetPowerupReason( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Out_ PSTORAGE_IDLE_POWERUP_REASON PowerupReason - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -BOOLEAN -DeviceZPODDIsInHomePosition( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -VOID -DeviceMarkActive( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN IsActive, - _In_ BOOLEAN SetIdleTimeout - ); - -// common routines for specific IOCTL process - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DvdStartSessionReadKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ ULONG IoControlCode, - _In_opt_ WDFREQUEST OriginalRequest, - _In_opt_ PVOID InputBuffer, - _In_ size_t InputBufferLength, - _In_ PVOID OutputBuffer, - _In_ size_t OutputBufferLength, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -ReadDvdStructure( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ WDFREQUEST OriginalRequest, - _In_ PVOID InputBuffer, - _In_ size_t InputBufferLength, - _In_ PVOID OutputBuffer, - _In_ size_t OutputBufferLength, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -ReadQChannel( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ WDFREQUEST OriginalRequest, - _In_ PVOID InputBuffer, - _In_ size_t InputBufferLength, - _In_ PVOID OutputBuffer, - _In_ size_t OutputBufferLength, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DvdSendKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ WDFREQUEST OriginalRequest, - _In_ PVOID InputBuffer, - _In_ size_t InputBufferLength, - _Out_ size_t * DataLength - ); - - -#ifndef SIZEOF_ARRAY - #define SIZEOF_ARRAY(ar) (sizeof(ar)/sizeof((ar)[0])) -#endif // !defined(SIZEOF_ARRAY) - - -// 100us to seconds -#define UNIT_100NS_PER_SECOND (10*1000*1000) -#define SECONDS_TO_100NS_UNITS(x) (((LONGLONG)x) * UNIT_100NS_PER_SECOND) - -// -// Bit Flag Macros -// -#define SET_FLAG(Flags, Bit) ((Flags) |= (Bit)) -#define CLEAR_FLAG(Flags, Bit) ((Flags) &= ~(Bit)) -#define TEST_FLAG(Flags, Bit) (((Flags) & (Bit)) != 0) - -// -// neat little hacks to count number of bits set efficiently -// -__inline ULONG CountOfSetBitsUChar(UCHAR _X) - { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } -__inline ULONG CountOfSetBitsULong(ULONG _X) - { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } -__inline ULONG CountOfSetBitsULong32(ULONG32 _X) - { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } -__inline ULONG CountOfSetBitsULong64(ULONG64 _X) - { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } -__inline ULONG CountOfSetBitsUlongPtr(ULONG_PTR _X) - { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } - - -__inline -BOOLEAN -IsVolumeMounted( - _In_ PDEVICE_OBJECT DeviceObject - ) -{ -#pragma prefast(push) -#pragma prefast(disable: 28175, "there is no other way to check if there is volume mounted") - return (DeviceObject->Vpb != NULL) && - ((DeviceObject->Vpb->Flags & VPB_MOUNTED) != 0); -#pragma prefast(pop) -} - - -__inline _Ret_range_(0,MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) -LONGLONG -ConvertSectorsPerSecondTo100nsUnitsFor64kWrite( - _In_range_(1,0xFFFFFFFF) ULONG SectorsPerSecond // zero would cause divide-by-zero - ) -{ - // 64k write - // ---------------- == time per 64k write - // sectors/second - // - // (32 / N) == seconds - // (32 / N) * (1,000,000,000) == nanoseconds - // (32 / N) * (1,000,000,000) / 100 == 100ns increments - // (32 * 10,000,000) / N == 100ns increments - // - // 320,000,000 / N == 100ns increments - // And this is safe to run in kernel-mode (no floats) - // - - // this assert ensures that we _never_ can return a value - // larger than the maximum allowed. - C_ASSERT(320000000 < MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS); - - return 320000000 / SectorsPerSecond; -} - -__inline -UCHAR -RequestGetCurrentStackLocationFlags( - _In_ WDFREQUEST Request - ) -{ - PIRP irp = NULL; - PIO_STACK_LOCATION currentStack = NULL; - - irp = WdfRequestWdmGetIrp(Request); - currentStack = IoGetCurrentIrpStackLocation(irp); - - return currentStack->Flags; -} - -__inline -ULONG -TimeOutValueGetCapValue( - _In_ ULONG TimeOutValue, - _In_ ULONG Times - ) -{ - ULONG value = 0; - - if (TimeOutValue > SCSI_CDROM_OPC_TIMEOUT) - { - // if time out value is specified by user in registry, and is - // bigger than OPC time out, it should be big enough - value = TimeOutValue; - } - else - { - // otherwise, OPC time out value should be the upper limit - value = min(TimeOutValue * Times, SCSI_CDROM_OPC_TIMEOUT); - } - - return value; -} - -VOID -RequestCompletion( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ NTSTATUS Status, - _In_ ULONG_PTR Information - ); - -NTSTATUS -RequestSend( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDFIOTARGET IoTarget, - _In_ ULONG Flags, - _Out_opt_ PBOOLEAN RequestSent - ); - -EVT_WDF_REQUEST_COMPLETION_ROUTINE RequestDummyCompletionRoutine; - -VOID -RequestProcessInternalDeviceControl( - _In_ WDFREQUEST Request, - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -EVT_WDF_WORKITEM IoctlWorkItemRoutine; - -EVT_WDF_WORKITEM ReadWriteWorkItemRoutine; - -#pragma warning(pop) // un-sets any local warning changes - -#endif // __CDROMP_H__ - - diff --git a/storage/class/cdrom/src/cdrom.inf b/storage/class/cdrom/src/cdrom.inf deleted file mode 100644 index 47245307..00000000 Binary files a/storage/class/cdrom/src/cdrom.inf and /dev/null differ diff --git a/storage/class/cdrom/src/cdrom.rc b/storage/class/cdrom/src/cdrom.rc deleted file mode 100644 index 688f9142..00000000 --- a/storage/class/cdrom/src/cdrom.rc +++ /dev/null @@ -1,23 +0,0 @@ -//+------------------------------------------------------------------------- -// -// Microsoft Windows -// -// Copyright (C) Microsoft Corporation, 1996 - 1999 -// -// File: scsicdrm.rc -// -//-------------------------------------------------------------------------- - -#include - -#include - -#define VER_FILETYPE VFT_DRV -#define VER_FILESUBTYPE VFT2_DRV_SYSTEM -#define VER_FILEDESCRIPTION_STR "SCSI CD-ROM Driver" -#define VER_INTERNALNAME_STR "cdrom.sys" -#define VER_ORIGINALFILENAME_STR "cdrom.sys" -#define VER_LANGNEUTRAL - -#include "common.ver" - diff --git a/storage/class/cdrom/src/cdrom.vcxproj b/storage/class/cdrom/src/cdrom.vcxproj deleted file mode 100644 index 689c9716..00000000 --- a/storage/class/cdrom/src/cdrom.vcxproj +++ /dev/null @@ -1,168 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {9DB6E759-C294-4E18-9013-82FD8F3DD5E6} - $(MSBuildProjectName) - 1 - false - Debug - Win32 - {E2CAD978-F695-4642-9CD1-65CB518B0B80} - - - - Windows10 - False - Universal - KMDF - WindowsKernelModeDriver10.0 - Driver - - - Windows10 - True - Universal - KMDF - WindowsKernelModeDriver10.0 - Driver - - - Windows10 - False - Universal - KMDF - WindowsKernelModeDriver10.0 - Driver - - - Windows10 - True - Universal - KMDF - WindowsKernelModeDriver10.0 - Driver - - - - $(IntDir) - - - - - - - - - - - - - - - - true - true - TracePrint((LEVEL,FLAGS,MSG,...)) - - - $(InfArch) - true - .\$(IntDir)\cdrom.inf - - - true - true - TracePrint((LEVEL,FLAGS,MSG,...)) - - - - cdrom - - - cdrom - - - cdrom - - - cdrom - - - - true - Level4 - - - - - %(AdditionalDependencies);$(DDK_LIB_PATH)\ntoskrnl.lib - - - - - true - Level4 - - - - - %(AdditionalDependencies);$(DDK_LIB_PATH)\ntoskrnl.lib - - - - - true - Level4 - - - - - %(AdditionalDependencies);$(DDK_LIB_PATH)\ntoskrnl.lib - - - - - true - Level4 - - - - - %(AdditionalDependencies);$(DDK_LIB_PATH)\ntoskrnl.lib - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/storage/class/cdrom/src/cdrom.vcxproj.Filters b/storage/class/cdrom/src/cdrom.vcxproj.Filters deleted file mode 100644 index 57895acd..00000000 --- a/storage/class/cdrom/src/cdrom.vcxproj.Filters +++ /dev/null @@ -1,72 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {1BE21169-AD4D-4A1B-AACD-6310066933B0} - - - h;hpp;hxx;hm;inl;inc;xsd - {9B550B9E-2283-4A6B-BAC8-52E0EAB6DD60} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {B3F87DD6-6AE2-4B7C-9C6F-6BC20F347A17} - - - inf;inv;inx;mof;mc; - {4F903A62-C105-4A95-AB1A-2EB0F3AE253F} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Driver Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/storage/class/cdrom/src/cdromp.h b/storage/class/cdrom/src/cdromp.h deleted file mode 100644 index 2fdf7118..00000000 --- a/storage/class/cdrom/src/cdromp.h +++ /dev/null @@ -1,383 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - cdromp.h - -Abstract: - - Private header file for cdrom.sys modules. This contains private - structure and function declarations as well as constant values which do - not need to be exported. - -Author: - -Environment: - - kernel mode only - -Notes: - - -Revision History: - ---*/ - -#ifndef __CDROMP_H__ -#define __CDROMP_H__ - - -#include -#include -#include -#include -#include - -/* - * IA64 requires 8-byte alignment for pointers, but the IA64 NT kernel expects 16-byte alignment - */ -#ifdef _WIN64 - #define PTRALIGN DECLSPEC_ALIGN(16) -#else - #define PTRALIGN -#endif - -// NOTE: Start with a smaller 100 second maximum, due to current assert in CLASSPNP -// 0x0000 00C9'2A69 C000 (864,000,000,000) is 24 hours in 100ns units -// 0x0000 0000'3B9A CA00 ( 1,000,000,000) is 100 seconds in 100ns units -#define MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS (0x3B9ACA00) - -// structures to simplify matching devices, ids, and hacks required for -// these ids. -typedef struct _CDROM_SCAN_FOR_SPECIAL_INFO { - // - // * NULL pointers indicates that no match is required. - // * empty string will only match an empty string. non-existant strings - // in the device descriptor are considered empty strings for this match. - // (ie. "" will only match "") - // * all other strings will do partial matches, based upon - // string provided (ie. "hi" will match "hitazen" and "higazui") - // * array must end with all three PCHARs being set to NULL. - // - - PCHAR VendorId; - PCHAR ProductId; - PCHAR ProductRevision; - - // - // marked as a ULONG_PTR to allow use as either a ptr to a data block - // or 32 bits worth of flags. (64 bits on 64 bit systems) no longer a - // const so that it may be dynamically built. - // - - ULONG_PTR Data; - -} CDROM_SCAN_FOR_SPECIAL_INFO, *PCDROM_SCAN_FOR_SPECIAL_INFO; - -// Define the various states that media can be in for autorun. -typedef enum _MEDIA_CHANGE_DETECTION_STATE { - MediaUnknown, - MediaPresent, - MediaNotPresent, - MediaUnavailable // e.g. cd-r media undergoing burn -} MEDIA_CHANGE_DETECTION_STATE, *PMEDIA_CHANGE_DETECTION_STATE; - - -/*++//////////////////////////////////////////////////////////////////////////// - - This structure defines the history kept for a given transfer packet. - It includes a srb status/sense data structure that is always either valid - or zero-filled for the full 18 bytes, time sent/completed, and how long - the retry delay was requested to be. - ---*/ -typedef struct _SRB_HISTORY_ITEM { - LARGE_INTEGER TickCountSent; // 0x00..0x07 - LARGE_INTEGER TickCountCompleted; // 0x08..0x0F - ULONG MillisecondsDelayOnRetry; // 0x10..0x13 - SENSE_DATA NormalizedSenseData; // 0x14..0x25 (0x12 bytes) - UCHAR SrbStatus; // 0x26 - UCHAR ClassDriverUse; // 0x27 -- one byte free (alignment) -} SRB_HISTORY_ITEM, *PSRB_HISTORY_ITEM; - -typedef struct _SRB_HISTORY { - ULONG_PTR ClassDriverUse[4]; // for the class driver to use as they please - _Field_range_(1,30000) - ULONG TotalHistoryCount; - _Field_range_(0,TotalHistoryCount) - ULONG UsedHistoryCount; - _Field_size_part_(TotalHistoryCount, UsedHistoryCount) - SRB_HISTORY_ITEM History[1]; -} SRB_HISTORY, *PSRB_HISTORY; - -extern CDROM_SCAN_FOR_SPECIAL_INFO CdRomBadItems[]; - -/*++////////////////////////////////////////////////////////////////////////////*/ - -// legacy registry key and values. -#define CLASSP_REG_SUBKEY_NAME (L"Classpnp") - -#define CLASSP_REG_HACK_VALUE_NAME (L"HackMask") -#define CLASSP_REG_MMC_DETECTION_VALUE_NAME (L"MMCDetectionState") -#define CLASSP_REG_WRITE_CACHE_VALUE_NAME (L"WriteCacheEnableOverride") -#define CLASSP_REG_PERF_RESTORE_VALUE_NAME (L"RestorePerfAtCount") -#define CLASSP_REG_REMOVAL_POLICY_VALUE_NAME (L"UserRemovalPolicy") -#define WINPE_REG_KEY_NAME (L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\MiniNT") - -#define CLASS_PERF_RESTORE_MINIMUM (0x10) -#define CLASS_ERROR_LEVEL_1 (0x4) -#define CLASS_ERROR_LEVEL_2 (0x8) - -#define FDO_HACK_CANNOT_LOCK_MEDIA (0x00000001) -#define FDO_HACK_GESN_IS_BAD (0x00000002) -#define FDO_HACK_NO_RESERVE6 (0x00000008) -#define FDO_HACK_GESN_IGNORE_OPCHANGE (0x00000010) -#define FDO_HACK_NO_STREAMING (0x00000020) -#define FDO_HACK_NO_ASYNCHRONOUS_NOTIFICATION (0x00000040) - -#define FDO_HACK_VALID_FLAGS (0x0000007F) -#define FDO_HACK_INVALID_FLAGS (~FDO_HACK_VALID_FLAGS) - -/* - * Lots of retries of synchronized SCSI commands that devices may not - * even support really slows down the system (especially while booting). - * (Even GetDriveCapacity may be failed on purpose if an external disk is powered off). - * If a disk cannot return a small initialization buffer at startup - * in two attempts (with delay interval) then we cannot expect it to return - * data consistently with four retries. - * So don't set the retry counts as high here as for data SRBs. - * - * If we find that these requests are failing consecutively, - * despite the retry interval, on otherwise reliable media, - * then we should either increase the retry interval for - * that failure or (by all means) increase these retry counts as appropriate. - */ -//#define NUM_LOCKMEDIAREMOVAL_RETRIES 1 -//#define NUM_MODESENSE_RETRIES 1 -//#define NUM_DRIVECAPACITY_RETRIES 1 - -/* - * We retry failed I/O requests at 1-second intervals. - * In the case of a failure due to bus reset, we want to make sure that we retry after the allowable - * reset time. For SCSI, the allowable reset time is 5 seconds. ScsiPort queues requests during - * a bus reset, which should cause us to retry after the reset is over; but the requests queued in - * the miniport are failed all the way back to us immediately. In any event, in order to make - * extra sure that our retries span the allowable reset time, we should retry more than 5 times. - */ -//#define NUM_IO_RETRIES 8 - -#define CDROM_VOLUME_VERIFY_CHECKED 0x34 - -#define CDROM_TAG_PRIVATE_DATA 'CPcS' - -typedef struct _MEDIA_CHANGE_DETECTION_INFO { - - // Use AN if supported so that we don't need to poll for media change notifications. - BOOLEAN AsynchronousNotificationSupported; - - // If AN is turned on and we received an AN signal when the device is exclusively locked, - // we should take a note and send down a GESN when the lock is lifted, since otherwise - // we will lose the signal. Even worse, some ODD models will signal the event again next - // time a SYNC CACHE is sent down, and processing the event in that arbitrary timing may - // cause unexpected behaviors. - BOOLEAN ANSignalPendingDueToExclusiveLock; - - // Mutex to synchronize enable/disable requests and media state changes - KMUTEX MediaChangeMutex; - - // For request erialization use. - // This irp is used in timer callback routine, will be sent to the device itself. - // so that the sequentail queue will get request wrapped on this irp. After doing - // the real work, this irp will be completed to indicate it's ok to send the next - // MCN request. - PIRP MediaChangeSyncIrp; - - // The last known state of the media (present, not present, unknown). - // Protected by MediaChangeMutex. - MEDIA_CHANGE_DETECTION_STATE LastKnownMediaDetectionState; - - // The last state of the media (present, not present, unknown) reported to apps - // via notifications. Protected by MediaChangeMutex - MEDIA_CHANGE_DETECTION_STATE LastReportedMediaDetectionState; - - // This is a count of how many time MCD has been disabled. if it is - // set to zero, then we'll poll the device for MCN events with the - // then-current method (ie. TEST UNIT READY or GESN). this is - // protected by MediaChangeMutex - LONG MediaChangeDetectionDisableCount; - - // recent changes allowed instant retries of the MCN REQUEST. Since this - // could cause an infinite loop, keep a count of how many times we've - // retried immediately so that we can catch if the count exceeds an - // arbitrary limit. - LONG MediaChangeRetryCount; - - // use GESN if it's available - struct { - BOOLEAN Supported; - BOOLEAN HackEventMask; - UCHAR EventMask; - UCHAR NoChangeEventMask; - PUCHAR Buffer; - PMDL Mdl; - ULONG BufferSize; - } Gesn; - - // If this value is one, then the REQUEST is currently in use. - // If this value is zero, then the REQUEST is available. - // Use InterlockedCompareExchange() to set from "available" to "in use". - // ASSERT that InterlockedCompareExchange() showed previous value of - // "in use" when changing back to "available" state. - // This also implicitly protects the MediaChangeSrb and SenseBuffer - // - // This protect is needed in the polling case since the timer is fired asynchronous - // to our sequential I/O queues, and when the timer is fired, our Sync Irp could be - // still using the MediaChangeRequest. However, if AN is used, then each interrupt - // will cause us to queue a request, so interrupts are serialized, and within the - // handling of each request, we already sequentially use the MediaChangeRequest if - // we need retries. We still use it in case of AN to be consistent with polling, but - // if in the future we remove polling altogether, then we don't need this field anymore. - LONG MediaChangeRequestInUse; - - // Pointer to the REQUEST to be used for media change detection. - // protected by Interlocked MediaChangeRequestInUse - WDFREQUEST MediaChangeRequest; - - // The srb for the media change detection. - // protected by Interlocked MediaChangeIrpInUse - SCSI_REQUEST_BLOCK MediaChangeSrb; - PUCHAR SenseBuffer; - ULONG SrbFlags; - - // Handle to the display state notification registration. - PVOID DisplayStateCallbackHandle; - -} MEDIA_CHANGE_DETECTION_INFO, *PMEDIA_CHANGE_DETECTION_INFO; - -#define DELAY_TIME_TO_ENTER_ZERO_POWER_IN_MS (60 * 1000) -#define DELAY_TIME_TO_ENTER_AOAC_IDLE_POWER_IN_MS (10 * 1000) -#define BECOMING_READY_RETRY_COUNT (15) -#define BECOMING_READY_RETRY_INTERNVAL_IN_100NS (2 * 1000 * 1000) - -typedef struct _ZERO_POWER_ODD_INFO { - - UCHAR LoadingMechanism; // From Removable Medium Feature Descriptor - UCHAR Load; // From Removable Medium Feature Descriptor - - D3COLD_SUPPORT_INTERFACE D3ColdInterface; // D3Cold interface from ACPI - - BOOLEAN Reserved; // Reserved - BOOLEAN InZeroPowerState; // Is device currently in Zero Power State - BOOLEAN RetryFirstCommand; // First command after power resume should be retried - BOOLEAN MonitorStartStopUnit; // If 1. drawer 2. soft eject 3. no media 4. Immed=0, - // we will not receive any GESN events, and so we should - // monitor the command to get notified - ULONG BecomingReadyRetryCount; // How many times we should retry for becoming ready - - UCHAR SenseKey; // sense code from TUR to check media & tray status - UCHAR AdditionalSenseCode; // sense code from TUR to check media & tray status - UCHAR AdditionalSenseCodeQualifier; // sense code from TUR to check media & tray status - - PGET_CONFIGURATION_HEADER GetConfigurationBuffer; // Cached Get Configuration response from device - ULONG GetConfigurationBufferSize; // Size of the above buffer - -} ZERO_POWER_ODD_INFO, *PZERO_POWER_ODD_INFO; - -typedef enum { - SimpleMediaLock, - SecureMediaLock, - InternalMediaLock -} MEDIA_LOCK_TYPE, *PMEDIA_LOCK_TYPE; - - -typedef enum _CDROM_DETECTION_STATE { - CdromDetectionUnknown = 0, - CdromDetectionUnsupported = 1, - CdromDetectionSupported = 2 -} CDROM_DETECTION_STATE, *PCDROM_DETECTION_STATE; - - -typedef struct _CDROM_ERROR_LOG_DATA { - LARGE_INTEGER TickCount; // Offset 0x00 - ULONG PortNumber; // Offset 0x08 - - UCHAR ErrorPaging : 1; // Offset 0x0c - UCHAR ErrorRetried : 1; - UCHAR ErrorUnhandled : 1; - UCHAR ErrorReserved : 5; - - UCHAR Reserved[3]; - - SCSI_REQUEST_BLOCK Srb; // Offset 0x10 - - // We define the SenseData as the default length. - // Since the sense data returned by the port driver may be longer, - // SenseData must be at the end of this structure. - // For our internal error log, we only log the default length. - SENSE_DATA SenseData; // Offset 0x50 for x86 (or 0x68 for ia64) (ULONG32 Alignment required!) -} CDROM_ERROR_LOG_DATA, *PCDROM_ERROR_LOG_DATA; - - -#define NUM_ERROR_LOG_ENTRIES 16 - -// -// add to the front of this structure to help prevent illegal -// snooping by other utilities. -// -typedef struct _CDROM_PRIVATE_FDO_DATA { - - // this private structure allows us to - // dynamically re-enable the perf benefits - // lost due to transient error conditions. - // in w2k, a reboot was required. :( - struct { - ULONG OriginalSrbFlags; - ULONG SuccessfulIO; - ULONG ReEnableThreshhold; // 0 means never - } Perf; - - ULONG_PTR HackFlags; - - STORAGE_HOTPLUG_INFO HotplugInfo; - - BOOLEAN TimerStarted; - BOOLEAN LoggedTURFailureSinceLastIO; - BOOLEAN LoggedSYNCFailure; - - // not use WDFSPINLOCK to avoid exposing private object creation - // in initialization code. (cdrom.sys was in WDK example) - KSPIN_LOCK SpinLock; - - // Circular array of timestamped logs of errors that occurred on this device. - ULONG ErrorLogNextIndex; - CDROM_ERROR_LOG_DATA ErrorLogs[NUM_ERROR_LOG_ENTRIES]; - -}CDROM_PRIVATE_FDO_DATA, *PCDROM_PRIVATE_FDO_DATA; - -// -// this is a private structure, but must be kept here -// to properly compile size of FUNCTIONAL_DEVICE_EXTENSION -// -typedef struct _FILE_OBJECT_CONTEXT { - WDFFILEOBJECT FileObject; - WDFDEVICE DeviceObject; - ULONG LockCount; - ULONG McnDisableCount; - BOOLEAN EnforceStreamingRead; - BOOLEAN EnforceStreamingWrite; -} FILE_OBJECT_CONTEXT, *PFILE_OBJECT_CONTEXT; - -WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(FILE_OBJECT_CONTEXT, FileObjectGetContext) - - -#define NOT_READY_RETRY_INTERVAL 10 -#define MODE_PAGE_DATA_SIZE 192 - -// -// per session device -// -#define INVALID_SESSION ((ULONG)-1) - -#endif // __CDROMP_H__ diff --git a/storage/class/cdrom/src/common.c b/storage/class/cdrom/src/common.c deleted file mode 100644 index 13312ac6..00000000 --- a/storage/class/cdrom/src/common.c +++ /dev/null @@ -1,3872 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - common.c - -Abstract: - - shared private routines for cdrom.sys - -Environment: - - kernel mode only - -Notes: - - -Revision History: - ---*/ - - -#include "ntddk.h" -#include "ntddstor.h" -#include "ntstrsafe.h" - -#include "cdrom.h" -#include "scratch.h" - - -#ifdef DEBUG_USE_WPP -#include "common.tmh" -#endif - -#ifdef ALLOC_PRAGMA - -#pragma alloc_text(PAGE, DeviceGetParameter) -#pragma alloc_text(PAGE, DeviceSetParameter) -#pragma alloc_text(PAGE, DeviceSendSrbSynchronously) -#pragma alloc_text(PAGE, DevicePickDvdRegion) -#pragma alloc_text(PAGE, StringsAreMatched) -#pragma alloc_text(PAGE, PerformEjectionControl) -#pragma alloc_text(PAGE, DeviceFindFeaturePage) -#pragma alloc_text(PAGE, DevicePrintAllFeaturePages) -#pragma alloc_text(PAGE, DeviceRegisterInterface) -#pragma alloc_text(PAGE, DeviceRestoreDefaultSpeed) -#pragma alloc_text(PAGE, DeviceSendRequestSynchronously) -#pragma alloc_text(PAGE, MediaReadCapacity) -#pragma alloc_text(PAGE, MediaReadCapacityDataInterpret) -#pragma alloc_text(PAGE, DeviceRetrieveModeSenseUsingScratch) -#pragma alloc_text(PAGE, ModeSenseFindSpecificPage) -#pragma alloc_text(PAGE, DeviceUnlockExclusive) - -#endif - -LPCSTR LockTypeStrings[] = {"Simple", - "Secure", - "Internal" - }; - -VOID -RequestSetReceivedTime( - _In_ WDFREQUEST Request - ) -{ - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request); - LARGE_INTEGER temp; - - KeQueryTickCount(&temp); - - requestContext->TimeReceived = temp; - - return; -} - -VOID -RequestSetSentTime( - _In_ WDFREQUEST Request - ) -{ - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request); - LARGE_INTEGER temp; - - KeQueryTickCount(&temp); - - if (requestContext->TimeSentDownFirstTime.QuadPart == 0) - { - requestContext->TimeSentDownFirstTime = temp; - } - - requestContext->TimeSentDownLasttTime = temp; - - if (requestContext->OriginalRequest != NULL) - { - PCDROM_REQUEST_CONTEXT originalRequestContext = RequestGetContext(requestContext->OriginalRequest); - - if (originalRequestContext->TimeSentDownFirstTime.QuadPart == 0) - { - originalRequestContext->TimeSentDownFirstTime = temp; - } - - originalRequestContext->TimeSentDownLasttTime = temp; - } - - return; -} - -VOID -RequestClearSendTime( - _In_ WDFREQUEST Request - ) -/* -Routine Description: - - This function is used to clean SentTime fields in reusable request context. - -Arguments: - Request - - -Return Value: - N/A - -*/ -{ - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request); - - requestContext->TimeSentDownFirstTime.QuadPart = 0; - requestContext->TimeSentDownLasttTime.QuadPart = 0; - - return; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -VOID -DeviceGetParameter( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ PWSTR SubkeyName, - _In_ PWSTR ParameterName, - _Inout_ PULONG ParameterValue // also default value - ) -/*++ -Routine Description: - - retrieve device parameter from registry. - -Arguments: - - DeviceExtension - device context. - - SubkeyName - name of subkey - - ParameterName - the registry parameter to be retrieved - -Return Value: - - ParameterValue - registry value retrieved - ---*/ -{ - NTSTATUS status; - WDFKEY rootKey = NULL; - WDFKEY subKey = NULL; - UNICODE_STRING registrySubKeyName; - UNICODE_STRING registryValueName; - ULONG defaultParameterValue; - - PAGED_CODE(); - - RtlInitUnicodeString(®istryValueName, ParameterName); - - if (SubkeyName != NULL) - { - RtlInitUnicodeString(®istrySubKeyName, SubkeyName); - } - - // open the hardware key - status = WdfDeviceOpenRegistryKey(DeviceExtension->Device, - PLUGPLAY_REGKEY_DEVICE, - KEY_READ, - WDF_NO_OBJECT_ATTRIBUTES, - &rootKey); - - // open the sub key - if (NT_SUCCESS(status) && (SubkeyName != NULL)) - { - status = WdfRegistryOpenKey(rootKey, - ®istrySubKeyName, - KEY_READ, - WDF_NO_OBJECT_ATTRIBUTES, - &subKey); - - if (!NT_SUCCESS(status)) - { - WdfRegistryClose(rootKey); - rootKey = NULL; - } - } - - if (NT_SUCCESS(status) && (rootKey != NULL)) - { - defaultParameterValue = *ParameterValue; - - status = WdfRegistryQueryULong((subKey != NULL) ? subKey : rootKey, - ®istryValueName, - ParameterValue); - - if (!NT_SUCCESS(status)) - { - *ParameterValue = defaultParameterValue; // use default value - } - } - - // close what we open - if (subKey != NULL) - { - WdfRegistryClose(subKey); - subKey = NULL; - } - - if (rootKey != NULL) - { - WdfRegistryClose(rootKey); - rootKey = NULL; - } - - // Windows 2000 SP3 uses the driver-specific key, so look in there - if (!NT_SUCCESS(status)) - { - // open the software key - status = WdfDeviceOpenRegistryKey(DeviceExtension->Device, - PLUGPLAY_REGKEY_DRIVER, - KEY_READ, - WDF_NO_OBJECT_ATTRIBUTES, - &rootKey); - - // open the sub key - if (NT_SUCCESS(status) && (SubkeyName != NULL)) - { - status = WdfRegistryOpenKey(rootKey, - ®istrySubKeyName, - KEY_READ, - WDF_NO_OBJECT_ATTRIBUTES, - &subKey); - - if (!NT_SUCCESS(status)) - { - WdfRegistryClose(rootKey); - rootKey = NULL; - } - } - - if (NT_SUCCESS(status) && (rootKey != NULL)) - { - defaultParameterValue = *ParameterValue; - - status = WdfRegistryQueryULong((subKey != NULL) ? subKey : rootKey, - ®istryValueName, - ParameterValue); - - if (!NT_SUCCESS(status)) - { - *ParameterValue = defaultParameterValue; // use default value - } - else - { - // Migrate the value over to the device-specific key - DeviceSetParameter(DeviceExtension, SubkeyName, ParameterName, *ParameterValue); - } - } - - // close what we open - if (subKey != NULL) - { - WdfRegistryClose(subKey); - subKey = NULL; - } - - if (rootKey != NULL) - { - WdfRegistryClose(rootKey); - rootKey = NULL; - } - } - - return; - -} // end DeviceetParameter() - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceSetParameter( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_z_ PWSTR SubkeyName, - _In_ PWSTR ParameterName, - _In_ ULONG ParameterValue - ) -/*++ -Routine Description: - - set parameter to registry. - -Arguments: - - DeviceExtension - device context. - - SubkeyName - name of subkey - - ParameterName - the registry parameter to be retrieved - - ParameterValue - registry value to be set - -Return Value: - NTSTATUS - ---*/ -{ - NTSTATUS status; - WDFKEY rootKey = NULL; - WDFKEY subKey = NULL; - UNICODE_STRING registrySubKeyName; - UNICODE_STRING registryValueName; - - PAGED_CODE(); - - RtlInitUnicodeString(®istryValueName, ParameterName); - - if (SubkeyName != NULL) - { - RtlInitUnicodeString(®istrySubKeyName, SubkeyName); - } - - // open the hardware key - status = WdfDeviceOpenRegistryKey(DeviceExtension->Device, - PLUGPLAY_REGKEY_DEVICE, - KEY_READ | KEY_WRITE, - WDF_NO_OBJECT_ATTRIBUTES, - &rootKey); - - // open the sub key - if (NT_SUCCESS(status) && (SubkeyName != NULL)) - { - status = WdfRegistryOpenKey(rootKey, - ®istrySubKeyName, - KEY_READ | KEY_WRITE, - WDF_NO_OBJECT_ATTRIBUTES, - &subKey); - - if (!NT_SUCCESS(status)) - { - WdfRegistryClose(rootKey); - rootKey = NULL; - } - } - - if (NT_SUCCESS(status) && (rootKey != NULL)) - { - status = WdfRegistryAssignULong((subKey != NULL) ? subKey : rootKey, - ®istryValueName, - ParameterValue); - } - - // close what we open - if (subKey != NULL) - { - WdfRegistryClose(subKey); - subKey = NULL; - } - - if (rootKey != NULL) - { - WdfRegistryClose(rootKey); - rootKey = NULL; - } - - return status; - -} // end DeviceSetParameter() - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceSendRequestSynchronously( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request, - _In_ BOOLEAN RequestFormated - ) -/*++ -Routine Description: - - send a request to lower driver synchronously. - -Arguments: - - Device - device object. - - Request - request object - - RequestFormated - if the request is already formatted, will no do it in this function - -Return Value: - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - BOOLEAN requestCancelled = FALSE; - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request); - - PAGED_CODE(); - - if (!RequestFormated) - { - // set request up for sending down - WdfRequestFormatRequestUsingCurrentType(Request); - } - - // get cancellation status for the original request - if (requestContext->OriginalRequest != NULL) - { - requestCancelled = WdfRequestIsCanceled(requestContext->OriginalRequest); - } - - if (!requestCancelled) - { - status = RequestSend(deviceExtension, - Request, - deviceExtension->IoTarget, - WDF_REQUEST_SEND_OPTION_SYNCHRONOUS, - NULL); - } - else - { - status = STATUS_CANCELLED; - } - - return status; -} - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceSendSrbSynchronously( - _In_ WDFDEVICE Device, - _In_ PSCSI_REQUEST_BLOCK Srb, - _In_opt_ PVOID BufferAddress, - _In_ ULONG BufferLength, - _In_ BOOLEAN WriteToDevice, - _In_opt_ WDFREQUEST OriginalRequest - ) -/*++ -Routine Description: - - Send a SRB structure to lower driver synchronously. - - Process of this function: - 1. Allocate SenseBuffer; Create Request; Allocate MDL - 2. Do following loop if necessary - 2.1 Reuse Request - 2.2 Format Srb, Irp - 2.3 Send Request - 2.4 Error Intepret and retry decision making. - 3. Release all allocated resosurces. - -Arguments: - - Device - device object. - - Request - request object - - RequestFormated - if the request is already formatted, will no do it in this function - -Return Value: - NTSTATUS - -NOTE: -The caller needs to setup following fields before calling this routine. - srb.CdbLength - srb.TimeOutValue - cdb - -BufferLength and WriteToDevice to control the data direction of the device - BufferLength = 0: No data transfer - BufferLenth != 0 && !WriteToDevice: get data from device - BufferLenth != 0 && WriteToDevice: send data to device ---*/ -{ - NTSTATUS status; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PCDROM_PRIVATE_FDO_DATA fdoData = deviceExtension->PrivateFdoData; - PUCHAR senseInfoBuffer = NULL; - ULONG retryCount = 0; - BOOLEAN retry = FALSE; - ULONG ioctlCode = 0; - WDFREQUEST request = NULL; - PIRP irp = NULL; - PIO_STACK_LOCATION nextStack = NULL; - PMDL mdlAddress = NULL; - BOOLEAN memoryLocked = FALSE; - WDF_OBJECT_ATTRIBUTES attributes; - PZERO_POWER_ODD_INFO zpoddInfo = deviceExtension->ZeroPowerODDInfo; - - PAGED_CODE(); - - // NOTE: This code is only pagable because we are not freezing - // the queue. Allowing the queue to be frozen from a pagable - // routine could leave the queue frozen as we try to page in - // the code to unfreeze the queue. The result would be a nice - // case of deadlock. Therefore, since we are unfreezing the - // queue regardless of the result, just set the NO_FREEZE_QUEUE - // flag in the SRB. - NT_ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL); - - //1. allocate SenseBuffer and initiate Srb common fields - // these fields will not be changed by lower driver. - { - // Write length to SRB. - Srb->Length = sizeof(SCSI_REQUEST_BLOCK); - Srb->Function = SRB_FUNCTION_EXECUTE_SCSI; - Srb->SenseInfoBufferLength = SENSE_BUFFER_SIZE; - - // Sense buffer is in aligned nonpaged pool. - senseInfoBuffer = ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED, - SENSE_BUFFER_SIZE, - CDROM_TAG_SENSE_INFO); - - if (senseInfoBuffer == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "DeviceSendSrbSynchronously: Can't allocate MDL\n")); - - goto Exit; - } - - Srb->SenseInfoBuffer = senseInfoBuffer; - Srb->DataBuffer = BufferAddress; - - // set timeout value to default value if it's not specifically set by caller. - if (Srb->TimeOutValue == 0) - { - Srb->TimeOutValue = deviceExtension->TimeOutValue; - } - } - - //2. Create Request object - { - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, - CDROM_REQUEST_CONTEXT); - - status = WdfRequestCreate(&attributes, - deviceExtension->IoTarget, - &request); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "DeviceSendSrbSynchronously: Can't create request: %lx\n", - status)); - - goto Exit; - } - - irp = WdfRequestWdmGetIrp(request); - } - - // 3. Build an MDL for the data buffer and stick it into the irp. - if (BufferAddress != NULL) - { - mdlAddress = IoAllocateMdl( BufferAddress, - BufferLength, - FALSE, - FALSE, - irp ); - if (mdlAddress == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "DeviceSendSrbSynchronously: Can't allocate MDL\n")); - - goto Exit; - } - - try - { - MmProbeAndLockPages(mdlAddress, - KernelMode, - (WriteToDevice ? IoReadAccess : IoWriteAccess)); - } - except(EXCEPTION_EXECUTE_HANDLER) - { - status = GetExceptionCode(); - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "DeviceSendSrbSynchronously: Exception %lx locking buffer\n", status)); - - goto Exit; - } - - memoryLocked = TRUE; - } - - // 4. Format Srb, Irp; Send request and retry when necessary - do - { - // clear the control variable. - retry = FALSE; - - // 4.1 reuse the request object; set originalRequest field. - { - WDF_REQUEST_REUSE_PARAMS params; - PCDROM_REQUEST_CONTEXT requestContext = NULL; - - // deassign the MdlAddress, this is the value we assign explicitly. - // doing this can prevent WdfRequestReuse to release the Mdl unexpectly. - if (irp->MdlAddress) - { - irp->MdlAddress = NULL; - } - - WDF_REQUEST_REUSE_PARAMS_INIT(¶ms, - WDF_REQUEST_REUSE_NO_FLAGS, - STATUS_SUCCESS); - - status = WdfRequestReuse(request, ¶ms); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "DeviceSendSrbSynchronously: WdfRequestReuse failed, %!STATUS!\n", - status)); - // exit the loop. - break; - } - - // WDF requests to format the request befor sending it - status = WdfIoTargetFormatRequestForInternalIoctlOthers(deviceExtension->IoTarget, - request, - ioctlCode, - NULL, NULL, - NULL, NULL, - NULL, NULL); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "DeviceSendSrbSynchronously: WdfIoTargetFormatRequestForInternalIoctlOthers failed, %!STATUS!\n", - status)); - // exit the loop. - break; - } - - requestContext = RequestGetContext(request); - requestContext->OriginalRequest = OriginalRequest; - } - - // 4.2 Format Srb and Irp - { - Srb->OriginalRequest = irp; - Srb->QueueAction = SRB_SIMPLE_TAG_REQUEST; - Srb->DataTransferLength = BufferLength; - Srb->SrbFlags = deviceExtension->SrbFlags; - - // Disable synchronous transfer for these requests. - SET_FLAG(Srb->SrbFlags, SRB_FLAGS_DISABLE_SYNCH_TRANSFER); - SET_FLAG(Srb->SrbFlags, SRB_FLAGS_NO_QUEUE_FREEZE); - - if (BufferAddress != NULL) - { - if (WriteToDevice) - { - SET_FLAG(Srb->SrbFlags, SRB_FLAGS_DATA_OUT); - ioctlCode = IOCTL_SCSI_EXECUTE_OUT; - } - else - { - SET_FLAG(Srb->SrbFlags, SRB_FLAGS_DATA_IN); - ioctlCode = IOCTL_SCSI_EXECUTE_IN; - } - } - else - { - ioctlCode = IOCTL_SCSI_EXECUTE_NONE; - } - - - // Zero out status. - Srb->ScsiStatus = 0; - Srb->SrbStatus = 0; - Srb->NextSrb = NULL; - - // irp related fields - irp->MdlAddress = mdlAddress; - - nextStack = IoGetNextIrpStackLocation(irp); - - nextStack->MajorFunction = IRP_MJ_SCSI; - nextStack->Parameters.DeviceIoControl.IoControlCode = ioctlCode; - nextStack->Parameters.Scsi.Srb = Srb; - } - - // 4.3 send Request to lower driver. - status = DeviceSendRequestSynchronously(Device, request, TRUE); - - if (status != STATUS_CANCELLED) - { - NT_ASSERT(SRB_STATUS(Srb->SrbStatus) != SRB_STATUS_PENDING); - NT_ASSERT(status != STATUS_PENDING); - NT_ASSERT(!(Srb->SrbStatus & SRB_STATUS_QUEUE_FROZEN)); - - // 4.4 error process. - if (SRB_STATUS(Srb->SrbStatus) != SRB_STATUS_SUCCESS) - { - LONGLONG retryIntervalIn100ns = 0; - - // Update status and determine if request should be retried. - retry = RequestSenseInfoInterpret(deviceExtension, - request, - Srb, - retryCount, - &status, - &retryIntervalIn100ns); - - if (retry) - { - LARGE_INTEGER t; - t.QuadPart = -retryIntervalIn100ns; - retryCount++; - KeDelayExecutionThread(KernelMode, FALSE, &t); - } - } - else - { - // Request succeeded. - fdoData->LoggedTURFailureSinceLastIO = FALSE; - status = STATUS_SUCCESS; - retry = FALSE; - } - } - } while(retry); - - if ((zpoddInfo != NULL) && - (zpoddInfo->MonitorStartStopUnit != FALSE) && - (SRB_STATUS(Srb->SrbStatus) == SRB_STATUS_SUCCESS)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "DeviceSendSrbSynchronously: soft eject detected, device marked as active\n")); - - DeviceMarkActive(deviceExtension, TRUE, FALSE); - } - - // 5. Release all allocated resources. - - // required even though we allocated our own, since the port driver may - // have allocated one also - if (PORT_ALLOCATED_SENSE(deviceExtension, Srb)) - { - FREE_PORT_ALLOCATED_SENSE_BUFFER(deviceExtension, Srb); - } - -Exit: - - if (senseInfoBuffer != NULL) - { - FREE_POOL(senseInfoBuffer); - } - - Srb->SenseInfoBuffer = NULL; - Srb->SenseInfoBufferLength = 0; - - if (mdlAddress) - { - if (memoryLocked) - { - MmUnlockPages(mdlAddress); - memoryLocked = FALSE; - } - - IoFreeMdl(mdlAddress); - irp->MdlAddress = NULL; - } - - if (request) - { - WdfObjectDelete(request); - } - - return status; -} - - -VOID -DeviceSendNotification( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ const GUID* Guid, - _In_ ULONG ExtraDataSize, - _In_opt_ PVOID ExtraData - ) -/*++ -Routine Description: - - send notification to other components - -Arguments: - - DeviceExtension - device context. - - Guid - GUID for the notification - - ExtraDataSize - data size along with notification - - ExtraData - data buffer send with notification - -Return Value: - None - ---*/ -{ - PTARGET_DEVICE_CUSTOM_NOTIFICATION notification; - ULONG requiredSize; - NTSTATUS status; - - status = RtlULongAdd((sizeof(TARGET_DEVICE_CUSTOM_NOTIFICATION) - sizeof(UCHAR)), - ExtraDataSize, - &requiredSize); - - if (!(NT_SUCCESS(status)) || (requiredSize > 0x0000ffff)) - { - // MAX_USHORT, max total size for these events! - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_MCN, - "Error sending event: size too large! (%x)\n", - requiredSize)); - return; - } - - notification = ExAllocatePool2(POOL_FLAG_NON_PAGED, - requiredSize, - CDROM_TAG_NOTIFICATION); - - // if none allocated, exit - if (notification == NULL) - { - return; - } - - // Prepare and send the request! - RtlZeroMemory(notification, requiredSize); - notification->Version = 1; - notification->Size = (USHORT)(requiredSize); - notification->FileObject = NULL; - notification->NameBufferOffset = -1; - notification->Event = *Guid; - - if (ExtraData != NULL) - { - RtlCopyMemory(notification->CustomDataBuffer, ExtraData, ExtraDataSize); - } - - IoReportTargetDeviceChangeAsynchronous(DeviceExtension->LowerPdo, - notification, - NULL, - NULL); - - FREE_POOL(notification); - - return; -} - - -VOID -DeviceSendStartUnit( - _In_ WDFDEVICE Device - ) -/*++ - -Routine Description: - - Send command to SCSI unit to start or power up. - Because this command is issued asynchronounsly, that is, without - waiting on it to complete, the IMMEDIATE flag is not set. This - means that the CDB will not return until the drive has powered up. - This should keep subsequent requests from being submitted to the - device before it has completely spun up. - - This routine is called from the InterpretSense routine, when a - request sense returns data indicating that a drive must be - powered up. - - This routine may also be called from a class driver's error handler, - or anytime a non-critical start device should be sent to the device. - -Arguments: - - Device - The device object. - -Return Value: - - None. - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = NULL; - WDF_OBJECT_ATTRIBUTES attributes; - WDFREQUEST startUnitRequest = NULL; - WDFMEMORY inputMemory = NULL; - - PCOMPLETION_CONTEXT context = NULL; - PSCSI_REQUEST_BLOCK srb = NULL; - PCDB cdb = NULL; - - deviceExtension = DeviceGetExtension(Device); - - if (NT_SUCCESS(status)) - { - // Allocate Srb from nonpaged pool. - context = ExAllocatePool2(POOL_FLAG_NON_PAGED, - sizeof(COMPLETION_CONTEXT), - CDROM_TAG_COMPLETION_CONTEXT); - - if (context == NULL) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "DeviceSendStartUnit: Failed to allocate completion context\n")); - - status = STATUS_INTERNAL_ERROR; - } - } - - if (NT_SUCCESS(status)) - { - // Save the device object in the context for use by the completion - // routine. - context->Device = Device; - srb = &context->Srb; - - // Zero out srb. - RtlZeroMemory(srb, sizeof(SCSI_REQUEST_BLOCK)); - - // setup SRB structure. - srb->Length = sizeof(SCSI_REQUEST_BLOCK); - srb->Function = SRB_FUNCTION_EXECUTE_SCSI; - srb->TimeOutValue = START_UNIT_TIMEOUT; - - srb->SrbFlags = SRB_FLAGS_NO_DATA_TRANSFER | - SRB_FLAGS_DISABLE_SYNCH_TRANSFER; - - // setup CDB - srb->CdbLength = 6; - cdb = (PCDB)srb->Cdb; - - cdb->START_STOP.OperationCode = SCSIOP_START_STOP_UNIT; - cdb->START_STOP.Start = 1; - cdb->START_STOP.Immediate = 0; - cdb->START_STOP.LogicalUnitNumber = srb->Lun; - - //Create Request for sending down to port driver - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, - CDROM_REQUEST_CONTEXT); - attributes.ParentObject = deviceExtension->IoTarget; - - status = WdfRequestCreate(&attributes, - deviceExtension->IoTarget, - &startUnitRequest); - } - - if (NT_SUCCESS(status)) - { - srb->OriginalRequest = WdfRequestWdmGetIrp(startUnitRequest); - NT_ASSERT(srb->OriginalRequest != NULL); - - //Prepare the request - WDF_OBJECT_ATTRIBUTES_INIT(&attributes); - attributes.ParentObject = startUnitRequest; - - status = WdfMemoryCreatePreallocated(&attributes, - (PVOID)srb, - sizeof(SCSI_REQUEST_BLOCK), - &inputMemory); - } - - if (NT_SUCCESS(status)) - { - status = WdfIoTargetFormatRequestForInternalIoctlOthers(deviceExtension->IoTarget, - startUnitRequest, - IOCTL_SCSI_EXECUTE_NONE, - inputMemory, - NULL, - NULL, - NULL, - NULL, - NULL); - } - - if (NT_SUCCESS(status)) - { - // Set a CompletionRoutine callback function. - WdfRequestSetCompletionRoutine(startUnitRequest, - DeviceAsynchronousCompletion, - context); - - status = RequestSend(deviceExtension, - startUnitRequest, - deviceExtension->IoTarget, - 0, - NULL); - } - - // release resources when failed. - if (!NT_SUCCESS(status)) - { - FREE_POOL(context); - if (startUnitRequest != NULL) - { - WdfObjectDelete(startUnitRequest); - } - } - - return; -} // end StartUnit() - - -VOID -DeviceSendIoctlAsynchronously( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ ULONG IoControlCode, - _In_ PDEVICE_OBJECT TargetDeviceObject - ) -/*++ - -Routine Description: - - Send an IOCTL asynchronously - -Arguments: - - DeviceExtension - device context. - IoControlCode - IOCTL code. - TargetDeviceObject - target device object. - -Return Value: - - None. - ---*/ -{ - PIRP irp = NULL; - PIO_STACK_LOCATION nextIrpStack = NULL; - - irp = IoAllocateIrp(DeviceExtension->DeviceObject->StackSize, FALSE); - - if (irp != NULL) - { - nextIrpStack = IoGetNextIrpStackLocation(irp); - - nextIrpStack->MajorFunction = IRP_MJ_DEVICE_CONTROL; - - nextIrpStack->Parameters.DeviceIoControl.OutputBufferLength = 0; - nextIrpStack->Parameters.DeviceIoControl.InputBufferLength = 0; - nextIrpStack->Parameters.DeviceIoControl.IoControlCode = IoControlCode; - nextIrpStack->Parameters.DeviceIoControl.Type3InputBuffer = NULL; - - IoSetCompletionRoutine(irp, - RequestAsynchronousIrpCompletion, - DeviceExtension, - TRUE, - TRUE, - TRUE); - - (VOID) IoCallDriver(TargetDeviceObject, irp); - } -} - -NTSTATUS -RequestAsynchronousIrpCompletion( - _In_ PDEVICE_OBJECT DeviceObject, - _In_ PIRP Irp, - _In_reads_opt_(_Inexpressible_("varies")) PVOID Context - ) -/*++ - -Routine Description: - - Free the Irp. - -Arguments: - - DeviceObject - device that the completion routine fires on. - - Irp - The irp to be completed. - - Context - IRP context - -Return Value: - NTSTATUS - ---*/ -{ - UNREFERENCED_PARAMETER(DeviceObject); - UNREFERENCED_PARAMETER(Context); - - IoFreeIrp(Irp); - - return STATUS_MORE_PROCESSING_REQUIRED; -} - -VOID -DeviceAsynchronousCompletion( - _In_ WDFREQUEST Request, - _In_ WDFIOTARGET Target, - _In_ PWDF_REQUEST_COMPLETION_PARAMS Params, - _In_ WDFCONTEXT Context - ) -/*++ - -Routine Description: - - This routine is called when an asynchronous I/O request - which was issused by the class driver completes. Examples of such requests - are release queue or START UNIT. This routine releases the queue if - necessary. It then frees the context and the IRP. - -Arguments: - - DeviceObject - The device object for the logical unit; however since this - is the top stack location the value is NULL. - - Irp - Supplies a pointer to the Irp to be processed. - - Context - Supplies the context to be used to process this request. - -Return Value: - - None. - ---*/ -{ - PCOMPLETION_CONTEXT context = (PCOMPLETION_CONTEXT)Context; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(context->Device); - - UNREFERENCED_PARAMETER(Target); - UNREFERENCED_PARAMETER(Params); - - // If this is an execute srb, then check the return status and make sure. - // the queue is not frozen. - if (context->Srb.Function == SRB_FUNCTION_EXECUTE_SCSI) - { - // Check for a frozen queue. - if (context->Srb.SrbStatus & SRB_STATUS_QUEUE_FROZEN) - { - // Unfreeze the queue getting the device object from the context. - DeviceReleaseQueue(context->Device); - } - } - - // free port-allocated sense buffer if we can detect - // - if (PORT_ALLOCATED_SENSE(deviceExtension, &context->Srb)) - { - FREE_PORT_ALLOCATED_SENSE_BUFFER(deviceExtension, &context->Srb); - } - - FREE_POOL(context); - - WdfObjectDelete(Request); - -} // end DeviceAsynchronousCompletion() - - -VOID -DeviceReleaseQueue( - _In_ WDFDEVICE Device - ) -/*++ - -Routine Description: - - This routine issues an internal device control command - to the port driver to release a frozen queue. The call - is issued asynchronously as DeviceReleaseQueue will be invoked - from the IO completion DPC (and will have no context to - wait for a synchronous call to complete). - - This routine must be called with the remove lock held. - -Arguments: - - Device - The functional device object for the device with the frozen queue. - -Return Value: - - None. - ---*/ -{ - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PSCSI_REQUEST_BLOCK srb = NULL; - KIRQL currentIrql; - - // we raise irql seperately so we're not swapped out or suspended - // while holding the release queue irp in this routine. this lets - // us release the spin lock before lowering irql. - KeRaiseIrql(DISPATCH_LEVEL, ¤tIrql); - - WdfSpinLockAcquire(deviceExtension->ReleaseQueueSpinLock); - - if (deviceExtension->ReleaseQueueInProgress) - { - // Someone is already doing this work - just set the flag to indicate that - // we need to release the queue again. - deviceExtension->ReleaseQueueNeeded = TRUE; - WdfSpinLockRelease(deviceExtension->ReleaseQueueSpinLock); - KeLowerIrql(currentIrql); - - return; - } - - // Mark that there is a release queue in progress and drop the spinlock. - deviceExtension->ReleaseQueueInProgress = TRUE; - - WdfSpinLockRelease(deviceExtension->ReleaseQueueSpinLock); - - srb = &(deviceExtension->ReleaseQueueSrb); - - // Optical media are removable, so we just flush the queue. This will also release it. - srb->Function = SRB_FUNCTION_FLUSH_QUEUE; - - srb->OriginalRequest = WdfRequestWdmGetIrp(deviceExtension->ReleaseQueueRequest); - - // Set a CompletionRoutine callback function. - WdfRequestSetCompletionRoutine(deviceExtension->ReleaseQueueRequest, - DeviceReleaseQueueCompletion, - Device); - // Send the request. If an error occurs, complete the request. - RequestSend(deviceExtension, - deviceExtension->ReleaseQueueRequest, - deviceExtension->IoTarget, - WDF_REQUEST_SEND_OPTION_IGNORE_TARGET_STATE, - NULL); - - KeLowerIrql(currentIrql); - - return; - -} // end DeviceReleaseQueue() - -VOID -DeviceReleaseQueueCompletion( - _In_ WDFREQUEST Request, - _In_ WDFIOTARGET Target, - _In_ PWDF_REQUEST_COMPLETION_PARAMS Params, - _In_ WDFCONTEXT Context - ) -/*++ - -Routine Description: - - This routine is called when an asynchronous release queue request which - was issused in DeviceReleaseQueue completes. This routine prepares for - the next release queue request and resends it if necessary. - -Arguments: - - Request - The completed request. - - Target - IoTarget object - - Params - Completion parameters - - Context - WDFDEVICE object handle. - -Return Value: - - None. - ---*/ -{ - NTSTATUS status; - WDFDEVICE device = Context; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(device); - - BOOLEAN releaseQueueNeeded = FALSE; - WDF_REQUEST_REUSE_PARAMS params = {0}; - - UNREFERENCED_PARAMETER(Target); - UNREFERENCED_PARAMETER(Params); - - WDF_REQUEST_REUSE_PARAMS_INIT(¶ms, - WDF_REQUEST_REUSE_NO_FLAGS, - STATUS_SUCCESS); - - // Grab the spinlock and clear the release queue in progress flag so others - // can run. Save (and clear) the state of the release queue needed flag - // so that we can issue a new release queue outside the spinlock. - WdfSpinLockAcquire(deviceExtension->ReleaseQueueSpinLock); - - releaseQueueNeeded = deviceExtension->ReleaseQueueNeeded; - - deviceExtension->ReleaseQueueNeeded = FALSE; - deviceExtension->ReleaseQueueInProgress = FALSE; - - // Reuse the ReleaseQueueRequest for the next time. - status = WdfRequestReuse(Request,¶ms); - - if (NT_SUCCESS(status)) - { - // Preformat the ReleaseQueueRequest for the next time. - // This should always succeed because it was already preformatted once during device initialization - status = WdfIoTargetFormatRequestForInternalIoctlOthers(deviceExtension->IoTarget, - Request, - IOCTL_SCSI_EXECUTE_NONE, - deviceExtension->ReleaseQueueInputMemory, - NULL, - NULL, - NULL, - NULL, - NULL); - } - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "DeviceReleaseQueueCompletion: WdfIoTargetFormatRequestForInternalIoctlOthers failed, %!STATUS!\n", - status)); - } - - RequestClearSendTime(Request); - - WdfSpinLockRelease(deviceExtension->ReleaseQueueSpinLock); - - // If we need a release queue then issue one now. Another processor may - // have already started one in which case we'll try to issue this one after - // it is done - but we should never recurse more than one deep. - if (releaseQueueNeeded) - { - DeviceReleaseQueue(device); - } - - return; - -} // DeviceReleaseQueueCompletion() - - -// -// In order to provide better performance without the need to reboot, -// we need to implement a self-adjusting method to set and clear the -// srb flags based upon current performance. -// -// whenever there is an error, immediately grab the spin lock. the -// MP perf hit here is acceptable, since we're in an error path. this -// is also neccessary because we are guaranteed to be modifying the -// SRB flags here, setting SuccessfulIO to zero, and incrementing the -// actual error count (which is always done within this spinlock). -// -// whenever there is no error, increment a counter. if there have been -// errors on the device, and we've enabled dynamic perf, *and* we've -// just crossed the perf threshhold, then grab the spin lock and -// double check that the threshhold has, indeed been hit(*). then -// decrement the error count, and if it's dropped sufficiently, undo -// some of the safety changes made in the SRB flags due to the errors. -// -// * this works in all cases. even if lots of ios occur after the -// previous guy went in and cleared the successfulio counter, that -// just means that we've hit the threshhold again, and so it's proper -// to run the inner loop again. -// - -VOID -DevicePerfIncrementErrorCount( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -{ - PCDROM_PRIVATE_FDO_DATA fdoData = DeviceExtension->PrivateFdoData; - KIRQL oldIrql; - ULONG errors; - - KeAcquireSpinLock(&fdoData->SpinLock, &oldIrql); - - fdoData->Perf.SuccessfulIO = 0; // implicit interlock - errors = InterlockedIncrement((PLONG)&DeviceExtension->ErrorCount); - - if (errors >= CLASS_ERROR_LEVEL_1) - { - // If the error count has exceeded the error limit, then disable - // any tagged queuing, multiple requests per lu queueing - // and sychronous data transfers. - // - // Clearing the no queue freeze flag prevents the port driver - // from sending multiple requests per logical unit. - CLEAR_FLAG(DeviceExtension->SrbFlags, SRB_FLAGS_NO_QUEUE_FREEZE); - CLEAR_FLAG(DeviceExtension->SrbFlags, SRB_FLAGS_QUEUE_ACTION_ENABLE); - - SET_FLAG(DeviceExtension->SrbFlags, SRB_FLAGS_DISABLE_SYNCH_TRANSFER); - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "PerfIncrementErrorCount: Too many errors; disabling tagged queuing and " - "synchronous data tranfers.\n")); - } - - if (errors >= CLASS_ERROR_LEVEL_2) - { - // If a second threshold is reached, disable disconnects. - SET_FLAG(DeviceExtension->SrbFlags, SRB_FLAGS_DISABLE_DISCONNECT); - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "PerfIncrementErrorCount: Too many errors; disabling disconnects.\n")); - } - - KeReleaseSpinLock(&fdoData->SpinLock, oldIrql); - return; -} - - -_IRQL_requires_max_(APC_LEVEL) -PVOID -DeviceFindFeaturePage( - _In_reads_bytes_(Length) PGET_CONFIGURATION_HEADER FeatureBuffer, - _In_ ULONG const Length, - _In_ FEATURE_NUMBER const Feature - ) -/*++ -Routine Description: - - find the specific feature page in the buffer - -Arguments: - - FeatureBuffer - buffer contains the device feature set. - - Length - buffer length - - Feature - the feature number looking for. - -Return Value: - - PVOID - pointer to the starting location of the specific feature in buffer. - ---*/ -{ - PUCHAR buffer; - PUCHAR limit; - ULONG validLength; - - PAGED_CODE(); - - if (Length < sizeof(GET_CONFIGURATION_HEADER) + sizeof(FEATURE_HEADER)) - { - return NULL; - } - - // Calculate the length of valid data available in the - // capabilities buffer from the DataLength field - REVERSE_BYTES(&validLength, FeatureBuffer->DataLength); - - validLength += RTL_SIZEOF_THROUGH_FIELD(GET_CONFIGURATION_HEADER, DataLength); - - // set limit to point to first illegal address - limit = (PUCHAR)FeatureBuffer; - limit += min(Length, validLength); - - // set buffer to point to first page - buffer = FeatureBuffer->Data; - - // loop through each page until we find the requested one, or - // until it's not safe to access the entire feature header - // (if equal, have exactly enough for the feature header) - while (buffer + sizeof(FEATURE_HEADER) <= limit) - { - PFEATURE_HEADER header = (PFEATURE_HEADER)buffer; - FEATURE_NUMBER thisFeature; - - thisFeature = (header->FeatureCode[0] << 8) | - (header->FeatureCode[1]); - - if (thisFeature == Feature) - { - PUCHAR temp; - - // if don't have enough memory to safely access all the feature - // information, return NULL - temp = buffer; - temp += sizeof(FEATURE_HEADER); - temp += header->AdditionalLength; - - if (temp > limit) - { - // this means the transfer was cut-off, an insufficiently - // small buffer was given, or other arbitrary error. since - // it's not safe to view the amount of data (even though - // the header is safe) in this feature, pretend it wasn't - // transferred at all... - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "Feature %x exists, but not safe to access all its data. returning NULL\n", - Feature)); - return NULL; - } - else - { - return buffer; - } - } - - if ((header->AdditionalLength % 4) && - !(Feature >= 0xff00 && Feature <= 0xffff)) - { - return NULL; - } - - buffer += sizeof(FEATURE_HEADER); - buffer += header->AdditionalLength; - } - - return NULL; -} - - -_IRQL_requires_max_(APC_LEVEL) -VOID -DevicePrintAllFeaturePages( - _In_reads_bytes_(Usable) PGET_CONFIGURATION_HEADER Buffer, - _In_ ULONG const Usable - ) -/*++ -Routine Description: - - print out all feature pages in the buffer - -Arguments: - - Buffer - buffer contains the device feature set. - - Usable - - -Return Value: - - none - ---*/ -{ -#if DBG - PFEATURE_HEADER header; - - PAGED_CODE(); - - //////////////////////////////////////////////////////////////////////////////// - // items expected to ALWAYS be current if they exist - //////////////////////////////////////////////////////////////////////////////// - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureProfileList); - if (header != NULL) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: CurrentProfile %x " - "with %x bytes of data at %p\n", - Buffer->CurrentProfile[0] << 8 | - Buffer->CurrentProfile[1], - Usable, Buffer)); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureCore); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "CORE Features" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureMorphing); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Morphing" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureRemovableMedium); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Removable Medium" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeaturePowerManagement); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Power Management" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureEmbeddedChanger); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Embedded Changer" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureMicrocodeUpgrade); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Microcode Update" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureTimeout); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Timeouts" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureLogicalUnitSerialNumber); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "LUN Serial Number" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureFirmwareDate); - if (header) { - - ULONG featureSize = header->AdditionalLength; - featureSize += RTL_SIZEOF_THROUGH_FIELD(FEATURE_HEADER, AdditionalLength); - - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Firmware Date" - )); - - if (featureSize >= RTL_SIZEOF_THROUGH_FIELD(FEATURE_DATA_FIRMWARE_DATE, Minute)) - { - PFEATURE_DATA_FIRMWARE_DATE date = (PFEATURE_DATA_FIRMWARE_DATE)header; - // show date as "YYYY/MM/DD hh:mm", which is 18 chars (17+NULL) - UCHAR dateString[18] = { 0 }; - dateString[ 0] = date->Year[0]; - dateString[ 1] = date->Year[1]; - dateString[ 2] = date->Year[2]; - dateString[ 3] = date->Year[3]; - dateString[ 4] = '/'; - dateString[ 5] = date->Month[0]; - dateString[ 6] = date->Month[1]; - dateString[ 7] = '/'; - dateString[ 8] = date->Day[0]; - dateString[ 9] = date->Day[1]; - dateString[10] = ' '; - dateString[11] = ' '; - dateString[12] = date->Hour[0]; - dateString[13] = date->Hour[1]; - dateString[14] = ':'; - dateString[15] = date->Minute[0]; - dateString[16] = date->Minute[1]; - dateString[17] = 0; - // SECONDS IS NOT AVAILABLE ON EARLY IMPLEMENTATIONS -- ignore it - //dateString[17] = ':'; - //dateString[18] = date->Seconds[0]; - //dateString[19] = date->Seconds[1]; - //dateString[20] = 0; - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: Firmware Date/Time %s (UTC)\n", - (PCSTR)dateString - )); - } - } - -//////////////////////////////////////////////////////////////////////////////// -// items expected not to always be current -//////////////////////////////////////////////////////////////////////////////// - - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureWriteProtect); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_GENERAL, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Software Write Protect" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureRandomReadable); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Random Reads" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureMultiRead); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Multi-Read" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureCdRead); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "reading from CD-ROM/R/RW" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureDvdRead); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "DVD Structure Reads" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureRandomWritable); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Random Writes" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureIncrementalStreamingWritable); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Incremental Streaming Writing" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureSectorErasable); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Sector Erasable Media" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureFormattable); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Formatting" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureDefectManagement); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "defect management" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureWriteOnce); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Write Once Media" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureRestrictedOverwrite); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Restricted Overwrites" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureCdrwCAVWrite); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "CD-RW CAV recording" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureMrw); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Mount Rainier media" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureEnhancedDefectReporting); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Enhanced Defect Reporting" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureDvdPlusRW); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "DVD+RW media" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureRigidRestrictedOverwrite); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Rigid Restricted Overwrite" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureCdTrackAtOnce); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "CD Recording (Track At Once)" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureCdMastering); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "CD Recording (Mastering)" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureDvdRecordableWrite); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "DVD Recording (Mastering)" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureDDCDRead); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "DD CD Reading" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureDDCDRWrite); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "DD CD-R Writing" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureDDCDRWWrite); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "DD CD-RW Writing" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureLayerJumpRecording); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Layer Jump Recording" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureHDDVDRead); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "HD-DVD Reading" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureHDDVDWrite); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "HD-DVD Writing" - )); - } - - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureSMART); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "S.M.A.R.T." - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureCDAudioAnalogPlay); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Analogue CD Audio Operations" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureDvdCSS); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "DVD CSS" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureRealTimeStreaming); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "Real-time Streaming Reads" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureDiscControlBlocks); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "DVD Disc Control Blocks" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureDvdCPRM); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "DVD CPRM" - )); - } - - header = DeviceFindFeaturePage(Buffer, Usable, FeatureAACS); - if (header) { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_INIT, - "CdromGetConfiguration: %s %s\n", - (header->Current ? - "Currently supports" : "Is able to support"), - "AACS" - )); - } - -#else - PAGED_CODE(); - - UNREFERENCED_PARAMETER(Usable); - UNREFERENCED_PARAMETER(Buffer); - -#endif // DBG - return; -} - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -MediaReadCapacity( - _In_ WDFDEVICE Device - ) -/*++ -Routine Description: - - Get media capacity - -Arguments: - - Device - the device that owns the media - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status; - SCSI_REQUEST_BLOCK srb; - PCDB cdb = NULL; - READ_CAPACITY_DATA capacityData; - - PAGED_CODE(); - - RtlZeroMemory(&srb, sizeof(srb)); - RtlZeroMemory(&capacityData, sizeof(capacityData)); - - cdb = (PCDB)(&srb.Cdb); - - //Prepare SCSI command fields - srb.CdbLength = 10; - srb.TimeOutValue = CDROM_READ_CAPACITY_TIMEOUT; - cdb->CDB10.OperationCode = SCSIOP_READ_CAPACITY; - - status = DeviceSendSrbSynchronously(Device, - &srb, - &capacityData, - sizeof(READ_CAPACITY_DATA), - FALSE, - NULL); - - //Remember the result - if (!NT_SUCCESS(status)) - { - //Set the BytesPerBlock to zero, this is for safe as if error happens this field should stay zero (no change). - //it will be treated as error case in MediaReadCapacityDataInterpret() - capacityData.BytesPerBlock = 0; - } - - MediaReadCapacityDataInterpret(Device, &capacityData); - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -VOID -MediaReadCapacityDataInterpret( - _In_ WDFDEVICE Device, - _In_ PREAD_CAPACITY_DATA ReadCapacityBuffer - ) -/*++ -Routine Description: - - Interpret media capacity and set corresponding fields in device context - -Arguments: - - Device - the device that owns the media - - ReadCapacityBuffer - data buffer of capacity - -Return Value: - - none - ---*/ -{ - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - ULONG lastSector = 0; - ULONG bps = 0; - ULONG lastBit = 0; - ULONG bytesPerBlock = 0; - BOOLEAN errorHappened = FALSE; - - PAGED_CODE(); - - NT_ASSERT(ReadCapacityBuffer); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "MediaReadCapacityDataInterpret: Entering\n")); - - // Swizzle bytes from Read Capacity and translate into - // the necessary geometry information in the device extension. - bytesPerBlock = ReadCapacityBuffer->BytesPerBlock; - - ((PFOUR_BYTE)&bps)->Byte0 = ((PFOUR_BYTE)&bytesPerBlock)->Byte3; - ((PFOUR_BYTE)&bps)->Byte1 = ((PFOUR_BYTE)&bytesPerBlock)->Byte2; - ((PFOUR_BYTE)&bps)->Byte2 = ((PFOUR_BYTE)&bytesPerBlock)->Byte1; - ((PFOUR_BYTE)&bps)->Byte3 = ((PFOUR_BYTE)&bytesPerBlock)->Byte0; - - // Insure that bps is a power of 2. - // This corrects a problem with the HP 4020i CDR where it - // returns an incorrect number for bytes per sector. - if (!bps) - { - // Set disk geometry to default values (per ISO 9660). - bps = 2048; - errorHappened = TRUE; - } - else - { - lastBit = (ULONG)(-1); - while (bps) - { - lastBit++; - bps = (bps >> 1); - } - bps = (1 << lastBit); - } - - deviceExtension->DiskGeometry.BytesPerSector = bps; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "MediaReadCapacityDataInterpret: Calculated bps %#x\n", - deviceExtension->DiskGeometry.BytesPerSector)); - - // Copy last sector in reverse byte order. - bytesPerBlock = ReadCapacityBuffer->LogicalBlockAddress; - - ((PFOUR_BYTE)&lastSector)->Byte0 = ((PFOUR_BYTE)&bytesPerBlock)->Byte3; - ((PFOUR_BYTE)&lastSector)->Byte1 = ((PFOUR_BYTE)&bytesPerBlock)->Byte2; - ((PFOUR_BYTE)&lastSector)->Byte2 = ((PFOUR_BYTE)&bytesPerBlock)->Byte1; - ((PFOUR_BYTE)&lastSector)->Byte3 = ((PFOUR_BYTE)&bytesPerBlock)->Byte0; - - // Calculate sector to byte shift. - WHICH_BIT(bps, deviceExtension->SectorShift); - - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_GENERAL, - "MediaReadCapacityDataInterpret: Sector size is %d\n", - deviceExtension->DiskGeometry.BytesPerSector)); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "MediaReadCapacityDataInterpret: Number of Sectors is %d\n", - lastSector + 1)); - - // Calculate media capacity in bytes. - if (errorHappened) - { - // Set disk geometry to default values (per ISO 9660). - deviceExtension->PartitionLength.QuadPart = (LONGLONG)(0x7fffffff); - } - else - { - deviceExtension->PartitionLength.QuadPart = (LONGLONG)(lastSector + 1); - deviceExtension->PartitionLength.QuadPart = - (deviceExtension->PartitionLength.QuadPart << deviceExtension->SectorShift); - } - - // we've defaulted to 32/64 forever. don't want to change this now... - deviceExtension->DiskGeometry.TracksPerCylinder = 0x40; - deviceExtension->DiskGeometry.SectorsPerTrack = 0x20; - - // Calculate number of cylinders. - deviceExtension->DiskGeometry.Cylinders.QuadPart = (LONGLONG)((lastSector + 1) / (32 * 64)); - - deviceExtension->DiskGeometry.MediaType = RemovableMedia; - - return; -} - - -_IRQL_requires_max_(APC_LEVEL) -VOID -DevicePickDvdRegion( - _In_ WDFDEVICE Device - ) -/*++ - -Routine Description: - - pick a default dvd region - -Arguments: - - Device - Device Object - -Return Value: - - none - ---*/ -{ - NTSTATUS status; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - - // these five pointers all point to dvdReadStructure or part of - // its data, so don't deallocate them more than once! - PDVD_READ_STRUCTURE dvdReadStructure; - PDVD_COPY_PROTECT_KEY copyProtectKey; - PDVD_COPYRIGHT_DESCRIPTOR dvdCopyRight; - PDVD_RPC_KEY rpcKey; - PDVD_SET_RPC_KEY dvdRpcKey; - - size_t bytesReturned = 0; - ULONG bufferLen = 0; - UCHAR mediaRegion = 0; - ULONG pickDvdRegion = 0; - ULONG defaultDvdRegion = 0; - ULONG dvdRegion = 0; - WDFKEY registryKey = NULL; - - DECLARE_CONST_UNICODE_STRING(registryValueName, DVD_DEFAULT_REGION); - - PAGED_CODE(); - - if ((pickDvdRegion = InterlockedExchange((PLONG)&deviceExtension->DeviceAdditionalData.PickDvdRegion, 0)) == 0) - { - // it was non-zero, so either another thread will do this, or - // we no longer need to pick a region - return; - } - - bufferLen = max( - max(sizeof(DVD_DESCRIPTOR_HEADER) + - sizeof(DVD_COPYRIGHT_DESCRIPTOR), - sizeof(DVD_READ_STRUCTURE) - ), - max(DVD_RPC_KEY_LENGTH, - DVD_SET_RPC_KEY_LENGTH - ) - ); - - dvdReadStructure = (PDVD_READ_STRUCTURE) - ExAllocatePool2(POOL_FLAG_PAGED, bufferLen, DVD_TAG_DVD_REGION); - - if (dvdReadStructure == NULL) - { - InterlockedExchange((PLONG)&deviceExtension->DeviceAdditionalData.PickDvdRegion, pickDvdRegion); - return; - } - - copyProtectKey = (PDVD_COPY_PROTECT_KEY)dvdReadStructure; - - dvdCopyRight = (PDVD_COPYRIGHT_DESCRIPTOR) - ((PDVD_DESCRIPTOR_HEADER)dvdReadStructure)->Data; - - // get the media region - RtlZeroMemory (dvdReadStructure, bufferLen); - dvdReadStructure->Format = DvdCopyrightDescriptor; - - // Build and send a request for READ_KEY - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): Getting Copyright Descriptor\n", - Device)); - - status = ReadDvdStructure(deviceExtension, - NULL, - dvdReadStructure, - sizeof(DVD_READ_STRUCTURE), - dvdReadStructure, - sizeof(DVD_DESCRIPTOR_HEADER) + sizeof(DVD_COPYRIGHT_DESCRIPTOR), - &bytesReturned); - - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): Got Copyright Descriptor %x\n", - Device, status)); - - if ((NT_SUCCESS(status)) && - (dvdCopyRight->CopyrightProtectionType == 0x01)) - { - // keep the media region bitmap around - // a 1 means ok to play - if (dvdCopyRight->RegionManagementInformation == 0xff) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): RegionManagementInformation " - "is set to dis-allow playback for all regions. This is " - "most likely a poorly authored disc. defaulting to all " - "region disc for purpose of choosing initial region\n", - Device)); - dvdCopyRight->RegionManagementInformation = 0; - } - - mediaRegion = ~dvdCopyRight->RegionManagementInformation; - } - else - { - // can't automatically pick a default region on a drive without media, so just exit - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): failed to auto-choose a region due to status %x getting copyright descriptor\n", - Device, status)); - goto getout; - } - - // get the device region - RtlZeroMemory (copyProtectKey, bufferLen); - copyProtectKey->KeyLength = DVD_RPC_KEY_LENGTH; - copyProtectKey->KeyType = DvdGetRpcKey; - - // Build and send a request for READ_KEY for RPC key - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): Getting RpcKey\n", - Device)); - status = DvdStartSessionReadKey(deviceExtension, - IOCTL_DVD_READ_KEY, - NULL, - copyProtectKey, - DVD_RPC_KEY_LENGTH, - copyProtectKey, - DVD_RPC_KEY_LENGTH, - &bytesReturned); - - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): Got RpcKey %x\n", - Device, status)); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): failed to get RpcKey from " - "a DVD Device\n", Device)); - goto getout; - } - - // so we now have what we can get for the media region and the - // drive region. we will not set a region if the drive has one - // set already (mask is not all 1's), nor will we set a region - // if there are no more user resets available. - rpcKey = (PDVD_RPC_KEY)copyProtectKey->KeyData; - - if (rpcKey->RegionMask != 0xff) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): not picking a region since " - "it is already chosen\n", Device)); - goto getout; - } - - if (rpcKey->UserResetsAvailable <= 1) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): not picking a region since " - "only one change remains\n", Device)); - goto getout; - } - - // OOBE sets this key based upon the system locale - status = WdfDriverOpenParametersRegistryKey(WdfGetDriver(), - KEY_READ, - WDF_NO_OBJECT_ATTRIBUTES, - ®istryKey); - - if (NT_SUCCESS(status)) - { - status = WdfRegistryQueryULong(registryKey, - ®istryValueName, - &defaultDvdRegion); - - WdfRegistryClose(registryKey); - } - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): failed to read registry value due to status %x\n", - Device, status)); - - // by default the default Dvd region is 0 - defaultDvdRegion = 0; - status = STATUS_SUCCESS; - } - - if (defaultDvdRegion > DVD_MAX_REGION) - { - // the registry has a bogus default - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): registry has a bogus default " - "region value of %x\n", Device, defaultDvdRegion)); - - defaultDvdRegion = 0; - } - - // if defaultDvdRegion == 0, it means no default. - - // we will select the initial dvd region for the user - - if ((defaultDvdRegion != 0) && - (mediaRegion & (1 << (defaultDvdRegion - 1)))) - { - // first choice: - // the media has region that matches - // the default dvd region. - dvdRegion = (1 << (defaultDvdRegion - 1)); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): Choice #1: media matches " - "drive's default, chose region %x\n", Device, dvdRegion)); - } - else if (mediaRegion) - { - // second choice: - // pick the lowest region number from the media - UCHAR mask = 1; - dvdRegion = 0; - - while (mediaRegion && !dvdRegion) - { - // pick the lowest bit - dvdRegion = mediaRegion & mask; - mask <<= 1; - } - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): Choice #2: choosing lowest " - "media region %x\n", Device, dvdRegion)); - } - else if (defaultDvdRegion) - { - // third choice: - // default dvd region from the dvd class installer - dvdRegion = (1 << (defaultDvdRegion - 1)); - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): Choice #3: using default " - "region for this install %x\n", Device, dvdRegion)); - } - else - { - // unable to pick one for the user -- this should rarely - // happen, since the proppage dvd class installer sets - // the key based upon the system locale - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): Choice #4: failed to choose " - "a media region\n", Device)); - goto getout; - } - - // now that we've chosen a region, set the region by sending the - // appropriate request to the drive - RtlZeroMemory (copyProtectKey, bufferLen); - copyProtectKey->KeyLength = DVD_SET_RPC_KEY_LENGTH; - copyProtectKey->KeyType = DvdSetRpcKey; - dvdRpcKey = (PDVD_SET_RPC_KEY)copyProtectKey->KeyData; - dvdRpcKey->PreferredDriveRegionCode = (UCHAR)~dvdRegion; - - // Build and send request for SEND_KEY - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): Sending new Rpc Key to region %x\n", - Device, dvdRegion)); - - status = DvdSendKey(deviceExtension, - NULL, - copyProtectKey, - DVD_SET_RPC_KEY_LENGTH, - &bytesReturned); - - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL, - "DevicePickDvdRegion (%p): Sent new Rpc Key %x\n", - Device, status)); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, "DevicePickDvdRegion (%p): unable to set dvd initial " - " region code (%x)\n", Device, status)); - } - else - { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL, "DevicePickDvdRegion (%p): Successfully set dvd " - "initial region\n", Device)); - - pickDvdRegion = 0; - } - -getout: - if (dvdReadStructure) - { - FREE_POOL(dvdReadStructure); - } - - // update the new PickDvdRegion value - InterlockedExchange((PLONG)&deviceExtension->DeviceAdditionalData.PickDvdRegion, pickDvdRegion); - - return; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceRegisterInterface( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ CDROM_DEVICE_INTERFACES InterfaceType - ) -/*++ -Routine Description: - - used to register device class interface or mount device interface - -Arguments: - - DeviceExtension - device context - - InterfaceType - interface type to be registered. - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status; - WDFSTRING string = NULL; - GUID* interfaceGuid = NULL; - PUNICODE_STRING savingString = NULL; - BOOLEAN setRestricted = FALSE; - UNICODE_STRING localString; - - PAGED_CODE(); - - //Get parameters - switch(InterfaceType) - { - case CdRomDeviceInterface: - interfaceGuid = (LPGUID)&GUID_DEVINTERFACE_CDROM; - setRestricted = TRUE; - savingString = &localString; - break; - case MountedDeviceInterface: - interfaceGuid = (LPGUID)&MOUNTDEV_MOUNTED_DEVICE_GUID; - savingString = &(DeviceExtension->MountedDeviceInterfaceName); - break; - default: - return STATUS_INVALID_PARAMETER; - } - - status = WdfDeviceCreateDeviceInterface(DeviceExtension->Device, - interfaceGuid, - NULL); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "DeviceRegisterInterface: Unable to register cdrom " - "DCA for fdo %p type: %s [%lx]\n", - DeviceExtension->Device, - (InterfaceType == CdRomDeviceInterface)? "CdRom Interface" : "Mounted Device Interface", - status)); - } - - // Retrieve interface string - if (NT_SUCCESS(status)) - { - // The string object will be released when its parent object is released. - WDF_OBJECT_ATTRIBUTES attributes; - - WDF_OBJECT_ATTRIBUTES_INIT(&attributes); - attributes.ParentObject = DeviceExtension->Device; - - status = WdfStringCreate(WDF_NO_OBJECT_ATTRIBUTES, - NULL, - &string); - } - - if (NT_SUCCESS(status)) - { - status = WdfDeviceRetrieveDeviceInterfaceString(DeviceExtension->Device, - interfaceGuid, - NULL, - string); - } - - if (NT_SUCCESS(status)) - { - WdfStringGetUnicodeString(string, savingString); - - if (setRestricted) { - - - WdfObjectDelete(string); - } - } - - return status; -} // end DeviceRegisterInterface() - - -VOID -DeviceRestoreDefaultSpeed( - _In_ WDFWORKITEM WorkItem - ) -/*++ - -Routine Description: - - This workitem is called on a media change when the CDROM device - speed should be restored to the default value. - -Arguments: - - Fdo - Supplies the device object for the CDROM device. - WorkItem - Supplies the pointer to the workitem. - -Return Value: - - None - ---*/ -{ - NTSTATUS status; - WDFDEVICE device = WdfWorkItemGetParentObject(WorkItem); - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(device); - PPERFORMANCE_DESCRIPTOR perfDescriptor; - ULONG transferLength = sizeof(PERFORMANCE_DESCRIPTOR); - SCSI_REQUEST_BLOCK srb = {0}; - PCDB cdb = (PCDB)srb.Cdb; - - PAGED_CODE(); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "DeviceRestoreDefaultSpeed: Restore device speed for %p\n", device)); - - perfDescriptor = ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED, - transferLength, - CDROM_TAG_STREAM); - if (perfDescriptor == NULL) - { - return; - } - - RtlZeroMemory(perfDescriptor, transferLength); - - perfDescriptor->RestoreDefaults = TRUE; - - srb.TimeOutValue = deviceExtension->TimeOutValue; - - srb.CdbLength = 12; - cdb->SET_STREAMING.OperationCode = SCSIOP_SET_STREAMING; - REVERSE_BYTES_SHORT(&cdb->SET_STREAMING.ParameterListLength, &transferLength); - - status = DeviceSendSrbSynchronously(device, - &srb, - perfDescriptor, - transferLength, - TRUE, - NULL); - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DeviceRestoreDefaultSpeed: Set Streaming command completed with status: 0x%X\n", status)); - - FREE_POOL(perfDescriptor); - WdfObjectDelete(WorkItem); - - return; -} - -// custom string match -- careful! -_IRQL_requires_max_(APC_LEVEL) -BOOLEAN -StringsAreMatched( - _In_opt_z_ PCHAR StringToMatch, - _In_z_ PCHAR TargetString - ) -/*++ - -Routine Description: - - compares if two strings are identical - -Arguments: - - StringToMatch - source string. - TargetString - target string. - -Return Value: - - BOOLEAN - TRUE (identical); FALSE (not match) - ---*/ -{ - size_t length; - - PAGED_CODE(); - - NT_ASSERT(TargetString); - - // if no match requested, return TRUE - if (StringToMatch == NULL) - { - return TRUE; - } - - // cache the string length for efficiency - length = strlen(StringToMatch); - - // ZERO-length strings may only match zero-length strings - if (length == 0) - { - return (strlen(TargetString) == 0); - } - - // strncmp returns zero if the strings match - return (strncmp(StringToMatch, TargetString, length) == 0); -} - - -NTSTATUS -RequestSetContextFields( - _In_ WDFREQUEST Request, - _In_ PSYNC_HANDLER Handler - ) -/*++ - -Routine Description: - - set the request object context fields - -Arguments: - - Request - request object. - Handler - the function that finally handles this request. - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request); - PKEVENT syncEvent = NULL; - - syncEvent = ExAllocatePool2(POOL_FLAG_NON_PAGED, - sizeof(KEVENT), - CDROM_TAG_SYNC_EVENT); - - if (syncEvent == NULL) - { - // memory allocation failed. - status = STATUS_INSUFFICIENT_RESOURCES; - } - else - { - // now, put the special synchronization information into the context - requestContext->SyncRequired = TRUE; - requestContext->SyncEvent = syncEvent; - requestContext->SyncCallback = Handler; - - status = STATUS_SUCCESS; - } - - return status; -} - - -NTSTATUS -RequestDuidGetDeviceIdProperty( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - - -Arguments: - - DeviceExtension - device context - Request - request object. - RequestParameters - request parameter - DataLength - transferred data length. - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PSTORAGE_DEVICE_ID_DESCRIPTOR deviceIdDescriptor = NULL; - PSTORAGE_DESCRIPTOR_HEADER descHeader = NULL; - STORAGE_PROPERTY_ID propertyId = StorageDeviceIdProperty; - - *DataLength = 0; - - // Get the VPD page 83h data. - status = DeviceRetrieveDescriptor(DeviceExtension->Device, - &propertyId, - (PSTORAGE_DESCRIPTOR_HEADER*)&deviceIdDescriptor); - - if (NT_SUCCESS(status) && (deviceIdDescriptor == NULL)) - { - status = STATUS_NOT_FOUND; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &descHeader, - NULL); - } - - if (NT_SUCCESS(status)) - { - PSTORAGE_DEVICE_UNIQUE_IDENTIFIER storageDuid = NULL; - ULONG offset = descHeader->Size; - PUCHAR dest = (PUCHAR)descHeader + offset; - size_t outputBufferSize; - - outputBufferSize = RequestParameters.Parameters.DeviceIoControl.OutputBufferLength; - - // Adjust required size and potential destination location. - status = RtlULongAdd(descHeader->Size, deviceIdDescriptor->Size, &descHeader->Size); - - if (NT_SUCCESS(status) && - (outputBufferSize < descHeader->Size)) - { - // Output buffer is too small. Return error and make sure - // the caller gets info about required buffer size. - *DataLength = descHeader->Size; - status = STATUS_BUFFER_OVERFLOW; - } - - if (NT_SUCCESS(status)) - { - storageDuid = (PSTORAGE_DEVICE_UNIQUE_IDENTIFIER)descHeader; - storageDuid->StorageDeviceIdOffset = offset; - - RtlCopyMemory(dest, - deviceIdDescriptor, - deviceIdDescriptor->Size); - - *DataLength = storageDuid->Size; - status = STATUS_SUCCESS; - } - - FREE_POOL(deviceIdDescriptor); - } - - return status; -} - -NTSTATUS -RequestDuidGetDeviceProperty( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - - -Arguments: - - DeviceExtension - device context - Request - request object. - RequestParameters - request parameter - DataLength - transferred data length. - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PSTORAGE_DEVICE_DESCRIPTOR deviceDescriptor = DeviceExtension->DeviceDescriptor; - PSTORAGE_DESCRIPTOR_HEADER descHeader = NULL; - PSTORAGE_DEVICE_UNIQUE_IDENTIFIER storageDuid; - PUCHAR dest = NULL; - - if (deviceDescriptor == NULL) - { - status = STATUS_NOT_FOUND; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &descHeader, - NULL); - } - - if (NT_SUCCESS(status) && - (deviceDescriptor->SerialNumberOffset == 0)) - { - status = STATUS_NOT_FOUND; - } - - // Use this info only if serial number is available. - if (NT_SUCCESS(status)) - { - ULONG offset = descHeader->Size; - size_t outputBufferSize = RequestParameters.Parameters.DeviceIoControl.OutputBufferLength; - - // Adjust required size and potential destination location. - dest = (PUCHAR)descHeader + offset; - - status = RtlULongAdd(descHeader->Size, deviceDescriptor->Size, &descHeader->Size); - - if (NT_SUCCESS(status) && - (outputBufferSize < descHeader->Size)) - { - // Output buffer is too small. Return error and make sure - // the caller get info about required buffer size. - *DataLength = descHeader->Size; - status = STATUS_BUFFER_OVERFLOW; - } - - if (NT_SUCCESS(status)) - { - storageDuid = (PSTORAGE_DEVICE_UNIQUE_IDENTIFIER)descHeader; - storageDuid->StorageDeviceOffset = offset; - - RtlCopyMemory(dest, - deviceDescriptor, - deviceDescriptor->Size); - - *DataLength = storageDuid->Size; - status = STATUS_SUCCESS; - } - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -ULONG -DeviceRetrieveModeSenseUsingScratch( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_reads_bytes_(Length) PCHAR ModeSenseBuffer, - _In_ ULONG Length, - _In_ UCHAR PageCode, - _In_ UCHAR PageControl - ) -/*++ - -Routine Description: - - retrieve mode sense informaiton of the device - -Arguments: - - DeviceExtension - device context - ModeSenseBuffer - buffer to savee the mode sense info. - Length - buffer length - PageCode - . - PageControl - - -Return Value: - - ULONG - transferred data length - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - ULONG transferSize = min(Length, DeviceExtension->ScratchContext.ScratchBufferSize); - CDB cdb; - - PAGED_CODE(); - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.MODE_SENSE.OperationCode = SCSIOP_MODE_SENSE; - cdb.MODE_SENSE.PageCode = PageCode; - cdb.MODE_SENSE.Pc = PageControl; - cdb.MODE_SENSE.AllocationLength = (UCHAR)transferSize; - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, NULL, transferSize, TRUE, &cdb, 6); - - if (NT_SUCCESS(status)) - { - transferSize = min(Length, DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength); - RtlCopyMemory(ModeSenseBuffer, - DeviceExtension->ScratchContext.ScratchBuffer, - transferSize); - } - - ScratchBuffer_EndUse(DeviceExtension); - - return transferSize; -} - -_IRQL_requires_max_(APC_LEVEL) -PVOID -ModeSenseFindSpecificPage( - _In_reads_bytes_(Length) PCHAR ModeSenseBuffer, - _In_ size_t Length, - _In_ UCHAR PageMode, - _In_ BOOLEAN Use6BytesCdb - ) -/*++ - -Routine Description: - - This routine scans through the mode sense data and finds the requested - mode sense page code. - -Arguments: - ModeSenseBuffer - Supplies a pointer to the mode sense data. - - Length - Indicates the length of valid data. - - PageMode - Supplies the page mode to be searched for. - - Use6BytesCdb - Indicates whether 6 or 10 byte mode sense was used. - -Return Value: - - A pointer to the the requested mode page. If the mode page was not found - then NULL is return. - ---*/ -{ - PCHAR limit; - ULONG parameterHeaderLength; - PVOID result = NULL; - - PAGED_CODE(); - - limit = ModeSenseBuffer + Length; - parameterHeaderLength = (Use6BytesCdb) - ? sizeof(MODE_PARAMETER_HEADER) - : sizeof(MODE_PARAMETER_HEADER10); - - if (Length >= parameterHeaderLength) - { - PMODE_PARAMETER_HEADER10 modeParam10; - ULONG blockDescriptorLength; - - // Skip the mode select header and block descriptors. - if (Use6BytesCdb) - { - blockDescriptorLength = ((PMODE_PARAMETER_HEADER)ModeSenseBuffer)->BlockDescriptorLength; - } - else - { - modeParam10 = (PMODE_PARAMETER_HEADER10) ModeSenseBuffer; - blockDescriptorLength = modeParam10->BlockDescriptorLength[1]; - } - - ModeSenseBuffer += parameterHeaderLength + blockDescriptorLength; - - // ModeSenseBuffer now points at pages. Walk the pages looking for the - // requested page until the limit is reached. - while (ModeSenseBuffer + - RTL_SIZEOF_THROUGH_FIELD(MODE_DISCONNECT_PAGE, PageLength) < limit) - { - if (((PMODE_DISCONNECT_PAGE) ModeSenseBuffer)->PageCode == PageMode) - { - // found the mode page. make sure it's safe to touch it all - // before returning the pointer to caller - if (ModeSenseBuffer + ((PMODE_DISCONNECT_PAGE)ModeSenseBuffer)->PageLength > limit) - { - // Return NULL since the page is not safe to access in full - result = NULL; - } - else - { - result = ModeSenseBuffer; - } - break; - } - - // Advance to the next page which is 4-byte-aligned offset after this page. - ModeSenseBuffer += ((PMODE_DISCONNECT_PAGE) ModeSenseBuffer)->PageLength + - RTL_SIZEOF_THROUGH_FIELD(MODE_DISCONNECT_PAGE, PageLength); - } - } - - return result; -} // end ModeSenseFindSpecificPage() - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -PerformEjectionControl( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ MEDIA_LOCK_TYPE LockType, - _In_ BOOLEAN Lock - ) -/*++ - -Routine Description: - - ejection control process - -Arguments: - - DeviceExtension - device extension - Request - WDF request to be used for communication with the device - LockType - the type of lock - Lock - if TRUE, lock the device; if FALSE, unlock it - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status; - PFILE_OBJECT_CONTEXT fileObjectContext = NULL; - SCSI_REQUEST_BLOCK srb; - PCDB cdb = NULL; - - LONG newLockCount = 0; - LONG newProtectedLockCount = 0; - LONG newInternalLockCount = 0; - LONG newFileLockCount = 0; - BOOLEAN countChanged = FALSE; - BOOLEAN previouslyLocked = FALSE; - BOOLEAN nowLocked = FALSE; - - PAGED_CODE(); - - // Prevent race conditions while working with lock counts - status = WdfWaitLockAcquire(DeviceExtension->EjectSynchronizationLock, NULL); - if (!NT_SUCCESS(status)) - { - NT_ASSERT(FALSE); - } - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "PerformEjectionControl: " - "Received request for %s lock type\n", - LockTypeStrings[LockType] - )); - - - // If this is a "secured" request, retrieve the file object context - if (LockType == SecureMediaLock) - { - WDFFILEOBJECT fileObject = NULL; - - fileObject = WdfRequestGetFileObject(Request); - - if (fileObject == NULL) - { - status = STATUS_INVALID_HANDLE; - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "FileObject does not match to the one in IRP_MJ_CREATE, KMDF returns NULL\n")); - goto Exit; - } - - fileObjectContext = FileObjectGetContext(fileObject); - NT_ASSERT(fileObjectContext != NULL); - } - - // Lock counts should never fall below 0 - NT_ASSERT(DeviceExtension->LockCount >= 0); - NT_ASSERT(DeviceExtension->ProtectedLockCount >= 0); - NT_ASSERT(DeviceExtension->InternalLockCount >= 0); - - // Get the current lock counts - newLockCount = DeviceExtension->LockCount; - newProtectedLockCount = DeviceExtension->ProtectedLockCount; - newInternalLockCount = DeviceExtension->InternalLockCount; - if (fileObjectContext) - { - // fileObjectContext->LockCount is ULONG and should always >= 0 - newFileLockCount = fileObjectContext->LockCount; - } - - // Determine which lock counts need to be changed and how - if (Lock && LockType == SimpleMediaLock) - { - newLockCount++; - countChanged = TRUE; - } - else if (Lock && LockType == SecureMediaLock) - { - newFileLockCount++; - newProtectedLockCount++; - countChanged = TRUE; - } - else if (Lock && LockType == InternalMediaLock) - { - newInternalLockCount++; - countChanged = TRUE; - } - else if (!Lock && LockType == SimpleMediaLock) - { - if (newLockCount != 0) - { - newLockCount--; - countChanged = TRUE; - } - } - else if (!Lock && LockType == SecureMediaLock) - { - if ( (newFileLockCount == 0) || (newProtectedLockCount == 0) ) - { - status = STATUS_INVALID_DEVICE_STATE; - goto Exit; - } - newFileLockCount--; - newProtectedLockCount--; - countChanged = TRUE; - } - else if (!Lock && LockType == InternalMediaLock) - { - NT_ASSERT(newInternalLockCount != 0); - newInternalLockCount--; - countChanged = TRUE; - } - - if ( (DeviceExtension->LockCount != 0) || - (DeviceExtension->ProtectedLockCount != 0) || - (DeviceExtension->InternalLockCount != 0) ) - { - previouslyLocked = TRUE; - } - if ( (newLockCount != 0) || - (newProtectedLockCount != 0) || - (newInternalLockCount != 0) ) - { - nowLocked = TRUE; - } - - // Only send command down to device when necessary - if (previouslyLocked != nowLocked) - { - // Compose and send the PREVENT ALLOW MEDIA REMOVAL command. - RtlZeroMemory(&srb, sizeof(SCSI_REQUEST_BLOCK)); - - srb.CdbLength = 6; - srb.TimeOutValue = DeviceExtension->TimeOutValue; - - cdb = (PCDB)&srb.Cdb; - cdb->MEDIA_REMOVAL.OperationCode = SCSIOP_MEDIUM_REMOVAL; - cdb->MEDIA_REMOVAL.Prevent = Lock; - - status = DeviceSendSrbSynchronously(DeviceExtension->Device, - &srb, - NULL, - 0, - FALSE, - Request); - } - -Exit: - - // Store the updated lock counts on success - if (countChanged && NT_SUCCESS(status)) - { - DeviceExtension->LockCount = newLockCount; - DeviceExtension->ProtectedLockCount = newProtectedLockCount; - DeviceExtension->InternalLockCount = newInternalLockCount; - if (fileObjectContext) - { - fileObjectContext->LockCount = newFileLockCount; - } - } - - WdfWaitLockRelease(DeviceExtension->EjectSynchronizationLock); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "PerformEjectionControl: %!STATUS!, " - "Count Changed: %d, Command Sent: %d, " - "Current Counts: Internal: %x Secure: %x Simple: %x\n", - status, - countChanged, - previouslyLocked != nowLocked, - DeviceExtension->InternalLockCount, - DeviceExtension->ProtectedLockCount, - DeviceExtension->LockCount - )); - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceUnlockExclusive( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFFILEOBJECT FileObject, - _In_ BOOLEAN IgnorePreviousMediaChanges - ) -/*++ - -Routine Description: - - to unlock the exclusive lock - -Arguments: - - DeviceExtension - device context - FileObject - file object that currently holds the lock - IgnorePreviousMediaChanges - if TRUE, ignore previously accumulated media changes - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &DeviceExtension->DeviceAdditionalData; - PMEDIA_CHANGE_DETECTION_INFO info = DeviceExtension->MediaChangeDetectionInfo; - BOOLEAN ANPending = 0; - LONG requestInUse = 0; - - PAGED_CODE(); - - if (!EXCLUSIVE_MODE(cdData)) - { - // Device is not locked for exclusive access. - // Can not process unlock request. - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestHandleExclusiveAccessUnlockDevice: Device not locked for exclusive access, can't unlock device.\n")); - status = STATUS_INVALID_DEVICE_REQUEST; - } - else if (!EXCLUSIVE_OWNER(cdData, FileObject)) - { - // Request not from the exclusive owner, can't unlock the device. - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestHandleExclusiveAccessUnlockDevice: Unable to unlock device, invalid file object\n")); - - status = STATUS_INVALID_HANDLE; - } - - if (NT_SUCCESS(status)) - { - // Unless we were explicitly requested not to do so, generate a media removal notification - // followed by a media arrival notification similar to volume lock/unlock file system events. - if (!IgnorePreviousMediaChanges) - { - MEDIA_CHANGE_DETECTION_STATE previousMediaState = MediaUnknown; - - // Change the media state to "unavailable", which will cause a removal notification if the media - // was previously present. At the same time, store the previous state in previousMediaState. - DeviceSetMediaChangeStateEx(DeviceExtension, MediaUnavailable, &previousMediaState); - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DeviceUnlockExclusive: Changing the media state to MediaUnavailable\n")); - - // Restore the previous media state, which will cause a media arrival notification if the media - // was originally present. - DeviceSetMediaChangeStateEx(DeviceExtension, previousMediaState, NULL); - } - - // Set DO_VERIFY_VOLUME so that the file system will remount on it. - if (IsVolumeMounted(DeviceExtension->DeviceObject)) - { - SET_FLAG(DeviceExtension->DeviceObject->Flags, DO_VERIFY_VOLUME); - } - - // Set MMC state to update required - cdData->Mmc.WriteAllowed = FALSE; - cdData->Mmc.UpdateState = CdromMmcUpdateRequired; - - // Send unlock notification - DeviceSendNotification(DeviceExtension, - &GUID_IO_CDROM_EXCLUSIVE_UNLOCK, - 0, - NULL); - - InterlockedExchangePointer((PVOID)&cdData->ExclusiveOwner, NULL); - - if ((info != NULL) && (info->AsynchronousNotificationSupported != FALSE)) - { - ANPending = info->ANSignalPendingDueToExclusiveLock; - info->ANSignalPendingDueToExclusiveLock = FALSE; - - if ((ANPending != FALSE) && (info->MediaChangeDetectionDisableCount == 0)) - { - // if the request is not in use, mark it as such. - requestInUse = InterlockedCompareExchange((PLONG)&info->MediaChangeRequestInUse, 1, 0); - - if (requestInUse == 0) - { - // The last MCN finished. ok to issue the new one. - RequestSetupMcnSyncIrp(DeviceExtension); - - // The irp will go into KMDF framework and a request will be created there to represent it. - IoCallDriver(DeviceExtension->DeviceObject, info->MediaChangeSyncIrp); - } - } - } - } - - return status; -} - - -VOID -RequestCompletion( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ NTSTATUS Status, - _In_ ULONG_PTR Information - ) -{ -#ifdef DBG - ULONG ioctlCode = 0; - WDF_REQUEST_PARAMETERS requestParameters; - - // Get the Request parameters - WDF_REQUEST_PARAMETERS_INIT(&requestParameters); - WdfRequestGetParameters(Request, &requestParameters); - - if (requestParameters.Type == WdfRequestTypeDeviceControl) - { - ioctlCode = requestParameters.Parameters.DeviceIoControl.IoControlCode; - - if (requestParameters.Parameters.DeviceIoControl.IoControlCode != IOCTL_MCN_SYNC_FAKE_IOCTL) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "Request complete - IOCTL - code: %X; Status: %X; Information: %X\n", - ioctlCode, - Status, - (ULONG)Information)); - } - else - { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_GENERAL, - "Request complete - IOCTL - code: %X; Status: %X; Information: %X\n", - ioctlCode, - Status, - (ULONG)Information)); - } - } - else if (requestParameters.Type == WdfRequestTypeRead) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "Request complete - READ - Starting Offset: %X; Length: %X; Transferred Length: %X; Status: %X\n", - (ULONG)requestParameters.Parameters.Read.DeviceOffset, - (ULONG)requestParameters.Parameters.Read.Length, - (ULONG)Information, - Status)); - } - else if (requestParameters.Type == WdfRequestTypeWrite) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "Request complete - WRITE - Starting Offset: %X; Length: %X; Transferred Length: %X; Status: %X\n", - (ULONG)requestParameters.Parameters.Write.DeviceOffset, - (ULONG)requestParameters.Parameters.Write.Length, - (ULONG)Information, - Status)); - } -#endif - - if (IoIsErrorUserInduced(Status)) - { - PIRP irp = WdfRequestWdmGetIrp(Request); - if (irp->Tail.Overlay.Thread) - { - IoSetHardErrorOrVerifyDevice(irp, DeviceExtension->DeviceObject); - } - } - - if (!NT_SUCCESS(Status) && DeviceExtension->SurpriseRemoved == TRUE) - { - // IMAPI expects ERROR_DEV_NOT_EXISTS if recorder has been surprised removed, - // or it will retry WRITE commands for up to 3 minutes - // CDROM behavior should be consistent for all requests, including SCSI pass-through - Status = STATUS_DEVICE_DOES_NOT_EXIST; - } - - WdfRequestCompleteWithInformation(Request, Status, Information); - - return; -} - - -VOID -RequestDummyCompletionRoutine( - _In_ WDFREQUEST Request, - _In_ WDFIOTARGET Target, - _In_ PWDF_REQUEST_COMPLETION_PARAMS Params, - _In_ WDFCONTEXT Context - ) -/*++ - -Routine Description: - - This is a dummy competion routine that simply calls WdfRequestComplete. We have to use - this dummy competion routine instead of WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET, because - the latter causes the framework to not check if the I/O target is closed or not. - -Arguments: - - Request - completed request - Target - the I/O target that completed the request - Params - request parameters - Context - not used - -Return Value: - - none - ---*/ -{ - UNREFERENCED_PARAMETER(Target); - UNREFERENCED_PARAMETER(Params); - UNREFERENCED_PARAMETER(Context); - - WdfRequestCompleteWithInformation(Request, - WdfRequestGetStatus(Request), - WdfRequestGetInformation(Request)); -} - - -_IRQL_requires_max_(DISPATCH_LEVEL) -NTSTATUS -DeviceSendPowerDownProcessRequest( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine, - _In_opt_ PVOID Context - ) -/*++ - -Routine Description: - - This function is called during processing power down request. - It is used to send either SYNC CACHE command or STOP UNIT command. - - Caller should set proper value in deviceExtension->PowerContext.PowerChangeState.PowerDown - to trigger the correct command be sent. - -Arguments: - - DeviceExtension - - - CompletionRoutine - Completion routine that needs to be set for the request - - Context - Completion context associated with the completion routine - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status; - BOOLEAN requestSent = FALSE; - - BOOLEAN shouldRetry = TRUE; - PCDB cdb = (PCDB)DeviceExtension->PowerContext.Srb.Cdb; - ULONG timeoutValue = DeviceExtension->TimeOutValue; - ULONG retryCount = 1; - - // reset some fields. - DeviceExtension->PowerContext.RetryIntervalIn100ns = 0; - status = PowerContextReuseRequest(DeviceExtension); - RequestClearSendTime(DeviceExtension->PowerContext.PowerRequest); - - if (!NT_SUCCESS(status)) - { - return status; - } - - // set proper timeout value and max retry count. - switch(DeviceExtension->PowerContext.PowerChangeState.PowerDown) - { - case PowerDownDeviceInitial: - case PowerDownDeviceQuiesced: - case PowerDownDeviceStopped: - break; - - case PowerDownDeviceLocked: - // Case of issuing SYNC CACHE command. Do not use power irp timeout remaining time in this case - // as we want to give best try on SYNC CACHE command. - retryCount = MAXIMUM_RETRIES; - timeoutValue = DeviceExtension->TimeOutValue; - break; - - case PowerDownDeviceFlushed: - { - // Case of issuing STOP UNIT command - // As "Imme" bit is set to '1', this command should be completed in short time. - // This command is at low importance, failure of this command has very small impact. - ULONG secondsRemaining = 0; - -#if (WINVER >= 0x0601) - // this API is introduced in Windows7 - PoQueryWatchdogTime(DeviceExtension->LowerPdo, &secondsRemaining); -#endif - - if (secondsRemaining == 0) - { - // not able to retrieve remaining time from PoQueryWatchdogTime API, use default values. - retryCount = MAXIMUM_RETRIES; - timeoutValue = SCSI_CDROM_TIMEOUT; - } - else - { - // plan to leave about 30 seconds to lower level drivers if possible. - if (secondsRemaining >= 32) - { - retryCount = (secondsRemaining - 30)/SCSI_CDROM_TIMEOUT + 1; - timeoutValue = SCSI_CDROM_TIMEOUT; - - if (retryCount > MAXIMUM_RETRIES) - { - retryCount = MAXIMUM_RETRIES; - } - - if (retryCount == 1) - { - timeoutValue = secondsRemaining - 30; - } - } - else - { - // issue the command with minimal timeout value and do not retry on it. - retryCount = 1; - timeoutValue = 2; - } - } - } - break; - default: - NT_ASSERT( FALSE ); - status = STATUS_NOT_IMPLEMENTED; - return status; - } - - DeviceExtension->PowerContext.RetryCount = retryCount; - - // issue command. - while (shouldRetry) - { - - // set SRB fields. - DeviceExtension->PowerContext.Srb.SrbFlags = SRB_FLAGS_NO_DATA_TRANSFER | - SRB_FLAGS_DISABLE_SYNCH_TRANSFER | - SRB_FLAGS_NO_QUEUE_FREEZE | - SRB_FLAGS_BYPASS_LOCKED_QUEUE | - SRB_FLAGS_D3_PROCESSING; - - DeviceExtension->PowerContext.Srb.Function = SRB_FUNCTION_EXECUTE_SCSI; - DeviceExtension->PowerContext.Srb.TimeOutValue = timeoutValue; - - if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceInitial) - { - DeviceExtension->PowerContext.Srb.Function = SRB_FUNCTION_LOCK_QUEUE; - } - else if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceLocked) - { - DeviceExtension->PowerContext.Srb.Function = SRB_FUNCTION_QUIESCE_DEVICE; - } - else if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceQuiesced) - { - // Case of issuing SYNC CACHE command. - DeviceExtension->PowerContext.Srb.CdbLength = 10; - cdb->SYNCHRONIZE_CACHE10.OperationCode = SCSIOP_SYNCHRONIZE_CACHE; - } - else if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceFlushed) - { - // Case of issuing STOP UNIT command. - DeviceExtension->PowerContext.Srb.CdbLength = 6; - cdb->START_STOP.OperationCode = SCSIOP_START_STOP_UNIT; - cdb->START_STOP.Start = 0; - cdb->START_STOP.Immediate = 1; - } - else if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceStopped) - { - DeviceExtension->PowerContext.Srb.Function = SRB_FUNCTION_UNLOCK_QUEUE; - } - - // Set up completion routine and context if requested - if (CompletionRoutine) - { - WdfRequestSetCompletionRoutine(DeviceExtension->PowerContext.PowerRequest, - CompletionRoutine, - Context); - } - - status = RequestSend(DeviceExtension, - DeviceExtension->PowerContext.PowerRequest, - DeviceExtension->IoTarget, - CompletionRoutine ? 0 : WDF_REQUEST_SEND_OPTION_SYNCHRONOUS, - &requestSent); - - if (requestSent) - { - if ((CompletionRoutine == NULL) && - (SRB_STATUS(DeviceExtension->PowerContext.Srb.SrbStatus) != SRB_STATUS_SUCCESS)) - { - TracePrint((TRACE_LEVEL_ERROR, - TRACE_FLAG_POWER, - "%p\tError occured when issuing %s command to device. Srb %p, Status %x\n", - DeviceExtension->PowerContext.PowerRequest, - (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceQuiesced) ? "SYNC CACHE" : "STOP UNIT", - &DeviceExtension->PowerContext.Srb, - DeviceExtension->PowerContext.Srb.SrbStatus)); - - NT_ASSERT(!(TEST_FLAG(DeviceExtension->PowerContext.Srb.SrbStatus, SRB_STATUS_QUEUE_FROZEN))); - - shouldRetry = RequestSenseInfoInterpret(DeviceExtension, - DeviceExtension->PowerContext.PowerRequest, - &(DeviceExtension->PowerContext.Srb), - retryCount - DeviceExtension->PowerContext.RetryCount, - &status, - &(DeviceExtension->PowerContext.RetryIntervalIn100ns)); - - if (shouldRetry && (DeviceExtension->PowerContext.RetryCount-- == 0)) - { - shouldRetry = FALSE; - } - } - else - { - // succeeded, do not need to retry. - shouldRetry = FALSE; - } - - } - else - { - // request failed to be sent - shouldRetry = FALSE; - } - - if (shouldRetry) - { - LARGE_INTEGER t; - t.QuadPart = -DeviceExtension->PowerContext.RetryIntervalIn100ns; - KeDelayExecutionThread(KernelMode, FALSE, &t); - - status = PowerContextReuseRequest(DeviceExtension); - if (!NT_SUCCESS(status)) - { - shouldRetry = FALSE; - } - } - } - - if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceQuiesced) - { - // record SYNC CACHE command completion time stamp. - KeQueryTickCount(&DeviceExtension->PowerContext.Step1CompleteTime); - } - - return status; -} - -NTSTATUS -RequestSend( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDFIOTARGET IoTarget, - _In_ ULONG Flags, - _Out_opt_ PBOOLEAN RequestSent - ) -/*++ - -Routine Description: - - Send the request to the target, wake up the device from Zero Power state if necessary. - -Arguments: - - DeviceExtension - device extension - Request - the request to be sent - IoTarget - target of the above request - Flags - flags for the operation - RequestSent - optional, if the request was sent - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - BOOLEAN requestSent = FALSE; - WDF_REQUEST_SEND_OPTIONS options; - - UNREFERENCED_PARAMETER(DeviceExtension); - - if ((DeviceExtension->ZeroPowerODDInfo != NULL) && - (DeviceExtension->ZeroPowerODDInfo->InZeroPowerState != FALSE)) - { - } - - // Now send down the request - if (NT_SUCCESS(status)) - { - WDF_REQUEST_SEND_OPTIONS_INIT(&options, Flags); - - RequestSetSentTime(Request); - - // send request and check status - - // Disable SDV warning about infinitely waiting in caller's context: - // 1. Some requests (such as SCSI_PASS_THROUGH, contains buffer from user space) need to be sent down in caller’s context. - // Consequently, these requests wait in caller’s context until they are allowed to be sent down. - // 2. Considering the situation that during sleep, a request can be hold by storage port driver. When system resumes, any time out value (if we set using KMDF time out value) might be expires. - // This will cause the waiting request being failed (behavior change). We’d rather not set time out value. - - _Analysis_assume_(options.Timeout != 0); - requestSent = WdfRequestSend(Request, IoTarget, &options); - _Analysis_assume_(options.Timeout == 0); - - // If WdfRequestSend fails, or if the WDF_REQUEST_SEND_OPTION_SYNCHRONOUS flag is set, - // the driver can call WdfRequestGetStatus immediately after calling WdfRequestSend. - if ((requestSent == FALSE) || - (Flags & WDF_REQUEST_SEND_OPTION_SYNCHRONOUS)) - { - status = WdfRequestGetStatus(Request); - - if (requestSent == FALSE) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "WdfRequestSend failed: %lx\n", - status - )); - } - } - else - { - status = STATUS_SUCCESS; - } - - if (RequestSent != NULL) - { - *RequestSent = requestSent; - } - } - - return status; -} - diff --git a/storage/class/cdrom/src/data.c b/storage/class/cdrom/src/data.c deleted file mode 100644 index 72ec53b8..00000000 --- a/storage/class/cdrom/src/data.c +++ /dev/null @@ -1,283 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - -Abstract: - - -Environment: - - -Notes: - -Revision History: - ---*/ - -#include "ntddk.h" -#include "cdrom.h" - - -#ifdef ALLOC_DATA_PRAGMA -#pragma data_seg("PAGEDATA") -#endif - -/* - -#define CDROM_HACK_DEC_RRD (0x00000001) -#define CDROM_HACK_FUJITSU_FMCD_10x (0x00000002) - #define CDROM_HACK_HITACHI_1750 (0x00000004) - obsolete. -#define CDROM_HACK_HITACHI_GD_2000 (0x00000008) -#define CDROM_HACK_TOSHIBA_SD_W1101 (0x00000010) - #define CDROM_HACK_TOSHIBA_XM_3xx (0x00000020) - obsolete. -#define CDROM_HACK_NEC_CDDA (0x00000040) -#define CDROM_HACK_PLEXTOR_CDDA (0x00000080) -#define CDROM_HACK_BAD_GET_CONFIG_SUPPORT (0x00000100) -#define CDROM_HACK_FORCE_READ_CD_DETECTION (0x00000200) -#define CDROM_HACK_READ_CD_SUPPORTED (0x00000400) - -*/ - -CDROM_SCAN_FOR_SPECIAL_INFO CdromHackItems[] = { - // digital put out drives using 512 byte block sizes, - // and needed us to send a mode page to set the sector - // size back to 2048. - { "DEC" , "RRD" , NULL, 0x0001 }, - // these fujitsu drives take longer than ten seconds to - // timeout commands when audio discs are placed in them - { "FUJITSU" , "FMCD-101" , NULL, 0x0002 }, - { "FUJITSU" , "FMCD-102" , NULL, 0x0002 }, - // these hitachi drives don't work properly in PIO mode - //{ "HITACHI ", "CDR-1750S" , NULL, 0x0004 }, - //{ "HITACHI ", "CDR-3650/1650S" , NULL, 0x0004 }, - // this particular gem doesn't automatcially spin up - // on some media access commands. - { "" , "HITACHI GD-2000" , NULL, 0x0008 }, - { "" , "HITACHI DVD-ROM GD-2000" , NULL, 0x0008 }, - // this particular drive doesn't support DVD playback. - // just print an error message in CHK builds. - { "TOSHIBA ", "SD-W1101 DVD-RAM" , NULL, 0x0010 }, - // not sure what this device's issue was. seems to - // require mode selects at various times. - //{ "TOSHIBA ", "CD-ROM XM-3" , NULL, 0x0020 }, - // NEC defined a "READ_CD" type command before there was - // a standard, so fall back on this as an option. - { "NEC" , NULL , NULL, 0x0040 }, - // plextor defined a "READ_CD" type command before there was - // a standard, so fall back on this as an option. - { "PLEXTOR ", NULL , NULL, 0x0080 }, - // this drive times out and sometimes disappears from the bus - // when send GET_CONFIGURATION commands. don't send them. - { "" , "LG DVD-ROM DRD-840B" , NULL, 0x0100 }, - { "" , "SAMSUNG DVD-ROM SD-608" , NULL, 0x0300 }, - // these drives should have supported READ_CD, but at least - // some firmware revisions did not. force READ_CD detection. - { "" , "SAMSUNG DVD-ROM SD-" , NULL, 0x0200 }, - // the mitsumi drive below doesn't follow the block-only spec, - // and we end up hanging when sending it commands it doesn't - // understand. this causes complications later, also. - { "MITSUMI ", "CR-4802TE " , NULL, 0x0100 }, - // some drives return various funky errors (such as 3/2/0 NO_SEEK_COMPLETE) - // during the detection of READ_CD support, resulting in iffy detection. - // since they probably don't support mode switching, which is really old - // legacy stuff anyways, the ability to read digitally is lost when - // these drives return unexpected error codes. note: MMC compliant drives - // are presumed to support READ_CD, as are DVD drives, and anything - // connected to a bus type other than IDE or SCSI, and therefore don't - // need to be here. - { "YAMAHA ", "CRW8424S " , NULL, 0x0400 }, - // Polling frequently on virtual optical devices created by Hyper-V will - // cause a significant perf / power hit. These devices need to be polled - // less frequently for device state changes. - { "MSFT ", NULL , NULL, 0x2000 }, - // and finally, a place to finish the list. :) - { NULL , NULL , NULL, 0x0000 } -}; - -CDROM_SCAN_FOR_SPECIAL_INFO CdRomBadItems[] = { // Type (HH, slim) + WHQL Date, if known - { "" , "MITSUMI CD-ROM FX240" , NULL , 0x02 }, - { "" , "MITSUMI CD-ROM FX320" , NULL , 0x02 }, - { "" , "MITSUMI CD-ROM FX322" , NULL , 0x02 }, - { "" , "TEAC DV-28E-A" , "2.0A", 0x02 }, - { "" , "HP CD-Writer cd16h" , "Q000", 0x02 }, - { "" , "_NEC NR-7800A" , "1.33", 0x02 }, - { "" , "COMPAQ CRD-8481B" , NULL , 0x04 }, - // The following is a list of device that report too many OpChange/Add events. - // They require ignoring (or not sending) the OpChange flag in the GESN command. - // This list contains vendor ID and product ID as separate strings for USB/1394 interface. - { "HL-DT-ST", "DVDRAM GMA-4020B" , NULL , 0x10 }, // hh , 2002/04/22 - { "HL-DT-ST", "DVD-RW GCA-4020B" , NULL , 0x10 }, // hh , 2002/05/14 - { "HL-DT-ST", "DVDRAM GSA-4040B" , NULL , 0x10 }, // hh , 2003/05/06 - { "HL-DT-ST", "DVDRAM GMA-4040B" , NULL , 0x10 }, // hh , 2003/07/27 - { "HL-DT-ST", "DVD-RW GWA-4040B" , NULL , 0x10 }, // hh , 2003/11/18 - { "HL-DT-ST", "DVDRAM GSA-4081B" , NULL , 0x10 }, // hh , 2003/11/06 - { "HL-DT-ST", "DVDRAM GSA-4082B" , NULL , 0x10 }, // hh , 2004/01/27 - { "HL-DT-ST", "DVD-RW GWA-4082B" , NULL , 0x10 }, // hh , 2004/03/11 - { "HL-DT-ST", "DVDRAM GSA-4120B" , NULL , 0x10 }, // hh , 2004/05/16 - { "HL-DT-ST", "DVD+RW GRA-4120B" , NULL , 0x10 }, // hh , 2004/04/28 - { "HL-DT-ST", "DVDRAM GSA-4160B" , NULL , 0x10 }, // hh , 2004/08/12 - { "HL-DT-ST", "DVD-RW GWA-4160B" , NULL , 0x10 }, // hh , 2004/08/24 - { "HL-DT-ST", "DVDRAM GSA-4163B" , NULL , 0x10 }, // hh , 2004/11/09 - { "HL-DT-ST", "DVD-RW GWA-4163B" , NULL , 0x10 }, // hh , 2004/12/29 - { "HL-DT-ST", "DVDRAM GSA-4165B" , NULL , 0x10 }, // hh , 2005/06/09 - { "HL-DT-ST", "DVDRAM_GSA-4165B" , NULL , 0x10 }, // hh , 2005/06/28 - { "HL-DT-ST", "DVD-RW GWA-4165B" , NULL , 0x10 }, // hh , 2005/08/23 - { "HL-DT-ST", "DVDRAM GSA-4167B" , NULL , 0x10 }, // hh , 2005/07/01 - { "HL-DT-ST", "DVDRAM GSA-H10N" , NULL , 0x10 }, // hh , 2006/02/16 - { "HL-DT-ST", "DVDRAM_GSA-H10N" , NULL , 0x10 }, // hh , 2006/02/16 - { "HL-DT-ST", "DVDRAM GSA-H10L" , NULL , 0x10 }, // hh , 2006/02/27 - { "HL-DT-ST", "DVDRAM_GSA-H10L" , NULL , 0x10 }, // hh , 2006/04/21 - { "HL-DT-ST", "DVDRAM GSA-H10A" , NULL , 0x10 }, // hh , 2006/01/03 - { "HL-DT-ST", "DVDRAM_GSA-H10A" , NULL , 0x10 }, // hh , 2006/05/14 - { "HL-DT-ST", "DVD-RW GSA-H11N" , NULL , 0x10 }, // hh , 2006/04/28 - { "HL-DT-ST", "DVD-RW_GSA-H11N" , NULL , 0x10 }, // hh , 2006/02/22 - - { "HL-DT-ST", "DVDRAM GSA-4080N" , NULL , 0x10 }, // slim, 2004/08/08 - { "HL-DT-ST", "DVDRAM GMA-4080N" , NULL , 0x10 }, // slim, 2004/11/09 - { "HL-DT-ST", "DVD-RW GCA-4080N" , NULL , 0x10 }, // slim, 2004/11/22 - { "HL-DT-ST", "DVD-RW GWA-4080N" , NULL , 0x10 }, // slim, 2004/08/17 - { "HL-DT-ST", "DVDRAM GSA-4082N" , NULL , 0x10 }, // slim, 2005/07/12 - { "HL-DT-ST", "DVDRAM_GSA-4082N" , NULL , 0x10 }, // slim, 2005/09/21 - { "HL-DT-ST", "DVDRAM GMA-4082N" , NULL , 0x10 }, // slim, 2005/10/20 - { "HL-DT-ST", "DVD-RW GRA-4082N" , NULL , 0x10 }, // slim, 2006/06/07 - { "HL-DT-ST", "DVD-RW GWA-4082N" , NULL , 0x10 }, // slim, 2005/05/24 - { "HL-DT-ST", "DVDRAM GMA4082Nf" , NULL , 0x10 }, // slim, 2006/02/28 - { "HL-DT-ST", "DVDRAM GMA4082Nj" , NULL , 0x10 }, // slim, 2006/01/26 - - { "HL-DT-ST", "DVDRAM GSA-4084N" , NULL , 0x10 }, // slim, 2005/12/21 - { "HL-DT-ST", "DVDRAM GMA-4084N" , NULL , 0x10 }, // slim, 2006/02/15 - { "HP" , "DVD Writer 550s" , NULL , 0x10 }, // slim, 2006/05/08 - { "HL-DT-ST", "DVDRAM GSA-T10N" , NULL , 0x10 }, // slim, 2006/07/26 - { "HL-DT-ST", "DVDRAM_GSA-T10N" , NULL , 0x10 }, // slim, 2006/07/26 - { "HL-DT-ST", "DVD+-RW GSA-T11N" , NULL , 0x10 }, // slim, 2006/07/25 - - { "HL-DT-ST", "DVD-ROM GDR8160B" , NULL , 0x10 }, // hh , 2001/10/12 - { "COMPAQ" , "DVD-ROM GDR8160B" , NULL , 0x10 }, // hh , 2001/11/08 - { "HL-DT-ST", "DVD-ROM GDR8161B" , NULL , 0x10 }, // hh , 2002/07/19 - { "HL-DT-ST", "DVD-ROM GDR8162B" , NULL , 0x10 }, // hh , 2003/04/22 - { "HL-DT-ST", "DVD-ROM GDR8163B" , NULL , 0x10 }, // hh , 2004/05/19 - { "HL-DT-ST", "DVD-ROM GDR8164B" , NULL , 0x10 }, // hh , 2005/06/29 - { "HL-DT-ST", "DVD-ROM GDRH10N" , NULL , 0x10 }, // hh , 2006/03/07 - - { "HL-DT-ST", "DVD-ROM GDR8081N" , NULL , 0x10 }, // slim, 2001/08/27 - { "HL-DT-ST", "DVD-ROM GDR8082N" , NULL , 0x10 }, // slim, 2003/02/02 - { "HL-DT-ST", "DVD-ROM GDR8083N" , NULL , 0x10 }, // slim, 2003/02/02 - { "HL-DT-ST", "DVD-ROM GDR8085N" , NULL , 0x10 }, // slim, 2005/11/10 - - { "HL-DT-ST", "RW/DVD GCC-4080N" , NULL , 0x10 }, // slim, 2001/08/21 - { "HL-DT-ST", "RW/DVD_GCC-4080N" , NULL , 0x10 }, // slim, - { "HL-DT-ST", "RW/DVD GCC-4160N" , NULL , 0x10 }, // slim, 2002/04/08 - { "HL-DT-ST", "RW/DVD GCC-4240N" , NULL , 0x10 }, // slim, 2002/04/26 - { "HL-DT-ST", "RW/DVD GCC-4241N" , NULL , 0x10 }, // slim, 2003/04/07 - { "HL-DT-ST", "RW/DVD_GCC-4241N" , NULL , 0x10 }, // slim, 2004/03/07 - { "HL-DT-ST", "RW/DVD GCC-4242N" , NULL , 0x10 }, // slim, 2003/12/21 - { "HL-DT-ST", "RW/DVD GCC-4246N" , NULL , 0x10 }, // slim, 2005/05/23 - { "HL-DT-ST", "BD-RE GBW-H10N" , NULL , 0x10 }, // hh , 2006/06/27 - - { "HL-DT-ST", "DVDRAM GSA-4083N" , NULL , 0x10 }, // hh , 2006/05/17 - { "HL-DT-ST", "DVD+-RW GWA4083N" , NULL , 0x10 }, // hh , 2006/06/05 - - { "PIONEER", "DVD-RW DVR-106D" , NULL , 0x10 }, // hh , ? - { "ASUS", "DVD-RW DRW-0402P" , NULL , 0x10 }, // hh , ? - - // - // This list contains devices that claims to support asynchronous notification, but - // doesn't handle it well (e.g., some TSST devices will not report media removal if - // the GESN command is sent down immediately after the AN interrupt, they need some - // time in between to be able to correctly report media removal). - // - - { "TSSTcorp", "CDDVDW SN-S083A" , "SB00", 0x40 }, // slim, ? - - // - // This list contains vendor ID and product ID as a single string for ATAPI interface. - // - - { "", "HL-DT-ST DVDRAM GMA-4020B" , NULL , 0x10 }, // hh , 2002/04/22 - { "", "HL-DT-ST DVD-RW GCA-4020B" , NULL , 0x10 }, // hh , 2002/05/14 - { "", "HL-DT-ST DVDRAM GSA-4040B" , NULL , 0x10 }, // hh , 2003/05/06 - { "", "HL-DT-ST DVDRAM GMA-4040B" , NULL , 0x10 }, // hh , 2003/07/27 - { "", "HL-DT-ST DVD-RW GWA-4040B" , NULL , 0x10 }, // hh , 2003/11/18 - { "", "HL-DT-ST DVDRAM GSA-4081B" , NULL , 0x10 }, // hh , 2003/11/06 - { "", "HL-DT-ST DVDRAM GSA-4082B" , NULL , 0x10 }, // hh , 2004/01/27 - { "", "HL-DT-ST DVD-RW GWA-4082B" , NULL , 0x10 }, // hh , 2004/03/11 - { "", "HL-DT-ST DVDRAM GSA-4120B" , NULL , 0x10 }, // hh , 2004/05/16 - { "", "HL-DT-ST DVD+RW GRA-4120B" , NULL , 0x10 }, // hh , 2004/04/28 - { "", "HL-DT-ST DVDRAM GSA-4160B" , NULL , 0x10 }, // hh , 2004/08/12 - { "", "HL-DT-ST DVD-RW GWA-4160B" , NULL , 0x10 }, // hh , 2004/08/24 - { "", "HL-DT-ST DVDRAM GSA-4163B" , NULL , 0x10 }, // hh , 2004/11/09 - { "", "HL-DT-ST DVD-RW GWA-4163B" , NULL , 0x10 }, // hh , 2004/12/29 - { "", "HL-DT-ST DVDRAM GSA-4165B" , NULL , 0x10 }, // hh , 2005/06/09 - { "", "HL-DT-ST DVDRAM_GSA-4165B" , NULL , 0x10 }, // hh , 2005/06/28 - { "", "HL-DT-ST DVD-RW GWA-4165B" , NULL , 0x10 }, // hh , 2005/08/23 - { "", "HL-DT-ST DVDRAM GSA-4167B" , NULL , 0x10 }, // hh , 2005/07/01 - { "", "HL-DT-ST DVDRAM GSA-H10N" , NULL , 0x10 }, // hh , 2006/02/16 - { "", "HL-DT-ST DVDRAM_GSA-H10N" , NULL , 0x10 }, // hh , 2006/02/16 - { "", "HL-DT-ST DVDRAM GSA-H10L" , NULL , 0x10 }, // hh , 2006/02/27 - { "", "HL-DT-ST DVDRAM_GSA-H10L" , NULL , 0x10 }, // hh , 2006/04/21 - { "", "HL-DT-ST DVDRAM GSA-H10A" , NULL , 0x10 }, // hh , 2006/01/03 - { "", "HL-DT-ST DVDRAM_GSA-H10A" , NULL , 0x10 }, // hh , 2006/05/14 - { "", "HL-DT-ST DVD-RW GSA-H11N" , NULL , 0x10 }, // hh , 2006/04/28 - { "", "HL-DT-ST DVD-RW_GSA-H11N" , NULL , 0x10 }, // hh , 2006/02/22 - - { "", "HL-DT-ST DVDRAM GSA-4080N" , NULL , 0x10 }, // slim, 2004/08/08 - { "", "HL-DT-ST DVDRAM GMA-4080N" , NULL , 0x10 }, // slim, 2004/11/09 - { "", "HL-DT-ST DVD-RW GCA-4080N" , NULL , 0x10 }, // slim, 2004/11/22 - { "", "HL-DT-ST DVD-RW GWA-4080N" , NULL , 0x10 }, // slim, 2004/08/17 - { "", "HL-DT-ST DVDRAM GSA-4082N" , NULL , 0x10 }, // slim, 2005/07/12 - { "", "HL-DT-ST DVDRAM_GSA-4082N" , NULL , 0x10 }, // slim, 2005/09/21 - { "", "HL-DT-ST DVDRAM GMA-4082N" , NULL , 0x10 }, // slim, 2005/10/20 - { "", "HL-DT-ST DVD-RW GRA-4082N" , NULL , 0x10 }, // slim, 2006/06/07 - { "", "HL-DT-ST DVD-RW GWA-4082N" , NULL , 0x10 }, // slim, 2005/05/24 - { "", "HL-DT-ST DVDRAM GMA4082Nf" , NULL , 0x10 }, // slim, 2006/02/28 - { "", "HL-DT-ST DVDRAM GMA4082Nj" , NULL , 0x10 }, // slim, 2006/01/26 - - { "", "HL-DT-ST DVDRAM GSA-4084N" , NULL , 0x10 }, // slim, 2005/12/21 - { "", "HL-DT-ST DVDRAM GMA-4084N" , NULL , 0x10 }, // slim, 2006/02/15 - { "", "HP DVD Writer 550s" , NULL , 0x10 }, // slim, 2006/05/08 - { "", "HL-DT-ST DVDRAM GSA-T10N" , NULL , 0x10 }, // slim, 2006/07/26 - { "", "HL-DT-ST DVDRAM_GSA-T10N" , NULL , 0x10 }, // slim, 2006/07/26 - { "", "HL-DT-ST DVD+-RW GSA-T11N" , NULL , 0x10 }, // slim, 2006/07/25 - - { "", "HL-DT-ST DVD-ROM GDR8160B" , NULL , 0x10 }, // hh , 2001/10/12 - { "", "COMPAQ DVD-ROM GDR8160B" , NULL , 0x10 }, // hh , 2001/11/08 - { "", "HL-DT-ST DVD-ROM GDR8161B" , NULL , 0x10 }, // hh , 2002/07/19 - { "", "HL-DT-ST DVD-ROM GDR8162B" , NULL , 0x10 }, // hh , 2003/04/22 - { "", "HL-DT-ST DVD-ROM GDR8163B" , NULL , 0x10 }, // hh , 2004/05/19 - { "", "HL-DT-ST DVD-ROM GDR8164B" , NULL , 0x10 }, // hh , 2005/06/29 - { "", "HL-DT-ST DVD-ROM GDRH10N" , NULL , 0x10 }, // hh , 2006/03/07 - - { "", "HL-DT-ST DVD-ROM GDR8081N" , NULL , 0x10 }, // slim, 2001/08/27 - { "", "HL-DT-ST DVD-ROM GDR8082N" , NULL , 0x10 }, // slim, 2003/02/02 - { "", "HL-DT-ST DVD-ROM GDR8083N" , NULL , 0x10 }, // slim, 2003/02/02 - { "", "HL-DT-ST DVD-ROM GDR8085N" , NULL , 0x10 }, // slim, 2005/11/10 - - { "", "HL-DT-ST RW/DVD GCC-4080N" , NULL , 0x10 }, // slim, 2001/08/21 - { "", "HL-DT-ST RW/DVD_GCC-4080N" , NULL , 0x10 }, // slim, - { "", "HL-DT-ST RW/DVD GCC-4160N" , NULL , 0x10 }, // slim, 2002/04/08 - { "", "HL-DT-ST RW/DVD GCC-4240N" , NULL , 0x10 }, // slim, 2002/04/26 - { "", "HL-DT-ST RW/DVD GCC-4241N" , NULL , 0x10 }, // slim, 2003/04/07 - { "", "HL-DT-ST RW/DVD_GCC-4241N" , NULL , 0x10 }, // slim, 2004/03/07 - { "", "HL-DT-ST RW/DVD GCC-4242N" , NULL , 0x10 }, // slim, 2003/12/21 - { "", "HL-DT-ST RW/DVD GCC-4246N" , NULL , 0x10 }, // slim, 2005/05/23 - { "", "HL-DT-ST BD-RE GBW-H10N" , NULL , 0x10 }, // hh , 2006/06/27 - - { "", "HL-DT-ST DVDRAM GSA-4083N" , NULL , 0x10 }, // hh , 2006/05/17 - { "", "HL-DT-ST DVD+-RW GWA4083N" , NULL , 0x10 }, // hh , 2006/06/05 - - { "", "PIONEER DVD-RW DVR-106D" , NULL , 0x10 }, // hh , ? - { "", "ASUS DVD-RW DRW-0402P" , NULL , 0x10 }, // hh , ? - - - // Sony sourced some drives from LG also.... - - { NULL , NULL , NULL , 0x00 }, -}; - - -#ifdef ALLOC_DATA_PRAGMA -#pragma data_seg() -#endif diff --git a/storage/class/cdrom/src/guid.c b/storage/class/cdrom/src/guid.c deleted file mode 100644 index 8af1f877..00000000 --- a/storage/class/cdrom/src/guid.c +++ /dev/null @@ -1,16 +0,0 @@ -/*-- -Copyright (C) Microsoft Corporation. All rights reserved. ---*/ - -#include "initguid.h" -#include "ntddk.h" -#include "ntddstor.h" -#include "mountmgr.h" -#include "ioevent.h" -#include "devpkey.h" -#include "wdmguid.h" - -// no code, just GUIDs being defined - - - diff --git a/storage/class/cdrom/src/init.c b/storage/class/cdrom/src/init.c deleted file mode 100644 index 0dc176fd..00000000 --- a/storage/class/cdrom/src/init.c +++ /dev/null @@ -1,2740 +0,0 @@ -/*-- - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - init.c - -Abstract: - - Initialization routines for CDROM - -Environment: - - kernel mode only - -Notes: - - -Revision History: - ---*/ - - -#include "ntddk.h" -#include "ntddstor.h" -#include "ntstrsafe.h" -#include "devpkey.h" - -#include "cdrom.h" -#include "scratch.h" -#include "mmc.h" - -#ifdef DEBUG_USE_WPP -#include "init.tmh" -#endif - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceInitAllocateBuffers( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceRetrieveScsiAddress( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSCSI_ADDRESS ScsiAddress - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceRetrieveDescriptorsAndTransferLength( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceScanSpecialDevices( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceInitMmcContext( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceGetMmcSupportInfo( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Out_ PBOOLEAN IsMmcDevice - ); - -#if (NTDDI_VERSION >= NTDDI_WIN8) -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceIsPortable( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Out_ PBOOLEAN IsPortable - ); -#endif - - -#ifdef ALLOC_PRAGMA - -#pragma alloc_text(PAGE, DeviceClaimRelease) -#pragma alloc_text(PAGE, DeviceEvtSelfManagedIoInit) - -#pragma alloc_text(PAGE, DeviceInitReleaseQueueContext) -#pragma alloc_text(PAGE, DeviceInitAllocateBuffers) -#pragma alloc_text(PAGE, DeviceInitPowerContext) -#pragma alloc_text(PAGE, DeviceCreateWellKnownName) -#pragma alloc_text(PAGE, DeviceRetrieveScsiAddress) -#pragma alloc_text(PAGE, DeviceRetrieveDescriptorsAndTransferLength) -#pragma alloc_text(PAGE, DeviceInitializeHotplugInfo) -#pragma alloc_text(PAGE, DeviceScanSpecialDevices) -#pragma alloc_text(PAGE, DeviceGetTimeOutValueFromRegistry) -#pragma alloc_text(PAGE, DeviceGetMmcSupportInfo) -#pragma alloc_text(PAGE, DeviceRetrieveDescriptor) -#pragma alloc_text(PAGE, DeviceRetrieveHackFlagsFromRegistry) -#pragma alloc_text(PAGE, DeviceScanForSpecial) -#pragma alloc_text(PAGE, DeviceHackFlagsScan) -#pragma alloc_text(PAGE, DeviceInitMmcContext) -#pragma alloc_text(PAGE, ScanForSpecialHandler) -#pragma alloc_text(PAGE, DeviceSetRawReadInfo) -#pragma alloc_text(PAGE, DeviceInitializeDvd) -#pragma alloc_text(PAGE, DeviceCacheDeviceInquiryData) - -#if (NTDDI_VERSION >= NTDDI_WIN8) -#pragma alloc_text(PAGE, DeviceIsPortable) -#endif - -#endif - -#pragma warning(push) -#pragma warning(disable:4152) // nonstandard extension, function/data pointer conversion in expression -#pragma warning(disable:26000) // read overflow reported because of pointer type conversion - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceClaimRelease( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN Release - ) -/*++ - -Routine Description: - - This function claims a device in the port driver. The port driver object - is updated with the correct driver object if the device is successfully - claimed. - -Arguments: - - Device - The WDFDEVICE that needs to be claimed or released. - - Release - Indicates the logical unit should be released rather than claimed. - -Return Value: - - Returns a status indicating success or failure of the operation. - ---*/ -{ - NTSTATUS status; - SCSI_REQUEST_BLOCK srb = {0}; - WDF_MEMORY_DESCRIPTOR descriptor; - WDFREQUEST request; - WDF_OBJECT_ATTRIBUTES attributes; - - PAGED_CODE(); - - //Create a request - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, - CDROM_REQUEST_CONTEXT); - - status = WdfRequestCreate(&attributes, - DeviceExtension->IoTarget, - &request); - - if (NT_SUCCESS(status)) - { - //fill up srb structure - srb.OriginalRequest = WdfRequestWdmGetIrp(request); - NT_ASSERT(srb.OriginalRequest != NULL); - - srb.Length = sizeof(SCSI_REQUEST_BLOCK); - - srb.Function = Release - ? SRB_FUNCTION_RELEASE_DEVICE - : SRB_FUNCTION_CLAIM_DEVICE; - - - WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&descriptor, - &srb, - sizeof(srb)); - - status = WdfIoTargetSendInternalIoctlOthersSynchronously(DeviceExtension->IoTarget, - request, - IOCTL_SCSI_EXECUTE_NONE, - &descriptor, - NULL, - NULL, - NULL, - NULL); - - NT_ASSERT(!TEST_FLAG(srb.SrbFlags, SRB_FLAGS_FREE_SENSE_BUFFER)); - - // The request should be deleted. - WdfObjectDelete(request); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_PNP, - "DeviceClaimRelease: Failed to %s device, status: 0x%X\n", - Release ? "Release" : "Claim", - status)); - } - } - else - { - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_PNP, - "DeviceClaimRelease: Failed to create request, status: 0x%X\n", - status)); - } - - if (Release) - { - // We only release the device when we don't want to manage it. - // The failure status does not matter. - status = STATUS_SUCCESS; - } - - return status; -} // end DeviceClaimRelease() - - -NTSTATUS -DeviceEvtSelfManagedIoInit( - _In_ WDFDEVICE Device - ) -/*++ - -Routine Description: - - This routine is called only once after the device is added in system, so it's used to do - hardware-dependent device initialization work and resource allocation. - If this routine fails, DeviceEvtSelfManagedIoCleanup will be invoked by the framework. - -Arguments: - - Device - Handle to device object - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = NULL; - - PAGED_CODE(); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_PNP, - "DeviceEvtSelfManagedIoInit: WDFDEVICE %p is being started.\n", - Device)); - - deviceExtension = DeviceGetExtension(Device); - - // 1. Set/retrieve basic information, some of the following operations may depend on it - if (NT_SUCCESS(status)) - { - // We do not care if this function fails, SCSI address is mainly for debugging/tracing purposes. - (VOID) DeviceRetrieveScsiAddress(deviceExtension, &deviceExtension->ScsiAddress); - } - - if (NT_SUCCESS(status)) - { - status = DeviceRetrieveDescriptorsAndTransferLength(deviceExtension); - } - - if (NT_SUCCESS(status)) - { - // This function should be called after DeviceRetrieveDescriptorsAndTransferLength() - // It depends on MaxTransferLenth fields. - status = DeviceInitAllocateBuffers(deviceExtension); - } - - // 2. The following functions depend on the allocated buffers. - - // perf re-enable after failing. Q: Is this one used by cdrom.sys? - if (NT_SUCCESS(status)) - { - // allow perf to be re-enabled after a given number of failed IOs - // require this number to be at least CLASS_PERF_RESTORE_MINIMUM - ULONG t = CLASS_PERF_RESTORE_MINIMUM; - - DeviceGetParameter(deviceExtension, - CLASSP_REG_SUBKEY_NAME, - CLASSP_REG_PERF_RESTORE_VALUE_NAME, - &t); - if (t >= CLASS_PERF_RESTORE_MINIMUM) - { - deviceExtension->PrivateFdoData->Perf.ReEnableThreshhold = t; - } - } - - // 3. Retrieve information about special devices and hack flags. - if (NT_SUCCESS(status)) - { - DeviceRetrieveHackFlagsFromRegistry(deviceExtension); - // scan for bad items. - DeviceScanForSpecial(deviceExtension, CdRomBadItems, DeviceHackFlagsScan); - // Check to see if it's a special device that needs special error process. - DeviceScanSpecialDevices(deviceExtension); // may send command to device - } - - // 4. Initialize the hotplug information only after the ScanForSpecial routines, - // as it relies upon the hack flags - deviceExtension->PrivateFdoData->HackFlags. - if (NT_SUCCESS(status)) - { - status = DeviceInitializeHotplugInfo(deviceExtension); - } - - if (NT_SUCCESS(status)) - { - // cache the device's inquiry data - status = DeviceCacheDeviceInquiryData(deviceExtension); - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "Failed to cache the device's inquiry data, failng %!STATUS!\n", - status - )); - } - } - - // 5. Initialize MMC context, media change notification stuff and read media capacity - if (NT_SUCCESS(status)) - { - status = DeviceInitializeMediaChangeDetection(deviceExtension); - } - if (NT_SUCCESS(status)) - { - status = DeviceInitMmcContext(deviceExtension); - } - if (NT_SUCCESS(status)) - { - status = DeviceInitializeZPODD(deviceExtension); - } - if (NT_SUCCESS(status)) - { - // Do READ CAPACITY. This SCSI command returns the last sector address - // on the device and the bytes per sector. These are used to calculate - // the drive capacity in bytes. - status = MediaReadCapacity(Device); - - // If READ CAPACITY succeeded, we can safely conclude that there is a media present - if (NT_SUCCESS(status)) - { - DeviceSetMediaChangeStateEx(deviceExtension, - MediaPresent, - NULL); - } - - // READ CAPACITY is not critical for init, ignore all errors occuring during its execution - status = STATUS_SUCCESS; - } - - // 6. Perform DVD-specific initialization - if (NT_SUCCESS(status)) - { - status = DeviceInitializeDvd(Device); - } - - // 7. Miscellaneous initialization actions - if (NT_SUCCESS(status)) - { - if (deviceExtension->PrivateFdoData != NULL) - { - deviceExtension->PrivateFdoData->Perf.OriginalSrbFlags = deviceExtension->SrbFlags; - } - - if (deviceExtension->DeviceAdditionalData.Mmc.IsWriter) - { - // OPC can really take this long per IMAPIv1 timeout.... - deviceExtension->TimeOutValue = max(deviceExtension->TimeOutValue, SCSI_CDROM_OPC_TIMEOUT); - } - } - - // 8. Enable the main timer, create ARC name as needed - if (NT_SUCCESS(status)) - { - // Device successfully added and initialized, increase CdRomCount. - IoGetConfigurationInformation()->CdRomCount++; - - deviceExtension->IsInitialized = TRUE; - - DeviceEnableMainTimer(deviceExtension); - - } - -#if (NTDDI_VERSION >= NTDDI_WIN8) - // 9. Set volume interface properties - if (NT_SUCCESS(status)) - { - BOOLEAN isCritical = FALSE; - BOOLEAN isPortable = FALSE; - BOOLEAN isRemovable = TEST_FLAG(deviceExtension->DeviceObject->Characteristics, FILE_REMOVABLE_MEDIA); - DEVPROP_BOOLEAN propCritical = DEVPROP_FALSE; - DEVPROP_BOOLEAN propPortable = DEVPROP_FALSE; - DEVPROP_BOOLEAN propRemovable = DEVPROP_FALSE; - - status = DeviceIsPortable(deviceExtension, &isPortable); - - if (NT_SUCCESS(status)) - { - if (isPortable) { - SET_FLAG(deviceExtension->DeviceObject->Characteristics, FILE_PORTABLE_DEVICE); - } - - propPortable = isPortable ? DEVPROP_TRUE : DEVPROP_FALSE; - - status = IoSetDeviceInterfacePropertyData(&deviceExtension->MountedDeviceInterfaceName, - &DEVPKEY_Storage_Portable, - 0, - 0, - DEVPROP_TYPE_BOOLEAN, - sizeof(DEVPROP_BOOLEAN), - &propPortable); - } - - if (NT_SUCCESS(status)) - { - propRemovable = isRemovable ? DEVPROP_TRUE : DEVPROP_FALSE; - - status = IoSetDeviceInterfacePropertyData(&deviceExtension->MountedDeviceInterfaceName, - &DEVPKEY_Storage_Removable_Media, - 0, - 0, - DEVPROP_TYPE_BOOLEAN, - sizeof(DEVPROP_BOOLEAN), - &propRemovable); - } - - if (NT_SUCCESS(status)) - { - isCritical = TEST_FLAG(deviceExtension->DeviceObject->Flags, - (DO_SYSTEM_SYSTEM_PARTITION | - DO_SYSTEM_BOOT_PARTITION | - DO_SYSTEM_CRITICAL_PARTITION)); - - propCritical = isCritical ? DEVPROP_TRUE : DEVPROP_FALSE; - - status = IoSetDeviceInterfacePropertyData(&deviceExtension->MountedDeviceInterfaceName, - &DEVPKEY_Storage_System_Critical, - 0, - 0, - DEVPROP_TYPE_BOOLEAN, - sizeof(DEVPROP_BOOLEAN), - &propCritical); - } - - } -#endif - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceInitReleaseQueueContext( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - Part of device initialize routine. Initialize ReleaseQueue related stuff. - -Arguments: - - DeviceExtension - device extension of WDFDEVICE. - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - WDF_OBJECT_ATTRIBUTES attributes; - - PAGED_CODE(); - - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, - CDROM_REQUEST_CONTEXT); - attributes.ParentObject = DeviceExtension->Device; - - status = WdfRequestCreate(&attributes, - DeviceExtension->IoTarget, - &(DeviceExtension->ReleaseQueueRequest)); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_PNP, "Cannot create the release queue request\n")); - - return status; - } - - // Initialize ReleaseQueueInputMemory, a wrapper around ReleaseQueueSrb - WDF_OBJECT_ATTRIBUTES_INIT(&attributes); - attributes.ParentObject = DeviceExtension->ReleaseQueueRequest; - - status = WdfMemoryCreatePreallocated(&attributes, - &DeviceExtension->ReleaseQueueSrb, - sizeof(SCSI_REQUEST_BLOCK), - &DeviceExtension->ReleaseQueueInputMemory); - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_PNP, "Failed to allocate ReleaseQueueSrb.\n")); - - return status; - } - - // Preformat the release queue request here to ensure that this call will never - // fail during an actual release of the queue. - if (NT_SUCCESS(status)) - { - status = WdfIoTargetFormatRequestForInternalIoctlOthers(DeviceExtension->IoTarget, - DeviceExtension->ReleaseQueueRequest, - IOCTL_SCSI_EXECUTE_NONE, - DeviceExtension->ReleaseQueueInputMemory, - NULL, - NULL, - NULL, - NULL, - NULL); - } - - // Set a CompletionRoutine callback function for ReleaseQueueRequest. - if (NT_SUCCESS(status)) - { - WdfRequestSetCompletionRoutine(DeviceExtension->ReleaseQueueRequest, - DeviceReleaseQueueCompletion, - DeviceExtension->Device); - } - - // Create a spinlock for ReleaseQueueRequest - WDF_OBJECT_ATTRIBUTES_INIT(&attributes); - attributes.ParentObject = DeviceExtension->Device; - - status = WdfSpinLockCreate(&attributes, - &(DeviceExtension->ReleaseQueueSpinLock)); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_PNP, - "DeviceInitReleaseQueueContext: Cannot create the release queue spinlock\n")); - - return status; - } - - // Initialize miscellaneous ReleaseQueue related fields - DeviceExtension->ReleaseQueueNeeded = FALSE; - DeviceExtension->ReleaseQueueInProgress = FALSE; - DeviceExtension->ReleaseQueueSrb.Length = sizeof(SCSI_REQUEST_BLOCK); - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceInitPowerContext( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - Part of device initialize routine. Initialize PowerContext related stuff. - -Arguments: - - DeviceExtension - device extension of WDFDEVICE. - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - WDF_OBJECT_ATTRIBUTES attributes; - - PAGED_CODE(); - - // create request object for Power operations - - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, - CDROM_REQUEST_CONTEXT); - attributes.ParentObject = DeviceExtension->Device; - - status = WdfRequestCreate(&attributes, - DeviceExtension->IoTarget, - &(DeviceExtension->PowerContext.PowerRequest) ); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_PNP, "Cannot create the power request object.\n")); - - return status; - } - - // Preformat the power request. With this being done, we never need to worry about - // WdfIoTargetFormatRequestForInternalIoctlOthers ever failing later. - status = WdfIoTargetFormatRequestForInternalIoctlOthers(DeviceExtension->IoTarget, - DeviceExtension->PowerContext.PowerRequest, - IOCTL_SCSI_EXECUTE_IN, - NULL, NULL, - NULL, NULL, - NULL, NULL); - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceCreateWellKnownName( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - This routine creates a symbolic link to the cdrom device object - under \dosdevices. The number of the cdrom device does not neccessarily - match between \dosdevices and \device, but usually will be the same. - - Saves the buffer - -Arguments: - - DeviceObject - - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - UNICODE_STRING unicodeLinkName = {0}; - WCHAR wideLinkName[64] = {0}; - PWCHAR savedName; - - LONG cdromNumber = DeviceExtension->DeviceNumber; - - PAGED_CODE(); - - // if already linked, assert then return - if (DeviceExtension->DeviceAdditionalData.WellKnownName.Buffer != NULL) - { - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_INIT, - "DeviceCreateWellKnownName: link already exists %p\n", - DeviceExtension->DeviceAdditionalData.WellKnownName.Buffer)); - - NT_ASSERT(FALSE); - - return STATUS_UNSUCCESSFUL; - } - - // find an unused CdRomNN to link to. - // It's doing this way because the same might be used for other device in another driver. - do - { - status = RtlStringCchPrintfW((NTSTRSAFE_PWSTR)wideLinkName, - RTL_NUMBER_OF(wideLinkName), - L"\\DosDevices\\CdRom%d", - cdromNumber); - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_INIT, - "DeviceCreateWellKnownName: Format symbolic link failed with error: 0x%X\n", status)); - return status; - } - - RtlInitUnicodeString(&unicodeLinkName, wideLinkName); - - status = WdfDeviceCreateSymbolicLink(DeviceExtension->Device, - &unicodeLinkName); - - cdromNumber++; - - } while((status == STATUS_OBJECT_NAME_COLLISION) || - (status == STATUS_OBJECT_NAME_EXISTS)); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_INIT, - "DeviceCreateWellKnownName: Error %lx linking %wZ to " - "device %wZ\n", - status, - &unicodeLinkName, - &(DeviceExtension->DeviceName))); - return status; - } - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceCreateWellKnownName: successfully linked %wZ " - "to device %wZ\n", - &unicodeLinkName, - &(DeviceExtension->DeviceName))); - - // Save away the symbolic link name in the driver data block. We need - // it so we can delete the link when the device is removed. - savedName = ExAllocatePool2(POOL_FLAG_PAGED, - unicodeLinkName.MaximumLength, - CDROM_TAG_STRINGS); - - if (savedName == NULL) - { - // Test Note: test path should excise here to see if the symbolic is deleted by framework. - // IoDeleteSymbolicLink(&unicodeLinkName); - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "DeviceCreateWellKnownName: unable to allocate memory.\n")); - - return STATUS_INSUFFICIENT_RESOURCES; - } - - RtlZeroMemory(savedName, unicodeLinkName.MaximumLength); - RtlCopyMemory(savedName, unicodeLinkName.Buffer, unicodeLinkName.MaximumLength); - - RtlInitUnicodeString(&(DeviceExtension->DeviceAdditionalData.WellKnownName), savedName); - - // the name was saved and the link created - - return STATUS_SUCCESS; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceRetrieveScsiAddress( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSCSI_ADDRESS ScsiAddress - ) -/*++ - -Routine Description: - - retrieve SCSI address information and put into device extension - -Arguments: - - DeviceExtension - device context. - ScsiAddress - the buffer to put the scsi address info. - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status; - WDF_MEMORY_DESCRIPTOR outputDescriptor; - - PAGED_CODE(); - - if ((DeviceExtension == NULL) || - (ScsiAddress == NULL)) - { - return STATUS_INVALID_PARAMETER; - } - - //Get IOTARGET for sending request to port driver. - WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&outputDescriptor, - (PVOID)ScsiAddress, - sizeof(SCSI_ADDRESS)); - - status = WdfIoTargetSendIoctlSynchronously(DeviceExtension->IoTarget, - NULL, - IOCTL_SCSI_GET_ADDRESS, - NULL, - &outputDescriptor, - NULL, - NULL); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "DeviceRetrieveScsiAddress: Get Address failed %lx\n", - status)); - } - else - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "GetAddress: Port %x, Path %x, Target %x, Lun %x\n", - ScsiAddress->PortNumber, - ScsiAddress->PathId, - ScsiAddress->TargetId, - ScsiAddress->Lun)); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceInitAllocateBuffers( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - Part of device initialize routine. - Allocate all buffers in Device Extension. - -Arguments: - - DeviceExtension - device extension of WDFDEVICE. - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PVOID senseData = NULL; - - PAGED_CODE(); - - // allocate a private extension for class data - if (DeviceExtension->PrivateFdoData == NULL) - { - DeviceExtension->PrivateFdoData = ExAllocatePool2(POOL_FLAG_NON_PAGED, - sizeof(CDROM_PRIVATE_FDO_DATA), - CDROM_TAG_PRIVATE_DATA); - } - - if (DeviceExtension->PrivateFdoData == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - else - { - // initialize the struct's various fields. - RtlZeroMemory(DeviceExtension->PrivateFdoData, sizeof(CDROM_PRIVATE_FDO_DATA)); - } - - // Allocate request sense buffer. - senseData = ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED, - SENSE_BUFFER_SIZE, - CDROM_TAG_SENSE_INFO); - - if (senseData == NULL) - { - // The buffer cannot be allocated. - status = STATUS_INSUFFICIENT_RESOURCES; - } - else - { - // Set the sense data pointer in the device extension. - DeviceExtension->SenseData = senseData; - } - - // Allocate scratch buffer -- Must occur after determining - // max transfer size, but before other CD specific detection - // (which relies upon this buffer). - if (!ScratchBuffer_Allocate(DeviceExtension)) - { - status = STATUS_INSUFFICIENT_RESOURCES; - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "Failed to allocate scratch buffer, failing %!STATUS!\n", - status - )); - } - - return status; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceRetrieveDescriptorsAndTransferLength( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - Part of device initialize routine. - Retrieve Device Descriptor and Adaptor Descriptor. - -Arguments: - - DeviceExtension - device extension of WDFDEVICE. - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - STORAGE_PROPERTY_ID propertyId; - - PAGED_CODE(); - - if (NT_SUCCESS(status)) - { - // Call port driver to get adapter capabilities. - propertyId = StorageAdapterProperty; - - status = DeviceRetrieveDescriptor(DeviceExtension->Device, - &propertyId, - (PSTORAGE_DESCRIPTOR_HEADER*)&DeviceExtension->AdapterDescriptor); - } - if (NT_SUCCESS(status)) - { - // Call port driver to get device descriptor. - propertyId = StorageDeviceProperty; - - status = DeviceRetrieveDescriptor(DeviceExtension->Device, - &propertyId, - (PSTORAGE_DESCRIPTOR_HEADER*)&DeviceExtension->DeviceDescriptor); - } - if (NT_SUCCESS(status)) - { - // Call port driver to get device power property. - // Not all port drivers support this property, and it's not fatal if this query fails. - propertyId = StorageDevicePowerProperty; - - (void) DeviceRetrieveDescriptor(DeviceExtension->Device, - &propertyId, - (PSTORAGE_DESCRIPTOR_HEADER*)&DeviceExtension->PowerDescriptor); - } - - if (NT_SUCCESS(status)) - { - // Determine the maximum page-aligned and non-page-aligned transfer - // lengths here, so we needn't do this in common READ/WRITE code paths - - // start with the number of pages the adapter can support - ULONG maxAlignedTransfer = DeviceExtension->AdapterDescriptor->MaximumPhysicalPages; - ULONG maxUnalignedTransfer = DeviceExtension->AdapterDescriptor->MaximumPhysicalPages; - - - // Unaligned buffers could cross a page boundary. - if (maxUnalignedTransfer > 1) - { - maxUnalignedTransfer--; - } - - // if we'd overflow multiplying by page size, just max out the - // transfer length allowed by the number of pages limit. - if (maxAlignedTransfer >= (((ULONG)-1) / PAGE_SIZE)) - { - maxAlignedTransfer = (ULONG)-1; - } - else - { - maxAlignedTransfer *= PAGE_SIZE; - } - - if (maxUnalignedTransfer >= (((ULONG)-1) / PAGE_SIZE)) - { - maxUnalignedTransfer = (ULONG)-1; - } - else - { - maxUnalignedTransfer *= PAGE_SIZE; - } - - // finally, take the smaller of the above and the adapter's - // reported maximum number of bytes per transfer. - maxAlignedTransfer = min(maxAlignedTransfer, DeviceExtension->AdapterDescriptor->MaximumTransferLength); - maxUnalignedTransfer = min(maxUnalignedTransfer, DeviceExtension->AdapterDescriptor->MaximumTransferLength); - - // Make sure the values are reasonable and not zero. - maxAlignedTransfer = max(maxAlignedTransfer, PAGE_SIZE); - maxUnalignedTransfer = max(maxUnalignedTransfer, PAGE_SIZE); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "Device %p Max aligned/unaligned transfer size is %x/%x\n", - DeviceExtension->Device, - maxAlignedTransfer, - maxUnalignedTransfer - )); - DeviceExtension->DeviceAdditionalData.MaxPageAlignedTransferBytes = maxAlignedTransfer; - DeviceExtension->DeviceAdditionalData.MaxUnalignedTransferBytes = maxUnalignedTransfer; - } - else - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_PNP, "DeviceRetrieveDescriptorsAndTransferLength failed %lx\n", status)); - } - - return status; -} - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceRetrieveDescriptor( - _In_ WDFDEVICE Device, - _In_ PSTORAGE_PROPERTY_ID PropertyId, - _Outptr_ PSTORAGE_DESCRIPTOR_HEADER* Descriptor - ) -/*++ - -Routine Description: - - This routine will perform a query for the specified property id and will - allocate a non-paged buffer to store the data in. It is the responsibility - of the caller to ensure that this buffer is freed. - - This routine must be run at IRQL_PASSIVE_LEVEL - -Arguments: - - Device - the device object - PropertyId - type of property to retrieve - Descriptor - buffer allocated in this function to hold the descriptor data - -Return Value: - - status - ---*/ -{ - NTSTATUS status; - WDF_MEMORY_DESCRIPTOR memoryDescriptor; - - STORAGE_PROPERTY_QUERY query = {0}; - ULONG bufferLength = 0; - - PSTORAGE_DESCRIPTOR_HEADER descriptor = NULL; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - - PAGED_CODE(); - - // Set the passed-in descriptor pointer to NULL as default - *Descriptor = NULL; - - // On the first pass we just want to get the first few - // bytes of the descriptor so we can read it's size - query.PropertyId = *PropertyId; - query.QueryType = PropertyStandardQuery; - - descriptor = (PVOID)&query; - - NT_ASSERT(sizeof(STORAGE_PROPERTY_QUERY) >= (sizeof(ULONG)*2)); - - WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&memoryDescriptor, - (PVOID)&query, - sizeof(STORAGE_PROPERTY_QUERY)); - - status = WdfIoTargetSendIoctlSynchronously(deviceExtension->IoTarget, - NULL, - IOCTL_STORAGE_QUERY_PROPERTY, - &memoryDescriptor, - &memoryDescriptor, - NULL, - NULL); - - if(!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_INIT, "DeviceRetrieveDescriptor: error %lx trying to " - "query properties #1\n", status)); - return status; - } - - if (descriptor->Size == 0) - { - // This DebugPrint is to help third-party driver writers - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_INIT, "DeviceRetrieveDescriptor: size returned was zero?! (status " - "%x\n", status)); - return STATUS_UNSUCCESSFUL; - } - - // This time we know how much data there is so we can - // allocate a buffer of the correct size - bufferLength = descriptor->Size; - NT_ASSERT(bufferLength >= sizeof(STORAGE_PROPERTY_QUERY)); - bufferLength = max(bufferLength, sizeof(STORAGE_PROPERTY_QUERY)); - - descriptor = ExAllocatePool2(POOL_FLAG_NON_PAGED, bufferLength, CDROM_TAG_DESCRIPTOR); - - if(descriptor == NULL) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_INIT, "DeviceRetrieveDescriptor: unable to memory for descriptor " - "(%d bytes)\n", bufferLength)); - return STATUS_INSUFFICIENT_RESOURCES; - } - - // setup the query again, as it was overwritten above - RtlZeroMemory(&query, sizeof(STORAGE_PROPERTY_QUERY)); - query.PropertyId = *PropertyId; - query.QueryType = PropertyStandardQuery; - - // copy the input to the new outputbuffer - RtlCopyMemory(descriptor, - &query, - sizeof(STORAGE_PROPERTY_QUERY)); - - WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&memoryDescriptor, - (PVOID)descriptor, - bufferLength); - - status = WdfIoTargetSendIoctlSynchronously(deviceExtension->IoTarget, - NULL, - IOCTL_STORAGE_QUERY_PROPERTY, - &memoryDescriptor, - &memoryDescriptor, - NULL, - NULL); - - if(!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_INIT, "DeviceRetrieveDescriptor: error %lx trying to " - "query properties #1\n", status)); - FREE_POOL(descriptor); - - return status; - } - - // return the memory we've allocated to the caller - *Descriptor = descriptor; - - return status; -} // end DeviceRetrieveDescriptor() - -_IRQL_requires_max_(PASSIVE_LEVEL) -VOID -DeviceRetrieveHackFlagsFromRegistry( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - try to retrieve hack flages from registry and put the information in - device extension. - -Arguments: - - DeviceExtension - the device context - -Return Value: - - none - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - WDFKEY hardwareKey = NULL; - WDFKEY subKey = NULL; - ULONG deviceHacks = 0; - - DECLARE_CONST_UNICODE_STRING(subKeyName, CLASSP_REG_SUBKEY_NAME); - DECLARE_CONST_UNICODE_STRING(valueName, CLASSP_REG_HACK_VALUE_NAME); - - PAGED_CODE(); - - status = WdfDeviceOpenRegistryKey(DeviceExtension->Device, - PLUGPLAY_REGKEY_DEVICE, - KEY_READ, - WDF_NO_OBJECT_ATTRIBUTES, - &hardwareKey); - if (NT_SUCCESS(status)) - { - status = WdfRegistryOpenKey(hardwareKey, - &subKeyName, - KEY_READ, - WDF_NO_OBJECT_ATTRIBUTES, - &subKey); - - if (NT_SUCCESS(status)) - { - status = WdfRegistryQueryULong(subKey, - &valueName, - &deviceHacks); - if (NT_SUCCESS(status)) - { - // remove unknown values and save... - CLEAR_FLAG(deviceHacks, FDO_HACK_INVALID_FLAGS); - SET_FLAG(DeviceExtension->PrivateFdoData->HackFlags, deviceHacks); - } - - WdfRegistryClose(subKey); - } - - WdfRegistryClose(hardwareKey); - } - - - // - // we should modify the system hive to include another key for us to grab - // settings from. in this case: Classpnp\HackFlags - // - // the use of a DWORD value for the HackFlags allows 32 hacks w/o - // significant use of the registry, and also reduces OEM exposure. - // - // definition of bit flags: - // 0x00000001 -- Device succeeds PREVENT_MEDIUM_REMOVAL, but - // cannot actually prevent removal. - // 0x00000002 -- Device hard-hangs or times out for GESN requests. - // 0x00000008 -- Device does not support RESERVE(6) and RELEASE(6). - // 0x00000010 -- Device may incorrecly report operational changes in GESN. - // 0x00000020 -- Device does not support streaming READ(12) / WRITE(12). - // 0x00000040 -- Device does not support asynchronous notification. - // 0xffffff80 -- Currently reserved, may be used later. - // - - return; -} - -_IRQL_requires_max_(APC_LEVEL) -VOID DeviceScanForSpecial( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ CDROM_SCAN_FOR_SPECIAL_INFO DeviceList[], - _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function) -/*++ - -Routine Description: - - scan the list of devices that should be hacked or not supported. - -Arguments: - - DeviceExtension - the device context - DeviceList - the device list - Function - function used to scan from the list. - -Return Value: - - none - ---*/ -{ - PSTORAGE_DEVICE_DESCRIPTOR deviceDescriptor; - PUCHAR vendorId; - PUCHAR productId; - PUCHAR productRevision; - UCHAR nullString[] = ""; - - PAGED_CODE(); - NT_ASSERT(DeviceList); - NT_ASSERT(Function); - - if (DeviceList == NULL) - { - return; - } - if (Function == NULL) - { - return; - } - - deviceDescriptor = DeviceExtension->DeviceDescriptor; - - // SCSI sets offsets to -1, ATAPI sets to 0. check for both. - if (deviceDescriptor->VendorIdOffset != 0 && - deviceDescriptor->VendorIdOffset != -1) - { - vendorId = ((PUCHAR)deviceDescriptor); - vendorId += deviceDescriptor->VendorIdOffset; - } - else - { - vendorId = nullString; - } - - if (deviceDescriptor->ProductIdOffset != 0 && - deviceDescriptor->ProductIdOffset != -1) - { - productId = ((PUCHAR)deviceDescriptor); - productId += deviceDescriptor->ProductIdOffset; - } - else - { - productId = nullString; - } - - if (deviceDescriptor->ProductRevisionOffset != 0 && - deviceDescriptor->ProductRevisionOffset != -1) - { - productRevision = ((PUCHAR)deviceDescriptor); - productRevision += deviceDescriptor->ProductRevisionOffset; - } - else - { - productRevision = nullString; - } - - // loop while the device list is valid (not null-filled) - for (;(DeviceList->VendorId != NULL || - DeviceList->ProductId != NULL || - DeviceList->ProductRevision != NULL); DeviceList++) - { - if (StringsAreMatched(DeviceList->VendorId, (LPSTR)vendorId) && - StringsAreMatched(DeviceList->ProductId, (LPSTR)productId) && - StringsAreMatched(DeviceList->ProductRevision, (LPSTR)productRevision) - ) - { - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, "DeviceScanForSpecial: Found matching " - "controller Ven: %s Prod: %s Rev: %s\n", - (LPCSTR)vendorId, (LPCSTR)productId, (LPCSTR)productRevision)); - - // pass the context to the call back routine and exit - (Function)(DeviceExtension, DeviceList->Data); - - // for CHK builds, try to prevent wierd stacks by having a debug - // print here. it's a hack, but i know of no other way to prevent - // the stack from being wrong. - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, "DeviceScanForSpecial: " - "completed callback\n")); - return; - - } // else the strings did not match - - } // none of the devices matched. - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, "DeviceScanForSpecial: no match found for %p\n", - DeviceExtension->DeviceObject)); - return; - -} // end DeviceScanForSpecial() - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceHackFlagsScan( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ ULONG_PTR Data - ) -{ - PAGED_CODE(); - - // remove invalid flags and save - CLEAR_FLAG(Data, FDO_HACK_INVALID_FLAGS); - SET_FLAG(DeviceExtension->PrivateFdoData->HackFlags, Data); - - return; -} - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceInitializeHotplugInfo( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - Retrieve information into struc STORAGE_HOTPLUG_INFO in DeviceExtension - initialize the hotplug information only after the ScanForSpecial routines, - as it relies upon the hack flags - DeviceExtension->PrivateFdoData->HackFlags. - -Arguments: - - DeviceExtension - the device context - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_PRIVATE_FDO_DATA fdoData = DeviceExtension->PrivateFdoData; - DEVICE_REMOVAL_POLICY deviceRemovalPolicy = 0; - ULONG resultLength = 0; - ULONG writeCacheOverride; - - PAGED_CODE(); - - // start with some default settings - RtlZeroMemory(&(fdoData->HotplugInfo), sizeof(STORAGE_HOTPLUG_INFO)); - - // set the size (aka version) - fdoData->HotplugInfo.Size = sizeof(STORAGE_HOTPLUG_INFO); - - // set if the device has removable media - if (DeviceExtension->DeviceDescriptor->RemovableMedia) - { - fdoData->HotplugInfo.MediaRemovable = TRUE; - } - else - { - fdoData->HotplugInfo.MediaRemovable = FALSE; - } - - // - // this refers to devices which, for reasons not yet understood, - // do not fail PREVENT_MEDIA_REMOVAL requests even though they - // have no way to lock the media into the drive. this allows - // the filesystems to turn off delayed-write caching for these - // devices as well. - // - - if (TEST_FLAG(DeviceExtension->PrivateFdoData->HackFlags, FDO_HACK_CANNOT_LOCK_MEDIA)) - { - fdoData->HotplugInfo.MediaHotplug = TRUE; - } - else - { - fdoData->HotplugInfo.MediaHotplug = FALSE; - } - - // Query the default removal policy from the kernel - status = WdfDeviceQueryProperty(DeviceExtension->Device, - DevicePropertyRemovalPolicy, - sizeof(DEVICE_REMOVAL_POLICY), - (PVOID)&deviceRemovalPolicy, - &resultLength); - if (NT_SUCCESS(status)) - { - if (resultLength != sizeof(DEVICE_REMOVAL_POLICY)) - { - status = STATUS_UNSUCCESSFUL; - } - } - - if (NT_SUCCESS(status)) - { - // Look into the registry to see if the user has chosen - // to override the default setting for the removal policy. - // User can override only if the default removal policy is - // orderly or suprise removal. - - if ((deviceRemovalPolicy == RemovalPolicyExpectOrderlyRemoval) || - (deviceRemovalPolicy == RemovalPolicyExpectSurpriseRemoval)) - { - DEVICE_REMOVAL_POLICY userRemovalPolicy = 0; - - DeviceGetParameter(DeviceExtension, - CLASSP_REG_SUBKEY_NAME, - CLASSP_REG_REMOVAL_POLICY_VALUE_NAME, - (PULONG)&userRemovalPolicy); - - // Validate the override value and use it only if it is an - // allowed value. - if ((userRemovalPolicy == RemovalPolicyExpectOrderlyRemoval) || - (userRemovalPolicy == RemovalPolicyExpectSurpriseRemoval)) - { - deviceRemovalPolicy = userRemovalPolicy; - } - } - - // use this info to set the DeviceHotplug setting - // don't rely on DeviceCapabilities, since it can't properly - // determine device relations, etc. let the kernel figure this - // stuff out instead. - if (deviceRemovalPolicy == RemovalPolicyExpectSurpriseRemoval) - { - fdoData->HotplugInfo.DeviceHotplug = TRUE; - } - else - { - fdoData->HotplugInfo.DeviceHotplug = FALSE; - } - - // this refers to the *filesystem* caching, but has to be included - // here since it's a per-device setting. this may change to be - // stored by the system in the future. - writeCacheOverride = FALSE; - DeviceGetParameter(DeviceExtension, - CLASSP_REG_SUBKEY_NAME, - CLASSP_REG_WRITE_CACHE_VALUE_NAME, - &writeCacheOverride); - - if (writeCacheOverride) - { - fdoData->HotplugInfo.WriteCacheEnableOverride = TRUE; - } - else - { - fdoData->HotplugInfo.WriteCacheEnableOverride = FALSE; - } - } - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_INIT, "Could not initialize hotplug information %lx\n", status)); - } - - return status; -} - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceInitMmcContext( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - This routine initializes and populates the internal data structures that are - used to discover various MMC-defined capabilities of the device. - - This routine will not clean up allocate resources if it fails - that - is left for device stop/removal routines - -Arguments: - - DeviceExtension - device extension - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - PAGED_CODE(); - - DeviceExtension->DeviceAdditionalData.Mmc.IsMmc = FALSE; - DeviceExtension->DeviceAdditionalData.Mmc.IsAACS = FALSE; - DeviceExtension->DeviceAdditionalData.Mmc.IsWriter = FALSE; - DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed = FALSE; - DeviceExtension->DeviceAdditionalData.Mmc.IsCssDvd = FALSE; - DeviceExtension->DeviceAdditionalData.DriveDeviceType = FILE_DEVICE_CD_ROM; - - // Determine if the drive is MMC-Capable - if (NT_SUCCESS(status)) - { - status = DeviceGetMmcSupportInfo(DeviceExtension, - &DeviceExtension->DeviceAdditionalData.Mmc.IsMmc); - - if (!NT_SUCCESS(status)) - { - //Currently, only low resource error comes here. - //That is a success case for unsupporting this command. - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "DeviceInitMmcContext: Failed to get the support info for GET CONFIGURATION " - "command, failng %!STATUS!\n", status - )); - - DeviceExtension->DeviceAdditionalData.Mmc.IsMmc = FALSE; - status = STATUS_SUCCESS; - } - } - - if (NT_SUCCESS(status) && DeviceExtension->DeviceAdditionalData.Mmc.IsMmc) - { - // the drive supports at least a subset of MMC commands - // (and therefore supports READ_CD, etc...) - - // allocate a buffer for all the capabilities and such - status = DeviceAllocateMmcResources(DeviceExtension->Device); - } - - if (NT_SUCCESS(status) && DeviceExtension->DeviceAdditionalData.Mmc.IsMmc) - { - PFEATURE_HEADER header = NULL; - FEATURE_NUMBER validationSchema; - ULONG blockingFactor; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceInitMmcContext: FDO %p GET CONFIGURATION buffer %p\n", - DeviceExtension->Device, - DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer - )); - - // Update several properties using the retrieved Configuration Data. - - // print all the feature pages (DBG only) - DevicePrintAllFeaturePages(DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer, - DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBufferSize); - - // if AACS feature exists, enable AACS flag in the driver - header = DeviceFindFeaturePage(DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer, - DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBufferSize, - FeatureAACS); - if (header) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceInitMmcContext: Reporting AACS support for device due to " - "GET CONFIGURATION showing support\n" - )); - DeviceExtension->DeviceAdditionalData.Mmc.IsAACS = TRUE; - } - -#ifdef ENABLE_AACS_TESTING - DeviceExtension->DeviceAdditionalData.Mmc.IsAACS = TRUE; // just force it true for testing -#endif // ENABLE_AACS_TESTING - - // Check if it's a DVD device - header = DeviceFindFeaturePage(DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer, - DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBufferSize, - FeatureDvdRead); - if (header != NULL) - { - DeviceExtension->DeviceAdditionalData.DriveDeviceType = FILE_DEVICE_DVD; - } - - // check if drive is writer - DeviceUpdateMmcWriteCapability(DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer, - DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBufferSize, - FALSE, //Check if the drive has the ability to write. - (PBOOLEAN)&(DeviceExtension->DeviceAdditionalData.Mmc.IsWriter), - &validationSchema, - &blockingFactor); - - // check if there is a CSS protected DVD or CPPM-protected DVDAudio media in drive. - header = DeviceFindFeaturePage(DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer, - DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBufferSize, - FeatureDvdCSS); - - DeviceExtension->DeviceAdditionalData.Mmc.IsCssDvd = (header != NULL) && (header->Current); - - // Flag the StartIo routine to update its state and hook in the error handler - DeviceExtension->DeviceAdditionalData.Mmc.UpdateState = CdromMmcUpdateRequired; - DeviceExtension->DeviceAdditionalData.ErrorHandler = DeviceErrorHandlerForMmc; - - SET_FLAG(DeviceExtension->DeviceFlags, DEV_SAFE_START_UNIT); - - // Read the CDROM mode sense page to get additional info for raw read requests. - // only valid for MMC devices - DeviceSetRawReadInfo(DeviceExtension); - } - - // Set Read-Only device flag for non-MMC device. - if (!(DeviceExtension->DeviceAdditionalData.Mmc.IsMmc)) - { - ULONG deviceCharacteristics = WdfDeviceGetCharacteristics(DeviceExtension->Device); - - deviceCharacteristics |= FILE_READ_ONLY_DEVICE; - - WdfDeviceSetCharacteristics(DeviceExtension->Device, deviceCharacteristics); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceInitMmcContext: FDO %p Device is not an MMC compliant device, so setting " - "to read-only (legacy) mode", - DeviceExtension->Device - )); - } - - // Set DEV_SAFE_START_UNIT flag for newer devices. - if (DeviceExtension->DeviceAdditionalData.DriveDeviceType == FILE_DEVICE_DVD) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceInitMmcContext: DVD Devices require START UNIT\n")); - SET_FLAG(DeviceExtension->DeviceFlags, DEV_SAFE_START_UNIT); - - } - else if ((DeviceExtension->DeviceDescriptor->BusType != BusTypeScsi) && - (DeviceExtension->DeviceDescriptor->BusType != BusTypeAtapi) && - (DeviceExtension->DeviceDescriptor->BusType != BusTypeUnknown) - ) - { - // devices on the newer busses require START_UNIT - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceInitMmcContext: Devices for newer buses require START UNIT\n")); - SET_FLAG(DeviceExtension->DeviceFlags, DEV_SAFE_START_UNIT); - } - - return status; -} - - -_IRQL_requires_max_(PASSIVE_LEVEL) -ULONG -DeviceGetTimeOutValueFromRegistry() -/*++ - -Routine Description: - - get the device time out value from registry - -Arguments: - - None - -Return Value: - - ULONG - value of timeout - ---*/ -{ - NTSTATUS status; - WDFKEY registryKey = NULL; - ULONG timeOutValue = 0; - - DECLARE_CONST_UNICODE_STRING(registryValueName, L"TimeOutValue"); - - PAGED_CODE(); - - // open the service key. - status = WdfDriverOpenParametersRegistryKey(WdfGetDriver(), - KEY_READ, - WDF_NO_OBJECT_ATTRIBUTES, - ®istryKey); - - if (NT_SUCCESS(status)) - { - status = WdfRegistryQueryULong(registryKey, - ®istryValueName, - &timeOutValue); - - WdfRegistryClose(registryKey); - } - - if (!NT_SUCCESS(status)) - { - timeOutValue = 0; - } - - return timeOutValue; - -} // end DeviceGetTimeOutValueFromRegistry() - - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceScanSpecialDevices( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - This function checks to see if an SCSI logical unit requires an special - initialization or error processing. - -Arguments: - - Device - device object. - -Return Value: - - None. - ---*/ -{ - - PAGED_CODE(); - - // set our hack flags - DeviceScanForSpecial(DeviceExtension, CdromHackItems, ScanForSpecialHandler); - - // - // All CDRom's can ignore the queue lock failure for power operations - // and do not require handling the SpinUp case (unknown result of sending - // a cdrom a START_UNIT command -- may eject disks?) - // - // We send the stop command mostly to stop outstanding asynch operations - // (like audio playback) from running when the system is powered off. - // Because of this and the unlikely chance that a PLAY command will be - // sent in the window between the STOP and the time the machine powers down - // we don't require queue locks. This is important because without them - // classpnp's power routines will send the START_STOP_UNIT command to the - // device whether or not it supports locking (atapi does not support locking - // and if we requested them we would end up not stopping audio on atapi - // devices). -// SET_FLAG(deviceExtension->ScanForSpecialFlags, CDROM_SPECIAL_DISABLE_SPIN_UP); -// SET_FLAG(deviceExtension->ScanForSpecialFlags, CDROM_SPECIAL_NO_QUEUE_LOCK); - - if (TEST_FLAG(DeviceExtension->DeviceAdditionalData.HackFlags, CDROM_HACK_TOSHIBA_SD_W1101)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceScanSpecialDevices: Found Toshiba SD-W1101 DVD-RAM " - "-- This drive will *NOT* support DVD-ROM playback.\n")); - } - else if (TEST_FLAG(DeviceExtension->DeviceAdditionalData.HackFlags, CDROM_HACK_HITACHI_GD_2000)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceScanSpecialDevices: Found Hitachi GD-2000\n")); - - // Setup an error handler to spin up the drive when it idles out - // since it seems to like to fail to spin itself back up on its - // own for a REPORT_KEY command. It may also lose the AGIDs that - // it has given, which will result in DVD playback failures. - // This routine will just do what it can... - DeviceExtension->DeviceAdditionalData.ErrorHandler = DeviceErrorHandlerForHitachiGD2000; - - // this drive may require START_UNIT commands to spin - // the drive up when it's spun itself down. - SET_FLAG(DeviceExtension->DeviceFlags, DEV_SAFE_START_UNIT); - } - else if (TEST_FLAG(DeviceExtension->DeviceAdditionalData.HackFlags, CDROM_HACK_FUJITSU_FMCD_10x)) - { - // When Read command is issued to FMCD-101 or FMCD-102 and there is a music - // cd in it. It takes longer time than SCSI_CDROM_TIMEOUT before returning - // error status. - DeviceExtension->TimeOutValue = 20; - } - else if (TEST_FLAG(DeviceExtension->DeviceAdditionalData.HackFlags, CDROM_HACK_DEC_RRD)) - { - NTSTATUS status; - PMODE_PARM_READ_WRITE_DATA modeParameters; - SCSI_REQUEST_BLOCK srb = {0}; - PCDB cdb; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceScanSpecialDevices: Found DEC RRD.\n")); - - DeviceExtension->DeviceAdditionalData.IsDecRrd = TRUE; - - // Setup an error handler to reinitialize the cd rom after it is reset? - // - //DeviceExtension->DevInfo->ClassError = DecRrdProcessError; - - // Found a DEC RRD cd-rom. These devices do not pass MS HCT - // multi-media tests because the DEC firmware modifieds the block - // from the PC-standard 2K to 512. Change the block transfer size - // back to the PC-standard 2K by using a mode select command. - - modeParameters = ExAllocatePool2(POOL_FLAG_NON_PAGED, - sizeof(MODE_PARM_READ_WRITE_DATA), - CDROM_TAG_MODE_DATA); - if (modeParameters == NULL) - { - return; - } - - RtlZeroMemory(modeParameters, sizeof(MODE_PARM_READ_WRITE_DATA)); - RtlZeroMemory(&srb, sizeof(SCSI_REQUEST_BLOCK)); - - // Set the block length to 2K. - modeParameters->ParameterListHeader.BlockDescriptorLength = sizeof(MODE_PARAMETER_BLOCK); - - // Set block length to 2K (0x0800) in Parameter Block. - modeParameters->ParameterListBlock.BlockLength[0] = 0x00; //MSB - modeParameters->ParameterListBlock.BlockLength[1] = 0x08; - modeParameters->ParameterListBlock.BlockLength[2] = 0x00; //LSB - - // Build the mode select CDB. - srb.CdbLength = 6; - srb.TimeOutValue = DeviceExtension->TimeOutValue; - - cdb = (PCDB)srb.Cdb; - cdb->MODE_SELECT.PFBit = 1; - cdb->MODE_SELECT.OperationCode = SCSIOP_MODE_SELECT; - cdb->MODE_SELECT.ParameterListLength = HITACHI_MODE_DATA_SIZE; - - // Send the request to the device. - status = DeviceSendSrbSynchronously(DeviceExtension->Device, - &srb, - modeParameters, - sizeof(MODE_PARM_READ_WRITE_DATA), - TRUE, - NULL); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "DeviceScanSpecialDevices: Setting DEC RRD to 2K block" - "size failed [%x]\n", status)); - } - - ExFreePool(modeParameters); - } - - return; -} - -_IRQL_requires_max_(APC_LEVEL) -VOID -ScanForSpecialHandler( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ ULONG_PTR HackFlags - ) -{ - PAGED_CODE(); - - CLEAR_FLAG(HackFlags, CDROM_HACK_INVALID_FLAGS); - - DeviceExtension->DeviceAdditionalData.HackFlags = HackFlags; - - return; -} - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceCacheDeviceInquiryData( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - get inquiry data from device and cache it into device extension - The first INQUIRY command sent is with 0x24 bytes required data, - as ATAport driver always sends this to enumerate devices and 0x24 - bytes is the minimum data device should return by spec. - -Arguments: - - DeviceExtension - device extension. - -Return Value: - - NTSTATUS. - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - SCSI_REQUEST_BLOCK srb = {0}; - PCDB cdb = (PCDB)(&srb.Cdb); - PINQUIRYDATA tmpInquiry = NULL; - - // by spec, device should return at least 36 bytes. - ULONG requestedInquiryTransferBytes = MINIMUM_CDROM_INQUIRY_SIZE; - BOOLEAN needResendCommand = TRUE; - BOOLEAN portDriverHack = FALSE; - - // this ensures that the strings vendorID, productID, and firmwareRevision - // are all available in the inquiry data. In addition, MMC spec requires - // all type 5 devices to have minimum 36 bytes of inquiry. - static const UCHAR minInquiryAdditionalLength = - MINIMUM_CDROM_INQUIRY_SIZE - - RTL_SIZEOF_THROUGH_FIELD(INQUIRYDATA, AdditionalLength); - - C_ASSERT( RTL_SIZEOF_THROUGH_FIELD(INQUIRYDATA, AdditionalLength) <= 8 ); - C_ASSERT( RTL_SIZEOF_THROUGH_FIELD(INQUIRYDATA, ProductRevisionLevel) == MINIMUM_CDROM_INQUIRY_SIZE ); - - PAGED_CODE(); - - // short-circuit here for if already cached for this device - // required to avoid use of scratch buffer after initialization - // of MCN code. - if (DeviceExtension->DeviceAdditionalData.CachedInquiryData != NULL) - { - NT_ASSERT(DeviceExtension->DeviceAdditionalData.CachedInquiryDataByteCount != 0); - return STATUS_SUCCESS; - } - - // 1. retrieve the inquiry data length - - // 1.1 allocate inquiry data buffer - tmpInquiry = ExAllocatePool2(POOL_FLAG_NON_PAGED, - requestedInquiryTransferBytes, - CDROM_TAG_INQUIRY); - if (tmpInquiry == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - - // 1.2 send INQUIRY command - if (NT_SUCCESS(status)) - { - srb.CdbLength = 6; - cdb->AsByte[0] = SCSIOP_INQUIRY; - cdb->AsByte[3] = (UCHAR)( requestedInquiryTransferBytes >> (8*1) ); - cdb->AsByte[4] = (UCHAR)( requestedInquiryTransferBytes >> (8*0) ); - - status = DeviceSendSrbSynchronously(DeviceExtension->Device, - &srb, - tmpInquiry, - requestedInquiryTransferBytes, - FALSE, - NULL); - } - - // 1.3 get required data length - if (NT_SUCCESS(status)) - { - if ((requestedInquiryTransferBytes == srb.DataTransferLength) && - (requestedInquiryTransferBytes == (tmpInquiry->AdditionalLength + - RTL_SIZEOF_THROUGH_FIELD(INQUIRYDATA, AdditionalLength))) ) - { - // device has only 36 bytes of INQUIRY data. do not need to resend the command. - needResendCommand = FALSE; - } - else - { - // workaround an ATAPI.SYS bug where additional length field is set to zero - if (tmpInquiry->AdditionalLength == 0) - { - tmpInquiry->AdditionalLength = minInquiryAdditionalLength; - portDriverHack = TRUE; - } - - requestedInquiryTransferBytes = - tmpInquiry->AdditionalLength + - RTL_SIZEOF_THROUGH_FIELD(INQUIRYDATA, AdditionalLength); - - if (requestedInquiryTransferBytes >= MINIMUM_CDROM_INQUIRY_SIZE) - { - needResendCommand = TRUE; - } - else - { - needResendCommand = FALSE; - //Length is small than minimum length, error out. - status = STATUS_DEVICE_PROTOCOL_ERROR; - } - } - } - - // 2. retrieve the inquiry data if still needed. - - // 2.1 Clean up. - if (NT_SUCCESS(status) && needResendCommand) - { - FREE_POOL(tmpInquiry); - RtlZeroMemory(&srb, sizeof(SCSI_REQUEST_BLOCK)); - - tmpInquiry = ExAllocatePool2(POOL_FLAG_NON_PAGED, - requestedInquiryTransferBytes, - CDROM_TAG_INQUIRY); - if (tmpInquiry == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - } - - // 2.2 resend INQUIRY command - if (NT_SUCCESS(status) && needResendCommand) - { - srb.CdbLength = 6; - cdb->AsByte[0] = SCSIOP_INQUIRY; - cdb->AsByte[3] = (UCHAR)( requestedInquiryTransferBytes >> (8*1) ); - cdb->AsByte[4] = (UCHAR)( requestedInquiryTransferBytes >> (8*0) ); - - status = DeviceSendSrbSynchronously( DeviceExtension->Device, - &srb, - tmpInquiry, - requestedInquiryTransferBytes, - FALSE, - NULL); - - if (!NT_SUCCESS(status)) - { - // Workaround for drive reports that it has more INQUIRY data than reality. - if ((srb.SrbStatus == SRB_STATUS_DATA_OVERRUN) && - (srb.DataTransferLength < requestedInquiryTransferBytes) && - (srb.DataTransferLength >= MINIMUM_CDROM_INQUIRY_SIZE)) - { - //Port driver says buffer size mismatch (buffer underrun), - //retry with the real buffer size it could return. - requestedInquiryTransferBytes = srb.DataTransferLength; - - FREE_POOL(tmpInquiry); - RtlZeroMemory(&srb, sizeof(SCSI_REQUEST_BLOCK)); - - tmpInquiry = ExAllocatePool2(POOL_FLAG_NON_PAGED, - requestedInquiryTransferBytes, - CDROM_TAG_INQUIRY); - if (tmpInquiry == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - else - { - srb.CdbLength = 6; - cdb->AsByte[0] = SCSIOP_INQUIRY; - cdb->AsByte[3] = (UCHAR)( requestedInquiryTransferBytes >> (8*1) ); - cdb->AsByte[4] = (UCHAR)( requestedInquiryTransferBytes >> (8*0) ); - - status = DeviceSendSrbSynchronously(DeviceExtension->Device, - &srb, - tmpInquiry, - requestedInquiryTransferBytes, - FALSE, - NULL); - } - } - } - - //Check the transferred data length for safe. - if (NT_SUCCESS(status)) - { - requestedInquiryTransferBytes = srb.DataTransferLength; - - if (requestedInquiryTransferBytes < MINIMUM_CDROM_INQUIRY_SIZE) - { - // should never occur - status = STATUS_DEVICE_PROTOCOL_ERROR; - } - } - - // ensure we got some non-zero data.... - // This is done so we don't accidentally work around the - // ATAPI.SYS bug when no data was transferred. - if (NT_SUCCESS(status) && portDriverHack) - { - PULONG tmp = (PULONG)tmpInquiry; - ULONG i = MINIMUM_CDROM_INQUIRY_SIZE / sizeof(ULONG); - C_ASSERT( RTL_SIZEOF_THROUGH_FIELD(INQUIRYDATA, ProductRevisionLevel) % sizeof(ULONG) == 0 ); - - // wouldn't you know it -- there is no RtlIsMemoryZero() function; Make one up. - for ( ; i != 0; i--) - { - if (*tmp != 0) - { - break; // out of this inner FOR loop -- guarantees 'i != 0' - } - tmp++; - } - - if (i == 0) // all loop'd successfully - { - // should never occur to successfully get all zero'd data - status = STATUS_DEVICE_PROTOCOL_ERROR; - } - } - } - - // if everything succeeded, then (and only then) modify the device extension - if (NT_SUCCESS(status)) - { - DeviceExtension->DeviceAdditionalData.CachedInquiryData = tmpInquiry; - DeviceExtension->DeviceAdditionalData.CachedInquiryDataByteCount = requestedInquiryTransferBytes; - } - else - { - FREE_POOL(tmpInquiry); - } - - return status; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceGetMmcSupportInfo( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Out_ PBOOLEAN IsMmcDevice - ) -/*++ - -Routine Description: - - check if the device is MMC capable. - -Arguments: - - DeviceExtension - device extension. - -Return Value: - - NTSTATUS. - IsMmcDevice - TRUE (MMC capable); FALSE (not MMC device) - ---*/ -{ - NTSTATUS status; - ULONG size; - ULONG previouslyFailed; - - PAGED_CODE(); - - *IsMmcDevice = FALSE; - - // read the registry in case the drive failed previously, - // and a timeout is occurring. - previouslyFailed = FALSE; - DeviceGetParameter(DeviceExtension, - CDROM_SUBKEY_NAME, - CDROM_NON_MMC_DRIVE_NAME, - &previouslyFailed); - - if (previouslyFailed) - { - SET_FLAG(DeviceExtension->DeviceAdditionalData.HackFlags, CDROM_HACK_BAD_GET_CONFIG_SUPPORT); - } - - // read from the registry in case the drive reports bad profile lengths - previouslyFailed = FALSE; - DeviceGetParameter(DeviceExtension, - CDROM_SUBKEY_NAME, - CDROM_NON_MMC_VENDOR_SPECIFIC_PROFILE, - &previouslyFailed); - - if (previouslyFailed) - { - SET_FLAG(DeviceExtension->DeviceAdditionalData.HackFlags, CDROM_HACK_BAD_VENDOR_PROFILES); - } - - // check for the ProfileList feature to determine if the drive is MMC compliant - // and set the "size" local variable to total GetConfig data size available. - // NOTE: This will exit this function in some error paths. - { - GET_CONFIGURATION_HEADER localHeader = {0}; - ULONG usable = 0; - - status = DeviceGetConfiguration(DeviceExtension->Device, - &localHeader, - sizeof(GET_CONFIGURATION_HEADER), - &usable, - FeatureProfileList, - SCSI_GET_CONFIGURATION_REQUEST_TYPE_ALL); - - if (status == STATUS_INVALID_DEVICE_REQUEST || - status == STATUS_NO_MEDIA_IN_DEVICE || - status == STATUS_IO_DEVICE_ERROR || - status == STATUS_IO_TIMEOUT) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "GetConfiguration Failed (%x), device %p not mmc-compliant\n", - status, DeviceExtension->DeviceObject - )); - - previouslyFailed = TRUE; - DeviceSetParameter( DeviceExtension, - CDROM_SUBKEY_NAME, - CDROM_NON_MMC_DRIVE_NAME, - previouslyFailed); - - return STATUS_SUCCESS; - } - else if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "GetConfiguration Failed, status %x -- defaulting to -ROM\n", - status)); - - return STATUS_SUCCESS; - } - else if (usable < sizeof(GET_CONFIGURATION_HEADER)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "GetConfiguration Failed, returned only %x bytes!\n", usable)); - previouslyFailed = TRUE; - DeviceSetParameter( DeviceExtension, - CDROM_SUBKEY_NAME, - CDROM_NON_MMC_DRIVE_NAME, - previouslyFailed); - - return STATUS_SUCCESS; - } - - size = (localHeader.DataLength[0] << 24) | - (localHeader.DataLength[1] << 16) | - (localHeader.DataLength[2] << 8) | - (localHeader.DataLength[3] << 0) ; - - - if ((size <= 4) || (size + 4 < size)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "GetConfiguration Failed, claims MMC support but doesn't " - "correctly return config length! (%x)\n", - size - )); - previouslyFailed = TRUE; - DeviceSetParameter( DeviceExtension, - CDROM_SUBKEY_NAME, - CDROM_NON_MMC_DRIVE_NAME, - previouslyFailed); - - return STATUS_SUCCESS; - } - else if ((size % 4) != 0) - { - if ((size % 2) != 0) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "GetConfiguration Failed, returned odd number of bytes %x!\n", - size - )); - previouslyFailed = TRUE; - DeviceSetParameter( DeviceExtension, - CDROM_SUBKEY_NAME, - CDROM_NON_MMC_DRIVE_NAME, - previouslyFailed); - - return STATUS_SUCCESS; - } - else - { - if (TEST_FLAG(DeviceExtension->DeviceAdditionalData.HackFlags, CDROM_HACK_BAD_VENDOR_PROFILES)) - { - // we've already caught this and ASSERT'd once, so don't do it again - } - else - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "GetConfiguration returned a size that is not per spec (%x bytes), this is probably because of a vendor specific data header with a size not divisible by 4.\n", - size - )); - previouslyFailed = TRUE; - DeviceSetParameter(DeviceExtension, - CDROM_SUBKEY_NAME, - CDROM_NON_MMC_VENDOR_SPECIFIC_PROFILE, - previouslyFailed); - } - } - } - - size += 4; // sizeof the datalength fields - } - - *IsMmcDevice = TRUE; - - // This code doesn't handle total get config size over 64k - NT_ASSERT( size <= MAXUSHORT ); - - // Check for SCSI_GET_CONFIGURATION_REQUEST_TYPE_ONE support in the device. - // NOTE: This will exit this function in some error paths. - { - ULONG featureSize = sizeof(GET_CONFIGURATION_HEADER)+sizeof(FEATURE_HEADER); - ULONG usable = 0; - - PGET_CONFIGURATION_HEADER configBuffer = ExAllocatePool2(POOL_FLAG_NON_PAGED, - featureSize, - CDROM_TAG_GET_CONFIG); - - if (configBuffer == NULL) - { - return STATUS_INSUFFICIENT_RESOURCES; - } - - // read the registry in case the drive failed previously, - // and a timeout is occurring. - previouslyFailed = FALSE; - DeviceGetParameter( DeviceExtension, - CDROM_SUBKEY_NAME, - CDROM_TYPE_ONE_GET_CONFIG_NAME, - &previouslyFailed); - - if (previouslyFailed) - { - SET_FLAG(DeviceExtension->DeviceAdditionalData.HackFlags, CDROM_HACK_BAD_TYPE_ONE_GET_CONFIG); - FREE_POOL(configBuffer); - return STATUS_SUCCESS; - } - - // Get only the config and feature header - status = DeviceGetConfiguration(DeviceExtension->Device, - configBuffer, - featureSize, - &usable, - FeatureProfileList, - SCSI_GET_CONFIGURATION_REQUEST_TYPE_ONE); - - if (!NT_SUCCESS(status) || (usable < featureSize)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "Type One GetConfiguration Failed. Usable buffer size: %d\n", usable)); - previouslyFailed = TRUE; - } - else - { - PFEATURE_HEADER featureHeader; - ULONG totalAvailableBytes = 0; - ULONG expectedAvailableBytes = 0; - - REVERSE_BYTES(&totalAvailableBytes, configBuffer->DataLength); - totalAvailableBytes += RTL_SIZEOF_THROUGH_FIELD(GET_CONFIGURATION_HEADER, DataLength); - - featureHeader = (PFEATURE_HEADER) ((PUCHAR)configBuffer + sizeof(GET_CONFIGURATION_HEADER)); - expectedAvailableBytes = sizeof(GET_CONFIGURATION_HEADER) + - sizeof(FEATURE_HEADER) + - featureHeader->AdditionalLength; - - if (totalAvailableBytes > expectedAvailableBytes) - { - // Device is returning more than required size. Most likely the device - // is returning TYPE ALL data. Set the flag to use TYPE ALL for TYPE ONE - // requets - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "Type One GetConfiguration Failed. " - "Device returned %d bytes instead of %d bytes\n", - size, featureSize)); - - previouslyFailed = TRUE; - } - } - - FREE_POOL(configBuffer); - - if (previouslyFailed == TRUE) - { - DeviceSetParameter( DeviceExtension, - CDROM_SUBKEY_NAME, - CDROM_TYPE_ONE_GET_CONFIG_NAME, - previouslyFailed); - - SET_FLAG(DeviceExtension->DeviceAdditionalData.HackFlags, CDROM_HACK_BAD_TYPE_ONE_GET_CONFIG); - } - } - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceSetRawReadInfo( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - This routine reads the CDROM capabilities mode page and save information - in the device extension needed for raw reads. - NOTE: this function is only valid for MMC device - -Arguments: - - DeviceExtension - device context - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PUCHAR buffer = NULL; - ULONG count = 0; - - PAGED_CODE(); - - // Check whether the device can return C2 error flag bits and the block - // error byte. If so, save this info and fill in appropriate flag during - // raw read requests. - - // Start by checking the GET_CONFIGURATION data - { - PFEATURE_DATA_CD_READ cdReadHeader = NULL; - ULONG additionalLength = sizeof(FEATURE_DATA_CD_READ) - sizeof(FEATURE_HEADER); - - cdReadHeader = DeviceFindFeaturePage(DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer, - DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBufferSize, - FeatureCdRead); - - if ((cdReadHeader != NULL) && - (cdReadHeader->Header.AdditionalLength >= additionalLength) && - (cdReadHeader->C2ErrorData) - ) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DeviceSetRawReadInfo: FDO %p GET_CONFIG shows ability to read C2 error bits\n", - DeviceExtension->DeviceObject - )); - DeviceExtension->DeviceAdditionalData.Mmc.ReadCdC2Pointers = TRUE; // Device returns C2 error info. - } - } - - // Unfortunately, the only way to check for the ability to read R-W subcode - // information is via MODE_SENSE. Do so here, and check the C2 bit as well - // in case the drive has a firmware bug where it fails to report this ability - // in GET_CONFIG (which some drives do). - for (count = 0; count < 6; count++) - { - SCSI_REQUEST_BLOCK srb = {0}; - PCDB cdb = (PCDB)srb.Cdb; - ULONG bufferLength = 0; - - // Build the MODE SENSE CDB. Try 10-byte CDB first. - if ((count/3) == 0) - { - bufferLength = sizeof(CDVD_CAPABILITIES_PAGE) + - sizeof(MODE_PARAMETER_HEADER10) + - sizeof(MODE_PARAMETER_BLOCK); - - cdb->MODE_SENSE10.OperationCode = SCSIOP_MODE_SENSE10; - cdb->MODE_SENSE10.Dbd = 1; - cdb->MODE_SENSE10.PageCode = MODE_PAGE_CAPABILITIES; - cdb->MODE_SENSE10.AllocationLength[0] = (UCHAR)(bufferLength >> 8); - cdb->MODE_SENSE10.AllocationLength[1] = (UCHAR)(bufferLength >> 0); - srb.CdbLength = 10; - } - else - { - bufferLength = sizeof(CDVD_CAPABILITIES_PAGE) + - sizeof(MODE_PARAMETER_HEADER) + - sizeof(MODE_PARAMETER_BLOCK); - - cdb->MODE_SENSE.OperationCode = SCSIOP_MODE_SENSE; - cdb->MODE_SENSE.Dbd = 1; - cdb->MODE_SENSE.PageCode = MODE_PAGE_CAPABILITIES; - cdb->MODE_SENSE.AllocationLength = (UCHAR)bufferLength; - srb.CdbLength = 6; - } - - // Set timeout value from device extension. - srb.TimeOutValue = DeviceExtension->TimeOutValue; - - buffer = ExAllocatePool2(POOL_FLAG_NON_PAGED, bufferLength, CDROM_TAG_MODE_DATA); - - if (buffer == NULL) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "DeviceSetRawReadInfo: cannot allocate " - "buffer, so not setting raw read info for FDO %p\n", - DeviceExtension->DeviceObject - )); - status = STATUS_INSUFFICIENT_RESOURCES; - goto FnExit; - } - - RtlZeroMemory(buffer, bufferLength); - - status = DeviceSendSrbSynchronously(DeviceExtension->Device, - &srb, - buffer, - bufferLength, - FALSE, - NULL); - - if (NT_SUCCESS(status) || - (status == STATUS_DATA_OVERRUN) || - (status == STATUS_BUFFER_OVERFLOW)) - { - PCDVD_CAPABILITIES_PAGE capabilities = NULL; - - // determine where the capabilities page really is - if ((count/3) == 0) - { - PMODE_PARAMETER_HEADER10 p = (PMODE_PARAMETER_HEADER10)buffer; - capabilities = (PCDVD_CAPABILITIES_PAGE)(buffer + - sizeof(MODE_PARAMETER_HEADER10) + - (p->BlockDescriptorLength[0] * 256) + - p->BlockDescriptorLength[1]); - } - else - { - PMODE_PARAMETER_HEADER p = (PMODE_PARAMETER_HEADER)buffer; - capabilities = (PCDVD_CAPABILITIES_PAGE)(buffer + - sizeof(MODE_PARAMETER_HEADER) + - p->BlockDescriptorLength); - } - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DeviceSetRawReadInfo: FDO %p CDVD Capabilities buffer %p\n", - DeviceExtension->DeviceObject, - buffer - )); - - if (capabilities->PageCode == MODE_PAGE_CAPABILITIES) - { - if (capabilities->C2Pointers) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DeviceSetRawReadInfo: FDO %p supports C2 error bits in READ_CD command\n", - DeviceExtension->DeviceObject - )); - DeviceExtension->DeviceAdditionalData.Mmc.ReadCdC2Pointers = TRUE; - } - - if (capabilities->RWSupported) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DeviceSetRawReadInfo: FDO %p supports raw subcode in READ_CD command\n", - DeviceExtension->DeviceObject - )); - DeviceExtension->DeviceAdditionalData.Mmc.ReadCdSubCode = TRUE; - } - - break; - } - } - - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "DeviceSetRawReadInfo: FDO %p failed %x byte mode sense, status %x\n", - DeviceExtension->DeviceObject, - (((count/3) == 0) ? 10 : 6), - status - )); - - FREE_POOL(buffer); - } - - if (count == 6) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "DeviceSetRawReadInfo: FDO %p couldn't get mode sense data\n", - DeviceExtension->DeviceObject - )); - } - -FnExit: - - if (buffer) - { - FREE_POOL(buffer); - } - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceInitializeDvd( - _In_ WDFDEVICE Device - ) -/*++ - -Routine Description: - - This routine sets the region of DVD drive - NOTE: this routine uses ScratchBuffer, it must be called after ScratchBuffer allocated. - -Arguments: - - Device - device object - -Return Value: - - NTSTATUS - ---*/ - -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension; - PDVD_COPY_PROTECT_KEY copyProtectKey = NULL; - PDVD_RPC_KEY rpcKey = NULL; - ULONG bufferLen = 0; - size_t bytesReturned; - - PAGED_CODE(); - - deviceExtension = DeviceGetExtension(Device); - - // check to see if we have a DVD device - if (deviceExtension->DeviceAdditionalData.DriveDeviceType != FILE_DEVICE_DVD) - { - return STATUS_SUCCESS; - } - - // we got a DVD drive. - bufferLen = DVD_RPC_KEY_LENGTH; - copyProtectKey = (PDVD_COPY_PROTECT_KEY)ExAllocatePool2(POOL_FLAG_PAGED, - bufferLen, - DVD_TAG_RPC2_CHECK); - - if (copyProtectKey == NULL) - { - return STATUS_INSUFFICIENT_RESOURCES; - } - - // get the device region - RtlZeroMemory (copyProtectKey, bufferLen); - copyProtectKey->KeyLength = DVD_RPC_KEY_LENGTH; - copyProtectKey->KeyType = DvdGetRpcKey; - - // perform IOCTL_DVD_READ_KEY - status = DvdStartSessionReadKey(deviceExtension, - IOCTL_DVD_READ_KEY, - NULL, - copyProtectKey, - DVD_RPC_KEY_LENGTH, - copyProtectKey, - DVD_RPC_KEY_LENGTH, - &bytesReturned); - - if (NT_SUCCESS(status)) - { - rpcKey = (PDVD_RPC_KEY)copyProtectKey->KeyData; - - // TypeCode of zero means that no region has been set. - if (rpcKey->TypeCode == 0) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_PNP, - "DVD Initialize (%p): must choose DVD region\n", - Device)); - deviceExtension->DeviceAdditionalData.PickDvdRegion = 1; - - // set the device region code to be the same as region code on media. - if (deviceExtension->DeviceAdditionalData.Mmc.IsCssDvd) - { - DevicePickDvdRegion(Device); - } - } - } - - FREE_POOL(copyProtectKey); - - // return status of IOCTL_DVD_READ_KEY will be ignored. - return STATUS_SUCCESS; -} - - -#if (NTDDI_VERSION >= NTDDI_WIN8) -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceIsPortable( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Out_ PBOOLEAN IsPortable - ) -/*++ - -Routine Description: - - This routine checks if the volume is on a portable storage device. - -Arguments: - - DeviceExtension - device context - IsPortable - device is portable - -Return Value: - - NTSTATUS. - ---*/ - -{ - DEVPROP_BOOLEAN isInternal = DEVPROP_FALSE; - BOOLEAN isPortable = FALSE; - ULONG size = 0; - NTSTATUS status = STATUS_SUCCESS; - DEVPROPTYPE type = DEVPROP_TYPE_EMPTY; - - PAGED_CODE(); - - *IsPortable = FALSE; - - // Check to see if the underlying device object is in local machine container - status = IoGetDevicePropertyData(DeviceExtension->LowerPdo, - &DEVPKEY_Device_InLocalMachineContainer, - 0, - 0, - sizeof(isInternal), - &isInternal, - &size, - &type); - - if (!NT_SUCCESS(status)) - { - goto Cleanup; - } - - NT_ASSERT(size == sizeof(isInternal)); - NT_ASSERT(type == DEVPROP_TYPE_BOOLEAN); - - // Volume is hot-pluggable if the disk pdo container id differs from that of root device - if (isInternal == DEVPROP_TRUE) - { - goto Cleanup; - } - - isPortable = TRUE; - - // Examine the bus type to ensure that this really is a fixed device - if (DeviceExtension->DeviceDescriptor->BusType == BusTypeFibre || - DeviceExtension->DeviceDescriptor->BusType == BusTypeiScsi || - DeviceExtension->DeviceDescriptor->BusType == BusTypeRAID) - { - isPortable = FALSE; - } - - *IsPortable = isPortable; - -Cleanup: - - return status; -} -#endif - - -#pragma warning(pop) // un-sets any local warning changes - diff --git a/storage/class/cdrom/src/ioctl.c b/storage/class/cdrom/src/ioctl.c deleted file mode 100644 index f0a540fc..00000000 --- a/storage/class/cdrom/src/ioctl.c +++ /dev/null @@ -1,9132 +0,0 @@ -/*-- - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - ioctl.c - -Abstract: - - Include all funtions for processing IOCTLs - -Environment: - - kernel mode only - -Notes: - - -Revision History: - ---*/ - -#include "stddef.h" -#include "string.h" - -#include "ntddk.h" -#include "ntddstor.h" -#include "cdrom.h" -#include "ioctl.h" -#include "scratch.h" -#include "mmc.h" - - -#ifdef DEBUG_USE_WPP -#include "ioctl.tmh" -#endif - - -#define FirstDriveLetter 'C' -#define LastDriveLetter 'Z' - -#if DBG - LPCSTR READ_DVD_STRUCTURE_FORMAT_STRINGS[DvdMaxDescriptor+1] = { - "Physical", - "Copyright", - "DiskKey", - "BCA", - "Manufacturer", - "Unknown" - }; -#endif // DBG - -_IRQL_requires_max_(APC_LEVEL) -VOID -GetConfigurationDataConversionTypeAllToTypeOne( - _In_ FEATURE_NUMBER RequestedFeature, - _In_ PSCSI_REQUEST_BLOCK Srb, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -VOID -GetConfigurationDataSynthesize( - _In_reads_bytes_(InputBufferSize) PVOID InputBuffer, - _In_ ULONG InputBufferSize, - _Out_writes_bytes_(OutputBufferSize) PVOID OutputBuffer, - _In_ size_t OutputBufferSize, - _In_ FEATURE_NUMBER StartingFeature, - _In_ ULONG RequestType, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -PCDB -RequestGetScsiPassThroughCdb( - _In_ PIRP Irp - ); - -#ifdef ALLOC_PRAGMA - -#pragma alloc_text(PAGE, DeviceIsPlayActive) -#pragma alloc_text(PAGE, RequestHandleGetDvdRegion) -#pragma alloc_text(PAGE, RequestHandleReadTOC) -#pragma alloc_text(PAGE, RequestHandleReadTocEx) -#pragma alloc_text(PAGE, RequestHandleGetConfiguration) -#pragma alloc_text(PAGE, RequestHandleGetDriveGeometry) -#pragma alloc_text(PAGE, RequestHandleDiskVerify) -#pragma alloc_text(PAGE, RequestHandleCheckVerify) -#pragma alloc_text(PAGE, RequestHandleFakePartitionInfo) -#pragma alloc_text(PAGE, RequestHandleEjectionControl) -#pragma alloc_text(PAGE, RequestHandleEnableStreaming) -#pragma alloc_text(PAGE, RequestHandleSendOpcInformation) -#pragma alloc_text(PAGE, RequestHandleGetPerformance) -#pragma alloc_text(PAGE, RequestHandleMcnSyncFakeIoctl) -#pragma alloc_text(PAGE, RequestHandleLoadEjectMedia) -#pragma alloc_text(PAGE, RequestHandleReserveRelease) -#pragma alloc_text(PAGE, RequestHandlePersistentReserve) -#pragma alloc_text(PAGE, DeviceHandleRawRead) -#pragma alloc_text(PAGE, DeviceHandlePlayAudioMsf) -#pragma alloc_text(PAGE, DeviceHandleReadQChannel) -#pragma alloc_text(PAGE, ReadQChannel) -#pragma alloc_text(PAGE, DeviceHandlePauseAudio) -#pragma alloc_text(PAGE, DeviceHandleResumeAudio) -#pragma alloc_text(PAGE, DeviceHandleSeekAudioMsf) -#pragma alloc_text(PAGE, DeviceHandleStopAudio) -#pragma alloc_text(PAGE, DeviceHandleGetSetVolume) -#pragma alloc_text(PAGE, DeviceHandleReadDvdStructure) -#pragma alloc_text(PAGE, ReadDvdStructure) -#pragma alloc_text(PAGE, DeviceHandleDvdEndSession) -#pragma alloc_text(PAGE, DeviceHandleDvdStartSessionReadKey) -#pragma alloc_text(PAGE, DvdStartSessionReadKey) -#pragma alloc_text(PAGE, DeviceHandleDvdSendKey) -#pragma alloc_text(PAGE, DvdSendKey) -#pragma alloc_text(PAGE, DeviceHandleSetReadAhead) -#pragma alloc_text(PAGE, DeviceHandleSetSpeed) -#pragma alloc_text(PAGE, RequestHandleExclusiveAccessQueryLockState) -#pragma alloc_text(PAGE, RequestHandleExclusiveAccessLockDevice) -#pragma alloc_text(PAGE, RequestHandleExclusiveAccessUnlockDevice) -#pragma alloc_text(PAGE, RequestHandleScsiPassThrough) -#pragma alloc_text(PAGE, RequestGetScsiPassThroughCdb) -#pragma alloc_text(PAGE, GetConfigurationDataConversionTypeAllToTypeOne) -#pragma alloc_text(PAGE, GetConfigurationDataSynthesize) - -#endif - -NTSTATUS -RequestHandleUnknownIoctl( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ) -/*++ - -Routine Description: - - All unknown IOCTLs will be forward to lower level driver. - -Arguments: - - Device - device object - Request - request to be handled - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_UNSUCCESSFUL; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request); - BOOLEAN syncRequired = requestContext->SyncRequired; - - ULONG sendOptionsFlags = 0; - BOOLEAN requestSent = FALSE; - - WdfRequestFormatRequestUsingCurrentType(Request); - - if (syncRequired) - { - sendOptionsFlags = WDF_REQUEST_SEND_OPTION_SYNCHRONOUS; - } - else - { - WdfRequestSetCompletionRoutine(Request, RequestDummyCompletionRoutine, NULL); - } - - status = RequestSend(deviceExtension, - Request, - deviceExtension->IoTarget, - sendOptionsFlags, - &requestSent); - - if (requestSent) - { - if (syncRequired) - { - // the request needs to be completed here. - RequestCompletion(deviceExtension, Request, status, WdfRequestGetInformation(Request)); - } - } - else - { - // failed to send the request to IoTarget - RequestCompletion(deviceExtension, Request, status, WdfRequestGetInformation(Request)); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -BOOLEAN -DeviceIsPlayActive( - _In_ WDFDEVICE Device - ) -/*++ - -Routine Description: - - This routine determines if the cd is currently playing music. - -Arguments: - - Device - Device object. - -Return Value: - - BOOLEAN - TRUE if the device is playing music. - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PSUB_Q_CURRENT_POSITION currentBuffer; - size_t bytesRead = 0; - - PAGED_CODE (); - - // if we don't think it is playing audio, don't bother checking. - if (!deviceExtension->DeviceAdditionalData.PlayActive) - { - return FALSE; - } - - // Allocate the required memory - NT_ASSERT(sizeof(SUB_Q_CURRENT_POSITION) >= sizeof(CDROM_SUB_Q_DATA_FORMAT)); - currentBuffer = ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED, - sizeof(SUB_Q_CURRENT_POSITION), - CDROM_TAG_PLAY_ACTIVE); - if (currentBuffer == NULL) - { - return FALSE; - } - - // set the options in the output buffer format - ((PCDROM_SUB_Q_DATA_FORMAT) currentBuffer)->Format = IOCTL_CDROM_CURRENT_POSITION; - ((PCDROM_SUB_Q_DATA_FORMAT) currentBuffer)->Track = 0; - - // Send SCSI command to read Q Channel information. - status = ReadQChannel(deviceExtension, - NULL, - currentBuffer, - sizeof(CDROM_SUB_Q_DATA_FORMAT), - currentBuffer, - sizeof(SUB_Q_CURRENT_POSITION), - &bytesRead); - - if (!NT_SUCCESS(status)) - { - ExFreePool(currentBuffer); - return FALSE; - } - - // update the playactive flag appropriately - if (currentBuffer->Header.AudioStatus == AUDIO_STATUS_IN_PROGRESS) - { - deviceExtension->DeviceAdditionalData.PlayActive = TRUE; - } - else - { - deviceExtension->DeviceAdditionalData.PlayActive = FALSE; - } - - ExFreePool(currentBuffer); - - return deviceExtension->DeviceAdditionalData.PlayActive; -} - -NTSTATUS -RequestHandleGetInquiryData( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength) -/*++ - -Routine Description: - - Handler for IOCTL_CDROM_GET_INQUIRY_DATA - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - - *DataLength = 0; - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength == 0) - { - status = STATUS_BUFFER_TOO_SMALL; - } - else - { - PVOID outputBuffer = NULL; - - *DataLength = min(cdData->CachedInquiryDataByteCount, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength); - - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &outputBuffer, - NULL); - - if (NT_SUCCESS(status) && - (outputBuffer != NULL)) - { - // Always copy as much data as possible - RtlCopyMemory(outputBuffer, - cdData->CachedInquiryData, - *DataLength); - } - - // and finally decide between two possible status values - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < cdData->CachedInquiryDataByteCount) - { - status = STATUS_BUFFER_OVERFLOW; - } - } - - return status; -} - - -NTSTATUS -RequestHandleGetMediaTypeEx( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handler for IOCTL_STORAGE_GET_MEDIA_TYPES_EX - -Arguments: - - DeviceExtension - device context - Request - request to be handled - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - - PGET_MEDIA_TYPES mediaTypes = NULL; - PDEVICE_MEDIA_INFO mediaInfo = NULL; //&mediaTypes->MediaInfo[0]; - ULONG sizeNeeded = 0; - PZERO_POWER_ODD_INFO zpoddInfo = DeviceExtension->ZeroPowerODDInfo; - - *DataLength = 0; - - // Must run below dispatch level. - if (KeGetCurrentIrql() >= DISPATCH_LEVEL) - { - NT_ASSERT(FALSE); - return STATUS_INVALID_LEVEL; - } - - sizeNeeded = sizeof(GET_MEDIA_TYPES); - - // IsMmc is static... - if (cdData->Mmc.IsMmc) - { - sizeNeeded += sizeof(DEVICE_MEDIA_INFO) * 1; // return two media types - } - - status = WdfRequestRetrieveOutputBuffer(Request, - sizeNeeded, - (PVOID*)&mediaTypes, - NULL); - - if (NT_SUCCESS(status) && - (mediaTypes != NULL)) - { - mediaInfo = &mediaTypes->MediaInfo[0]; - - RtlZeroMemory(mediaTypes, sizeNeeded); - - // ISSUE-2000/5/11-henrygab - need to update GET_MEDIA_TYPES_EX - - mediaTypes->DeviceType = cdData->DriveDeviceType; - - mediaTypes->MediaInfoCount = 1; - mediaInfo->DeviceSpecific.RemovableDiskInfo.MediaType = CD_ROM; - mediaInfo->DeviceSpecific.RemovableDiskInfo.NumberMediaSides = 1; - mediaInfo->DeviceSpecific.RemovableDiskInfo.MediaCharacteristics = MEDIA_READ_ONLY; - mediaInfo->DeviceSpecific.RemovableDiskInfo.Cylinders.QuadPart = DeviceExtension->DiskGeometry.Cylinders.QuadPart; - mediaInfo->DeviceSpecific.RemovableDiskInfo.TracksPerCylinder = DeviceExtension->DiskGeometry.TracksPerCylinder; - mediaInfo->DeviceSpecific.RemovableDiskInfo.SectorsPerTrack = DeviceExtension->DiskGeometry.SectorsPerTrack; - mediaInfo->DeviceSpecific.RemovableDiskInfo.BytesPerSector = DeviceExtension->DiskGeometry.BytesPerSector; - - if (cdData->Mmc.IsMmc) - { - // also report a removable disk - mediaTypes->MediaInfoCount += 1; - - mediaInfo++; - mediaInfo->DeviceSpecific.RemovableDiskInfo.MediaType = RemovableMedia; - mediaInfo->DeviceSpecific.RemovableDiskInfo.NumberMediaSides = 1; - mediaInfo->DeviceSpecific.RemovableDiskInfo.MediaCharacteristics = MEDIA_READ_WRITE; - mediaInfo->DeviceSpecific.RemovableDiskInfo.Cylinders.QuadPart = DeviceExtension->DiskGeometry.Cylinders.QuadPart; - mediaInfo->DeviceSpecific.RemovableDiskInfo.TracksPerCylinder = DeviceExtension->DiskGeometry.TracksPerCylinder; - mediaInfo->DeviceSpecific.RemovableDiskInfo.SectorsPerTrack = DeviceExtension->DiskGeometry.SectorsPerTrack; - mediaInfo->DeviceSpecific.RemovableDiskInfo.BytesPerSector = DeviceExtension->DiskGeometry.BytesPerSector; - mediaInfo--; - - } - - // Status will either be success, if media is present, or no media. - // It would be optimal to base from density code and medium type, but not all devices - // have values for these fields. - - // Send a TUR to determine if media is present, only if the device is not in ZPODD mode. - if ((!EXCLUSIVE_MODE(cdData) || - EXCLUSIVE_OWNER(cdData, WdfRequestGetFileObject(Request))) && - ((zpoddInfo == NULL) || - (zpoddInfo->InZeroPowerState == FALSE))) - { - SCSI_REQUEST_BLOCK srb; - PCDB cdb = (PCDB)srb.Cdb; - - RtlZeroMemory(&srb,sizeof(SCSI_REQUEST_BLOCK)); - - srb.CdbLength = 6; - cdb->CDB6GENERIC.OperationCode = SCSIOP_TEST_UNIT_READY; - - srb.TimeOutValue = CDROM_TEST_UNIT_READY_TIMEOUT; - - status = DeviceSendSrbSynchronously(DeviceExtension->Device, - &srb, - NULL, - 0, - FALSE, - Request); - - if (NT_SUCCESS(status)) - { - // set the disk's media as current if we can write to it. - if (cdData->Mmc.IsMmc && cdData->Mmc.WriteAllowed) - { - mediaInfo++; - SET_FLAG(mediaInfo->DeviceSpecific.RemovableDiskInfo.MediaCharacteristics, - MEDIA_CURRENTLY_MOUNTED); - mediaInfo--; - } - else - { - SET_FLAG(mediaInfo->DeviceSpecific.RemovableDiskInfo.MediaCharacteristics, - MEDIA_CURRENTLY_MOUNTED); - } - } - else - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestHandleGetMediaTypeEx: GET_MEDIA_TYPES status of TUR - %lx\n", status)); - } - } - - // per legacy cdrom behavior, always return success - status = STATUS_SUCCESS; - } - - *DataLength = sizeNeeded; - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleGetDvdRegion( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handler for IOCTL_DVD_GET_REGION - -Arguments: - - DeviceExtension - device context - Request - request to be handled - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - PVOID outputBuffer = NULL; - size_t bytesReturned = 0; - - PDVD_COPY_PROTECT_KEY copyProtectKey = NULL; - ULONG keyLength = 0; - PDVD_DESCRIPTOR_HEADER dvdHeader; - PDVD_COPYRIGHT_DESCRIPTOR copyRightDescriptor; - PDVD_REGION dvdRegion = NULL; - PDVD_READ_STRUCTURE readStructure = NULL; - PDVD_RPC_KEY rpcKey; - - PAGED_CODE (); - - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL, - "RequestHandleGetDvdRegion: [%p] IOCTL_DVD_GET_REGION\n", Request)); - - *DataLength = 0; - - // reject the request if it's not a DVD device. - if (DeviceExtension->DeviceAdditionalData.DriveDeviceType != FILE_DEVICE_DVD) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - sizeof(DVD_REGION), - &outputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - // figure out how much data buffer we need - keyLength = max((sizeof(DVD_DESCRIPTOR_HEADER) + sizeof(DVD_COPYRIGHT_DESCRIPTOR)), - sizeof(DVD_READ_STRUCTURE)); - keyLength = max(keyLength, - DVD_RPC_KEY_LENGTH); - - // round the size to nearest ULONGLONG -- why? - // could this be to deal with device alignment issues? - keyLength += sizeof(ULONGLONG) - (keyLength & (sizeof(ULONGLONG) - 1)); - - readStructure = ExAllocatePool2(POOL_FLAG_NON_PAGED, - keyLength, - DVD_TAG_READ_KEY); - if (readStructure == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - } - - if (NT_SUCCESS(status)) - { - RtlZeroMemory (readStructure, keyLength); - readStructure->Format = DvdCopyrightDescriptor; - - // use READ_STRUCTURE to read copyright descriptor - status = ReadDvdStructure(DeviceExtension, - Request, - readStructure, - keyLength, - readStructure, - sizeof(DVD_DESCRIPTOR_HEADER) + sizeof(DVD_COPYRIGHT_DESCRIPTOR), - &bytesReturned); - } - - if (NT_SUCCESS(status)) - { - // we got the copyright descriptor, so now get the region if possible - dvdHeader = (PDVD_DESCRIPTOR_HEADER) readStructure; - copyRightDescriptor = (PDVD_COPYRIGHT_DESCRIPTOR) dvdHeader->Data; - - // the original irp's systembuffer has a copy of the info that - // should be passed down in the request - dvdRegion = outputBuffer; - - dvdRegion->CopySystem = copyRightDescriptor->CopyrightProtectionType; - dvdRegion->RegionData = copyRightDescriptor->RegionManagementInformation; - - // now reuse the buffer to request the copy protection info - copyProtectKey = (PDVD_COPY_PROTECT_KEY) readStructure; - RtlZeroMemory (copyProtectKey, DVD_RPC_KEY_LENGTH); - copyProtectKey->KeyLength = DVD_RPC_KEY_LENGTH; - copyProtectKey->KeyType = DvdGetRpcKey; - - // send a request for READ_KEY - status = DvdStartSessionReadKey(DeviceExtension, - IOCTL_DVD_READ_KEY, - Request, - copyProtectKey, - DVD_RPC_KEY_LENGTH, - copyProtectKey, - DVD_RPC_KEY_LENGTH, - &bytesReturned); - } - - if (NT_SUCCESS(status)) - { - // the request succeeded. if a supported scheme is returned, - // then return the information to the caller - rpcKey = (PDVD_RPC_KEY) copyProtectKey->KeyData; - - if (rpcKey->RpcScheme == 1) - { - if (rpcKey->TypeCode) - { - dvdRegion->SystemRegion = ~rpcKey->RegionMask; - dvdRegion->ResetCount = rpcKey->UserResetsAvailable; - } - else - { - // the drive has not been set for any region - dvdRegion->SystemRegion = 0; - dvdRegion->ResetCount = rpcKey->UserResetsAvailable; - } - - *DataLength = sizeof(DVD_REGION); - } - else - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "RequestHandleGetDvdRegion => rpcKey->RpcScheme != 1\n")); - status = STATUS_INVALID_DEVICE_REQUEST; - } - } - - // Clean up - if (readStructure != NULL) - { - ExFreePool(readStructure); - } - - return status; -} - -NTSTATUS -RequestValidateRawRead( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_CDROM_RAW_READ - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - - PVOID inputBuffer = NULL; - PIRP irp = NULL; - PIO_STACK_LOCATION currentStack = NULL; - - LARGE_INTEGER startingOffset = {0}; - ULONGLONG transferBytes = 0; - ULONGLONG endOffset; - ULONGLONG mdlBytes; - RAW_READ_INFO rawReadInfo = {0}; - - *DataLength = 0; - - irp = WdfRequestWdmGetIrp(Request); - currentStack = IoGetCurrentIrpStackLocation(irp); - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - - // Check that ending sector is on disc and buffers are there and of - // correct size. - if (NT_SUCCESS(status) && - (RequestParameters.Parameters.DeviceIoControl.Type3InputBuffer == NULL)) - { - // This is a call from user space. This is the only time that we need to validate parameters. - // Validate the input and get the input buffer into Type3InputBuffer - // so the rest of the code will be uniform. - if (inputBuffer != NULL) - { - currentStack->Parameters.DeviceIoControl.Type3InputBuffer = inputBuffer; - RequestParameters.Parameters.DeviceIoControl.Type3InputBuffer = inputBuffer; - - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < sizeof(RAW_READ_INFO)) - { - *DataLength = sizeof(RAW_READ_INFO); - status = STATUS_BUFFER_TOO_SMALL; - } - } - else - { - status = STATUS_INVALID_PARAMETER; - } - } - - if (NT_SUCCESS(status)) - { - // Since this ioctl is METHOD_OUT_DIRECT, we need to copy away the input buffer before interpreting it. - // This prevents a malicious app from messing with the input buffer while we are interpreting it. - rawReadInfo = *(PRAW_READ_INFO)RequestParameters.Parameters.DeviceIoControl.Type3InputBuffer; - - startingOffset.QuadPart = rawReadInfo.DiskOffset.QuadPart; - - if ((rawReadInfo.TrackMode == CDDA) || - (rawReadInfo.TrackMode == YellowMode2) || - (rawReadInfo.TrackMode == XAForm2) ) - { - transferBytes = (ULONGLONG)rawReadInfo.SectorCount * RAW_SECTOR_SIZE; - } - else if (rawReadInfo.TrackMode == RawWithSubCode) - { - transferBytes = (ULONGLONG)rawReadInfo.SectorCount * CD_RAW_SECTOR_WITH_SUBCODE_SIZE; - } - else if (rawReadInfo.TrackMode == RawWithC2) - { - transferBytes = (ULONGLONG)rawReadInfo.SectorCount * CD_RAW_SECTOR_WITH_C2_SIZE; - } - else if (rawReadInfo.TrackMode == RawWithC2AndSubCode) - { - transferBytes = (ULONGLONG)rawReadInfo.SectorCount * CD_RAW_SECTOR_WITH_C2_AND_SUBCODE_SIZE; - } - else - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "RequestValidateRawRead: Invalid TrackMode type %x for XA read\n", - rawReadInfo.TrackMode - )); - } - - endOffset = (ULONGLONG)rawReadInfo.SectorCount * COOKED_SECTOR_SIZE; - endOffset += startingOffset.QuadPart; - - // check for overflows.... - if (rawReadInfo.SectorCount == 0) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "RequestValidateRawRead: Invalid I/O parameters for XA " - "Read (zero sectors requested)\n")); - status = STATUS_INVALID_PARAMETER; - } - else if (transferBytes < (ULONGLONG)(rawReadInfo.SectorCount)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "RequestValidateRawRead: Invalid I/O parameters for XA " - "Read (TransferBytes Overflow)\n")); - status = STATUS_INVALID_PARAMETER; - } - else if (endOffset < (ULONGLONG)startingOffset.QuadPart) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "RequestValidateRawRead: Invalid I/O parameters for XA " - "Read (EndingOffset Overflow)\n")); - status = STATUS_INVALID_PARAMETER; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < transferBytes) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "RequestValidateRawRead: Invalid I/O parameters for XA " - "Read (Bad buffer size)\n")); - status = STATUS_INVALID_PARAMETER; - } - else if (endOffset > (ULONGLONG)DeviceExtension->PartitionLength.QuadPart) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "RequestValidateRawRead: Invalid I/O parameters for XA " - "Read (Request Out of Bounds)\n")); - status = STATUS_INVALID_PARAMETER; - } - } - - if (NT_SUCCESS(status)) - { - // cannot validate the MdlAddress, since it is not included in any - // other location per the DDK and file system calls. - - // validate the mdl describes at least the number of bytes - // requested from us. - mdlBytes = (ULONGLONG)MmGetMdlByteCount(irp->MdlAddress); - if (mdlBytes < transferBytes) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "RequestValidateRawRead: Invalid MDL %s, Irp %p\n", - "size (5)", irp)); - status = STATUS_INVALID_PARAMETER; - } - } - - if (NT_SUCCESS(status)) - { - // check the buffer for alignment - // This is important for x86 as some busses (ie ATAPI) - // require word-aligned buffers. - if ( ((ULONG_PTR)MmGetMdlVirtualAddress(irp->MdlAddress)) & - DeviceExtension->AdapterDescriptor->AlignmentMask ) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "RequestValidateRawRead: Invalid I/O parameters for " - "XA Read (Buffer %p not aligned with mask %x\n", - RequestParameters.Parameters.DeviceIoControl.Type3InputBuffer, - DeviceExtension->AdapterDescriptor->AlignmentMask)); - status = STATUS_INVALID_PARAMETER; - } - } - - if (NT_SUCCESS(status)) - { - // Validate the request is not too large for the adapter - BOOLEAN bufferIsPageAligned = FALSE; - ULONG maxLength = 0; - - // if buffer is not page-aligned, then subtract one as the - // transfer could cross a page boundary. - if ((((ULONG_PTR)MmGetMdlVirtualAddress(irp->MdlAddress)) & (PAGE_SIZE-1)) == 0) - { - bufferIsPageAligned = TRUE; - } - - if (bufferIsPageAligned) - { - maxLength = cdData->MaxPageAlignedTransferBytes; - } - else - { - maxLength = cdData->MaxUnalignedTransferBytes; - } - - if (transferBytes > maxLength) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "RequestValidateRawRead: The XA Read (type %x) would require %I64x bytes, " - "but the adapter can only handle %x bytes (for a%saligned buffer)\n", - rawReadInfo.TrackMode, - transferBytes, - maxLength, - (bufferIsPageAligned ? " " : "n un") - )); - status = STATUS_INVALID_PARAMETER; - } - } - - if (NT_SUCCESS(status)) - { - // - // HACKHACK - REF #0001 - // The retry count will be in this irp's IRP_MN function, - // as the new irp was freed, and we therefore cannot use - // this irp's next stack location for this function. - // This may be a good location to store this info for - // when we remove RAW_READ (mode switching), as we will - // no longer have the nextIrpStackLocation to play with - // when that occurs - // - currentStack->MinorFunction = MAXIMUM_RETRIES; // HACKHACK - REF #0001 - } - - return status; -} - -NTSTATUS -RequestValidateReadTocEx( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_CDROM_READ_TOC_EX - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - PCDROM_READ_TOC_EX inputBuffer = NULL; - - *DataLength = 0; - - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(CDROM_READ_TOC_EX)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - MINIMUM_CDROM_READ_TOC_EX_SIZE) - { - status = STATUS_BUFFER_TOO_SMALL; - *DataLength = MINIMUM_CDROM_READ_TOC_EX_SIZE; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength > - ((USHORT)-1)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength & - DeviceExtension->AdapterDescriptor->AlignmentMask) - { - status = STATUS_INVALID_PARAMETER; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - if ((inputBuffer->Reserved1 != 0) || - (inputBuffer->Reserved2 != 0) || - (inputBuffer->Reserved3 != 0)) - { - status = STATUS_INVALID_PARAMETER; - } - // NOTE: when adding new formats, ensure that first two bytes - // specify the amount of additional data available. - else if ((inputBuffer->Format == CDROM_READ_TOC_EX_FORMAT_TOC ) || - (inputBuffer->Format == CDROM_READ_TOC_EX_FORMAT_FULL_TOC) || - (inputBuffer->Format == CDROM_READ_TOC_EX_FORMAT_CDTEXT )) - { - // SessionTrack field is used - } - else if ((inputBuffer->Format == CDROM_READ_TOC_EX_FORMAT_SESSION) || - (inputBuffer->Format == CDROM_READ_TOC_EX_FORMAT_PMA) || - (inputBuffer->Format == CDROM_READ_TOC_EX_FORMAT_ATIP)) - { - // SessionTrack field is reserved - if (inputBuffer->SessionTrack != 0) - { - status = STATUS_INVALID_PARAMETER; - } - } - else - { - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - -NTSTATUS -RequestValidateReadToc( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_CDROM_READ_TOC - -Arguments: - - DeviceExtension - device context - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - *DataLength = 0; - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - sizeof(CDROM_TOC)) - { - // they didn't request the entire TOC -- use _EX version - // for partial transfers and such. - status = STATUS_BUFFER_TOO_SMALL; - *DataLength = sizeof(CDROM_TOC); - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength & - DeviceExtension->AdapterDescriptor->AlignmentMask) - { - status = STATUS_INVALID_PARAMETER; - } - - return status; -} - -NTSTATUS -RequestValidateGetLastSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_CDROM_GET_LAST_SESSION - -Arguments: - - DeviceExtension - device context - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - *DataLength = 0; - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - sizeof(CDROM_TOC_SESSION_DATA)) - { - status = STATUS_BUFFER_TOO_SMALL; - *DataLength = sizeof(CDROM_TOC_SESSION_DATA); - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength & - DeviceExtension->AdapterDescriptor->AlignmentMask) - { - status = STATUS_INVALID_PARAMETER; - } - - return status; -} - -NTSTATUS -RequestValidateReadQChannel( - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_CDROM_READ_Q_CHANNEL - -Arguments: - - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_SUB_Q_DATA_FORMAT inputBuffer = NULL; - ULONG transferByteCount = 0; - - *DataLength = 0; - - if(RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(CDROM_SUB_Q_DATA_FORMAT)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - // check for all valid types of request - if (inputBuffer->Format == IOCTL_CDROM_CURRENT_POSITION) - { - transferByteCount = sizeof(SUB_Q_CURRENT_POSITION); - } - else if (inputBuffer->Format == IOCTL_CDROM_MEDIA_CATALOG) - { - transferByteCount = sizeof(SUB_Q_MEDIA_CATALOG_NUMBER); - } - else if (inputBuffer->Format == IOCTL_CDROM_TRACK_ISRC) - { - transferByteCount = sizeof(SUB_Q_TRACK_ISRC); - } - else - { - // Format not valid - status = STATUS_INVALID_PARAMETER; - } - } - - if (NT_SUCCESS(status)) - { - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - transferByteCount) - { - status = STATUS_BUFFER_TOO_SMALL; - *DataLength = transferByteCount; - } - } - - return status; -} - -NTSTATUS -RequestValidateDvdReadStructure( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_DVD_READ_STRUCTURE - -Arguments: - - DeviceExtension - device context - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - *DataLength = 0; - - if (NT_SUCCESS(status)) - { - if(RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(DVD_READ_STRUCTURE)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestValidateDvdReadStructure - input buffer " - "length too small (was %d should be %d)\n", - (int)RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - sizeof(DVD_READ_STRUCTURE))); - status = STATUS_INVALID_PARAMETER; - } - else if(RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - sizeof(READ_DVD_STRUCTURES_HEADER)) - { - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestValidateDvdReadStructure - output buffer " - "cannot hold header information\n")); - status = STATUS_BUFFER_TOO_SMALL; - *DataLength = sizeof(READ_DVD_STRUCTURES_HEADER); - } - else if(RequestParameters.Parameters.DeviceIoControl.OutputBufferLength > - MAXUSHORT) - { - // key length must fit in two bytes - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestValidateDvdReadStructure - output buffer " - "too large\n")); - status = STATUS_INVALID_PARAMETER; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength & - DeviceExtension->AdapterDescriptor->AlignmentMask) - { - status = STATUS_INVALID_PARAMETER; - } - else if (DeviceExtension->DeviceAdditionalData.DriveDeviceType != FILE_DEVICE_DVD) - { - // reject the request if it's not a DVD device. - status = STATUS_INVALID_DEVICE_REQUEST; - } - } - - return status; -} - -NTSTATUS -RequestValidateDvdStartSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_DVD_START_SESSION - -Arguments: - - DeviceExtension - device context - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - *DataLength = 0; - - if (NT_SUCCESS(status)) - { - if(RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - sizeof(DVD_SESSION_ID)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestValidateDvdStartSession: DVD_START_SESSION - output " - "buffer too small\n")); - status = STATUS_BUFFER_TOO_SMALL; - *DataLength = sizeof(DVD_SESSION_ID); - } - else if (DeviceExtension->DeviceAdditionalData.DriveDeviceType != FILE_DEVICE_DVD) - { - // reject the request if it's not a DVD device. - status = STATUS_INVALID_DEVICE_REQUEST; - } - } - - return status; -} - -NTSTATUS -RequestValidateDvdSendKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_DVD_SEND_KEY, IOCTL_DVD_SEND_KEY2 - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PDVD_COPY_PROTECT_KEY key = NULL; - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &key, - NULL); - - if (NT_SUCCESS(status)) - { - if((RequestParameters.Parameters.DeviceIoControl.InputBufferLength < sizeof(DVD_COPY_PROTECT_KEY)) || - (RequestParameters.Parameters.DeviceIoControl.InputBufferLength != key->KeyLength)) - { - - // - // Key is too small to have a header or the key length doesn't - // match the input buffer length. Key must be invalid - // - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestValidateDvdSendKey: [%p] IOCTL_DVD_SEND_KEY - " - "key is too small or does not match KeyLength\n", - Request)); - status = STATUS_INVALID_PARAMETER; - } - } - - if (NT_SUCCESS(status)) - { - // allow only certain key type (non-destructive) to go through - // IOCTL_DVD_SEND_KEY (which only requires READ access to the device) - if (RequestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_DVD_SEND_KEY) - { - if ((key->KeyType != DvdChallengeKey) && - (key->KeyType != DvdBusKey2) && - (key->KeyType != DvdInvalidateAGID)) - { - status = STATUS_INVALID_PARAMETER; - } - } - else if ((key->KeyType != DvdChallengeKey) && - (key->KeyType != DvdBusKey1) && - (key->KeyType != DvdBusKey2) && - (key->KeyType != DvdTitleKey) && - (key->KeyType != DvdAsf) && - (key->KeyType != DvdSetRpcKey) && - (key->KeyType != DvdGetRpcKey) && - (key->KeyType != DvdDiskKey) && - (key->KeyType != DvdInvalidateAGID)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (DeviceExtension->DeviceAdditionalData.DriveDeviceType != FILE_DEVICE_DVD) - { - // reject the request if it's not a DVD device. - status = STATUS_INVALID_DEVICE_REQUEST; - } - } - - return status; -} - -NTSTATUS -RequestValidateGetConfiguration( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_CDROM_GET_CONFIGURATION - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - *DataLength = 0; - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - sizeof(GET_CONFIGURATION_HEADER)) - { - status = STATUS_BUFFER_TOO_SMALL; - *DataLength = sizeof(GET_CONFIGURATION_HEADER); - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength > 0xffff) - { - // output buffer is too large - status = STATUS_INVALID_BUFFER_SIZE; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength & - DeviceExtension->AdapterDescriptor->AlignmentMask) - { - // buffer is not proper size multiple - status = STATUS_INVALID_PARAMETER; - } - - if (NT_SUCCESS(status)) - { - -#if BUILD_WOW64_ENABLED && defined(_WIN64) - - if (WdfRequestIsFrom32BitProcess(Request)) - { - PGET_CONFIGURATION_IOCTL_INPUT32 inputBuffer = NULL; - - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(GET_CONFIGURATION_IOCTL_INPUT32)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - - // - // also verify the arguments are reasonable. - // - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (inputBuffer->Feature > 0xffff) - { - status = STATUS_INVALID_PARAMETER; - } - else if ((inputBuffer->RequestType != SCSI_GET_CONFIGURATION_REQUEST_TYPE_ONE) && - (inputBuffer->RequestType != SCSI_GET_CONFIGURATION_REQUEST_TYPE_CURRENT) && - (inputBuffer->RequestType != SCSI_GET_CONFIGURATION_REQUEST_TYPE_ALL)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (inputBuffer->Reserved[0] || inputBuffer->Reserved[1]) - { - status = STATUS_INVALID_PARAMETER; - } - } - } - else - -#endif - - { - PGET_CONFIGURATION_IOCTL_INPUT inputBuffer = NULL; - - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(GET_CONFIGURATION_IOCTL_INPUT)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - - // also verify the arguments are reasonable. - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (inputBuffer->Feature > 0xffff) - { - status = STATUS_INVALID_PARAMETER; - } - else if ((inputBuffer->RequestType != SCSI_GET_CONFIGURATION_REQUEST_TYPE_ONE) && - (inputBuffer->RequestType != SCSI_GET_CONFIGURATION_REQUEST_TYPE_CURRENT) && - (inputBuffer->RequestType != SCSI_GET_CONFIGURATION_REQUEST_TYPE_ALL)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (inputBuffer->Reserved[0] || inputBuffer->Reserved[1]) - { - status = STATUS_INVALID_PARAMETER; - } - } - } - } - - return status; -} - -NTSTATUS -RequestValidateSetSpeed( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_CDROM_SET_SPEED - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - PCDROM_SET_SPEED inputBuffer = NULL; - ULONG requiredLength = 0; - - *DataLength = 0; - - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < sizeof(CDROM_SET_SPEED)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - - if (NT_SUCCESS(status)) - { - // Get the request type using CDROM_SET_SPEED structure - status = WdfRequestRetrieveInputBuffer(Request, - sizeof(CDROM_SET_SPEED), - &inputBuffer, - NULL); - - } - - if (NT_SUCCESS(status)) - { - if (inputBuffer->RequestType > CdromSetStreaming) - { - // Unknown request type. - status = STATUS_INVALID_PARAMETER; - } - else if (inputBuffer->RequestType == CdromSetSpeed) - { - requiredLength = sizeof(CDROM_SET_SPEED); - } - else - { - // Don't send SET STREAMING command if this is not a MMC compliant device - if (cdData->Mmc.IsMmc == FALSE) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - - requiredLength = sizeof(CDROM_SET_STREAMING); - } - } - - if (NT_SUCCESS(status)) - { - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < requiredLength) - { - // Input buffer too small - status = STATUS_INFO_LENGTH_MISMATCH; - } - } - - return status; -} - -NTSTATUS -RequestValidateAacsReadMediaKeyBlock( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_AACS_READ_MEDIA_KEY_BLOCK - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - PAACS_LAYER_NUMBER layerNumber = NULL; - - *DataLength = 0; - - if (!cdData->Mmc.IsAACS) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - else if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength != sizeof(AACS_LAYER_NUMBER)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < 8) - { - // This is a variable-length structure, but we're pretty sure - // it can never be less than eight bytes... - *DataLength = 8; - status = STATUS_BUFFER_TOO_SMALL; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &layerNumber, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (*layerNumber > 255) - { - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - -NTSTATUS -RequestValidateAacsStartSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_AACS_START_SESSION - -Arguments: - - DeviceExtension - device context - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - - *DataLength = 0; - - if (!cdData->Mmc.IsAACS) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < sizeof(DVD_SESSION_ID)) - { - *DataLength = sizeof(DVD_SESSION_ID); - status = STATUS_BUFFER_TOO_SMALL; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength > sizeof(DVD_SESSION_ID)) - { - status = STATUS_INVALID_BUFFER_SIZE; - } - - return status; -} - -NTSTATUS -RequestValidateAacsSendCertificate( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_AACS_SEND_CERTIFICATE - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - PAACS_SEND_CERTIFICATE inputBuffer = NULL; - - *DataLength = 0; - - if (!cdData->Mmc.IsAACS) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - else if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength != sizeof(AACS_SEND_CERTIFICATE)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (inputBuffer->SessionId > MAX_COPY_PROTECT_AGID) - { - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - -NTSTATUS -RequestValidateAacsGetCertificate( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_AACS_GET_CERTIFICATE - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - PDVD_SESSION_ID sessionId = NULL; - - *DataLength = 0; - - if (!cdData->Mmc.IsAACS) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - else if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength != sizeof(DVD_SESSION_ID)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < sizeof(AACS_CERTIFICATE)) - { - *DataLength = sizeof(AACS_CERTIFICATE); - status = STATUS_BUFFER_TOO_SMALL; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength > sizeof(AACS_CERTIFICATE)) - { - status = STATUS_INVALID_BUFFER_SIZE; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &sessionId, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (*sessionId > MAX_COPY_PROTECT_AGID) - { - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - -NTSTATUS -RequestValidateAacsGetChallengeKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_AACS_GET_CHALLENGE_KEY - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - PDVD_SESSION_ID sessionId = NULL; - - *DataLength = 0; - - if (!cdData->Mmc.IsAACS) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - else if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength != sizeof(DVD_SESSION_ID)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < sizeof(AACS_CHALLENGE_KEY)) - { - *DataLength = sizeof(AACS_CHALLENGE_KEY); - status = STATUS_BUFFER_TOO_SMALL; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength > sizeof(AACS_CHALLENGE_KEY)) - { - status = STATUS_INVALID_BUFFER_SIZE; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &sessionId, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (*sessionId > MAX_COPY_PROTECT_AGID) - { - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - -NTSTATUS -RequestValidateAacsSendChallengeKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_AACS_SEND_CHALLENGE_KEY - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - PAACS_SEND_CHALLENGE_KEY inputBuffer = NULL; - - *DataLength = 0; - - if (!cdData->Mmc.IsAACS) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - else if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength != sizeof(AACS_SEND_CHALLENGE_KEY)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (inputBuffer->SessionId > MAX_COPY_PROTECT_AGID) - { - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - -NTSTATUS -RequestValidateAacsReadVolumeId( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_AACS_READ_VOLUME_ID - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - PDVD_SESSION_ID sessionId = NULL; - - *DataLength = 0; - - if (!cdData->Mmc.IsAACS) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - else if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength != sizeof(DVD_SESSION_ID)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < sizeof(AACS_VOLUME_ID)) - { - *DataLength = sizeof(AACS_VOLUME_ID); - status = STATUS_BUFFER_TOO_SMALL; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength > sizeof(AACS_VOLUME_ID)) - { - status = STATUS_INVALID_BUFFER_SIZE; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &sessionId, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (*sessionId > MAX_COPY_PROTECT_AGID) - { - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - -NTSTATUS -RequestValidateAacsReadSerialNumber( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_AACS_READ_SERIAL_NUMBER - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - PDVD_SESSION_ID sessionId = NULL; - - *DataLength = 0; - - if (!cdData->Mmc.IsAACS) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - else if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength != sizeof(DVD_SESSION_ID)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < sizeof(AACS_SERIAL_NUMBER)) - { - *DataLength = sizeof(AACS_SERIAL_NUMBER); - status = STATUS_BUFFER_TOO_SMALL; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength > sizeof(AACS_SERIAL_NUMBER)) - { - status = STATUS_INVALID_BUFFER_SIZE; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &sessionId, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (*sessionId > MAX_COPY_PROTECT_AGID) - { - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - -NTSTATUS -RequestValidateAacsReadMediaId( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_AACS_READ_MEDIA_ID - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - PDVD_SESSION_ID sessionId = NULL; - - *DataLength = 0; - - if (!cdData->Mmc.IsAACS) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - else if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength != sizeof(DVD_SESSION_ID)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < sizeof(AACS_MEDIA_ID)) - { - *DataLength = sizeof(AACS_MEDIA_ID); - status = STATUS_BUFFER_TOO_SMALL; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength > sizeof(AACS_MEDIA_ID)) - { - status = STATUS_INVALID_BUFFER_SIZE; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &sessionId, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (*sessionId > MAX_COPY_PROTECT_AGID) - { - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - -NTSTATUS -RequestValidateAacsBindingNonce( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_AACS_READ_BINDING_NONCE - IOCTL_AACS_GENERATE_BINDING_NONCE - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - PAACS_READ_BINDING_NONCE inputBuffer = NULL; - - *DataLength = 0; - - if (!cdData->Mmc.IsAACS) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - else if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength != sizeof(AACS_READ_BINDING_NONCE)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < sizeof(AACS_BINDING_NONCE)) - { - *DataLength = sizeof(AACS_BINDING_NONCE); - status = STATUS_BUFFER_TOO_SMALL; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength > sizeof(AACS_BINDING_NONCE)) - { - status = STATUS_INVALID_BUFFER_SIZE; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (inputBuffer->SessionId > MAX_COPY_PROTECT_AGID) - { - status = STATUS_INVALID_PARAMETER; - } - else if (inputBuffer->NumberOfSectors > 255) - { - status = STATUS_INVALID_PARAMETER; - } - else if (inputBuffer->StartLba > MAXULONG) - { - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - -NTSTATUS -RequestValidateExclusiveAccess( - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_CDROM_EXCLUSIVE_ACCESS - -Arguments: - - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_EXCLUSIVE_ACCESS exclusiveAccess = NULL; - - *DataLength = 0; - - if (KeGetCurrentIrql() != PASSIVE_LEVEL) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, "RequestValidateExclusiveAccess: IOCTL must be called at passive level.\n")); - status = STATUS_INVALID_DEVICE_REQUEST; - } - else if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < sizeof(CDROM_EXCLUSIVE_ACCESS)) - { - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, "RequestValidateExclusiveAccess: Input buffer too small\n")); - status = STATUS_INFO_LENGTH_MISMATCH; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &exclusiveAccess, - NULL); - } - - if (NT_SUCCESS(status)) - { - switch (exclusiveAccess->RequestType) - { - case ExclusiveAccessQueryState: - { - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - sizeof(CDROM_EXCLUSIVE_LOCK_STATE)) - { - // - // Output buffer too small. - // - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, "RequestValidateExclusiveAccess: Output buffer too small\n")); - *DataLength = sizeof(CDROM_EXCLUSIVE_LOCK_STATE); - status = STATUS_BUFFER_TOO_SMALL; - } - break; - } - - case ExclusiveAccessLockDevice: - { - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(CDROM_EXCLUSIVE_LOCK)) - { - // - // Input buffer too small - // - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, "RequestValidateExclusiveAccess: Input buffer too small\n")); - status = STATUS_INFO_LENGTH_MISMATCH; - } - break; - } - case ExclusiveAccessUnlockDevice: - { - // - // Nothing to check - // - break; - } - - default: - { - // - // Unknown request type. - // - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, "RequestValidateExclusiveAccess: Invalid request type\n")); - status = STATUS_INVALID_PARAMETER; - } - } - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleExclusiveAccessQueryLockState( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ) -/*++ - -Routine Description: - - Handle request of IOCTL_CDROM_EXCLUSIVE_ACCESS with ExclusiveAccessQueryState - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PCDROM_DATA cdData = &deviceExtension->DeviceAdditionalData; - PCDROM_EXCLUSIVE_LOCK_STATE exclusiveLockState = NULL; - - PAGED_CODE(); - - status = WdfRequestRetrieveOutputBuffer(Request, - sizeof(CDROM_EXCLUSIVE_LOCK_STATE), - &exclusiveLockState, - NULL); - NT_ASSERT(NT_SUCCESS(status)); - - RtlZeroMemory(exclusiveLockState, sizeof(CDROM_EXCLUSIVE_LOCK_STATE)); - - if (EXCLUSIVE_MODE(cdData)) - { - // Device is locked for exclusive use - exclusiveLockState->LockState = TRUE; - - RtlCopyMemory(&exclusiveLockState->CallerName, - &cdData->CallerName, - CDROM_EXCLUSIVE_CALLER_LENGTH); - - } - else - { - // Device is not locked - exclusiveLockState->LockState = FALSE; - } - - RequestCompletion(deviceExtension, Request, status, sizeof(CDROM_EXCLUSIVE_LOCK_STATE)); - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleExclusiveAccessLockDevice( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ) -/*++ - -Routine Description: - - Handle request of IOCTL_CDROM_EXCLUSIVE_ACCESS with ExclusiveAccessLockDevice - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PCDROM_DATA cdData = &deviceExtension->DeviceAdditionalData; - PCDROM_EXCLUSIVE_LOCK exclusiveLock = NULL; - PIO_ERROR_LOG_PACKET logEntry; - - WDFFILEOBJECT fileObject = NULL; - ULONG idx = 0; - ULONG nameLength = 0; - - PAGED_CODE(); - - fileObject = WdfRequestGetFileObject(Request); - - if (fileObject == NULL) - { - status = STATUS_INVALID_HANDLE; - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestHandleExclusiveAccessLockDevice: FileObject is NULL, cannot grant exclusive access\n")); - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - sizeof(CDROM_EXCLUSIVE_LOCK), - &exclusiveLock, - NULL); - } - - if (NT_SUCCESS(status)) - { - // Validate the caller name string - for (idx = 0; (idx < CDROM_EXCLUSIVE_CALLER_LENGTH) && (exclusiveLock->CallerName[idx] != '\0'); idx++) - { - if (!ValidChar(exclusiveLock->CallerName[idx])) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestHandleExclusiveAccessLockDevice: Invalid characters in caller name\n")); - // error out - status = STATUS_INVALID_PARAMETER; - break; - } - } - } - - if (NT_SUCCESS(status)) - { - if ((idx == 0) || (idx >= CDROM_EXCLUSIVE_CALLER_LENGTH)) - { - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestHandleExclusiveAccessLockDevice: Not a valid null terminated string.\n")); - //error out - status = STATUS_INVALID_PARAMETER; - } - else - { - nameLength = idx+1; // Add 1 for the NULL character - NT_ASSERT(nameLength <= CDROM_EXCLUSIVE_CALLER_LENGTH); - } - } - - // If the file system is still mounted on this device fail the request, - // unless the force lock flag is set. - if (NT_SUCCESS(status)) - { - if ((TEST_FLAG(exclusiveLock->Access.Flags, CDROM_LOCK_IGNORE_VOLUME) == FALSE) && - IsVolumeMounted(deviceExtension->DeviceObject)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestHandleExclusiveAccessLockDevice: Unable to lock device, file system mounted\n")); - status = STATUS_INVALID_DEVICE_STATE; - } - } - - // Lock the device for exclusive access if the device is not already locked - if (NT_SUCCESS(status)) - { - if (InterlockedCompareExchangePointer((PVOID)&cdData->ExclusiveOwner, (PVOID)fileObject, NULL) == NULL) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestHandleExclusiveAccessLockDevice: Entering exclusive mode! Device locked by file object %p\n", fileObject)); - - // Zero out the CallerName before storing it in the extension - RtlZeroMemory(&cdData->CallerName, CDROM_EXCLUSIVE_CALLER_LENGTH); - RtlCopyMemory(&cdData->CallerName, - &exclusiveLock->CallerName, - nameLength); - - // Send Exclusive Lock notification - DeviceSendNotification(deviceExtension, - &GUID_IO_CDROM_EXCLUSIVE_LOCK, - 0, - NULL); - - // Log an informational event with the caller name - logEntry = IoAllocateErrorLogEntry( - deviceExtension->DeviceObject, - sizeof(IO_ERROR_LOG_PACKET) + CDROM_EXCLUSIVE_CALLER_LENGTH); - - if (logEntry != NULL) - { - PUCHAR dumpDataPtr = (PUCHAR) logEntry->DumpData; - - logEntry->FinalStatus = STATUS_SUCCESS; - logEntry->ErrorCode = IO_CDROM_EXCLUSIVE_LOCK; - logEntry->SequenceNumber = 0; - logEntry->MajorFunctionCode = IRP_MJ_DEVICE_CONTROL; - logEntry->IoControlCode = IOCTL_CDROM_EXCLUSIVE_ACCESS; - logEntry->RetryCount = 0; - logEntry->UniqueErrorValue = 0x1; - logEntry->DumpDataSize = CDROM_EXCLUSIVE_CALLER_LENGTH; - - RtlCopyMemory(dumpDataPtr, - (PUCHAR)&cdData->CallerName, - CDROM_EXCLUSIVE_CALLER_LENGTH); - - // Write the error log packet. - IoWriteErrorLogEntry(logEntry); - } - - } - else - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestHandleExclusiveAccessLockDevice: Unable to lock device, device already locked.\n")); - - status = STATUS_ACCESS_DENIED; - } - } - - RequestCompletion(deviceExtension, Request, status, 0); - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleExclusiveAccessUnlockDevice( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ) -/*++ - -Routine Description: - - Handle request of IOCTL_CDROM_EXCLUSIVE_ACCESS with ExclusiveAccessUnlockDevice - -Arguments: - - Device - device handle - Request - request to be handled - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PCDROM_EXCLUSIVE_ACCESS exclusiveAccess = NULL; - WDFFILEOBJECT fileObject = NULL; - - PAGED_CODE(); - - fileObject = WdfRequestGetFileObject(Request); - - if (fileObject == NULL) - { - // The device can be unlocked from exclusive mode only via the file object which locked it. - status = STATUS_INVALID_HANDLE; - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestHandleExclusiveAccessUnlockDevice: FileObject is NULL, cannot release exclusive access\n")); - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - sizeof(PCDROM_EXCLUSIVE_ACCESS), - &exclusiveAccess, - NULL); - } - - if (NT_SUCCESS(status)) - { - status = DeviceUnlockExclusive(deviceExtension, fileObject, - TEST_FLAG(exclusiveAccess->Flags, CDROM_NO_MEDIA_NOTIFICATIONS)); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "RequestHandleExclusiveAccessUnlockDevice: Device unlocked\n")); - } - - RequestCompletion(deviceExtension, Request, status, 0); - - return status; -} - -NTSTATUS -RequestHandleQueryPropertyRetrieveCachedData( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_STORAGE_QUERY_PROPERTY when the required data is cached. - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PSTORAGE_PROPERTY_QUERY inputBuffer = NULL; - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - - if (NT_SUCCESS(status)) - { - if (inputBuffer->PropertyId == StorageDeviceProperty) - { - // check output buffer length - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength == 0) - { - // According to MSDN, an output buffer of size 0 can be used to determine if a property exists - // so this must be a success case with no data transferred - *DataLength = 0; - status = STATUS_SUCCESS; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < sizeof(STORAGE_DESCRIPTOR_HEADER)) - { - // Buffer too small - *DataLength = DeviceExtension->DeviceDescriptor->Size; - status = STATUS_BUFFER_TOO_SMALL; - } - else - { - PSTORAGE_DEVICE_DESCRIPTOR outputDescriptor = NULL; - CHAR* localDescriptorBuffer = (CHAR*)DeviceExtension->DeviceDescriptor; - - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &outputDescriptor, - NULL); - - if (NT_SUCCESS(status)) - { - // transfer as much data out as the buffer will allow - *DataLength = min(RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - DeviceExtension->DeviceDescriptor->Size); - - RtlCopyMemory(outputDescriptor, - DeviceExtension->DeviceDescriptor, - *DataLength); - - // walk through and update offset variables to reflect data that didn't make it into the output buffer - if ((*DataLength >= RTL_SIZEOF_THROUGH_FIELD(STORAGE_DEVICE_DESCRIPTOR, VendorIdOffset)) && - (DeviceExtension->DeviceDescriptor->VendorIdOffset != 0) && - (DeviceExtension->DeviceDescriptor->VendorIdOffset != 0xFFFFFFFF)) - { - // set VendorIdOffset appropriately - if (*DataLength < - (DeviceExtension->DeviceDescriptor->VendorIdOffset + strlen(localDescriptorBuffer + DeviceExtension->DeviceDescriptor->VendorIdOffset))) - { - outputDescriptor->VendorIdOffset = 0; - } - } - - if ((*DataLength >= RTL_SIZEOF_THROUGH_FIELD(STORAGE_DEVICE_DESCRIPTOR, ProductIdOffset)) && - (DeviceExtension->DeviceDescriptor->ProductIdOffset != 0) && - (DeviceExtension->DeviceDescriptor->ProductIdOffset != 0xFFFFFFFF)) - { - // set ProductIdOffset appropriately - if (*DataLength < - (DeviceExtension->DeviceDescriptor->ProductIdOffset + strlen(localDescriptorBuffer + DeviceExtension->DeviceDescriptor->ProductIdOffset))) - { - outputDescriptor->ProductIdOffset = 0; - } - } - - if ((*DataLength >= RTL_SIZEOF_THROUGH_FIELD(STORAGE_DEVICE_DESCRIPTOR, ProductRevisionOffset)) && - (DeviceExtension->DeviceDescriptor->ProductRevisionOffset != 0) && - (DeviceExtension->DeviceDescriptor->ProductRevisionOffset != 0xFFFFFFFF)) - { - // set ProductRevisionOffset appropriately - if (*DataLength < - (DeviceExtension->DeviceDescriptor->ProductRevisionOffset + strlen(localDescriptorBuffer + DeviceExtension->DeviceDescriptor->ProductRevisionOffset))) - { - outputDescriptor->ProductRevisionOffset = 0; - } - } - - if ((*DataLength >= RTL_SIZEOF_THROUGH_FIELD(STORAGE_DEVICE_DESCRIPTOR, SerialNumberOffset)) && - (DeviceExtension->DeviceDescriptor->SerialNumberOffset != 0) && - (DeviceExtension->DeviceDescriptor->SerialNumberOffset != 0xFFFFFFFF)) - { - // set SerialNumberOffset appropriately - if (*DataLength < - (DeviceExtension->DeviceDescriptor->SerialNumberOffset + strlen(localDescriptorBuffer + DeviceExtension->DeviceDescriptor->SerialNumberOffset))) - { - // NOTE: setting this to 0 since that is what most port drivers do - // [this could cause issues with SCSI port devices whose clients expect -1 in this field] - outputDescriptor->SerialNumberOffset = 0; - } - } - status = STATUS_SUCCESS; - } - } - } //end of StorageDeviceProperty - else if (inputBuffer->PropertyId == StorageAdapterProperty) - { - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength == 0) - { - // According to MSDN, an output buffer of size 0 can be used to determine if a property exists - // so this must be a success case with no data transferred - *DataLength = 0; - status = STATUS_SUCCESS; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < sizeof(STORAGE_DESCRIPTOR_HEADER)) - { - // Buffer too small - *DataLength = DeviceExtension->AdapterDescriptor->Size; - status = STATUS_BUFFER_TOO_SMALL; - } - else - { - PSTORAGE_ADAPTER_DESCRIPTOR outputDescriptor = NULL; - - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &outputDescriptor, - NULL); - if (NT_SUCCESS(status)) - { - // copy as much data out as the buffer will allow - *DataLength = min(RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - DeviceExtension->AdapterDescriptor->Size); - - RtlCopyMemory(outputDescriptor, - DeviceExtension->AdapterDescriptor, - *DataLength); - - // set status - status = STATUS_SUCCESS; - } - } - } - } - - return status; -} - -NTSTATUS -RequestHandleQueryPropertyDeviceUniqueId( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ) -/*++ - -Routine Description: - - Handle request of IOCTL_STORAGE_QUERY_PROPERTY with StorageDeviceUniqueIdProperty. - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PSTORAGE_PROPERTY_QUERY inputBuffer = NULL; - PSTORAGE_DESCRIPTOR_HEADER descHeader = NULL; - size_t outLength = 0; - WDF_REQUEST_PARAMETERS requestParameters; - - // Get the Request parameters - WDF_REQUEST_PARAMETERS_INIT(&requestParameters); - WdfRequestGetParameters(Request, &requestParameters); - - status = WdfRequestRetrieveInputBuffer(Request, - requestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - - if (NT_SUCCESS(status)) - { - BOOLEAN overflow = FALSE; - BOOLEAN infoFound = FALSE; - - // Must run at less then dispatch. - if (KeGetCurrentIrql() >= DISPATCH_LEVEL) - { - NT_ASSERT(FALSE); - outLength = 0; - status = STATUS_INVALID_LEVEL; - } - else if (inputBuffer->QueryType == PropertyExistsQuery) - { - outLength = 0; - status = STATUS_SUCCESS; - } - else if (inputBuffer->QueryType != PropertyStandardQuery) - { - outLength = 0; - status = STATUS_NOT_SUPPORTED; - } - else - { - // Check AdditionalParameters validity. - if (inputBuffer->AdditionalParameters[0] == DUID_INCLUDE_SOFTWARE_IDS) - { - // Do nothing - } - else if (inputBuffer->AdditionalParameters[0] == DUID_HARDWARE_IDS_ONLY) - { - // Do nothing - } - else - { - outLength = 0; - status = STATUS_INVALID_PARAMETER; - } - - if (NT_SUCCESS(status) && - (outLength < sizeof(STORAGE_DESCRIPTOR_HEADER))) - { - outLength = 0; - status = STATUS_INFO_LENGTH_MISMATCH; - } - } - - // From this point forward the status depends on the overflow - // and infoFound flags. - if (NT_SUCCESS(status)) - { - outLength = requestParameters.Parameters.DeviceIoControl.OutputBufferLength; - status = WdfRequestRetrieveOutputBuffer(Request, - requestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &descHeader, - NULL); - } - - if (NT_SUCCESS(status)) - { - RtlZeroMemory(descHeader, outLength); - - descHeader->Version = DUID_VERSION_1; - descHeader->Size = sizeof(STORAGE_DEVICE_UNIQUE_IDENTIFIER); - - // Try to build device unique id from StorageDeviceIdProperty. - status = RequestDuidGetDeviceIdProperty(deviceExtension, - Request, - requestParameters, - &outLength); - - if (status == STATUS_BUFFER_OVERFLOW) - { - overflow = TRUE; - } - - if (NT_SUCCESS(status)) - { - infoFound = TRUE; - } - - // Try to build device unique id from StorageDeviceProperty. - status = RequestDuidGetDeviceProperty(deviceExtension, - Request, - requestParameters, - &outLength); - - if (status == STATUS_BUFFER_OVERFLOW) - { - overflow = TRUE; - } - - if (NT_SUCCESS(status)) - { - infoFound = TRUE; - } - - // Return overflow, success, or a generic error. - if (overflow) - { - // If output buffer is STORAGE_DESCRIPTOR_HEADER, then return - // success to the user. Otherwise, send an error so the user - // knows a larger buffer is required. - if (outLength == sizeof(STORAGE_DESCRIPTOR_HEADER)) - { - status = STATUS_SUCCESS; - } - else - { - outLength = (ULONG)WdfRequestGetInformation(Request); - status = STATUS_BUFFER_OVERFLOW; - } - - } - else if (infoFound) - { - status = STATUS_SUCCESS; - - // Exercise the compare routine. This should always succeed. - NT_ASSERT(DuidExactMatch == CompareStorageDuids((PSTORAGE_DEVICE_UNIQUE_IDENTIFIER)descHeader, - (PSTORAGE_DEVICE_UNIQUE_IDENTIFIER)descHeader)); - - } - else - { - status = STATUS_NOT_FOUND; - } - } - } - - RequestCompletion(deviceExtension, Request, status, outLength); - - return status; -} - -NTSTATUS -RequestHandleQueryPropertyWriteCache( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ) -/*++ - -Routine Description: - - Handle request of IOCTL_STORAGE_QUERY_PROPERTY with StorageDeviceWriteCacheProperty. - -Arguments: - - DeviceExtension - device context - Request - request to be handled - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PSTORAGE_PROPERTY_QUERY query = NULL; - PSTORAGE_WRITE_CACHE_PROPERTY writeCache = NULL; - PMODE_PARAMETER_HEADER modeData = NULL; - PMODE_CACHING_PAGE pageData = NULL; - size_t length = 0; - ULONG information = 0; - PSCSI_REQUEST_BLOCK srb = NULL; - WDF_REQUEST_PARAMETERS requestParameters; - - // Get the Request parameters - WDF_REQUEST_PARAMETERS_INIT(&requestParameters); - WdfRequestGetParameters(Request, &requestParameters); - - status = WdfRequestRetrieveInputBuffer(Request, - requestParameters.Parameters.DeviceIoControl.InputBufferLength, - &query, - NULL); - - if (NT_SUCCESS(status)) - { - - // Must run at less then dispatch. - if (KeGetCurrentIrql() >= DISPATCH_LEVEL) - { - NT_ASSERT(FALSE); - status = STATUS_INVALID_LEVEL; - } - else if (query->QueryType == PropertyExistsQuery) - { - information = 0; - status = STATUS_SUCCESS; - } - else if (query->QueryType != PropertyStandardQuery) - { - status = STATUS_NOT_SUPPORTED; - } - } - - if (NT_SUCCESS(status)) - { - length = requestParameters.Parameters.DeviceIoControl.OutputBufferLength; - - if (length < sizeof(STORAGE_DESCRIPTOR_HEADER)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - requestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &writeCache, - NULL); - } - - if (NT_SUCCESS(status)) - { - RtlZeroMemory(writeCache, length); - - // Set version and required size. - writeCache->Version = sizeof(STORAGE_WRITE_CACHE_PROPERTY); - writeCache->Size = sizeof(STORAGE_WRITE_CACHE_PROPERTY); - - if (length < sizeof(STORAGE_WRITE_CACHE_PROPERTY)) - { - // caller only wants header information, bail out. - information = sizeof(STORAGE_DESCRIPTOR_HEADER); - status = STATUS_SUCCESS; - - RequestCompletion(deviceExtension, Request, status, information); - return status; - } - } - - if (NT_SUCCESS(status)) - { - srb = ExAllocatePool2(POOL_FLAG_NON_PAGED, - sizeof(SCSI_REQUEST_BLOCK) + - (sizeof(ULONG_PTR) * 2), - CDROM_TAG_SRB); - - if (srb == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - } - - if (NT_SUCCESS(status)) - { - RtlZeroMemory(srb, sizeof(SCSI_REQUEST_BLOCK)); - - // Set known values - writeCache->NVCacheEnabled = FALSE; - writeCache->UserDefinedPowerProtection = TEST_FLAG(deviceExtension->DeviceFlags, DEV_POWER_PROTECTED); - - // Check for flush cache support by sending a sync cache command - // to the device. - - // Set timeout value and mark the request as not being a tagged request. - srb->Length = SCSI_REQUEST_BLOCK_SIZE; - srb->TimeOutValue = TimeOutValueGetCapValue(deviceExtension->TimeOutValue, 4); - srb->QueueTag = SP_UNTAGGED; - srb->QueueAction = SRB_SIMPLE_TAG_REQUEST; - srb->SrbFlags = deviceExtension->SrbFlags; - - srb->Function = SRB_FUNCTION_EXECUTE_SCSI; - srb->CdbLength = 10; - - srb->Cdb[0] = SCSIOP_SYNCHRONIZE_CACHE; - - status = DeviceSendSrbSynchronously(Device, - srb, - NULL, - 0, - TRUE, //flush drive cache - Request); - - if (NT_SUCCESS(status)) - { - writeCache->FlushCacheSupported = TRUE; - } - else - { - // Device does not support sync cache - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "RequestHandleQueryPropertyWriteCache: Synchronize cache failed with status 0x%X\n", status)); - writeCache->FlushCacheSupported = FALSE; - - // Reset the status if there was any failure - status = STATUS_SUCCESS; - } - - modeData = ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED, - MODE_PAGE_DATA_SIZE, - CDROM_TAG_MODE_DATA); - - if (modeData == NULL) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "RequestHandleQueryPropertyWriteCache: Unable to allocate mode data buffer\n")); - status = STATUS_INSUFFICIENT_RESOURCES; - } - } - - if (NT_SUCCESS(status)) - { - RtlZeroMemory(modeData, MODE_PAGE_DATA_SIZE); - - length = DeviceRetrieveModeSenseUsingScratch(deviceExtension, - (PCHAR)modeData, - MODE_PAGE_DATA_SIZE, - MODE_PAGE_CACHING, - MODE_SENSE_CURRENT_VALUES); - - if (length < sizeof(MODE_PARAMETER_HEADER)) - { - // Retry the request in case of a check condition. - length = DeviceRetrieveModeSenseUsingScratch(deviceExtension, - (PCHAR)modeData, - MODE_PAGE_DATA_SIZE, - MODE_PAGE_CACHING, - MODE_SENSE_CURRENT_VALUES); - - if (length < sizeof(MODE_PARAMETER_HEADER)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, "RequestHandleQueryPropertyWriteCache: Mode Sense failed\n")); - status = STATUS_IO_DEVICE_ERROR; - } - } - } - - if (NT_SUCCESS(status)) - { - // If the length is greater than length indicated by the mode data reset - // the data to the mode data. - if (length > (ULONG) (modeData->ModeDataLength + 1)) - { - length = modeData->ModeDataLength + 1; - } - - // Look for caching page in the returned mode page data. - pageData = ModeSenseFindSpecificPage((PCHAR)modeData, - length, - MODE_PAGE_CACHING, - TRUE); - - // Check if valid caching page exists. - if (pageData == NULL) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "RequestHandleQueryPropertyWriteCache: Unable to find caching mode page.\n")); - - // Set write cache value as unknown. - writeCache->WriteCacheEnabled = WriteCacheEnableUnknown; - writeCache->WriteCacheType = WriteCacheTypeUnknown; - } - else - { - writeCache->WriteCacheEnabled = pageData->WriteCacheEnable - ? WriteCacheEnabled - : WriteCacheDisabled; - - writeCache->WriteCacheType = pageData->WriteCacheEnable - ? WriteCacheTypeWriteBack - : WriteCacheTypeUnknown; - } - - // Check write through support. - if (modeData->DeviceSpecificParameter & MODE_DSP_FUA_SUPPORTED) - { - writeCache->WriteThroughSupported = WriteThroughSupported; - } - else - { - writeCache->WriteThroughSupported = WriteThroughNotSupported; - } - - // Get the changeable caching mode page and check write cache is changeable. - RtlZeroMemory(modeData, MODE_PAGE_DATA_SIZE); - - length = DeviceRetrieveModeSenseUsingScratch(deviceExtension, - (PCHAR) modeData, - MODE_PAGE_DATA_SIZE, - MODE_PAGE_CACHING, - MODE_SENSE_CHANGEABLE_VALUES); - - if (length < sizeof(MODE_PARAMETER_HEADER)) - { - // Retry the request in case of a check condition. - length = DeviceRetrieveModeSenseUsingScratch(deviceExtension, - (PCHAR) modeData, - MODE_PAGE_DATA_SIZE, - MODE_PAGE_CACHING, - MODE_SENSE_CHANGEABLE_VALUES); - - if (length < sizeof(MODE_PARAMETER_HEADER)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "RequestHandleQueryPropertyWriteCache: Mode Sense failed\n")); - - // If the device fails to return changeable pages, then - // set the write cache changeable value to unknown. - writeCache->WriteCacheChangeable = WriteCacheChangeUnknown; - information = sizeof(STORAGE_WRITE_CACHE_PROPERTY); - } - } - } - - if (NT_SUCCESS(status)) - { - // If the length is greater than length indicated by the mode data reset - // the data to the mode data. - if (length > (ULONG) (modeData->ModeDataLength + 1)) - { - length = modeData->ModeDataLength + 1; - } - - // Look for caching page in the returned mode page data. - pageData = ModeSenseFindSpecificPage((PCHAR)modeData, - length, - MODE_PAGE_CACHING, - TRUE); - // Check if valid caching page exists. - if (pageData == NULL) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "RequestHandleQueryPropertyWriteCache: Unable to find caching mode page.\n")); - - // Set write cache changeable value to unknown. - writeCache->WriteCacheChangeable = WriteCacheChangeUnknown; - } - else - { - writeCache->WriteCacheChangeable = pageData->WriteCacheEnable - ? WriteCacheChangeable - : WriteCacheNotChangeable; - } - - information = sizeof(STORAGE_WRITE_CACHE_PROPERTY); - - } - - FREE_POOL(srb); - FREE_POOL(modeData); - - RequestCompletion(deviceExtension, Request, status, information); - - return status; -} - -NTSTATUS -RequestValidateDvdReadKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_DVD_READ_KEY - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PDVD_COPY_PROTECT_KEY keyParameters = NULL; - ULONG keyLength = 0; - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &keyParameters, - NULL); - - if (NT_SUCCESS(status)) - { - if(RequestParameters.Parameters.DeviceIoControl.InputBufferLength < sizeof(DVD_COPY_PROTECT_KEY)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "DvdDeviceControl: EstablishDriveKey - challenge " - "key buffer too small\n")); - status = STATUS_INVALID_PARAMETER; - } - } - - if (NT_SUCCESS(status)) - { - switch(keyParameters->KeyType) - { - - case DvdChallengeKey: - { - C_ASSERT(sizeof(DVD_COPY_PROTECT_KEY) <= DVD_CHALLENGE_KEY_LENGTH); - keyLength = DVD_CHALLENGE_KEY_LENGTH; - break; - } - case DvdBusKey1: - case DvdBusKey2: - { - C_ASSERT(sizeof(DVD_COPY_PROTECT_KEY) <= DVD_BUS_KEY_LENGTH); - keyLength = DVD_BUS_KEY_LENGTH; - break; - } - case DvdTitleKey: - { - C_ASSERT(sizeof(DVD_COPY_PROTECT_KEY) <= DVD_TITLE_KEY_LENGTH); - keyLength = DVD_TITLE_KEY_LENGTH; - break; - } - case DvdAsf: - { - C_ASSERT(sizeof(DVD_COPY_PROTECT_KEY) <= DVD_ASF_LENGTH); - keyLength = DVD_ASF_LENGTH; - break; - } - case DvdDiskKey: - { - C_ASSERT(sizeof(DVD_COPY_PROTECT_KEY) <= DVD_DISK_KEY_LENGTH); - keyLength = DVD_DISK_KEY_LENGTH; - break; - } - case DvdGetRpcKey: - { - C_ASSERT(sizeof(DVD_COPY_PROTECT_KEY) <= DVD_RPC_KEY_LENGTH); - keyLength = DVD_RPC_KEY_LENGTH; - break; - } - default: - { - keyLength = sizeof(DVD_COPY_PROTECT_KEY); - break; - } - } - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < keyLength) - { - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "DvdDeviceControl: EstablishDriveKey - output " - "buffer too small\n")); - status = STATUS_BUFFER_TOO_SMALL; - *DataLength = keyLength; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength & - DeviceExtension->AdapterDescriptor->AlignmentMask) - { - status = STATUS_INVALID_PARAMETER; - } - else if (DeviceExtension->DeviceAdditionalData.DriveDeviceType != FILE_DEVICE_DVD) - { - // reject the request if it's not a DVD device. - status = STATUS_INVALID_DEVICE_REQUEST; - } - } - - return status; -} - - -NTSTATUS -RequestValidateDvdEndSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_DVD_END_SESSION - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PDVD_SESSION_ID sessionId = NULL; - - UNREFERENCED_PARAMETER(DeviceExtension); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &sessionId, - NULL); - - if (NT_SUCCESS(status)) - { - if(RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(DVD_SESSION_ID)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "DvdDeviceControl: EndSession - input buffer too " - "small\n")); - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - - -NTSTATUS -RequestValidateAacsEndSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_AACS_END_SESSION - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PDVD_SESSION_ID sessionId = NULL; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &sessionId, - NULL); - - if (NT_SUCCESS(status)) - { - if (!cdData->Mmc.IsAACS) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - else if(RequestParameters.Parameters.DeviceIoControl.InputBufferLength != sizeof(DVD_SESSION_ID)) - { - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - - -NTSTATUS -RequestValidateEnableStreaming( - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validates an IOCTL_CDROM_ENABLE_STREAMING request - -Arguments: - - Request - request to be handled - RequestParameters - request parameters - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - PCDROM_STREAMING_CONTROL inputBuffer = NULL; - - *DataLength = 0; - - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(CDROM_STREAMING_CONTROL)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - - if (NT_SUCCESS(status)) - { - // Get the request type using CDROM_STREAMING_CONTROL structure - status = WdfRequestRetrieveInputBuffer(Request, - sizeof(CDROM_STREAMING_CONTROL), - &inputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (inputBuffer->RequestType != CdromStreamingDisable && - inputBuffer->RequestType != CdromStreamingEnableForReadOnly && - inputBuffer->RequestType != CdromStreamingEnableForWriteOnly && - inputBuffer->RequestType != CdromStreamingEnableForReadWrite) - { - // Unknown request type - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - - -NTSTATUS -RequestValidateSendOpcInformation( - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validates an IOCTL_CDROM_SEND_OPC_INFORMATION request - -Arguments: - - Request - request to be handled - RequestParameters - request parameters - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - PCDROM_SIMPLE_OPC_INFO inputBuffer = NULL; - - *DataLength = 0; - - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(CDROM_SIMPLE_OPC_INFO)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - - if (NT_SUCCESS(status)) - { - // Get the request type using CDROM_SIMPLE_OPC_INFO structure - status = WdfRequestRetrieveInputBuffer(Request, - sizeof(CDROM_SIMPLE_OPC_INFO), - &inputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (inputBuffer->RequestType != SimpleOpcInfo) - { - // Unknown request type - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - - -NTSTATUS -RequestValidateGetPerformance( - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validates an IOCTL_CDROM_GET_PERFORMANCE request - -Arguments: - - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_WRITE_SPEED_REQUEST writeSpeedRequest = NULL; - PCDROM_PERFORMANCE_REQUEST performanceRequest = NULL; - - *DataLength = 0; - - // CDROM_WRITE_SPEED_REQUEST is the smallest performance request that we support. - // We use it to retrieve request type and then check input length more carefully - // on a per request type basis. - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(CDROM_WRITE_SPEED_REQUEST)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - sizeof(CDROM_WRITE_SPEED_REQUEST), - (PVOID*)&writeSpeedRequest, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (writeSpeedRequest->RequestType == CdromPerformanceRequest) - { - // CDROM_PERFORMANCE_REQUEST is bigger than CDROM_WRITE_SPEED_REQUEST, - // so we perform more checks and retrieve more bytes through WDF. - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(CDROM_PERFORMANCE_REQUEST)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - sizeof(CDROM_PERFORMANCE_REQUEST), - &performanceRequest, - NULL); - } - - if (!NT_SUCCESS(status)) - { - // just pass the status code from above - } - // validate all enum-type fields of CDROM_PERFORMANCE_REQUEST - else if (performanceRequest->PerformanceType != CdromReadPerformance && - performanceRequest->PerformanceType != CdromWritePerformance) - { - status = STATUS_INVALID_PARAMETER; - } - else if (performanceRequest->Exceptions != CdromReadPerformance && - performanceRequest->Exceptions != CdromEntirePerformanceList && - performanceRequest->Exceptions != CdromPerformanceExceptionsOnly) - { - status = STATUS_INVALID_PARAMETER; - } - else if (performanceRequest->Tolerance != Cdrom10Nominal20Exceptions) - { - status = STATUS_INVALID_PARAMETER; - } - } - else if (writeSpeedRequest->RequestType == CdromWriteSpeedRequest) - { - // No additional checks here: all remaining fields are ignored - // if RequestType == CdromWriteSpeedRequest. - } - else - { - status = STATUS_INVALID_PARAMETER; - } - } - - // finally, check output buffer length - if (NT_SUCCESS(status)) - { - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - sizeof(CDROM_PERFORMANCE_HEADER)) - { - status = STATUS_BUFFER_TOO_SMALL; - *DataLength = sizeof(CDROM_PERFORMANCE_HEADER); - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength > - ((USHORT)-1)) - { - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -PCDB -RequestGetScsiPassThroughCdb( - _In_ PIRP Irp - ) -/*++ - -Routine Description: - - Get the CDB structure from the SCSI pass through - -Arguments: - - Irp - request to be handled - -Return Value: - - PCDB - ---*/ -{ - PCDB cdb = NULL; - PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp); - ULONG inputBufferLength = 0; - PVOID inputBuffer = NULL; - BOOLEAN legacyPassThrough = FALSE; - - PAGED_CODE(); - - if (((currentIrpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SCSI_PASS_THROUGH) || - (currentIrpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SCSI_PASS_THROUGH_DIRECT) || - (currentIrpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SCSI_PASS_THROUGH_EX) || - (currentIrpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SCSI_PASS_THROUGH_DIRECT_EX)) && - (Irp->AssociatedIrp.SystemBuffer != NULL)) - { - inputBufferLength = currentIrpStack->Parameters.DeviceIoControl.InputBufferLength; - inputBuffer = Irp->AssociatedIrp.SystemBuffer; - legacyPassThrough = TRUE; - - if ((currentIrpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SCSI_PASS_THROUGH_EX) || - (currentIrpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SCSI_PASS_THROUGH_DIRECT_EX)) - { - legacyPassThrough = FALSE; - } - - // - // If this is a 32 bit application running on 64 bit then thunk the - // input structures to grab the cdb. - // - -#if BUILD_WOW64_ENABLED && defined(_WIN64) - - if (IoIs32bitProcess(Irp)) - { - if (legacyPassThrough) - { - if (inputBufferLength >= sizeof(SCSI_PASS_THROUGH32)) - { - cdb = (PCDB)((PSCSI_PASS_THROUGH32)inputBuffer)->Cdb; - } - } - else - { - if (inputBufferLength >= sizeof(SCSI_PASS_THROUGH32_EX)) - { - cdb = (PCDB)((PSCSI_PASS_THROUGH32_EX)inputBuffer)->Cdb; - } - } - - } - else - -#endif - - { - if (legacyPassThrough) - { - if (inputBufferLength >= sizeof(SCSI_PASS_THROUGH)) - { - cdb = (PCDB)((PSCSI_PASS_THROUGH)inputBuffer)->Cdb; - } - } - else - { - if (inputBufferLength >= sizeof(SCSI_PASS_THROUGH_EX)) - { - cdb = (PCDB)((PSCSI_PASS_THROUGH_EX)inputBuffer)->Cdb; - } - } - } - } - - return cdb; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleScsiPassThrough( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ) -/*++ - -Routine Description: - - Handle request of IOCTL_SCSI_PASS_THROUGH - IOCTL_SCSI_PASS_THROUGH_DIRECT - - The function sets the MinorFunction field of irpStack, - and pass the request to lower level driver. - -Arguments: - - Device - device object - Request - request to be handled - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_UNSUCCESSFUL; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PIRP irp = WdfRequestWdmGetIrp(Request); - PZERO_POWER_ODD_INFO zpoddInfo = deviceExtension->ZeroPowerODDInfo; - PCDB cdb = NULL; - BOOLEAN isSoftEject = FALSE; - -#if DBG - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request); -#endif - - - PAGED_CODE(); - -#if DBG - // SPTI is always processed in sync manner. - NT_ASSERT(requestContext->SyncRequired); -#endif - - if ((zpoddInfo != NULL) && - (zpoddInfo->LoadingMechanism == LOADING_MECHANISM_TRAY) && - (zpoddInfo->Load == 0)) // Drawer - { - cdb = RequestGetScsiPassThroughCdb(irp); - - if ((cdb != NULL) && - (cdb->AsByte[0] == SCSIOP_START_STOP_UNIT) && - (cdb->START_STOP.LoadEject == 1) && - (cdb->START_STOP.Start == 0)) - { - isSoftEject = TRUE; - } - } - - WdfRequestFormatRequestUsingCurrentType(Request); - - // Special for SPTI, set the MinorFunction. - { - PIO_STACK_LOCATION nextStack = IoGetNextIrpStackLocation(irp); - - nextStack->MinorFunction = 1; - } - - - status = RequestSend(deviceExtension, - Request, - deviceExtension->IoTarget, - WDF_REQUEST_SEND_OPTION_SYNCHRONOUS, - NULL); - - - if (!NT_SUCCESS(status) && - (isSoftEject != FALSE)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "RequestHandleScsiPassThrough: soft eject detected, device marked as active\n")); - - DeviceMarkActive(deviceExtension, TRUE, FALSE); - } - - RequestCompletion(deviceExtension, Request, status, WdfRequestGetInformation(Request)); - - return status; -} - -NTSTATUS -RequestHandleMountQueryUniqueId( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_MOUNTDEV_QUERY_UNIQUE_ID - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PMOUNTDEV_UNIQUE_ID uniqueId = NULL; - - *DataLength = 0; - - if (!DeviceExtension->MountedDeviceInterfaceName.Buffer) - { - status = STATUS_INVALID_PARAMETER; - } - else if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < sizeof(MOUNTDEV_UNIQUE_ID)) - { - *DataLength = sizeof(MOUNTDEV_UNIQUE_ID); - status = STATUS_BUFFER_TOO_SMALL; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &uniqueId, - NULL); - } - - if (NT_SUCCESS(status)) - { - RtlZeroMemory(uniqueId, RequestParameters.Parameters.DeviceIoControl.OutputBufferLength); - - uniqueId->UniqueIdLength = DeviceExtension->MountedDeviceInterfaceName.Length; - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - (sizeof(USHORT) + DeviceExtension->MountedDeviceInterfaceName.Length)) - { - *DataLength = sizeof(MOUNTDEV_UNIQUE_ID); - status = STATUS_BUFFER_OVERFLOW; - } - } - - if (NT_SUCCESS(status)) - { - RtlCopyMemory(uniqueId->UniqueId, - DeviceExtension->MountedDeviceInterfaceName.Buffer, - uniqueId->UniqueIdLength); - - *DataLength = sizeof(USHORT) + uniqueId->UniqueIdLength; - status = STATUS_SUCCESS; - } - - return status; -} - -NTSTATUS -RequestHandleMountQueryDeviceName( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_MOUNTDEV_QUERY_DEVICE_NAME - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PMOUNTDEV_NAME name = NULL; - - *DataLength = 0; - - NT_ASSERT(DeviceExtension->DeviceName.Buffer); - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < sizeof(MOUNTDEV_NAME)) - { - status = STATUS_BUFFER_TOO_SMALL; - *DataLength = sizeof(MOUNTDEV_NAME); - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &name, - NULL); - } - - if (NT_SUCCESS(status)) - { - RtlZeroMemory(name, RequestParameters.Parameters.DeviceIoControl.OutputBufferLength); - name->NameLength = DeviceExtension->DeviceName.Length; - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - (sizeof(USHORT) + DeviceExtension->DeviceName.Length)) - { - status = STATUS_BUFFER_OVERFLOW; - *DataLength = sizeof(MOUNTDEV_NAME); - } - } - - if (NT_SUCCESS(status)) - { - RtlCopyMemory(name->Name, - DeviceExtension->DeviceName.Buffer, - name->NameLength); - - status = STATUS_SUCCESS; - *DataLength = sizeof(USHORT) + name->NameLength; - } - - return status; -} - -NTSTATUS -RequestHandleMountQuerySuggestedLinkName( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - PMOUNTDEV_SUGGESTED_LINK_NAME suggestedName = NULL; - - WCHAR driveLetterNameBuffer[10] = {0}; - RTL_QUERY_REGISTRY_TABLE queryTable[2] = {0}; - PWSTR valueName = NULL; - UNICODE_STRING driveLetterName = {0}; - - *DataLength = 0; - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < - sizeof(MOUNTDEV_SUGGESTED_LINK_NAME)) - { - status = STATUS_BUFFER_TOO_SMALL; - *DataLength = sizeof(MOUNTDEV_SUGGESTED_LINK_NAME); - } - - if (NT_SUCCESS(status)) - { - valueName = ExAllocatePool2(POOL_FLAG_PAGED, - DeviceExtension->DeviceName.Length + sizeof(WCHAR), - CDROM_TAG_STRINGS); - if (valueName == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - } - - if (NT_SUCCESS(status)) - { - RtlCopyMemory(valueName, - DeviceExtension->DeviceName.Buffer, - DeviceExtension->DeviceName.Length); - valueName[DeviceExtension->DeviceName.Length/sizeof(WCHAR)] = 0; - - driveLetterName.Buffer = driveLetterNameBuffer; - driveLetterName.MaximumLength = sizeof(driveLetterNameBuffer); - driveLetterName.Length = 0; - - queryTable[0].Flags = RTL_QUERY_REGISTRY_REQUIRED | RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_TYPECHECK; - queryTable[0].Name = valueName; - queryTable[0].EntryContext = &driveLetterName; - queryTable[0].DefaultType = (REG_SZ << RTL_QUERY_REGISTRY_TYPECHECK_SHIFT) | REG_NONE; - - status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, - L"\\Registry\\Machine\\System\\DISK", // why hard coded? - queryTable, NULL, NULL); - } - - if (NT_SUCCESS(status)) - { - if ((driveLetterName.Length == 4) && - (driveLetterName.Buffer[0] == '%') && - (driveLetterName.Buffer[1] == ':')) - { - driveLetterName.Buffer[0] = 0xFF; - } - else if ((driveLetterName.Length != 4) || - (driveLetterName.Buffer[0] < FirstDriveLetter) || - (driveLetterName.Buffer[0] > LastDriveLetter) || - (driveLetterName.Buffer[1] != ':')) - { - status = STATUS_NOT_FOUND; - } - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &suggestedName, - NULL); - } - - if (NT_SUCCESS(status)) - { - RtlZeroMemory(suggestedName, RequestParameters.Parameters.DeviceIoControl.OutputBufferLength); - suggestedName->UseOnlyIfThereAreNoOtherLinks = TRUE; - suggestedName->NameLength = 28; - - *DataLength = FIELD_OFFSET(MOUNTDEV_SUGGESTED_LINK_NAME, Name) + 28; - - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < *DataLength) - { - *DataLength = sizeof(MOUNTDEV_SUGGESTED_LINK_NAME); - status = STATUS_BUFFER_OVERFLOW; - } - } - - if (NT_SUCCESS(status)) - { - RtlDeleteRegistryValue(RTL_REGISTRY_ABSOLUTE, - L"\\Registry\\Machine\\System\\DISK", - valueName); - - RtlCopyMemory(suggestedName->Name, L"\\DosDevices\\", 24); - suggestedName->Name[12] = driveLetterName.Buffer[0]; - suggestedName->Name[13] = ':'; - } - - FREE_POOL(valueName); - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleReadTOC( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_CDROM_READ_TOC - IOCTL_CDROM_GET_LAST_SESSION - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - VOID* outputBuffer = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - if (DeviceIsPlayActive(DeviceExtension->Device)) - { - status = STATUS_DEVICE_BUSY; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &outputBuffer, - NULL); - } - - // handle the request - if (NT_SUCCESS(status)) - { - size_t transferSize; - CDB cdb; - - transferSize = min(RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, sizeof(CDROM_TOC)); - - RtlZeroMemory(outputBuffer, transferSize); - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - if (RequestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_CDROM_GET_LAST_SESSION) - { - // Set format to return first and last session numbers. - cdb.READ_TOC.Format2 = CDROM_READ_TOC_EX_FORMAT_SESSION; - } - else - { - // Use MSF addressing - cdb.READ_TOC.Msf = 1; - } - - cdb.READ_TOC.OperationCode = SCSIOP_READ_TOC; - cdb.READ_TOC.AllocationLength[0] = (UCHAR)(transferSize >> 8); - cdb.READ_TOC.AllocationLength[1] = (UCHAR)(transferSize & 0xFF); - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, (ULONG)transferSize, TRUE, &cdb, 10); - - if (NT_SUCCESS(status)) - { - *DataLength = DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength; - RtlCopyMemory(outputBuffer, - DeviceExtension->ScratchContext.ScratchBuffer, - *DataLength); - } - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleReadTocEx( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_CDROM_READ_TOC_EX - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_READ_TOC_EX inputBuffer = NULL; - VOID* outputBuffer = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - if (DeviceIsPlayActive(DeviceExtension->Device)) - { - status = STATUS_DEVICE_BUSY; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &outputBuffer, - NULL); - } - - // handle the request - if (NT_SUCCESS(status)) - { - size_t transferSize; - CDB cdb; - - transferSize = min(RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, MAXUSHORT); - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.READ_TOC.OperationCode = SCSIOP_READ_TOC; - cdb.READ_TOC.Msf = inputBuffer->Msf; - cdb.READ_TOC.Format2 = inputBuffer->Format; - cdb.READ_TOC.StartingTrack = inputBuffer->SessionTrack; - cdb.READ_TOC.AllocationLength[0] = (UCHAR)(transferSize >> 8); - cdb.READ_TOC.AllocationLength[1] = (UCHAR)(transferSize & 0xFF); - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, (ULONG)transferSize, TRUE, &cdb, 10); - - if (NT_SUCCESS(status)) - { - if (DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength < MINIMUM_CDROM_READ_TOC_EX_SIZE) - { - *DataLength = 0; - status = STATUS_INVALID_DEVICE_REQUEST; - } - else - { - *DataLength = DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength; - RtlCopyMemory(outputBuffer, - DeviceExtension->ScratchContext.ScratchBuffer, - *DataLength); - } - } - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -VOID -GetConfigurationDataConversionTypeAllToTypeOne( - _In_ FEATURE_NUMBER RequestedFeature, - _In_ PSCSI_REQUEST_BLOCK Srb, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Some CDROM devices do not handle the GET CONFIGURATION commands with - TYPE ONE request. The command will time out causing a bus reset. - To avoid this problem we set a device flag during start device if the device - fails a TYPE ONE request. If this flag is set the TYPE ONE requests will be - tried as TYPE ALL request and the data will be converted to TYPE ONE format - in this routine. - -Arguments: - - RequestedFeature - device context - Srb - request to be handled - DataLength - transfer data length - -Return Value: - - NTSTATUS - ---*/ -{ - PFEATURE_HEADER featureHeader = NULL; - FEATURE_NUMBER thisFeature; - ULONG totalLength = 0; - ULONG featureLength = 0; - ULONG headerLength = 0; - - PGET_CONFIGURATION_HEADER header = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - if (Srb->DataTransferLength < RTL_SIZEOF_THROUGH_FIELD(GET_CONFIGURATION_HEADER, DataLength)) - { - // do not have valid data. - return; - } - - // Calculate the length of valid data available in the - // capabilities buffer from the DataLength field - header = (PGET_CONFIGURATION_HEADER) Srb->DataBuffer; - REVERSE_BYTES(&totalLength, header->DataLength); - - totalLength += RTL_SIZEOF_THROUGH_FIELD(GET_CONFIGURATION_HEADER, DataLength); - - // Make sure the we have enough data in the SRB - totalLength = min(totalLength, Srb->DataTransferLength); - - // If we have received enough data from the device - // check for the given feature. - if (totalLength >= (sizeof(GET_CONFIGURATION_HEADER) + sizeof(FEATURE_HEADER))) - { - // Feature information is present. Verify the feature. - featureHeader = (PFEATURE_HEADER)((PUCHAR)Srb->DataBuffer + sizeof(GET_CONFIGURATION_HEADER)); - - thisFeature = (featureHeader->FeatureCode[0] << 8) | (featureHeader->FeatureCode[1]); - - if (thisFeature == RequestedFeature) - { - // Calculate the feature length - featureLength = sizeof(FEATURE_HEADER) + featureHeader->AdditionalLength; - } - } - - // Calculate the total size - totalLength = sizeof(GET_CONFIGURATION_HEADER) + featureLength; - - headerLength = totalLength - - RTL_SIZEOF_THROUGH_FIELD(GET_CONFIGURATION_HEADER, DataLength); - - REVERSE_BYTES(header->DataLength, &headerLength); - - *DataLength = totalLength; - - return; -} - -_IRQL_requires_max_(APC_LEVEL) -VOID -GetConfigurationDataSynthesize( - _In_reads_bytes_(InputBufferSize) PVOID InputBuffer, - _In_ ULONG InputBufferSize, - _Out_writes_bytes_(OutputBufferSize) PVOID OutputBuffer, - _In_ size_t OutputBufferSize, - _In_ FEATURE_NUMBER StartingFeature, - _In_ ULONG RequestType, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Get Configuration is a frequently used command, and we don't want it to wake - up the device in case it is in Zero Power state. Before entering Zero Power state, - the complete response of the command is saved in cache, and since the response - is always the same in case there is no media, we can synthesize the response - based on the user request. - -Arguments: - - InputBuffer - buffer containing cached command response - InputBufferSize - size of above buffer - OutputBuffer - buffer to fill in result - OutputBufferSize - size of above buffer - StartingFeature - requested Starting Feature Number - RequestType - requested Request Type - DataLength - transfer data length - -Return Value: - ---*/ -{ - PFEATURE_HEADER featureHeader = NULL; - ULONG validLength = 0; - ULONG featureLength = 0; - ULONG headerLength = 0; - PUCHAR buffer = NULL; - ULONG bytesRemaining = 0; - FEATURE_NUMBER featureCode = 0; - BOOLEAN shouldCopy = FALSE; - size_t copyLength = 0; - size_t transferedLength = 0; - size_t requiredLength = 0; - - PGET_CONFIGURATION_HEADER header = NULL; - - PAGED_CODE (); - - if (InputBufferSize < sizeof (GET_CONFIGURATION_HEADER)) - { - // do not have valid data. - *DataLength = 0; - - return; - } - - // Calculate the length of valid data available in the - // capabilities buffer from the DataLength field - header = (PGET_CONFIGURATION_HEADER) InputBuffer; - REVERSE_BYTES(&validLength, header->DataLength); - - validLength += RTL_SIZEOF_THROUGH_FIELD(GET_CONFIGURATION_HEADER, DataLength); - - // Make sure we have enough data - validLength = min(validLength, InputBufferSize); - - // Copy the header first - copyLength = min(OutputBufferSize, sizeof (GET_CONFIGURATION_HEADER)); - - RtlMoveMemory(OutputBuffer, - InputBuffer, - copyLength); - - transferedLength = copyLength; - requiredLength = sizeof (GET_CONFIGURATION_HEADER); - - if (validLength > sizeof (GET_CONFIGURATION_HEADER)) - { - buffer = header->Data; - bytesRemaining = validLength - sizeof (GET_CONFIGURATION_HEADER); - - // Ignore incomplete feature descriptor - while (bytesRemaining >= sizeof (FEATURE_HEADER)) - { - featureHeader = (PFEATURE_HEADER) buffer; - shouldCopy = FALSE; - - featureCode = (featureHeader->FeatureCode[0] << 8) | (featureHeader->FeatureCode[1]); - featureLength = sizeof (FEATURE_HEADER) + featureHeader->AdditionalLength; - - if (featureCode >= StartingFeature) - { - switch (RequestType) { - - case SCSI_GET_CONFIGURATION_REQUEST_TYPE_ALL: - - shouldCopy = TRUE; - break; - - case SCSI_GET_CONFIGURATION_REQUEST_TYPE_CURRENT: - - if (featureHeader->Current) - { - shouldCopy = TRUE; - } - break; - - case SCSI_GET_CONFIGURATION_REQUEST_TYPE_ONE: - - if (featureCode == StartingFeature) - { - shouldCopy = TRUE; - } - break; - - default: - - break; - } - } - - if (shouldCopy != FALSE) - { - copyLength = min(featureLength, bytesRemaining); - copyLength = min(copyLength, OutputBufferSize - transferedLength); - - RtlMoveMemory((PUCHAR) OutputBuffer + transferedLength, - buffer, - copyLength); - - transferedLength += copyLength; - requiredLength += featureLength; - } - - buffer += min(featureLength, bytesRemaining); - bytesRemaining -= min(featureLength, bytesRemaining); - } - } - - // Adjust Data Length field in header - if (transferedLength >= RTL_SIZEOF_THROUGH_FIELD(GET_CONFIGURATION_HEADER, DataLength)) - { - headerLength = (ULONG) requiredLength - RTL_SIZEOF_THROUGH_FIELD(GET_CONFIGURATION_HEADER, DataLength); - - header = (PGET_CONFIGURATION_HEADER) OutputBuffer; - REVERSE_BYTES(header->DataLength, &headerLength); - } - - *DataLength = transferedLength; - - return; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleGetConfiguration( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_CDROM_GET_CONFIGURATION - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - PGET_CONFIGURATION_IOCTL_INPUT inputBuffer = NULL; - VOID* outputBuffer = NULL; - size_t transferByteCount = 0; - PZERO_POWER_ODD_INFO zpoddInfo = DeviceExtension->ZeroPowerODDInfo; - BOOLEAN inZeroPowerState = FALSE; - - PAGED_CODE (); - - *DataLength = 0; - - // - if (!cdData->Mmc.IsMmc) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - else - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &outputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - // If device is Zero Power state, there should be no media in device, thus we can synthesize the response - // from our cache. Avoid waking up the device in this case. - if ((zpoddInfo != NULL) && - (zpoddInfo->InZeroPowerState != FALSE)) - { - inZeroPowerState = TRUE; - } - - if ((inZeroPowerState == FALSE) || - (zpoddInfo->GetConfigurationBuffer == NULL)) - { - CDB cdb; - - //The maximum number of bytes that a Drive may return - //to describe its Features in one GET CONFIGURATION Command is 65,534 - transferByteCount = min(RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, (MAXUSHORT - 1)); - - // If this is a TYPE ONE request and if this device can't handle this - // request, then we need to send TYPE ALL request to the device and - // convert the data in the completion routine. If required allocate a big - // buffer to get both configuration and feature header. - if ((inputBuffer->RequestType == SCSI_GET_CONFIGURATION_REQUEST_TYPE_ONE) && - TEST_FLAG(cdData->HackFlags, CDROM_HACK_BAD_TYPE_ONE_GET_CONFIG)) - { - transferByteCount = max(transferByteCount, - sizeof(GET_CONFIGURATION_HEADER) + sizeof(FEATURE_HEADER)); - } - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.GET_CONFIGURATION.OperationCode = SCSIOP_GET_CONFIGURATION; - cdb.GET_CONFIGURATION.AllocationLength[0] = (UCHAR)(transferByteCount >> 8); - cdb.GET_CONFIGURATION.AllocationLength[1] = (UCHAR)(transferByteCount & 0xff); - - cdb.GET_CONFIGURATION.StartingFeature[0] = (UCHAR)(inputBuffer->Feature >> 8); - cdb.GET_CONFIGURATION.StartingFeature[1] = (UCHAR)(inputBuffer->Feature & 0xff); - cdb.GET_CONFIGURATION.RequestType = (UCHAR)(inputBuffer->RequestType); - - // If the device does not support TYPE ONE get configuration commands - // then change the request type to TYPE ALL. Convert the returned data to - // TYPE ONE format in the completion routine. - if ((inputBuffer->RequestType == SCSI_GET_CONFIGURATION_REQUEST_TYPE_ONE) && - TEST_FLAG(cdData->HackFlags, CDROM_HACK_BAD_TYPE_ONE_GET_CONFIG)) - { - - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "DeviceHandleGetConfiguration: Changing TYPE_ONE Get Config to TYPE_ALL\n")); - cdb.GET_CONFIGURATION.RequestType = SCSI_GET_CONFIGURATION_REQUEST_TYPE_ALL; - } - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, (ULONG)transferByteCount, TRUE, &cdb, 12); - - if (NT_SUCCESS(status)) - { - if ((inputBuffer->RequestType == SCSI_GET_CONFIGURATION_REQUEST_TYPE_ONE) && - TEST_FLAG(cdData->HackFlags, CDROM_HACK_BAD_TYPE_ONE_GET_CONFIG)) - { - - if (DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength < sizeof(GET_CONFIGURATION_HEADER)) - { - // Not enough data to calculate the data length. - // So assume feature is not present - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, "DeviceHandleGetConfiguration: No get config header!\n")); - *DataLength = 0; - status = STATUS_INVALID_DEVICE_REQUEST; - } - else - { - //Some CDROM devices do not handle the GET CONFIGURATION commands with - //TYPE ONE request. The command will time out causing a bus reset. - //To avoid this problem we set a device flag during start device if the device - //fails a TYPE ONE request. If this flag is set the TYPE ONE requests will be - //tried as TYPE ALL request and the data will be converted to TYPE ONE format - //in this routine. - GetConfigurationDataConversionTypeAllToTypeOne(inputBuffer->Feature, DeviceExtension->ScratchContext.ScratchSrb, DataLength); - *DataLength = min(*DataLength, RequestParameters.Parameters.DeviceIoControl.OutputBufferLength); - } - } - else - { - *DataLength = DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength; - } - - // copy data to output buffer - if (NT_SUCCESS(status)) - { - RtlMoveMemory(outputBuffer, - DeviceExtension->ScratchContext.ScratchBuffer, - *DataLength); - } - } - - ScratchBuffer_EndUse(DeviceExtension); - } - else - { - // We are in Zero Power state, and our cached response is available. - // Synthesize the requested data. - GetConfigurationDataSynthesize(zpoddInfo->GetConfigurationBuffer, - zpoddInfo->GetConfigurationBufferSize, - outputBuffer, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - inputBuffer->Feature, - inputBuffer->RequestType, - DataLength - ); - } - } - - return status; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -RequestHandleGetDriveGeometry( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_DISK_GET_LENGTH_INFO - IOCTL_DISK_GET_DRIVE_GEOMETRY - IOCTL_DISK_GET_DRIVE_GEOMETRY_EX - IOCTL_CDROM_GET_DRIVE_GEOMETRY - IOCTL_CDROM_GET_DRIVE_GEOMETRY_EX - IOCTL_STORAGE_READ_CAPACITY - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - VOID* outputBuffer = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &outputBuffer, - NULL); - - // Issue ReadCapacity to update device extension - // with information for current media. - if (NT_SUCCESS(status)) - { - status = MediaReadCapacity(DeviceExtension->Device); - } - - if (NT_SUCCESS(status)) - { - switch(RequestParameters.Parameters.DeviceIoControl.IoControlCode) - { - case IOCTL_DISK_GET_LENGTH_INFO: - { - PGET_LENGTH_INFORMATION lengthInfo = (PGET_LENGTH_INFORMATION)outputBuffer; - - lengthInfo->Length = DeviceExtension->PartitionLength; - *DataLength = sizeof(GET_LENGTH_INFORMATION); - break; - } - case IOCTL_DISK_GET_DRIVE_GEOMETRY: - case IOCTL_CDROM_GET_DRIVE_GEOMETRY: - { - PDISK_GEOMETRY geometry = (PDISK_GEOMETRY)outputBuffer; - - *geometry = DeviceExtension->DiskGeometry; - *DataLength = sizeof(DISK_GEOMETRY); - break; - } - case IOCTL_DISK_GET_DRIVE_GEOMETRY_EX: - case IOCTL_CDROM_GET_DRIVE_GEOMETRY_EX: - { - PDISK_GEOMETRY_EX geometryEx = (PDISK_GEOMETRY_EX)outputBuffer; - - geometryEx->DiskSize = DeviceExtension->PartitionLength; - geometryEx->Geometry = DeviceExtension->DiskGeometry; - *DataLength = FIELD_OFFSET(DISK_GEOMETRY_EX, Data); - break; - } - case IOCTL_STORAGE_READ_CAPACITY: - { - PSTORAGE_READ_CAPACITY readCapacity = (PSTORAGE_READ_CAPACITY)outputBuffer; - - readCapacity->Version = sizeof(STORAGE_READ_CAPACITY); - readCapacity->Size = sizeof(STORAGE_READ_CAPACITY); - - readCapacity->BlockLength = DeviceExtension->DiskGeometry.BytesPerSector; - if (readCapacity->BlockLength > 0) - { - readCapacity->NumberOfBlocks.QuadPart = DeviceExtension->PartitionLength.QuadPart/readCapacity->BlockLength; - } - else - { - readCapacity->NumberOfBlocks.QuadPart = 0; - } - - readCapacity->DiskLength = DeviceExtension->PartitionLength; - - *DataLength = sizeof(STORAGE_READ_CAPACITY); - break; - } - default: - { - NT_ASSERT(FALSE); - break; - } - } // end of switch() - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleDiskVerify( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_DISK_VERIFY - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - PVERIFY_INFORMATION verifyInfo = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - if (!cdData->Mmc.WriteAllowed) - { - status = STATUS_MEDIA_WRITE_PROTECTED; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &verifyInfo, - NULL); - } - - // handle the request - if (NT_SUCCESS(status)) - { - LARGE_INTEGER byteOffset = {0}; - - // Add disk offset to starting sector. - byteOffset.QuadPart = DeviceExtension->StartingOffset.QuadPart + - verifyInfo->StartingOffset.QuadPart; - - // prevent overflow returning success but only validating small area - if (((DeviceExtension->StartingOffset.QuadPart + verifyInfo->StartingOffset.QuadPart) < DeviceExtension->StartingOffset.QuadPart) || - ((verifyInfo->Length >> DeviceExtension->SectorShift) > MAXUSHORT) || - ((byteOffset.QuadPart >> DeviceExtension->SectorShift) > MAXULONG) ) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - ULONG transferSize = 0; - ULONG timeoutValue = 0; - CDB cdb; - ULONG sectorOffset; - USHORT sectorCount; - - ScratchBuffer_BeginUse(DeviceExtension); - - // Convert byte offset to sector offset. - sectorOffset = (ULONG)(byteOffset.QuadPart >> DeviceExtension->SectorShift); - - // Convert ULONG byte count to USHORT sector count. - sectorCount = (USHORT)(verifyInfo->Length >> DeviceExtension->SectorShift); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.CDB10.OperationCode = SCSIOP_VERIFY; - - // Move little endian values into CDB in big endian format. - cdb.CDB10.LogicalBlockByte0 = ((PFOUR_BYTE)§orOffset)->Byte3; - cdb.CDB10.LogicalBlockByte1 = ((PFOUR_BYTE)§orOffset)->Byte2; - cdb.CDB10.LogicalBlockByte2 = ((PFOUR_BYTE)§orOffset)->Byte1; - cdb.CDB10.LogicalBlockByte3 = ((PFOUR_BYTE)§orOffset)->Byte0; - - cdb.CDB10.TransferBlocksMsb = ((PFOUR_BYTE)§orCount)->Byte1; - cdb.CDB10.TransferBlocksLsb = ((PFOUR_BYTE)§orCount)->Byte0; - - // The verify command is used by the NT FORMAT utility and - // requests are sent down for 5% of the volume size. The - // request timeout value is calculated based on the number of - // sectors verified. - if (sectorCount != 0) - { - // sectorCount is a USHORT, so no overflow here... - timeoutValue = TimeOutValueGetCapValue(DeviceExtension->TimeOutValue, ((sectorCount + 128) / 128)); - } - - status = ScratchBuffer_ExecuteCdbEx(DeviceExtension, Request, transferSize, FALSE, &cdb, 10, timeoutValue); - - // nothing to do after the command finishes. - ScratchBuffer_EndUse(DeviceExtension); - } - } - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleCheckVerify( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_STORAGE_CHECK_VERIFY2 - IOCTL_STORAGE_CHECK_VERIFY - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - PAGED_CODE (); - - *DataLength = 0; - - if (NT_SUCCESS(status)) - { - ULONG transferSize = 0; - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.CDB6GENERIC.OperationCode = SCSIOP_TEST_UNIT_READY; - - status = ScratchBuffer_ExecuteCdbEx(DeviceExtension, Request, transferSize, FALSE, &cdb, 6, CDROM_TEST_UNIT_READY_TIMEOUT); - - if (NT_SUCCESS(status)) - { - if((RequestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_STORAGE_CHECK_VERIFY) && - (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength)) - { - PULONG outputBuffer = NULL; - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &outputBuffer, - NULL); - - if (outputBuffer != NULL) - { - *outputBuffer = DeviceExtension->MediaChangeCount; - *DataLength = sizeof(ULONG); - } - } - else - { - *DataLength = 0; - } - } - - // nothing to do after the command finishes. - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleFakePartitionInfo( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_DISK_GET_DRIVE_LAYOUT - IOCTL_DISK_GET_DRIVE_LAYOUT_EX - IOCTL_DISK_GET_PARTITION_INFO - IOCTL_DISK_GET_PARTITION_INFO_EX - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - VOID* outputBuffer = NULL; - ULONG ioctl = RequestParameters.Parameters.DeviceIoControl.IoControlCode; - - PAGED_CODE (); - - *DataLength = 0; - - if (NT_SUCCESS(status)) - { - if ((ioctl != IOCTL_DISK_GET_DRIVE_LAYOUT) && - (ioctl != IOCTL_DISK_GET_DRIVE_LAYOUT_EX) && - (ioctl != IOCTL_DISK_GET_PARTITION_INFO) && - (ioctl != IOCTL_DISK_GET_PARTITION_INFO_EX)) - { - status = STATUS_INTERNAL_ERROR; - } - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &outputBuffer, - NULL); - } - - // handle the request - if (NT_SUCCESS(status)) - { - switch (ioctl) - { - case IOCTL_DISK_GET_DRIVE_LAYOUT: - *DataLength = FIELD_OFFSET(DRIVE_LAYOUT_INFORMATION, PartitionEntry[1]); - RtlZeroMemory(outputBuffer, *DataLength); - break; - case IOCTL_DISK_GET_DRIVE_LAYOUT_EX: - *DataLength = FIELD_OFFSET(DRIVE_LAYOUT_INFORMATION_EX, PartitionEntry[1]); - RtlZeroMemory(outputBuffer, *DataLength); - break; - case IOCTL_DISK_GET_PARTITION_INFO: - *DataLength = sizeof(PARTITION_INFORMATION); - RtlZeroMemory(outputBuffer, *DataLength); - break; - case IOCTL_DISK_GET_PARTITION_INFO_EX: - *DataLength = sizeof(PARTITION_INFORMATION_EX); - RtlZeroMemory(outputBuffer, *DataLength); - break; - default: - NT_ASSERT(!"Invalid ioctl should not have reached this point\n"); - break; - } - - // if we are getting the drive layout, then we need to start by - // adding some of the non-partition stuff that says we have - // exactly one partition available. - if (ioctl == IOCTL_DISK_GET_DRIVE_LAYOUT) - { - PDRIVE_LAYOUT_INFORMATION layout; - layout = (PDRIVE_LAYOUT_INFORMATION)outputBuffer; - layout->PartitionCount = 1; - layout->Signature = 1; - outputBuffer = (PVOID)(layout->PartitionEntry); - ioctl = IOCTL_DISK_GET_PARTITION_INFO; - } - else if (ioctl == IOCTL_DISK_GET_DRIVE_LAYOUT_EX) - { - PDRIVE_LAYOUT_INFORMATION_EX layoutEx; - layoutEx = (PDRIVE_LAYOUT_INFORMATION_EX)outputBuffer; - layoutEx->PartitionStyle = PARTITION_STYLE_MBR; - layoutEx->PartitionCount = 1; - layoutEx->Mbr.Signature = 1; - outputBuffer = (PVOID)(layoutEx->PartitionEntry); - ioctl = IOCTL_DISK_GET_PARTITION_INFO_EX; - } - - // NOTE: the local var 'ioctl' is now modified to either EX or - // non-EX version. the local var 'systemBuffer' is now pointing - // to the partition information structure. - if (ioctl == IOCTL_DISK_GET_PARTITION_INFO) - { - PPARTITION_INFORMATION partitionInfo; - partitionInfo = (PPARTITION_INFORMATION)outputBuffer; - partitionInfo->RewritePartition = FALSE; - partitionInfo->RecognizedPartition = TRUE; - partitionInfo->PartitionType = PARTITION_FAT32; - partitionInfo->BootIndicator = FALSE; - partitionInfo->HiddenSectors = 0; - partitionInfo->StartingOffset.QuadPart = 0; - partitionInfo->PartitionLength = DeviceExtension->PartitionLength; - partitionInfo->PartitionNumber = 0; - } - else - { - PPARTITION_INFORMATION_EX partitionInfo; - partitionInfo = (PPARTITION_INFORMATION_EX)outputBuffer; - partitionInfo->PartitionStyle = PARTITION_STYLE_MBR; - partitionInfo->RewritePartition = FALSE; - partitionInfo->Mbr.RecognizedPartition = TRUE; - partitionInfo->Mbr.PartitionType = PARTITION_FAT32; - partitionInfo->Mbr.BootIndicator = FALSE; - partitionInfo->Mbr.HiddenSectors = 0; - partitionInfo->StartingOffset.QuadPart = 0; - partitionInfo->PartitionLength = DeviceExtension->PartitionLength; - partitionInfo->PartitionNumber = 0; - } - } - - return status; -} - -NTSTATUS -RequestHandleGetDeviceNumber( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_STORAGE_GET_DEVICE_NUMBER - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - *DataLength = 0; - - if(RequestParameters.Parameters.DeviceIoControl.OutputBufferLength >= - sizeof(STORAGE_DEVICE_NUMBER)) - { - PSTORAGE_DEVICE_NUMBER deviceNumber = NULL; - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &deviceNumber, - NULL); - if (NT_SUCCESS(status)) - { - deviceNumber->DeviceType = DeviceExtension->DeviceObject->DeviceType; - deviceNumber->DeviceNumber = DeviceExtension->DeviceNumber; - deviceNumber->PartitionNumber = (ULONG)-1; // legacy reason, return (-1) for this IOCTL. - - status = STATUS_SUCCESS; - *DataLength = sizeof(STORAGE_DEVICE_NUMBER); - } - } - else - { - status = STATUS_BUFFER_TOO_SMALL; - *DataLength = sizeof(STORAGE_DEVICE_NUMBER); - } - - return status; -} - -NTSTATUS -RequestHandleGetHotPlugInfo( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_STORAGE_GET_HOTPLUG_INFO - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - *DataLength = 0; - - if(RequestParameters.Parameters.DeviceIoControl.OutputBufferLength >= - sizeof(STORAGE_HOTPLUG_INFO)) - { - PSTORAGE_HOTPLUG_INFO info = NULL; - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &info, - NULL); - if (NT_SUCCESS(status)) - { - *info = DeviceExtension->PrivateFdoData->HotplugInfo; - - status = STATUS_SUCCESS; - *DataLength = sizeof(STORAGE_HOTPLUG_INFO); - } - } - else - { - status = STATUS_BUFFER_TOO_SMALL; - *DataLength = sizeof(STORAGE_HOTPLUG_INFO); - } - - return status; -} - -NTSTATUS -RequestHandleSetHotPlugInfo( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_STORAGE_SET_HOTPLUG_INFO - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PSTORAGE_HOTPLUG_INFO info = NULL; - - *DataLength = 0; - - if (RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(STORAGE_HOTPLUG_INFO)) - { - // Indicate unsuccessful status and no data transferred. - status = STATUS_INFO_LENGTH_MISMATCH; - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &info, - NULL); - } - - if (NT_SUCCESS(status)) - { - if (info->Size != DeviceExtension->PrivateFdoData->HotplugInfo.Size) - { - status = STATUS_INVALID_PARAMETER_1; - } - - if (info->MediaRemovable != DeviceExtension->PrivateFdoData->HotplugInfo.MediaRemovable) - { - status = STATUS_INVALID_PARAMETER_2; - } - - if (info->MediaHotplug != DeviceExtension->PrivateFdoData->HotplugInfo.MediaHotplug) - { - status = STATUS_INVALID_PARAMETER_3; - } - - if (info->WriteCacheEnableOverride != DeviceExtension->PrivateFdoData->HotplugInfo.WriteCacheEnableOverride) - { - status = STATUS_INVALID_PARAMETER_5; - } - } - - if (NT_SUCCESS(status)) - { - DeviceExtension->PrivateFdoData->HotplugInfo.DeviceHotplug = info->DeviceHotplug; - - // Store the user-defined override in the registry - DeviceSetParameter(DeviceExtension, - CLASSP_REG_SUBKEY_NAME, - CLASSP_REG_REMOVAL_POLICY_VALUE_NAME, - (info->DeviceHotplug) ? RemovalPolicyExpectSurpriseRemoval : RemovalPolicyExpectOrderlyRemoval); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleEventNotification( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ WDFREQUEST Request, - _In_opt_ PWDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - This routine handles the process of IOCTL_STORAGE_EVENT_NOTIFICATION - -Arguments: - - DeviceExtension - device context - - Request - request to be handled - - RequestParameters - request parameter - - DataLength - data transferred - -Return Value: - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PMEDIA_CHANGE_DETECTION_INFO info = NULL; - LONG requestInUse; - PSTORAGE_EVENT_NOTIFICATION eventBuffer = NULL; - - *DataLength = 0; - - info = DeviceExtension->MediaChangeDetectionInfo; - - // Since AN is ASYNCHRONOUS and can happen at any time, - // make certain not to do anything before properly initialized. - if ((!DeviceExtension->IsInitialized) || (info == NULL)) - { - status = STATUS_UNSUCCESSFUL; - } - - if (NT_SUCCESS(status) && (Request != NULL) && (RequestParameters != NULL)) { - - // - // Validate IOCTL parameters - // - if (RequestParameters->Parameters.DeviceIoControl.InputBufferLength < - sizeof(STORAGE_EVENT_NOTIFICATION)) { - status = STATUS_INFO_LENGTH_MISMATCH; - } - - // - // Check for an supported event - // - if (NT_SUCCESS(status)) { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters->Parameters.DeviceIoControl.InputBufferLength, - &eventBuffer, - NULL); - if (NT_SUCCESS(status)) { - if ((eventBuffer->Version != STORAGE_EVENT_NOTIFICATION_VERSION_V1) || - (eventBuffer->Size != sizeof(STORAGE_EVENT_NOTIFICATION))) { - status = STATUS_INVALID_PARAMETER; - } else if ((eventBuffer->Events & - (STORAGE_EVENT_MEDIA_STATUS | STORAGE_EVENT_DEVICE_STATUS | STORAGE_EVENT_DEVICE_OPERATION)) == 0) { - status = STATUS_NOT_SUPPORTED; - } - } - } - - } - - if (NT_SUCCESS(status)) - { - if (info->MediaChangeDetectionDisableCount != 0) - { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_MCN, - "RequestHandleEventNotification: device %p has detection disabled \n", - DeviceExtension->DeviceObject)); - status = STATUS_UNSUCCESSFUL; - } - } - - if (NT_SUCCESS(status)) - { - // if the request is not in use, mark it as such. - requestInUse = InterlockedCompareExchange((PLONG)&info->MediaChangeRequestInUse, 1, 0); - - if (requestInUse != 0) - { - status = STATUS_UNSUCCESSFUL; - } - } - - if (NT_SUCCESS(status)) - { - // The last MCN finished. ok to issue the new one. - RequestSetupMcnSyncIrp(DeviceExtension); - - // The irp will go into KMDF framework and a request will be created there to represent it. - IoCallDriver(DeviceExtension->DeviceObject, info->MediaChangeSyncIrp); - } - - return status; -} - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -RequestHandleEjectionControl( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_STORAGE_MEDIA_REMOVAL - IOCTL_STORAGE_EJECTION_CONTROL - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PPREVENT_MEDIA_REMOVAL mediaRemoval = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - if(RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - sizeof(PREVENT_MEDIA_REMOVAL)) - { - status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &mediaRemoval, - NULL); - } - - if (NT_SUCCESS(status)) - { - status = PerformEjectionControl(DeviceExtension, - Request, - ((RequestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_STORAGE_EJECTION_CONTROL) - ? SecureMediaLock - : SimpleMediaLock), - mediaRemoval->PreventMediaRemoval); - } - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleEnableStreaming( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handles an IOCTL_CDROM_ENABLE_STREAMING request - -Arguments: - - DeviceExtension - device context - Request - request to be handled - DataLength - transferred data length - -Notes: - - This IOCTL is serialized because it changes read/write - behavior and we want to make sure that all previous - reads/writes have been completed before we change the - behavior. - -Return Value: - - NTSTATUS - ---*/ -{ - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - PCDROM_PRIVATE_FDO_DATA fdoData = DeviceExtension->PrivateFdoData; - - WDFFILEOBJECT fileObject = NULL; - PFILE_OBJECT_CONTEXT fileObjectContext = NULL; - - NTSTATUS status = STATUS_SUCCESS; - PCDROM_STREAMING_CONTROL inputBuffer = NULL; - - BOOLEAN enforceStreamingRead = FALSE; - BOOLEAN enforceStreamingWrite = FALSE; - BOOLEAN streamingReadSupported, streamingWriteSupported; - - PAGED_CODE (); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - sizeof(CDROM_STREAMING_CONTROL), - &inputBuffer, - NULL); - - if (NT_SUCCESS(status)) - { - // get file object context - fileObject = WdfRequestGetFileObject(Request); - if (fileObject != NULL) { - fileObjectContext = FileObjectGetContext(fileObject); - } - NT_ASSERT(fileObjectContext != NULL); - - if (fileObjectContext == NULL) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestHandleEnableStreaming: cannot find file object context\n")); - status = STATUS_INVALID_HANDLE; - } - } - - if (NT_SUCCESS(status)) - { - if (inputBuffer->RequestType == CdromStreamingDisable) - { - enforceStreamingRead = FALSE; - enforceStreamingWrite = FALSE; - } - else if (inputBuffer->RequestType == CdromStreamingEnableForReadOnly) - { - enforceStreamingRead = TRUE; - enforceStreamingWrite = FALSE; - } - else if (inputBuffer->RequestType == CdromStreamingEnableForWriteOnly) - { - enforceStreamingRead = FALSE; - enforceStreamingWrite = TRUE; - } - else if (inputBuffer->RequestType == CdromStreamingEnableForReadWrite) - { - enforceStreamingRead = TRUE; - enforceStreamingWrite = TRUE; - } - - streamingReadSupported = cdData->Mmc.StreamingReadSupported && !TEST_FLAG(fdoData->HackFlags, FDO_HACK_NO_STREAMING); - streamingWriteSupported = cdData->Mmc.StreamingWriteSupported && !TEST_FLAG(fdoData->HackFlags, FDO_HACK_NO_STREAMING); - if ((enforceStreamingRead && !streamingReadSupported) || - (enforceStreamingWrite && !streamingWriteSupported)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "RequestHandleEnableStreaming: requested Streaming mode is not supported\n")); - status = STATUS_INVALID_DEVICE_REQUEST; - } - else - { - fileObjectContext->EnforceStreamingRead = enforceStreamingRead; - fileObjectContext->EnforceStreamingWrite = enforceStreamingWrite; - } - } - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleSendOpcInformation( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handles an IOCTL_CDROM_SEND_OPC_INFORMATION request - -Arguments: - - DeviceExtension - device context - Request - request to be handled - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_SIMPLE_OPC_INFO inputBuffer = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - sizeof(CDROM_SIMPLE_OPC_INFO), - (PVOID*)&inputBuffer, - NULL); - - if (NT_SUCCESS(status)) - { - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - - // we support only the simplest version for now - cdb.SEND_OPC_INFORMATION.OperationCode = SCSIOP_SEND_OPC_INFORMATION; - cdb.SEND_OPC_INFORMATION.DoOpc = 1; - cdb.SEND_OPC_INFORMATION.Exclude0 = (inputBuffer->Exclude0 ? 1 : 0); - cdb.SEND_OPC_INFORMATION.Exclude1 = (inputBuffer->Exclude1 ? 1 : 0); - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, 0, FALSE, &cdb, sizeof(cdb.SEND_OPC_INFORMATION)); - - // nothing to do after the command finishes - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleGetPerformance( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handles an IOCTL_CDROM_GET_PERFORMANCE request - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_PERFORMANCE_REQUEST inputBuffer = NULL; - PVOID outputBuffer = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - // Retrieve pointers to input/output data. The size has been validated earlier - // in RequestValidateGetPerformance, so we do not check it again. - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&inputBuffer, - NULL); - } - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &outputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - USHORT descriptorSize = 0; - USHORT descriptorCount = 0; - size_t transferSize = 0; - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - // Set up the CDB - RtlZeroMemory(&cdb, sizeof(CDB)); - - if (inputBuffer->RequestType == CdromPerformanceRequest) - { - cdb.GET_PERFORMANCE.Type = 0; - - // 10b is the only defined tolerance in MMCr6 - cdb.GET_PERFORMANCE.Tolerance = 2; - - switch (inputBuffer->Exceptions) { - case CdromNominalPerformance: - cdb.GET_PERFORMANCE.Except = 0; - descriptorSize = sizeof(CDROM_NOMINAL_PERFORMANCE_DESCRIPTOR); - break; - case CdromEntirePerformanceList: - cdb.GET_PERFORMANCE.Except = 1; - descriptorSize = sizeof(CDROM_NOMINAL_PERFORMANCE_DESCRIPTOR); - break; - case CdromPerformanceExceptionsOnly: - cdb.GET_PERFORMANCE.Except = 2; - descriptorSize = sizeof(CDROM_EXCEPTION_PERFORMANCE_DESCRIPTOR); - break; - } - - switch (inputBuffer->PerformanceType) { - case CdromReadPerformance: - cdb.GET_PERFORMANCE.Write = 0; break; - case CdromWritePerformance: - cdb.GET_PERFORMANCE.Write = 1; break; - } - - REVERSE_BYTES(&cdb.GET_PERFORMANCE.StartingLBA, &inputBuffer->StaringLba); - } - else if (inputBuffer->RequestType == CdromWriteSpeedRequest) - { - cdb.GET_PERFORMANCE.Type = 3; - descriptorSize = sizeof(CDROM_WRITE_SPEED_DESCRIPTOR); - } - - cdb.GET_PERFORMANCE.OperationCode = SCSIOP_GET_PERFORMANCE; - - // calculate how many descriptors can fit into the output buffer - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength >= - sizeof(CDROM_PERFORMANCE_HEADER) && - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength <= - MAXUSHORT && - descriptorSize > 0) - { - descriptorCount = (USHORT)(RequestParameters.Parameters.DeviceIoControl.OutputBufferLength - sizeof(CDROM_PERFORMANCE_HEADER)); - descriptorCount /= descriptorSize; - } - else - { - status = STATUS_INVALID_PARAMETER; - } - - REVERSE_BYTES_SHORT(&cdb.GET_PERFORMANCE.MaximumNumberOfDescriptors, &descriptorCount); - - // Calculate transfer size. We round it up to meet adapter requirements. - // Extra bytes are discarded later, when we copy data to the output buffer. - transferSize = RequestParameters.Parameters.DeviceIoControl.OutputBufferLength; - transferSize += DeviceExtension->AdapterDescriptor->AlignmentMask; - transferSize &= ~DeviceExtension->AdapterDescriptor->AlignmentMask; - - if (NT_SUCCESS(status)) - { - status = ScratchBuffer_ExecuteCdbEx(DeviceExtension, Request, (ULONG)transferSize, TRUE, &cdb, sizeof(cdb.GET_PERFORMANCE), CDROM_GET_PERFORMANCE_TIMEOUT); - } - - if (NT_SUCCESS(status)) - { - if (DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength < sizeof(CDROM_PERFORMANCE_HEADER)) - { - *DataLength = 0; - status = STATUS_INVALID_DEVICE_REQUEST; - } - else - { - *DataLength = min(RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength); - RtlCopyMemory(outputBuffer, - DeviceExtension->ScratchContext.ScratchBuffer, - *DataLength); - } - } - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleMcnSyncFakeIoctl( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handles an IOCTL_MCN_SYNC_FAKE_IOCTL request - -Arguments: - - DeviceExtension - device context - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PMEDIA_CHANGE_DETECTION_INFO info = DeviceExtension->MediaChangeDetectionInfo; - BOOLEAN shouldRetry = TRUE; - BOOLEAN requestSent = FALSE; - - PAGED_CODE (); - - *DataLength = 0; - - // - // Try to acquire the media change event. If we can't do it immediately - // then bail out and assume the caller will try again later. - // - while (shouldRetry) - { - status = RequestSetupMcnRequest(DeviceExtension, - info->Gesn.Supported); - - if (!NT_SUCCESS(status)) - { - shouldRetry = FALSE; - } - - if (NT_SUCCESS(status)) - { - requestSent = RequestSendMcnRequest(DeviceExtension); - - if (requestSent) - { - shouldRetry = RequestPostWorkMcnRequest(DeviceExtension); - } - else - { - shouldRetry = FALSE; - } - } - } - - // If there were any media change notifications that were not delivered - // for some reason, make an attempt to do so at this time. - DeviceSendDelayedMediaChangeNotifications(DeviceExtension); - - // Set the status and then complete the original request. - // The timer handler will be able to send the next request. - status = STATUS_SUCCESS; - - return status; -} - -BOOLEAN -RequestIsRealtimeStreaming( - _In_ WDFREQUEST Request, - _In_ BOOLEAN IsReadRequest - ) -/*++ - -Routine Description: - - Checks whether a given read/write request should - be performed in Real-Time Streaming mode. - -Arguments: - - Request - request to be checked - IsReadRequest - TRUE = read request; FALSE = write request - -Return Value: - - TRUE - a Real-Time Streaming operation has to be performed - FALSE - a normal (non-Streaming) operation has to be performed - ---*/ -{ - BOOLEAN useStreaming = FALSE; - - if (!useStreaming) { - // - // Check if we're required to use Streaming via I/O Stack Location flags - // - UCHAR currentStackLocationFlags = 0; - currentStackLocationFlags = RequestGetCurrentStackLocationFlags(Request); - - useStreaming = TEST_FLAG(currentStackLocationFlags, SL_REALTIME_STREAM); - } - - if (!useStreaming) { - // - // Check if we were previously requested to enforce Streaming for - // the file handle through which this request was sent. - // - - WDFFILEOBJECT fileObject; - PFILE_OBJECT_CONTEXT fileObjectContext; - - fileObject = WdfRequestGetFileObject(Request); - - if (fileObject != NULL) { - fileObjectContext = FileObjectGetContext(fileObject); - NT_ASSERT(fileObjectContext != NULL); - - if (IsReadRequest && fileObjectContext->EnforceStreamingRead) - { - useStreaming = TRUE; - } - - if (!IsReadRequest && fileObjectContext->EnforceStreamingWrite) - { - useStreaming = TRUE; - } - } - } - - return useStreaming; -} - - -NTSTATUS -RequestValidateReadWrite( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters - ) -/*++ - -Routine Description: - - Validate Read/Write request - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - - BOOLEAN isValid = TRUE; - LONGLONG startingOffset = 0; - size_t transferByteCount = 0; - PIRP irp = NULL; - PIO_STACK_LOCATION currentStack = NULL; - - irp = WdfRequestWdmGetIrp(Request); - currentStack = IoGetCurrentIrpStackLocation(irp); - - if (TEST_FLAG(DeviceExtension->DeviceObject->Flags, DO_VERIFY_VOLUME) && - (currentStack->MinorFunction != CDROM_VOLUME_VERIFY_CHECKED) && - !TEST_FLAG(currentStack->Flags, SL_OVERRIDE_VERIFY_VOLUME)) - { - // DO_VERIFY_VOLUME is set for the device object, - // but this request is not itself a verify request. - // So fail this request. - - //set the status for volume verification. - status = STATUS_VERIFY_REQUIRED; - } - - if (NT_SUCCESS(status)) - { - if (PLAY_ACTIVE(DeviceExtension)) - { - status = STATUS_DEVICE_BUSY; - } - } - - if (NT_SUCCESS(status)) - { - // If the device is in exclusive mode, check whether the request is from - // the handle that locked the device. - if (EXCLUSIVE_MODE(cdData) && !EXCLUSIVE_OWNER(cdData, WdfRequestGetFileObject(Request))) - { - // This request is not from the owner. We can't let the operation go. - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_RW, "RequestValidateReadWrite: Access Denied! Device in exclusive mode.\n")); - - status = STATUS_ACCESS_DENIED; - } - } - - // Validate the request alignment. - if (NT_SUCCESS(status)) - { - if (RequestParameters.Type == WdfRequestTypeRead) - { - startingOffset = RequestParameters.Parameters.Read.DeviceOffset; - transferByteCount = RequestParameters.Parameters.Read.Length; - } - else - { - startingOffset = RequestParameters.Parameters.Write.DeviceOffset; - transferByteCount = RequestParameters.Parameters.Write.Length; - } - - if (!DeviceExtension->DiskGeometry.BytesPerSector) - { - DeviceExtension->DiskGeometry.BytesPerSector = 2048; - } - - if (!DeviceExtension->SectorShift) - { - DeviceExtension->SectorShift = 11; - } - - // Perform some basic validation up front - if (TEST_FLAG(startingOffset, DeviceExtension->DiskGeometry.BytesPerSector - 1) || - TEST_FLAG(transferByteCount, DeviceExtension->DiskGeometry.BytesPerSector - 1)) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - } - - // validate the request against the current mmc schema - if (NT_SUCCESS(status)) - { - FEATURE_NUMBER schema = cdData->Mmc.ValidationSchema; - - // We validate read requests according to the RandomWritable schema, except in the - // case of IncrementalStreamingWritable, wherein the drive is responsible for all - // of the verification - if (RequestParameters.Type == WdfRequestTypeRead) - { - if (!cdData->Mmc.WriteAllowed) - { - // standard legacy validation of read irps - // if writing is not allowed on the media - schema = FeatureRandomWritable; - } - else if (schema != FeatureIncrementalStreamingWritable) - { - // standard legacy validation of read irps - // if not using streaming writes on writable media - schema = FeatureRandomWritable; - } - } - - // Fail write requests to read-only media - if ((RequestParameters.Type == WdfRequestTypeWrite) && - !(cdData->Mmc.WriteAllowed)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_RW, "RequestValidateReadWrite: Write request to read-only media\n")); - isValid = FALSE; - } - - if (isValid) - { - switch (schema) - { - case FeatureDefectManagement: - case FeatureRandomWritable: - // Ensure that the request is within bounds for ROM drives. - // Writer drives do not need to have bounds as outbounds request should not damage the drive. - if(!cdData->Mmc.IsWriter) - { - if ((startingOffset >= DeviceExtension->PartitionLength.QuadPart) || - startingOffset < 0) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_RW, "RequestValidateReadWrite: Request is out of bounds\n")); - isValid = FALSE; - - } - else - { - ULONGLONG bytesRemaining = DeviceExtension->PartitionLength.QuadPart - startingOffset; - - if ((ULONGLONG)transferByteCount > bytesRemaining) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_RW, "RequestValidateReadWrite: Request is out of bounds\n")); - isValid = FALSE; - } - } - } - break; - - case FeatureRigidRestrictedOverwrite: - // Ensure that the number of blocks is a multiple of the blocking size - if (((transferByteCount >> DeviceExtension->SectorShift) % cdData->Mmc.Blocking) != 0) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_RW, - "RequestValidateReadWrite: Number of blocks is not a multiple of the blocking size (%x)\n", - cdData->Mmc.Blocking)); - - isValid = FALSE; - } - // Fall through - case FeatureRestrictedOverwrite: - // Ensure that the request begins on a blocking boundary - if ((Int64ShrlMod32(startingOffset, DeviceExtension->SectorShift) % cdData->Mmc.Blocking) != 0) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_RW, - "RequestValidateReadWrite: Starting block is not a multiple of the blocking size (%x)\n", - cdData->Mmc.Blocking)); - - isValid = FALSE; - } - break; - - case FeatureIncrementalStreamingWritable: - // Let the drive handle the verification - break; - - default: - // Unknown schema. Fail the request - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_RW, - "RequestValidateReadWrite: Unknown validation schema (%x)\n", - schema)); - - isValid = FALSE; - break; - } //end of switch (schema) - } // end of if (isValid) - - if (!isValid) - { - status = STATUS_INVALID_DEVICE_REQUEST; - } - } // end of mmc schema validation - - // validate that the Real-Time Streaming requests meet device capabilties - if (NT_SUCCESS(status)) - { - // We do not check for FDO_HACK_NO_STREAMING in DeviceExtension->PrivateFdoData->HackFlags here, - // because we're going to hide device failures related to streaming reads/writes from the sender - // of the request. FDO_HACK_NO_STREAMING is going to be taken into account later during actual - // processing of the request. - if (RequestIsRealtimeStreaming(Request, RequestParameters.Type == WdfRequestTypeRead)) - { - if (RequestParameters.Type == WdfRequestTypeRead && !cdData->Mmc.StreamingReadSupported) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_RW, - "RequestValidateReadWrite: Streaming reads are not supported.\n")); - - status = STATUS_INVALID_DEVICE_REQUEST; - } - if (RequestParameters.Type == WdfRequestTypeWrite && !cdData->Mmc.StreamingWriteSupported) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_RW, - "RequestValidateReadWrite: Streaming writes are not supported.\n")); - - status = STATUS_INVALID_DEVICE_REQUEST; - } - } - } - - return status; -} - -NTSTATUS -RequestHandleReadWrite( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters - ) -/*++ - -Routine Description: - - Handle a read/write request - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - - size_t transferByteCount = 0; - PIRP irp = NULL; - PIO_STACK_LOCATION currentStack = NULL; - - PUCHAR dataBuffer; - - - irp = WdfRequestWdmGetIrp(Request); - currentStack = IoGetCurrentIrpStackLocation(irp); - dataBuffer = MmGetMdlVirtualAddress(irp->MdlAddress); - - if (NT_SUCCESS(status)) - { - if (RequestParameters.Type == WdfRequestTypeRead) - { - transferByteCount = RequestParameters.Parameters.Read.Length; - } - else - { - transferByteCount = RequestParameters.Parameters.Write.Length; - } - - if (transferByteCount == 0) - { - // Several parts of the code turn 0 into 0xffffffff, - // so don't process a zero-length request any further. - status = STATUS_SUCCESS; - RequestCompletion(DeviceExtension, Request, status, 0); - return status; - } - - // Add partition byte offset to make starting byte relative to - // beginning of disk. - currentStack->Parameters.Read.ByteOffset.QuadPart += (DeviceExtension->StartingOffset.QuadPart); - - //not very necessary as the starting offset for CD/DVD device is always 0. - if (RequestParameters.Type == WdfRequestTypeRead) - { - RequestParameters.Parameters.Read.DeviceOffset = currentStack->Parameters.Read.ByteOffset.QuadPart; - } - else - { - RequestParameters.Parameters.Write.DeviceOffset = currentStack->Parameters.Write.ByteOffset.QuadPart; - } - } - - if (NT_SUCCESS(status)) - { - ULONG entireXferLen = currentStack->Parameters.Read.Length; - ULONG maxLength = 0; - ULONG packetsCount = 0; - - PCDROM_SCRATCH_READ_WRITE_CONTEXT readWriteContext; - PCDROM_REQUEST_CONTEXT requestContext; - PCDROM_REQUEST_CONTEXT originalRequestContext; - - // get the count of packets we need to send. - if ((((ULONG_PTR)dataBuffer) & (PAGE_SIZE-1)) == 0) - { - maxLength = cdData->MaxPageAlignedTransferBytes; - } - else - { - maxLength = cdData->MaxUnalignedTransferBytes; - } - - packetsCount = entireXferLen / maxLength; - - if (entireXferLen % maxLength != 0) - { - packetsCount++; - } - - originalRequestContext = RequestGetContext(Request); - - - ScratchBuffer_BeginUse(DeviceExtension); - - readWriteContext = &DeviceExtension->ScratchContext.ScratchReadWriteContext; - requestContext = RequestGetContext(DeviceExtension->ScratchContext.ScratchRequest); - - readWriteContext->PacketsCount = packetsCount; - readWriteContext->EntireXferLen = entireXferLen; - readWriteContext->MaxLength = maxLength; - readWriteContext->StartingOffset = currentStack->Parameters.Read.ByteOffset; - readWriteContext->DataBuffer = dataBuffer; - readWriteContext->TransferedBytes = 0; - readWriteContext->IsRead = (RequestParameters.Type == WdfRequestTypeRead); - - requestContext->OriginalRequest = Request; - requestContext->DeviceExtension = DeviceExtension; - - // - // Setup the READ/WRITE fields in the original request which is what - // we use to properly synchronize cancellation logic between the - // cancel callback and the timer routine. - // - - originalRequestContext->ReadWriteIsCompleted = FALSE; - originalRequestContext->ReadWriteRetryInitialized = FALSE; - originalRequestContext->DeviceExtension = DeviceExtension; - - status = ScratchBuffer_PerformNextReadWrite(DeviceExtension, TRUE); - - // We do not call ScratchBuffer_EndUse here, because we're not releasing the scratch SRB. - // It will be released in the completion routine. - } - - return status; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -RequestHandleLoadEjectMedia( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_STORAGE_EJECT_MEDIA - IOCTL_STORAGE_LOAD_MEDIA - IOCTL_STORAGE_LOAD_MEDIA2 - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PZERO_POWER_ODD_INFO zpoddInfo = DeviceExtension->ZeroPowerODDInfo; - - PAGED_CODE (); - - *DataLength = 0; - - if (NT_SUCCESS(status)) - { - // Synchronize with ejection control and ejection cleanup code as - // well as other eject/load requests. - WdfWaitLockAcquire(DeviceExtension->EjectSynchronizationLock, NULL); - - if(DeviceExtension->ProtectedLockCount != 0) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, "RequestHandleLoadEjectMedia: call to eject protected locked " - "device - failure\n")); - status = STATUS_DEVICE_BUSY; - } - - if (NT_SUCCESS(status)) - { - SCSI_REQUEST_BLOCK srb; - PCDB cdb = (PCDB)srb.Cdb; - - RtlZeroMemory(&srb, sizeof(SCSI_REQUEST_BLOCK)); - - srb.CdbLength = 6; - - cdb->START_STOP.OperationCode = SCSIOP_START_STOP_UNIT; - cdb->START_STOP.LoadEject = 1; - - if(RequestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_STORAGE_EJECT_MEDIA) - { - cdb->START_STOP.Start = 0; - - // We are sending down a soft eject, and in this case we should take an active ref - // if the command succeeds. - if ((zpoddInfo != NULL) && - (zpoddInfo->LoadingMechanism == LOADING_MECHANISM_TRAY) && - (zpoddInfo->Load == 0)) // Drawer - { - zpoddInfo->MonitorStartStopUnit = TRUE; - } - } - else - { - cdb->START_STOP.Start = 1; - } - - status = DeviceSendSrbSynchronously(DeviceExtension->Device, - &srb, - NULL, - 0, - FALSE, - Request); - - if (zpoddInfo != NULL) - { - zpoddInfo->MonitorStartStopUnit = FALSE; - } - } - - WdfWaitLockRelease(DeviceExtension->EjectSynchronizationLock); - } - - return status; -} - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -RequestHandleReserveRelease( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_STORAGE_RESERVE - IOCTL_STORAGE_RELEASE - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PSCSI_REQUEST_BLOCK srb = NULL; - PCDB cdb = NULL; - ULONG ioctlCode = 0; - - PAGED_CODE (); - - *DataLength = 0; - - srb = ExAllocatePool2(POOL_FLAG_NON_PAGED, - sizeof(SCSI_REQUEST_BLOCK) + - (sizeof(ULONG_PTR) * 2), - CDROM_TAG_SRB); - - if (srb == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - - if (NT_SUCCESS(status)) - { - ioctlCode = RequestParameters.Parameters.DeviceIoControl.IoControlCode; - cdb = (PCDB)srb->Cdb; - - if (TEST_FLAG(DeviceExtension->PrivateFdoData->HackFlags, FDO_HACK_NO_RESERVE6)) - { - srb->CdbLength = 10; - cdb->CDB10.OperationCode = (ioctlCode == IOCTL_STORAGE_RESERVE) ? SCSIOP_RESERVE_UNIT10 : SCSIOP_RELEASE_UNIT10; - } - else - { - srb->CdbLength = 6; - cdb->CDB6GENERIC.OperationCode = (ioctlCode == IOCTL_STORAGE_RESERVE) ? SCSIOP_RESERVE_UNIT : SCSIOP_RELEASE_UNIT; - } - - // Set timeout value. - srb->TimeOutValue = DeviceExtension->TimeOutValue; - - // Send reserves as tagged requests. - if (ioctlCode == IOCTL_STORAGE_RESERVE) - { - SET_FLAG(srb->SrbFlags, SRB_FLAGS_QUEUE_ACTION_ENABLE); - srb->QueueAction = SRB_SIMPLE_TAG_REQUEST; - } - - status = DeviceSendSrbSynchronously(DeviceExtension->Device, - srb, - NULL, - 0, - FALSE, - Request); - // no data transfer. - *DataLength = 0; - - FREE_POOL(srb); - } - - return status; -} // end RequestHandleReserveRelease() - -__inline -BOOLEAN -ValidPersistentReserveScope( - UCHAR Scope) -{ - switch (Scope) { - case RESERVATION_SCOPE_LU: - case RESERVATION_SCOPE_ELEMENT: - - return TRUE; - - default: - - return FALSE; - } -} - -__inline -BOOLEAN -ValidPersistentReserveType( - UCHAR Type) -{ - switch (Type) { - case RESERVATION_TYPE_WRITE_EXCLUSIVE: - case RESERVATION_TYPE_EXCLUSIVE: - case RESERVATION_TYPE_WRITE_EXCLUSIVE_REGISTRANTS: - case RESERVATION_TYPE_EXCLUSIVE_REGISTRANTS: - - return TRUE; - - default: - - return FALSE; - } -} - -NTSTATUS -RequestValidatePersistentReserve( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Validate request of IOCTL_STORAGE_PERSISTENT_RESERVE_IN - IOCTL_STORAGE_PERSISTENT_RESERVE_OUT - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - ULONG ioctlCode = RequestParameters.Parameters.DeviceIoControl.IoControlCode; - - PPERSISTENT_RESERVE_COMMAND reserveCommand = NULL; - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&reserveCommand, - NULL); - if (NT_SUCCESS(status)) - { - if ((RequestParameters.Parameters.DeviceIoControl.InputBufferLength < sizeof(PERSISTENT_RESERVE_COMMAND)) || - (reserveCommand->Size < sizeof(PERSISTENT_RESERVE_COMMAND))) - { - *DataLength = 0; - status = STATUS_INFO_LENGTH_MISMATCH; - } - else if ((ULONG_PTR)reserveCommand & DeviceExtension->AdapterDescriptor->AlignmentMask) - { - // Check buffer alignment. Only an issue if another kernel mode component - // (not the I/O manager) allocates the buffer. - *DataLength = 0; - status = STATUS_INVALID_USER_BUFFER; - } - } - - if (NT_SUCCESS(status)) - { - if (ioctlCode == IOCTL_STORAGE_PERSISTENT_RESERVE_IN) - { - if (RequestParameters.Parameters.DeviceIoControl.OutputBufferLength < reserveCommand->PR_IN.AllocationLength) - { - *DataLength = 0; - status = STATUS_INVALID_PARAMETER; - } - else - { - switch (reserveCommand->PR_IN.ServiceAction) - { - case RESERVATION_ACTION_READ_KEYS: - if (reserveCommand->PR_IN.AllocationLength < sizeof(PRI_REGISTRATION_LIST)) - { - *DataLength = 0; - status = STATUS_INVALID_PARAMETER; - } - break; - - case RESERVATION_ACTION_READ_RESERVATIONS: - if (reserveCommand->PR_IN.AllocationLength < sizeof(PRI_RESERVATION_LIST)) - { - *DataLength = 0; - status = STATUS_INVALID_PARAMETER; - } - break; - - default: - *DataLength = 0; - status = STATUS_INVALID_PARAMETER; - break; - } - } - } - else // case of IOCTL_STORAGE_PERSISTENT_RESERVE_OUT - { - // Verify ServiceAction, Scope, and Type - switch (reserveCommand->PR_OUT.ServiceAction) - { - case RESERVATION_ACTION_REGISTER: - case RESERVATION_ACTION_REGISTER_IGNORE_EXISTING: - case RESERVATION_ACTION_CLEAR: - // Scope and type ignored. - break; - - case RESERVATION_ACTION_RESERVE: - case RESERVATION_ACTION_RELEASE: - case RESERVATION_ACTION_PREEMPT: - case RESERVATION_ACTION_PREEMPT_ABORT: - if (!ValidPersistentReserveScope(reserveCommand->PR_OUT.Scope) || - !ValidPersistentReserveType(reserveCommand->PR_OUT.Type)) - { - *DataLength = 0; - status = STATUS_INVALID_PARAMETER; - } - break; - - default: - *DataLength = 0; - status = STATUS_INVALID_PARAMETER; - break; - } - - // Check input buffer for PR Out. - // Caller must include the PR parameter list. - if (NT_SUCCESS(status)) - { - if ((RequestParameters.Parameters.DeviceIoControl.InputBufferLength < - (sizeof(PERSISTENT_RESERVE_COMMAND) + sizeof(PRO_PARAMETER_LIST))) || - (reserveCommand->Size < RequestParameters.Parameters.DeviceIoControl.InputBufferLength)) - { - *DataLength = 0; - status = STATUS_INVALID_PARAMETER; - } - } - } // end of validation for IOCTL_STORAGE_PERSISTENT_RESERVE_OUT - } - - return status; -} // end RequestValidatePersistentReserve() - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -RequestHandlePersistentReserve( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_STORAGE_PERSISTENT_RESERVE_IN - IOCTL_STORAGE_PERSISTENT_RESERVE_OUT - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - ULONG ioctlCode = RequestParameters.Parameters.DeviceIoControl.IoControlCode; - PSCSI_REQUEST_BLOCK srb = NULL; - PCDB cdb = NULL; - BOOLEAN writeToDevice; - - PPERSISTENT_RESERVE_COMMAND reserveCommand = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&reserveCommand, - NULL); - if (NT_SUCCESS(status)) - { - srb = ExAllocatePool2(POOL_FLAG_NON_PAGED, - sizeof(SCSI_REQUEST_BLOCK) + - (sizeof(ULONG_PTR) * 2), - CDROM_TAG_SRB); - - if (srb == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - else - { - cdb = (PCDB)srb->Cdb; - RtlZeroMemory(srb, sizeof(SCSI_REQUEST_BLOCK)); - } - } - - if (NT_SUCCESS(status)) - { - size_t dataBufLen = 0; - - // Fill in the CDB. - if (ioctlCode == IOCTL_STORAGE_PERSISTENT_RESERVE_IN) - { - cdb->PERSISTENT_RESERVE_IN.OperationCode = SCSIOP_PERSISTENT_RESERVE_IN; - cdb->PERSISTENT_RESERVE_IN.ServiceAction = reserveCommand->PR_IN.ServiceAction; - - REVERSE_BYTES_SHORT(&(cdb->PERSISTENT_RESERVE_IN.AllocationLength), - &(reserveCommand->PR_IN.AllocationLength)); - - dataBufLen = RequestParameters.Parameters.DeviceIoControl.OutputBufferLength; - writeToDevice = FALSE; - } - else - { - cdb->PERSISTENT_RESERVE_OUT.OperationCode = SCSIOP_PERSISTENT_RESERVE_OUT; - cdb->PERSISTENT_RESERVE_OUT.ServiceAction = reserveCommand->PR_OUT.ServiceAction; - cdb->PERSISTENT_RESERVE_OUT.Scope = reserveCommand->PR_OUT.Scope; - cdb->PERSISTENT_RESERVE_OUT.Type = reserveCommand->PR_OUT.Type; - - cdb->PERSISTENT_RESERVE_OUT.ParameterListLength[1] = (UCHAR)sizeof(PRO_PARAMETER_LIST); - - // Move the parameter list to the beginning of the data buffer (so it is aligned - // correctly and that the MDL describes it correctly). - RtlMoveMemory(reserveCommand, - reserveCommand->PR_OUT.ParameterList, - sizeof(PRO_PARAMETER_LIST)); - - dataBufLen = sizeof(PRO_PARAMETER_LIST); - writeToDevice = TRUE; - } - - srb->CdbLength = 10; - srb->QueueAction = SRB_SIMPLE_TAG_REQUEST; - - status = DeviceSendSrbSynchronously(DeviceExtension->Device, - srb, - reserveCommand, - (ULONG) dataBufLen, - writeToDevice, - Request); - - FREE_POOL(srb); - } - - return status; -} - -#if (NTDDI_VERSION >= NTDDI_WIN8) -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleAreVolumesReady( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_DISK_ARE_VOLUMES_READY - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - BOOLEAN completeRequest = TRUE; - NTSTATUS status = STATUS_SUCCESS; - - UNREFERENCED_PARAMETER(RequestParameters); - - *DataLength = 0; - - if (DeviceExtension->IsVolumeOnlinePending == FALSE) - { - status = STATUS_SUCCESS; - goto Cleanup; - } - - // - // Add to the volume ready queue. No worries about request cancellation, - // since KMDF will automatically handle that while request is in queue. - // - status = WdfRequestForwardToIoQueue(Request, - DeviceExtension->ManualVolumeReadyQueue - ); - - if(!NT_SUCCESS(status)) - { - goto Cleanup; - } - - status = STATUS_PENDING; - completeRequest = FALSE; - -Cleanup: - - if (completeRequest) - { - RequestCompletion(DeviceExtension, Request, status, 0); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleVolumeOnline( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_VOLUME_ONLINE / IOCTL_VOLUME_POST_ONLINE - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - WDFREQUEST request; - PIRP irp = NULL; - PIO_STACK_LOCATION nextStack = NULL; - - UNREFERENCED_PARAMETER(RequestParameters); - - *DataLength = 0; - - DeviceExtension->IsVolumeOnlinePending = FALSE; - - // Complete all parked volume ready requests. - for (;;) - { - status = WdfIoQueueRetrieveNextRequest(DeviceExtension->ManualVolumeReadyQueue, - &request); - - if (!NT_SUCCESS(status)) - { - break; - } - - RequestCompletion(DeviceExtension, request, STATUS_SUCCESS, 0); - } - - // Change the IOCTL code to IOCTL_DISK_VOLUMES_ARE_READY, and forward the request down, - // so that if the underlying port driver will also know that volume is ready. - WdfRequestFormatRequestUsingCurrentType(Request); - irp = WdfRequestWdmGetIrp(Request); - nextStack = IoGetNextIrpStackLocation(irp); - - irp->AssociatedIrp.SystemBuffer = &DeviceExtension->DeviceNumber; - nextStack->Parameters.DeviceIoControl.OutputBufferLength = 0; - nextStack->Parameters.DeviceIoControl.InputBufferLength = sizeof (DeviceExtension->DeviceNumber); - nextStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_DISK_VOLUMES_ARE_READY; - - // Send the request straight down (synchronously). - RequestSend(DeviceExtension, - Request, - DeviceExtension->IoTarget, - WDF_REQUEST_SEND_OPTION_SYNCHRONOUS, - NULL); - - return STATUS_SUCCESS; -} -#endif - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceHandleRawRead( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_CDROM_RAW_READ - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - // Determine whether the drive is currently in raw or cooked mode, - // and which command to use to read the data. - - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - RAW_READ_INFO rawReadInfo = {0}; - PVOID outputVirtAddr = NULL; - ULONG startingSector; - - PIRP irp = WdfRequestWdmGetIrp(Request); - PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(irp); - - VOID* outputBuffer = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - if (TEST_FLAG(DeviceExtension->DeviceObject->Flags, DO_VERIFY_VOLUME) && - (currentIrpStack->MinorFunction != CDROM_VOLUME_VERIFY_CHECKED) && - !TEST_FLAG(currentIrpStack->Flags, SL_OVERRIDE_VERIFY_VOLUME)) - { - // DO_VERIFY_VOLUME is set for the device object, - // but this request is not itself a verify request. - // So fail this request. - (VOID) MediaReadCapacity(DeviceExtension->Device); - - *DataLength = 0; - //set the status for volume verification. - status = STATUS_VERIFY_REQUIRED; - } - - if (NT_SUCCESS(status)) - { - // Since this ioctl is METHOD_OUT_DIRECT, we need to copy away - // the input buffer before interpreting it. This prevents a - // malicious app from messing with the input buffer while we - // are interpreting it. This is done in dispacth. - // - // Here, we are going to get the input buffer out of saved place. - rawReadInfo = *(PRAW_READ_INFO)currentIrpStack->Parameters.DeviceIoControl.Type3InputBuffer; - - if (currentIrpStack->Parameters.DeviceIoControl.OutputBufferLength > 0) - { - // Make sure that any user buffer that we pass down to - // the hardware is properly aligned - NT_ASSERT(irp->MdlAddress); - outputVirtAddr = MmGetMdlVirtualAddress(irp->MdlAddress); - if ((ULONG_PTR)outputVirtAddr & DeviceExtension->AdapterDescriptor->AlignmentMask) - { - NT_ASSERT(!((ULONG_PTR)outputVirtAddr & DeviceExtension->AdapterDescriptor->AlignmentMask)); - *DataLength = 0; - status = STATUS_INVALID_PARAMETER; - } - } - else - { - status = STATUS_INVALID_PARAMETER; - } - } - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &outputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - switch (rawReadInfo.TrackMode) - { - case CDDA: - case YellowMode2: - case XAForm2: - // no check needed. - break; - - case RawWithC2AndSubCode: - if (!cdData->Mmc.ReadCdC2Pointers || !cdData->Mmc.ReadCdSubCode) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "Request to read C2 & Subcode rejected. " - "Is C2 supported: %d Is Subcode supported: %d\n", - cdData->Mmc.ReadCdC2Pointers, - cdData->Mmc.ReadCdSubCode - )); - *DataLength = 0; - status = STATUS_INVALID_DEVICE_REQUEST; - } - break; - case RawWithC2: - if (!cdData->Mmc.ReadCdC2Pointers) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "Request to read C2 rejected because drive does not " - "report support for C2 pointers\n" - )); - *DataLength = 0; - status = STATUS_INVALID_DEVICE_REQUEST; - } - break; - case RawWithSubCode: - - if (!cdData->Mmc.ReadCdSubCode) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "Request to read subcode rejected because drive does " - "not report support for reading the subcode data\n" - )); - *DataLength = 0; - status = STATUS_INVALID_DEVICE_REQUEST; - } - break; - - default: - *DataLength = 0; - status = STATUS_INVALID_DEVICE_REQUEST; - break; - } - } - - if (NT_SUCCESS(status)) - { - PSCSI_REQUEST_BLOCK srb = DeviceExtension->ScratchContext.ScratchSrb; - PCDB cdb = (PCDB)(srb->Cdb); - - size_t transferByteCount; - BOOLEAN shouldRetry = TRUE; - ULONG timesAlreadyRetried = 0; - LONGLONG retryIn100nsUnits = 0; - - transferByteCount = RequestParameters.Parameters.DeviceIoControl.OutputBufferLength; - - ScratchBuffer_BeginUse(DeviceExtension); - - while (shouldRetry) - { - // Setup cdb depending upon the sector type we want. - switch (rawReadInfo.TrackMode) - { - case CDDA: - transferByteCount = rawReadInfo.SectorCount * RAW_SECTOR_SIZE; - cdb->READ_CD.ExpectedSectorType = CD_DA_SECTOR; - cdb->READ_CD.IncludeUserData = 1; - cdb->READ_CD.HeaderCode = 3; - cdb->READ_CD.IncludeSyncData = 1; - break; - - case YellowMode2: - transferByteCount = rawReadInfo.SectorCount * RAW_SECTOR_SIZE; - cdb->READ_CD.ExpectedSectorType = YELLOW_MODE2_SECTOR; - cdb->READ_CD.IncludeUserData = 1; - cdb->READ_CD.HeaderCode = 1; - cdb->READ_CD.IncludeSyncData = 1; - break; - - case XAForm2: - transferByteCount = rawReadInfo.SectorCount * RAW_SECTOR_SIZE; - cdb->READ_CD.ExpectedSectorType = FORM2_MODE2_SECTOR; - cdb->READ_CD.IncludeUserData = 1; - cdb->READ_CD.HeaderCode = 3; - cdb->READ_CD.IncludeSyncData = 1; - break; - - case RawWithC2AndSubCode: - transferByteCount = rawReadInfo.SectorCount * CD_RAW_SECTOR_WITH_C2_AND_SUBCODE_SIZE; - cdb->READ_CD.ExpectedSectorType = 0; // Any sector type - cdb->READ_CD.IncludeUserData = 1; - cdb->READ_CD.HeaderCode = 3; // Header and subheader returned - cdb->READ_CD.IncludeSyncData = 1; - cdb->READ_CD.ErrorFlags = 2; // C2 and block error - cdb->READ_CD.SubChannelSelection = 1; // raw subchannel data - break; - - case RawWithC2: - transferByteCount = rawReadInfo.SectorCount * CD_RAW_SECTOR_WITH_C2_SIZE; - cdb->READ_CD.ExpectedSectorType = 0; // Any sector type - cdb->READ_CD.IncludeUserData = 1; - cdb->READ_CD.HeaderCode = 3; // Header and subheader returned - cdb->READ_CD.IncludeSyncData = 1; - cdb->READ_CD.ErrorFlags = 2; // C2 and block error - break; - - case RawWithSubCode: - transferByteCount = rawReadInfo.SectorCount * CD_RAW_SECTOR_WITH_SUBCODE_SIZE; - cdb->READ_CD.ExpectedSectorType = 0; // Any sector type - cdb->READ_CD.IncludeUserData = 1; - cdb->READ_CD.HeaderCode = 3; // Header and subheader returned - cdb->READ_CD.IncludeSyncData = 1; - cdb->READ_CD.SubChannelSelection = 1; // raw subchannel data - break; - - default: - // should already checked before coming in loop. - NT_ASSERT(FALSE); - break; - } - - ScratchBuffer_SetupSrb(DeviceExtension, Request, (ULONG)transferByteCount, TRUE); - // Restore the buffer, buffer size and MdlAddress. They got changed but we don't want to use the scratch buffer. - { - PIRP scratchIrp = WdfRequestWdmGetIrp(DeviceExtension->ScratchContext.ScratchRequest); - scratchIrp->MdlAddress = irp->MdlAddress; - srb->DataBuffer = outputVirtAddr; - srb->DataTransferLength = (ULONG)transferByteCount; - } - // Calculate starting offset. - startingSector = (ULONG)(rawReadInfo.DiskOffset.QuadPart >> DeviceExtension->SectorShift); - - // Fill in CDB fields. - srb->CdbLength = 12; - - cdb->READ_CD.OperationCode = SCSIOP_READ_CD; - cdb->READ_CD.TransferBlocks[2] = (UCHAR) (rawReadInfo.SectorCount & 0xFF); - cdb->READ_CD.TransferBlocks[1] = (UCHAR) (rawReadInfo.SectorCount >> 8 ); - cdb->READ_CD.TransferBlocks[0] = (UCHAR) (rawReadInfo.SectorCount >> 16); - - cdb->READ_CD.StartingLBA[3] = (UCHAR) (startingSector & 0xFF); - cdb->READ_CD.StartingLBA[2] = (UCHAR) ((startingSector >> 8)); - cdb->READ_CD.StartingLBA[1] = (UCHAR) ((startingSector >> 16)); - cdb->READ_CD.StartingLBA[0] = (UCHAR) ((startingSector >> 24)); - - ScratchBuffer_SendSrb(DeviceExtension, TRUE, NULL); - - if ((DeviceExtension->ScratchContext.ScratchSrb->SrbStatus == SRB_STATUS_ABORTED) && - (DeviceExtension->ScratchContext.ScratchSrb->InternalStatus == STATUS_CANCELLED)) - { - shouldRetry = FALSE; - status = STATUS_CANCELLED; - } - else - { - shouldRetry = RequestSenseInfoInterpretForScratchBuffer(DeviceExtension, - timesAlreadyRetried, - &status, - &retryIn100nsUnits); - if (shouldRetry) - { - LARGE_INTEGER t; - t.QuadPart = -retryIn100nsUnits; - timesAlreadyRetried++; - KeDelayExecutionThread(KernelMode, FALSE, &t); - // keep items clean - ScratchBuffer_ResetItems(DeviceExtension, FALSE); - } - } - } - - if (NT_SUCCESS(status)) - { - *DataLength = srb->DataTransferLength; - } - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandlePlayAudioMsf( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_CDROM_PLAY_AUDIO_MSF - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_PLAY_AUDIO_MSF inputBuffer = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&inputBuffer, - NULL); - - - if (NT_SUCCESS(status)) - { - ULONG transferSize = 0; - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.PLAY_AUDIO_MSF.OperationCode = SCSIOP_PLAY_AUDIO_MSF; - - cdb.PLAY_AUDIO_MSF.StartingM = inputBuffer->StartingM; - cdb.PLAY_AUDIO_MSF.StartingS = inputBuffer->StartingS; - cdb.PLAY_AUDIO_MSF.StartingF = inputBuffer->StartingF; - - cdb.PLAY_AUDIO_MSF.EndingM = inputBuffer->EndingM; - cdb.PLAY_AUDIO_MSF.EndingS = inputBuffer->EndingS; - cdb.PLAY_AUDIO_MSF.EndingF = inputBuffer->EndingF; - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, transferSize, FALSE, &cdb, 10); - - if (NT_SUCCESS(status)) - { - PLAY_ACTIVE(DeviceExtension) = TRUE; - *DataLength = 0; - } - - // nothing to do after the command finishes. - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleReadQChannel( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_CDROM_READ_Q_CHANNEL - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PVOID inputBuffer = NULL; - PVOID outputBuffer = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &outputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - status = ReadQChannel(DeviceExtension, - Request, - inputBuffer, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - outputBuffer, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - DataLength); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -ReadQChannel( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ WDFREQUEST OriginalRequest, - _In_ PVOID InputBuffer, - _In_ size_t InputBufferLength, - _In_ PVOID OutputBuffer, - _In_ size_t OutputBufferLength, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - base function to handle request of IOCTL_CDROM_READ_Q_CHANNEL - -Arguments: - - DeviceExtension - device context - OriginalRequest - original request to be handled - InputBuffer - input buffer - InputBufferLength - length of input buffer - OutputBuffer - output buffer - OutputBufferLength - length of output buffer - -Return Value: - - NTSTATUS - DataLength - returned data length - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - ULONG transferByteCount = 0; - CDB cdb; - PCDROM_SUB_Q_DATA_FORMAT inputBuffer = (PCDROM_SUB_Q_DATA_FORMAT)InputBuffer; - PSUB_Q_CHANNEL_DATA userChannelData = (PSUB_Q_CHANNEL_DATA)OutputBuffer; - - PAGED_CODE (); - - UNREFERENCED_PARAMETER(InputBufferLength); - - *DataLength = 0; - - // Set size of channel data -- however, this is dependent on - // what information we are requesting (which Format) - switch( inputBuffer->Format ) - { - case IOCTL_CDROM_CURRENT_POSITION: - transferByteCount = sizeof(SUB_Q_CURRENT_POSITION); - break; - - case IOCTL_CDROM_MEDIA_CATALOG: - transferByteCount = sizeof(SUB_Q_MEDIA_CATALOG_NUMBER); - break; - - case IOCTL_CDROM_TRACK_ISRC: - transferByteCount = sizeof(SUB_Q_TRACK_ISRC); - break; - } - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - // Always logical unit 0, but only use MSF addressing - // for IOCTL_CDROM_CURRENT_POSITION - if (inputBuffer->Format==IOCTL_CDROM_CURRENT_POSITION) - { - cdb.SUBCHANNEL.Msf = CDB_USE_MSF; - } - - // Return subchannel data - cdb.SUBCHANNEL.SubQ = CDB_SUBCHANNEL_BLOCK; - - // Specify format of informatin to return - cdb.SUBCHANNEL.Format = inputBuffer->Format; - - // Specify which track to access (only used by Track ISRC reads) - if (inputBuffer->Format==IOCTL_CDROM_TRACK_ISRC) - { - cdb.SUBCHANNEL.TrackNumber = inputBuffer->Track; - } - - cdb.SUBCHANNEL.AllocationLength[0] = (UCHAR) (transferByteCount >> 8); - cdb.SUBCHANNEL.AllocationLength[1] = (UCHAR) (transferByteCount & 0xFF); - cdb.SUBCHANNEL.OperationCode = SCSIOP_READ_SUB_CHANNEL; - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, OriginalRequest, transferByteCount, TRUE, &cdb, 10); - - if (NT_SUCCESS(status)) - { - PSUB_Q_CHANNEL_DATA subQPtr = DeviceExtension->ScratchContext.ScratchSrb->DataBuffer; - -#if DBG - switch( inputBuffer->Format ) - { - case IOCTL_CDROM_CURRENT_POSITION: - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL,"ReadQChannel: Audio Status is %u\n", subQPtr->CurrentPosition.Header.AudioStatus )); - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL,"ReadQChannel: ADR = 0x%x\n", subQPtr->CurrentPosition.ADR )); - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL,"ReadQChannel: Control = 0x%x\n", subQPtr->CurrentPosition.Control )); - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL,"ReadQChannel: Track = %u\n", subQPtr->CurrentPosition.TrackNumber )); - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL,"ReadQChannel: Index = %u\n", subQPtr->CurrentPosition.IndexNumber )); - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL,"ReadQChannel: Absolute Address = %x\n", *((PULONG)subQPtr->CurrentPosition.AbsoluteAddress) )); - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL,"ReadQChannel: Relative Address = %x\n", *((PULONG)subQPtr->CurrentPosition.TrackRelativeAddress) )); - break; - - case IOCTL_CDROM_MEDIA_CATALOG: - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL,"ReadQChannel: Audio Status is %u\n", subQPtr->MediaCatalog.Header.AudioStatus )); - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL,"ReadQChannel: Mcval is %u\n", subQPtr->MediaCatalog.Mcval )); - break; - - case IOCTL_CDROM_TRACK_ISRC: - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL,"ReadQChannel: Audio Status is %u\n", subQPtr->TrackIsrc.Header.AudioStatus )); - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL,"ReadQChannel: Tcval is %u\n", subQPtr->TrackIsrc.Tcval )); - break; - } -#endif - - // Update the play active status. - if (subQPtr->CurrentPosition.Header.AudioStatus == AUDIO_STATUS_IN_PROGRESS) - { - PLAY_ACTIVE(DeviceExtension) = TRUE; - } - else - { - PLAY_ACTIVE(DeviceExtension) = FALSE; - } - - // Check if output buffer is large enough to contain - // the data. - if (OutputBufferLength < DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength) - { - DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength = (ULONG)OutputBufferLength; - } - - // Copy our buffer into users. - RtlMoveMemory(userChannelData, - subQPtr, - DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength); - - *DataLength = DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength; - } - - // nothing to do after the command finishes. - ScratchBuffer_EndUse(DeviceExtension); - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandlePauseAudio( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_CDROM_PAUSE_AUDIO - -Arguments: - - DeviceExtension - device context - Request - request to be handled - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - PAGED_CODE (); - - *DataLength = 0; - - if (NT_SUCCESS(status)) - { - ULONG transferSize = 0; - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.PAUSE_RESUME.OperationCode = SCSIOP_PAUSE_RESUME; - cdb.PAUSE_RESUME.Action = CDB_AUDIO_PAUSE; - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, transferSize, FALSE, &cdb, 10); - - if (NT_SUCCESS(status)) - { - PLAY_ACTIVE(DeviceExtension) = FALSE; - *DataLength = 0; - } - - // nothing to do after the command finishes. - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleResumeAudio( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_CDROM_RESUME_AUDIO - -Arguments: - - DeviceExtension - device context - Request - request to be handled - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - PAGED_CODE (); - - *DataLength = 0; - - if (NT_SUCCESS(status)) - { - ULONG transferSize = 0; - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.PAUSE_RESUME.OperationCode = SCSIOP_PAUSE_RESUME; - cdb.PAUSE_RESUME.Action = CDB_AUDIO_RESUME; - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, transferSize, FALSE, &cdb, 10); - - if (NT_SUCCESS(status)) - { - PLAY_ACTIVE(DeviceExtension) = TRUE; //not in original code. But we should set it. - *DataLength = 0; - } - - // nothing to do after the command finishes. - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleSeekAudioMsf( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_CDROM_SEEK_AUDIO_MSF - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_SEEK_AUDIO_MSF inputBuffer = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&inputBuffer, - NULL); - - if (NT_SUCCESS(status)) - { - ULONG transferSize = 0; - CDB cdb; - ULONG logicalBlockAddress; - - logicalBlockAddress = MSF_TO_LBA(inputBuffer->M, inputBuffer->S, inputBuffer->F); - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.SEEK.OperationCode = SCSIOP_SEEK; - cdb.SEEK.LogicalBlockAddress[0] = ((PFOUR_BYTE)&logicalBlockAddress)->Byte3; - cdb.SEEK.LogicalBlockAddress[1] = ((PFOUR_BYTE)&logicalBlockAddress)->Byte2; - cdb.SEEK.LogicalBlockAddress[2] = ((PFOUR_BYTE)&logicalBlockAddress)->Byte1; - cdb.SEEK.LogicalBlockAddress[3] = ((PFOUR_BYTE)&logicalBlockAddress)->Byte0; - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, transferSize, FALSE, &cdb, 10); - - if (NT_SUCCESS(status)) - { - *DataLength = 0; - } - - // nothing to do after the command finishes. - - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleStopAudio( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ) -{ - NTSTATUS status = STATUS_SUCCESS; - - PAGED_CODE (); - - *DataLength = 0; - - if (NT_SUCCESS(status)) - { - ULONG transferSize = 0; - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.START_STOP.OperationCode = SCSIOP_START_STOP_UNIT; - cdb.START_STOP.Immediate = 1; - cdb.START_STOP.Start = 0; - cdb.START_STOP.LoadEject = 0; - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, transferSize, FALSE, &cdb, 6); - - if (NT_SUCCESS(status)) - { - PLAY_ACTIVE(DeviceExtension) = FALSE; - *DataLength = 0; - } - - // nothing to do after the command finishes. - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleGetSetVolume( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_CDROM_GET_VOLUME - IOCTL_CDROM_SET_VOLUME - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - PAGED_CODE (); - - *DataLength = 0; - - if (NT_SUCCESS(status)) - { - ULONG transferSize = MODE_DATA_SIZE; - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.MODE_SENSE10.OperationCode = SCSIOP_MODE_SENSE10; - cdb.MODE_SENSE10.PageCode = CDROM_AUDIO_CONTROL_PAGE; - cdb.MODE_SENSE10.AllocationLength[0] = (UCHAR)(MODE_DATA_SIZE >> 8); - cdb.MODE_SENSE10.AllocationLength[1] = (UCHAR)(MODE_DATA_SIZE & 0xFF); - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, transferSize, TRUE, &cdb, 10); - - if (NT_SUCCESS(status)) - { - if (RequestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_CDROM_GET_VOLUME) - { - PAUDIO_OUTPUT audioOutput; - PVOLUME_CONTROL volumeControl; - ULONG bytesTransferred; - - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - (PVOID*)&volumeControl, - NULL); - if (NT_SUCCESS(status)) - { - audioOutput = ModeSenseFindSpecificPage((PCHAR)DeviceExtension->ScratchContext.ScratchSrb->DataBuffer, - DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength, - CDROM_AUDIO_CONTROL_PAGE, - FALSE); - - // Verify the page is as big as expected. - bytesTransferred = (ULONG)((PCHAR)audioOutput - (PCHAR)DeviceExtension->ScratchContext.ScratchSrb->DataBuffer) + - sizeof(AUDIO_OUTPUT); - - if ((audioOutput != NULL) && - (DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength >= bytesTransferred)) - { - ULONG i; - for (i=0; i<4; i++) - { - volumeControl->PortVolume[i] = audioOutput->PortOutput[i].Volume; - } - - // Set bytes transferred in IRP. - *DataLength = sizeof(VOLUME_CONTROL); - - } - else - { - *DataLength = 0; - status = STATUS_INVALID_DEVICE_REQUEST; - } - } - } - else //IOCTL_CDROM_SET_VOLUME - { - PAUDIO_OUTPUT audioInput = NULL; - PAUDIO_OUTPUT audioOutput = NULL; - PVOLUME_CONTROL volumeControl = NULL; - ULONG i,bytesTransferred,headerLength; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&volumeControl, - NULL); - - if (NT_SUCCESS(status)) - { - audioInput = ModeSenseFindSpecificPage((PCHAR)DeviceExtension->ScratchContext.ScratchSrb->DataBuffer, - DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength, - CDROM_AUDIO_CONTROL_PAGE, - FALSE); - - // Check to make sure the mode sense data is valid before we go on - if(audioInput == NULL) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "Mode Sense Page %d not found\n", - CDROM_AUDIO_CONTROL_PAGE)); - - *DataLength = 0; - status = STATUS_INVALID_DEVICE_REQUEST; - } - } - - if (NT_SUCCESS(status)) - { - // keep items clean; clear the command history - ScratchBuffer_ResetItems(DeviceExtension, TRUE); - - headerLength = sizeof(MODE_PARAMETER_HEADER10); - bytesTransferred = sizeof(AUDIO_OUTPUT) + headerLength; - - // use the scratch buffer as input buffer. - // the content of this buffer will not be changed in the following loop. - audioOutput = (PAUDIO_OUTPUT)((PCHAR)DeviceExtension->ScratchContext.ScratchBuffer + headerLength); - - for (i=0; i<4; i++) - { - audioOutput->PortOutput[i].Volume = volumeControl->PortVolume[i]; - audioOutput->PortOutput[i].ChannelSelection = audioInput->PortOutput[i].ChannelSelection; - } - - audioOutput->CodePage = CDROM_AUDIO_CONTROL_PAGE; - audioOutput->ParameterLength = sizeof(AUDIO_OUTPUT) - 2; - audioOutput->Immediate = MODE_SELECT_IMMEDIATE; - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.MODE_SELECT10.OperationCode = SCSIOP_MODE_SELECT10; - cdb.MODE_SELECT10.ParameterListLength[0] = (UCHAR) (bytesTransferred >> 8); - cdb.MODE_SELECT10.ParameterListLength[1] = (UCHAR) (bytesTransferred & 0xFF); - cdb.MODE_SELECT10.PFBit = 1; - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, bytesTransferred, FALSE, &cdb, 10); - - } - *DataLength = 0; - } - } - - // nothing to do after the command finishes. - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleReadDvdStructure( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_DVD_READ_STRUCTURE - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PVOID inputBuffer = NULL; - PVOID outputBuffer = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &outputBuffer, - NULL); - } - - if (NT_SUCCESS(status)) - { - status = ReadDvdStructure(DeviceExtension, - Request, - inputBuffer, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - outputBuffer, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - DataLength); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -ReadDvdStructure( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ WDFREQUEST OriginalRequest, - _In_ PVOID InputBuffer, - _In_ size_t InputBufferLength, - _In_ PVOID OutputBuffer, - _In_ size_t OutputBufferLength, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - base function to handle request of IOCTL_DVD_START_SESSION - IOCTL_DVD_READ_KEY - -Arguments: - - DeviceExtension - device context - OriginalRequest - original request to be handled - InputBuffer - input buffer - InputBufferLength - length of input buffer - OutputBuffer - output buffer - OutputBufferLength - length of output buffer - -Return Value: - - NTSTATUS - DataLength - returned data length - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PDVD_READ_STRUCTURE request = (PDVD_READ_STRUCTURE)InputBuffer; - PDVD_DESCRIPTOR_HEADER header = (PDVD_DESCRIPTOR_HEADER)OutputBuffer; - CDB cdb; - - USHORT dataLength; - ULONG blockNumber; - PFOUR_BYTE fourByte; - - PAGED_CODE (); - - UNREFERENCED_PARAMETER(InputBufferLength); - - if (DeviceExtension->DeviceAdditionalData.DriveDeviceType != FILE_DEVICE_DVD) - { - *DataLength = 0; - return STATUS_INVALID_DEVICE_REQUEST; - } - - dataLength = (USHORT)OutputBufferLength; - blockNumber = (ULONG)(request->BlockByteOffset.QuadPart >> DeviceExtension->SectorShift); - fourByte = (PFOUR_BYTE)&blockNumber; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.READ_DVD_STRUCTURE.OperationCode = SCSIOP_READ_DVD_STRUCTURE; - cdb.READ_DVD_STRUCTURE.RMDBlockNumber[0] = fourByte->Byte3; - cdb.READ_DVD_STRUCTURE.RMDBlockNumber[1] = fourByte->Byte2; - cdb.READ_DVD_STRUCTURE.RMDBlockNumber[2] = fourByte->Byte1; - cdb.READ_DVD_STRUCTURE.RMDBlockNumber[3] = fourByte->Byte0; - cdb.READ_DVD_STRUCTURE.LayerNumber = request->LayerNumber; - cdb.READ_DVD_STRUCTURE.Format = (UCHAR)request->Format; - -#if DBG - { - if ((UCHAR)request->Format > DvdMaxDescriptor) - { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL, - "READ_DVD_STRUCTURE format %x = %s (%x bytes)\n", - (UCHAR)request->Format, - READ_DVD_STRUCTURE_FORMAT_STRINGS[DvdMaxDescriptor], - dataLength - )); - } - else - { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_IOCTL, - "READ_DVD_STRUCTURE format %x = %s (%x bytes)\n", - (UCHAR)request->Format, - READ_DVD_STRUCTURE_FORMAT_STRINGS[(UCHAR)request->Format], - dataLength - )); - } - } -#endif // DBG - - if (request->Format == DvdDiskKeyDescriptor) - { - cdb.READ_DVD_STRUCTURE.AGID = (UCHAR)request->SessionId; - } - - cdb.READ_DVD_STRUCTURE.AllocationLength[0] = (UCHAR)(dataLength >> 8); - cdb.READ_DVD_STRUCTURE.AllocationLength[1] = (UCHAR)(dataLength & 0xff); - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, OriginalRequest, dataLength, TRUE, &cdb, 12); - - if (NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DvdDCCompletion - READ_STRUCTURE: descriptor format of %d\n", request->Format)); - - RtlMoveMemory(header, - DeviceExtension->ScratchContext.ScratchSrb->DataBuffer, - DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength); - - // Cook the data. There are a number of fields that really - // should be byte-swapped for the caller. - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DvdDCCompletion - READ_STRUCTURE:\n" - "\tHeader at %p\n" - "\tDvdDCCompletion - READ_STRUCTURE: data at %p\n" - "\tDataBuffer was at %p\n" - "\tDataTransferLength was %lx\n", - header, - header->Data, - DeviceExtension->ScratchContext.ScratchSrb->DataBuffer, - DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength)); - - // First the fields in the header - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "READ_STRUCTURE: header->Length %lx -> ", - header->Length)); - - REVERSE_SHORT(&header->Length); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "%lx\n", header->Length)); - - // Now the fields in the descriptor - if(request->Format == DvdPhysicalDescriptor) - { - ULONG tempLength = (DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength > (ULONG)FIELD_OFFSET(DVD_DESCRIPTOR_HEADER, Data)) - ? (DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength - FIELD_OFFSET(DVD_DESCRIPTOR_HEADER, Data)) - : 0; - - PDVD_LAYER_DESCRIPTOR layer = (PDVD_LAYER_DESCRIPTOR)&(header->Data[0]); - - // Make sure the buffer size is good for swapping bytes. - if (tempLength >= RTL_SIZEOF_THROUGH_FIELD(DVD_LAYER_DESCRIPTOR, StartingDataSector)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "READ_STRUCTURE: StartingDataSector %lx -> ", - layer->StartingDataSector)); - REVERSE_LONG(&(layer->StartingDataSector)); - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "%lx\n", layer->StartingDataSector)); - } - if (tempLength >= RTL_SIZEOF_THROUGH_FIELD(DVD_LAYER_DESCRIPTOR, EndDataSector)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "READ_STRUCTURE: EndDataSector %lx -> ", - layer->EndDataSector)); - REVERSE_LONG(&(layer->EndDataSector)); - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "%lx\n", layer->EndDataSector)); - } - if (tempLength >= RTL_SIZEOF_THROUGH_FIELD(DVD_LAYER_DESCRIPTOR, EndLayerZeroSector)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "READ_STRUCTURE: EndLayerZeroSector %lx -> ", - layer->EndLayerZeroSector)); - REVERSE_LONG(&(layer->EndLayerZeroSector)); - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "%lx\n", layer->EndLayerZeroSector)); - } - } - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "Status is %lx\n", status)); - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "DvdDeviceControlCompletion - " - "IOCTL_DVD_READ_STRUCTURE: data transfer length of %d\n", - DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength)); - } - - *DataLength = DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength; - } - - ScratchBuffer_EndUse(DeviceExtension); - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleDvdEndSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_DVD_END_SESSION - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PDVD_SESSION_ID sessionId = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&sessionId, - NULL); - - if (NT_SUCCESS(status)) - { - ULONG transferSize = 0; - CDB cdb; - DVD_SESSION_ID currentSession = 0; - DVD_SESSION_ID limitSession = 0; - - if(*sessionId == DVD_END_ALL_SESSIONS) - { - currentSession = 0; - limitSession = MAX_COPY_PROTECT_AGID - 1; - } - else - { - currentSession = *sessionId; - limitSession = *sessionId; - } - - ScratchBuffer_BeginUse(DeviceExtension); - - do - { - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.SEND_KEY.OperationCode = SCSIOP_SEND_KEY; - cdb.SEND_KEY.AGID = (UCHAR)(currentSession); - cdb.SEND_KEY.KeyFormat = DVD_INVALIDATE_AGID; - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, transferSize, FALSE, &cdb, 12); - - currentSession++; - } while ((currentSession <= limitSession) && NT_SUCCESS(status)); - - // nothing to do after the command finishes. - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleDvdStartSessionReadKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_DVD_START_SESSION - IOCTL_DVD_READ_KEY - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PDVD_COPY_PROTECT_KEY keyParameters = NULL; - PVOID outputBuffer = NULL; - - PAGED_CODE (); - - if (NT_SUCCESS(status)) - { - status = WdfRequestRetrieveOutputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - &outputBuffer, - NULL); - } - - if (NT_SUCCESS(status) && RequestParameters.Parameters.DeviceIoControl.IoControlCode == IOCTL_DVD_READ_KEY) - { - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&keyParameters, - NULL); - } - - if (NT_SUCCESS(status)) - { - status = DvdStartSessionReadKey(DeviceExtension, - RequestParameters.Parameters.DeviceIoControl.IoControlCode, - Request, - keyParameters, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - outputBuffer, - RequestParameters.Parameters.DeviceIoControl.OutputBufferLength, - DataLength); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DvdStartSessionReadKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ ULONG IoControlCode, - _In_opt_ WDFREQUEST OriginalRequest, - _In_opt_ PVOID InputBuffer, - _In_ size_t InputBufferLength, - _In_ PVOID OutputBuffer, - _In_ size_t OutputBufferLength, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - base function to handle request of IOCTL_DVD_START_SESSION - IOCTL_DVD_READ_KEY - -Arguments: - - DeviceExtension - device context - IoControlCode - IOCTL_DVD_READ_KEY or IOCTL_DVD_START_SESSION - OriginalRequest - original request to be handled - InputBuffer - input buffer - InputBufferLength - length of input buffer - OutputBuffer - output buffer - OutputBufferLength - length of output buffer - -Return Value: - - NTSTATUS - DataLength - returned data length - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - ULONG keyLength = 0; - ULONG result = 0; - ULONG allocationLength; - PFOUR_BYTE fourByte; - PDVD_COPY_PROTECT_KEY keyParameters = (PDVD_COPY_PROTECT_KEY)InputBuffer; - - PAGED_CODE (); - - UNREFERENCED_PARAMETER(InputBufferLength); - - *DataLength = 0; - - fourByte = (PFOUR_BYTE)&allocationLength; - - if (IoControlCode == IOCTL_DVD_READ_KEY) - { - if (keyParameters == NULL) - { - status = STATUS_INTERNAL_ERROR; - } - - // First of all, initialize the DVD region of the drive, if it has not been set yet - if (NT_SUCCESS(status) && - (keyParameters->KeyType == DvdGetRpcKey) && - DeviceExtension->DeviceAdditionalData.Mmc.IsCssDvd) - { - DevicePickDvdRegion(DeviceExtension->Device); - } - - if (NT_SUCCESS(status) && - (keyParameters->KeyType == DvdDiskKey)) - { - // Special case - need to use READ DVD STRUCTURE command to get the disk key. - PDVD_COPY_PROTECT_KEY keyHeader = NULL; - PDVD_READ_STRUCTURE readStructureRequest = (PDVD_READ_STRUCTURE)keyParameters; - - // save the key header so we can restore the interesting parts later - keyHeader = ExAllocatePool2(POOL_FLAG_NON_PAGED, - sizeof(DVD_COPY_PROTECT_KEY), - DVD_TAG_READ_KEY); - - if(keyHeader == NULL) - { - // Can't save the context so return an error - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "DvdDeviceControl - READ_KEY: unable to allocate context\n")); - status = STATUS_INSUFFICIENT_RESOURCES; - } - - if (NT_SUCCESS(status)) - { - PREAD_DVD_STRUCTURES_HEADER rawKey = OutputBuffer; - PDVD_COPY_PROTECT_KEY outputKey = OutputBuffer; - - // save input parameters - RtlCopyMemory(keyHeader, - InputBuffer, - sizeof(DVD_COPY_PROTECT_KEY)); - - readStructureRequest->Format = DvdDiskKeyDescriptor; - readStructureRequest->BlockByteOffset.QuadPart = 0; - readStructureRequest->LayerNumber = 0; - readStructureRequest->SessionId = keyHeader->SessionId; - - status = ReadDvdStructure(DeviceExtension, - OriginalRequest, - InputBuffer, - sizeof(DVD_READ_STRUCTURE), - OutputBuffer, - sizeof(READ_DVD_STRUCTURES_HEADER) + sizeof(DVD_DISK_KEY_DESCRIPTOR), - DataLength); - - // fill the output buffer, it's not touched in DeviceHandleReadDvdStructure() - // for this specific request type: DvdDiskKeyDescriptor - if (NT_SUCCESS(status)) - { - // Shift the data down to its new position. - RtlMoveMemory(outputKey->KeyData, - rawKey->Data, - sizeof(DVD_DISK_KEY_DESCRIPTOR)); - - RtlCopyMemory(outputKey, - keyHeader, - sizeof(DVD_COPY_PROTECT_KEY)); - - outputKey->KeyLength = DVD_DISK_KEY_LENGTH; - - *DataLength = DVD_DISK_KEY_LENGTH; - } - else - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, - "StartSessionReadKey Failed with status %x, %xI64 (%x) bytes\n", - status, - (unsigned int)*DataLength, - ((rawKey->Length[0] << 16) | rawKey->Length[1]) )); - } - - FREE_POOL(keyHeader); - } - - // special process finished. return from here. - return status; - } - - if (NT_SUCCESS(status)) - { - status = RtlULongSub((ULONG)OutputBufferLength, - (ULONG)sizeof(DVD_COPY_PROTECT_KEY), &result); - } - - if (NT_SUCCESS(status)) - { - status = RtlULongAdd(result, sizeof(CDVD_KEY_HEADER), &keyLength); - } - - if (NT_SUCCESS(status)) - { - //The data length field of REPORT KEY Command occupies two bytes - keyLength = min(keyLength, MAXUSHORT); - } - } - else //IOCTL_DVD_START_SESSION - { - keyParameters = NULL; - keyLength = sizeof(CDVD_KEY_HEADER) + sizeof(CDVD_REPORT_AGID_DATA); - status = STATUS_SUCCESS; - } - - if (NT_SUCCESS(status)) - { - CDB cdb; - - allocationLength = keyLength; - - // Defensive coding. Prefix cannot recognize this usage. - UNREFERENCED_PARAMETER(allocationLength); - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.REPORT_KEY.OperationCode = SCSIOP_REPORT_KEY; - cdb.REPORT_KEY.AllocationLength[0] = fourByte->Byte1; - cdb.REPORT_KEY.AllocationLength[1] = fourByte->Byte0; - - // set the specific parameters.... - if(IoControlCode == IOCTL_DVD_READ_KEY) - { - if(keyParameters->KeyType == DvdTitleKey) - { - ULONG logicalBlockAddress; - - logicalBlockAddress = (ULONG)(keyParameters->Parameters.TitleOffset.QuadPart >> - DeviceExtension->SectorShift); - - fourByte = (PFOUR_BYTE)&(logicalBlockAddress); - - cdb.REPORT_KEY.LogicalBlockAddress[0] = fourByte->Byte3; - cdb.REPORT_KEY.LogicalBlockAddress[1] = fourByte->Byte2; - cdb.REPORT_KEY.LogicalBlockAddress[2] = fourByte->Byte1; - cdb.REPORT_KEY.LogicalBlockAddress[3] = fourByte->Byte0; - } - - cdb.REPORT_KEY.KeyFormat = (UCHAR)keyParameters->KeyType; - cdb.REPORT_KEY.AGID = (UCHAR)keyParameters->SessionId; - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DvdStartSessionReadKey => sending irp %p (%s)\n", - OriginalRequest, "READ_KEY")); - } - else - { - cdb.REPORT_KEY.KeyFormat = DVD_REPORT_AGID; - cdb.REPORT_KEY.AGID = 0; - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DvdStartSessionReadKey => sending irp %p (%s)\n", - OriginalRequest, "START_SESSION")); - } - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, OriginalRequest, keyLength, TRUE, &cdb, 12); - - if (NT_SUCCESS(status)) - { - if(IoControlCode == IOCTL_DVD_READ_KEY) - { - NTSTATUS tempStatus; - PDVD_COPY_PROTECT_KEY copyProtectKey = (PDVD_COPY_PROTECT_KEY)OutputBuffer; - PCDVD_KEY_HEADER keyHeader = DeviceExtension->ScratchContext.ScratchSrb->DataBuffer; - ULONG dataLength; - ULONG transferLength; - - tempStatus = RtlULongSub(DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength, - FIELD_OFFSET(CDVD_KEY_HEADER, Data), - &transferLength); - - dataLength = (keyHeader->DataLength[0] << 8) + keyHeader->DataLength[1]; - - if (NT_SUCCESS(tempStatus) && (dataLength >= 2)) - { - // Adjust the data length to ignore the two reserved bytes in the - // header. - dataLength -= 2; - - // take the minimum of the transferred length and the - // length as specified in the header. - if(dataLength < transferLength) - { - transferLength = dataLength; - } - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DvdDeviceControlCompletion: [%p] - READ_KEY with " - "transfer length of (%d or %d) bytes\n", - OriginalRequest, - dataLength, - DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength - 2)); - - // Copy the key data into the return buffer - if(copyProtectKey->KeyType == DvdTitleKey) - { - RtlMoveMemory(copyProtectKey->KeyData, - keyHeader->Data + 1, - transferLength - 1); - - copyProtectKey->KeyData[transferLength - 1] = 0; - - // If this is a title key then we need to copy the CGMS flags - // as well. - copyProtectKey->KeyFlags = *(keyHeader->Data); - - } - else - { - RtlMoveMemory(copyProtectKey->KeyData, - keyHeader->Data, - transferLength); - } - - copyProtectKey->KeyLength = sizeof(DVD_COPY_PROTECT_KEY); - copyProtectKey->KeyLength += transferLength; - - *DataLength = copyProtectKey->KeyLength; - } - else - { - //There is no valid data from drive. - //This may happen when Key Format = 0x3f that does not require data back from drive. - status = STATUS_SUCCESS; - *DataLength = 0; - } - } - else - { - PDVD_SESSION_ID sessionId = (PDVD_SESSION_ID)OutputBuffer; - PCDVD_KEY_HEADER keyHeader = DeviceExtension->ScratchContext.ScratchSrb->DataBuffer; - PCDVD_REPORT_AGID_DATA keyData = (PCDVD_REPORT_AGID_DATA)keyHeader->Data; - - *sessionId = keyData->AGID; - - *DataLength = sizeof(DVD_SESSION_ID); - } - } - - // nothing to do after the command finishes. - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleDvdSendKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_DVD_SEND_KEY - IOCTL_DVD_SEND_KEY2 - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PVOID inputBuffer = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - &inputBuffer, - NULL); - - if (NT_SUCCESS(status)) - { - status = DvdSendKey(DeviceExtension, - Request, - inputBuffer, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - DataLength); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DvdSendKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ WDFREQUEST OriginalRequest, - _In_ PVOID InputBuffer, - _In_ size_t InputBufferLength, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - base function to handle request of IOCTL_DVD_SEND_KEY(2) - NOTE: cdrom does not process this IOCTL if the input buffer length is bigger than Port transfer length. - -Arguments: - - DeviceExtension - device context - OriginalRequest - original request to be handled - InputBuffer - input buffer - InputBufferLength - length of input buffer - -Return Value: - - NTSTATUS - DataLength - returned data length - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY)InputBuffer; - - ULONG keyLength = 0; - ULONG result = 0; - PFOUR_BYTE fourByte; - - PAGED_CODE (); - - UNREFERENCED_PARAMETER(InputBufferLength); - - *DataLength = 0; - - if (NT_SUCCESS(status)) - { - if ((key->KeyLength < sizeof(DVD_COPY_PROTECT_KEY)) || - ((key->KeyLength - sizeof(DVD_COPY_PROTECT_KEY)) > DeviceExtension->ScratchContext.ScratchBufferSize)) - { - NT_ASSERT(FALSE); - status = STATUS_INTERNAL_ERROR; - } - } - - if (NT_SUCCESS(status)) - { - status = RtlULongSub(key->KeyLength, sizeof(DVD_COPY_PROTECT_KEY), &result); - } - - if (NT_SUCCESS(status)) - { - status = RtlULongAdd(result, sizeof(CDVD_KEY_HEADER), &keyLength); - } - - if (NT_SUCCESS(status)) - { - keyLength = min(keyLength, DeviceExtension->ScratchContext.ScratchBufferSize); - - if (keyLength < 2) - { - status = STATUS_INVALID_PARAMETER; - } - } - - if (NT_SUCCESS(status)) - { - PCDVD_KEY_HEADER keyBuffer = NULL; - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - // prepare the input buffer - keyBuffer = (PCDVD_KEY_HEADER)DeviceExtension->ScratchContext.ScratchBuffer; - - // keylength is decremented here by two because the - // datalength does not include the header, which is two - // bytes. keylength is immediately incremented later - // by the same amount. - keyLength -= 2; - fourByte = (PFOUR_BYTE)&keyLength; - keyBuffer->DataLength[0] = fourByte->Byte1; - keyBuffer->DataLength[1] = fourByte->Byte0; - keyLength += 2; - - RtlMoveMemory(keyBuffer->Data, - key->KeyData, - key->KeyLength - sizeof(DVD_COPY_PROTECT_KEY)); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.REPORT_KEY.OperationCode = SCSIOP_SEND_KEY; - - cdb.SEND_KEY.ParameterListLength[0] = fourByte->Byte1; - cdb.SEND_KEY.ParameterListLength[1] = fourByte->Byte0; - cdb.SEND_KEY.KeyFormat = (UCHAR)key->KeyType; - cdb.SEND_KEY.AGID = (UCHAR)key->SessionId; - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, OriginalRequest, keyLength, FALSE, &cdb, 12); - - // nothing to do after the command finishes. - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleSetReadAhead( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_STORAGE_SET_READ_AHEAD - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PSTORAGE_SET_READ_AHEAD readAhead = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&readAhead, - NULL); - - if (NT_SUCCESS(status)) - { - ULONG transferSize = 0; - CDB cdb; - ULONG blockAddress; - PFOUR_BYTE fourByte = (PFOUR_BYTE)&blockAddress; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.SET_READ_AHEAD.OperationCode = SCSIOP_SET_READ_AHEAD; - - blockAddress = (ULONG)(readAhead->TriggerAddress.QuadPart >> - DeviceExtension->SectorShift); - - // Defensive coding. Prefix cannot recognize this usage. - UNREFERENCED_PARAMETER(blockAddress); - - cdb.SET_READ_AHEAD.TriggerLBA[0] = fourByte->Byte3; - cdb.SET_READ_AHEAD.TriggerLBA[1] = fourByte->Byte2; - cdb.SET_READ_AHEAD.TriggerLBA[2] = fourByte->Byte1; - cdb.SET_READ_AHEAD.TriggerLBA[3] = fourByte->Byte0; - - blockAddress = (ULONG)(readAhead->TargetAddress.QuadPart >> - DeviceExtension->SectorShift); - - cdb.SET_READ_AHEAD.ReadAheadLBA[0] = fourByte->Byte3; - cdb.SET_READ_AHEAD.ReadAheadLBA[1] = fourByte->Byte2; - cdb.SET_READ_AHEAD.ReadAheadLBA[2] = fourByte->Byte1; - cdb.SET_READ_AHEAD.ReadAheadLBA[3] = fourByte->Byte0; - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, transferSize, FALSE, &cdb, 12); - - if (NT_SUCCESS(status)) - { - *DataLength = 0; - } - - // nothing to do after the command finishes. - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleSetSpeed( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ) -/*++ - -Routine Description: - - Handle request of IOCTL_CDROM_SET_SPEED - -Arguments: - - DeviceExtension - device context - Request - request to be handled - RequestParameters - request parameter - DataLength - transferred data length - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DATA cdData = &(DeviceExtension->DeviceAdditionalData); - PCDROM_SET_SPEED inputBuffer = NULL; - - PAGED_CODE (); - - *DataLength = 0; - - status = WdfRequestRetrieveInputBuffer(Request, - RequestParameters.Parameters.DeviceIoControl.InputBufferLength, - (PVOID*)&inputBuffer, - NULL); - - if (NT_SUCCESS(status)) - { - ULONG transferSize = 0; - CDB cdb; - CDROM_SPEED_REQUEST requestType = inputBuffer->RequestType; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - if (requestType == CdromSetSpeed) - { - PCDROM_SET_SPEED speed = inputBuffer; - - cdb.SET_CD_SPEED.OperationCode = SCSIOP_SET_CD_SPEED; - cdb.SET_CD_SPEED.RotationControl = speed->RotationControl; - REVERSE_BYTES_SHORT(&cdb.SET_CD_SPEED.ReadSpeed, &speed->ReadSpeed); - REVERSE_BYTES_SHORT(&cdb.SET_CD_SPEED.WriteSpeed, &speed->WriteSpeed); - } - else - { - PCDROM_SET_STREAMING stream = (PCDROM_SET_STREAMING)inputBuffer; - PPERFORMANCE_DESCRIPTOR perfDescriptor; - - transferSize = sizeof(PERFORMANCE_DESCRIPTOR); - - perfDescriptor = DeviceExtension->ScratchContext.ScratchBuffer; - RtlZeroMemory(perfDescriptor, transferSize); - - perfDescriptor->RandomAccess = stream->RandomAccess; - perfDescriptor->Exact = stream->SetExact; - perfDescriptor->RestoreDefaults = stream->RestoreDefaults; - perfDescriptor->WriteRotationControl = stream->RotationControl; - - REVERSE_BYTES(&perfDescriptor->StartLba, &stream->StartLba); - REVERSE_BYTES(&perfDescriptor->EndLba, &stream->EndLba); - REVERSE_BYTES(&perfDescriptor->ReadSize, &stream->ReadSize); - REVERSE_BYTES(&perfDescriptor->ReadTime, &stream->ReadTime); - REVERSE_BYTES(&perfDescriptor->WriteSize, &stream->WriteSize); - REVERSE_BYTES(&perfDescriptor->WriteTime, &stream->WriteTime); - - cdb.SET_STREAMING.OperationCode = SCSIOP_SET_STREAMING; - REVERSE_BYTES_SHORT(&cdb.SET_STREAMING.ParameterListLength, &transferSize); - - // set value in extension by user inputs. - cdData->RestoreDefaults = stream->Persistent ? FALSE : TRUE; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "DeviceHandleSetSpeed: Restore default speed on media change set to %s\n", - cdData->RestoreDefaults ? "true" : "false")); - } - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, Request, transferSize, FALSE, &cdb, 12); - - if (NT_SUCCESS(status)) - { - *DataLength = 0; - } - - // nothing to do after the command finishes. - ScratchBuffer_EndUse(DeviceExtension); - } - - return status; -} - - diff --git a/storage/class/cdrom/src/ioctl.h b/storage/class/cdrom/src/ioctl.h deleted file mode 100644 index 951561a9..00000000 --- a/storage/class/cdrom/src/ioctl.h +++ /dev/null @@ -1,847 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - ioctl.h - -Abstract: - - Functions to handle IOCTLs. - -Author: - -Environment: - - kernel mode only - -Notes: - - -Revision History: - ---*/ - -#ifndef __IOCTL_H__ -#define __IOCTL_H__ - -BOOLEAN -RequestDispatchProcessDirectly( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters - ); - -BOOLEAN -RequestDispatchToSequentialQueue( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters - ); - -BOOLEAN -RequestDispatchSyncWithSequentialQueue( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters - ); - -BOOLEAN -RequestDispatchSpecialIoctls( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters - ); - -BOOLEAN -RequestDispatchUnknownRequests( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters - ); - -// -// I/O Request Handlers -// - -// Handlers that are called directly in dispatch routine. - -NTSTATUS -RequestHandleGetInquiryData( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestHandleGetMediaTypeEx( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestHandleMountQueryUniqueId( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestHandleMountQueryDeviceName( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestHandleMountQuerySuggestedLinkName( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestHandleGetDeviceNumber( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestHandleGetHotPlugInfo( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestHandleSetHotPlugInfo( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleEventNotification( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ WDFREQUEST Request, - _In_opt_ PWDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -// Handlers that are called in RequestProcessSerializedIoctl in a work item. - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleGetDvdRegion( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestHandleQueryPropertyRetrieveCachedData( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleReadTOC( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleReadTocEx( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleGetConfiguration( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -RequestHandleGetDriveGeometry( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleDiskVerify( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleCheckVerify( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleFakePartitionInfo( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -RequestHandleEjectionControl( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -RequestHandleLoadEjectMedia( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleMcnControl( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -RequestHandleReserveRelease( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -RequestHandlePersistentReserve( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -#if (NTDDI_VERSION >= NTDDI_WIN8) -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleAreVolumesReady( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleVolumeOnline( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); -#endif - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceHandleRawRead( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandlePlayAudioMsf( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleReadQChannel( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandlePauseAudio( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleResumeAudio( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleSeekAudioMsf( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleStopAudio( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleGetSetVolume( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleReadDvdStructure( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleDvdEndSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleDvdStartSessionReadKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleDvdSendKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleSetReadAhead( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleSetSpeed( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsReadMediaKeyBlock( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsStartSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsEndSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsSendCertificate( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsGetCertificate( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsGetChallengeKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleSendChallengeKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleReadVolumeId( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsReadSerialNumber( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsReadMediaId( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsReadBindingNonce( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -DeviceHandleAacsGenerateBindingNonce( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleEnableStreaming( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleSendOpcInformation( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleGetPerformance( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleMcnSyncFakeIoctl( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Out_ size_t * DataLength - ); - -// Handlers that will be called by Sync process. - -// RequestHandleUnknownIoctl could be called at DISPATCH_LEVEL. -NTSTATUS -RequestHandleUnknownIoctl( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleExclusiveAccessQueryLockState( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleExclusiveAccessLockDevice( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleExclusiveAccessUnlockDevice( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ); - -NTSTATUS -RequestHandleQueryPropertyDeviceUniqueId( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ); - -NTSTATUS -RequestHandleQueryPropertyWriteCache( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -RequestHandleScsiPassThrough( - _In_ WDFDEVICE Device, - _In_ WDFREQUEST Request - ); - -// Read/write handler called possibly at DISPATCH_LEVEL. - -NTSTATUS -RequestHandleReadWrite( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters - ); - -// -// I/O Request Validation helpers -// - -NTSTATUS -RequestValidateRawRead( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateReadTocEx( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateReadToc( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateGetLastSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateReadQChannel( - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateDvdReadStructure( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateDvdStartSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateDvdSendKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateDvdReadKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateGetConfiguration( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateSetSpeed( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateAacsReadMediaKeyBlock( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateAacsStartSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateAacsSendCertificate( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateAacsGetCertificate( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateAacsGetChallengeKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateAacsSendChallengeKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateAacsReadVolumeId( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateAacsReadSerialNumber( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateAacsReadMediaId( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateAacsBindingNonce( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateExclusiveAccess( - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateEnableStreaming( - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateSendOpcInformation( - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateGetPerformance( - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -BOOLEAN -RequestIsRealtimeStreaming( - _In_ WDFREQUEST Request, - _In_ BOOLEAN IsReadRequest - ); - -NTSTATUS -RequestValidateReadWrite( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters - ); - -NTSTATUS -RequestValidatePersistentReserve( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateDvdEndSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - -NTSTATUS -RequestValidateAacsEndSession( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ WDF_REQUEST_PARAMETERS RequestParameters, - _Out_ size_t * DataLength - ); - - -// -// completion routines -// - - - - -#endif // __IOCTL_H__ diff --git a/storage/class/cdrom/src/localwpp.ini b/storage/class/cdrom/src/localwpp.ini deleted file mode 100644 index 0e793609..00000000 --- a/storage/class/cdrom/src/localwpp.ini +++ /dev/null @@ -1,17 +0,0 @@ - -// this defines how to log a len/buffer pair. -// This function should be in trace.h -DEFINE_CPLX_TYPE(HEXDUMP, WPP_LOGHEXDUMP, xstr_t, ItemHEXDump,"s", _HEX_, 0,2); - -// DEFINE_CPLX_TYPE( -// name, // i.e. HEXDUMP // %!HEXDUMP! -// macro, // i.e. WPP_LOGHEXDUMP // Marshalling macro, defined in trace.h -// structure, // i.e. xstr_t // Argument type (structure to be created by above macro) -// item type, // i.e. ItemHEXDump // MOF type that TracePrt can understand -// format specifier, // i.e. "s" // a format specifier that TracePrt can understand -// ???? // i.e. _HEX_ // Type signature (becomes a part of function name) -// ???? // i.e. 0 // Weight (0 is variable data length) -// ???? // i.e. 2 // Slots used by this entry (optional, 1 default) -// ) - - diff --git a/storage/class/cdrom/src/mmc.c b/storage/class/cdrom/src/mmc.c deleted file mode 100644 index 5f96726c..00000000 --- a/storage/class/cdrom/src/mmc.c +++ /dev/null @@ -1,1629 +0,0 @@ -/*-- - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - mmc.c - -Abstract: - - Include all funtions relate to MMC - -Environment: - - kernel mode only - -Notes: - - -Revision History: - ---*/ - -#include "stddef.h" -#include "string.h" - -#include "ntddk.h" -#include "ntddstor.h" -#include "cdrom.h" -#include "mmc.h" -#include "scratch.h" - -#ifdef DEBUG_USE_WPP -#include "mmc.tmh" -#endif - -#ifdef ALLOC_PRAGMA - -#pragma alloc_text(PAGE, DeviceDeallocateMmcResources) -#pragma alloc_text(PAGE, DeviceAllocateMmcResources) -#pragma alloc_text(PAGE, DeviceUpdateMmcCapabilities) -#pragma alloc_text(PAGE, DeviceGetConfigurationWithAlloc) -#pragma alloc_text(PAGE, DeviceGetConfiguration) -#pragma alloc_text(PAGE, DeviceUpdateMmcWriteCapability) -#pragma alloc_text(PAGE, MmcDataFindFeaturePage) -#pragma alloc_text(PAGE, MmcDataFindProfileInProfiles) -#pragma alloc_text(PAGE, DeviceRetryTimeGuessBasedOnProfile) -#pragma alloc_text(PAGE, DeviceRetryTimeDetectionBasedOnModePage2A) -#pragma alloc_text(PAGE, DeviceRetryTimeDetectionBasedOnGetPerformance) - -#endif - -#pragma warning(push) -#pragma warning(disable:4214) // nonstandard extension used : bit field types other than int - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceDeallocateMmcResources( - _In_ WDFDEVICE Device - ) -/*++ - -Routine Description: - - release MMC resources - -Arguments: - - Device - device object - -Return Value: - - none - ---*/ -{ - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PCDROM_DATA cddata = &(deviceExtension->DeviceAdditionalData); - PCDROM_MMC_EXTENSION mmcData = &cddata->Mmc; - - PAGED_CODE(); - - if (mmcData->CapabilitiesIrp) - { - IoFreeIrp(mmcData->CapabilitiesIrp); - mmcData->CapabilitiesIrp = NULL; - } - if (mmcData->CapabilitiesMdl) - { - IoFreeMdl(mmcData->CapabilitiesMdl); - mmcData->CapabilitiesMdl = NULL; - } - if (mmcData->CapabilitiesBuffer) - { - ExFreePool(mmcData->CapabilitiesBuffer); - mmcData->CapabilitiesBuffer = NULL; - } - if (mmcData->CapabilitiesRequest) - { - WdfObjectDelete(mmcData->CapabilitiesRequest); - mmcData->CapabilitiesRequest = NULL; - } - mmcData->CapabilitiesBufferSize = 0; - mmcData->IsMmc = FALSE; - mmcData->WriteAllowed = FALSE; - - return; -} - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceAllocateMmcResources( - _In_ WDFDEVICE Device - ) -/*++ - -Routine Description: - - allocate all MMC resources needed - -Arguments: - - Device - device object - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PCDROM_DATA cddata = &(deviceExtension->DeviceAdditionalData); - PCDROM_MMC_EXTENSION mmcData = &(cddata->Mmc); - WDF_OBJECT_ATTRIBUTES attributes = {0}; - - PAGED_CODE(); - - NT_ASSERT(mmcData->CapabilitiesBuffer == NULL); - NT_ASSERT(mmcData->CapabilitiesBufferSize == 0); - - // allocate the buffer and set the buffer size. - // retrieve drive configuration information. - status = DeviceGetConfigurationWithAlloc(Device, - &mmcData->CapabilitiesBuffer, - &mmcData->CapabilitiesBufferSize, - FeatureProfileList, - SCSI_GET_CONFIGURATION_REQUEST_TYPE_ALL); - if (!NT_SUCCESS(status)) - { - NT_ASSERT(mmcData->CapabilitiesBuffer == NULL); - NT_ASSERT(mmcData->CapabilitiesBufferSize == 0); - return status; - } - - NT_ASSERT(mmcData->CapabilitiesBuffer != NULL); - NT_ASSERT(mmcData->CapabilitiesBufferSize != 0); - - // Create an MDL over the new Buffer (allocated by DeviceGetConfiguration) - mmcData->CapabilitiesMdl = IoAllocateMdl(mmcData->CapabilitiesBuffer, - mmcData->CapabilitiesBufferSize, - FALSE, FALSE, NULL); - if (mmcData->CapabilitiesMdl == NULL) - { - ExFreePool(mmcData->CapabilitiesBuffer); - mmcData->CapabilitiesBuffer = NULL; - mmcData->CapabilitiesBufferSize = 0; - return STATUS_INSUFFICIENT_RESOURCES; - } - - // Create an IRP from which we will create a WDFREQUEST - mmcData->CapabilitiesIrp = IoAllocateIrp(deviceExtension->DeviceObject->StackSize + 1, FALSE); - if (mmcData->CapabilitiesIrp == NULL) - { - IoFreeMdl(mmcData->CapabilitiesMdl); - mmcData->CapabilitiesMdl = NULL; - ExFreePool(mmcData->CapabilitiesBuffer); - mmcData->CapabilitiesBuffer = NULL; - mmcData->CapabilitiesBufferSize = 0; - return STATUS_INSUFFICIENT_RESOURCES; - } - - // create WDF request object - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, - CDROM_REQUEST_CONTEXT); - status = WdfRequestCreateFromIrp(&attributes, - mmcData->CapabilitiesIrp, - FALSE, - &mmcData->CapabilitiesRequest); - if (!NT_SUCCESS(status)) - { - return status; - } - - return STATUS_SUCCESS; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceUpdateMmcCapabilities( - _In_ WDFDEVICE Device - ) -/*++ - -Routine Description: - - issue get congiguration command ans save result in device extension - -Arguments: - - Device - device object - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PCDROM_DATA cdData = &(deviceExtension->DeviceAdditionalData); - PCDROM_MMC_EXTENSION mmcData = &(cdData->Mmc); - ULONG returnedBytes = 0; - LONG updateState; - - PAGED_CODE(); - - // first of all, check if we're still in the CdromMmcUpdateRequired state - // and, if yes, change it to CdromMmcUpdateStarted. - updateState = InterlockedCompareExchange((PLONG)&(cdData->Mmc.UpdateState), - CdromMmcUpdateStarted, - CdromMmcUpdateRequired); - if (updateState != CdromMmcUpdateRequired) { - // Mmc capabilities have been already updated or are in the process of - // being updated - just return STATUS_SUCCESS - return STATUS_SUCCESS; - } - - // default to read-only, no Streaming, non-blank - mmcData->WriteAllowed = FALSE; - mmcData->StreamingReadSupported = FALSE; - mmcData->StreamingWriteSupported = FALSE; - - // Issue command to update the drive capabilities. - // The failure of MMC update is not considered critical, - // so that we'll continue to process I/O even MMC update fails. - status = DeviceGetConfiguration(Device, - mmcData->CapabilitiesBuffer, - mmcData->CapabilitiesBufferSize, - &returnedBytes, - FeatureProfileList, - SCSI_GET_CONFIGURATION_REQUEST_TYPE_CURRENT); - - if (NT_SUCCESS(status) && // succeeded. - (mmcData->CapabilitiesBufferSize >= returnedBytes)) // not overflow. - { - // update whether or not writes are allowed - // this should be the *ONLY* place writes are set to allowed - { - BOOLEAN writeAllowed = FALSE; - FEATURE_NUMBER validationSchema = 0; - ULONG blockingFactor = 1; - - DeviceUpdateMmcWriteCapability(mmcData->CapabilitiesBuffer, - returnedBytes, - TRUE, - &writeAllowed, - &validationSchema, - &blockingFactor); - - mmcData->WriteAllowed = writeAllowed; - mmcData->ValidationSchema = validationSchema; - mmcData->Blocking = blockingFactor; - } - - // Check if Streaming reads/writes are supported and cache - // this information for later use. - { - PFEATURE_HEADER header; - ULONG minAdditionalLength; - - minAdditionalLength = FIELD_OFFSET(FEATURE_DATA_REAL_TIME_STREAMING, Reserved2) - - sizeof(FEATURE_HEADER); - - header = MmcDataFindFeaturePage(mmcData->CapabilitiesBuffer, - returnedBytes, - FeatureRealTimeStreaming); - - if ((header != NULL) && - (header->Current) && - (header->AdditionalLength >= minAdditionalLength)) - { - PFEATURE_DATA_REAL_TIME_STREAMING feature = (PFEATURE_DATA_REAL_TIME_STREAMING)header; - - // If Real-Time feature is current, then Streaming reads are supported for sure. - mmcData->StreamingReadSupported = TRUE; - - // Streaming writes are supported if an appropriate bit is set in the feature page. - mmcData->StreamingWriteSupported = (feature->StreamRecording == 1); - } - } - - // update the flag to reflect that if the media is CSS protected DVD or CPPM-protected DVDAudio - { - PFEATURE_HEADER header; - - header = DeviceFindFeaturePage(mmcData->CapabilitiesBuffer, - returnedBytes, - FeatureDvdCSS); - - mmcData->IsCssDvd = (header != NULL) && (header->Current); - } - - // Update the guesstimate for the drive's write speed - // Use the GetConfig profile first as a quick-guess based - // on media "type", then continue with media-specific - // queries for older media types, and use GET_PERFORMANCE - // for all unknown/future media types. - { - // pseudo-code: - // 1) Determine default based on profile (slowest for media) - // 2) Determine default based on MODE PAGE 2Ah - // 3) Determine default based on GET PERFORMANCE data - // 4) Choose fastest reported speed (-1 == none reported) - // 5) If all failed (returned -1), go with very safe (slow) default - // - // This ensures that the retries do not overload the drive's processor. - // Sending at highest possible speed for the media is OK, because the - // major downside is drive processor usage. (bus usage too, but most - // storage is becoming a point-to-point link.) - - FEATURE_PROFILE_TYPE const profile = - mmcData->CapabilitiesBuffer->CurrentProfile[0] << (8*1) | - mmcData->CapabilitiesBuffer->CurrentProfile[1] << (8*0) ; - LONGLONG t1 = (LONGLONG)-1; - LONGLONG t2 = (LONGLONG)-1; - LONGLONG t3 = (LONGLONG)-1; - LONGLONG t4 = (LONGLONG)-1; - LONGLONG final; - - t1 = DeviceRetryTimeGuessBasedOnProfile(profile); - t2 = DeviceRetryTimeDetectionBasedOnModePage2A(deviceExtension); - t3 = DeviceRetryTimeDetectionBasedOnGetPerformance(deviceExtension, TRUE); - t4 = DeviceRetryTimeDetectionBasedOnGetPerformance(deviceExtension, FALSE); - - // use the "fastest" value returned - final = MAXLONGLONG; - if (t4 != -1) - { - final = min(final, t4); - } - if (t3 != -1) - { - final = min(final, t3); - } - if (t2 != -1) - { - final = min(final, t2); - } - if (t1 != -1) - { - final = min(final, t1); - } - if (final == MAXLONGLONG) - { - // worst case -- use relatively slow default.... - final = WRITE_RETRY_DELAY_CD_4x; - } - - cdData->ReadWriteRetryDelay100nsUnits = final; - } - - } - else - { - // Rediscovery of MMC capabilities has failed - we'll need to retry - cdData->Mmc.UpdateState = CdromMmcUpdateRequired; - } - - // Change the state to CdromMmcUpdateComplete if it is CdromMmcUpdateStarted. - // If it is not, some error must have happened while this function was executed - // and the state is CdromMmcUpdateRequired now. In that case, we want to perform - // everything again, so we do not set CdromMmcUpdateComplete. - InterlockedCompareExchange((PLONG)&(cdData->Mmc.UpdateState), - CdromMmcUpdateComplete, - CdromMmcUpdateStarted); - - return status; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceGetConfigurationWithAlloc( - _In_ WDFDEVICE Device, - _Outptr_result_bytebuffer_all_(*BytesReturned) - PGET_CONFIGURATION_HEADER* Buffer, // this routine allocates this memory - _Out_ PULONG BytesReturned, - FEATURE_NUMBER const StartingFeature, - ULONG const RequestedType - ) -/*++ - -Routine Description: - - This function will allocates configuration buffer and set the size. - -Arguments: - - Device - device object - Buffer - to be allocated by this function - BytesReturned - size of the buffer - StartingFeature - the starting point of the feature list - RequestedType - - -Return Value: - - NTSTATUS - -NOTE: does not handle case where more than 65000 bytes are returned, - which requires multiple calls with different starting feature - numbers. - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - GET_CONFIGURATION_HEADER header = {0}; // eight bytes, not a lot - PGET_CONFIGURATION_HEADER buffer = NULL; - ULONG returned = 0; - ULONG size = 0; - ULONG i = 0; - - PAGED_CODE(); - - *Buffer = NULL; - *BytesReturned = 0; - - // send the first request down to just get the header - status = DeviceGetConfiguration(Device, - &header, - sizeof(header), - &returned, - StartingFeature, - RequestedType); - - // now send command again, using information returned to allocate just enough memory - if (NT_SUCCESS(status)) - { - size = header.DataLength[0] << 24 | - header.DataLength[1] << 16 | - header.DataLength[2] << 8 | - header.DataLength[3] << 0 ; - - // the loop is in case that the retrieved data length is bigger than last time reported. - for (i = 0; (i < 4) && NT_SUCCESS(status); i++) - { - // the datalength field is the size *following* itself, so adjust accordingly - size += 4*sizeof(UCHAR); - - // make sure the size is reasonable - if (size <= sizeof(FEATURE_HEADER)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "DeviceGetConfigurationWithAlloc: drive reports only %x bytes?\n", - size)); - status = STATUS_UNSUCCESSFUL; - } - - if (NT_SUCCESS(status)) - { - // allocate the memory - buffer = (PGET_CONFIGURATION_HEADER)ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED, - size, - CDROM_TAG_FEATURE); - - if (buffer == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - } - - if (NT_SUCCESS(status)) - { - // send the first request down to just get the header - status = DeviceGetConfiguration(Device, - buffer, - size, - &returned, - StartingFeature, - RequestedType); - - if (!NT_SUCCESS(status)) - { - ExFreePool(buffer); - } - else if (returned > size) - { - ExFreePool(buffer); - status = STATUS_INTERNAL_ERROR; - } - } - - // command succeeded. - if (NT_SUCCESS(status)) - { - returned = buffer->DataLength[0] << 24 | - buffer->DataLength[1] << 16 | - buffer->DataLength[2] << 8 | - buffer->DataLength[3] << 0 ; - returned += 4*sizeof(UCHAR); - - if (returned <= size) - { - *Buffer = buffer; - *BytesReturned = returned; // amount of 'safe' memory - // succes, get out of loop. - status = STATUS_SUCCESS; - break; - } - else - { - // the data size is bigger than the buffer size, retry using new size.... - size = returned; - ExFreePool(buffer); - buffer = NULL; - } - } - } // end of for() loop - } - - if (!NT_SUCCESS(status)) - { - // it failed after a number of attempts, so just fail. - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "DeviceGetConfigurationWithAlloc: Failed %d attempts to get all feature " - "information\n", i)); - } - - return status; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceGetConfiguration( - _In_ WDFDEVICE Device, - _Out_writes_bytes_to_(BufferSize, *ValidBytes) - PGET_CONFIGURATION_HEADER Buffer, - _In_ ULONG const BufferSize, - _Out_ PULONG ValidBytes, - _In_ FEATURE_NUMBER const StartingFeature, - _In_ ULONG const RequestedType - ) -/*++ - -Routine Description: - - This function is used to get configuration data. - -Arguments: - - Device - device object - Buffer - buffer address to hold data. - BufferSize - size of the buffer - ValidBytes - valid data size in buffer - StartingFeature - the starting point of the feature list - RequestedType - - -Return Value: - - NTSTATUS - -NOTE: does not handle case where more than 64k bytes are returned, - which requires multiple calls with different starting feature - numbers. - ---*/ -{ - NTSTATUS status; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - SCSI_REQUEST_BLOCK srb; - PCDB cdb = (PCDB)srb.Cdb; - - PAGED_CODE(); - - NT_ASSERT(ValidBytes); - - // when system is low resources we can receive empty buffer - if (Buffer == NULL || BufferSize < sizeof(GET_CONFIGURATION_HEADER)) - { - return STATUS_BUFFER_TOO_SMALL; - } - - *ValidBytes = 0; - - RtlZeroMemory(&srb, sizeof(SCSI_REQUEST_BLOCK)); - RtlZeroMemory(Buffer, BufferSize); - - if (TEST_FLAG(deviceExtension->DeviceAdditionalData.HackFlags, CDROM_HACK_BAD_GET_CONFIG_SUPPORT)) - { - return STATUS_INVALID_DEVICE_REQUEST; - } - -#pragma warning(push) -#pragma warning(disable: 6386) // OACR will complain buffer overrun: the writable size is 'BufferSize' bytes, but '65532' - // bytes might be written, which is impossible because BufferSize > 0xFFFC. - - if (BufferSize > 0xFFFC) - { - // cannot request more than 0xFFFC bytes in one request - // Eventually will "stitch" together multiple requests if needed - // Today, no drive has anywhere close to 4k..... - return DeviceGetConfiguration(Device, - Buffer, - 0xFFFC, - ValidBytes, - StartingFeature, - RequestedType); - } -#pragma warning(pop) - - //Start real work - srb.TimeOutValue = CDROM_GET_CONFIGURATION_TIMEOUT; - srb.CdbLength = 10; - - cdb->GET_CONFIGURATION.OperationCode = SCSIOP_GET_CONFIGURATION; - cdb->GET_CONFIGURATION.RequestType = (UCHAR)RequestedType; - cdb->GET_CONFIGURATION.StartingFeature[0] = (UCHAR)(StartingFeature >> 8); - cdb->GET_CONFIGURATION.StartingFeature[1] = (UCHAR)(StartingFeature & 0xff); - cdb->GET_CONFIGURATION.AllocationLength[0] = (UCHAR)(BufferSize >> 8); - cdb->GET_CONFIGURATION.AllocationLength[1] = (UCHAR)(BufferSize & 0xff); - - status = DeviceSendSrbSynchronously(Device, - &srb, - Buffer, - BufferSize, - FALSE, - NULL); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, - "DeviceGetConfiguration: Status was %x\n", status)); - - if (NT_SUCCESS(status) || - (status == STATUS_BUFFER_OVERFLOW) || - (status == STATUS_DATA_OVERRUN)) - { - ULONG returned = srb.DataTransferLength; - PGET_CONFIGURATION_HEADER header = (PGET_CONFIGURATION_HEADER)Buffer; - ULONG available = (header->DataLength[0] << (8*3)) | - (header->DataLength[1] << (8*2)) | - (header->DataLength[2] << (8*1)) | - (header->DataLength[3] << (8*0)) ; - - available += RTL_SIZEOF_THROUGH_FIELD(GET_CONFIGURATION_HEADER, DataLength); - - _Analysis_assume_(srb.DataTransferLength <= BufferSize); - - // The true usable amount of data returned is the lesser of - // * the returned data per the srb.DataTransferLength field - // * the total size per the GET_CONFIGURATION_HEADER - // This is because ATAPI can't tell how many bytes really - // were transferred on success when using DMA. - if (available < returned) - { - returned = available; - } - - NT_ASSERT(returned <= BufferSize); - *ValidBytes = (ULONG)returned; - - //This is succeed case - status = STATUS_SUCCESS; - } - else - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, - "DeviceGetConfiguration: failed %x\n", status)); - } - - return status; -} - - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceUpdateMmcWriteCapability( - _In_reads_bytes_(BufferSize) - PGET_CONFIGURATION_HEADER Buffer, - ULONG const BufferSize, - BOOLEAN const CurrentOnly, // TRUE == can drive write now, FALSE == can drive ever write - _Out_ PBOOLEAN Writable, - _Out_ PFEATURE_NUMBER ValidationSchema, - _Out_ PULONG BlockingFactor - ) -/*++ - -Routine Description: - - This function will allocates configuration buffer and set the size. - -Arguments: - - Buffer - - BufferSize - size of the buffer - CurrentOnly - valid data size in buffer - Writable - the buffer is allocationed in non-paged pool. - validationSchema - the starting point of the feature list - BlockingFactor - - -Return Value: - - NTSTATUS - -NOTE: does not handle case where more than 64k bytes are returned, - which requires multiple calls with different starting feature - numbers. - ---*/ -{ - // - // this routine is used to check if the drive can currently (current==TRUE) - // or can ever (current==FALSE) write to media with the current CDROM.SYS - // driver. this check parses the GET_CONFIGURATION response data to search - // for the appropriate features and/or if they are current. - // - // this function should not allocate any resources, and thus may safely - // return from any point within the function. - // - PAGED_CODE(); - - *Writable = FALSE; - *ValidationSchema = 0; - *BlockingFactor = 1; - - // - // if the drive supports hardware defect management and random writes, that's - // sufficient to allow writes. - // - { - PFEATURE_HEADER defectHeader; - PFEATURE_HEADER writableHeader; - - defectHeader = MmcDataFindFeaturePage(Buffer, - BufferSize, - FeatureDefectManagement); - writableHeader = MmcDataFindFeaturePage(Buffer, - BufferSize, - FeatureRandomWritable); - - if (defectHeader == NULL || writableHeader == NULL) - { - // cannot write this way - } - else if (!CurrentOnly) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceUpdateMmcWriteCapability => Writes supported (defect management)\n")); - *Writable = TRUE; - return; - } - else if (defectHeader->Current && writableHeader->Current) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceUpdateMmcWriteCapability => Writes *allowed* (defect management)\n")); - *Writable = TRUE; - *ValidationSchema = FeatureDefectManagement; - return; - } - } - - // Certain validation schema require the blocking factor - // This is a best-effort attempt to ensure that illegal - // requests do not make it to drive - { - PFEATURE_HEADER header; - ULONG additionalLength; - - // Certain validation schema require the blocking factor - // This is a best-effort attempt to ensure that illegal - // requests do not make it to drive - additionalLength = RTL_SIZEOF_THROUGH_FIELD(FEATURE_DATA_RANDOM_READABLE, Blocking) - sizeof(FEATURE_HEADER); - - header = MmcDataFindFeaturePage(Buffer, - BufferSize, - FeatureRandomReadable); - - if ((header != NULL) && - (header->Current) && - (header->AdditionalLength >= additionalLength)) - { - PFEATURE_DATA_RANDOM_READABLE feature = (PFEATURE_DATA_RANDOM_READABLE)header; - *BlockingFactor = (feature->Blocking[0] << 8) | feature->Blocking[1]; - } - } - - // the majority of features to indicate write capability - // indicate this by a single feature existance/current bit. - // thus, can use a table-based method for the majority - // of the detection.... - { - typedef struct { - FEATURE_NUMBER FeatureToFind; // the ones allowed - FEATURE_NUMBER ValidationSchema; // and their related schema - } FEATURE_TO_WRITE_SCHEMA_MAP; - - static FEATURE_TO_WRITE_SCHEMA_MAP const FeaturesToAllowWritesWith[] = { - { FeatureRandomWritable, FeatureRandomWritable }, - { FeatureRigidRestrictedOverwrite, FeatureRigidRestrictedOverwrite }, - { FeatureRestrictedOverwrite, FeatureRestrictedOverwrite }, - { FeatureIncrementalStreamingWritable, FeatureIncrementalStreamingWritable }, - }; - - ULONG count; - for (count = 0; count < RTL_NUMBER_OF(FeaturesToAllowWritesWith); count++) - { - PFEATURE_HEADER header = MmcDataFindFeaturePage(Buffer, - BufferSize, - FeaturesToAllowWritesWith[count].FeatureToFind); - if (header == NULL) - { - // cannot write using this method - } - else if (!CurrentOnly) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceUpdateMmcWriteCapability => Writes supported (feature %04x)\n", - FeaturesToAllowWritesWith[count].FeatureToFind - )); - *Writable = TRUE; - return; - } - else if (header->Current) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceUpdateMmcWriteCapability => Writes *allowed* (feature %04x)\n", - FeaturesToAllowWritesWith[count].FeatureToFind - )); - *Writable = TRUE; - *ValidationSchema = FeaturesToAllowWritesWith[count].ValidationSchema; - return; - } - } // end count loop - } - - // unfortunately, DVD+R media doesn't require IncrementalStreamingWritable feature - // to be explicitly set AND it has a seperate bit in the feature to indicate - // being able to write to this media type. Thus, use a special case of the above code. - { - PFEATURE_DATA_DVD_PLUS_R header; - ULONG additionalLength = FIELD_OFFSET(FEATURE_DATA_DVD_PLUS_R, Reserved2[0]) - sizeof(FEATURE_HEADER); - header = MmcDataFindFeaturePage(Buffer, - BufferSize, - FeatureDvdPlusR); - - if (header == NULL || (header->Header.AdditionalLength < additionalLength) || (!header->Write)) - { - // cannot write this way - } - else if (!CurrentOnly) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceUpdateMmcWriteCapability => Writes supported (feature %04x)\n", - FeatureDvdPlusR - )); - *Writable = TRUE; - return; - } - else if (header->Header.Current) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceUpdateMmcWriteCapability => Writes *allowed* (feature %04x)\n", - FeatureDvdPlusR - )); - *Writable = TRUE; - *ValidationSchema = FeatureIncrementalStreamingWritable; - return; - } - } - - // unfortunately, DVD+R DL media doesn't require IncrementalStreamingWritable feature - // to be explicitly set AND it has a seperate bit in the feature to indicate - // being able to write to this media type. Thus, use a special case of the above code. - { - PFEATURE_DATA_DVD_PLUS_R_DUAL_LAYER header; - ULONG additionalLength = FIELD_OFFSET(FEATURE_DATA_DVD_PLUS_R_DUAL_LAYER, Reserved2[0]) - sizeof(FEATURE_HEADER); - header = MmcDataFindFeaturePage(Buffer, - BufferSize, - FeatureDvdPlusRDualLayer); - - if (header == NULL || (header->Header.AdditionalLength < additionalLength) || (!header->Write)) - { - // cannot write this way - } - else if (!CurrentOnly) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceUpdateMmcWriteCapability => Writes supported (feature %04x)\n", - FeatureDvdPlusRDualLayer - )); - *Writable = TRUE; - return; - } - else if (header->Header.Current) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceUpdateMmcWriteCapability => Writes *allowed* (feature %04x)\n", - FeatureDvdPlusRDualLayer - )); - *Writable = TRUE; - *ValidationSchema = FeatureIncrementalStreamingWritable; - return; - } - } - - // There are currently a number of drives on the market - // that fail to report: - // (a) FeatureIncrementalStreamingWritable as current - // for CD-R / DVD-R profile. - // (b) FeatureRestrictedOverwrite as current for CD-RW - // profile - // (c) FeatureRigidRestrictedOverwrite as current for - // DVD-RW profile - // - // Thus, use the profiles also. - { - PFEATURE_HEADER header; - header = MmcDataFindFeaturePage(Buffer, - BufferSize, - FeatureProfileList); - - if (header != NULL && header->Current) - { - // verify buffer bounds -- the below routine presumes full profile list provided - PUCHAR bufferEnd = ((PUCHAR)Buffer) + BufferSize; - PUCHAR headerEnd = ((PUCHAR)header) + header->AdditionalLength + RTL_SIZEOF_THROUGH_FIELD(FEATURE_HEADER, AdditionalLength); - if (bufferEnd >= headerEnd) // this _should_ never occurr, but.... - { - // Profiles don't contain any data other than current/not current. - // thus, can generically loop through them to see if any of the - // below (in order of preference) are current. - typedef struct { - FEATURE_PROFILE_TYPE ProfileToFind; // the ones allowed - FEATURE_NUMBER ValidationSchema; // and their related schema - } PROFILE_TO_WRITE_SCHEMA_MAP; - - static PROFILE_TO_WRITE_SCHEMA_MAP const ProfilesToAllowWritesWith[] = { - { ProfileDvdRewritable, FeatureRigidRestrictedOverwrite }, - { ProfileCdRewritable, FeatureRestrictedOverwrite }, - { ProfileDvdRecordable, FeatureIncrementalStreamingWritable }, - { ProfileCdRecordable, FeatureIncrementalStreamingWritable }, - }; - - ULONG count; - for (count = 0; count < RTL_NUMBER_OF(ProfilesToAllowWritesWith); count++) - { - BOOLEAN exists = FALSE; - MmcDataFindProfileInProfiles((PFEATURE_DATA_PROFILE_LIST)header, - ProfilesToAllowWritesWith[count].ProfileToFind, - CurrentOnly, - &exists); - if (exists) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, - "DeviceUpdateMmcWriteCapability => Writes %s (profile %04x)\n", - (CurrentOnly ? "*allowed*" : "supported"), - FeatureDvdPlusR - )); - - *Writable = TRUE; - *ValidationSchema = ProfilesToAllowWritesWith[count].ValidationSchema; - return; - } - } // end count loop - } // end if (bufferEnd >= headerEnd) - - } // end if (header != NULL && header->Current) - } - - // nothing matched to say it's writable..... - return; -} - -_IRQL_requires_max_(APC_LEVEL) -PVOID -MmcDataFindFeaturePage( - _In_reads_bytes_(Length) - PGET_CONFIGURATION_HEADER FeatureBuffer, - ULONG const Length, - FEATURE_NUMBER const Feature - ) -/*++ - -Routine Description: - - search the specific feature from feature list buffer - -Arguments: - - FeatureBuffer - buffer of feature list - Length - size of the buffer - Feature - feature wanted to find - -Return Value: - - PVOID - if found, pointer of starting address of the specific feature. - otherwise, NULL. - ---*/ -{ - PUCHAR buffer; - PUCHAR limit; - ULONG validLength; - - PAGED_CODE(); - - if (Length < sizeof(GET_CONFIGURATION_HEADER) + sizeof(FEATURE_HEADER)) { - return NULL; - } - - // Calculate the length of valid data available in the - // capabilities buffer from the DataLength field - REVERSE_BYTES(&validLength, FeatureBuffer->DataLength); - validLength += RTL_SIZEOF_THROUGH_FIELD(GET_CONFIGURATION_HEADER, DataLength); - - // set limit to point to first illegal address - limit = (PUCHAR)FeatureBuffer; - limit += min(Length, validLength); - - // set buffer to point to first page - buffer = FeatureBuffer->Data; - - // loop through each page until we find the requested one, or - // until it's not safe to access the entire feature header - // (if equal, have exactly enough for the feature header) - while (buffer + sizeof(FEATURE_HEADER) <= limit) - { - PFEATURE_HEADER header = (PFEATURE_HEADER)buffer; - FEATURE_NUMBER thisFeature; - - thisFeature = (header->FeatureCode[0] << 8) | - (header->FeatureCode[1]); - - if (thisFeature == Feature) - { - PUCHAR temp; - - // if don't have enough memory to safely access all the feature - // information, return NULL - temp = buffer; - temp += sizeof(FEATURE_HEADER); - temp += header->AdditionalLength; - - if (temp > limit) - { - // this means the transfer was cut-off, an insufficiently - // small buffer was given, or other arbitrary error. since - // it's not safe to view the amount of data (even though - // the header is safe) in this feature, pretend it wasn't - // transferred at all... - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "Feature %x exists, but not safe to access all its " - "data. returning NULL\n", Feature)); - return NULL; - } - else - { - return buffer; - } - } - - if ((header->AdditionalLength % 4) && - !(Feature >= 0xff00 && Feature <= 0xffff)) - { - return NULL; - } - - buffer += sizeof(FEATURE_HEADER); - buffer += header->AdditionalLength; - - } - return NULL; -} - -_IRQL_requires_max_(APC_LEVEL) -VOID -MmcDataFindProfileInProfiles( - _In_ FEATURE_DATA_PROFILE_LIST const* ProfileHeader, - _In_ FEATURE_PROFILE_TYPE const ProfileToFind, - _In_ BOOLEAN const CurrentOnly, - _Out_ PBOOLEAN Found - ) -/*++ - -Routine Description: - - search the specific feature from feature list buffer - -Arguments: - - ProfileHeader - buffer of profile list - ProfileToFind - profile to be found - CurrentOnly - - -Return Value: - - Found - found or not - ---*/ -{ - FEATURE_DATA_PROFILE_LIST_EX const * profile; - ULONG numberOfProfiles; - ULONG i; - - PAGED_CODE(); - - // initialize output - *Found = FALSE; - - // sanity check - if (ProfileHeader->Header.AdditionalLength % 2 != 0) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "Profile total length %x is not integral multiple of 4\n", - ProfileHeader->Header.AdditionalLength)); - NT_ASSERT(FALSE); - return; - } - - // calculate number of profiles - numberOfProfiles = ProfileHeader->Header.AdditionalLength / 4; - profile = ProfileHeader->Profiles; // zero-sized array - - // loop through profiles - for (i = 0; i < numberOfProfiles; i++) - { - FEATURE_PROFILE_TYPE currentProfile; - - currentProfile = (profile->ProfileNumber[0] << 8) | - (profile->ProfileNumber[1] & 0xff); - - if (currentProfile == ProfileToFind) - { - if (profile->Current || (!CurrentOnly)) - { - *Found = TRUE; - } - } - - profile++; - } - - return; -} - -_IRQL_requires_max_(APC_LEVEL) -_Ret_range_(-1,MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) -LONGLONG -DeviceRetryTimeGuessBasedOnProfile( - FEATURE_PROFILE_TYPE const Profile - ) -/*++ - -Routine Description: - - determine the retry time based on profile - -Arguments: - - Profile - - -Return Value: - - LONGLONG - retry time - ---*/ -{ - LONGLONG result = -1; // this means we have no idea - - PAGED_CODE(); - - switch (Profile) - { - case ProfileInvalid: // = 0x0000, - case ProfileNonRemovableDisk: // = 0x0001, - case ProfileRemovableDisk: // = 0x0002, - case ProfileMOErasable: // = 0x0003, - case ProfileMOWriteOnce: // = 0x0004, - case ProfileAS_MO: // = 0x0005, - // Reserved 0x0006 - 0x0007, - // Reserved 0x000b - 0x000f, - // Reserved 0x0017 - 0x0019 - // Reserved 0x001C - 001F - // Reserved 0x0023 - 0x0029 - // Reserved 0x002C - 0x003F - // Reserved 0x0044 - 0x004F - // Reserved 0x0053 - 0xfffe - case ProfileNonStandard: // = 0xffff - default: - { - NOTHING; // no default - break; - } - - case ProfileCdrom: // = 0x0008, - case ProfileCdRecordable: // = 0x0009, - case ProfileCdRewritable: // = 0x000a, - case ProfileDDCdrom: // = 0x0020, // obsolete - case ProfileDDCdRecordable: // = 0x0021, // obsolete - case ProfileDDCdRewritable: // = 0x0022, // obsolete - { - // 4x is ok as all CD drives have - // at least 64k*4 (256k) buffer - // and this is just a first-pass - // guess based only on profile - result = WRITE_RETRY_DELAY_CD_4x; - break; - } - case ProfileDvdRom: // = 0x0010, - case ProfileDvdRecordable: // = 0x0011, - case ProfileDvdRam: // = 0x0012, - case ProfileDvdRewritable: // = 0x0013, // restricted overwrite - case ProfileDvdRWSequential: // = 0x0014, - case ProfileDvdDashRLayerJump: // = 0x0016, - case ProfileDvdPlusRW: // = 0x001A, - case ProfileDvdPlusR: // = 0x001B, - { - result = WRITE_RETRY_DELAY_DVD_1x; - break; - } - case ProfileDvdDashRDualLayer: // = 0x0015, - case ProfileDvdPlusRWDualLayer: // = 0x002A, - case ProfileDvdPlusRDualLayer: // = 0x002B, - { - result = WRITE_RETRY_DELAY_DVD_1x; - break; - } - - case ProfileBDRom: // = 0x0040, - case ProfileBDRSequentialWritable: // = 0x0041, // BD-R 'SRM' - case ProfileBDRRandomWritable: // = 0x0042, // BD-R 'RRM' - case ProfileBDRewritable: // = 0x0043, - { - // I could not find specifications for the - // minimal 1x data rate for BD media. Use - // HDDVD values for now, since they are - // likely to be similar. Also, all media - // except for CD, DVD, and AS-MO should - // already fully support GET_CONFIG, so - // this guess is only used if we fail to - // get a performance descriptor.... - result = WRITE_RETRY_DELAY_HDDVD_1x; - break; - } - - case ProfileHDDVDRom: // = 0x0050, - case ProfileHDDVDRecordable: // = 0x0051, - case ProfileHDDVDRam: // = 0x0052, - { - // All HDDVD drives support GET_PERFORMANCE - // so this guess is fine at 1x.... - result = WRITE_RETRY_DELAY_HDDVD_1x; - break; - } - - // addition of any further profile types is not - // technically required as GET PERFORMANCE - // should succeed for all future drives. However, - // it is useful in case GET PERFORMANCE does - // fail for other reasons (i.e. bus resets, etc) - - } // end switch(Profile) - - return result; -} - -_IRQL_requires_max_(APC_LEVEL) -_Ret_range_(-1,MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) -LONGLONG -DeviceRetryTimeDetectionBasedOnModePage2A( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - determine the retry time based on mode sense data - -Arguments: - - DeviceExtension - device context - -Return Value: - - LONGLONG - retry time - ---*/ -{ - NTSTATUS status; - ULONG transferSize = min(0xFFF0, DeviceExtension->ScratchContext.ScratchBufferSize); - CDB cdb; - LONGLONG result = -1; - - PAGED_CODE(); - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.MODE_SENSE10.OperationCode = SCSIOP_MODE_SENSE10; - cdb.MODE_SENSE10.Dbd = 1; - cdb.MODE_SENSE10.PageCode = MODE_PAGE_CAPABILITIES; - cdb.MODE_SENSE10.AllocationLength[0] = (UCHAR)(transferSize >> 8); - cdb.MODE_SENSE10.AllocationLength[1] = (UCHAR)(transferSize & 0xFF); - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, NULL, transferSize, TRUE, &cdb, 10); - - // analyze the data on success.... - if (NT_SUCCESS(status)) - { - MODE_PARAMETER_HEADER10 const* header = DeviceExtension->ScratchContext.ScratchBuffer; - CDVD_CAPABILITIES_PAGE const* page = NULL; - ULONG dataLength = (header->ModeDataLength[0] << (8*1)) | - (header->ModeDataLength[1] << (8*0)) ; - - // no possible overflow - if (dataLength != 0) - { - dataLength += RTL_SIZEOF_THROUGH_FIELD(MODE_PARAMETER_HEADER10, ModeDataLength); - } - - // If it's not abundantly clear, we really don't trust the drive - // to be returning valid data. Get the page pointer and usable - // size of the page here... - if (dataLength < sizeof(MODE_PARAMETER_HEADER10)) - { - dataLength = 0; - } - else if (dataLength > DeviceExtension->ScratchContext.ScratchBufferSize) - { - dataLength = 0; - } - else if ((header->BlockDescriptorLength[1] == 0) && - (header->BlockDescriptorLength[0] == 0)) - { - dataLength -= sizeof(MODE_PARAMETER_HEADER10); - page = (CDVD_CAPABILITIES_PAGE const *)(header + 1); - } - else if ((header->BlockDescriptorLength[1] == 0) && - (header->BlockDescriptorLength[0] == sizeof(MODE_PARAMETER_BLOCK))) - { - dataLength -= sizeof(MODE_PARAMETER_HEADER10); - dataLength -= min(dataLength, sizeof(MODE_PARAMETER_BLOCK)); - page = (CDVD_CAPABILITIES_PAGE const *) - ( ((PUCHAR)header) + - sizeof(MODE_PARAMETER_HEADER10) + - sizeof(MODE_PARAMETER_BLOCK) - ); - } - - // Change dataLength from the size available per the header to - // the size available per the page itself. - if ((page != NULL) && - (dataLength >= RTL_SIZEOF_THROUGH_FIELD(CDVD_CAPABILITIES_PAGE, PageLength)) - ) - { - dataLength = min(dataLength, ((ULONG)(page->PageLength) + 2)); - } - - // Ignore the page if the fastest write speed field isn't available. - if ((page != NULL) && - (dataLength < RTL_SIZEOF_THROUGH_FIELD(CDVD_CAPABILITIES_PAGE, WriteSpeedMaximum)) - ) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "ModePage 2Ah was requested, but drive reported " - "only %x bytes (%x needed). Ignoring.\n", - dataLength, - RTL_SIZEOF_THROUGH_FIELD(CDVD_CAPABILITIES_PAGE, WriteSpeedMaximum) - )); - page = NULL; - } - - // Verify the page we requested is the one the drive actually provided - if ((page != NULL) && (page->PageCode != MODE_PAGE_CAPABILITIES)) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "ModePage 2Ah was requested, but drive reported " - "page %x\n", - page->PageCode - )); - page = NULL; - } - - // If _everything_ succeeded, then use the speed value in the page! - if (page != NULL) - { - ULONG temp = - (page->WriteSpeedMaximum[0] << (8*1)) | - (page->WriteSpeedMaximum[1] << (8*0)) ; - // stored as 1,000 byte increments... - temp *= 1000; - // typically stored at 2448 bytes/sector due to CD media - // error up to 20% high by presuming it returned 2048 data - // and convert to sectors/second - temp /= 2048; - // currently: sectors/sec - // ignore too-small or zero values - if (temp != 0) - { - result = ConvertSectorsPerSecondTo100nsUnitsFor64kWrite(temp); - } - } - } - - ScratchBuffer_EndUse(DeviceExtension); - - return result; -} - - -_IRQL_requires_max_(APC_LEVEL) -_Ret_range_(-1,MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) -LONGLONG -DeviceRetryTimeDetectionBasedOnGetPerformance( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN UseLegacyNominalPerformance - ) -/*++ - -Routine Description: - - determine the retry time based on get performance data - -Arguments: - - DeviceExtension - device context - UseLegacyNominalPerformance - - -Return Value: - - LONGLONG - retry time - ---*/ -{ - typedef struct _GET_PERFORMANCE_HEADER { - UCHAR TotalDataLength[4]; // not including this field - UCHAR Except : 1; - UCHAR Write : 1; - UCHAR Reserved0 : 6; - UCHAR Reserved1[3]; - } GET_PERFORMANCE_HEADER, *PGET_PERFORMANCE_HEADER; - C_ASSERT( sizeof(GET_PERFORMANCE_HEADER) == 8); - - typedef struct _GET_PERFORMANCE_NOMINAL_PERFORMANCE_DESCRIPTOR { - UCHAR StartLba[4]; - UCHAR StartPerformance[4]; - UCHAR EndLba[4]; - UCHAR EndPerformance[4]; - } GET_PERFORMANCE_NOMINAL_PERFORMANCE_DESCRIPTOR, *PGET_PERFORMANCE_NOMINAL_PERFORMANCE_DESCRIPTOR; - C_ASSERT( sizeof(GET_PERFORMANCE_NOMINAL_PERFORMANCE_DESCRIPTOR) == 16); - - - typedef struct _GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR { - UCHAR MixedReadWrite : 1; - UCHAR GuaranteedForWholeMedia : 1; - UCHAR Reserved0_RDD : 1; - UCHAR WriteRotationControl : 2; - UCHAR Reserved1 : 3; - UCHAR Reserved2[3]; - - UCHAR MediaCapacity[4]; - UCHAR ReadSpeedKilobytesPerSecond[4]; - UCHAR WriteSpeedKilobytesPerSecond[4]; - } GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR, *PGET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR; - C_ASSERT( sizeof(GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR) == 16); - - ////// - - NTSTATUS status; - LONGLONG result = -1; - - // transfer size -- descriptors + 8 byte header - // Note: this size is identical for both descriptor types - C_ASSERT( sizeof(GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR) == sizeof(GET_PERFORMANCE_NOMINAL_PERFORMANCE_DESCRIPTOR)); - - ULONG const maxDescriptors = min(200, (DeviceExtension->ScratchContext.ScratchBufferSize-sizeof(GET_PERFORMANCE_HEADER))/sizeof(GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR)); - ULONG validDescriptors = 0; - ULONG transferSize = sizeof(GET_PERFORMANCE_HEADER) + (maxDescriptors*sizeof(GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR)); - CDB cdb; - - PAGED_CODE(); - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - if (UseLegacyNominalPerformance) - { - cdb.GET_PERFORMANCE.OperationCode = SCSIOP_GET_PERFORMANCE; - cdb.GET_PERFORMANCE.Except = 0; - cdb.GET_PERFORMANCE.Write = 1; - cdb.GET_PERFORMANCE.Tolerance = 2; // only defined option - cdb.GET_PERFORMANCE.MaximumNumberOfDescriptors[1] = (UCHAR)maxDescriptors; - cdb.GET_PERFORMANCE.Type = 0; // legacy nominal descriptors - } - else - { - cdb.GET_PERFORMANCE.OperationCode = SCSIOP_GET_PERFORMANCE; - cdb.GET_PERFORMANCE.MaximumNumberOfDescriptors[1] = (UCHAR)maxDescriptors; - cdb.GET_PERFORMANCE.Type = 3; // write speed - } - - status = ScratchBuffer_ExecuteCdbEx(DeviceExtension, NULL, transferSize, TRUE, &cdb, 12, CDROM_GET_PERFORMANCE_TIMEOUT); - - // determine how many valid descriptors there actually are - if (NT_SUCCESS(status)) - { - GET_PERFORMANCE_HEADER const* header = (GET_PERFORMANCE_HEADER const*)DeviceExtension->ScratchContext.ScratchBuffer; - ULONG temp1 = (header->TotalDataLength[0] << (8*3)) | - (header->TotalDataLength[1] << (8*2)) | - (header->TotalDataLength[2] << (8*1)) | - (header->TotalDataLength[3] << (8*0)) ; - - // adjust data size for header - if (temp1 + (ULONG)RTL_SIZEOF_THROUGH_FIELD(GET_PERFORMANCE_HEADER, TotalDataLength) < temp1) - { - temp1 = 0; - } - else if (temp1 != 0) - { - temp1 += RTL_SIZEOF_THROUGH_FIELD(GET_PERFORMANCE_HEADER, TotalDataLength); - } - - if (temp1 == 0) - { - // no data returned - } - else if (temp1 <= sizeof(GET_PERFORMANCE_HEADER)) - { - // only the header returned, no descriptors - } - else if (UseLegacyNominalPerformance && - ((header->Except != 0) || (header->Write == 0)) - ) - { - // bad data being returned -- ignore it - } - else if (!UseLegacyNominalPerformance && - ((header->Except != 0) || (header->Write != 0)) - ) - { - // returning Performance (Type 0) data, not requested Write Speed (Type 3) data - } - else if ( (temp1 - sizeof(GET_PERFORMANCE_HEADER)) % sizeof(GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR) != 0) - { - // Note: this size is identical for both descriptor types - C_ASSERT( sizeof(GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR) == sizeof(GET_PERFORMANCE_NOMINAL_PERFORMANCE_DESCRIPTOR)); - - // not returning valid data.... - } - else // save how many are usable - { - // Note: this size is identical for both descriptor types - C_ASSERT( sizeof(GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR) == sizeof(GET_PERFORMANCE_NOMINAL_PERFORMANCE_DESCRIPTOR)); - - // take the smaller usable value - temp1 = min(temp1, DeviceExtension->ScratchContext.ScratchSrb->DataTransferLength); - // then determine the usable descriptors - validDescriptors = (temp1 - sizeof(GET_PERFORMANCE_HEADER)) / sizeof(GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR); - } - } - - // The drive likely supports this command. - // Verify the data makes sense. - if (NT_SUCCESS(status)) - { - ULONG i; - GET_PERFORMANCE_HEADER const* header = (GET_PERFORMANCE_HEADER const*)DeviceExtension->ScratchContext.ScratchBuffer; - GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR const* descriptor = (GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR const*)(header+1); // pointer math - - // NOTE: We could write this loop twice, once for each write descriptor type - // However, the only fields of interest are the writeKBps field (Type 3) and - // the EndPerformance field (Type 0), which both exist in the same exact - // location and have essentially the same meaning. So, just use the same - // loop/structure pointers for both of the to simplify the readability of - // this code. The C_ASSERT()s here verify this at compile-time. - - C_ASSERT( sizeof(GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR) == sizeof(GET_PERFORMANCE_NOMINAL_PERFORMANCE_DESCRIPTOR)); - C_ASSERT( FIELD_OFFSET(GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR, WriteSpeedKilobytesPerSecond) == - FIELD_OFFSET(GET_PERFORMANCE_NOMINAL_PERFORMANCE_DESCRIPTOR, EndPerformance) - ); - C_ASSERT( RTL_FIELD_SIZE(GET_PERFORMANCE_WRITE_SPEED_DESCRIPTOR, WriteSpeedKilobytesPerSecond) == - RTL_FIELD_SIZE(GET_PERFORMANCE_NOMINAL_PERFORMANCE_DESCRIPTOR, EndPerformance) - ); - - // loop through them all, and find the fastest listed write speed - for (i = 0; NT_SUCCESS(status) && (i WriteSpeedKilobytesPerSecond[0] << (8*3)) | - (descriptor->WriteSpeedKilobytesPerSecond[1] << (8*2)) | - (descriptor->WriteSpeedKilobytesPerSecond[2] << (8*1)) | - (descriptor->WriteSpeedKilobytesPerSecond[3] << (8*0)) ; - - // Avoid overflow and still have good estimates - // 0x1 0000 0000 / 1000 == 0x00418937 == maximum writeKBps to multiple first - ULONG const sectorsPerSecond = - (writeKBps > 0x00418937) ? // would overflow occur by multiplying by 1000? - ((writeKBps / 2048) * 1000) : // must divide first, minimal loss of accuracy - ((writeKBps * 1000) / 2048) ; // must multiply first, avoid loss of accuracy - - if (sectorsPerSecond <= 0) - { - break; // out of the loop -- no longer valid data (very defensive programming) - } - - // we have at least one valid result, so prevent returning -1 as our result - if (result == -1) { result = MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS; } - - // take the fastest speed (smallest wait time) we've found thus far - result = min(result, ConvertSectorsPerSecondTo100nsUnitsFor64kWrite(sectorsPerSecond)); - } - } - - ScratchBuffer_EndUse(DeviceExtension); - - return result; -} - -#pragma warning(pop) // un-sets any local warning changes diff --git a/storage/class/cdrom/src/mmc.h b/storage/class/cdrom/src/mmc.h deleted file mode 100644 index 51c03309..00000000 --- a/storage/class/cdrom/src/mmc.h +++ /dev/null @@ -1,122 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - mmc.h - -Abstract: - - Functions for MMC area. - -Author: - -Environment: - - kernel mode only - -Notes: - - -Revision History: - ---*/ - -#ifndef __MMC_H__ -#define __MMC_H__ - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceDeallocateMmcResources( - _In_ WDFDEVICE Device - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceAllocateMmcResources( - _In_ WDFDEVICE Device - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceUpdateMmcCapabilities( - _In_ WDFDEVICE Device - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceGetConfigurationWithAlloc( - _In_ WDFDEVICE Device, - _Outptr_result_bytebuffer_all_(*BytesReturned) - PGET_CONFIGURATION_HEADER * Buffer, - _Out_ PULONG BytesReturned, - FEATURE_NUMBER const StartingFeature, - ULONG const RequestedType - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceGetConfiguration( - _In_ WDFDEVICE Device, - _Out_writes_bytes_to_(BufferSize, *ValidBytes) - PGET_CONFIGURATION_HEADER Buffer, - _In_ ULONG const BufferSize, - _Out_ PULONG ValidBytes, - _In_ FEATURE_NUMBER const StartingFeature, - _In_ ULONG const RequestedType - ); - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceUpdateMmcWriteCapability( - _In_reads_bytes_(BufferSize) - PGET_CONFIGURATION_HEADER Buffer, - ULONG const BufferSize, - BOOLEAN const CurrentOnly, // TRUE == can drive write now, FALSE == can drive ever write - _Out_ PBOOLEAN Writable, - _Out_ PFEATURE_NUMBER ValidationSchema, - _Out_ PULONG BlockingFactor - ); - -_IRQL_requires_max_(APC_LEVEL) -PVOID -MmcDataFindFeaturePage( - _In_reads_bytes_(Length) - PGET_CONFIGURATION_HEADER FeatureBuffer, - ULONG const Length, - FEATURE_NUMBER const Feature - ); - -_IRQL_requires_max_(APC_LEVEL) -VOID -MmcDataFindProfileInProfiles( - _In_ FEATURE_DATA_PROFILE_LIST const* ProfileHeader, - _In_ FEATURE_PROFILE_TYPE const ProfileToFind, - _In_ BOOLEAN const CurrentOnly, - _Out_ PBOOLEAN Found - ); - -_IRQL_requires_max_(APC_LEVEL) -_Ret_range_(-1,MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) -LONGLONG -DeviceRetryTimeGuessBasedOnProfile( - FEATURE_PROFILE_TYPE const Profile - ); - -_IRQL_requires_max_(APC_LEVEL) -_Ret_range_(-1,MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) -LONGLONG -DeviceRetryTimeDetectionBasedOnModePage2A( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(APC_LEVEL) -_Ret_range_(-1,MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) -LONGLONG -DeviceRetryTimeDetectionBasedOnGetPerformance( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN UseLegacyNominalPerformance - ); - -#endif // __MMC_H__ diff --git a/storage/class/cdrom/src/pnppower.c b/storage/class/cdrom/src/pnppower.c deleted file mode 100644 index 56f239e4..00000000 --- a/storage/class/cdrom/src/pnppower.c +++ /dev/null @@ -1,684 +0,0 @@ -/*-- - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - pnppower.c - -Abstract: - - Functions to handle PnP and Power IRPs. - -Environment: - - kernel mode only - -Notes: - optical devices do not need to issue SPIN UP when power up. - The device itself should SPIN UP to process commands. - - -Revision History: - ---*/ - - -#include "ntddk.h" -#include "wdfcore.h" - -#include "cdrom.h" -#include "ioctl.h" -#include "scratch.h" -#include "mmc.h" - -#ifdef DEBUG_USE_WPP -#include "pnppower.tmh" -#endif - - -NTSTATUS -DeviceScratchSyncCache( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -NTSTATUS -DeviceScratchPreventMediaRemoval( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN Prevent - ); - -NTSTATUS -RequestIssueShutdownFlush( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PIRP Irp - ); - -IO_COMPLETION_ROUTINE RequestProcessPowerIrpCompletion; - -EVT_WDF_REQUEST_COMPLETION_ROUTINE RequestUnlockQueueCompletion; - -#ifdef ALLOC_PRAGMA - -#pragma alloc_text(PAGE, DevicePowerSettingCallback) - -#endif - -#pragma warning(push) -#pragma warning(disable:4152) // nonstandard extension, function/data pointer conversion in expression - -#pragma warning(disable:28118) // Dispatch routines for IRP_MJ_SHUTDOWN, IRP_MJ_FLUSH_BUFFERS occur at PASSIVE_LEVEL. - // WDF defines EVT_WDFDEVICE_WDM_IRP_PREPROCESS with _IRQL_requires_max_(DISPATCH_LEVEL), - // triggering a false positive for this warning. - -NTSTATUS -RequestProcessShutdownFlush( - WDFDEVICE Device, - PIRP Irp - ) -/*++ - -Routine Description: - - process IRP: IRP_MJ_SHUTDOWN, IRP_MJ_FLUSH_BUFFERS - -Arguments: - - Device - device object - Irp - the irp - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PIO_STACK_LOCATION currentStack = NULL; - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - - //add trace info - - // acquire the shutdown/flush lock - WdfWaitLockAcquire(deviceExtension->ShutdownFlushWaitLock, NULL); - - currentStack = IoGetCurrentIrpStackLocation(Irp); - - // finish all current requests - WdfIoQueueStopSynchronously(deviceExtension->SerialIOQueue); - - // sync cache - if (NT_SUCCESS(status)) - { - // safe to use scratch srb to send the request. - status = DeviceScratchSyncCache(deviceExtension); - } - - // For SHUTDOWN, allow media removal. - if (NT_SUCCESS(status)) - { - if (currentStack->MajorFunction == IRP_MJ_SHUTDOWN) - { - // safe to use scratch srb to send the request. - status = DeviceScratchPreventMediaRemoval(deviceExtension, FALSE); - } - } - - // Use original IRP, send SRB_FUNCTION_SHUTDOWN or SRB_FUNCTION_FLUSH (no retry) - if (NT_SUCCESS(status)) - { - status = RequestIssueShutdownFlush(deviceExtension, Irp); - } - - // restart queue to allow processing further requests. - WdfIoQueueStart(deviceExtension->SerialIOQueue); - - // release the shutdown/flush lock - WdfWaitLockRelease(deviceExtension->ShutdownFlushWaitLock); - - // 6. complete the irp - Irp->IoStatus.Status = status; - IoCompleteRequest(Irp, 0); - - return status; -} - -NTSTATUS -RequestProcessSetPower( - WDFDEVICE Device, - PIRP Irp - ) -/*++ - -Routine Description: - - process IRP: IRP_MJ_POWER - -Arguments: - - Device - device object - Irp - the irp - -Return Value: - - NTSTATUS - ---*/ -{ - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device); - PIO_STACK_LOCATION currentStack; - NTSTATUS status; - BOOLEAN IrpMarkedPending = FALSE; - - currentStack = IoGetCurrentIrpStackLocation(Irp); - - if ((currentStack->Parameters.Power.Type == DevicePowerState) && - (currentStack->Parameters.Power.State.DeviceState != PowerDeviceD0)) - { - // We need to unlock the device queue in D3 postprocessing. - IoCopyCurrentIrpStackLocationToNext(Irp); - IoSetCompletionRoutine(Irp, - RequestProcessPowerIrpCompletion, - deviceExtension, - TRUE, - TRUE, - TRUE); - - // Mark the Irp pending as we'll defer the I/O completion. - IoMarkIrpPending(Irp); - IrpMarkedPending = TRUE; - } - else { - - IoSkipCurrentIrpStackLocation(Irp); - } - -#pragma warning(push) -#pragma warning(disable: 28193) // OACR will complain that the status variable is not examined. - - // - // Deliver the IRP back to the framework. - // - - status = WdfDeviceWdmDispatchPreprocessedIrp(Device, Irp); - - if (IrpMarkedPending) - { - UNREFERENCED_PARAMETER(status); - return STATUS_PENDING; - } - -#pragma warning(pop) - - return status; -} - -// use scratch SRB to issue SYNC CACHE command. -NTSTATUS -DeviceScratchSyncCache( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - use scratch buffer to send SYNC CACHE command - -Arguments: - - DeviceExtension - device context - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - ULONG transferSize = 0; - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.SYNCHRONIZE_CACHE10.OperationCode = SCSIOP_SYNCHRONIZE_CACHE; - //srb->QueueTag = SP_UNTAGGED; - //srb->QueueAction = SRB_SIMPLE_TAG_REQUEST; - - status = ScratchBuffer_ExecuteCdbEx(DeviceExtension, NULL, transferSize, FALSE, &cdb, 10, TimeOutValueGetCapValue(DeviceExtension->TimeOutValue, 4)); - - ScratchBuffer_EndUse(DeviceExtension); - - return status; -} - -NTSTATUS -DeviceScratchPreventMediaRemoval( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN Prevent - ) -/*++ - -Routine Description: - - use scratch SRB to issue ALLOW/PREVENT MEDIA REMOVAL command. - -Arguments: - - DeviceExtension - device context - Prevent - TRUE (prevent media removal); FALSE (allow media removal) - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - ULONG transferSize = 0; - CDB cdb; - - ScratchBuffer_BeginUse(DeviceExtension); - - RtlZeroMemory(&cdb, sizeof(CDB)); - // Set up the CDB - cdb.MEDIA_REMOVAL.OperationCode = SCSIOP_MEDIUM_REMOVAL; - cdb.MEDIA_REMOVAL.Prevent = Prevent; - //srb->QueueTag = SP_UNTAGGED; - //srb->QueueAction = SRB_SIMPLE_TAG_REQUEST; - - status = ScratchBuffer_ExecuteCdb(DeviceExtension, NULL, transferSize, FALSE, &cdb, 6); - - ScratchBuffer_EndUse(DeviceExtension); - - return status; -} - -NTSTATUS -RequestIssueShutdownFlush( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PIRP Irp - ) -/*++ - -Routine Description: - - issue SRB function Flush/Shutdown command. - -Arguments: - - DeviceExtension - device context - Irp - the irp - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PSCSI_REQUEST_BLOCK srb = DeviceExtension->ScratchContext.ScratchSrb; - PIO_STACK_LOCATION currentStack = NULL; - - ULONG transferSize = 0; - BOOLEAN shouldRetry = TRUE; - ULONG timesAlreadyRetried = 0; - LONGLONG retryIn100nsUnits = 0; - - - currentStack = IoGetCurrentIrpStackLocation(Irp); - - - ScratchBuffer_BeginUse(DeviceExtension); - - // no retry needed. - { - ScratchBuffer_SetupSrb(DeviceExtension, NULL, transferSize, FALSE); - - // Set up the SRB/CDB - srb->QueueTag = SP_UNTAGGED; - srb->QueueAction = SRB_SIMPLE_TAG_REQUEST; - srb->TimeOutValue = TimeOutValueGetCapValue(DeviceExtension->TimeOutValue, 4); - srb->CdbLength = 0; - - if (currentStack->MajorFunction == IRP_MJ_SHUTDOWN) - { - srb->Function = SRB_FUNCTION_SHUTDOWN; - } - else - { - srb->Function = SRB_FUNCTION_FLUSH; - } - - ScratchBuffer_SendSrb(DeviceExtension, TRUE, NULL); - - shouldRetry = RequestSenseInfoInterpretForScratchBuffer(DeviceExtension, - timesAlreadyRetried, - &status, - &retryIn100nsUnits); - UNREFERENCED_PARAMETER(shouldRetry); //defensive coding, avoid PREFAST warning. - UNREFERENCED_PARAMETER(status); //defensive coding, avoid PREFAST warning. - - // retrieve the real status from the request. - status = WdfRequestGetStatus(DeviceExtension->ScratchContext.ScratchRequest); - } - - ScratchBuffer_EndUse(DeviceExtension); - - - return status; -} - -VOID -RequestUnlockQueueCompletion ( - _In_ WDFREQUEST Request, - _In_ WDFIOTARGET Target, - _In_ PWDF_REQUEST_COMPLETION_PARAMS Params, - _In_ WDFCONTEXT Context - ) -{ - PIRP Irp = Context; - WDFDEVICE device = WdfIoTargetGetDevice(Target); - PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(device); - - UNREFERENCED_PARAMETER(Request); - UNREFERENCED_PARAMETER(Params); - - deviceExtension->PowerContext.Options.LockQueue = FALSE; - - PowerContextEndUse(deviceExtension); - - // Complete the original power irp - IoCompleteRequest( Irp, IO_NO_INCREMENT ); -} - -NTSTATUS -RequestProcessPowerIrpCompletion( - _In_ PDEVICE_OBJECT DeviceObject, - _In_ PIRP Irp, - _In_reads_opt_(_Inexpressible_("varies")) PVOID Context - ) -/*++ - -Routine Description: - - Free the Irp. - -Arguments: - - DeviceObject - device that the completion routine fires on. - - Irp - The irp to be completed. - - Context - IRP context - -Return Value: - NTSTATUS - ---*/ -{ - PCDROM_DEVICE_EXTENSION deviceExtension = Context; - PIO_STACK_LOCATION currentStack; - - UNREFERENCED_PARAMETER(DeviceObject); - - if (Irp->PendingReturned) - { - IoMarkIrpPending( Irp ); - } - - currentStack = IoGetCurrentIrpStackLocation(Irp); - - NT_ASSERT(currentStack->Parameters.Power.Type == DevicePowerState); - NT_ASSERT(currentStack->Parameters.Power.State.DeviceState != PowerDeviceD0); - - _Analysis_assume_(deviceExtension != NULL); - - deviceExtension->PowerContext.PowerChangeState.PowerDown++; - - // Step 5. UNLOCK QUEUE - if (deviceExtension->PowerContext.Options.LockQueue) - { - (VOID)DeviceSendPowerDownProcessRequest(deviceExtension, - RequestUnlockQueueCompletion, - Irp); - - // Let the completion routine complete the Irp - return STATUS_MORE_PROCESSING_REQUIRED; - } - - // Release the power context if it wasn't already done as part of D0Exit handling - if (deviceExtension->PowerContext.InUse) - { - PowerContextEndUse(deviceExtension); - } - - return STATUS_CONTINUE_COMPLETION; -} - - -_IRQL_requires_max_(DISPATCH_LEVEL) -NTSTATUS -PowerContextReuseRequest( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - reset fields for the request. - -Arguments: - - DeviceExtension - device context - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - WDF_REQUEST_REUSE_PARAMS reuseParams; - PIRP irp = NULL; - - RtlZeroMemory(&(DeviceExtension->PowerContext.SenseData), sizeof(DeviceExtension->PowerContext.SenseData)); - RtlZeroMemory(&(DeviceExtension->PowerContext.Srb), sizeof(DeviceExtension->PowerContext.Srb)); - - irp = WdfRequestWdmGetIrp(DeviceExtension->PowerContext.PowerRequest); - - // Re-use the previously created PowerRequest object and format it - WDF_REQUEST_REUSE_PARAMS_INIT(&reuseParams, WDF_REQUEST_REUSE_NO_FLAGS, STATUS_NOT_SUPPORTED); - status = WdfRequestReuse(DeviceExtension->PowerContext.PowerRequest, &reuseParams); - if (NT_SUCCESS(status)) - { - // This request was preformated during initialization so this call should never fail. - status = WdfIoTargetFormatRequestForInternalIoctlOthers(DeviceExtension->IoTarget, - DeviceExtension->PowerContext.PowerRequest, - IOCTL_SCSI_EXECUTE_IN, - NULL, NULL, - NULL, NULL, - NULL, NULL); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "PowerContextReuseRequest: WdfIoTargetFormatRequestForInternalIoctlOthers failed, %!STATUS!\n", - status)); - } - } - - // Do some basic initialization of the PowerRequest, the rest will be done by the caller - // of this function - if (NT_SUCCESS(status)) - { - PIO_STACK_LOCATION nextStack = NULL; - - nextStack = IoGetNextIrpStackLocation(irp); - - nextStack->MajorFunction = IRP_MJ_SCSI; - nextStack->Parameters.Scsi.Srb = &(DeviceExtension->PowerContext.Srb); - - DeviceExtension->PowerContext.Srb.Length = sizeof(SCSI_REQUEST_BLOCK); - DeviceExtension->PowerContext.Srb.OriginalRequest = irp; - - DeviceExtension->PowerContext.Srb.SenseInfoBuffer = &(DeviceExtension->PowerContext.SenseData); - DeviceExtension->PowerContext.Srb.SenseInfoBufferLength = SENSE_BUFFER_SIZE; - } - - return status; -} - -_IRQL_requires_max_(DISPATCH_LEVEL) -NTSTATUS -PowerContextBeginUse( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - initialize fields in power context - -Arguments: - - DeviceExtension - device context - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - NT_ASSERT(!DeviceExtension->PowerContext.InUse); - - DeviceExtension->PowerContext.InUse = TRUE; - DeviceExtension->PowerContext.RetryCount = MAXIMUM_RETRIES; - DeviceExtension->PowerContext.RetryIntervalIn100ns = 0; - - KeQueryTickCount(&DeviceExtension->PowerContext.StartTime); - - RtlZeroMemory(&(DeviceExtension->PowerContext.Options), sizeof(DeviceExtension->PowerContext.Options)); - RtlZeroMemory(&(DeviceExtension->PowerContext.PowerChangeState), sizeof(DeviceExtension->PowerContext.PowerChangeState)); - - status = PowerContextReuseRequest(DeviceExtension); - - RequestClearSendTime(DeviceExtension->PowerContext.PowerRequest); - - return status; -} - -_IRQL_requires_max_(DISPATCH_LEVEL) -NTSTATUS -PowerContextEndUse( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - inidate that power context using is finished. - -Arguments: - - DeviceExtension - device context - -Return Value: - - NTSTATUS - ---*/ -{ - NT_ASSERT(DeviceExtension->PowerContext.InUse); - - DeviceExtension->PowerContext.InUse = FALSE; - - KeQueryTickCount(&DeviceExtension->PowerContext.CompleteTime); - - return STATUS_SUCCESS; -} - - -_Function_class_(POWER_SETTING_CALLBACK) -_IRQL_requires_same_ -NTSTATUS -DevicePowerSettingCallback( - _In_ LPCGUID SettingGuid, - _In_reads_bytes_(ValueLength) PVOID Value, - _In_ ULONG ValueLength, - _Inout_opt_ PVOID Context - ) -/*++ -Description: - - This function is the callback for power setting notifications (registered - when ClasspGetD3IdleTimeout() is called for the first time). - - Currently, this function is used to get the disk idle timeout value from - the system power settings. - - This function is guaranteed to be called at PASSIVE_LEVEL. - -Arguments: - - SettingGuid - The power setting GUID. - Value - Pointer to the power setting value. - ValueLength - Size of the Value buffer. - Context - The FDO's device extension. - -Return Value: - - STATUS_SUCCESS - ---*/ -{ - PCDROM_DEVICE_EXTENSION DeviceExtension = Context; - MONITOR_DISPLAY_STATE DisplayState; - - PAGED_CODE(); - - if (IsEqualGUID(SettingGuid, &GUID_CONSOLE_DISPLAY_STATE)) { - - if ((ValueLength == sizeof(ULONG)) && (Value != NULL)) { - - DisplayState = *((PULONG)Value); - - _Analysis_assume_(DeviceExtension != NULL); - - // - // Power setting callbacks are asynchronous so make sure the device - // is completely initialized before taking any actions. - // - if (DeviceExtension->IsInitialized) { - - // - // If monitor is off, change media change requests to not keep device active. - // This allows the devices to go to sleep if there are no other active requests. - // - - if (DisplayState == PowerMonitorOff) { - - // - // Mark the device inactive so that it can enter a low power state. - // - - DeviceMarkActive(DeviceExtension, FALSE, TRUE); - SET_FLAG(DeviceExtension->MediaChangeDetectionInfo->SrbFlags, SRB_FLAGS_NO_KEEP_AWAKE); - } - else - { - CLEAR_FLAG(DeviceExtension->MediaChangeDetectionInfo->SrbFlags, SRB_FLAGS_NO_KEEP_AWAKE); - DeviceMarkActive(DeviceExtension, TRUE, TRUE); - } - } - } - } - - return STATUS_SUCCESS; -} - -#pragma warning(pop) // un-sets any local warning changes - diff --git a/storage/class/cdrom/src/scratch.c b/storage/class/cdrom/src/scratch.c deleted file mode 100644 index fe82049a..00000000 --- a/storage/class/cdrom/src/scratch.c +++ /dev/null @@ -1,1463 +0,0 @@ -/*-- - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - scratch.c - -Abstract: - - Functions for using common scratch buffer - -Environment: - - kernel mode only - -Notes: - - -Revision History: - ---*/ - -#include "stddef.h" -#include "string.h" - -#include "ntddk.h" -#include "ntddstor.h" -#include "cdrom.h" -#include "ioctl.h" -#include "scratch.h" -#include "mmc.h" - -#ifdef DEBUG_USE_WPP -#include "scratch.tmh" -#endif - -// Forward declarations -EVT_WDF_REQUEST_COMPLETION_ROUTINE ScratchBuffer_ReadWriteCompletionRoutine; - -#ifdef ALLOC_PRAGMA - -#pragma alloc_text(PAGE, ScratchBuffer_Deallocate) -#pragma alloc_text(PAGE, ScratchBuffer_Allocate) -#pragma alloc_text(PAGE, ScratchBuffer_SetupSrb) -#pragma alloc_text(PAGE, ScratchBuffer_ExecuteCdbEx) - -#endif - -_IRQL_requires_max_(APC_LEVEL) -VOID -ScratchBuffer_Deallocate( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - release all resources allocated for scratch. - -Arguments: - - DeviceExtension - device extension - -Return Value: - - none - ---*/ -{ - PAGED_CODE (); - - NT_ASSERT(DeviceExtension->ScratchContext.ScratchInUse == 0); - - if (DeviceExtension->ScratchContext.ScratchHistory != NULL) - { - ExFreePool(DeviceExtension->ScratchContext.ScratchHistory); - DeviceExtension->ScratchContext.ScratchHistory = NULL; - } - if (DeviceExtension->ScratchContext.ScratchSense != NULL) - { - ExFreePool(DeviceExtension->ScratchContext.ScratchSense); - DeviceExtension->ScratchContext.ScratchSense = NULL; - } - if (DeviceExtension->ScratchContext.ScratchSrb != NULL) - { - ExFreePool(DeviceExtension->ScratchContext.ScratchSrb); - DeviceExtension->ScratchContext.ScratchSrb = NULL; - } - if (DeviceExtension->ScratchContext.ScratchBufferSize != 0) - { - DeviceExtension->ScratchContext.ScratchBufferSize = 0; - } - if (DeviceExtension->ScratchContext.ScratchBufferMdl != NULL) - { - IoFreeMdl(DeviceExtension->ScratchContext.ScratchBufferMdl); - DeviceExtension->ScratchContext.ScratchBufferMdl = NULL; - } - if (DeviceExtension->ScratchContext.ScratchBuffer != NULL) - { - ExFreePool(DeviceExtension->ScratchContext.ScratchBuffer); - DeviceExtension->ScratchContext.ScratchBuffer = NULL; - } - - if (DeviceExtension->ScratchContext.PartialMdl != NULL) - { - IoFreeMdl(DeviceExtension->ScratchContext.PartialMdl); - DeviceExtension->ScratchContext.PartialMdl = NULL; - } - - if (DeviceExtension->ScratchContext.ScratchRequest != NULL) - { - PIRP irp = WdfRequestWdmGetIrp(DeviceExtension->ScratchContext.ScratchRequest); - if (irp->MdlAddress) - { - irp->MdlAddress = NULL; - } - WdfObjectDelete(DeviceExtension->ScratchContext.ScratchRequest); - DeviceExtension->ScratchContext.ScratchRequest = NULL; - } - - return; -} - -_IRQL_requires_max_(APC_LEVEL) -BOOLEAN -ScratchBuffer_Allocate( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - allocate resources allocated for scratch. - -Arguments: - - DeviceExtension - device extension - -Return Value: - - none - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - - PAGED_CODE (); - - NT_ASSERT(DeviceExtension->ScratchContext.ScratchInUse == 0); - - // quick-exit if already allocated - if ((DeviceExtension->ScratchContext.ScratchBuffer != NULL) && - (DeviceExtension->ScratchContext.ScratchBufferMdl != NULL) && - (DeviceExtension->ScratchContext.ScratchBufferSize != 0) && - (DeviceExtension->ScratchContext.ScratchRequest != NULL) && - (DeviceExtension->ScratchContext.ScratchSrb != NULL) && - (DeviceExtension->ScratchContext.ScratchHistory != NULL) && - (DeviceExtension->ScratchContext.PartialMdl != NULL) - ) - { - return TRUE; - } - - // validate max transfer already determined - NT_ASSERT(DeviceExtension->DeviceAdditionalData.MaxPageAlignedTransferBytes != 0); - - // validate no partially-saved state - NT_ASSERT(DeviceExtension->ScratchContext.ScratchBuffer == NULL); - NT_ASSERT(DeviceExtension->ScratchContext.ScratchBufferMdl == NULL); - NT_ASSERT(DeviceExtension->ScratchContext.ScratchBufferSize == 0); - NT_ASSERT(DeviceExtension->ScratchContext.ScratchRequest == NULL); - NT_ASSERT(DeviceExtension->ScratchContext.PartialMdl == NULL); - - // limit the scratch buffer to between 4k and 64k (so data length fits into USHORT -- req'd for many commands) - DeviceExtension->ScratchContext.ScratchBufferSize = min(DeviceExtension->DeviceAdditionalData.MaxPageAlignedTransferBytes, (64*1024)); - - // allocate the buffer - if (NT_SUCCESS(status)) - { - DeviceExtension->ScratchContext.ScratchBuffer = ExAllocatePool2(POOL_FLAG_NON_PAGED, - DeviceExtension->ScratchContext.ScratchBufferSize, - CDROM_TAG_SCRATCH); - if (DeviceExtension->ScratchContext.ScratchBuffer == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "Failed to allocate scratch buffer of %x bytes\n", - DeviceExtension->ScratchContext.ScratchBufferSize - )); - } - else if (BYTE_OFFSET(DeviceExtension->ScratchContext.ScratchBuffer) != 0) - { - status = STATUS_INTERNAL_ERROR; - TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_INIT, - "Allocation of %x bytes non-paged pool was not " - "allocated on page boundary? STATUS_INTERNAL_ERROR\n", - DeviceExtension->ScratchContext.ScratchBufferSize - )); - } - } - - // allocate the MDL - if (NT_SUCCESS(status)) - { - DeviceExtension->ScratchContext.ScratchBufferMdl = IoAllocateMdl(DeviceExtension->ScratchContext.ScratchBuffer, - DeviceExtension->ScratchContext.ScratchBufferSize, - FALSE, FALSE, NULL); - if (DeviceExtension->ScratchContext.ScratchBufferMdl == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "Failed to allocate MDL for %x byte buffer\n", - DeviceExtension->ScratchContext.ScratchBufferSize - )); - } - else - { - MmBuildMdlForNonPagedPool(DeviceExtension->ScratchContext.ScratchBufferMdl); - } - } - - // create the request - if (NT_SUCCESS(status)) - { - WDF_OBJECT_ATTRIBUTES attributes; - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, - CDROM_REQUEST_CONTEXT); - - status = WdfRequestCreate(&attributes, - DeviceExtension->IoTarget, - &DeviceExtension->ScratchContext.ScratchRequest); - - if ((!NT_SUCCESS(status)) || - (DeviceExtension->ScratchContext.ScratchRequest == NULL)) - { - status = STATUS_INSUFFICIENT_RESOURCES; - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "Failed to allocate scratch MDL \n")); - } - } - - // allocate the srb - if (NT_SUCCESS(status)) - { - DeviceExtension->ScratchContext.ScratchSrb = ExAllocatePool2(POOL_FLAG_NON_PAGED, - sizeof(SCSI_REQUEST_BLOCK), - CDROM_TAG_SCRATCH); - - if (DeviceExtension->ScratchContext.ScratchSrb == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "Failed to allocate scratch SRB\n")); - } - } - - // allocate the sense buffer - if (NT_SUCCESS(status)) - { - DeviceExtension->ScratchContext.ScratchSense = ExAllocatePool2(POOL_FLAG_NON_PAGED, - sizeof(SENSE_DATA), - CDROM_TAG_SCRATCH); - - if (DeviceExtension->ScratchContext.ScratchSense == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "Failed to allocate scratch sense data\n" - )); - } - } - - // allocate the SRB history data - if (NT_SUCCESS(status)) - { - size_t allocationSize = sizeof(SRB_HISTORY) - sizeof(SRB_HISTORY_ITEM); - allocationSize += 20 * sizeof(SRB_HISTORY_ITEM); - - DeviceExtension->ScratchContext.ScratchHistory = ExAllocatePool2(POOL_FLAG_NON_PAGED, - allocationSize, - CDROM_TAG_SCRATCH); - if (DeviceExtension->ScratchContext.ScratchHistory == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "Failed to allocate scratch history buffer\n" - )); - } - else - { - // must be initialized here... - DeviceExtension->ScratchContext.ScratchHistory->TotalHistoryCount = 20; - } - } - - // allocate the MDL - if (NT_SUCCESS(status)) - { - ULONG transferLength = 0; - - status = RtlULongAdd(DeviceExtension->DeviceAdditionalData.MaxPageAlignedTransferBytes, PAGE_SIZE, &transferLength); - if (NT_SUCCESS(status)) - { - DeviceExtension->ScratchContext.PartialMdlIsBuilt = FALSE; - DeviceExtension->ScratchContext.PartialMdl = IoAllocateMdl(NULL, - transferLength, - FALSE, - FALSE, - NULL); - if (DeviceExtension->ScratchContext.PartialMdl == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "Failed to allocate MDL for %x byte buffer\n", - DeviceExtension->ScratchContext.ScratchBufferSize - )); - } - else - { - NT_ASSERT(DeviceExtension->ScratchContext.PartialMdl->Size >= - (CSHORT)(sizeof(MDL) + BYTES_TO_PAGES(DeviceExtension->DeviceAdditionalData.MaxPageAlignedTransferBytes) * sizeof(PFN_NUMBER))); - } - } - else - { - status = STATUS_INTEGER_OVERFLOW; - } - } - - // cleanup on failure - if (!NT_SUCCESS(status)) - { - ScratchBuffer_Deallocate(DeviceExtension); - } - - return NT_SUCCESS(status); -} - - -VOID -ScratchBuffer_ResetItems( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN ResetRequestHistory - ) -/*++ - -Routine Description: - - reset scratch items for reuse. - -Arguments: - - DeviceExtension - device extension - ResetRequestHistory - reset history fields or not - -Return Value: - - none - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - WDF_REQUEST_REUSE_PARAMS reuseParams; - PIRP irp = NULL; - - NT_ASSERT(DeviceExtension->ScratchContext.ScratchHistory != NULL); - NT_ASSERT(DeviceExtension->ScratchContext.ScratchSense != NULL); - NT_ASSERT(DeviceExtension->ScratchContext.ScratchSrb != NULL); - NT_ASSERT(DeviceExtension->ScratchContext.ScratchRequest != NULL); - NT_ASSERT(DeviceExtension->ScratchContext.ScratchBufferSize != 0); - NT_ASSERT(DeviceExtension->ScratchContext.ScratchBuffer != NULL); - NT_ASSERT(DeviceExtension->ScratchContext.ScratchBufferMdl != NULL); - NT_ASSERT(DeviceExtension->ScratchContext.ScratchInUse != 0); - - irp = WdfRequestWdmGetIrp(DeviceExtension->ScratchContext.ScratchRequest); - - if (ResetRequestHistory) - { - PSRB_HISTORY history = DeviceExtension->ScratchContext.ScratchHistory; - RtlZeroMemory(history->History, sizeof(SRB_HISTORY_ITEM) * history->TotalHistoryCount); - history->ClassDriverUse[0] = 0; - history->ClassDriverUse[1] = 0; - history->ClassDriverUse[2] = 0; - history->ClassDriverUse[3] = 0; - history->UsedHistoryCount = 0; - } - - // re-use the KMDF request object - - // deassign the MdlAddress, this is the value we assign explicitly. - // this is to prevent WdfRequestReuse to release the Mdl unexpectly. - if (irp->MdlAddress) - { - irp->MdlAddress = NULL; - } - - WDF_REQUEST_REUSE_PARAMS_INIT(&reuseParams, WDF_REQUEST_REUSE_NO_FLAGS, STATUS_NOT_SUPPORTED); - status = WdfRequestReuse(DeviceExtension->ScratchContext.ScratchRequest, &reuseParams); - // WDF request to format the request befor sending it - if (NT_SUCCESS(status)) - { - // clean up completion routine. - WdfRequestSetCompletionRoutine(DeviceExtension->ScratchContext.ScratchRequest, NULL, NULL); - - status = WdfIoTargetFormatRequestForInternalIoctlOthers(DeviceExtension->IoTarget, - DeviceExtension->ScratchContext.ScratchRequest, - IOCTL_SCSI_EXECUTE_IN, - NULL, NULL, - NULL, NULL, - NULL, NULL); - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "ScratchBuffer_ResetItems: WdfIoTargetFormatRequestForInternalIoctlOthers failed, %!STATUS!\n", - status)); - } - } - - RtlZeroMemory(DeviceExtension->ScratchContext.ScratchSense, sizeof(SENSE_DATA)); - RtlZeroMemory(DeviceExtension->ScratchContext.ScratchSrb, sizeof(SCSI_REQUEST_BLOCK)); - - return; -} - - -NTSTATUS -ScratchBuffer_PerformNextReadWrite( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN FirstTry - ) -/*++ - -Routine Description: - - This function asynchronously sends the next read/write SRB down the stack. - -Arguments: - - DeviceExtension - Device extension - -Return Value: - - none - ---*/ -{ - PCDROM_SCRATCH_READ_WRITE_CONTEXT readWriteContext = &DeviceExtension->ScratchContext.ScratchReadWriteContext; - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(DeviceExtension->ScratchContext.ScratchRequest); - WDFREQUEST originalRequest = requestContext->OriginalRequest; - NTSTATUS status = STATUS_SUCCESS; - - ULONG transferSize; - BOOLEAN usePartialMdl; - - transferSize = min((readWriteContext->EntireXferLen - readWriteContext->TransferedBytes), readWriteContext->MaxLength); - - if (FirstTry) - { - DeviceExtension->ScratchContext.NumRetries = 0; - } - - ScratchBuffer_ResetItems(DeviceExtension, FALSE); - - usePartialMdl = (readWriteContext->PacketsCount > 1 || readWriteContext->TransferedBytes > 0); - - ScratchBuffer_SetupReadWriteSrb(DeviceExtension, - originalRequest, - readWriteContext->StartingOffset, - transferSize, - readWriteContext->DataBuffer, - readWriteContext->IsRead, - usePartialMdl - ); - - WdfRequestSetCompletionRoutine(DeviceExtension->ScratchContext.ScratchRequest, - ScratchBuffer_ReadWriteCompletionRoutine, DeviceExtension); - - status = ScratchBuffer_SendSrb(DeviceExtension, FALSE, (FirstTry ? &readWriteContext->SrbHistoryItem : NULL)); - - return status; -} - - -VOID -ScratchBuffer_ReadWriteTimerRoutine( - struct _KDPC *Dpc, - PVOID DeferredContext, - PVOID SystemArgument1, - PVOID SystemArgument2 - ) -/*++ - -Routine Description: - - Timer routine for retrying read and write requests. - -Arguments: - - Timer - WDF timer - -Return Value: - - none - ---*/ -{ - PCDROM_DEVICE_EXTENSION deviceExtension = NULL; - PCDROM_SCRATCH_READ_WRITE_CONTEXT readWriteContext = NULL; - WDFREQUEST originalRequest = NULL; - PCDROM_REQUEST_CONTEXT requestContext = NULL; - NTSTATUS status = STATUS_SUCCESS; - KIRQL oldIrql; - - UNREFERENCED_PARAMETER(Dpc); - UNREFERENCED_PARAMETER(SystemArgument1); - UNREFERENCED_PARAMETER(SystemArgument2); - - if (DeferredContext == NULL) - { - // This is impossible, but definition of KDEFERRED_ROUTINE allows optional argument, - // and thus OACR will complain. - - return; - } - - originalRequest = (WDFREQUEST) DeferredContext; - requestContext = RequestGetContext(originalRequest); - - KeAcquireSpinLock(&requestContext->ReadWriteCancelSpinLock, &oldIrql); - - if (!requestContext->ReadWriteIsCompleted) - { - // As the first step, unregister the cancellation routine - status = WdfRequestUnmarkCancelable(originalRequest); - } - else - { - status = STATUS_CANCELLED; - } - - KeReleaseSpinLock(&requestContext->ReadWriteCancelSpinLock, oldIrql); - - if (status != STATUS_CANCELLED) - { - deviceExtension = requestContext->DeviceExtension; - readWriteContext = &deviceExtension->ScratchContext.ScratchReadWriteContext; - - // We use timer only for retries, that's why the second parameter is always FALSE - status = ScratchBuffer_PerformNextReadWrite(deviceExtension, FALSE); - - if (!NT_SUCCESS(status)) - { - ScratchBuffer_EndUse(deviceExtension); - RequestCompletion(deviceExtension, originalRequest, status, readWriteContext->TransferedBytes); - } - } - - // - // Drop the extra reference - // - WdfObjectDereference(originalRequest); -} - - -EVT_WDF_REQUEST_CANCEL ScratchBuffer_ReadWriteEvtRequestCancel; - -VOID -ScratchBuffer_ReadWriteEvtRequestCancel( - _In_ WDFREQUEST Request - ) -/*++ - -Routine Description: - - Cancels a request waiting for the read/write timer to expire. This function does not - support cancellation of requests that have already been sent down. - -Arguments: - - Request - WDF request - -Return Value: - - none - ---*/ -{ - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request); - PCDROM_DEVICE_EXTENSION deviceExtension = requestContext->DeviceExtension; - PCDROM_SCRATCH_READ_WRITE_CONTEXT readWriteContext = &deviceExtension->ScratchContext.ScratchReadWriteContext; - KIRQL oldIrql; - - KeAcquireSpinLock(&requestContext->ReadWriteCancelSpinLock, &oldIrql); - - if (KeCancelTimer(&requestContext->ReadWriteTimer)) - { - // - // Timer is canceled, we own the request. Drop the reference we took before - // queueing the timer. - // - WdfObjectDereference(Request); - } - else - { - // - // Timer will run and drop the reference but it won't complete the request - // because we set IsCompleted to TRUE - // - } - - requestContext->ReadWriteIsCompleted = TRUE; - - KeReleaseSpinLock(&requestContext->ReadWriteCancelSpinLock, oldIrql); - - ScratchBuffer_EndUse(deviceExtension); - - // If WdfTimerStop returned TRUE, it means this request was scheduled for a retry - // and the retry has not happened yet. We just need to cancel it and release the scratch buffer. - RequestCompletion(deviceExtension, Request, STATUS_CANCELLED, readWriteContext->TransferedBytes); -} - -VOID -ScratchBuffer_ReadWriteCompletionRoutine( - _In_ WDFREQUEST Request, - _In_ WDFIOTARGET Target, - _In_ PWDF_REQUEST_COMPLETION_PARAMS Params, - _In_ WDFCONTEXT Context - ) -/*++ - -Routine Description: - - Read/write request completion routine. - -Arguments: - Request - WDF request - Target - The IO target the request was completed by. - Params - the request completion parameters - Context - context - -Return Value: - - none - ---*/ -{ - PCDROM_DEVICE_EXTENSION deviceExtension = (PCDROM_DEVICE_EXTENSION) Context; - PCDROM_SCRATCH_READ_WRITE_CONTEXT readWriteContext = &deviceExtension->ScratchContext.ScratchReadWriteContext; - NTSTATUS status = STATUS_SUCCESS; - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(deviceExtension->ScratchContext.ScratchRequest); - WDFREQUEST originalRequest = requestContext->OriginalRequest; - - if (!NT_SUCCESS(WdfRequestGetStatus(Request))) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_INIT, - "WdfRequestSend: %lx\n", - WdfRequestGetStatus(Request) - )); - } - - UNREFERENCED_PARAMETER(Params); - UNREFERENCED_PARAMETER(Target); - - // We are not calling ScratchBuffer_BeginUse / ScratchBuffer_EndUse in this function, because we already own - // the scratch buffer if this function is being called. - - if ((deviceExtension->ScratchContext.ScratchSrb->SrbStatus == SRB_STATUS_ABORTED) && - (deviceExtension->ScratchContext.ScratchSrb->InternalStatus == STATUS_CANCELLED)) - { - // The request has been cancelled, just need to complete it - } - else if (SRB_STATUS(deviceExtension->ScratchContext.ScratchSrb->SrbStatus) != SRB_STATUS_SUCCESS) - { - // The SCSI command that we sent down has failed, retry it if necessary - BOOLEAN shouldRetry = TRUE; - LONGLONG retryIn100nsUnits = 0; - - shouldRetry = RequestSenseInfoInterpretForScratchBuffer(deviceExtension, - deviceExtension->ScratchContext.NumRetries, - &status, - &retryIn100nsUnits); - - if (shouldRetry) - { - deviceExtension->ScratchContext.NumRetries++; - - if (retryIn100nsUnits == 0) - { - // We take a shortcut here by calling ScratchBuffer_PerformNextReadWrite directly: - // this helps to avoid unnecessary context switch. - status = ScratchBuffer_PerformNextReadWrite(deviceExtension, FALSE); - - if (NT_SUCCESS(status)) - { - // We're not done with the request yet, no need to complete it now - return; - } - } - else - { - PCDROM_REQUEST_CONTEXT originalRequestContext = RequestGetContext(originalRequest); - KIRQL oldIrql; - - // - // Initialize the spin lock and timer local to the original request. - // - if (!originalRequestContext->ReadWriteRetryInitialized) - { - KeInitializeSpinLock(&originalRequestContext->ReadWriteCancelSpinLock); - KeInitializeTimer(&originalRequestContext->ReadWriteTimer); - KeInitializeDpc(&originalRequestContext->ReadWriteDpc, ScratchBuffer_ReadWriteTimerRoutine, originalRequest); - originalRequestContext->ReadWriteRetryInitialized = TRUE; - } - - KeAcquireSpinLock(&requestContext->ReadWriteCancelSpinLock, &oldIrql); - - status = WdfRequestMarkCancelableEx(originalRequest, ScratchBuffer_ReadWriteEvtRequestCancel); - - if (status == STATUS_CANCELLED) - { - requestContext->ReadWriteIsCompleted = TRUE; - - KeReleaseSpinLock(&requestContext->ReadWriteCancelSpinLock, oldIrql); - } - else - { - LARGE_INTEGER t; - - t.QuadPart = -retryIn100nsUnits; - - WdfObjectReference(originalRequest); - - // Use negative time to indicate that we want a relative delay - KeSetTimer(&originalRequestContext->ReadWriteTimer, - t, - &originalRequestContext->ReadWriteDpc - ); - - KeReleaseSpinLock(&requestContext->ReadWriteCancelSpinLock, oldIrql); - - return; - } - } - } - } - else - { - // The SCSI command has succeeded - readWriteContext->DataBuffer += deviceExtension->ScratchContext.ScratchSrb->DataTransferLength; - readWriteContext->StartingOffset.QuadPart += deviceExtension->ScratchContext.ScratchSrb->DataTransferLength; - readWriteContext->TransferedBytes += deviceExtension->ScratchContext.ScratchSrb->DataTransferLength; - readWriteContext->PacketsCount--; - - // Update the SRB history item - if (readWriteContext->SrbHistoryItem) - { - ULONG senseSize; - - // Query the tick count and store in the history - KeQueryTickCount(&readWriteContext->SrbHistoryItem->TickCountCompleted); - - // Copy the SRB Status... - readWriteContext->SrbHistoryItem->SrbStatus = deviceExtension->ScratchContext.ScratchSrb->SrbStatus; - - // Determine the amount of valid sense data - if (deviceExtension->ScratchContext.ScratchSrb->SenseInfoBufferLength >= - RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseLength)) - { - PSENSE_DATA sense = (PSENSE_DATA)deviceExtension->ScratchContext.ScratchSrb->SenseInfoBuffer; - senseSize = RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseLength) + - sense->AdditionalSenseLength; - senseSize = min(senseSize, sizeof(SENSE_DATA)); - } - else - { - senseSize = deviceExtension->ScratchContext.ScratchSrb->SenseInfoBufferLength; - } - - // Normalize the sense data copy in the history - RtlZeroMemory(&(readWriteContext->SrbHistoryItem->NormalizedSenseData), sizeof(SENSE_DATA)); - RtlCopyMemory(&(readWriteContext->SrbHistoryItem->NormalizedSenseData), - deviceExtension->ScratchContext.ScratchSrb->SenseInfoBuffer, senseSize); - } - - // Check whether we need to send more SCSI commands to complete the request - if (readWriteContext->PacketsCount > 0) - { - status = ScratchBuffer_PerformNextReadWrite(deviceExtension, TRUE); - - if (NT_SUCCESS(status)) - { - // We're not done with the request yet, no need to complete it now - return; - } - } - } - - ScratchBuffer_EndUse(deviceExtension); - - - RequestCompletion(deviceExtension, originalRequest, status, readWriteContext->TransferedBytes); -} - -_IRQL_requires_max_(APC_LEVEL) -VOID -ScratchBuffer_SetupSrb( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ WDFREQUEST OriginalRequest, - _In_ ULONG MaximumTransferLength, - _In_ BOOLEAN GetDataFromDevice - ) -/*++ - -Routine Description: - - setup scratch SRB for sending out. - -Arguments: - - DeviceExtension - device extension - OriginalRequest - original request delivered by WDF - MaximumTransferLength - transfer length - GetDataFromDevice - TRUE (get data from device); FALSE (send data to device) - -Return Value: - - none - ---*/ -{ - WDFREQUEST request = DeviceExtension->ScratchContext.ScratchRequest; - PIRP irp = WdfRequestWdmGetIrp(request); - PSCSI_REQUEST_BLOCK srb = DeviceExtension->ScratchContext.ScratchSrb; - PIO_STACK_LOCATION irpStack = NULL; - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(request); - - PAGED_CODE (); - - requestContext->OriginalRequest = OriginalRequest; - - // set to use the full scratch buffer via the scratch SRB - irpStack = IoGetNextIrpStackLocation(irp); - irpStack->MajorFunction = IRP_MJ_SCSI; - if (MaximumTransferLength == 0) - { - irpStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_SCSI_EXECUTE_NONE; - } - else if (GetDataFromDevice) - { - irpStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_SCSI_EXECUTE_IN; - } - else - { - irpStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_SCSI_EXECUTE_OUT; - } - irpStack->Parameters.Scsi.Srb = srb; - - if (MaximumTransferLength > 0) - { - // the Irp must show the MDL's address for the transfer - irp->MdlAddress = DeviceExtension->ScratchContext.ScratchBufferMdl; - - srb->DataBuffer = DeviceExtension->ScratchContext.ScratchBuffer; - } - - // prepare the SRB with default values - srb->Length = SCSI_REQUEST_BLOCK_SIZE; - srb->Function = SRB_FUNCTION_EXECUTE_SCSI; - srb->QueueAction = SRB_SIMPLE_TAG_REQUEST; - srb->SrbStatus = 0; - srb->ScsiStatus = 0; - srb->NextSrb = NULL; - srb->OriginalRequest = irp; - srb->SenseInfoBufferLength = SENSE_BUFFER_SIZE; - srb->SenseInfoBuffer = DeviceExtension->ScratchContext.ScratchSense; - - srb->CdbLength = 16; // to cause failures if not set correctly -- CD devices limited to 12 bytes for now... - - srb->DataTransferLength = min(DeviceExtension->ScratchContext.ScratchBufferSize, MaximumTransferLength); - srb->TimeOutValue = DeviceExtension->TimeOutValue; - srb->SrbFlags = DeviceExtension->SrbFlags; - SET_FLAG(srb->SrbFlags, SRB_FLAGS_DISABLE_SYNCH_TRANSFER); - SET_FLAG(srb->SrbFlags, SRB_FLAGS_NO_QUEUE_FREEZE); - - if (MaximumTransferLength == 0) - { - SET_FLAG(srb->SrbFlags, SRB_FLAGS_NO_DATA_TRANSFER); - } - else if (GetDataFromDevice) - { - SET_FLAG(srb->SrbFlags, SRB_FLAGS_DATA_IN); - } - else - { - SET_FLAG(srb->SrbFlags, SRB_FLAGS_DATA_OUT); - } -} - - -NTSTATUS -ScratchBuffer_SendSrb( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN SynchronousSrb, - _When_(SynchronousSrb, _Pre_null_) - _When_(!SynchronousSrb, _In_opt_) - PSRB_HISTORY_ITEM *SrbHistoryItem - ) -/*++ - -Routine Description: - - Send the command from the scratch SRB to lower driver and retry if necessary. - -Arguments: - - DeviceExtension - device extension - SynchronousSrb - indicates whether the SRB needs to be sent synchronously or nor - SrbHistoryItem - storage for SRB history item, if this is an asynchronous request - -Return Value: - - none - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PSCSI_REQUEST_BLOCK srb = DeviceExtension->ScratchContext.ScratchSrb; - PSRB_HISTORY history = DeviceExtension->ScratchContext.ScratchHistory; - PSRB_HISTORY_ITEM item = NULL; - BOOLEAN requestCancelled = FALSE; - - srb->InternalStatus = 0; - srb->SrbStatus = 0; - - // allocate/update history pre-command, if it is a synchronous request or we were supplied - // with a storage for the history item - if (SynchronousSrb || SrbHistoryItem != NULL) - { - // sending a packet implies a new history unit is to be used. - NT_ASSERT( history->UsedHistoryCount <= history->TotalHistoryCount ); - - // if already all used up, remove at least one history unit - if (history->UsedHistoryCount == history->TotalHistoryCount ) - { - CompressSrbHistoryData(history); - NT_ASSERT( history->UsedHistoryCount < history->TotalHistoryCount ); - } - - // thus, since we are about to increment the count, it must now be less... - NT_ASSERT( history->UsedHistoryCount < history->TotalHistoryCount ); - - // increment the number of history units in use - history->UsedHistoryCount++; - - // determine index to use - item = &( history->History[ history->UsedHistoryCount-1 ] ); - - if (SrbHistoryItem != NULL) - { - *SrbHistoryItem = item; - } - - // zero out the history item - RtlZeroMemory(item, sizeof(SRB_HISTORY_ITEM)); - - // Query the tick count and store in the history - KeQueryTickCount(&item->TickCountSent); - } - - // get cancellation status; - { - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(DeviceExtension->ScratchContext.ScratchRequest); - - if (requestContext->OriginalRequest != NULL) - { - requestCancelled = WdfRequestIsCanceled(requestContext->OriginalRequest); - } - } - - if (!requestCancelled) - { - status = RequestSend(DeviceExtension, - DeviceExtension->ScratchContext.ScratchRequest, - DeviceExtension->IoTarget, - SynchronousSrb ? WDF_REQUEST_SEND_OPTION_SYNCHRONOUS : 0, - NULL); - - // If this is a synchronous request, update the history item immediately, including "normalized" sense data - if (SynchronousSrb) - { - ULONG senseSize; - - // Query the tick count and store in the history - KeQueryTickCount(&item->TickCountCompleted); - - // Copy the SRB Status - item->SrbStatus = srb->SrbStatus; - - // Determine the amount of valid sense data - if (srb->SenseInfoBufferLength >= RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseLength)) - { - PSENSE_DATA sense = (PSENSE_DATA)srb->SenseInfoBuffer; - senseSize = RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseLength) + - sense->AdditionalSenseLength; - senseSize = min(senseSize, sizeof(SENSE_DATA)); - } - else - { - senseSize = srb->SenseInfoBufferLength; - } - - // Normalize the sense data copy in the history - RtlZeroMemory(&(item->NormalizedSenseData), sizeof(SENSE_DATA)); - RtlCopyMemory(&(item->NormalizedSenseData), srb->SenseInfoBuffer, senseSize); - } - } - else - { - DeviceExtension->ScratchContext.ScratchSrb->SrbStatus = SRB_STATUS_ABORTED; - DeviceExtension->ScratchContext.ScratchSrb->InternalStatus = (ULONG)STATUS_CANCELLED; - status = STATUS_CANCELLED; - } - - return status; -} - -VOID -CompressSrbHistoryData( - _Inout_ PSRB_HISTORY RequestHistory - ) -/*++ - -Routine Description: - - compress the SRB history data. - -Arguments: - - RequestHistory - SRB history data - -Return Value: - - RequestHistory - compressed history data - ---*/ -{ - ULONG i; - NT_ASSERT( RequestHistory->UsedHistoryCount == RequestHistory->TotalHistoryCount ); - ValidateSrbHistoryDataPresumptions(RequestHistory); - - for (i=0; i < RequestHistory->UsedHistoryCount; i++) - { - // for each item... - PSRB_HISTORY_ITEM toMatch = &( RequestHistory->History[i] ); - // hint: read const qualifiers backwards. i.e. srbstatus is a const UCHAR - // so, "UCHAR const * const x" is read "x is a const pointer to a const UCHAR" - // unfortunately, "const UCHAR" is equivalent to "UCHAR const", which causes - // people no end of confusion due to its widespread use. - UCHAR const srbStatus = toMatch->SrbStatus; - UCHAR const sense = toMatch->NormalizedSenseData.SenseKey; - UCHAR const asc = toMatch->NormalizedSenseData.AdditionalSenseCode; - UCHAR const ascq = toMatch->NormalizedSenseData.AdditionalSenseCodeQualifier; - ULONG j; - - // see if there are any at higher indices with identical Sense/ASC/ASCQ - for (j = i+1; (toMatch->ClassDriverUse != 0xFF) && (j < RequestHistory->UsedHistoryCount); j++) - { - PSRB_HISTORY_ITEM found = &( RequestHistory->History[j] ); - // close enough match? - if ((srbStatus == found->SrbStatus) && - (sense == found->NormalizedSenseData.SenseKey) && - (asc == found->NormalizedSenseData.AdditionalSenseCode) && - (ascq == found->NormalizedSenseData.AdditionalSenseCodeQualifier)) { - - // add the fields to keep reasonable track of delay times. - if (toMatch->MillisecondsDelayOnRetry + found->MillisecondsDelayOnRetry < toMatch->MillisecondsDelayOnRetry) { - toMatch->MillisecondsDelayOnRetry = MAXULONG; - } else { - toMatch->MillisecondsDelayOnRetry += found->MillisecondsDelayOnRetry; - } - - // this found item cannot contain any compressed entries because - // the first entry with a given set of sense/asc/ascq will always - // either be full (0xFF) or be the only partially-full entry with - // that sense/asc/ascq. - NT_ASSERT(found->ClassDriverUse == 0); - // add the counts so we still know how many retries total - toMatch->ClassDriverUse++; - - - // if not the last entry, need to move later entries earlier in the array - if (j != RequestHistory->UsedHistoryCount-1) { - // how many entries remain? - SIZE_T remainingBytes = RequestHistory->UsedHistoryCount - 1 - j; - remainingBytes *= sizeof(SRB_HISTORY_ITEM); - - // note that MOVE is required due to overlapping entries - RtlMoveMemory(found, found+1, remainingBytes); - - // Finally, decrement the number of used history count and - // decrement j to rescan the current location again - --RequestHistory->UsedHistoryCount; - --j; - } // end moving of array elements around - } // end of close enough match - } // end j loop - } // end i loop - - // unable to compress duplicate sense/asc/ascq, so just lose the most recent data - if (RequestHistory->UsedHistoryCount == RequestHistory->TotalHistoryCount) - { - PSRB_HISTORY_ITEM item = &( RequestHistory->History[ RequestHistory->TotalHistoryCount-1 ] ); - RequestHistory->ClassDriverUse[0] += item->ClassDriverUse; // how many did we "lose"? - RequestHistory->UsedHistoryCount--; - } - - // finally, zero any that are no longer in use - NT_ASSERT( RequestHistory->UsedHistoryCount != RequestHistory->TotalHistoryCount); - { - SIZE_T bytesToZero = RequestHistory->TotalHistoryCount - RequestHistory->UsedHistoryCount; - bytesToZero *= sizeof(SRB_HISTORY_ITEM); - RtlZeroMemory(&(RequestHistory->History[RequestHistory->UsedHistoryCount]), bytesToZero); - } - - ValidateSrbHistoryDataPresumptions(RequestHistory); - return; -} - -VOID -ValidateSrbHistoryDataPresumptions( - _In_ SRB_HISTORY const * RequestHistory - ) -{ -#if DBG - // validate that all fully-compressed items are before any non-fully-compressed items of any particular sense/asc/ascq - // validate that there is at most one partially-compressed item of any particular sense/asc/ascq - // validate that all items of any particular sense/asc/ascq that are uncompressed are at the end - // THUS: A(255) A(255) A( 40) A( 0) A( 0) is legal for all types with A as sense/asc/ascq - // A(0) B(255) A( 0) B( 17) B( 0) is also legal because A/B are different types of error - - ULONG i; - for (i = 0; i < RequestHistory->UsedHistoryCount; i++) - { - SRB_HISTORY_ITEM const * toMatch = &( RequestHistory->History[i] ); - UCHAR const srbStatus = toMatch->SrbStatus; - UCHAR const sense = toMatch->NormalizedSenseData.SenseKey; - UCHAR const asc = toMatch->NormalizedSenseData.AdditionalSenseCode; - UCHAR const ascq = toMatch->NormalizedSenseData.AdditionalSenseCodeQualifier; - ULONG j; - - BOOLEAN foundPartiallyCompressedItem = - (toMatch->ClassDriverUse != 0) && - (toMatch->ClassDriverUse != 0xFF) ; - BOOLEAN foundUncompressedItem = - (toMatch->ClassDriverUse == 0) ; - - for (j = i+1; j < RequestHistory->UsedHistoryCount; j++) - { - SRB_HISTORY_ITEM const * found = &( RequestHistory->History[j] ); - if ((srbStatus == found->SrbStatus) && - (sense == found->NormalizedSenseData.SenseKey) && - (asc == found->NormalizedSenseData.AdditionalSenseCode) && - (ascq == found->NormalizedSenseData.AdditionalSenseCodeQualifier) - ) - { - // found a matching type, so validate ordering rules - if (foundUncompressedItem && (found->ClassDriverUse != 0)) - { - DbgPrintEx(DPFLTR_CDROM_ID, DPFLTR_ERROR_LEVEL, - "History data has compressed history following uncompressed history " - "for srbstatus/sense/asc/ascq of %02x/%02x/%02x/%02x at indices %d (%08x) and %d (%08x)\n", - srbStatus, sense, asc, ascq, - i,i, j,j - ); - NT_ASSERT(FALSE); - } - else if (foundPartiallyCompressedItem && (found->ClassDriverUse == 0xFF)) - { - DbgPrintEx(DPFLTR_CDROM_ID, DPFLTR_ERROR_LEVEL, - "History data has fully compressed history following partially compressed history " - "for srbstatus/sense/asc/ascq of %02x/%02x/%02x/%02x at indices %d (%08x) and %d (%08x)\n", - srbStatus, sense, asc, ascq, - i,i, j,j - ); - NT_ASSERT(FALSE); - } - - // update if we have now found partially compressed and/or uncompressed items - if (found->ClassDriverUse == 0) - { - foundUncompressedItem = TRUE; - } - else if (found->ClassDriverUse != 0xFF) - { - foundPartiallyCompressedItem = TRUE; - } - } // end match of (toMatch,found) - } // end loop j - } // end loop i -#else - UNREFERENCED_PARAMETER(RequestHistory); -#endif - return; -} - -VOID -ScratchBuffer_SetupReadWriteSrb( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST OriginalRequest, - _In_ LARGE_INTEGER StartingOffset, - _In_ ULONG RequiredLength, - _Inout_updates_bytes_(RequiredLength) UCHAR* DataBuffer, - _In_ BOOLEAN IsReadRequest, - _In_ BOOLEAN UsePartialMdl - ) -/*++ - -Routine Description: - - setup SRB for read/write request. - -Arguments: - - DeviceExtension - device extension - OriginalRequest - read/write request - StartingOffset - read/write starting offset - DataBuffer - buffer for read/write - IsReadRequest - TRUE (read); FALSE (write) - -Return Value: - - none - ---*/ -{ - //NOTE: R/W request not use the ScratchBuffer, instead, it uses the buffer associated with IRP. - - PSCSI_REQUEST_BLOCK srb = DeviceExtension->ScratchContext.ScratchSrb; - PCDB cdb = (PCDB)srb->Cdb; - LARGE_INTEGER logicalBlockAddr; - ULONG numTransferBlocks; - - PIRP originalIrp = WdfRequestWdmGetIrp(OriginalRequest); - - PIRP irp = WdfRequestWdmGetIrp(DeviceExtension->ScratchContext.ScratchRequest); - PIO_STACK_LOCATION irpStack = NULL; - - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(DeviceExtension->ScratchContext.ScratchRequest); - - requestContext->OriginalRequest = OriginalRequest; - - - logicalBlockAddr.QuadPart = Int64ShrlMod32(StartingOffset.QuadPart, DeviceExtension->SectorShift); - numTransferBlocks = RequiredLength >> DeviceExtension->SectorShift; - - // set to use the full scratch buffer via the scratch SRB - irpStack = IoGetNextIrpStackLocation(irp); - irpStack->MajorFunction = IRP_MJ_SCSI; - if (IsReadRequest) - { - irpStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_SCSI_EXECUTE_IN; - } - else - { - irpStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_SCSI_EXECUTE_OUT; - } - irpStack->Parameters.Scsi.Srb = srb; - - // prepare the SRB with default values - srb->Length = SCSI_REQUEST_BLOCK_SIZE; - srb->Function = SRB_FUNCTION_EXECUTE_SCSI; - srb->QueueAction = SRB_SIMPLE_TAG_REQUEST; - srb->SrbStatus = 0; - srb->ScsiStatus = 0; - srb->NextSrb = NULL; - srb->SenseInfoBufferLength = SENSE_BUFFER_SIZE; - srb->SenseInfoBuffer = DeviceExtension->ScratchContext.ScratchSense; - - srb->DataBuffer = DataBuffer; - srb->DataTransferLength = RequiredLength; - - srb->QueueSortKey = logicalBlockAddr.LowPart; - if (logicalBlockAddr.QuadPart > 0xFFFFFFFF) - { - // - // If the requested LBA is more than max ULONG set the - // QueueSortKey to the maximum value, so that these - // requests can be added towards the end of the queue. - // - srb->QueueSortKey = 0xFFFFFFFF; - } - - srb->OriginalRequest = irp; - srb->TimeOutValue = DeviceExtension->TimeOutValue; - - if (RequestIsRealtimeStreaming(OriginalRequest, IsReadRequest) && - !TEST_FLAG(DeviceExtension->PrivateFdoData->HackFlags, FDO_HACK_NO_STREAMING)) - { - if (IsReadRequest) - { - RtlZeroMemory(&cdb->READ12, sizeof(cdb->READ12)); - REVERSE_BYTES(&cdb->READ12.LogicalBlock, &logicalBlockAddr.LowPart); - REVERSE_BYTES(&cdb->READ12.TransferLength, &numTransferBlocks); - cdb->READ12.Streaming = 1; - cdb->READ12.OperationCode = SCSIOP_READ12; - srb->CdbLength = sizeof(cdb->READ12); - } - else - { - RtlZeroMemory(&cdb->WRITE12, sizeof(cdb->WRITE12)); - REVERSE_BYTES(&cdb->WRITE12.LogicalBlock, &logicalBlockAddr.LowPart); - REVERSE_BYTES(&cdb->WRITE12.TransferLength, &numTransferBlocks); - cdb->WRITE12.Streaming = 1; - cdb->WRITE12.OperationCode = SCSIOP_WRITE12; - srb->CdbLength = sizeof(cdb->WRITE12); - } - } - else - { - RtlZeroMemory(&cdb->CDB10, sizeof(cdb->CDB10)); - cdb->CDB10.LogicalBlockByte0 = ((PFOUR_BYTE)&logicalBlockAddr.LowPart)->Byte3; - cdb->CDB10.LogicalBlockByte1 = ((PFOUR_BYTE)&logicalBlockAddr.LowPart)->Byte2; - cdb->CDB10.LogicalBlockByte2 = ((PFOUR_BYTE)&logicalBlockAddr.LowPart)->Byte1; - cdb->CDB10.LogicalBlockByte3 = ((PFOUR_BYTE)&logicalBlockAddr.LowPart)->Byte0; - cdb->CDB10.TransferBlocksMsb = ((PFOUR_BYTE)&numTransferBlocks)->Byte1; - cdb->CDB10.TransferBlocksLsb = ((PFOUR_BYTE)&numTransferBlocks)->Byte0; - cdb->CDB10.OperationCode = (IsReadRequest) ? SCSIOP_READ : SCSIOP_WRITE; - srb->CdbLength = sizeof(cdb->CDB10); - } - - // Set SRB and IRP flags - srb->SrbFlags = DeviceExtension->SrbFlags; - if (TEST_FLAG(originalIrp->Flags, IRP_PAGING_IO) || - TEST_FLAG(originalIrp->Flags, IRP_SYNCHRONOUS_PAGING_IO)) - { - SET_FLAG(srb->SrbFlags, SRB_CLASS_FLAGS_PAGING); - } - - SET_FLAG(srb->SrbFlags, (IsReadRequest) ? SRB_FLAGS_DATA_IN : SRB_FLAGS_DATA_OUT); - SET_FLAG(srb->SrbFlags, SRB_FLAGS_ADAPTER_CACHE_ENABLE); - - // - // If the request is not split, we can use the original IRP MDL. If the - // request needs to be split, we need to use a partial MDL. The partial MDL - // is needed because more than one driver might be mapping the same MDL - // and this causes problems. - // - if (UsePartialMdl == FALSE) - { - irp->MdlAddress = originalIrp->MdlAddress; - } - else - { - if (DeviceExtension->ScratchContext.PartialMdlIsBuilt != FALSE) - { - MmPrepareMdlForReuse(DeviceExtension->ScratchContext.PartialMdl); - } - - IoBuildPartialMdl(originalIrp->MdlAddress, DeviceExtension->ScratchContext.PartialMdl, srb->DataBuffer, srb->DataTransferLength); - DeviceExtension->ScratchContext.PartialMdlIsBuilt = TRUE; - irp->MdlAddress = DeviceExtension->ScratchContext.PartialMdl; - } - - //DBGLOGSENDPACKET(Pkt); - //HISTORYLOGSENDPACKET(Pkt); - - // - // Set the original irp here for SFIO. - // - srb->SrbExtension = (PVOID)(originalIrp); - - return; -} - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -ScratchBuffer_ExecuteCdbEx( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ WDFREQUEST OriginalRequest, - _In_ ULONG TransferSize, - _In_ BOOLEAN GetDataFromDevice, - _In_ PCDB Cdb, - _In_ UCHAR OprationLength, - _In_ ULONG TimeoutValue - ) -/*++ - -Routine Description: - - Use Scratch buffer to send the Cdb, check error and retry if necessary. - -Arguments: - - DeviceExtension - device context - OriginalRequest - original request that requires this CDB operation - TransferSize - Data transfer size required - GetFromDevice - TRUE if getting data from device. - Cdb - SCSI command - OprationLength - SCSI command length: 6, 10 or 12 - TimeoutValue - if > 0, use it as timeout value for command - if 0, use the default device timeout value - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PSCSI_REQUEST_BLOCK srb = DeviceExtension->ScratchContext.ScratchSrb; - PCDB cdb = (PCDB)(srb->Cdb); - - BOOLEAN shouldRetry = TRUE; - ULONG timesAlreadyRetried = 0; - LONGLONG retryIn100nsUnits = 0; - - PAGED_CODE (); - - while (shouldRetry) - { - ScratchBuffer_SetupSrb(DeviceExtension, OriginalRequest, TransferSize, GetDataFromDevice); - - // Set up the SRB/CDB - RtlCopyMemory(cdb, Cdb, sizeof(CDB)); - - srb->CdbLength = OprationLength; - - if (TimeoutValue > 0) - { - srb->TimeOutValue = TimeoutValue; - } - - ScratchBuffer_SendSrb(DeviceExtension, TRUE, NULL); - - if ((DeviceExtension->ScratchContext.ScratchSrb->SrbStatus == SRB_STATUS_ABORTED) && - (DeviceExtension->ScratchContext.ScratchSrb->InternalStatus == STATUS_CANCELLED)) - { - shouldRetry = FALSE; - status = STATUS_CANCELLED; - } - else - { - shouldRetry = RequestSenseInfoInterpretForScratchBuffer(DeviceExtension, - timesAlreadyRetried, - &status, - &retryIn100nsUnits); - if (shouldRetry) - { - LARGE_INTEGER t; - t.QuadPart = -retryIn100nsUnits; - timesAlreadyRetried++; - KeDelayExecutionThread(KernelMode, FALSE, &t); - // keep items clean - ScratchBuffer_ResetItems(DeviceExtension, FALSE); - } - } - } - - return status; -} - - diff --git a/storage/class/cdrom/src/scratch.h b/storage/class/cdrom/src/scratch.h deleted file mode 100644 index 92d75328..00000000 --- a/storage/class/cdrom/src/scratch.h +++ /dev/null @@ -1,187 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - mmc.h - -Abstract: - - Functions/macros for using the scratch buffer and scratch request/SRB - in the serial I/O queue context - -Author: - -Environment: - - kernel mode only - -Notes: - - -Revision History: - ---*/ - -#ifndef __SCRATCH_H__ -#define __SCRATCH_H__ - - -_IRQL_requires_max_(APC_LEVEL) -VOID -ScratchBuffer_Deallocate( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -_IRQL_requires_max_(APC_LEVEL) -BOOLEAN -ScratchBuffer_Allocate( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension - ); - -VOID -ScratchBuffer_ResetItems( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN ResetRequestHistory - ); - -_IRQL_requires_max_(APC_LEVEL) -VOID -ScratchBuffer_SetupSrb( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ WDFREQUEST OriginalRequest, - _In_ ULONG MaximumTransferLength, - _In_ BOOLEAN GetDataFromDevice - ); - -VOID -ScratchBuffer_SetupReadWriteSrb( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST OriginalRequest, - _In_ LARGE_INTEGER StartingOffset, - _In_ ULONG RequiredLength, - _Inout_updates_bytes_(RequiredLength) UCHAR* DataBuffer, - _In_ BOOLEAN IsReadRequest, - _In_ BOOLEAN UsePartialMdl - ); - -NTSTATUS -ScratchBuffer_SendSrb( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN SynchronousSrb, - _When_(SynchronousSrb, _Pre_null_) - _When_(!SynchronousSrb, _In_opt_) - PSRB_HISTORY_ITEM *SrbHistoryItem - ); - -NTSTATUS -ScratchBuffer_PerformNextReadWrite( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN FirstTry - ); - -#if DBG - #define ScratchBuffer_BeginUse(context) ScratchBuffer_BeginUseX((context), __FILE__, __LINE__) -#else - #define ScratchBuffer_BeginUse(context) ScratchBuffer_BeginUseX((context), NULL, (ULONG)-1) -#endif - -__inline VOID ScratchBuffer_BeginUseX(_Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_opt_ LPCSTR File, ULONG Line) -{ - // NOTE: these are not "real" locks. They are simply to help - // avoid multiple uses of the scratch buffer. Thus, it - // is not critical to have atomic operations here. - PVOID tmp = InterlockedCompareExchangePointer((PVOID)&(DeviceExtension->ScratchContext.ScratchInUse), (PVOID)-1, NULL); - NT_ASSERT(tmp == NULL); - UNREFERENCED_PARAMETER(tmp); //defensive coding, avoid PREFAST warning. - DeviceExtension->ScratchContext.ScratchInUseFileName = File; - DeviceExtension->ScratchContext.ScratchInUseLineNumber = Line; - ScratchBuffer_ResetItems(DeviceExtension, TRUE); - RequestClearSendTime(DeviceExtension->ScratchContext.ScratchRequest); - return; -} -__inline VOID ScratchBuffer_EndUse(_Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension) -{ - // NOTE: these are not "real" locks. They are simply to help - // avoid multiple uses of the scratch buffer. Thus, it - // is not critical to have atomic operations here. - - // On lock release, we erase ScratchInUseFileName and ScratchInUseLineNumber _before_ releasing ScratchInUse, - // because otherwise we may erase these after the lock has been acquired again by another thread. We store the - // old values of ScratchInUseFileName and ScratchInUseLineNumber in local variables to facilitate debugging, - // if the ASSERT at the end of the function is hit. - PCSTR scratchInUseFileName; - ULONG scratchInUseLineNumber; - PVOID tmp; - - scratchInUseFileName = DeviceExtension->ScratchContext.ScratchInUseFileName; - scratchInUseLineNumber = DeviceExtension->ScratchContext.ScratchInUseLineNumber; - UNREFERENCED_PARAMETER(scratchInUseFileName); - UNREFERENCED_PARAMETER(scratchInUseLineNumber); - DeviceExtension->ScratchContext.ScratchInUseFileName = NULL; - DeviceExtension->ScratchContext.ScratchInUseLineNumber = 0; - - // - // If we have used the PartialMdl in the scratch context we should notify MM that we will be reusing it - // otherwise it may leak System VA if some one below us has mapped the same. - // - - if (DeviceExtension->ScratchContext.PartialMdlIsBuilt != FALSE) - { - MmPrepareMdlForReuse(DeviceExtension->ScratchContext.PartialMdl); - DeviceExtension->ScratchContext.PartialMdlIsBuilt = FALSE; - } - - tmp = InterlockedCompareExchangePointer((PVOID)&(DeviceExtension->ScratchContext.ScratchInUse), NULL, (PVOID)-1); - NT_ASSERT(tmp == ((PVOID)-1)); - UNREFERENCED_PARAMETER(tmp); //defensive coding, avoid PREFAST warning. - return; -} - -VOID -CompressSrbHistoryData( - _Inout_ PSRB_HISTORY RequestHistory - ); - -VOID -ValidateSrbHistoryDataPresumptions( - _In_ SRB_HISTORY const* RequestHistory - ); - -_IRQL_requires_max_(APC_LEVEL) -NTSTATUS -ScratchBuffer_ExecuteCdbEx( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ WDFREQUEST OriginalRequest, - _In_ ULONG TransferSize, - _In_ BOOLEAN GetDataFromDevice, - _In_ PCDB Cdb, - _In_ UCHAR OprationLength, - _In_ ULONG TimeoutValue - ); - -_IRQL_requires_max_(APC_LEVEL) -__inline -NTSTATUS -ScratchBuffer_ExecuteCdb( - _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_opt_ WDFREQUEST OriginalRequest, - _In_ ULONG TransferSize, - _In_ BOOLEAN GetDataFromDevice, - _In_ PCDB Cdb, - _In_ UCHAR OprationLength - ) -{ - return ScratchBuffer_ExecuteCdbEx(DeviceExtension, - OriginalRequest, - TransferSize, - GetDataFromDevice, - Cdb, - OprationLength, - 0); -} - -KDEFERRED_ROUTINE ScratchBuffer_ReadWriteTimerRoutine; - -#endif //__SCRATCH_H__ diff --git a/storage/class/cdrom/src/sense.c b/storage/class/cdrom/src/sense.c deleted file mode 100644 index 7033c6ce..00000000 --- a/storage/class/cdrom/src/sense.c +++ /dev/null @@ -1,2600 +0,0 @@ -/*-- - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - sense.c - -Abstract: - - This file contains the methods needed to accurately - determine how to retry requests on CDROM device types. - -Environment: - - kernel mode only - -Revision History: - ---*/ - -#include "stddef.h" -#include "string.h" - -#include "ntddk.h" -#include "ntddstor.h" -#include "cdrom.h" -#include "ntstrsafe.h" - - -#ifdef DEBUG_USE_WPP -#include "sense.tmh" -#endif - -// Forward declarations -VOID -SenseInfoInterpretRefineByIoControl( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ ULONG IoControlCode, - _In_ BOOLEAN OverrideVerifyVolume, - _Inout_ BOOLEAN* Retry, - _Inout_ NTSTATUS* Status - ); - - -#ifdef ALLOC_PRAGMA - -#pragma alloc_text(PAGE, SenseInfoInterpretRefineByIoControl) - -#endif - - -// -// FROM CLASSPNP\CLASSP.H -// Lots of retries of synchronized SCSI commands that devices may not -// even support really slows down the system (especially while booting). -// (Even GetDriveCapacity may be failed on purpose if an external disk is powered off). -// If a disk cannot return a small initialization buffer at startup -// in two attempts (with delay interval) then we cannot expect it to return -// data consistently with four retries. -// So don't set the retry counts as high here as for data SRBs. -// -// If we find that these requests are failing consecutively, -// despite the retry interval, on otherwise reliable media, -// then we should either increase the retry interval for -// that failure or (by all means) increase these retry counts as appropriate. -// - -#define TOTAL_COUNT_RETRY_DEFAULT 4 -#define TOTAL_COUNT_RETRY_LOCK_MEDIA 1 -#define TOTAL_COUNT_RETRY_MODESENSE 1 -#define TOTAL_COUNT_RETRY_READ_CAPACITY 1 - - -#define TOTAL_SECONDS_RETRY_TIME_WRITE 160 -#define TOTAL_SECONDS_RETRY_TIME_MEDIUM_REMOVAL 120 - -typedef struct _ERROR_LOG_CONTEXT { - BOOLEAN LogError; - BOOLEAN ErrorUnhandled; - NTSTATUS ErrorCode; - ULONG UniqueErrorValue; - ULONG BadSector; -} ERROR_LOG_CONTEXT, *PERROR_LOG_CONTEXT; - -NTSTATUS -DeviceErrorHandlerForMmc( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSCSI_REQUEST_BLOCK Srb, - _Inout_ PNTSTATUS Status, - _Inout_ PBOOLEAN Retry - ) -/*++ - -Routine Description: - - this routine will be used for error handler for all MMC devices. - it's invoked by DeviceErrorHandler()that invoked by SenseInfoInterpret() or GESN - - This routine just checks for media change sense/asc/ascq and - also for other events, such as bus resets. this is used to - determine if the device behaviour has changed, to allow for - read and write operations to be allowed and/or disallowed. - -Arguments: - - DeviceExtension - device context - Srb - SRB structure for analyze - -Return Value: - - NTSTATUS - Status - - Retry - - ---*/ -{ - BOOLEAN mediaChange = FALSE; - PCDB cdb = (PCDB)Srb->Cdb; - - if (TEST_FLAG(Srb->SrbStatus, SRB_STATUS_AUTOSENSE_VALID)) - { - PSENSE_DATA senseBuffer = Srb->SenseInfoBuffer; - - // the following sense keys could indicate a change in capabilities. - - // we used to expect this to be serialized, and only hit from our - // own routine. we now allow some requests to continue during our - // processing of the capabilities update in order to allow - // IoReadPartitionTable() to succeed. - switch (senseBuffer->SenseKey & 0xf) - { - - case SCSI_SENSE_NOT_READY: - { - if (senseBuffer->AdditionalSenseCode == SCSI_ADSENSE_NO_MEDIA_IN_DEVICE) - { - if (DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "DeviceErrorHandlerForMmc: media removed, writes will be " - "failed until new media detected\n")); - } - - // NOTE - REF #0002 - DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed = FALSE; - } - else if (senseBuffer->AdditionalSenseCode == SCSI_ADSENSE_LUN_NOT_READY) - { - if (senseBuffer->AdditionalSenseCodeQualifier == SCSI_SENSEQ_BECOMING_READY) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "DeviceErrorHandlerForMmc: media becoming ready, " - "SHOULD notify shell of change time by sending " - "GESN request immediately!\n")); - } - else if (((senseBuffer->AdditionalSenseCodeQualifier == SCSI_SENSEQ_OPERATION_IN_PROGRESS) || - (senseBuffer->AdditionalSenseCodeQualifier == SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS) - ) && - ((Srb->Cdb[0] == SCSIOP_READ) || - (Srb->Cdb[0] == SCSIOP_READ6) || - (Srb->Cdb[0] == SCSIOP_READ_CAPACITY) || - (Srb->Cdb[0] == SCSIOP_READ_CD) || - (Srb->Cdb[0] == SCSIOP_READ_CD_MSF) || - (Srb->Cdb[0] == SCSIOP_READ_TOC) || - (Srb->Cdb[0] == SCSIOP_WRITE) || - (Srb->Cdb[0] == SCSIOP_WRITE6) || - (Srb->Cdb[0] == SCSIOP_READ_TRACK_INFORMATION) || - (Srb->Cdb[0] == SCSIOP_READ_DISK_INFORMATION) - ) - ) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "DeviceErrorHandlerForMmc: LONG_WRITE or " - "OP_IN_PROGRESS for limited subset of cmds -- " - "setting retry to TRUE\n")); - *Retry = TRUE; - *Status = STATUS_DEVICE_BUSY; - } - } - break; - } // end SCSI_SENSE_NOT_READY - - case SCSI_SENSE_UNIT_ATTENTION: - { - switch (senseBuffer->AdditionalSenseCode) - { - case SCSI_ADSENSE_MEDIUM_CHANGED: - { - // always update if the medium may have changed - - // NOTE - REF #0002 - DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed = FALSE; - DeviceExtension->DeviceAdditionalData.Mmc.UpdateState = CdromMmcUpdateRequired; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "DeviceErrorHandlerForMmc: media change detected, need to " - "update drive capabilities\n")); - mediaChange = TRUE; - break; - - } // end SCSI_ADSENSE_MEDIUM_CHANGED - - case SCSI_ADSENSE_BUS_RESET: - { - // NOTE - REF #0002 - DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed = FALSE; - DeviceExtension->DeviceAdditionalData.Mmc.UpdateState = CdromMmcUpdateRequired; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "DeviceErrorHandlerForMmc: bus reset detected, need to " - "update drive capabilities\n")); - break; - - } // end SCSI_ADSENSE_BUS_RESET - - case SCSI_ADSENSE_OPERATOR_REQUEST: - { - - BOOLEAN b = FALSE; - - switch (senseBuffer->AdditionalSenseCodeQualifier) - { - case SCSI_SENSEQ_MEDIUM_REMOVAL: - { - // eject notification currently handled by classpnp - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "DeviceErrorHandlerForMmc: Eject requested by user\n")); - *Retry = TRUE; - *Status = STATUS_DEVICE_BUSY; - break; - } - - case SCSI_SENSEQ_WRITE_PROTECT_DISABLE: - b = TRUE; - case SCSI_SENSEQ_WRITE_PROTECT_ENABLE: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "DeviceErrorHandlerForMmc: Write protect %s requested " - "by user\n", - (b ? "disable" : "enable"))); - *Retry = TRUE; - *Status = STATUS_DEVICE_BUSY; - // NOTE - REF #0002 - DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed = FALSE; - DeviceExtension->DeviceAdditionalData.Mmc.UpdateState = CdromMmcUpdateRequired; - - break; - } - - } // end of AdditionalSenseCodeQualifier switch - - - break; - - } // end SCSI_ADSENSE_OPERATOR_REQUEST - - default: - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "DeviceErrorHandlerForMmc: Unit attention %02x/%02x\n", - senseBuffer->AdditionalSenseCode, - senseBuffer->AdditionalSenseCodeQualifier)); - break; - } - - } // end of AdditionSenseCode switch - break; - - } // end SCSI_SENSE_UNIT_ATTENTION - - case SCSI_SENSE_ILLEGAL_REQUEST: - { - if (senseBuffer->AdditionalSenseCode == SCSI_ADSENSE_WRITE_PROTECT) - { - if (DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "DeviceErrorHandlerForMmc: media was writable, but " - "failed request with WRITE_PROTECT error...\n")); - } - // NOTE - REF #0002 - // do not update all the capabilities just because - // we can't write to the disc. - DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed = FALSE; - } - break; - } // end SCSI_SENSE_ILLEGAL_REQUEST - - } // end of SenseKey switch - - // Check if we failed to set the DVD region key and send appropriate error - if (cdb->CDB16.OperationCode == SCSIOP_SEND_KEY) - { - if (cdb->SEND_KEY.KeyFormat == DvdSetRpcKey) - { - if (senseBuffer->AdditionalSenseCode == SCSI_ADSENSE_NO_MEDIA_IN_DEVICE) - { - // media of appropriate region required - *Status = STATUS_NO_MEDIA_IN_DEVICE; - *Retry = FALSE; - } - else if ((senseBuffer->SenseKey == SCSI_SENSE_ILLEGAL_REQUEST) && - (senseBuffer->AdditionalSenseCode == SCSI_ADSENSE_COPY_PROTECTION_FAILURE) && - (senseBuffer->AdditionalSenseCodeQualifier == SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT)) - { - // media of appropriate region required - *Status = STATUS_CSS_REGION_MISMATCH; - *Retry = FALSE; - } - else if ((senseBuffer->SenseKey == SCSI_SENSE_ILLEGAL_REQUEST) && - (senseBuffer->AdditionalSenseCode == SCSI_ADSENSE_INVALID_MEDIA) && - (senseBuffer->AdditionalSenseCodeQualifier == SCSI_SENSEQ_INCOMPATIBLE_FORMAT)) - { - // media of appropriate region required - *Status = STATUS_CSS_REGION_MISMATCH; - *Retry = FALSE; - } - } - } - } // end of SRB_STATUS_AUTOSENSE_VALID - - // On media change, if device speed should be reset to default then - // queue a workitem to send the commands to the device. Do this on - // media arrival as some device will fail this command if no media - // is present. Ignore the fake media change from classpnp driver. - if ((mediaChange == TRUE) && (*Status != STATUS_MEDIA_CHANGED)) - { - if (DeviceExtension->DeviceAdditionalData.RestoreDefaults == TRUE) - { - NTSTATUS status = STATUS_SUCCESS; - WDF_OBJECT_ATTRIBUTES attributes; - WDF_WORKITEM_CONFIG workitemConfig; - WDFWORKITEM workItem; - - WDF_OBJECT_ATTRIBUTES_INIT(&attributes); - attributes.ParentObject = DeviceExtension->Device; - - WDF_WORKITEM_CONFIG_INIT(&workitemConfig, - DeviceRestoreDefaultSpeed); - - status = WdfWorkItemCreate(&workitemConfig, - &attributes, - &workItem); - if (!NT_SUCCESS(status)) - { - return STATUS_SUCCESS; - } - - WdfWorkItemEnqueue(workItem); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "DeviceErrorHandlerForMmc: Restore device default speed for %p\n", - DeviceExtension->DeviceObject)); - } - } - return STATUS_SUCCESS; -} - -NTSTATUS -DeviceErrorHandlerForHitachiGD2000( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSCSI_REQUEST_BLOCK Srb, - _Inout_ PNTSTATUS Status, - _Inout_ PBOOLEAN Retry - ) -/*++ - -Routine Description: - - error handler for HITACHI CDR-1750S, CDR-3650/1650S - - This routine checks the type of error. If the error suggests that the - drive has spun down and cannot reinitialize itself, send a - START_UNIT or READ to the device. This will force the drive to spin - up. This drive also loses the AGIDs it has granted when it spins down, - which may result in playback failure the first time around. - -Arguments: - - DeviceExtension - the device object. - - Srb - Supplies a pointer to the failing Srb. - - Status - return the final status for this command? - - Retry - return if the command should be retried. - -Return Value: - - None. - ---*/ -{ - PSENSE_DATA senseBuffer = Srb->SenseInfoBuffer; - - if (!TEST_FLAG(Srb->SrbStatus, SRB_STATUS_AUTOSENSE_VALID)) - { - return STATUS_SUCCESS; //nobody cares about this return value yet. - } - - if (((senseBuffer->SenseKey & 0xf) == SCSI_SENSE_HARDWARE_ERROR) && - (senseBuffer->AdditionalSenseCode == 0x44)) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "DeviceErrorHandlerForHitachiGD2000 (%p) => Internal Target " - "Failure Detected -- spinning up drive\n", DeviceExtension->Device)); - - // the request should be retried because the device isn't ready - *Retry = TRUE; - *Status = STATUS_DEVICE_NOT_READY; - - // send a START_STOP unit to spin up the drive - // NOTE: this temporarily violates the StartIo serialization - // mechanism, but the completion routine on this will NOT - // call StartNextPacket(), so it's a temporary disruption - // of the serialization only. - DeviceSendStartUnit(DeviceExtension->Device); - } - - return STATUS_SUCCESS; -} - - -VOID -SenseInfoRequestGetInformation( - _In_ WDFREQUEST Request, - _Out_ UCHAR* MajorFunctionCode, - _Out_ ULONG* IoControlCode, - _Out_ BOOLEAN* OverrideVerifyVolume, - _Out_ ULONGLONG* Total100nsSinceFirstSend - ) -{ - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request); - - *MajorFunctionCode = 0; - *IoControlCode = 0; - *OverrideVerifyVolume = FALSE; - *Total100nsSinceFirstSend = 0; - - if (requestContext->OriginalRequest != NULL) - { - PIO_STACK_LOCATION originalIrpStack = NULL; - - PIRP originalIrp = WdfRequestWdmGetIrp(requestContext->OriginalRequest); - - if (originalIrp != NULL) - { - originalIrpStack = IoGetCurrentIrpStackLocation(originalIrp); - } - - if (originalIrpStack != NULL) - { - *MajorFunctionCode = originalIrpStack->MajorFunction; - - if (*MajorFunctionCode == IRP_MJ_DEVICE_CONTROL) - { - *IoControlCode = originalIrpStack->Parameters.DeviceIoControl.IoControlCode; - } - - *OverrideVerifyVolume = TEST_FLAG(originalIrpStack->Flags, SL_OVERRIDE_VERIFY_VOLUME); - } - } - - // Calculate time past since the request was first time sent. - if (requestContext->TimeSentDownFirstTime.QuadPart > 0) - { - LARGE_INTEGER tmp; - KeQueryTickCount(&tmp); - tmp.QuadPart -= requestContext->TimeSentDownFirstTime.QuadPart; - tmp.QuadPart *= KeQueryTimeIncrement(); - *Total100nsSinceFirstSend = tmp.QuadPart; - } - else - { - // set to -1 if field TimeSentDownFirstTime not set. - *Total100nsSinceFirstSend = (ULONGLONG) -1; - } - - return; -} - -BOOLEAN -SenseInfoInterpretByAdditionalSenseCode( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSCSI_REQUEST_BLOCK Srb, - _In_ UCHAR AdditionalSenseCode, - _In_ UCHAR AdditionalSenseCodeQual, - _Inout_ NTSTATUS* Status, - _Inout_ BOOLEAN* Retry, - _Out_ _Deref_out_range_(0,100) ULONG* RetryIntervalInSeconds, - _Inout_ PERROR_LOG_CONTEXT LogContext - ) -/* - This function will interpret error based on ASC/ASCQ. - - If the error code is not processed in this function, e.g. return value is TRUE, - caller needs to call SenseInfoInterpretBySenseKey() for further interpret. -*/ -{ - BOOLEAN needFurtherInterpret = TRUE; - PSENSE_DATA senseBuffer = (PSENSE_DATA)Srb->SenseInfoBuffer; - - // set default values for retry fields. - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - *RetryIntervalInSeconds = 0; - - switch (AdditionalSenseCode) - { - case SCSI_ADSENSE_LUN_NOT_READY: - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Lun not ready\n")); - - // - // Many non-WHQL certified drives (mostly CD-RW) return - // 2/4/0 when they have no media instead of the obvious choice of: - // - // SCSI_SENSE_NOT_READY/SCSI_ADSENSE_NO_MEDIA_IN_DEVICE - // - // These drives should not pass WHQL certification due to this discrepency. - // - // However, we have to retry on 2/4/0 (Not ready, LUN not ready, no info) - // and also 3/2/0 (no seek complete). - // - // These conditions occur when the shell tries to examine an - // injected CD (e.g. for autoplay) before the CD is spun up. - // - // The drive should be returning an ASCQ of SCSI_SENSEQ_BECOMING_READY - // (0x01) in order to comply with WHQL standards. - // - // The default retry timeout of one second is acceptable to balance - // these discrepencies. don't modify the status, though.... - // - - switch (AdditionalSenseCodeQual) - { - case SCSI_SENSEQ_OPERATION_IN_PROGRESS: - { - DEVICE_EVENT_BECOMING_READY notReady = {0}; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Operation In Progress\n")); - - needFurtherInterpret = FALSE; - - *Retry = TRUE; - *RetryIntervalInSeconds = NOT_READY_RETRY_INTERVAL; - *Status = STATUS_DEVICE_NOT_READY; - - notReady.Version = 1; - notReady.Reason = 2; - notReady.Estimated100msToReady = *RetryIntervalInSeconds * 10; - DeviceSendNotification(DeviceExtension, - &GUID_IO_DEVICE_BECOMING_READY, - sizeof(DEVICE_EVENT_BECOMING_READY), - ¬Ready); - - break; - } - - case SCSI_SENSEQ_BECOMING_READY: - { - DEVICE_EVENT_BECOMING_READY notReady = {0}; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: In process of becoming ready\n")); - - needFurtherInterpret = FALSE; - - *Retry = TRUE; - *RetryIntervalInSeconds = NOT_READY_RETRY_INTERVAL; - *Status = STATUS_DEVICE_NOT_READY; - - notReady.Version = 1; - notReady.Reason = 1; - notReady.Estimated100msToReady = *RetryIntervalInSeconds * 10; - DeviceSendNotification(DeviceExtension, - &GUID_IO_DEVICE_BECOMING_READY, - sizeof(DEVICE_EVENT_BECOMING_READY), - ¬Ready); - - break; - } - - case SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Long write in progress\n")); - - needFurtherInterpret = FALSE; - - // This has been seen as a transcient failure on some drives - *Status = STATUS_DEVICE_NOT_READY; - *Retry = TRUE; - // Set retry interval to be 0 as the drive can be ready at anytime. - *RetryIntervalInSeconds = 0; - - break; - } - - case SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Manual intervention required\n")); - - needFurtherInterpret = FALSE; - - *Status = STATUS_NO_MEDIA_IN_DEVICE; - *Retry = FALSE; - *RetryIntervalInSeconds = NOT_READY_RETRY_INTERVAL; - - break; - } - - case SCSI_SENSEQ_FORMAT_IN_PROGRESS: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Format in progress\n")); - - needFurtherInterpret = FALSE; - - *Status = STATUS_DEVICE_NOT_READY; - *Retry = FALSE; - *RetryIntervalInSeconds = NOT_READY_RETRY_INTERVAL; - - break; - } - - case SCSI_SENSEQ_CAUSE_NOT_REPORTABLE: - case SCSI_SENSEQ_INIT_COMMAND_REQUIRED: - default: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Initializing command required\n")); - - needFurtherInterpret = FALSE; - - *Status = STATUS_DEVICE_NOT_READY; - *Retry = TRUE; - *RetryIntervalInSeconds = 0; - - // This sense code/additional sense code combination may indicate - // that the device needs to be started. - if (TEST_FLAG(DeviceExtension->DeviceFlags, DEV_SAFE_START_UNIT) && - !TEST_FLAG(Srb->SrbFlags, SRB_CLASS_FLAGS_LOW_PRIORITY)) - { - DeviceSendStartUnit(DeviceExtension->Device); - } - - break; - } - } // end switch (AdditionalSenseCodeQual) - break; - - } // end case (SCSI_ADSENSE_LUN_NOT_READY) - - case SCSI_ADSENSE_NO_MEDIA_IN_DEVICE: - { - TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: No Media in device.\n")); - - needFurtherInterpret = FALSE; - - *Status = STATUS_NO_MEDIA_IN_DEVICE; - *Retry = FALSE; - - if (AdditionalSenseCodeQual == 0xCC) - { - // The IMAPIv1 filter returns this ASCQ value while it is burning CD media, and we want - // to preserve this functionality for compatibility reasons. - // We want to indicate that the media is not present to most applications; - // but RSM has to know that the media is still in the drive (i.e. the drive is not free). - DeviceSetMediaChangeStateEx(DeviceExtension, MediaUnavailable, NULL); - } - else - { - DeviceSetMediaChangeStateEx(DeviceExtension, MediaNotPresent, NULL); - } - - break; - } // end case SCSI_ADSENSE_NO_MEDIA_IN_DEVICE - - case SCSI_ADSENSE_INVALID_MEDIA: - { - switch (AdditionalSenseCodeQual) - { - - case SCSI_SENSEQ_UNKNOWN_FORMAT: - { - needFurtherInterpret = FALSE; - - // Log error only if this is a paging request - *Status = STATUS_UNRECOGNIZED_MEDIA; - *Retry = FALSE; - - LogContext->LogError = TEST_FLAG(Srb->SrbFlags, SRB_CLASS_FLAGS_PAGING); - LogContext->UniqueErrorValue = 256; - LogContext->ErrorCode = IO_ERR_BAD_BLOCK; - - break; - } - - case SCSI_SENSEQ_INCOMPATIBLE_FORMAT: - { - needFurtherInterpret = FALSE; - - *Status = STATUS_UNRECOGNIZED_MEDIA; - *Retry = FALSE; - - LogContext->LogError = FALSE; - - break; - } - - case SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED: - { - needFurtherInterpret = FALSE; - - *Status = STATUS_CLEANER_CARTRIDGE_INSTALLED; - *Retry = FALSE; - - LogContext->LogError = FALSE; - LogContext->UniqueErrorValue = 256; - LogContext->ErrorCode = IO_ERR_BAD_BLOCK; - break; - } - - default: - { - needFurtherInterpret = TRUE; - break; - } - } // end case AdditionalSenseCodeQual - - break; - } // end case SCSI_ADSENSE_NO_MEDIA_IN_DEVICE - - case SCSI_ADSENSE_NO_SEEK_COMPLETE: - { - switch (AdditionalSenseCodeQual) - { - - case 0x00: - { - needFurtherInterpret = FALSE; - - *Status = STATUS_DEVICE_DATA_ERROR; - *Retry = TRUE; - *RetryIntervalInSeconds = 0; - LogContext->LogError = TRUE; - LogContext->UniqueErrorValue = 256; - LogContext->ErrorCode = IO_ERR_BAD_BLOCK; - break; - } - - default: - { - needFurtherInterpret = TRUE; - break; - } - } - - break; - } // end case SCSI_ADSENSE_NO_SEEK_COMPLETE - - case SCSI_ADSENSE_LUN_COMMUNICATION: - { - switch (AdditionalSenseCodeQual) - { - - case SCSI_SESNEQ_COMM_CRC_ERROR: - { - needFurtherInterpret = FALSE; - - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - *RetryIntervalInSeconds = 1; - LogContext->LogError = TRUE; - LogContext->UniqueErrorValue = 257; - LogContext->ErrorCode = IO_ERR_CONTROLLER_ERROR; - break; - } - - default: - { - needFurtherInterpret = TRUE; - break; - } - } - - break; - } // end case SCSI_ADSENSE_LUN_COMMUNICATION - - case SCSI_ADSENSE_ILLEGAL_BLOCK: - { - needFurtherInterpret = FALSE; - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Illegal block address\n")); - *Status = STATUS_NONEXISTENT_SECTOR; - *Retry = FALSE; - break; - } - - case SCSI_ADSENSE_INVALID_LUN: - { - needFurtherInterpret = FALSE; - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Invalid LUN\n")); - *Status = STATUS_NO_SUCH_DEVICE; - *Retry = FALSE; - break; - } - - case SCSI_ADSENSE_COPY_PROTECTION_FAILURE: - { - needFurtherInterpret = FALSE; - - *Retry = FALSE; - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Key - Copy protection failure\n")); - - switch (AdditionalSenseCodeQual) - { - case SCSI_SENSEQ_AUTHENTICATION_FAILURE: - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Authentication failure\n")); - *Status = STATUS_CSS_AUTHENTICATION_FAILURE; - break; - case SCSI_SENSEQ_KEY_NOT_PRESENT: - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Key not present\n")); - *Status = STATUS_CSS_KEY_NOT_PRESENT; - break; - case SCSI_SENSEQ_KEY_NOT_ESTABLISHED: - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Key not established\n")); - *Status = STATUS_CSS_KEY_NOT_ESTABLISHED; - break; - case SCSI_SENSEQ_READ_OF_SCRAMBLED_SECTOR_WITHOUT_AUTHENTICATION: - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Read of scrambled sector w/o authentication\n")); - *Status = STATUS_CSS_SCRAMBLED_SECTOR; - break; - case SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT: - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Media region does not logical unit region\n")); - *Status = STATUS_CSS_REGION_MISMATCH; - break; - case SCSI_SENSEQ_LOGICAL_UNIT_RESET_COUNT_ERROR: - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Region set error -- region may be permanent\n")); - *Status = STATUS_CSS_RESETS_EXHAUSTED; - break; - - default: - *Status = STATUS_COPY_PROTECTION_FAILURE; - break; - } // end switch of ASCQ for COPY_PROTECTION_FAILURE - - break; - } - - case SCSI_ADSENSE_INVALID_CDB: - { - needFurtherInterpret = FALSE; - - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Key - Invalid CDB\n")); - - *Status = STATUS_INVALID_DEVICE_REQUEST; - *Retry = FALSE; - - // Note: the retry interval is not typically used. - // it is set here only because a ClassErrorHandler - // cannot set the RetryIntervalInSeconds, and the error may - // require a few commands to be sent to clear whatever - // caused this condition (i.e. disk clears the write - // cache, requiring at least two commands) - // - // hopefully, this shortcoming can be changed for blackcomb. - *RetryIntervalInSeconds = 3; - - break; - } - - case SCSI_ADSENSE_MEDIUM_CHANGED: - { - needFurtherInterpret = FALSE; - *RetryIntervalInSeconds = 0; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "SenseInfoInterpretByAdditionalSenseCode: Media changed\n")); - - DeviceSetMediaChangeStateEx(DeviceExtension, MediaPresent, NULL); - - // special process for Media Change - if (IsVolumeMounted(DeviceExtension->DeviceObject)) - { - // Set bit to indicate that media may have changed and volume needs verification. - SET_FLAG(DeviceExtension->DeviceObject->Flags, DO_VERIFY_VOLUME); - - *Status = STATUS_VERIFY_REQUIRED; - *Retry = FALSE; - } - else - { - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - } - break; - } - - case SCSI_ADSENSE_OPERATOR_REQUEST: - { - switch (AdditionalSenseCodeQual) - { - case SCSI_SENSEQ_MEDIUM_REMOVAL: - { - needFurtherInterpret = FALSE; - *RetryIntervalInSeconds = 0; - - InterlockedIncrement((PLONG)&DeviceExtension->MediaChangeCount); - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Ejection request received!\n")); - //Send eject notification. - DeviceSendNotification(DeviceExtension, - &GUID_IO_MEDIA_EJECT_REQUEST, - 0, - NULL); - // special process for Media Change - if (IsVolumeMounted(DeviceExtension->DeviceObject)) - { - // Set bit to indicate that media may have changed and volume needs verification. - SET_FLAG(DeviceExtension->DeviceObject->Flags, DO_VERIFY_VOLUME); - - *Status = STATUS_VERIFY_REQUIRED; - *Retry = FALSE; - } - else - { - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - } - break; - } - default: - { - needFurtherInterpret = TRUE; - break; - } - } - break; - } - - case SCSI_ADSENSE_OPERATING_CONDITIONS_CHANGED: - { - needFurtherInterpret = FALSE; - *RetryIntervalInSeconds = 5; - - InterlockedIncrement((PLONG)&DeviceExtension->MediaChangeCount); - - // Device information has changed, we need to rescan the - // bus for changed information such as the capacity. - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Device information changed. Invalidate the bus\n")); - - IoInvalidateDeviceRelations(DeviceExtension->LowerPdo, BusRelations); - - // special process for Media Change - if (IsVolumeMounted(DeviceExtension->DeviceObject)) - { - // Set bit to indicate that media may have changed and volume needs verification. - SET_FLAG(DeviceExtension->DeviceObject->Flags, DO_VERIFY_VOLUME); - - *Status = STATUS_VERIFY_REQUIRED; - *Retry = FALSE; - } - else - { - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - } - break; - } //end Case SCSI_ADSENSE_OPERATING_CONDITIONS_CHANGED - - - case SCSI_ADSENSE_REC_DATA_NOECC: - case SCSI_ADSENSE_REC_DATA_ECC: - { - needFurtherInterpret = FALSE; - - *Status = STATUS_SUCCESS; - *Retry = FALSE; - LogContext->LogError = TRUE; - LogContext->UniqueErrorValue = 258; - LogContext->ErrorCode = IO_RECOVERED_VIA_ECC; - - if (senseBuffer->IncorrectLength) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Incorrect length detected.\n")); - *Status = STATUS_INVALID_BLOCK_LENGTH ; - } - break; - } - - case SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED: - { - UCHAR wmiEventData[sizeof(ULONG)+sizeof(UCHAR)] = {0}; - - *((PULONG)wmiEventData) = sizeof(UCHAR); - wmiEventData[sizeof(ULONG)] = AdditionalSenseCodeQual; - - needFurtherInterpret = FALSE; - - // Don't log another eventlog if we have already logged once - // NOTE: this should have been interlocked, but the structure - // was publicly defined to use a BOOLEAN (char). Since - // media only reports these errors once per X minutes, - // the potential race condition is nearly non-existant. - // the worst case is duplicate log entries, so ignore. - - *Status = STATUS_SUCCESS; - *Retry = FALSE; - LogContext->UniqueErrorValue = 258; - LogContext->LogError = TRUE; - LogContext->ErrorCode = IO_WRN_FAILURE_PREDICTED; - - if (senseBuffer->IncorrectLength) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "SenseInfoInterpretByAdditionalSenseCode: Incorrect length detected.\n")); - *Status = STATUS_INVALID_BLOCK_LENGTH ; - } - break; - } - - case 0x57: - { - // UNABLE_TO_RECOVER_TABLE_OF_CONTENTS - // the Matshita CR-585 returns this for all read commands - // on blank CD-R and CD-RW media, and we need to handle - // this for READ_CD detection ability. - switch (AdditionalSenseCodeQual) - { - case 0x00: - { - needFurtherInterpret = FALSE; - - *Status = STATUS_UNRECOGNIZED_MEDIA; - *Retry = FALSE; - break; - } - default: - { - needFurtherInterpret = TRUE; - break; - } - } - break; - } //end case Matshita specific error 0x57 - - default: - { - needFurtherInterpret = TRUE; - break; - } - } - - return needFurtherInterpret; -} - -VOID -SenseInfoInterpretBySenseKey( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSENSE_DATA SenseData, - _In_ UCHAR SenseKey, - _Inout_ NTSTATUS* Status, - _Inout_ BOOLEAN* Retry, - _Out_ _Deref_out_range_(0,100) ULONG* RetryIntervalInSeconds, - _Inout_ PERROR_LOG_CONTEXT LogContext - ) -{ - // set default values for retry fields. - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - *RetryIntervalInSeconds = 0; - - switch (SenseKey) - { - case SCSI_SENSE_NOT_READY: - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretBySenseKey: Key - Not Ready (bad block)\n")); - - *Status = STATUS_DEVICE_NOT_READY; - *Retry = TRUE; - - // for unprocessed "not ready" codes, retry the command immediately. - *RetryIntervalInSeconds = 0; - break; - } - - case SCSI_SENSE_DATA_PROTECT: - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "SenseInfoInterpretBySenseKey: Key - Media write protected\n")); - *Status = STATUS_MEDIA_WRITE_PROTECTED; - *Retry = FALSE; - break; - } - - case SCSI_SENSE_MEDIUM_ERROR: - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretBySenseKey: Key - Medium Error (bad block)\n")); - - *Status = STATUS_DEVICE_DATA_ERROR; - *Retry = FALSE; - LogContext->LogError = TRUE; - LogContext->UniqueErrorValue = 256; - LogContext->ErrorCode = IO_ERR_BAD_BLOCK; - - break; - } // end SCSI_SENSE_MEDIUM_ERROR - - case SCSI_SENSE_HARDWARE_ERROR: - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretBySenseKey: Key - Hardware error\n")); - - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - LogContext->LogError = TRUE; - LogContext->UniqueErrorValue = 257; - LogContext->ErrorCode = IO_ERR_CONTROLLER_ERROR; - - break; - } // end SCSI_SENSE_HARDWARE_ERROR - - case SCSI_SENSE_ILLEGAL_REQUEST: - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretBySenseKey: Key - Illegal SCSI request\n")); - *Status = STATUS_INVALID_DEVICE_REQUEST; - *Retry = FALSE; - - break; - } // end SCSI_SENSE_ILLEGAL_REQUEST - - case SCSI_SENSE_UNIT_ATTENTION: - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretBySenseKey: Key - Unit Attention\n")); - - // A media change may have occured so increment the change - // count for the physical device - InterlockedIncrement((PLONG)&DeviceExtension->MediaChangeCount); - - if (IsVolumeMounted(DeviceExtension->DeviceObject)) - { - // Set bit to indicate that media may have changed - // and volume needs verification. - SET_FLAG(DeviceExtension->DeviceObject->Flags, DO_VERIFY_VOLUME); - - *Status = STATUS_VERIFY_REQUIRED; - *Retry = FALSE; - } - else - { - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - } - - break; - - } // end SCSI_SENSE_UNIT_ATTENTION - - case SCSI_SENSE_ABORTED_COMMAND: - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretBySenseKey: Command aborted\n")); - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - *RetryIntervalInSeconds = 1; - break; - } // end SCSI_SENSE_ABORTED_COMMAND - - case SCSI_SENSE_BLANK_CHECK: - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "SenseInfoInterpretBySenseKey: Media blank check\n")); - *Retry = FALSE; - *Status = STATUS_NO_DATA_DETECTED; - break; - } // end SCSI_SENSE_BLANK_CHECK - - case SCSI_SENSE_RECOVERED_ERROR: - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "SenseInfoInterpretBySenseKey: Recovered error\n")); - *Status = STATUS_SUCCESS; - *Retry = FALSE; - LogContext->LogError = TRUE; - LogContext->UniqueErrorValue = 258; - LogContext->ErrorCode = IO_ERR_CONTROLLER_ERROR; - - if (SenseData->IncorrectLength) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "SenseInfoInterpretBySenseKey: Incorrect length detected.\n")); - *Status = STATUS_INVALID_BLOCK_LENGTH ; - } - - break; - } // end SCSI_SENSE_RECOVERED_ERROR - - case SCSI_SENSE_NO_SENSE: - { - // Check other indicators. - if (SenseData->IncorrectLength) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "SenseInfoInterpretBySenseKey: Incorrect length detected.\n")); - *Status = STATUS_INVALID_BLOCK_LENGTH ; - *Retry = FALSE; - } - else - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "SenseInfoInterpretBySenseKey: No specific sense key\n")); - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - } - - break; - } // end SCSI_SENSE_NO_SENSE - - default: - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpretBySenseKey: Unrecognized sense code\n")); - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - *RetryIntervalInSeconds = 0; - - break; - } - - } // end switch (SenseKey) - - return; -} - -VOID -SenseInfoInterpretBySrbStatus( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSCSI_REQUEST_BLOCK Srb, - _In_ ULONG RetriedCount, - _Inout_ NTSTATUS* Status, - _Inout_ BOOLEAN* Retry, - _Out_ _Deref_out_range_(0,100) ULONG* RetryIntervalInSeconds, - _Inout_ PERROR_LOG_CONTEXT LogContext - ) -{ - BOOLEAN incrementErrorCount = FALSE; - - // set default values for retry fields. - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - *RetryIntervalInSeconds = 0; - - switch (SRB_STATUS(Srb->SrbStatus)) - { - case SRB_STATUS_INVALID_LUN: - case SRB_STATUS_INVALID_TARGET_ID: - case SRB_STATUS_NO_DEVICE: - case SRB_STATUS_NO_HBA: - case SRB_STATUS_INVALID_PATH_ID: - { - *Status = STATUS_NO_SUCH_DEVICE; - *Retry = FALSE; - break; - } - - case SRB_STATUS_COMMAND_TIMEOUT: - case SRB_STATUS_TIMEOUT: - { - // Update the error count for the device. - *Status = STATUS_IO_TIMEOUT; - *Retry = TRUE; - *RetryIntervalInSeconds = 0; - incrementErrorCount = TRUE; - break; - } - - case SRB_STATUS_ABORTED: - { - // Update the error count for the device. - *Status = STATUS_IO_TIMEOUT; - *Retry = TRUE; - *RetryIntervalInSeconds = 1; - incrementErrorCount = TRUE; - break; - } - - case SRB_STATUS_SELECTION_TIMEOUT: - { - *Status = STATUS_DEVICE_NOT_CONNECTED; - *Retry = FALSE; - *RetryIntervalInSeconds = 2; - LogContext->LogError = TRUE; - LogContext->ErrorCode = IO_ERR_NOT_READY; - LogContext->UniqueErrorValue = 260; - break; - } - - case SRB_STATUS_DATA_OVERRUN: - { - *Status = STATUS_DATA_OVERRUN; - *Retry = FALSE; - break; - } - - case SRB_STATUS_PHASE_SEQUENCE_FAILURE: - { - // Update the error count for the device. - incrementErrorCount = TRUE; - *Status = STATUS_IO_DEVICE_ERROR; - - // If there was phase sequence error then limit the number of retries. - *Retry = (RetriedCount <= 1); - - break; - } - - case SRB_STATUS_REQUEST_FLUSHED: - { - // If the status needs verification bit is set. Then set - // the status to need verification and no retry; otherwise, - // just retry the request. - if (TEST_FLAG(DeviceExtension->DeviceObject->Flags, DO_VERIFY_VOLUME)) - { - *Status = STATUS_VERIFY_REQUIRED; - *Retry = FALSE; - } - else - { - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - } - - break; - } - - case SRB_STATUS_INVALID_REQUEST: - { - *Status = STATUS_INVALID_DEVICE_REQUEST; - *Retry = FALSE; - break; - } - - case SRB_STATUS_UNEXPECTED_BUS_FREE: - case SRB_STATUS_PARITY_ERROR: - // Update the error count for the device and fall through to below - incrementErrorCount = TRUE; - - case SRB_STATUS_BUS_RESET: - { - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - break; - } - - case SRB_STATUS_ERROR: - { - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - - if (Srb->ScsiStatus == 0) - { - // This is some strange return code. Update the error - // count for the device. - incrementErrorCount = TRUE; - } - - if (Srb->ScsiStatus == SCSISTAT_BUSY) - { - *Status = STATUS_DEVICE_NOT_READY; - } - - break; - } - - default: - { - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - LogContext->LogError = TRUE; - LogContext->ErrorCode = IO_ERR_CONTROLLER_ERROR; - LogContext->UniqueErrorValue = 259; - LogContext->ErrorUnhandled = TRUE; - break; - } - - } //end of (SRB_STATUS(Srb->SrbStatus)) - - if (incrementErrorCount) - { - // if any error count occurred, delay the retry of this io by - // at least one second, if caller supports it. - if (*RetryIntervalInSeconds == 0) - { - *RetryIntervalInSeconds = 1; - } - - DevicePerfIncrementErrorCount(DeviceExtension); - } - - return; -} - -VOID -SenseInfoLogError( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSCSI_REQUEST_BLOCK Srb, - _In_ UCHAR MajorFunctionCode, - _In_ ULONG IoControlCode, - _In_ ULONG RetriedCount, - _In_ NTSTATUS* Status, - _In_ BOOLEAN* Retry, - _Inout_ PERROR_LOG_CONTEXT LogContext - ) -{ - // Always log the error in our internal log. - // If logError is set, also log the error in the system log. - PSENSE_DATA senseBuffer = (PSENSE_DATA)Srb->SenseInfoBuffer; - ULONG totalSize = 0; - ULONG senseBufferSize = 0; - IO_ERROR_LOG_PACKET staticErrLogEntry = {0}; - CDROM_ERROR_LOG_DATA staticErrLogData = {0}; - - // Calculate the total size of the error log entry. - // add to totalSize in the order that they are used. - // the advantage to calculating all the sizes here is - // that we don't have to do a bunch of extraneous checks - // later on in this code path. - totalSize = sizeof(IO_ERROR_LOG_PACKET) // required - + sizeof(CDROM_ERROR_LOG_DATA); // struct for ease - - // also save any available extra sense data, up to the maximum errlog - // packet size . WMI should be used for real-time analysis. - // the event log should only be used for post-mortem debugging. - if (TEST_FLAG(Srb->SrbStatus, SRB_STATUS_AUTOSENSE_VALID)) - { - ULONG validSenseBytes; - BOOLEAN validSense; - - // make sure we can at least access the AdditionalSenseLength field - validSense = RTL_CONTAINS_FIELD(senseBuffer, - Srb->SenseInfoBufferLength, - AdditionalSenseLength); - if (validSense) - { - // if extra info exists, copy the maximum amount of available - // sense data that is safe into the the errlog. - validSenseBytes = senseBuffer->AdditionalSenseLength - + offsetof(SENSE_DATA, AdditionalSenseLength); - - // this is invalid because it causes overflow! - // whoever sent this type of request would cause - // a system crash. - NT_ASSERT(validSenseBytes < MAX_ADDITIONAL_SENSE_BYTES); - - // set to save the most sense buffer possible - senseBufferSize = max(validSenseBytes, sizeof(SENSE_DATA)); - senseBufferSize = min(senseBufferSize, Srb->SenseInfoBufferLength); - } - else - { - // it's smaller than required to read the total number of - // valid bytes, so just use the SenseInfoBufferLength field. - senseBufferSize = Srb->SenseInfoBufferLength; - } - - // Bump totalSize by the number of extra senseBuffer bytes - // (beyond the default sense buffer within CDROM_ERROR_LOG_DATA). - // Make sure to never allocate more than ERROR_LOG_MAXIMUM_SIZE. - if (senseBufferSize > sizeof(SENSE_DATA)) - { - totalSize += senseBufferSize-sizeof(SENSE_DATA); - if (totalSize > ERROR_LOG_MAXIMUM_SIZE) - { - senseBufferSize -= totalSize-ERROR_LOG_MAXIMUM_SIZE; - totalSize = ERROR_LOG_MAXIMUM_SIZE; - } - } - } - - // If we've used up all of our retry attempts, set the final status to - // reflect the appropriate result. - // - // ISSUE: the test below should also check RetriedCount to determine if we will actually retry, - // but there is no easy test because we'd have to consider the original retry count - // for the op; besides, InterpretTransferPacketError sometimes ignores the retry - // decision returned by this function. So just ErrorRetried to be true in the majority case. - // - if (*Retry) - { - staticErrLogEntry.FinalStatus = STATUS_SUCCESS; - staticErrLogData.ErrorRetried = TRUE; - } - else - { - staticErrLogEntry.FinalStatus = *Status; - } - - // Don't log generic IO_WARNING_PAGING_FAILURE message if either the - // I/O is retried, or it completed successfully. - if ((LogContext->ErrorCode == IO_WARNING_PAGING_FAILURE) && - (*Retry || NT_SUCCESS(*Status)) ) - { - LogContext->LogError = FALSE; - } - - if (TEST_FLAG(Srb->SrbFlags, SRB_CLASS_FLAGS_PAGING)) - { - staticErrLogData.ErrorPaging = TRUE; - } - - staticErrLogData.ErrorUnhandled = LogContext->ErrorUnhandled; - - // Calculate the device offset if there is a geometry. - staticErrLogEntry.DeviceOffset.QuadPart = (LONGLONG)LogContext->BadSector; - staticErrLogEntry.DeviceOffset.QuadPart *= (LONGLONG)DeviceExtension->DiskGeometry.BytesPerSector; - - if (LogContext->ErrorCode == -1) - { - staticErrLogEntry.ErrorCode = STATUS_IO_DEVICE_ERROR; - } - else - { - staticErrLogEntry.ErrorCode = LogContext->ErrorCode; - } - - // The dump data follows the IO_ERROR_LOG_PACKET - staticErrLogEntry.DumpDataSize = (USHORT)totalSize - sizeof(IO_ERROR_LOG_PACKET); - - staticErrLogEntry.SequenceNumber = 0; - staticErrLogEntry.MajorFunctionCode = MajorFunctionCode; - staticErrLogEntry.IoControlCode = IoControlCode; - staticErrLogEntry.RetryCount = (UCHAR)RetriedCount; - staticErrLogEntry.UniqueErrorValue = LogContext->UniqueErrorValue; - - KeQueryTickCount(&staticErrLogData.TickCount); - staticErrLogData.PortNumber = (ULONG)-1; - - // Save the entire contents of the SRB. - staticErrLogData.Srb = *Srb; - - // For our private log, save just the default length of the SENSE_DATA. - if (senseBufferSize != 0) - { - RtlCopyMemory(&staticErrLogData.SenseData, senseBuffer, min(senseBufferSize, sizeof(SENSE_DATA))); - } - - // Save the error log in our context. - // We only save the default sense buffer length. - { - KIRQL oldIrql; - KeAcquireSpinLock(&DeviceExtension->PrivateFdoData->SpinLock, &oldIrql); - DeviceExtension->PrivateFdoData->ErrorLogs[DeviceExtension->PrivateFdoData->ErrorLogNextIndex] = staticErrLogData; - DeviceExtension->PrivateFdoData->ErrorLogNextIndex++; - DeviceExtension->PrivateFdoData->ErrorLogNextIndex %= NUM_ERROR_LOG_ENTRIES; - KeReleaseSpinLock(&DeviceExtension->PrivateFdoData->SpinLock, oldIrql); - } - - // If logError is set, also save this log in the system's error log. - // But make sure we don't log TUR failures over and over - // (e.g. if an external drive was switched off and we're still sending TUR's to it every second). - if (LogContext->LogError) - { - // We do not want to log certain system events repetitively - switch (((PCDB)Srb->Cdb)->CDB10.OperationCode) - { - case SCSIOP_TEST_UNIT_READY: - { - if (DeviceExtension->PrivateFdoData->LoggedTURFailureSinceLastIO) - { - LogContext->LogError = FALSE; - } - else - { - DeviceExtension->PrivateFdoData->LoggedTURFailureSinceLastIO = TRUE; - } - - break; - } - - case SCSIOP_SYNCHRONIZE_CACHE: - { - if (DeviceExtension->PrivateFdoData->LoggedSYNCFailure) - { - LogContext->LogError = FALSE; - } - else - { - DeviceExtension->PrivateFdoData->LoggedSYNCFailure = TRUE; - } - - break; - } - } - - // Do not log 5/21/00 LOGICAL BLOCK ADDRESS OUT OF RANGE if the disc is blank, - // it is known to litter the Event Log with repetitive errors - // Do not log this error for READ, as it's known that File System mount process reads different sectors from media. - if (senseBufferSize > RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseCodeQualifier) && - senseBuffer->SenseKey == SCSI_SENSE_ILLEGAL_REQUEST && - senseBuffer->AdditionalSenseCode == SCSI_ADSENSE_ILLEGAL_BLOCK && - senseBuffer->AdditionalSenseCodeQualifier == 0 && - IS_SCSIOP_READ(((PCDB)Srb->Cdb)->CDB10.OperationCode)) - { - LogContext->LogError = FALSE; - } - } - - // Write the error log packet to the system error logging thread. - if (LogContext->LogError) - { - PIO_ERROR_LOG_PACKET errorLogEntry; - PCDROM_ERROR_LOG_DATA errlogData; - - errorLogEntry = (PIO_ERROR_LOG_PACKET)IoAllocateErrorLogEntry(DeviceExtension->DeviceObject, (UCHAR)totalSize); - if (errorLogEntry) - { - errlogData = (PCDROM_ERROR_LOG_DATA)errorLogEntry->DumpData; - - *errorLogEntry = staticErrLogEntry; - *errlogData = staticErrLogData; - - // For the system log, copy as much of the sense buffer as possible. - if (senseBufferSize != 0) - { - RtlCopyMemory(&errlogData->SenseData, senseBuffer, senseBufferSize); - } - - // errorLogEntry - It will be freed by the kernel. - IoWriteErrorLogEntry(errorLogEntry); - } - } - - return; -} - -VOID -SenseInfoInterpretRefineByScsiCommand( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSCSI_REQUEST_BLOCK Srb, - _In_ ULONG RetriedCount, - _In_ LONGLONG Total100nsSinceFirstSend, - _In_ BOOLEAN OverrideVerifyVolume, - _Inout_ BOOLEAN* Retry, - _Inout_ NTSTATUS* Status, - _Inout_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) - LONGLONG* RetryIntervalIn100ns - ) -/*++ - -Routine Description: - - Based on SCSI command, modify the interpretion result. - -Arguments: - - DeviceExtension - device extension. - Srb - Supplies the scsi request block which failed. - RetriedCount - retried count. - Total100nsUnitsSinceFirstSend - time spent after the request was sent down first time. - OverrideVerifyVolume - should override verify volume request. - -Return Value: - - Retry - the reques should be retried or not. - Status - Returns the status for the request. - RetryInterval - waiting time (in 100ns) before the request should be retried. - Zero indicates the request should be immediately retried. - ---*/ -{ - UCHAR const opCode = Srb->Cdb[0]; - CDB const* cdb = (CDB const*)(Srb->Cdb); - PSENSE_DATA senseBuffer = (PSENSE_DATA)Srb->SenseInfoBuffer; - - if (opCode == SCSIOP_MEDIUM_REMOVAL) - { - if (( cdb->AsByte[1] == 0) && - ( cdb->AsByte[2] == 0) && - ( cdb->AsByte[3] == 0) && - ((cdb->AsByte[4] & 0xFC) == 0) - ) - { - // byte[4] == 0x3 or byte[4] == 0x1 == UNLOCK OF MEDIA - if ((cdb->AsByte[4] & 0x01) == 0) - { - if (RetriedCount < TOTAL_COUNT_RETRY_DEFAULT) - { - // keep retrying unlock operation for several times - *Retry = TRUE; - } - } - else // LOCK REQUEST - { - // do not retry LOCK requests more than once (per CLASSPNP code) - if (RetriedCount > TOTAL_COUNT_RETRY_LOCK_MEDIA) - { - *Retry = FALSE; - } - } - } - - // want a minimum time to retry of 2 seconds - if ((*Status == STATUS_DEVICE_NOT_READY) && - (senseBuffer->AdditionalSenseCode == SCSI_ADSENSE_LUN_NOT_READY)) - { - *RetryIntervalIn100ns = max(*RetryIntervalIn100ns, SECONDS_TO_100NS_UNITS(2)); - } - else if (SRB_STATUS(Srb->SrbStatus) == SRB_STATUS_SELECTION_TIMEOUT) - { - *RetryIntervalIn100ns = max(*RetryIntervalIn100ns, SECONDS_TO_100NS_UNITS(2)); - } - } - else if ((opCode == SCSIOP_MODE_SENSE) || (opCode == SCSIOP_MODE_SENSE10)) - { - // want a minimum time to retry of 2 seconds - if ((*Status == STATUS_DEVICE_NOT_READY) && - (senseBuffer->AdditionalSenseCode == SCSI_ADSENSE_LUN_NOT_READY)) - { - *RetryIntervalIn100ns = max(*RetryIntervalIn100ns, SECONDS_TO_100NS_UNITS(2)); - } - else if (SRB_STATUS(Srb->SrbStatus) == SRB_STATUS_SELECTION_TIMEOUT) - { - *RetryIntervalIn100ns = max(*RetryIntervalIn100ns, SECONDS_TO_100NS_UNITS(2)); - } - - // Want to ignore a STATUS_VERIFY_REQUIRED error because it either - // doesn't make sense or is required to satisfy the VERIFY. - if (*Status == STATUS_VERIFY_REQUIRED) - { - *Retry = TRUE; - } - else if (SRB_STATUS(Srb->SrbStatus) == SRB_STATUS_DATA_OVERRUN) - { - /* - * This is a HACK. - * Atapi returns SRB_STATUS_DATA_OVERRUN when it really means - * underrun (i.e. success, and the buffer is longer than needed). - * So treat this as a success. - * When the caller of this function sees that the status was changed to success, - * it will add the transferred length to the original irp. - */ - *Status = STATUS_SUCCESS; - *Retry = FALSE; - } - - // limit the count of retries - if (RetriedCount > TOTAL_COUNT_RETRY_MODESENSE) - { - *Retry = FALSE; - } - } - else if ((opCode == SCSIOP_READ_CAPACITY) || (opCode == SCSIOP_READ_CAPACITY16)) - { - // Want to ignore a STATUS_VERIFY_REQUIRED error because it either - // doesn't make sense or is required to satisfy the VERIFY. - if (*Status == STATUS_VERIFY_REQUIRED) - { - *Retry = TRUE; - } - - if (RetriedCount > TOTAL_COUNT_RETRY_READ_CAPACITY) - { - *Retry = FALSE; - } - } - else if ((opCode == SCSIOP_RESERVE_UNIT) || (opCode == SCSIOP_RELEASE_UNIT)) - { - // The RESERVE(6) / RELEASE(6) commands are optional. - // So if they aren't supported, try the 10-byte equivalents - if (*Status == STATUS_INVALID_DEVICE_REQUEST) - { - PCDB tempCdb = (PCDB)Srb->Cdb; - - Srb->CdbLength = 10; - tempCdb->CDB10.OperationCode = (tempCdb->CDB6GENERIC.OperationCode == SCSIOP_RESERVE_UNIT) - ? SCSIOP_RESERVE_UNIT10 - : SCSIOP_RELEASE_UNIT10; - - SET_FLAG(DeviceExtension->PrivateFdoData->HackFlags, FDO_HACK_NO_RESERVE6); - *Retry = TRUE; - } - } - else if (IS_SCSIOP_READWRITE(opCode)) - { - // Retry if still verifying a (possibly) reloaded disk/cdrom. - if (OverrideVerifyVolume && (*Status == STATUS_VERIFY_REQUIRED)) - { - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - } - - // Special case for streaming READ/WRITE commands - if (((opCode == SCSIOP_READ12) && (cdb->READ12.Streaming == 1)) || - ((opCode == SCSIOP_WRITE12) && (cdb->WRITE12.Streaming == 1))) - { - // We've got a failure while performing a streaming operation and now need to guess if - // it's likely to be a permanent error because the drive does not support streaming at all - // (in which case we're going to fall back to normal reads/writes), or a transient error - // (in which case we quickly fail the request but contrinue to use streaming). - // - // We analyze the sense information to make that decision. Bus resets and device timeouts - // are treated as permanent errors, because some non-compliant devices may even hang when - // they get a command that they do not expect. - - BOOLEAN disableStreaming = FALSE; - - if (SRB_STATUS(Srb->SrbStatus) == SRB_STATUS_TIMEOUT || - SRB_STATUS(Srb->SrbStatus) == SRB_STATUS_COMMAND_TIMEOUT || - SRB_STATUS(Srb->SrbStatus) == SRB_STATUS_SELECTION_TIMEOUT || - SRB_STATUS(Srb->SrbStatus) == SRB_STATUS_BUS_RESET) - { - disableStreaming = TRUE; - } - else if ((senseBuffer->SenseKey &0xf) == SCSI_SENSE_UNIT_ATTENTION) - { - if (senseBuffer->AdditionalSenseCode == SCSI_ADSENSE_BUS_RESET || - senseBuffer->AdditionalSenseCode == SCSI_ADSENSE_INSUFFICIENT_TIME_FOR_OPERATION) - { - disableStreaming = TRUE; - } - } - else if ((senseBuffer->SenseKey &0xf) == SCSI_SENSE_ILLEGAL_REQUEST) - { - // LBA Out of Range is an exception, as it's more likely to be caused by - // upper layers attempting to read/write a wrong LBA. - if (senseBuffer->AdditionalSenseCode != SCSI_ADSENSE_ILLEGAL_BLOCK) - { - disableStreaming = TRUE; - } - } - - if (disableStreaming) - { - // if the failure looks permanent, we disable streaming for all future reads/writes - // and retry the command immediately - SET_FLAG(DeviceExtension->PrivateFdoData->HackFlags, FDO_HACK_NO_STREAMING); - *Retry = TRUE; - *RetryIntervalIn100ns = 0; - } - else - { - // if the failure looks transient, we simply fail the current request without retries - // to minimize the time of processing - *Retry = FALSE; - } - } - - // Special-case handling of READ/WRITE commands. These commands now have a 120 second timeout, - // but the preferred behavior (and that taken by many drives) is to immediately report 2/4/x - // on OPC and similar commands. Thus, retries must occur for at least 160 seconds - // (120 seconds + four 10 second retries) as a conservative guess. - // Note: 160s retry time is also a result of discussion with OEMs for case of 2/4/7 and 2/4/8. - if (*Retry) - { - if ((Total100nsSinceFirstSend < 0) || - (((senseBuffer->SenseKey &0xf) == SCSI_SENSE_HARDWARE_ERROR) && (senseBuffer->AdditionalSenseCode == 0x09))) - { - // time information is not valid. use default retry count. - // or if it's SERVO FAILURE, use retry count instead of 160s retry. - *Retry = (RetriedCount <= TOTAL_COUNT_RETRY_DEFAULT); - } - else if (Total100nsSinceFirstSend > SECONDS_TO_100NS_UNITS(TOTAL_SECONDS_RETRY_TIME_WRITE)) - { - *Retry = FALSE; - } - - // How long should we request a delay for during writing? This depends entirely on - // the current write speed of the drive. If we request retries too quickly, - // we can overload the processor on the drive (resulting in garbage being written), - // but too slowly results in lesser performance. - // - *RetryIntervalIn100ns = DeviceExtension->DeviceAdditionalData.ReadWriteRetryDelay100nsUnits; - - } // end retry for 160 seconds modification - } - else if (opCode == SCSIOP_GET_PERFORMANCE) - { - if (SRB_STATUS(Srb->SrbStatus) == SRB_STATUS_DATA_OVERRUN) - { - // This is a HACK. - // Atapi returns SRB_STATUS_DATA_OVERRUN when it really means - // underrun (i.e. success, and the buffer is longer than needed). - // So treat this as a success. - // When the caller of this function sees that the status was changed to success, - // it will add the transferred length to the original irp. - *Status = STATUS_SUCCESS; - *Retry = FALSE; - } - - if ((Srb->SenseInfoBufferLength < RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA,AdditionalSenseCodeQualifier)) || - !TEST_FLAG(Srb->SrbStatus, SRB_STATUS_AUTOSENSE_VALID)) - { - // If get configuration command is failing and if the request type is TYPE ONE - // then most likely the device does not support this request type. Set the - // flag so that the TYPE ONE requests will be tried as TYPE ALL requets. - if ((SRB_STATUS(Srb->SrbStatus) != SRB_STATUS_SUCCESS) && - (SRB_STATUS(Srb->SrbStatus) != SRB_STATUS_DATA_OVERRUN) && - (((PCDB)Srb->Cdb)->GET_CONFIGURATION.RequestType == SCSI_GET_CONFIGURATION_REQUEST_TYPE_ONE)) - { - - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "TYPE ONE GetConfiguration failed. Set hack flag and retry.\n")); - SET_FLAG(DeviceExtension->DeviceAdditionalData.HackFlags, CDROM_HACK_BAD_TYPE_ONE_GET_CONFIG); - *Retry = TRUE; - } - } - - // limit retries to GET_PERFORMANCE commands to default retry count - if (RetriedCount > TOTAL_COUNT_RETRY_DEFAULT) - { - *Retry = FALSE; - } - } - else // default handler -- checks for retry count only. - { - if (RetriedCount > TOTAL_COUNT_RETRY_DEFAULT) - { - *Retry = FALSE; - } - } - - return; -} - - -VOID -SenseInfoInterpretRefineByIoControl( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ ULONG IoControlCode, - _In_ BOOLEAN OverrideVerifyVolume, - _Inout_ BOOLEAN* Retry, - _Inout_ NTSTATUS* Status - ) -/*++ - -Routine Description: - - Based on IOCTL code, modify the interpretion result. - -Arguments: - - Device - Supplies the device object associated with this request. - OriginalRequest - the irp that error occurs on. - Srb - Supplies the scsi request block which failed. - MajorFunctionCode - Supplies the function code to be used for logging. - IoDeviceCode - Supplies the device code to be used for logging. - PreviousRetryCount - retried count. - RequestHistory_DoNotUse - the history list - -Return Value: - - BOOLEAN TRUE: Drivers should retry this request. - FALSE: Drivers should not retry this request. - Status - Returns the status for the request. - RetryInterval - Number of seconds before the request should be retried. - Zero indicates the request should be immediately retried. - ---*/ -{ - PAGED_CODE(); - - if ((IoControlCode == IOCTL_CDROM_GET_LAST_SESSION) || - (IoControlCode == IOCTL_CDROM_READ_TOC) || - (IoControlCode == IOCTL_CDROM_READ_TOC_EX) || - (IoControlCode == IOCTL_CDROM_GET_CONFIGURATION)|| - (IoControlCode == IOCTL_CDROM_GET_VOLUME)) - { - if (*Status == STATUS_DATA_OVERRUN) - { - *Status = STATUS_SUCCESS; - *Retry = FALSE; - } - } - - if (IoControlCode == IOCTL_CDROM_READ_Q_CHANNEL) - { - PLAY_ACTIVE(DeviceExtension) = FALSE; - } - - // If the status is verified required and the this request - // should bypass verify required then retry the request. - if (OverrideVerifyVolume && (*Status == STATUS_VERIFY_REQUIRED)) - { - // note: status gets overwritten here - *Status = STATUS_IO_DEVICE_ERROR; - *Retry = TRUE; - - if ((IoControlCode == IOCTL_CDROM_CHECK_VERIFY) || - (IoControlCode == IOCTL_STORAGE_CHECK_VERIFY) || - (IoControlCode == IOCTL_STORAGE_CHECK_VERIFY2) || - (IoControlCode == IOCTL_DISK_CHECK_VERIFY) - ) - { - // Update the geometry information, as the media could have changed. - (VOID) MediaReadCapacity(DeviceExtension->Device); - } // end of ioctls to update capacity - } - - if (!NT_SUCCESS(*Status) && (IoControlCode == IOCTL_CDROM_SET_SPEED)) - { - // If set speed request fails then we should disable the restore speed option. - // Otherwise we will try to restore to default speed on next media change, - // if requested by the caller. - DeviceExtension->DeviceAdditionalData.RestoreDefaults = FALSE; - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "Disable restore default\n")); - } - - return; -} - -BOOLEAN -SenseInfoInterpret( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ PSCSI_REQUEST_BLOCK Srb, - _In_ ULONG RetriedCount, - _Out_ NTSTATUS* Status, - _Out_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) - LONGLONG* RetryIntervalIn100ns - ) -/*++ - -SenseInfoInterpret() - -Routine Description: - - This routine interprets the data returned from the SCSI request sense. - It determines the status to return in the IRP - and whether this request can be retried. - -Arguments: - - Device - Supplies the device object associated with this request. - Srb - Supplies the scsi request block which failed. - MajorFunctionCode - Supplies the function code to be used for logging. - IoDeviceCode - Supplies the device code to be used for logging. - -Return Value: - - BOOLEAN TRUE: Drivers should retry this request. - FALSE: Drivers should not retry this request. - Status - Returns the status for the request. - RetryInterval - Number of seconds before the request should be retried. - Zero indicates the request should be immediately retried. - ---*/ -{ - ULONG retryIntervalInSeconds = 0; - BOOLEAN retry = TRUE; - PSENSE_DATA senseBuffer = Srb->SenseInfoBuffer; - ULONG readSector = 0; - ERROR_LOG_CONTEXT logContext; - - UCHAR majorFunctionCode = 0; - ULONG ioControlCode = 0; - BOOLEAN overrideVerifyVolume = FALSE; - ULONGLONG total100nsSinceFirstSend = 0; - PZERO_POWER_ODD_INFO zpoddInfo = DeviceExtension->ZeroPowerODDInfo; - - // - *Status = STATUS_IO_DEVICE_ERROR; - - RtlZeroMemory(&logContext, sizeof(ERROR_LOG_CONTEXT)); - logContext.ErrorCode = -1; - - // Get Original Request related information - SenseInfoRequestGetInformation(Request, - &majorFunctionCode, - &ioControlCode, - &overrideVerifyVolume, - &total100nsSinceFirstSend); - - if(TEST_FLAG(Srb->SrbFlags, SRB_CLASS_FLAGS_PAGING)) - { - // Log anything remotely incorrect about paging i/o - logContext.LogError = TRUE; - logContext.UniqueErrorValue = 301; - logContext.ErrorCode = IO_WARNING_PAGING_FAILURE; - } - - // must handle the SRB_STATUS_INTERNAL_ERROR case first, - // as it has all the flags set. - if (SRB_STATUS(Srb->SrbStatus) == SRB_STATUS_INTERNAL_ERROR) - { - TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, - "SenseInfoInterpret: Internal Error code is %x\n", - Srb->InternalStatus)); - - retry = FALSE; - *Status = Srb->InternalStatus; - } - else if (Srb->ScsiStatus == SCSISTAT_RESERVATION_CONFLICT) - { - retry = FALSE; - *Status = STATUS_DEVICE_BUSY; - logContext.LogError = FALSE; - } - else if ((Srb->SrbStatus & SRB_STATUS_AUTOSENSE_VALID) && - (Srb->SenseInfoBufferLength >= RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseLength))) - { - UCHAR senseKey = (UCHAR)(senseBuffer->SenseKey & 0x0f); - UCHAR additionalSenseCode = 0; - UCHAR additionalSenseCodeQual = 0; - - // Zero the additional sense code and additional sense code qualifier - // if they were not returned by the device. - readSector = senseBuffer->AdditionalSenseLength + offsetof(SENSE_DATA, AdditionalSenseLength); - if (readSector > Srb->SenseInfoBufferLength) - { - readSector = Srb->SenseInfoBufferLength; - } - - additionalSenseCode = (readSector >= RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseCode)) ? - senseBuffer->AdditionalSenseCode : 0; - additionalSenseCodeQual = (readSector >= RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseCodeQualifier)) ? - senseBuffer->AdditionalSenseCodeQualifier : 0; - - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "SCSI Error - \n" - "\tcdb: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n" - "\tsrb status: %X; sense: %02X/%02X/%02X; Retried count: %d\n\n", - Srb->Cdb[0], Srb->Cdb[1], Srb->Cdb[2], Srb->Cdb[3], Srb->Cdb[4], Srb->Cdb[5], - Srb->Cdb[6], Srb->Cdb[7], Srb->Cdb[8], Srb->Cdb[9], Srb->Cdb[10], Srb->Cdb[11], - Srb->Cdb[12], Srb->Cdb[13], Srb->Cdb[14], Srb->Cdb[15], - SRB_STATUS(Srb->SrbStatus), - senseKey, - additionalSenseCode, - additionalSenseCodeQual, - RetriedCount)); - - if (senseKey == SCSI_SENSE_UNIT_ATTENTION) - { - ULONG mediaChangeCount; - - // A media change may have occured so increment the change count for the physical device - mediaChangeCount = InterlockedIncrement((PLONG)&DeviceExtension->MediaChangeCount); - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN, - "SenseInfoInterpret: Media change count for device %d incremented to %#lx\n", - DeviceExtension->DeviceNumber, mediaChangeCount)); - } - - if ((zpoddInfo != NULL) && - (((PCDB)Srb->Cdb)->CDB6GENERIC.OperationCode == SCSIOP_TEST_UNIT_READY)) - { - // This sense code is in response to the Test Unit Ready sent during delayed power down - // request. Copy the sense data into the zpoddInfo structure for later processing. - zpoddInfo->SenseKey = senseKey; - zpoddInfo->AdditionalSenseCode = additionalSenseCode; - zpoddInfo->AdditionalSenseCodeQualifier = additionalSenseCodeQual; - } - - // Interpret error by specific ASC & ASCQ first, - // If the error is not handled, interpret using f - { - BOOLEAN notHandled = FALSE; - notHandled = SenseInfoInterpretByAdditionalSenseCode(DeviceExtension, - Srb, - additionalSenseCode, - additionalSenseCodeQual, - Status, - &retry, - &retryIntervalInSeconds, - &logContext); - - if (notHandled) - { - SenseInfoInterpretBySenseKey(DeviceExtension, - senseBuffer, - senseKey, - Status, - &retry, - &retryIntervalInSeconds, - &logContext); - } - } - - // Try to determine the bad sector from the inquiry data. - if ((IS_SCSIOP_READWRITE(((PCDB)Srb->Cdb)->CDB10.OperationCode)) || - (((PCDB)Srb->Cdb)->CDB10.OperationCode == SCSIOP_VERIFY) || - (((PCDB)Srb->Cdb)->CDB10.OperationCode == SCSIOP_VERIFY16)) - { - ULONG index; - readSector = 0; - - for (index = 0; index < 4; index++) - { - logContext.BadSector = (logContext.BadSector << 8) | senseBuffer->Information[index]; - } - - for (index = 0; index < 4; index++) - { - readSector = (readSector << 8) | Srb->Cdb[index+2]; - } - - index = (((PCDB)Srb->Cdb)->CDB10.TransferBlocksMsb << 8) | - ((PCDB)Srb->Cdb)->CDB10.TransferBlocksLsb; - - // Make sure the bad sector is within the read sectors. - if (!(logContext.BadSector >= readSector && logContext.BadSector < (readSector + index))) - { - logContext.BadSector = readSector; - } - } - } - else - { - // Request sense buffer not valid. No sense information - // to pinpoint the error. Return general request fail. - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "SCSI Error - \n" - "\tcdb: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n" - "\tsrb status: %X; sense info not valid; Retried count: %d\n\n", - Srb->Cdb[0], Srb->Cdb[1], Srb->Cdb[2], Srb->Cdb[3], Srb->Cdb[4], Srb->Cdb[5], - Srb->Cdb[6], Srb->Cdb[7], Srb->Cdb[8], Srb->Cdb[9], Srb->Cdb[10], Srb->Cdb[11], - Srb->Cdb[12], Srb->Cdb[13], Srb->Cdb[14], Srb->Cdb[15], - SRB_STATUS(Srb->SrbStatus), - RetriedCount)); - - SenseInfoInterpretBySrbStatus(DeviceExtension, - Srb, - RetriedCount, - Status, - &retry, - &retryIntervalInSeconds, - &logContext); - } - - // all functions using unit - seconds for retry Interval already be called. - *RetryIntervalIn100ns = SECONDS_TO_100NS_UNITS(retryIntervalInSeconds); - - // call the device specific error handler if it has one. - // DeviceErrorHandlerForMmmc() for all MMC devices - // or DeviceErrorHandlerForHitachiGD2000() for HITACHI GD-2000, HITACHI DVD-ROM GD-2000 - if (DeviceExtension->DeviceAdditionalData.ErrorHandler) - { - DeviceExtension->DeviceAdditionalData.ErrorHandler(DeviceExtension, Srb, Status, &retry); - } - - // Refine retry based on SCSI command - SenseInfoInterpretRefineByScsiCommand(DeviceExtension, - Srb, - RetriedCount, - total100nsSinceFirstSend, - overrideVerifyVolume, - &retry, - Status, - RetryIntervalIn100ns); - - // Refine retry based on IOCTL code. - if (majorFunctionCode == IRP_MJ_DEVICE_CONTROL) - { - SenseInfoInterpretRefineByIoControl(DeviceExtension, - ioControlCode, - overrideVerifyVolume, - &retry, - Status); - } - - // LOG the error: - // Always log the error in our internal log. - // If logError is set, also log the error in the system log. - SenseInfoLogError(DeviceExtension, - Srb, - majorFunctionCode, - ioControlCode, - RetriedCount, - Status, - &retry, - &logContext); - - // all process about the error done. check if the irp was cancelled. - if ((!NT_SUCCESS(*Status)) && retry) - { - PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request); - - if ((requestContext->OriginalRequest != NULL) && - WdfRequestIsCanceled(requestContext->OriginalRequest) - ) - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "Request %p was cancelled when it would have been retried\n", - requestContext->OriginalRequest)); - - *Status = STATUS_CANCELLED; - retry = FALSE; - *RetryIntervalIn100ns = 0; - } - } - - // now, all decisions are made. display trace information. - if (retry) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "Command shall be retried in %2I64d.%03I64d seconds\n", - (*RetryIntervalIn100ns / UNIT_100NS_PER_SECOND), - (*RetryIntervalIn100ns / 10000) % 1000 - )); - } - else - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "Will not retry; Sense/ASC/ASCQ of %02x/%02x/%02x\n", - senseBuffer->SenseKey, - senseBuffer->AdditionalSenseCode, - senseBuffer->AdditionalSenseCodeQualifier - )); - } - - return retry; - -} // end SenseInfoInterpret() - - -BOOLEAN -SenseInfoInterpretForZPODD( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ PSCSI_REQUEST_BLOCK Srb, - _Out_ NTSTATUS* Status, - _Out_ _Out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) - LONGLONG* RetryIntervalIn100ns - ) -/*++ - -SenseInfoInterpretForZPODD() - -Routine Description: - - This routine interprets the data returned from the SCSI request sense. - It determines the status to return in the IRP - and whether this request can be retried. - -Arguments: - - Device - Supplies the device object associated with this request. - Srb - Supplies the scsi request block which failed. - -Return Value: - - BOOLEAN TRUE: Drivers should retry this request. - FALSE: Drivers should not retry this request. - Status - Returns the status for the request. - RetryInterval - Number of seconds before the request should be retried. - Zero indicates the request should be immediately retried. - ---*/ -{ - BOOLEAN retry = FALSE; - PSENSE_DATA senseBuffer = Srb->SenseInfoBuffer; - ULONG readSector = 0; - PZERO_POWER_ODD_INFO zpoddInfo = DeviceExtension->ZeroPowerODDInfo; - - *Status = STATUS_IO_DEVICE_ERROR; - *RetryIntervalIn100ns = 0; - - if (zpoddInfo->RetryFirstCommand != FALSE) - { - // The first command to the logical unit after power resumed will be terminated - // with CHECK CONDITION Status, 6/29/00 POWER ON, RESET, OR BUS DEVICE RESET OCCURRED - - // We have observed some devices return a different sense code, and thus as long as - // the first command after power resume fails, we just retry one more time. - zpoddInfo->RetryFirstCommand = FALSE; - - retry = TRUE; - } - else if ((Srb->SrbStatus & SRB_STATUS_AUTOSENSE_VALID) && - (Srb->SenseInfoBufferLength >= RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseLength))) - { - UCHAR senseKey = (UCHAR)(senseBuffer->SenseKey & 0x0f); - UCHAR additionalSenseCode = 0; - UCHAR additionalSenseCodeQual = 0; - - // Zero the additional sense code and additional sense code qualifier - // if they were not returned by the device. - readSector = senseBuffer->AdditionalSenseLength + offsetof(SENSE_DATA, AdditionalSenseLength); - if (readSector > Srb->SenseInfoBufferLength) - { - readSector = Srb->SenseInfoBufferLength; - } - - additionalSenseCode = (readSector >= RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseCode)) ? - senseBuffer->AdditionalSenseCode : 0; - additionalSenseCodeQual = (readSector >= RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseCodeQualifier)) ? - senseBuffer->AdditionalSenseCodeQualifier : 0; - - // If sense code is 2/4/1, device is becoming ready from ZPODD mode. According to Mt Fuji, device - // could take up to 800msec to be fully operational. - if ((senseKey == SCSI_SENSE_NOT_READY) && - (additionalSenseCode == SCSI_ADSENSE_LUN_NOT_READY) && - (additionalSenseCodeQual == SCSI_SENSEQ_BECOMING_READY)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "SenseInfoInterpretForZPODD: In process of becoming ready\n")); - - zpoddInfo->BecomingReadyRetryCount--; - - if (zpoddInfo->BecomingReadyRetryCount > 0) - { - DEVICE_EVENT_BECOMING_READY notReady = {0}; - - retry = TRUE; - *Status = STATUS_DEVICE_NOT_READY; - *RetryIntervalIn100ns = BECOMING_READY_RETRY_INTERNVAL_IN_100NS; - - notReady.Version = 1; - notReady.Reason = 1; - notReady.Estimated100msToReady = (ULONG) *RetryIntervalIn100ns / (1000 * 1000); - DeviceSendNotification(DeviceExtension, - &GUID_IO_DEVICE_BECOMING_READY, - sizeof(DEVICE_EVENT_BECOMING_READY), - ¬Ready); - } - } - } - - // now, all decisions are made. display trace information. - if (retry) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, - "Command shall be retried in %2I64d.%03I64d seconds\n", - (*RetryIntervalIn100ns / UNIT_100NS_PER_SECOND), - (*RetryIntervalIn100ns / 10000) % 1000 - )); - } - else - { - TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, - "Will not retry; Sense/ASC/ASCQ of %02x/%02x/%02x\n", - senseBuffer->SenseKey, - senseBuffer->AdditionalSenseCode, - senseBuffer->AdditionalSenseCodeQualifier - )); - } - - return retry; - -} // end SenseInfoInterpret() - - -BOOLEAN -RequestSenseInfoInterpret( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ WDFREQUEST Request, - _In_ PSCSI_REQUEST_BLOCK Srb, - _In_ ULONG RetriedCount, - _Out_ NTSTATUS* Status, - _Out_opt_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) - LONGLONG* RetryIntervalIn100ns - ) -/*++ - -Routine Description: - -Interpret the error, process it. - 1. Release device queue if it's frozen. - 2. Interpret and process the error. - -Arguments: - - DeviceExtension - Supplies the device object associated with this request. - Request - the Request that error occurs on. - Srb - Supplies the scsi request block which failed. - RetriedCount - retried count. - -Return Value: - - BOOLEAN TRUE: Drivers should retry this request. - FALSE: Drivers should not retry this request. - Status - Returns the status for the request. - RetryIntervalIn100nsUnits - Number of 100ns before the request should be retried. - Zero indicates the request should be immediately retried. - ---*/ -{ - BOOLEAN retry = FALSE; - LONGLONG retryIntervalIn100ns = 0; - PZERO_POWER_ODD_INFO zpoddInfo = DeviceExtension->ZeroPowerODDInfo; - - if (SRB_STATUS(Srb->SrbStatus) == SRB_STATUS_SUCCESS) - { - // request succeeded. - if ((zpoddInfo != NULL) && - (zpoddInfo->BecomingReadyRetryCount > 0)) - { - zpoddInfo->BecomingReadyRetryCount = 0; - } - - *Status = STATUS_SUCCESS; - retry = FALSE; - } - else - { - // request failed. We need to process the error. - - // 1. Release the queue if it is frozen. - if (Srb->SrbStatus & SRB_STATUS_QUEUE_FROZEN) - { - DeviceReleaseQueue(DeviceExtension->Device); - } - - if ((zpoddInfo != NULL) && - ((zpoddInfo->RetryFirstCommand != FALSE) || (zpoddInfo->BecomingReadyRetryCount > 0))) - { - retry = SenseInfoInterpretForZPODD(DeviceExtension, - Srb, - Status, - &retryIntervalIn100ns); - } - - if (retry == FALSE) - { - // 2. Error Processing - if ((zpoddInfo != NULL) && - (zpoddInfo->BecomingReadyRetryCount > 0)) - { - zpoddInfo->BecomingReadyRetryCount = 0; - } - - retry = SenseInfoInterpret(DeviceExtension, - Request, - Srb, - RetriedCount, - Status, - &retryIntervalIn100ns); - } - } - - if (RetryIntervalIn100ns != NULL) - { - *RetryIntervalIn100ns = retryIntervalIn100ns; - } - - return retry; -} - - -BOOLEAN -RequestSenseInfoInterpretForScratchBuffer( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ ULONG RetriedCount, - _Out_ NTSTATUS* Status, - _Out_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) - LONGLONG* RetryIntervalIn100ns - ) -/*++ - -Routine Description: - - to analyze the error occurred and set the status, retry interval and decide to retry or not. - -Arguments: - - DeviceExtension - device extension - RetriedCount - already retried count. - -Return Value: - - BOOLEAN - TRUE (should retry) - Status - NTSTATUS - RetryIntervalIn100nsUnits - retry interval - ---*/ -{ - NT_ASSERT(DeviceExtension->ScratchContext.ScratchInUse != 0); - - return RequestSenseInfoInterpret(DeviceExtension, - DeviceExtension->ScratchContext.ScratchRequest, - DeviceExtension->ScratchContext.ScratchSrb, - RetriedCount, - Status, - RetryIntervalIn100ns); -} - - diff --git a/storage/class/cdrom/src/zpodd.c b/storage/class/cdrom/src/zpodd.c deleted file mode 100644 index 9e729143..00000000 --- a/storage/class/cdrom/src/zpodd.c +++ /dev/null @@ -1,823 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation. All rights reserved. - -Module Name: - - zpodd.c - -Abstract: - - Code for Zero Power ODD support. - -Environment: - - kernel mode only - -Notes: - - -Revision History: - ---*/ - -#include "ntddk.h" -#include "ntddstor.h" -#include "wdmguid.h" -#include "cdrom.h" -#include "mmc.h" -#include "ioctl.h" -#include "scratch.h" - -#ifdef DEBUG_USE_WPP -#include "zpodd.tmh" -#endif - -_IRQL_requires_max_(PASSIVE_LEVEL) -ULONG -DeviceGetZPODDEnabledFromRegistry(); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceQueryD3ColdInterface( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Out_ PD3COLD_SUPPORT_INTERFACE D3ColdInterface - ); - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceSendEnableIdlePowerIoctl( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN WakeCapable, - _In_ BOOLEAN Enable, - _In_ ULONG D3IdleTimeout - ); - -#if ALLOC_PRAGMA - -#pragma alloc_text(PAGE, DeviceInitializeZPODD) -#pragma alloc_text(PAGE, DeviceGetZPODDEnabledFromRegistry) -#pragma alloc_text(PAGE, DeviceQueryD3ColdInterface) -#pragma alloc_text(PAGE, DeviceSendEnableIdlePowerIoctl) -#pragma alloc_text(PAGE, DeviceReleaseZPODDResources) -#pragma alloc_text(PAGE, DeviceZPODDIsInHomePosition) -#pragma alloc_text(PAGE, DeviceMarkActive) - -#endif - -#pragma warning(push) -#pragma warning(disable:4152) // nonstandard extension, function/data pointer conversion in expression -#pragma warning(disable:26000) // read overflow reported because of pointer type conversion - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceInitializeZPODD( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - This routine initialize the contents of ZPODD structure. - -Arguments: - - DeviceExtension - the device extension - -Return Value: - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - NTSTATUS tempStatus = STATUS_SUCCESS; - PZERO_POWER_ODD_INFO zpoddInfo = NULL; - PFEATURE_DATA_REMOVABLE_MEDIUM removableMediumHeader = NULL; - ULONG ZPODDEnabledInRegistry = 0; - PD3COLD_SUPPORT_INTERFACE d3ColdInterface = NULL; - DEVICE_WAKE_DEPTH deepestWakeableDstate = DeviceWakeDepthNotWakeable; - BOOLEAN inHomePosition = FALSE; - - PAGED_CODE(); - - if (DeviceExtension->ZeroPowerODDInfo != NULL) - { - // - // Already initialized. - // - - goto Cleanup; - } - - ZPODDEnabledInRegistry = DeviceGetZPODDEnabledFromRegistry(); - - if (ZPODDEnabledInRegistry == 0) - { - // - // User has explicitly disabled Zero Power ODD. - // - - status = STATUS_NOT_SUPPORTED; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "DeviceInitializeZPODD: ZPODD not enabled due to registry settings.\n" - )); - - goto Cleanup; - } - - zpoddInfo = ExAllocatePool2(POOL_FLAG_NON_PAGED, - sizeof(ZERO_POWER_ODD_INFO), - CDROM_TAG_ZERO_POWER_ODD); - - if (zpoddInfo == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - - goto Cleanup; - } - - // - // Check the system for the following prerequisites: - // - // 1. SATA: Device Attention line - // 2. SATA: Asynchronous Notification - // 3. ODD: LoChange / MediaRemoval - // 4. ACPI: Wake capable - // - // Only drawer and slot loading types have well defined behaviors in the spec, so only these two - // types are supported. - // - - // - // Check for DA & AN - // - - if ((DeviceExtension->PowerDescriptor == NULL) || - (DeviceExtension->PowerDescriptor->DeviceAttentionSupported == FALSE) || - (DeviceExtension->PowerDescriptor->AsynchronousNotificationSupported == FALSE)) - { - status = STATUS_NOT_SUPPORTED; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "DeviceInitializeZPODD: ZPODD not enabled due to SATA features not present.\n" - )); - - goto Cleanup; - } - - // - // Check for LoChange / MediaRemoval - // - - removableMediumHeader = (PFEATURE_DATA_REMOVABLE_MEDIUM) - DeviceFindFeaturePage(DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer, - DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBufferSize, - FeatureRemovableMedium); - - if ((removableMediumHeader == NULL) || - !((removableMediumHeader->LoadingMechanism == LOADING_MECHANISM_TRAY) && (removableMediumHeader->Load == 0) && // Drawer ... - (removableMediumHeader->DBML != FALSE)) && // requires LoChange/NotBusy - !((removableMediumHeader->LoadingMechanism == LOADING_MECHANISM_CADDY) && (removableMediumHeader->Load == 0) && // Slot ... - (DeviceExtension->MediaChangeDetectionInfo->Gesn.Supported != FALSE))) // requires MediaRemoval - { - status = STATUS_NOT_SUPPORTED; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "DeviceInitializeZPODD: ZPODD not enabled due to ODD features not present.\n" - )); - - goto Cleanup; - } - - zpoddInfo->LoadingMechanism = removableMediumHeader->LoadingMechanism; - zpoddInfo->Load = removableMediumHeader->Load; - - // - // Check for ACPI - // - - status = DeviceQueryD3ColdInterface(DeviceExtension, &zpoddInfo->D3ColdInterface); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "DeviceInitializeZPODD: Query D3Cold support interface failed.\n" - )); - - goto Cleanup; - } - - // - // If the platform supports Zero Power ODD, the following conditions must be met: - // - // 1. The deepest wakeable D-state for the device is D3Cold; - // 2. The platform supports D3Cold for the device. - // - - d3ColdInterface = &zpoddInfo->D3ColdInterface; - - status = d3ColdInterface->GetIdleWakeInfo(d3ColdInterface->Context, - PowerSystemWorking, - &deepestWakeableDstate); - - if (!NT_SUCCESS(status)) - { - goto Cleanup; - } - - // - // DeviceExtension->PowerDescriptor->D3ColdSupported is retrieved from lower layer. - // It has more accurate supportive information than just uses d3ColdInterface->GetD3ColdCapability - // - if ((deepestWakeableDstate != DeviceWakeDepthD3cold) || - (DeviceExtension->PowerDescriptor->D3ColdSupported == FALSE)) - { - status = STATUS_NOT_SUPPORTED; - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "DeviceInitializeZPODD: ZPODD not enabled due to ACPI support not present.\n" - )); - - goto Cleanup; - } - - // - // The system meets all requirements. Go ahead and enable ZPODD. - // - - // - // Register with the runtime power framework. - // Note that no un-registration is needed during tear-down. - // D3Cold will be enabled (success case of following call) or disabled by port driver during processing Enable Idle Power IOCTL. - // - - status = DeviceSendEnableIdlePowerIoctl(DeviceExtension, TRUE, TRUE, DELAY_TIME_TO_ENTER_ZERO_POWER_IN_MS); - - if (!NT_SUCCESS(status)) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "DeviceInitializeZPODD: ZPODD not enabled due to runtime power framework.\n" - )); - - goto Cleanup; - } - - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "DeviceInitializeZPODD: ZPODD is enabled.\n" - )); - - DeviceExtension->ZeroPowerODDInfo = zpoddInfo; - - // - // If device is not in home position, then we should take an active reference here - // to prevent it from being powered off. - // - - inHomePosition = DeviceZPODDIsInHomePosition(DeviceExtension); - - if (inHomePosition == FALSE) - { - TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_POWER, - "DeviceInitializeZPODD: not ready to power off, device marked as active\n")); - - DeviceMarkActive(DeviceExtension, TRUE, FALSE); - } - else - { - // - // cache get configuration response. - // failing is not critical, so we don't want to check for status here. - // - - if (zpoddInfo->GetConfigurationBuffer == NULL) - { - tempStatus = DeviceGetConfigurationWithAlloc(DeviceExtension->Device, - &zpoddInfo->GetConfigurationBuffer, - &zpoddInfo->GetConfigurationBufferSize, - FeatureProfileList, - SCSI_GET_CONFIGURATION_REQUEST_TYPE_ALL); - - UNREFERENCED_PARAMETER(tempStatus); // Avoid PREFAST warning. - } - } - -Cleanup: - - if (!NT_SUCCESS(status)) - { - // - // We register always even in non-ZPODD case, per request from storport. - // - - tempStatus = DeviceSendEnableIdlePowerIoctl(DeviceExtension, FALSE, FALSE, DELAY_TIME_TO_ENTER_ZERO_POWER_IN_MS); - - if (NT_SUCCESS(tempStatus)) - { - // - // Mark the device active; this reference will never be released unless the system enters a - // low power state. - // - - DeviceMarkActive(DeviceExtension, TRUE, FALSE); - } - - FREE_POOL(zpoddInfo); - } - - // - // If Zero Power ODD is not supported, we should not block the device init sequence. - // - - return STATUS_SUCCESS; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -ULONG -DeviceGetZPODDEnabledFromRegistry() -/*++ - -Routine Description: - - Get the ZeroPowerODDEnabled value from registry, which dictates if Zero Power ODD - should be enabled or not. If the value is not in registry, by default Zero - Power ODD is enabled. - -Arguments: - - None - -Return Value: - - ULONG - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - WDFKEY registryKey = NULL; - ULONG ZPODDEnabled = 0; - - DECLARE_CONST_UNICODE_STRING(registryValueName, L"ZeroPowerODDEnabled"); - - PAGED_CODE(); - - // - // open the Parameters key under the service key. - // - - status = WdfDriverOpenParametersRegistryKey(WdfGetDriver(), - KEY_READ, - WDF_NO_OBJECT_ATTRIBUTES, - ®istryKey); - - if (NT_SUCCESS(status)) - { - status = WdfRegistryQueryULong(registryKey, - ®istryValueName, - &ZPODDEnabled); - - WdfRegistryClose(registryKey); - } - - if (!NT_SUCCESS(status)) - { - // - // By default, Zero Power ODD is enabled - // - - ZPODDEnabled = 1; - } - - return ZPODDEnabled; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceQueryD3ColdInterface( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Out_ PD3COLD_SUPPORT_INTERFACE D3ColdInterface - ) -/*++ - -Routine Description: - - Queries ACPI for the D3Cold support interface. - -Arguments: - - DeviceExtension - the device extension - D3ColdInterface - output buffer receiving the interface - -Return Value: - - NTSTATUS - ---*/ -{ - PIRP irp = NULL; - KEVENT event; - NTSTATUS status = STATUS_SUCCESS; - PDEVICE_OBJECT targetDevice = NULL; - IO_STATUS_BLOCK ioStatus = {0}; - PIO_STACK_LOCATION irpStack = NULL; - - PAGED_CODE(); - - RtlZeroMemory(D3ColdInterface, sizeof(D3COLD_SUPPORT_INTERFACE)); - - // - // Query D3COLD support interface synchronously - // - - KeInitializeEvent(&event, NotificationEvent, FALSE); - - targetDevice = IoGetAttachedDeviceReference(DeviceExtension->DeviceObject); - - irp = IoBuildSynchronousFsdRequest(IRP_MJ_PNP, - targetDevice, - NULL, - 0, - 0, - &event, - &ioStatus); - - if (irp == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - - goto Cleanup; - } - - irp->IoStatus.Status = STATUS_NOT_SUPPORTED; - irp->IoStatus.Information = 0; - - irpStack = IoGetNextIrpStackLocation(irp); - irpStack->MinorFunction = IRP_MN_QUERY_INTERFACE; - irpStack->Parameters.QueryInterface.InterfaceType = (LPGUID) &GUID_D3COLD_SUPPORT_INTERFACE; - irpStack->Parameters.QueryInterface.Size = sizeof (D3COLD_SUPPORT_INTERFACE); - irpStack->Parameters.QueryInterface.Version = D3COLD_SUPPORT_INTERFACE_VERSION; - irpStack->Parameters.QueryInterface.Interface = (PINTERFACE) D3ColdInterface; - irpStack->Parameters.QueryInterface.InterfaceSpecificData = NULL; - - status = IoCallDriver(targetDevice, irp); - - if (status == STATUS_PENDING) - { - KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL); - - status = ioStatus.Status; - } - - if (!NT_SUCCESS(status)) - { - goto Cleanup; - } - - NT_ASSERT(D3ColdInterface->SetD3ColdSupport != NULL); - NT_ASSERT(D3ColdInterface->GetIdleWakeInfo != NULL); - NT_ASSERT(D3ColdInterface->GetD3ColdCapability != NULL); - -Cleanup: - - ObDereferenceObject(targetDevice); - - return status; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS -DeviceSendEnableIdlePowerIoctl( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN WakeCapable, - _In_ BOOLEAN Enable, - _In_ ULONG D3IdleTimeout - ) -/*++ - -Routine Description: - - Enables idle power support. - -Arguments: - - DeviceExtension - the device extension - WakeCapable - whether the device is wake capable - Enable - enable / disable idle power management - -Return Value: - - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - STORAGE_IDLE_POWER idlePower = {0}; - IO_STATUS_BLOCK ioStatus = {0}; - PIRP irp = NULL; - KEVENT event; - - PAGED_CODE(); - - idlePower.Version = 1; - idlePower.Size = sizeof (STORAGE_IDLE_POWER); - idlePower.WakeCapableHint = WakeCapable; - idlePower.D3ColdSupported = Enable; - idlePower.D3IdleTimeout = D3IdleTimeout; - - KeInitializeEvent(&event, NotificationEvent, FALSE); - - irp = IoBuildDeviceIoControlRequest(IOCTL_STORAGE_ENABLE_IDLE_POWER, - DeviceExtension->LowerPdo, - &idlePower, - sizeof(STORAGE_IDLE_POWER), - NULL, - 0, - FALSE, - &event, - &ioStatus); - - if (irp == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - else - { - // - // Send the synchronous request to port driver. - // - - status = IoCallDriver(DeviceExtension->LowerPdo, irp); - - if (status == STATUS_PENDING) - { - KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL); - - status = ioStatus.Status; - } - } - - TracePrint((TRACE_LEVEL_INFORMATION, - TRACE_FLAG_POWER, - "DeviceSendEnableIdlePowerIoctl: Port driver returned status (%x) for FDO (%p)\n" - "\tD3ColdSupported: %u\n" - "\tD3IdleTimeout: %u (ms)", - status, - DeviceExtension->DeviceObject, - Enable, - DELAY_TIME_TO_ENTER_ZERO_POWER_IN_MS)); - - return status; -} - -_IRQL_requires_max_(APC_LEVEL) -VOID -DeviceReleaseZPODDResources( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - This routine will cleanup any resources allocated for ZPODD. - -Arguments: - - DeviceExtension - the device context - -Return Value: - None. - ---*/ -{ - PZERO_POWER_ODD_INFO zpoddInfo = DeviceExtension->ZeroPowerODDInfo; - - PAGED_CODE() - - if (zpoddInfo != NULL) - { - FREE_POOL(zpoddInfo->GetConfigurationBuffer); - FREE_POOL(zpoddInfo); - } - - return; -} - -NTSTATUS -DeviceZPODDGetPowerupReason( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _Out_ PSTORAGE_IDLE_POWERUP_REASON PowerupReason - ) -/*++ - -Routine Description: - - This routine queries the port driver for what caused the power up. - -Arguments: - - DeviceExtension - device extension. - PowerupReason - what caused the power up. - -Return Value: - NTSTATUS - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PIRP irp = NULL; - IO_STATUS_BLOCK ioStatus = {0}; - KEVENT event; - - RtlZeroMemory(PowerupReason, sizeof (STORAGE_IDLE_POWERUP_REASON)); - - PowerupReason->Size = sizeof (STORAGE_IDLE_POWERUP_REASON); - PowerupReason->Version = STORAGE_IDLE_POWERUP_REASON_VERSION_V1; - - // - // Setup a synchronous irp. - // - - KeInitializeEvent(&event, NotificationEvent, FALSE); - - irp = IoBuildDeviceIoControlRequest(IOCTL_STORAGE_GET_IDLE_POWERUP_REASON, - DeviceExtension->LowerPdo, - PowerupReason, - sizeof (STORAGE_IDLE_POWERUP_REASON), - PowerupReason, - sizeof (STORAGE_IDLE_POWERUP_REASON), - FALSE, - &event, - &ioStatus); - - if (irp == NULL) - { - status = STATUS_INSUFFICIENT_RESOURCES; - } - else - { - // - // Send the synchronous request to port driver. - // - - status = IoCallDriver(DeviceExtension->LowerPdo, irp); - - if (status == STATUS_PENDING) - { - KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL); - - status = ioStatus.Status; - } - } - - return status; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -BOOLEAN -DeviceZPODDIsInHomePosition( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension - ) -/*++ - -Routine Description: - - Checks to see if the device is ready to be powered off. - Requirements are: 1. tray closed 2. no media present. - -Arguments: - - DeviceExtension - device extension. - -Return Value: - BOOLEAN - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PZERO_POWER_ODD_INFO zpoddInfo = DeviceExtension->ZeroPowerODDInfo; - SCSI_REQUEST_BLOCK srb = {0}; - PCDB cdb = (PCDB) srb.Cdb; - BOOLEAN inHomePosition = FALSE; - - PAGED_CODE(); - - if (zpoddInfo != NULL) - { - // - // Clear sense data. - // - - zpoddInfo->SenseKey = 0; - zpoddInfo->AdditionalSenseCode = 0; - zpoddInfo->AdditionalSenseCodeQualifier = 0; - - // - // Send a Test Unit Ready to check media & tray status. - // - - RtlZeroMemory(&srb, sizeof(SCSI_REQUEST_BLOCK)); - - srb.CdbLength = 6; - cdb->CDB6GENERIC.OperationCode = SCSIOP_TEST_UNIT_READY; - - srb.TimeOutValue = CDROM_TEST_UNIT_READY_TIMEOUT; - - status = DeviceSendSrbSynchronously(DeviceExtension->Device, - &srb, - NULL, - 0, - FALSE, - NULL); - - // - // At this time, sense data, if available, is already copied into zpoddInfo. - // - // We don't check for status because we expect it to fail in case there is no media in device. - // - // Should enter Zero Power state if: - // - // Drawer: 02/3A/01 - // Slot: 02/3A/xx - // - - if (((zpoddInfo->LoadingMechanism == LOADING_MECHANISM_TRAY) && (zpoddInfo->Load == 0) && // Drawer - (zpoddInfo->SenseKey == SCSI_SENSE_NOT_READY) && - (zpoddInfo->AdditionalSenseCode == SCSI_ADSENSE_NO_MEDIA_IN_DEVICE) && - (zpoddInfo->AdditionalSenseCodeQualifier == 0x01)) || - ((zpoddInfo->LoadingMechanism == LOADING_MECHANISM_CADDY) && (zpoddInfo->Load == 0) && // Slot - (zpoddInfo->SenseKey == SCSI_SENSE_NOT_READY) && - (zpoddInfo->AdditionalSenseCode == SCSI_ADSENSE_NO_MEDIA_IN_DEVICE))) - { - inHomePosition = TRUE; - } - } - - return inHomePosition; -} - -_IRQL_requires_max_(PASSIVE_LEVEL) -VOID -DeviceMarkActive( - _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, - _In_ BOOLEAN IsActive, - _In_ BOOLEAN SetIdleTimeout - ) -/*++ - -Routine Description: - - This routine will mark the device as active / idle. - -Arguments: - - DeviceExtension - the device context - IsActive - if the device should be marked as active - -Return Value: - None. - ---*/ -{ - NTSTATUS status = STATUS_SUCCESS; - PZERO_POWER_ODD_INFO zpoddInfo = DeviceExtension->ZeroPowerODDInfo; - - PAGED_CODE() - - if (DeviceExtension->IsActive != IsActive) - { - if ((IsActive == FALSE) && (zpoddInfo != NULL)) - { - // cache get configuration response. - // failing is not critical, so we don't want to check for status here. - if (zpoddInfo->GetConfigurationBuffer == NULL) - { - (VOID)DeviceGetConfigurationWithAlloc(DeviceExtension->Device, - &zpoddInfo->GetConfigurationBuffer, - &zpoddInfo->GetConfigurationBufferSize, - FeatureProfileList, - SCSI_GET_CONFIGURATION_REQUEST_TYPE_ALL); - } - } - - if (SetIdleTimeout) - { - status = DeviceSendEnableIdlePowerIoctl(DeviceExtension, - FALSE, - FALSE, - IsActive ? DELAY_TIME_TO_ENTER_ZERO_POWER_IN_MS : DELAY_TIME_TO_ENTER_AOAC_IDLE_POWER_IN_MS); - } - - if (NT_SUCCESS(status)) - { - DeviceSendIoctlAsynchronously(DeviceExtension, - IsActive ? IOCTL_STORAGE_POWER_ACTIVE : IOCTL_STORAGE_POWER_IDLE, - DeviceExtension->LowerPdo); - } - - DeviceExtension->IsActive = IsActive; - } -} - -#pragma warning(pop) // un-sets any local warning changes - - -- cgit v1.3.1 From 24caf7a578bfb4c6108afcfbf4a7d4354d5f4a59 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 3 Mar 2023 14:37:28 -0800 Subject: Remove BasicDriverOk from samples (#908) Co-authored-by: Jason Knichel --- gpio/samples/simgpio/simgpio.inx | Bin 3752 -> 3714 bytes gpio/samples/simgpio_i2c/simgpio_i2c.inx | Bin 3824 -> 3786 bytes sd/miniport/sdhc/sdhc.inx | Bin 7894 -> 7860 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/gpio/samples/simgpio/simgpio.inx b/gpio/samples/simgpio/simgpio.inx index b0a724e2..fd8a4c18 100644 Binary files a/gpio/samples/simgpio/simgpio.inx and b/gpio/samples/simgpio/simgpio.inx differ diff --git a/gpio/samples/simgpio_i2c/simgpio_i2c.inx b/gpio/samples/simgpio_i2c/simgpio_i2c.inx index ffe92042..7706cfbf 100644 Binary files a/gpio/samples/simgpio_i2c/simgpio_i2c.inx and b/gpio/samples/simgpio_i2c/simgpio_i2c.inx differ diff --git a/sd/miniport/sdhc/sdhc.inx b/sd/miniport/sdhc/sdhc.inx index 31e3a964..83bbe195 100644 Binary files a/sd/miniport/sdhc/sdhc.inx and b/sd/miniport/sdhc/sdhc.inx differ -- cgit v1.3.1 From a24dcb8231e3ed597ca46bdc1cdcec1c1ee6d6ac Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 3 Mar 2023 17:03:26 -0800 Subject: Fix up some of the malformed DriverVer directives (#909) Co-authored-by: Jason Knichel --- bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx | Bin 4526 -> 4530 bytes general/PLX9x5x/sys/pci9x5x.inx | Bin 5280 -> 5282 bytes .../SimpleMediaSourceDriver.inf | Bin 6712 -> 6716 bytes .../Toaster Driver/toaster/toaster.inx | 2 +- general/echo/kmdf/driver/AutoSync/echo.inx | Bin 4084 -> 4086 bytes general/echo/kmdf/driver/DriverSync/echo_2.inx | Bin 4218 -> 4220 bytes general/echo/umdf2/driver/AutoSync/echoum.inx | Bin 4030 -> 4032 bytes general/pcidrv/kmdf/genpci.inx | Bin 6244 -> 6246 bytes .../toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx | Bin 4740 -> 4742 bytes .../toaster/toastDrv/kmdf/bus/static/statbus.inx | Bin 4682 -> 4684 bytes general/toaster/toastDrv/kmdf/filter/filter.inx | Bin 6208 -> 6210 bytes .../toastDrv/kmdf/func/featured/wdffeatured.inx | Bin 5022 -> 5024 bytes .../toaster/toastDrv/kmdf/func/simple/wdfsimple.inx | Bin 6016 -> 6018 bytes .../toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx | Bin 3910 -> 3912 bytes general/toaster/umdf2/filter/generic/filterum.inx | Bin 4908 -> 4910 bytes .../toaster/umdf2/func/featured/wdffeaturedum.inx | Bin 5012 -> 5014 bytes general/toaster/umdf2/func/simple/wdfsimpleum.inx | Bin 4888 -> 4890 bytes gpio/samples/simdevice/kmdf/simdevice.inx | Bin 3052 -> 3068 bytes gpio/samples/simgpio/simgpio.inx | Bin 3714 -> 3710 bytes network/modem/fakemodem/mdmfake.inx | Bin 24276 -> 24280 bytes .../ndis/extension/samples/forward/msforwardext.inf | 2 +- network/ndis/ndisprot/6x/sys/60/ndisprot60.inf | Bin 5604 -> 5612 bytes network/ndis/ndisprot/6x/sys/630/ndisprot630.inf | Bin 7568 -> 7576 bytes nfp/net/driver/netnfpprovider.inx | Bin 3868 -> 3870 bytes pofx/PEP/acpi/sampleacpipep.inx | Bin 4242 -> 4238 bytes .../SingleComp/SingleComponentSingleStateUm.inx | Bin 4550 -> 4552 bytes usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx | Bin 5276 -> 5278 bytes usb/kmdf_fx2/driver/osrusbfx2.inx | Bin 6952 -> 6954 bytes usb/usbsamp/sys/driver/usbsamp.inx | Bin 5766 -> 5768 bytes usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx | Bin 4992 -> 4994 bytes usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx | Bin 4988 -> 4990 bytes usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx | Bin 4988 -> 4990 bytes usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx | Bin 4988 -> 4990 bytes usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx | Bin 4988 -> 4990 bytes 34 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx b/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx index e6bfeb55..23387a7c 100644 Binary files a/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx and b/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx differ diff --git a/general/PLX9x5x/sys/pci9x5x.inx b/general/PLX9x5x/sys/pci9x5x.inx index 2446271e..8340d1fa 100644 Binary files a/general/PLX9x5x/sys/pci9x5x.inx and b/general/PLX9x5x/sys/pci9x5x.inx differ diff --git a/general/SimpleMediaSource/SimpleMediaSourceDriver/SimpleMediaSourceDriver.inf b/general/SimpleMediaSource/SimpleMediaSourceDriver/SimpleMediaSourceDriver.inf index e2d228fe..b182e169 100644 Binary files a/general/SimpleMediaSource/SimpleMediaSourceDriver/SimpleMediaSourceDriver.inf and b/general/SimpleMediaSource/SimpleMediaSourceDriver/SimpleMediaSourceDriver.inf differ diff --git a/general/WinHEC 2017 Lab/Toaster Driver/toaster/toaster.inx b/general/WinHEC 2017 Lab/Toaster Driver/toaster/toaster.inx index 2e7e0ad3..91a1d73c 100644 --- a/general/WinHEC 2017 Lab/Toaster Driver/toaster/toaster.inx +++ b/general/WinHEC 2017 Lab/Toaster Driver/toaster/toaster.inx @@ -5,7 +5,7 @@ Signature = "$WINDOWS NT$" Class = System ClassGuid = {4D36E97D-E325-11CE-BFC1-08002BE10318} Provider = Contoso -DriverVer = 06/16/1999, 5.00.2064 +DriverVer = 06/16/1999, 5.0.2064.0 CatalogFile = toaster.cat PnpLockdown = 1 diff --git a/general/echo/kmdf/driver/AutoSync/echo.inx b/general/echo/kmdf/driver/AutoSync/echo.inx index 970462a3..bd3f5bf5 100644 Binary files a/general/echo/kmdf/driver/AutoSync/echo.inx and b/general/echo/kmdf/driver/AutoSync/echo.inx differ diff --git a/general/echo/kmdf/driver/DriverSync/echo_2.inx b/general/echo/kmdf/driver/DriverSync/echo_2.inx index bb73b485..f52fb578 100644 Binary files a/general/echo/kmdf/driver/DriverSync/echo_2.inx and b/general/echo/kmdf/driver/DriverSync/echo_2.inx differ diff --git a/general/echo/umdf2/driver/AutoSync/echoum.inx b/general/echo/umdf2/driver/AutoSync/echoum.inx index ccfe6a7e..b012672c 100644 Binary files a/general/echo/umdf2/driver/AutoSync/echoum.inx and b/general/echo/umdf2/driver/AutoSync/echoum.inx differ diff --git a/general/pcidrv/kmdf/genpci.inx b/general/pcidrv/kmdf/genpci.inx index db6e5c55..058e81e6 100644 Binary files a/general/pcidrv/kmdf/genpci.inx and b/general/pcidrv/kmdf/genpci.inx differ diff --git a/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx b/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx index 912596fd..bb22add8 100644 Binary files a/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx and b/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx differ diff --git a/general/toaster/toastDrv/kmdf/bus/static/statbus.inx b/general/toaster/toastDrv/kmdf/bus/static/statbus.inx index 76cab06a..a8b4b39e 100644 Binary files a/general/toaster/toastDrv/kmdf/bus/static/statbus.inx and b/general/toaster/toastDrv/kmdf/bus/static/statbus.inx differ diff --git a/general/toaster/toastDrv/kmdf/filter/filter.inx b/general/toaster/toastDrv/kmdf/filter/filter.inx index 7958ef4d..eb656e9f 100644 Binary files a/general/toaster/toastDrv/kmdf/filter/filter.inx and b/general/toaster/toastDrv/kmdf/filter/filter.inx differ diff --git a/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx b/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx index 4b7f091f..a294267b 100644 Binary files a/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx and b/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx differ diff --git a/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx b/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx index 46fcb3d4..3a4998d5 100644 Binary files a/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx and b/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx differ diff --git a/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx b/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx index 2986b5e4..ea61cea9 100644 Binary files a/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx and b/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx differ diff --git a/general/toaster/umdf2/filter/generic/filterum.inx b/general/toaster/umdf2/filter/generic/filterum.inx index db5e7a28..6b631a57 100644 Binary files a/general/toaster/umdf2/filter/generic/filterum.inx and b/general/toaster/umdf2/filter/generic/filterum.inx differ diff --git a/general/toaster/umdf2/func/featured/wdffeaturedum.inx b/general/toaster/umdf2/func/featured/wdffeaturedum.inx index 2c251ffd..cc2d6bd8 100644 Binary files a/general/toaster/umdf2/func/featured/wdffeaturedum.inx and b/general/toaster/umdf2/func/featured/wdffeaturedum.inx differ diff --git a/general/toaster/umdf2/func/simple/wdfsimpleum.inx b/general/toaster/umdf2/func/simple/wdfsimpleum.inx index 8f28fbaa..fb8578af 100644 Binary files a/general/toaster/umdf2/func/simple/wdfsimpleum.inx and b/general/toaster/umdf2/func/simple/wdfsimpleum.inx differ diff --git a/gpio/samples/simdevice/kmdf/simdevice.inx b/gpio/samples/simdevice/kmdf/simdevice.inx index 48f8a52d..c758f27a 100644 Binary files a/gpio/samples/simdevice/kmdf/simdevice.inx and b/gpio/samples/simdevice/kmdf/simdevice.inx differ diff --git a/gpio/samples/simgpio/simgpio.inx b/gpio/samples/simgpio/simgpio.inx index fd8a4c18..32ad72fe 100644 Binary files a/gpio/samples/simgpio/simgpio.inx and b/gpio/samples/simgpio/simgpio.inx differ diff --git a/network/modem/fakemodem/mdmfake.inx b/network/modem/fakemodem/mdmfake.inx index 688cd08f..ea95a9ad 100644 Binary files a/network/modem/fakemodem/mdmfake.inx and b/network/modem/fakemodem/mdmfake.inx differ diff --git a/network/ndis/extension/samples/forward/msforwardext.inf b/network/ndis/extension/samples/forward/msforwardext.inf index 9d3d587c..2b9093a2 100644 --- a/network/ndis/extension/samples/forward/msforwardext.inf +++ b/network/ndis/extension/samples/forward/msforwardext.inf @@ -8,7 +8,7 @@ Class = NetService ClassGUID = {4D36E974-E325-11CE-BFC1-08002BE10318} Provider = %ProviderString% CatalogFile = msforwardext.cat -DriverVer = 07/29/2011,2.0 +DriverVer = 07/29/2011,2.0.0.0 [Manufacturer] %ManufacturerName%=Standard,NTx86,NTia64,NTamd64 diff --git a/network/ndis/ndisprot/6x/sys/60/ndisprot60.inf b/network/ndis/ndisprot/6x/sys/60/ndisprot60.inf index 92f30001..0c294311 100644 Binary files a/network/ndis/ndisprot/6x/sys/60/ndisprot60.inf and b/network/ndis/ndisprot/6x/sys/60/ndisprot60.inf differ diff --git a/network/ndis/ndisprot/6x/sys/630/ndisprot630.inf b/network/ndis/ndisprot/6x/sys/630/ndisprot630.inf index f992ad08..849195f7 100644 Binary files a/network/ndis/ndisprot/6x/sys/630/ndisprot630.inf and b/network/ndis/ndisprot/6x/sys/630/ndisprot630.inf differ diff --git a/nfp/net/driver/netnfpprovider.inx b/nfp/net/driver/netnfpprovider.inx index fa19a86d..e9a7281c 100644 Binary files a/nfp/net/driver/netnfpprovider.inx and b/nfp/net/driver/netnfpprovider.inx differ diff --git a/pofx/PEP/acpi/sampleacpipep.inx b/pofx/PEP/acpi/sampleacpipep.inx index b4059974..4dfa0a29 100644 Binary files a/pofx/PEP/acpi/sampleacpipep.inx and b/pofx/PEP/acpi/sampleacpipep.inx differ diff --git a/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx b/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx index 785b3fd1..313cfdb2 100644 Binary files a/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx and b/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx differ diff --git a/usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx b/usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx index 384d83fc..cbd8fb15 100644 Binary files a/usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx and b/usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx differ diff --git a/usb/kmdf_fx2/driver/osrusbfx2.inx b/usb/kmdf_fx2/driver/osrusbfx2.inx index 0634ee6c..4d53d79a 100644 Binary files a/usb/kmdf_fx2/driver/osrusbfx2.inx and b/usb/kmdf_fx2/driver/osrusbfx2.inx differ diff --git a/usb/usbsamp/sys/driver/usbsamp.inx b/usb/usbsamp/sys/driver/usbsamp.inx index 8a1b4997..eee41d30 100644 Binary files a/usb/usbsamp/sys/driver/usbsamp.inx and b/usb/usbsamp/sys/driver/usbsamp.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx index ddd17e82..cc1817a7 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx index 5d97c8c4..6c0fee93 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx index 5d97c8c4..6c0fee93 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx index 5d97c8c4..6c0fee93 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx index 5d97c8c4..6c0fee93 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx differ -- cgit v1.3.1 From e802b80eaf6b0e949b6fbcecac633da37a71ced7 Mon Sep 17 00:00:00 2001 From: "Michael Bernstein (MSFT)" <99994515+michbern-ms@users.noreply.github.com> Date: Tue, 7 Mar 2023 09:31:41 -0800 Subject: Opt many samples in for Universal validation (#910) * Opt-in many Desktop samples for ApiValidator ApiValidator is passing for many of our samples marked Desktop. This is promising and it is worth running ApiValidator on these to ensure they stay within the Universal API limits. * Shift avstream/sampledevicemft sample to use mfcore.dll rather than mf.dll * Opt many samples in for Universal validation Many of our driver samples build cleanly agains the UniversalDDIs.xml API list. Opting these in as Universal helps protect their API surface against accidentally picking up more Desktop-only APIs. * Revert "Opt-in many Desktop samples for ApiValidator" This reverts commit a6aa7e6797ab01e6b15c8a4e1cbcea6d7a615629. --------- Co-authored-by: Michael Bernstein (DPLAT) --- TrEE/Miniport/TrEEMiniportSample.vcxproj | 12 ++++++------ TrEE/OSService/TrEEOSServiceSample.vcxproj | 12 ++++++------ avstream/sampledevicemft/multipinmft.vcxproj | 8 ++++---- bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.vcxproj | 8 ++++---- bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.vcxproj | 8 ++++---- bluetooth/bthecho/common/lib/bthecho.vcxproj | 8 ++++---- general/PLX9x5x/sys/Pci9x5x.vcxproj | 8 ++++---- general/SystemDma/wdm/sys/SDma.vcxproj | 8 ++++---- general/cancel/startio/cancel.vcxproj | 8 ++++---- general/cancel/sys/cancel.vcxproj | 8 ++++---- general/event/wdm/event.vcxproj | 8 ++++---- general/ioctl/kmdf/sys/nonpnp.vcxproj | 8 ++++---- general/ioctl/wdm/sys/sioctl.vcxproj | 8 ++++---- general/obcallback/driver/ObCallbackTest.vcxproj | 8 ++++---- general/pcidrv/kmdf/HW/PCIDRV.vcxproj | 8 ++++---- general/perfcounters/kcs/kcs.vcxproj | 8 ++++---- general/registry/regfltr/sys/regfltr.vcxproj | 8 ++++---- general/tracing/evntdrv/Eventdrv/Eventdrv.vcxproj | 8 ++++---- general/tracing/tracedriver/tracedrv/tracedrv.vcxproj | 8 ++++---- gpio/samples/simgpio/simgpio.vcxproj | 8 ++++---- gpio/samples/simgpio_i2c/simgpio_i2c.vcxproj | 8 ++++---- hid/hidusbfx2/hidkmdf/hidkmdf.vcxproj | 8 ++++---- hid/vhidmini2/driver/kmdf/vhidmini.vcxproj | 8 ++++---- network/ndis/extension/samples/forward/msforwardext.vcxproj | 4 ++-- .../extension/samples/passthrough/mspassthroughext.vcxproj | 4 ++-- network/ndis/filter/ndislwf.vcxproj | 8 ++++---- network/ndis/mux/driver/60/novlan/mux.vcxproj | 8 ++++---- network/ndis/mux/driver/60/vlan/muxvlan.vcxproj | 8 ++++---- network/ndis/ndisprot/6x/sys/60/ndisprot60.vcxproj | 8 ++++---- network/ndis/ndisprot/6x/sys/630/ndisprot630.vcxproj | 8 ++++---- network/ndis/ndisprot_kmdf/60/nprt6wdf.vcxproj | 8 ++++---- network/ndis/netvmini/6x/60/netvmini60.vcxproj | 8 ++++---- network/ndis/netvmini/6x/620/netvmini620.vcxproj | 8 ++++---- network/ndis/netvmini/6x/630/netvmini630.vcxproj | 8 ++++---- network/ndis/netvmini/6x/680/netvmini680.vcxproj | 8 ++++---- .../radio/HidSwitchDriverSample/RadioSwitchHidUsbFx2.vcxproj | 8 ++++---- network/trans/WFPSampler/svc/WFPSamplerService.vcxproj | 8 ++++---- network/trans/WFPSampler/sys/WFPSamplerCalloutDriver.vcxproj | 8 ++++---- network/trans/ddproxy/sys/ddproxy.vcxproj | 8 ++++---- network/trans/inspect/sys/inspect.vcxproj | 8 ++++---- network/trans/msnmntr/sys/msnmntr.vcxproj | 8 ++++---- network/trans/stmedit/sys/stmedit.vcxproj | 8 ++++---- network/wsk/echosrv/echosrv.vcxproj | 8 ++++---- pofx/PEP/acpi/sampleacpipep.vcxproj | 8 ++++---- security/elam/elamsample.vcxproj | 8 ++++---- storage/msdsm/src/SampleDSM.vcxproj | 8 ++++---- .../samples/DV-FailDriver-WDM/driver/defect_toastmon.vcxproj | 8 ++++---- .../samples/SDV-FailDriver-KMDF/driver/fail_driver1.vcxproj | 8 ++++---- tools/sdv/samples/SDV-FailDriver-NDIS/driver/sdvmp.vcxproj | 8 ++++---- .../samples/SDV-FailDriver-STORPORT/driver/lsi_u3.vcxproj | 8 ++++---- .../samples/SDV-FailDriver-WDM/driver/fail_driver1.vcxproj | 8 ++++---- usb/kmdf_fx2/driver/osrusbfx2.vcxproj | 8 ++++---- 52 files changed, 208 insertions(+), 208 deletions(-) diff --git a/TrEE/Miniport/TrEEMiniportSample.vcxproj b/TrEE/Miniport/TrEEMiniportSample.vcxproj index f2ec5ea2..7a2265b6 100644 --- a/TrEE/Miniport/TrEEMiniportSample.vcxproj +++ b/TrEE/Miniport/TrEEMiniportSample.vcxproj @@ -38,7 +38,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -62,7 +62,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -70,7 +70,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -78,7 +78,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/TrEE/OSService/TrEEOSServiceSample.vcxproj b/TrEE/OSService/TrEEOSServiceSample.vcxproj index d3afa66a..7fd4726d 100644 --- a/TrEE/OSService/TrEEOSServiceSample.vcxproj +++ b/TrEE/OSService/TrEEOSServiceSample.vcxproj @@ -38,7 +38,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -62,7 +62,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -70,7 +70,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -78,7 +78,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/avstream/sampledevicemft/multipinmft.vcxproj b/avstream/sampledevicemft/multipinmft.vcxproj index a236b1ad..152ff207 100644 --- a/avstream/sampledevicemft/multipinmft.vcxproj +++ b/avstream/sampledevicemft/multipinmft.vcxproj @@ -189,7 +189,7 @@ %(PreprocessorDefinitions);UNICODE;MF_WPP;SECURITY_WIN32;MFT_UNIQUE_METHOD_NAMES;MF_DEVICEMFT_ALLOW_MFT0_LOAD - %(AdditionalDependencies);D2d1.lib;mf.lib;mfplat.lib;mfuuid.lib;uuid.lib + onecore.lib;D2d1.lib;mfcore.lib;mfplat.lib;mfuuid.lib;uuid.lib Source.def @@ -204,7 +204,7 @@ %(PreprocessorDefinitions);UNICODE;MF_WPP;SECURITY_WIN32;MFT_UNIQUE_METHOD_NAMES;MF_DEVICEMFT_ALLOW_MFT0_LOAD - %(AdditionalDependencies);D2d1.lib;mf.lib;mfplat.lib;mfuuid.lib;uuid.lib + onecore.lib;D2d1.lib;mfcore.lib;mfplat.lib;mfuuid.lib;uuid.lib Source.def @@ -219,7 +219,7 @@ %(PreprocessorDefinitions);UNICODE;MF_WPP;SECURITY_WIN32;MFT_UNIQUE_METHOD_NAMES;MF_DEVICEMFT_ALLOW_MFT0_LOAD - %(AdditionalDependencies);D2d1.lib;mf.lib;mfplat.lib;mfuuid.lib;uuid.lib + onecore.lib;D2d1.lib;mfcore.lib;mfplat.lib;mfuuid.lib;uuid.lib Source.def @@ -234,7 +234,7 @@ %(PreprocessorDefinitions);UNICODE;MF_WPP;SECURITY_WIN32;MFT_UNIQUE_METHOD_NAMES;MF_DEVICEMFT_ALLOW_MFT0_LOAD - %(AdditionalDependencies);D2d1.lib;mf.lib;mfplat.lib;mfuuid.lib;uuid.lib + onecore.lib;D2d1.lib;mfcore.lib;mfplat.lib;mfuuid.lib;uuid.lib Source.def diff --git a/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.vcxproj b/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.vcxproj index 6f79e19b..a2a6aec8 100644 --- a/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.vcxproj +++ b/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.vcxproj b/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.vcxproj index f612a2bc..c8db174a 100644 --- a/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.vcxproj +++ b/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/bluetooth/bthecho/common/lib/bthecho.vcxproj b/bluetooth/bthecho/common/lib/bthecho.vcxproj index 27ac5cc6..247ba48a 100644 --- a/bluetooth/bthecho/common/lib/bthecho.vcxproj +++ b/bluetooth/bthecho/common/lib/bthecho.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 StaticLibrary diff --git a/general/PLX9x5x/sys/Pci9x5x.vcxproj b/general/PLX9x5x/sys/Pci9x5x.vcxproj index de71cdb9..1c3cb7e1 100644 --- a/general/PLX9x5x/sys/Pci9x5x.vcxproj +++ b/general/PLX9x5x/sys/Pci9x5x.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -39,7 +39,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -47,7 +47,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -55,7 +55,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/SystemDma/wdm/sys/SDma.vcxproj b/general/SystemDma/wdm/sys/SDma.vcxproj index 76c512c3..799c158b 100644 --- a/general/SystemDma/wdm/sys/SDma.vcxproj +++ b/general/SystemDma/wdm/sys/SDma.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/cancel/startio/cancel.vcxproj b/general/cancel/startio/cancel.vcxproj index 6aac3614..7d6687ec 100644 --- a/general/cancel/startio/cancel.vcxproj +++ b/general/cancel/startio/cancel.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/cancel/sys/cancel.vcxproj b/general/cancel/sys/cancel.vcxproj index a5c25827..8478a962 100644 --- a/general/cancel/sys/cancel.vcxproj +++ b/general/cancel/sys/cancel.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/event/wdm/event.vcxproj b/general/event/wdm/event.vcxproj index b82f72b0..f47abce7 100644 --- a/general/event/wdm/event.vcxproj +++ b/general/event/wdm/event.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/ioctl/kmdf/sys/nonpnp.vcxproj b/general/ioctl/kmdf/sys/nonpnp.vcxproj index 90a56bcf..c1b3ec29 100644 --- a/general/ioctl/kmdf/sys/nonpnp.vcxproj +++ b/general/ioctl/kmdf/sys/nonpnp.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/ioctl/wdm/sys/sioctl.vcxproj b/general/ioctl/wdm/sys/sioctl.vcxproj index 66c2fe71..663855c2 100644 --- a/general/ioctl/wdm/sys/sioctl.vcxproj +++ b/general/ioctl/wdm/sys/sioctl.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/obcallback/driver/ObCallbackTest.vcxproj b/general/obcallback/driver/ObCallbackTest.vcxproj index 4f5c92d6..9898a7da 100644 --- a/general/obcallback/driver/ObCallbackTest.vcxproj +++ b/general/obcallback/driver/ObCallbackTest.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/pcidrv/kmdf/HW/PCIDRV.vcxproj b/general/pcidrv/kmdf/HW/PCIDRV.vcxproj index fe456c2c..f3cb00ce 100644 --- a/general/pcidrv/kmdf/HW/PCIDRV.vcxproj +++ b/general/pcidrv/kmdf/HW/PCIDRV.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/perfcounters/kcs/kcs.vcxproj b/general/perfcounters/kcs/kcs.vcxproj index 6afa9d83..1852b871 100644 --- a/general/perfcounters/kcs/kcs.vcxproj +++ b/general/perfcounters/kcs/kcs.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/registry/regfltr/sys/regfltr.vcxproj b/general/registry/regfltr/sys/regfltr.vcxproj index b50d1972..84ca9581 100644 --- a/general/registry/regfltr/sys/regfltr.vcxproj +++ b/general/registry/regfltr/sys/regfltr.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/tracing/evntdrv/Eventdrv/Eventdrv.vcxproj b/general/tracing/evntdrv/Eventdrv/Eventdrv.vcxproj index f919e046..74127e2d 100644 --- a/general/tracing/evntdrv/Eventdrv/Eventdrv.vcxproj +++ b/general/tracing/evntdrv/Eventdrv/Eventdrv.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/tracing/tracedriver/tracedrv/tracedrv.vcxproj b/general/tracing/tracedriver/tracedrv/tracedrv.vcxproj index eb78d92c..b731b60b 100644 --- a/general/tracing/tracedriver/tracedrv/tracedrv.vcxproj +++ b/general/tracing/tracedriver/tracedrv/tracedrv.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/gpio/samples/simgpio/simgpio.vcxproj b/gpio/samples/simgpio/simgpio.vcxproj index 98e5f591..83cb53bd 100644 --- a/gpio/samples/simgpio/simgpio.vcxproj +++ b/gpio/samples/simgpio/simgpio.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -39,7 +39,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -47,7 +47,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -55,7 +55,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/gpio/samples/simgpio_i2c/simgpio_i2c.vcxproj b/gpio/samples/simgpio_i2c/simgpio_i2c.vcxproj index ba8bf9e5..981f6178 100644 --- a/gpio/samples/simgpio_i2c/simgpio_i2c.vcxproj +++ b/gpio/samples/simgpio_i2c/simgpio_i2c.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -39,7 +39,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -47,7 +47,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -55,7 +55,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/hid/hidusbfx2/hidkmdf/hidkmdf.vcxproj b/hid/hidusbfx2/hidkmdf/hidkmdf.vcxproj index 4e5e456f..e2c14745 100644 --- a/hid/hidusbfx2/hidkmdf/hidkmdf.vcxproj +++ b/hid/hidusbfx2/hidkmdf/hidkmdf.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -39,7 +39,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -47,7 +47,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -55,7 +55,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/hid/vhidmini2/driver/kmdf/vhidmini.vcxproj b/hid/vhidmini2/driver/kmdf/vhidmini.vcxproj index 4f712d80..7e818e1c 100644 --- a/hid/vhidmini2/driver/kmdf/vhidmini.vcxproj +++ b/hid/vhidmini2/driver/kmdf/vhidmini.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/extension/samples/forward/msforwardext.vcxproj b/network/ndis/extension/samples/forward/msforwardext.vcxproj index 959386bc..f55e93b8 100644 --- a/network/ndis/extension/samples/forward/msforwardext.vcxproj +++ b/network/ndis/extension/samples/forward/msforwardext.vcxproj @@ -21,7 +21,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -29,7 +29,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/extension/samples/passthrough/mspassthroughext.vcxproj b/network/ndis/extension/samples/passthrough/mspassthroughext.vcxproj index aaa7da8e..791d2493 100644 --- a/network/ndis/extension/samples/passthrough/mspassthroughext.vcxproj +++ b/network/ndis/extension/samples/passthrough/mspassthroughext.vcxproj @@ -21,7 +21,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -29,7 +29,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/filter/ndislwf.vcxproj b/network/ndis/filter/ndislwf.vcxproj index fa4f9d39..8dfd9637 100644 --- a/network/ndis/filter/ndislwf.vcxproj +++ b/network/ndis/filter/ndislwf.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/mux/driver/60/novlan/mux.vcxproj b/network/ndis/mux/driver/60/novlan/mux.vcxproj index 33700ad4..1eac45e0 100644 --- a/network/ndis/mux/driver/60/novlan/mux.vcxproj +++ b/network/ndis/mux/driver/60/novlan/mux.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/mux/driver/60/vlan/muxvlan.vcxproj b/network/ndis/mux/driver/60/vlan/muxvlan.vcxproj index b521aed6..423e7bde 100644 --- a/network/ndis/mux/driver/60/vlan/muxvlan.vcxproj +++ b/network/ndis/mux/driver/60/vlan/muxvlan.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/ndisprot/6x/sys/60/ndisprot60.vcxproj b/network/ndis/ndisprot/6x/sys/60/ndisprot60.vcxproj index da4c5c58..df548983 100644 --- a/network/ndis/ndisprot/6x/sys/60/ndisprot60.vcxproj +++ b/network/ndis/ndisprot/6x/sys/60/ndisprot60.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/ndisprot/6x/sys/630/ndisprot630.vcxproj b/network/ndis/ndisprot/6x/sys/630/ndisprot630.vcxproj index 08e82745..b7b2dbda 100644 --- a/network/ndis/ndisprot/6x/sys/630/ndisprot630.vcxproj +++ b/network/ndis/ndisprot/6x/sys/630/ndisprot630.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/ndisprot_kmdf/60/nprt6wdf.vcxproj b/network/ndis/ndisprot_kmdf/60/nprt6wdf.vcxproj index a04d1a1d..980c6052 100644 --- a/network/ndis/ndisprot_kmdf/60/nprt6wdf.vcxproj +++ b/network/ndis/ndisprot_kmdf/60/nprt6wdf.vcxproj @@ -32,7 +32,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -40,7 +40,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -48,7 +48,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -56,7 +56,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/netvmini/6x/60/netvmini60.vcxproj b/network/ndis/netvmini/6x/60/netvmini60.vcxproj index 6562995b..b1b647f8 100644 --- a/network/ndis/netvmini/6x/60/netvmini60.vcxproj +++ b/network/ndis/netvmini/6x/60/netvmini60.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/netvmini/6x/620/netvmini620.vcxproj b/network/ndis/netvmini/6x/620/netvmini620.vcxproj index 531cd372..74b53571 100644 --- a/network/ndis/netvmini/6x/620/netvmini620.vcxproj +++ b/network/ndis/netvmini/6x/620/netvmini620.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/netvmini/6x/630/netvmini630.vcxproj b/network/ndis/netvmini/6x/630/netvmini630.vcxproj index 19a25bfb..6e9ae38c 100644 --- a/network/ndis/netvmini/6x/630/netvmini630.vcxproj +++ b/network/ndis/netvmini/6x/630/netvmini630.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/netvmini/6x/680/netvmini680.vcxproj b/network/ndis/netvmini/6x/680/netvmini680.vcxproj index 3d16c5e3..55497606 100644 --- a/network/ndis/netvmini/6x/680/netvmini680.vcxproj +++ b/network/ndis/netvmini/6x/680/netvmini680.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/radio/HidSwitchDriverSample/RadioSwitchHidUsbFx2.vcxproj b/network/radio/HidSwitchDriverSample/RadioSwitchHidUsbFx2.vcxproj index 3b9df8db..84bbb1ea 100644 --- a/network/radio/HidSwitchDriverSample/RadioSwitchHidUsbFx2.vcxproj +++ b/network/radio/HidSwitchDriverSample/RadioSwitchHidUsbFx2.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/network/trans/WFPSampler/svc/WFPSamplerService.vcxproj b/network/trans/WFPSampler/svc/WFPSamplerService.vcxproj index 00e24f27..94eb7ad7 100644 --- a/network/trans/WFPSampler/svc/WFPSamplerService.vcxproj +++ b/network/trans/WFPSampler/svc/WFPSamplerService.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WindowsApplicationForDrivers10.0 Application diff --git a/network/trans/WFPSampler/sys/WFPSamplerCalloutDriver.vcxproj b/network/trans/WFPSampler/sys/WFPSamplerCalloutDriver.vcxproj index 8e69a8a0..672d5a8f 100644 --- a/network/trans/WFPSampler/sys/WFPSamplerCalloutDriver.vcxproj +++ b/network/trans/WFPSampler/sys/WFPSamplerCalloutDriver.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -39,7 +39,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -47,7 +47,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -55,7 +55,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/network/trans/ddproxy/sys/ddproxy.vcxproj b/network/trans/ddproxy/sys/ddproxy.vcxproj index ae9cface..db813981 100644 --- a/network/trans/ddproxy/sys/ddproxy.vcxproj +++ b/network/trans/ddproxy/sys/ddproxy.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/network/trans/inspect/sys/inspect.vcxproj b/network/trans/inspect/sys/inspect.vcxproj index 3b874a1f..bd73f3d7 100644 --- a/network/trans/inspect/sys/inspect.vcxproj +++ b/network/trans/inspect/sys/inspect.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/network/trans/msnmntr/sys/msnmntr.vcxproj b/network/trans/msnmntr/sys/msnmntr.vcxproj index 19091c05..8c4da9ab 100644 --- a/network/trans/msnmntr/sys/msnmntr.vcxproj +++ b/network/trans/msnmntr/sys/msnmntr.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/network/trans/stmedit/sys/stmedit.vcxproj b/network/trans/stmedit/sys/stmedit.vcxproj index cdfcc9e7..2b81aee6 100644 --- a/network/trans/stmedit/sys/stmedit.vcxproj +++ b/network/trans/stmedit/sys/stmedit.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -47,7 +47,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -55,7 +55,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/network/wsk/echosrv/echosrv.vcxproj b/network/wsk/echosrv/echosrv.vcxproj index c97a2bae..378dfd8e 100644 --- a/network/wsk/echosrv/echosrv.vcxproj +++ b/network/wsk/echosrv/echosrv.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/pofx/PEP/acpi/sampleacpipep.vcxproj b/pofx/PEP/acpi/sampleacpipep.vcxproj index 19607f91..77709aa2 100644 --- a/pofx/PEP/acpi/sampleacpipep.vcxproj +++ b/pofx/PEP/acpi/sampleacpipep.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/security/elam/elamsample.vcxproj b/security/elam/elamsample.vcxproj index b0dcb931..a442079c 100644 --- a/security/elam/elamsample.vcxproj +++ b/security/elam/elamsample.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/storage/msdsm/src/SampleDSM.vcxproj b/storage/msdsm/src/SampleDSM.vcxproj index 308353ca..5387d218 100644 --- a/storage/msdsm/src/SampleDSM.vcxproj +++ b/storage/msdsm/src/SampleDSM.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/tools/dv/samples/DV-FailDriver-WDM/driver/defect_toastmon.vcxproj b/tools/dv/samples/DV-FailDriver-WDM/driver/defect_toastmon.vcxproj index 3a8a6d16..ad363b30 100644 --- a/tools/dv/samples/DV-FailDriver-WDM/driver/defect_toastmon.vcxproj +++ b/tools/dv/samples/DV-FailDriver-WDM/driver/defect_toastmon.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -39,7 +39,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -47,7 +47,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -55,7 +55,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/tools/sdv/samples/SDV-FailDriver-KMDF/driver/fail_driver1.vcxproj b/tools/sdv/samples/SDV-FailDriver-KMDF/driver/fail_driver1.vcxproj index 912be491..62362adb 100644 --- a/tools/sdv/samples/SDV-FailDriver-KMDF/driver/fail_driver1.vcxproj +++ b/tools/sdv/samples/SDV-FailDriver-KMDF/driver/fail_driver1.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -39,7 +39,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -47,7 +47,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -55,7 +55,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver diff --git a/tools/sdv/samples/SDV-FailDriver-NDIS/driver/sdvmp.vcxproj b/tools/sdv/samples/SDV-FailDriver-NDIS/driver/sdvmp.vcxproj index f89012d1..9489a228 100644 --- a/tools/sdv/samples/SDV-FailDriver-NDIS/driver/sdvmp.vcxproj +++ b/tools/sdv/samples/SDV-FailDriver-NDIS/driver/sdvmp.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/tools/sdv/samples/SDV-FailDriver-STORPORT/driver/lsi_u3.vcxproj b/tools/sdv/samples/SDV-FailDriver-STORPORT/driver/lsi_u3.vcxproj index ca461e0a..af3b63a8 100644 --- a/tools/sdv/samples/SDV-FailDriver-STORPORT/driver/lsi_u3.vcxproj +++ b/tools/sdv/samples/SDV-FailDriver-STORPORT/driver/lsi_u3.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal Miniport WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal Miniport WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal Miniport WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal Miniport WindowsKernelModeDriver10.0 Driver diff --git a/tools/sdv/samples/SDV-FailDriver-WDM/driver/fail_driver1.vcxproj b/tools/sdv/samples/SDV-FailDriver-WDM/driver/fail_driver1.vcxproj index 5a45eb5b..2f57650e 100644 --- a/tools/sdv/samples/SDV-FailDriver-WDM/driver/fail_driver1.vcxproj +++ b/tools/sdv/samples/SDV-FailDriver-WDM/driver/fail_driver1.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Desktop + Universal WDM WindowsKernelModeDriver10.0 Driver diff --git a/usb/kmdf_fx2/driver/osrusbfx2.vcxproj b/usb/kmdf_fx2/driver/osrusbfx2.vcxproj index 747de89e..49ec0221 100644 --- a/usb/kmdf_fx2/driver/osrusbfx2.vcxproj +++ b/usb/kmdf_fx2/driver/osrusbfx2.vcxproj @@ -32,7 +32,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -40,7 +40,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -48,7 +48,7 @@ Windows10 False - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -56,7 +56,7 @@ Windows10 True - Desktop + Universal KMDF WindowsKernelModeDriver10.0 Driver -- cgit v1.3.1 From 7d5c202eddde517fe5546452d83c36cf42381f8a Mon Sep 17 00:00:00 2001 From: Julia D'Zmura <78620953+judzmura@users.noreply.github.com> Date: Tue, 7 Mar 2023 11:32:48 -0800 Subject: Adding the AudioCodec ACX sample driver to Github. (#882) * Adding the AudioCodec acx sample driver to Github. * Fix to make AudioCodec driver all build in one solution file. Builds in ARM64 now. --- audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf | Bin 0 -> 8474 bytes audio/Acx/Samples/AudioCodec/Driver/AudioCodec.sln | 88 ++ .../Samples/AudioCodec/Driver/AudioCodec.vcxproj | 303 +++++ .../AudioCodec/Driver/AudioCodec.vcxproj.Filters | 42 + audio/Acx/Samples/AudioCodec/Driver/Device.cpp | 439 +++++++ audio/Acx/Samples/AudioCodec/Driver/Driver.cpp | 129 ++ .../Acx/Samples/AudioCodec/Driver/DriverSettings.h | 54 + audio/Acx/Samples/AudioCodec/Driver/ReadMe.txt | 42 + audio/Acx/Samples/AudioCodec/Driver/Resources.rc | 12 + audio/Acx/Samples/Common/CaptureCircuit.cpp | 799 ++++++++++++ audio/Acx/Samples/Common/CircuitHelper.cpp | 620 +++++++++ audio/Acx/Samples/Common/CircuitHelper.h | 135 ++ audio/Acx/Samples/Common/KeywordDetector.cpp | 484 +++++++ audio/Acx/Samples/Common/KeywordDetector.h | 145 +++ audio/Acx/Samples/Common/NewDelete.cpp | 91 ++ audio/Acx/Samples/Common/NewDelete.h | 58 + audio/Acx/Samples/Common/Private.h | 922 ++++++++++++++ audio/Acx/Samples/Common/RenderCircuit.cpp | 807 ++++++++++++ audio/Acx/Samples/Common/SamplesCommon.vcxproj | 304 +++++ audio/Acx/Samples/Common/SaveData.cpp | 1103 ++++++++++++++++ audio/Acx/Samples/Common/SaveData.h | 259 ++++ audio/Acx/Samples/Common/SimPeakMeter.cpp | 106 ++ audio/Acx/Samples/Common/SimPeakMeter.h | 51 + audio/Acx/Samples/Common/StreamEngine.cpp | 1345 ++++++++++++++++++++ audio/Acx/Samples/Common/StreamEngine.h | 449 +++++++ audio/Acx/Samples/Common/ToneGenerator.cpp | 297 +++++ audio/Acx/Samples/Common/ToneGenerator.h | 88 ++ audio/Acx/Samples/Common/Trace_macros.h | 470 +++++++ audio/Acx/Samples/Common/WaveReader.cpp | 769 +++++++++++ audio/Acx/Samples/Common/WaveReader.h | 196 +++ audio/Acx/Samples/Inc/AudioFormats.h | 959 ++++++++++++++ audio/Acx/Samples/Inc/cpp_utils.h | 71 ++ audio/Acx/Samples/Shared/Public.h | 342 +++++ audio/Acx/Samples/Shared/Trace.h | 33 + 34 files changed, 12012 insertions(+) create mode 100644 audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf create mode 100644 audio/Acx/Samples/AudioCodec/Driver/AudioCodec.sln create mode 100644 audio/Acx/Samples/AudioCodec/Driver/AudioCodec.vcxproj create mode 100644 audio/Acx/Samples/AudioCodec/Driver/AudioCodec.vcxproj.Filters create mode 100644 audio/Acx/Samples/AudioCodec/Driver/Device.cpp create mode 100644 audio/Acx/Samples/AudioCodec/Driver/Driver.cpp create mode 100644 audio/Acx/Samples/AudioCodec/Driver/DriverSettings.h create mode 100644 audio/Acx/Samples/AudioCodec/Driver/ReadMe.txt create mode 100644 audio/Acx/Samples/AudioCodec/Driver/Resources.rc create mode 100644 audio/Acx/Samples/Common/CaptureCircuit.cpp create mode 100644 audio/Acx/Samples/Common/CircuitHelper.cpp create mode 100644 audio/Acx/Samples/Common/CircuitHelper.h create mode 100644 audio/Acx/Samples/Common/KeywordDetector.cpp create mode 100644 audio/Acx/Samples/Common/KeywordDetector.h create mode 100644 audio/Acx/Samples/Common/NewDelete.cpp create mode 100644 audio/Acx/Samples/Common/NewDelete.h create mode 100644 audio/Acx/Samples/Common/Private.h create mode 100644 audio/Acx/Samples/Common/RenderCircuit.cpp create mode 100644 audio/Acx/Samples/Common/SamplesCommon.vcxproj create mode 100644 audio/Acx/Samples/Common/SaveData.cpp create mode 100644 audio/Acx/Samples/Common/SaveData.h create mode 100644 audio/Acx/Samples/Common/SimPeakMeter.cpp create mode 100644 audio/Acx/Samples/Common/SimPeakMeter.h create mode 100644 audio/Acx/Samples/Common/StreamEngine.cpp create mode 100644 audio/Acx/Samples/Common/StreamEngine.h create mode 100644 audio/Acx/Samples/Common/ToneGenerator.cpp create mode 100644 audio/Acx/Samples/Common/ToneGenerator.h create mode 100644 audio/Acx/Samples/Common/Trace_macros.h create mode 100644 audio/Acx/Samples/Common/WaveReader.cpp create mode 100644 audio/Acx/Samples/Common/WaveReader.h create mode 100644 audio/Acx/Samples/Inc/AudioFormats.h create mode 100644 audio/Acx/Samples/Inc/cpp_utils.h create mode 100644 audio/Acx/Samples/Shared/Public.h create mode 100644 audio/Acx/Samples/Shared/Trace.h diff --git a/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf new file mode 100644 index 00000000..240efa85 Binary files /dev/null and b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf differ diff --git a/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.sln b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.sln new file mode 100644 index 00000000..980e7ad6 --- /dev/null +++ b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.sln @@ -0,0 +1,88 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31409.214 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SamplesCommon", "SamplesCommon", "{0DF6D5E6-3B78-414B-B37B-85D9CA454487}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AudioCodec", "AudioCodec", "{0D3B6287-146E-4700-B2EE-11D520014FEA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SamplesCommon", "..\..\Common\SamplesCommon.vcxproj", "{6A946D59-6690-4ED0-A77D-7D4C3D4B3241}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AudioCodec", "AudioCodec.vcxproj", "{C575002D-5FDE-43C7-AB19-EE846A20083A}" + ProjectSection(ProjectDependencies) = postProject + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241} = {6A946D59-6690-4ED0-A77D-7D4C3D4B3241} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|ARM.ActiveCfg = Debug|ARM + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|ARM.Build.0 = Debug|ARM + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|ARM.Deploy.0 = Debug|ARM + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|ARM64.Build.0 = Debug|ARM64 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|x64.ActiveCfg = Debug|x64 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|x64.Build.0 = Debug|x64 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|x64.Deploy.0 = Debug|x64 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|x86.ActiveCfg = Debug|Win32 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|x86.Build.0 = Debug|Win32 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|x86.Deploy.0 = Debug|Win32 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|ARM.ActiveCfg = Release|ARM + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|ARM.Build.0 = Release|ARM + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|ARM.Deploy.0 = Release|ARM + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|ARM64.ActiveCfg = Release|ARM64 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|ARM64.Build.0 = Release|ARM64 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|ARM64.Deploy.0 = Release|ARM64 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|x64.ActiveCfg = Release|x64 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|x64.Build.0 = Release|x64 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|x64.Deploy.0 = Release|x64 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|x86.ActiveCfg = Release|Win32 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|x86.Build.0 = Release|Win32 + {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|x86.Deploy.0 = Release|Win32 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|ARM.ActiveCfg = Debug|ARM + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|ARM.Build.0 = Debug|ARM + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|ARM.Deploy.0 = Debug|ARM + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|ARM64.Build.0 = Debug|ARM64 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|x64.ActiveCfg = Debug|x64 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|x64.Build.0 = Debug|x64 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|x64.Deploy.0 = Debug|x64 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|x86.ActiveCfg = Debug|Win32 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|x86.Build.0 = Debug|Win32 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|x86.Deploy.0 = Debug|Win32 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|ARM.ActiveCfg = Release|ARM + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|ARM.Build.0 = Release|ARM + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|ARM.Deploy.0 = Release|ARM + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|ARM64.ActiveCfg = Release|ARM64 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|ARM64.Build.0 = Release|ARM64 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|ARM64.Deploy.0 = Release|ARM64 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|x64.ActiveCfg = Release|x64 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|x64.Build.0 = Release|x64 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|x64.Deploy.0 = Release|x64 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|x86.ActiveCfg = Release|Win32 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|x86.Build.0 = Release|Win32 + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|x86.Deploy.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241} = {0DF6D5E6-3B78-414B-B37B-85D9CA454487} + {C575002D-5FDE-43C7-AB19-EE846A20083A} = {0D3B6287-146E-4700-B2EE-11D520014FEA} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8E3043F2-1C76-4A4A-9C60-A645BD6CBF24} + EndGlobalSection +EndGlobal diff --git a/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.vcxproj b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.vcxproj new file mode 100644 index 00000000..68389954 --- /dev/null +++ b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.vcxproj @@ -0,0 +1,303 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + + + + + + + + + + + + + + + + + 1 + 1 + 1 + 31 + {C575002D-5FDE-43C7-AB19-EE846A20083A} + {497e31cb-056b-4f31-abb8-447fd55ee5a5} + v4.5 + 12.0 + Debug + Win32 + AudioCodec + $(LatestTargetPlatformVersion) + + + + Windows10 + true + WindowsKernelModeDriver10.0 + Driver + KMDF + Windows Driver + + + Windows10 + false + WindowsKernelModeDriver10.0 + Driver + KMDF + Windows Driver + + + Windows10 + true + WindowsKernelModeDriver10.0 + Driver + KMDF + Windows Driver + + + Windows10 + false + WindowsKernelModeDriver10.0 + Driver + KMDF + Windows Driver + + + Windows10 + true + WindowsKernelModeDriver10.0 + Driver + KMDF + Windows Driver + + + Windows10 + false + WindowsKernelModeDriver10.0 + Driver + KMDF + Windows Driver + + + Windows10 + true + WindowsKernelModeDriver10.0 + Driver + KMDF + Windows Driver + + + Windows10 + false + WindowsKernelModeDriver10.0 + Driver + KMDF + Windows Driver + + + + + + + + + + + DbgengKernelDebugger + $(IntDir) + + + DbgengKernelDebugger + $(IntDir) + + + DbgengKernelDebugger + $(IntDir) + + + DbgengKernelDebugger + $(IntDir) + + + DbgengKernelDebugger + $(IntDir) + + + DbgengKernelDebugger + $(IntDir) + + + DbgengKernelDebugger + $(IntDir) + + + DbgengKernelDebugger + $(IntDir) + + + + true + true + ..\..\common\trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR);..\..\common;..\..\inc;..\..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + $(DDK_LIB_PATH)\libcntpr.lib;wpprecorder.lib;acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR)\acxstub.lib;..\..\Common\$(IntDir)\SamplesCommon.lib;%(AdditionalDependencies) + + + + + true + true + ..\..\common\trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR);..\..\common;..\..\inc;..\..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + $(DDK_LIB_PATH)\libcntpr.lib;wpprecorder.lib;acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR)\acxstub.lib;..\..\Common\$(IntDir)\SamplesCommon.lib;%(AdditionalDependencies) + + + + + true + true + ..\..\common\trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR);..\..\common;..\..\inc;..\..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + $(DDK_LIB_PATH)\libcntpr.lib;wpprecorder.lib;acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR)\acxstub.lib;..\..\Common\$(IntDir)\SamplesCommon.lib;%(AdditionalDependencies) + + + + + true + true + ..\..\common\trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR);..\..\common;..\..\inc;..\..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + $(DDK_LIB_PATH)\libcntpr.lib;wpprecorder.lib;acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR)\acxstub.lib;..\..\Common\$(IntDir)\SamplesCommon.lib;%(AdditionalDependencies) + + + + + true + true + ..\..\common\trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR);..\..\common;..\..\inc;..\..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + $(DDK_LIB_PATH)\libcntpr.lib;wpprecorder.lib;acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR)\acxstub.lib;..\..\Common\$(IntDir)\SamplesCommon.lib;%(AdditionalDependencies) + + + + + true + true + ..\..\common\trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR);..\..\common;..\..\inc;..\..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=25;%(PreprocessorDefinitions) + + + sha256 + + + $(DDK_LIB_PATH)\libcntpr.lib;wpprecorder.lib;acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR)\acxstub.lib;..\..\Common\$(IntDir)\SamplesCommon.lib;%(AdditionalDependencies) + + + + + true + true + ..\..\common\trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR);..\..\common;..\..\inc;..\..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + $(DDK_LIB_PATH)\libcntpr.lib;wpprecorder.lib;acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR)\acxstub.lib;..\..\Common\$(IntDir)\SamplesCommon.lib;%(AdditionalDependencies) + + + + + true + true + ..\..\common\trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR);..\..\common;..\..\inc;..\..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + $(DDK_LIB_PATH)\libcntpr.lib;wpprecorder.lib;acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR)\acxstub.lib;..\..\Common\$(IntDir)\SamplesCommon.lib;%(AdditionalDependencies) + + + + + + + + + \ No newline at end of file diff --git a/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.vcxproj.Filters b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.vcxproj.Filters new file mode 100644 index 00000000..0b882019 --- /dev/null +++ b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.vcxproj.Filters @@ -0,0 +1,42 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {8E41214B-6785-4CFE-B992-037D68949A14} + inf;inv;inx;mof;mc; + + + + + + + + Driver Files + + + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/audio/Acx/Samples/AudioCodec/Driver/Device.cpp b/audio/Acx/Samples/AudioCodec/Driver/Device.cpp new file mode 100644 index 00000000..7e9a0a3c --- /dev/null +++ b/audio/Acx/Samples/AudioCodec/Driver/Device.cpp @@ -0,0 +1,439 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + + Device.cpp - Device handling events for example driver. + +Abstract: + + This file contains the device entry points and callbacks. + +Environment: + + Kernel-mode Driver Framework + +--*/ + +#include +#include +#include "public.h" +#include +#include +#include +#include +#include "streamengine.h" +#include "DriverSettings.h" + +#ifndef __INTELLISENSE__ +#include "device.tmh" +#endif + +UNICODE_STRING g_RegistryPath = { 0 }; // This is used to store the registry settings path for the driver + +ULONG DeviceDriverTag = DRIVER_TAG; + +ULONG IdleTimeoutMsec = IDLE_TIMEOUT_MSEC; + +__drv_requiresIRQL(PASSIVE_LEVEL) +PAGED_CODE_SEG +NTSTATUS +CopyRegistrySettingsPath( + _In_ PUNICODE_STRING RegistryPath +) +/*++ + +Routine Description: + +Copies the following registry path to a global variable. + +\REGISTRY\MACHINE\SYSTEM\ControlSetxxx\Services\\Parameters + +Arguments: + +RegistryPath - Registry path passed to DriverEntry + +Returns: + +NTSTATUS - SUCCESS if able to configure the framework + +--*/ + +{ + PAGED_CODE(); + + // + // Initializing the unicode string, so that if it is not allocated it will not be deallocated too. + // + RtlInitUnicodeString(&g_RegistryPath, nullptr); + + g_RegistryPath.MaximumLength = RegistryPath->Length + sizeof(WCHAR); + + g_RegistryPath.Buffer = (PWCH)ExAllocatePool2(POOL_FLAG_PAGED, g_RegistryPath.MaximumLength, DRIVER_TAG); + + if (g_RegistryPath.Buffer == nullptr) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + + RtlAppendUnicodeToString(&g_RegistryPath, RegistryPath->Buffer); + + return STATUS_SUCCESS; +} + +PAGED_CODE_SEG +NTSTATUS +Codec_EvtBusDeviceAdd( + _In_ WDFDRIVER Driver, + _Inout_ PWDFDEVICE_INIT DeviceInit +) +/*++ + +Routine Description: + + EvtDeviceAdd is called by the framework in response to AddDevice + call from the PnP manager. We create and initialize a device object to + represent a new instance of the device. All the software resources + should be allocated in this callback. + +Arguments: + Driver - Handle to a framework driver object created in DriverEntry + + DeviceInit - Pointer to a framework-allocated WDFDEVICE_INIT structure. + +Return Value: + + NTSTATUS + +--*/ +{ + NTSTATUS status = STATUS_SUCCESS; + WDF_OBJECT_ATTRIBUTES attributes; + WDF_DEVICE_PNP_CAPABILITIES pnpCaps; + ACX_DEVICEINIT_CONFIG devInitCfg; + ACX_DEVICE_CONFIG devCfg; + WDFDEVICE device = nullptr; + PCODEC_DEVICE_CONTEXT devCtx; + WDF_PNPPOWER_EVENT_CALLBACKS pnpPowerCallbacks; + + PAGED_CODE(); + + UNREFERENCED_PARAMETER(Driver); + + // + // The driver calls this DDI in its AddDevice callback before creating the PnP device. + // ACX uses this call to add default/standard settings for the device to be created. + // + ACX_DEVICEINIT_CONFIG_INIT(&devInitCfg); + RETURN_IF_FAILED(AcxDeviceInitInitialize(DeviceInit, &devInitCfg)); + + // + // Initialize the pnpPowerCallbacks structure. Callback events for PNP + // and Power are specified here. If you don't supply any callbacks, + // the Framework will take appropriate default actions based on whether + // DeviceInit is initialized to be an FDO, a PDO or a filter device + // object. + // + WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks); + pnpPowerCallbacks.EvtDevicePrepareHardware = Codec_EvtDevicePrepareHardware; + pnpPowerCallbacks.EvtDeviceReleaseHardware = Codec_EvtDeviceReleaseHardware; + pnpPowerCallbacks.EvtDeviceD0Entry = Codec_EvtDeviceD0Entry; + pnpPowerCallbacks.EvtDeviceD0Exit = Codec_EvtDeviceD0Exit; + WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &pnpPowerCallbacks); + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, CODEC_DEVICE_CONTEXT); + attributes.EvtCleanupCallback = Codec_EvtDeviceContextCleanup; + + RETURN_NTSTATUS_IF_FAILED(WdfDeviceCreate(&DeviceInit, &attributes, &device)); + + // + // Init Codec's device context. + // + devCtx = GetCodecDeviceContext(device); + ASSERT(devCtx != nullptr); + + devCtx->Render = nullptr; + devCtx->Capture = nullptr; + devCtx->ExcludeD3Cold = WdfFalse; + + // + // The driver calls this DDI in its AddDevice callback after creating the PnP + // device. ACX uses this call to apply any post device settings. + // + ACX_DEVICE_CONFIG_INIT(&devCfg); + RETURN_NTSTATUS_IF_FAILED(AcxDeviceInitialize(device, &devCfg)); + + // + // Tell the framework to set the SurpriseRemovalOK in the DeviceCaps so + // that you don't get the popup in usermode (on Win2K) when you surprise + // remove the device. + // + WDF_DEVICE_PNP_CAPABILITIES_INIT(&pnpCaps); + pnpCaps.SurpriseRemovalOK = WdfTrue; + WdfDeviceSetPnpCapabilities(device, &pnpCaps); + + // + // Create a render circuit and capture circuit and add them to the current + // device context. These circuits will be added to the device when the + // prepare hardware callback is called. + // + RETURN_NTSTATUS_IF_FAILED(CodecR_AddStaticRender(device, &CODEC_RENDER_COMPONENT_GUID, &renderCircuitName)); + + RETURN_NTSTATUS_IF_FAILED(CodecC_AddStaticCapture(device, &CODEC_CAPTURE_COMPONENT_GUID, &MIC_CUSTOM_NAME, &captureCircuitName)); + + return status; +} + +PAGED_CODE_SEG +NTSTATUS +Codec_EvtDevicePrepareHardware( + _In_ WDFDEVICE Device, + _In_ WDFCMRESLIST ResourceList, + _In_ WDFCMRESLIST ResourceListTranslated +) +/*++ + +Routine Description: + + In this callback, the driver does whatever is necessary to make the + hardware ready to use. + +Arguments: + + Device - handle to a device + +Return Value: + + NT status value + +--*/ +{ + NTSTATUS status = STATUS_SUCCESS; + PCODEC_DEVICE_CONTEXT devCtx; + + UNREFERENCED_PARAMETER(ResourceList); + UNREFERENCED_PARAMETER(ResourceListTranslated); + + PAGED_CODE(); + + devCtx = GetCodecDeviceContext(Device); + ASSERT(devCtx != nullptr); + + // NOTE: Download firmware here. + + // NOTE: Register streaming h/w resources here. + + // + // Set power policy data. + // + RETURN_NTSTATUS_IF_FAILED(Codec_SetPowerPolicy(Device)); + + // + // Setting up the data saving (CSaveData) and wave file reader (CWaveReader) + // utility classes which will be used by the virtual streaming engine. + // + RETURN_NTSTATUS_IF_FAILED(CSaveData::SetDeviceObject(WdfDeviceWdmGetDeviceObject(Device))); + + RETURN_NTSTATUS_IF_FAILED(CSaveData::InitializeWorkItems(WdfDeviceWdmGetDeviceObject(Device))); + + RETURN_NTSTATUS_IF_FAILED(CWaveReader::InitializeWorkItems(WdfDeviceWdmGetDeviceObject(Device))); + + // + // The driver uses this DDI to associate a circuit to a device. After + // this call the circuit is not visible until the device goes in D0. + // For a real driver there should be a check here to make sure the + // circuit has not been added already (there could be a situation where + // prepareHardware is called multiple times and releaseHardware is only + // called once). + // + + ASSERT(devCtx->Render); + RETURN_NTSTATUS_IF_FAILED(AcxDeviceAddCircuit(Device, devCtx->Render)); + + ASSERT(devCtx->Capture); + RETURN_NTSTATUS_IF_FAILED(AcxDeviceAddCircuit(Device, devCtx->Capture)); + + return status; +} + +PAGED_CODE_SEG +NTSTATUS +Codec_EvtDeviceReleaseHardware( + _In_ WDFDEVICE Device, + _In_ WDFCMRESLIST ResourceListTranslated +) +/*++ + +Routine Description: + + In this callback, the driver releases the h/w resources allocated in the + prepare h/w callback. + +Arguments: + + Device - handle to a device + +Return Value: + + NT status value + +--*/ +{ + NTSTATUS status; + PCODEC_DEVICE_CONTEXT devCtx; + + UNREFERENCED_PARAMETER(Device); + UNREFERENCED_PARAMETER(ResourceListTranslated); + + PAGED_CODE(); + + devCtx = GetCodecDeviceContext(Device); + ASSERT(devCtx != nullptr); + + // + // The driver uses this DDI to delete a circuit from the current device. + // + RETURN_NTSTATUS_IF_FAILED(AcxDeviceRemoveCircuit(Device, devCtx->Render)); + RETURN_NTSTATUS_IF_FAILED(AcxDeviceRemoveCircuit(Device, devCtx->Capture)); + + // NOTE: Release streaming h/w resources here. + + CSaveData::DestroyWorkItems(); + CWaveReader::DestroyWorkItems(); + + status = STATUS_SUCCESS; + + return status; +} + +PAGED_CODE_SEG +NTSTATUS +Codec_EvtDeviceD0Entry( + _In_ WDFDEVICE Device, + _In_ WDF_POWER_DEVICE_STATE PreviousState +) +{ + UNREFERENCED_PARAMETER(Device); + UNREFERENCED_PARAMETER(PreviousState); + + PAGED_CODE(); + + return STATUS_SUCCESS; +} + +NTSTATUS +Codec_EvtDeviceD0Exit( + _In_ WDFDEVICE Device, + _In_ WDF_POWER_DEVICE_STATE TargetState +) +{ + NTSTATUS status = STATUS_SUCCESS; + POWER_ACTION powerAction; + + PAGED_CODE(); + + powerAction = WdfDeviceGetSystemPowerAction(Device); + + // + // Update the power policy D3-cold info for Connected Standby. + // + if (TargetState == WdfPowerDeviceD3 && powerAction == PowerActionNone) + { + PCODEC_DEVICE_CONTEXT devCtx; + WDF_TRI_STATE excludeD3Cold = WdfTrue; + ACX_DX_EXIT_LATENCY latency; + + devCtx = GetCodecDeviceContext(Device); + ASSERT(devCtx != nullptr); + + // + // Get the current exit latency. + // + latency = AcxDeviceGetCurrentDxExitLatency(Device, + WdfDeviceGetSystemPowerAction(Device), + TargetState); + + // + // If the current exit latency for the ACX device is responsive + // (not instant or fast) then D3-cold does not need to be excluded. + // Otherwise, D3-cold should be excluded because if the hardware + // goes into this state it will take too long to go back into D0 + // and respond. + // + if (latency == AcxDxExitLatencyResponsive) + { + excludeD3Cold = WdfFalse; + } + + if (devCtx->ExcludeD3Cold != excludeD3Cold) + { + devCtx->ExcludeD3Cold = excludeD3Cold; + + RETURN_NTSTATUS_IF_FAILED(Codec_SetPowerPolicy(Device)); + } + } + + return status; +} + +PAGED_CODE_SEG +NTSTATUS +Codec_SetPowerPolicy( + _In_ WDFDEVICE Device +) +{ + NTSTATUS status = STATUS_SUCCESS; + PCODEC_DEVICE_CONTEXT devCtx; + + PAGED_CODE(); + + devCtx = GetCodecDeviceContext(Device); + ASSERT(devCtx != nullptr); + + // + // Init the idle policy structure. + // + WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS idleSettings; + WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS_INIT(&idleSettings, IdleCannotWakeFromS0); + idleSettings.IdleTimeout = IDLE_POWER_TIMEOUT; + idleSettings.IdleTimeoutType = SystemManagedIdleTimeoutWithHint; + idleSettings.ExcludeD3Cold = devCtx->ExcludeD3Cold; + + RETURN_NTSTATUS_IF_FAILED(WdfDeviceAssignS0IdleSettings(Device, &idleSettings)); + + return status; +} + +VOID +Codec_EvtDeviceContextCleanup( + _In_ WDFOBJECT WdfDevice +) +/*++ + +Routine Description: + + In this callback, it cleans up device context. + +Arguments: + + WdfDevice - WDF device object + +Return Value: + + nullptr + +--*/ +{ + WDFDEVICE device; + PCODEC_DEVICE_CONTEXT devCtx; + + device = (WDFDEVICE)WdfDevice; + devCtx = GetCodecDeviceContext(device); + ASSERT(devCtx != nullptr); + + if (devCtx->Capture) + { + CodecC_CircuitCleanup(devCtx->Capture); + } +} diff --git a/audio/Acx/Samples/AudioCodec/Driver/Driver.cpp b/audio/Acx/Samples/AudioCodec/Driver/Driver.cpp new file mode 100644 index 00000000..452b0d99 --- /dev/null +++ b/audio/Acx/Samples/AudioCodec/Driver/Driver.cpp @@ -0,0 +1,129 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + + Driver.cpp + +Abstract: + + This file contains the driver entry points and callbacks. + +Environment: + + Kernel-mode Driver Framework + +--*/ + +#include "public.h" +#include "cpp_utils.h" + +#ifndef __INTELLISENSE__ +#include "driver.tmh" +#endif + +_Use_decl_annotations_ +void AudioCodecDriverUnload( + _In_ WDFDRIVER Driver +) +{ + PAGED_CODE(); + + if (!Driver) + { + ASSERT(FALSE); + return; + } + + WPP_CLEANUP(WdfDriverWdmGetDriverObject(Driver)); + + if (g_RegistryPath.Buffer != nullptr) + { + ExFreePool(g_RegistryPath.Buffer); + RtlZeroMemory(&g_RegistryPath, sizeof(g_RegistryPath)); + } + + return; +} + +INIT_CODE_SEG +NTSTATUS +DriverEntry( + _In_ PDRIVER_OBJECT DriverObject, + _In_ PUNICODE_STRING RegistryPath +) +/*++ + +Routine Description: + DriverEntry initializes the driver and is the first routine called by the + system after the driver is loaded. DriverEntry specifies the other entry + points in the function driver, such as EvtDevice and DriverUnload. + +Parameters Description: + + DriverObject - represents the instance of the function driver that is loaded + into memory. DriverEntry must initialize members of DriverObject before it + returns to the caller. DriverObject is allocated by the system before the + driver is loaded, and it is released by the system after the system unloads + the function driver from memory. + + RegistryPath - represents the driver specific path in the Registry. + The function driver can use the path to store driver related data between + reboots. The path does not store hardware instance specific data. + +Return Value: + + STATUS_SUCCESS if successful, + STATUS_UNSUCCESSFUL otherwise. + +--*/ +{ + WDF_DRIVER_CONFIG wdfCfg; + ACX_DRIVER_CONFIG acxCfg; + WDFDRIVER driver; + NTSTATUS status = STATUS_SUCCESS; + WDF_OBJECT_ATTRIBUTES attributes; + + PAGED_CODE(); + WPP_INIT_TRACING(DriverObject, RegistryPath); + + auto exit = scope_exit([&status, &DriverObject]() { + if (!NT_SUCCESS(status)) + { + WPP_CLEANUP(DriverObject); + + if (g_RegistryPath.Buffer != nullptr) + { + ExFreePool(g_RegistryPath.Buffer); + RtlZeroMemory(&g_RegistryPath, sizeof(g_RegistryPath)); + } + } + }); + + RETURN_NTSTATUS_IF_FAILED(CopyRegistrySettingsPath(RegistryPath)); + + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + + WDF_DRIVER_CONFIG_INIT(&wdfCfg, Codec_EvtBusDeviceAdd); + wdfCfg.EvtDriverUnload = AudioCodecDriverUnload; + + // + // Create a framework driver object to represent our driver. + // + RETURN_NTSTATUS_IF_FAILED(WdfDriverCreate(DriverObject, RegistryPath, &attributes, &wdfCfg, &driver)); + + // + // Initializing the ACX driver configuration struct which contains size and flags + // elements. + // + ACX_DRIVER_CONFIG_INIT(&acxCfg); + + // + // The driver calls this DDI in its DriverEntry callback after creating the WDF driver + // object. ACX uses this call to apply any post driver settings. + // + RETURN_NTSTATUS_IF_FAILED(AcxDriverInitialize(driver, &acxCfg)); + + return status; +} diff --git a/audio/Acx/Samples/AudioCodec/Driver/DriverSettings.h b/audio/Acx/Samples/AudioCodec/Driver/DriverSettings.h new file mode 100644 index 00000000..65aa7f5b --- /dev/null +++ b/audio/Acx/Samples/AudioCodec/Driver/DriverSettings.h @@ -0,0 +1,54 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + DriverSettings.h + +Abstract: + + Contains guid definitions and other definitions used by the render and capture circuits + for this specific driver. Driver developers should replace these definitions with their + own. + +Environment: + + Kernel mode + +--*/ + +// Defining the component ID for the capture circuit. This ID uniquely identifies the circuit instance (vendor specific): +DEFINE_GUID(CODEC_CAPTURE_COMPONENT_GUID, 0xc3ee9ec6, 0x8e8c, 0x49e9, 0xaf, 0x4b, 0xa7, 0xfc, 0x28, 0xe9, 0xd2, 0xe7); + +// Defines a custom name for the capture circuit bridge pin: +DEFINE_GUID(MIC_CUSTOM_NAME, 0xd5649dc4, 0x2fa2, 0x418b, 0xb2, 0x78, 0x39, 0x7, 0x64, 0x6b, 0x3, 0xe); + +// Defining the component ID for the render circuit. This ID uniquely identifies the circuit instance (vendor specific): +DEFINE_GUID(CODEC_RENDER_COMPONENT_GUID, 0xd03deb75, 0xe5b2, 0x45f7, 0x91, 0xfa, 0xf7, 0xae, 0x42, 0xdd, 0xf, 0xe0); + +// This is always the definition for the system container guid: +DEFINE_GUID(SYSTEM_CONTAINER_GUID, 0x00000000, 0x0000, 0x0000, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF); + +// Driver developers should update this guid if the container is a device rather than a +// system. Otherwise, this GUID should stay the same: +DEFINE_GUID(DEVICE_CONTAINER_GUID, 0x00000000, 0x0000, 0x0000, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF); + +// AudioCodec driver tag: +#define DRIVER_TAG (ULONG) 'CduA' + +// The idle timeout in msec for power policy structure: +#define IDLE_TIMEOUT_MSEC (ULONG) 10000 + +// The WPP control GUID defined in Trace.h should also be updated to be unique. + +// This string must match the string defined in AudioCodec.inf for the microphone name: +DECLARE_CONST_UNICODE_STRING(captureCircuitName, L"Microphone0"); + +// This string must match the string defined in AudioCodec.inf for the speaker name: +DECLARE_CONST_UNICODE_STRING(renderCircuitName, L"Speaker0"); diff --git a/audio/Acx/Samples/AudioCodec/Driver/ReadMe.txt b/audio/Acx/Samples/AudioCodec/Driver/ReadMe.txt new file mode 100644 index 00000000..ebc61c6d --- /dev/null +++ b/audio/Acx/Samples/AudioCodec/Driver/ReadMe.txt @@ -0,0 +1,42 @@ +======================================================================== + AudioCodec Project Overview +======================================================================== + +This file contains a summary of what you will find in each of the files that make up your project. + +AudioCodec.vcxproj + This is the main project file for projects generated using an Application Wizard. + It contains information about the version of the product that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +AudioCodec.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +Driver.cpp & Driver.h + DriverEntry and WDFDRIVER related functionality and callbacks. Driver developers should + make changes to these files for their specific driver as necessary. + +Device.cpp & Device.h + WDFDEVICE related functionality and callbacks. Driver developers should make changes to + these files for their specific driver as necessary. + +Trace.h + Definitions for WPP tracing. + +DriverSettings.h + Contains guid definitions and other definitions used by the render and capture circuits + for this specific driver. Driver developers should replace these definitions with their + own. + +///////////////////////////////////////////////////////////////////////////// + +Learn more about Kernel Mode Driver Framework here: + +http://msdn.microsoft.com/en-us/library/ff544296(v=VS.85).aspx + +///////////////////////////////////////////////////////////////////////////// diff --git a/audio/Acx/Samples/AudioCodec/Driver/Resources.rc b/audio/Acx/Samples/AudioCodec/Driver/Resources.rc new file mode 100644 index 00000000..788fc416 --- /dev/null +++ b/audio/Acx/Samples/AudioCodec/Driver/Resources.rc @@ -0,0 +1,12 @@ +#include + +#include + +#define VER_FILETYPE VFT_DRV +#define VER_FILESUBTYPE VFT2_DRV_SYSTEM +#define VER_FILEDESCRIPTION_STR "Audio Codec Acx Sample Driver" +#define VER_INTERNALNAME_STR "AudioCodec.sys" +#define VER_ORIGINALFILENAME_STR "AudioCodec.sys" + +#include "common.ver" + diff --git a/audio/Acx/Samples/Common/CaptureCircuit.cpp b/audio/Acx/Samples/Common/CaptureCircuit.cpp new file mode 100644 index 00000000..ba205a90 --- /dev/null +++ b/audio/Acx/Samples/Common/CaptureCircuit.cpp @@ -0,0 +1,799 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + CaptureCircuit.cpp + +Abstract: + + Capture Circuit. This file contains routines to create and handle + capture circuit. + +Environment: + + Kernel mode + +--*/ + +#include "private.h" +#include "public.h" +#include +#include +#include +#include "AudioFormats.h" +#include "streamengine.h" +#include "cpp_utils.h" +#include "circuithelper.h" + +#ifndef __INTELLISENSE__ +#include "captureCircuit.tmh" +#endif + +// +// Controls how the custom name of the bridge pin is read. +// +BOOL g_UseCustomInfName = TRUE; + +PAGED_CODE_SEG +NTSTATUS +CodecC_EvtAcxPinSetDataFormat( + _In_ ACXPIN Pin, + _In_ ACXDATAFORMAT DataFormat +) +/*++ + +Routine Description: + + This ACX pin callback sets the device/mixed format. + +Return Value: + + NTSTATUS + +--*/ +{ + UNREFERENCED_PARAMETER(Pin); + UNREFERENCED_PARAMETER(DataFormat); + + PAGED_CODE(); + + // NOTE: update device/mixed format here. + + return STATUS_NOT_SUPPORTED; +} + +/////////////////////////////////////////////////////////// +// +// For more information on volume element see: https://docs.microsoft.com/en-us/windows-hardware/drivers/audio/ksnodetype-volume +// +_Use_decl_annotations_ +NTSTATUS +CodecC_EvtVolumeAssignLevelCallback( + _In_ ACXVOLUME Volume, + _In_ ULONG Channel, + _In_ LONG VolumeLevel +) +{ + PAGED_CODE(); + + ASSERT(Volume); + PVOLUME_ELEMENT_CONTEXT volumeCtx = GetVolumeElementContext(Volume); + ASSERT(volumeCtx); + + if (Channel != ALL_CHANNELS_ID) + { + volumeCtx->VolumeLevel[Channel] = VolumeLevel; + } + else + { + for (ULONG i = 0; i < MAX_CHANNELS; ++i) + { + volumeCtx->VolumeLevel[i] = VolumeLevel; + } + } + + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +NTSTATUS +CodecC_EvtVolumeRetrieveLevelCallback( + _In_ ACXVOLUME Volume, + _In_ ULONG Channel, + _Out_ LONG * VolumeLevel +) +{ + PAGED_CODE(); + + ASSERT(Volume); + PVOLUME_ELEMENT_CONTEXT volumeCtx = GetVolumeElementContext(Volume); + ASSERT(volumeCtx); + + if (Channel == ALL_CHANNELS_ID) + { + Channel = 0; + } + + *VolumeLevel = volumeCtx->VolumeLevel[Channel]; + + return STATUS_SUCCESS; +} + +PAGED_CODE_SEG +NTSTATUS +CodecC_CreateVolumeElement( + _In_ ACXCIRCUIT Circuit, + _Out_ ACXVOLUME* Element +) +/*++ + +Routine Description: + + This routine creates a volume element. + +Return Value: + + NT status value +--*/ +{ + NTSTATUS status = STATUS_SUCCESS; + WDF_OBJECT_ATTRIBUTES attributes; + ACX_VOLUME_CALLBACKS volumeCallbacks; + ACX_VOLUME_CONFIG volumeCfg; + VOLUME_ELEMENT_CONTEXT * volumeCtx; + + PAGED_CODE(); + + // + // The driver uses this DDI to assign its volume element callbacks. + // + ACX_VOLUME_CALLBACKS_INIT(&volumeCallbacks); + volumeCallbacks.EvtAcxVolumeAssignLevel = CodecC_EvtVolumeAssignLevelCallback; + volumeCallbacks.EvtAcxVolumeRetrieveLevel = CodecC_EvtVolumeRetrieveLevelCallback; + + // + // Create Volume element + // + ACX_VOLUME_CONFIG_INIT(&volumeCfg); + volumeCfg.ChannelsCount = MAX_CHANNELS; + volumeCfg.Minimum = VOLUME_LEVEL_MINIMUM; + volumeCfg.Maximum = VOLUME_LEVEL_MAXIMUM; + volumeCfg.SteppingDelta = VOLUME_STEPPING; + volumeCfg.Callbacks = &volumeCallbacks; + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, VOLUME_ELEMENT_CONTEXT); + attributes.ParentObject = Circuit; + + RETURN_NTSTATUS_IF_FAILED(AcxVolumeCreate(Circuit, &attributes, &volumeCfg, Element)); + + ASSERT(*Element != nullptr); + volumeCtx = GetVolumeElementContext(*Element); + ASSERT(volumeCtx); + + // + // (max + min)/2 puts it in the middle of the valid range, divide that by the stepping to get the nearest + // valid step, multiply that by stepping to put it back at a level value. + // + volumeCtx->VolumeLevel[0] = (VOLUME_LEVEL_MAXIMUM + VOLUME_LEVEL_MINIMUM) / 2 / VOLUME_STEPPING * VOLUME_STEPPING; + volumeCtx->VolumeLevel[1] = (VOLUME_LEVEL_MAXIMUM + VOLUME_LEVEL_MINIMUM) / 2 / VOLUME_STEPPING * VOLUME_STEPPING; + + return status; +} + +PAGED_CODE_SEG +NTSTATUS +CodecC_EvtAcxPinRetrieveName( + _In_ ACXPIN Pin, + _Out_ PUNICODE_STRING Name +) +/*++ + +Routine Description: + + If g_UseCustomInfName is false then the ACX + pin callback EvtAcxPinRetrieveName calls this + function in order to retrieve the pin name. + +Return Value: + + NTSTATUS + +--*/ +{ + UNREFERENCED_PARAMETER(Pin); + + PAGED_CODE(); + + return RtlUnicodeStringPrintf(Name, L"CustomName2"); +} + +VOID +CodecC_EvtPinContextCleanup( + _In_ WDFOBJECT WdfPin +) +/*++ + +Routine Description: + + In this callback, it cleans up pin context. + +Arguments: + + WdfDevice - WDF device object + +Return Value: + + nullptr + +--*/ +{ + UNREFERENCED_PARAMETER(WdfPin); +} + +PAGED_CODE_SEG +NTSTATUS +CodecC_CircuitCleanup( + _In_ ACXCIRCUIT Circuit +) +{ + PCODEC_CAPTURE_CIRCUIT_CONTEXT circuitCtx; + + PAGED_CODE(); + + // + // Remove the static capture circuit. + // + circuitCtx = GetCaptureCircuitContext(Circuit); + ASSERT(circuitCtx != nullptr); + + return STATUS_SUCCESS; +} + +PAGED_CODE_SEG +NTSTATUS +CodecC_AddStaticCapture( + _In_ WDFDEVICE Device, + _In_ const GUID * ComponentGuid, + _In_ const GUID * MicCustomName, + _In_ const UNICODE_STRING * CircuitName +) +/*++ + +Routine Description: + + Creates the static capture circuit (pictured below) + and adds it to the device context. This is called + when a new device is detected and the AddDevice + call is made by the pnp manager. + + ****************************************************** + * Capture Circuit * + * * + * +-----------------------+ * + * | | * + * | +-------------+ | * + * Host ------>| | Volume Node | |---> Bridge * + * Pin | +-------------+ | Pin * + * | | * + * +-----------------------+ * + * * + ****************************************************** + +Return Value: + + NTSTATUS + +--*/ +{ + NTSTATUS status = STATUS_SUCCESS; + PCODEC_DEVICE_CONTEXT devCtx; + PCAPTURE_DEVICE_CONTEXT captureDevCtx; + ACXCIRCUIT captureCircuit = nullptr; + WDF_OBJECT_ATTRIBUTES attributes; + + PAGED_CODE(); + + devCtx = GetCodecDeviceContext(Device); + ASSERT(devCtx != nullptr); + + // + // Alloc audio context to current device. + // + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, CAPTURE_DEVICE_CONTEXT); + RETURN_NTSTATUS_IF_FAILED(WdfObjectAllocateContext(Device, &attributes, (PVOID*)&captureDevCtx)); + ASSERT(captureDevCtx); + + // + // Create a capture circuit associated with this child device. + // + RETURN_NTSTATUS_IF_FAILED(CodecC_CreateCaptureCircuit(Device, ComponentGuid, MicCustomName, CircuitName, &captureCircuit)); + + devCtx->Capture = captureCircuit; + + return status; +} + +PAGED_CODE_SEG +NTSTATUS +Capture_AllocateSupportedFormats( + _In_ WDFDEVICE Device, + _In_reads_bytes_(CodecCapturePinCount) ACXPIN Pin[], + _In_ ACXCIRCUIT Circuit, + _In_ size_t CodecCapturePinCount +) +{ + UNREFERENCED_PARAMETER(CodecCapturePinCount); + + NTSTATUS status = STATUS_SUCCESS; + ACXDATAFORMAT formatPcm44100c1; + ACXDATAFORMAT formatPcm48000c1; + ACXDATAFORMATLIST formatList; + + WDF_OBJECT_ATTRIBUTES attributes; + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + + /////////////////////////////////////////////////////////// + // + // Allocate the formats this circuit supports. + // + + RETURN_NTSTATUS_IF_FAILED(AllocateFormat(Pcm44100c1, Circuit, Device, &formatPcm44100c1)); + RETURN_NTSTATUS_IF_FAILED(AllocateFormat(Pcm48000c1, Circuit, Device, &formatPcm48000c1)); + + /////////////////////////////////////////////////////////// + // + // Define supported formats for the host pin. + // + + // + // The raw processing mode list is associated with each single circuit + // by ACX. A driver uses this DDI to retrieve the built-in raw + // data-format list. + // + RETURN_NTSTATUS_IF_TRUE(CodecCaptureHostPin >= CodecCapturePinCount, STATUS_INVALID_PARAMETER); + formatList = AcxPinGetRawDataFormatList(Pin[CodecCaptureHostPin]); + RETURN_NTSTATUS_IF_TRUE(formatList == nullptr, STATUS_INSUFFICIENT_RESOURCES); + + // + // The driver uses this DDI to add data formats to the raw + // processing mode list associated with the current circuit. + // + RETURN_NTSTATUS_IF_FAILED(AcxDataFormatListAddDataFormat(formatList, formatPcm44100c1)); + RETURN_NTSTATUS_IF_FAILED(AcxDataFormatListAddDataFormat(formatList, formatPcm48000c1)); + + return status; +} + +PAGED_CODE_SEG +NTSTATUS +CodecC_CreateCaptureCircuit( + _In_ WDFDEVICE Device, + _In_ const GUID * ComponentGuid, + _In_ const GUID * MicCustomName, + _In_ const UNICODE_STRING * CircuitName, + _Out_ ACXCIRCUIT* Circuit +) +/*++ + +Routine Description: + + This routine builds the CODEC capture circuit. + +Return Value: + + NT status value + +--*/ +{ + NTSTATUS status; + WDF_OBJECT_ATTRIBUTES attributes; + ACXCIRCUIT circuit; + CODEC_CAPTURE_CIRCUIT_CONTEXT* circuitCtx; + ACXPIN pin[CodecCapturePinCount]; + + PAGED_CODE(); + + // + // Init output value. + // + *Circuit = nullptr; + + /////////////////////////////////////////////////////////// + // + // Create a circuit. + // + { + PACXCIRCUIT_INIT circuitInit = nullptr; + ACX_CIRCUIT_PNPPOWER_CALLBACKS powerCallbacks; + + // + // The driver uses this DDI to allocate an ACXCIRCUIT_INIT + // structure. This opaque structure is used when creating + // a standalone audio circuit representing an audio device. + // + circuitInit = AcxCircuitInitAllocate(Device); + + // + // A driver uses this DDI to free the allocated + // ACXCIRCUIT_INIT structure when an error is detected. + // Normally the structures is deleted/cleared by ACX when + // an ACX circuit is created successfully. + // + auto circuitInitScope = scope_exit([&circuitInit]() { + if (circuitInit) { + AcxCircuitInitFree(circuitInit); + } + }); + + // + // The driver uses this DDI to specify the Component ID + // of the ACX circuit. This ID is a guid that uniquely + // identifies the circuit instance (vendor specific). + // + AcxCircuitInitSetComponentId(circuitInit, ComponentGuid); + + // + // The driver uses this DDI to specify the circuit name. + // For standalone circuits, this is the audio device name + // which is used by clients to open handles to the audio devices. + // + (VOID)AcxCircuitInitAssignName(circuitInit, CircuitName); + + // + // The driver uses this DDI to specify the circuit type. The + // circuit type can be AcxCircuitTypeRender, AcxCircuitTypeCapture, + // AcxCircuitTypeOther, or AcxCircuitTypeMaximum (for validation). + // + AcxCircuitInitSetCircuitType(circuitInit, AcxCircuitTypeCapture); + + // + // The driver uses this DDI to assign its (if any) power callbacks. + // + ACX_CIRCUIT_PNPPOWER_CALLBACKS_INIT(&powerCallbacks); + powerCallbacks.EvtAcxCircuitPowerUp = CodecC_EvtCircuitPowerUp; + powerCallbacks.EvtAcxCircuitPowerDown = CodecC_EvtCircuitPowerDown; + AcxCircuitInitSetAcxCircuitPnpPowerCallbacks(circuitInit, &powerCallbacks); + + // + // The driver uses this DDI to register for a stream-create callback. + // + RETURN_NTSTATUS_IF_FAILED(AcxCircuitInitAssignAcxCreateStreamCallback(circuitInit, CodecC_EvtCircuitCreateStream)); + + // + // The driver uses this DDI to create a new ACX circuit. + // + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, CODEC_CAPTURE_CIRCUIT_CONTEXT); + RETURN_NTSTATUS_IF_FAILED(AcxCircuitCreate(Device, &attributes, &circuitInit, &circuit)); + + circuitInitScope.release(); + + circuitCtx = GetCaptureCircuitContext(circuit); + ASSERT(circuitCtx); + } + + // + // Post circuit creation initialization. + // + + /////////////////////////////////////////////////////////// + // + // Create volume element. + // + { + ACXELEMENT elements[CaptureElementCount] = { 0 }; + + RETURN_NTSTATUS_IF_FAILED(CodecC_CreateVolumeElement(circuit, (ACXVOLUME*)&elements[CaptureVolumeIndex])); + + // + // Saving the volume element in the circuit context. + // + circuitCtx->VolumeElement = (ACXVOLUME)elements[CaptureVolumeIndex]; + + // + // The driver uses this DDI post circuit creation to add ACXELEMENTs. + // + RETURN_NTSTATUS_IF_FAILED(AcxCircuitAddElements(circuit, elements, SIZEOF_ARRAY(elements))); + } + + /////////////////////////////////////////////////////////// + // + // Create the pins for the circuit. + // + { + ACX_PIN_CALLBACKS pinCallbacks; + ACX_PIN_CONFIG pinCfg; + CODEC_PIN_CONTEXT* pinCtx; + + /////////////////////////////////////////////////////////// + // + // Create capture streaming pin. + // + ACX_PIN_CALLBACKS_INIT(&pinCallbacks); + pinCallbacks.EvtAcxPinSetDataFormat = CodecC_EvtAcxPinSetDataFormat; + + ACX_PIN_CONFIG_INIT(&pinCfg); + pinCfg.Type = AcxPinTypeSource; + pinCfg.Communication = AcxPinCommunicationSink; + pinCfg.Category = &KSCATEGORY_AUDIO; + pinCfg.PinCallbacks = &pinCallbacks; + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, CODEC_PIN_CONTEXT); + attributes.EvtCleanupCallback = CodecC_EvtPinContextCleanup; + attributes.ParentObject = circuit; + + // + // The driver uses this DDI to create one or more pins on the circuits. + // + RETURN_NTSTATUS_IF_FAILED(AcxPinCreate(circuit, &attributes, &pinCfg, &(pin[CodecCaptureHostPin]))); + + ASSERT(pin[CodecCaptureHostPin] != nullptr); + pinCtx = GetCodecPinContext(pin[CodecCaptureHostPin]); + ASSERT(pinCtx); + pinCtx->CodecPinType = CodecPinTypeHost; + + /////////////////////////////////////////////////////////// + // + // Create capture endpoint pin. + // + ACX_PIN_CALLBACKS_INIT(&pinCallbacks); + ACX_PIN_CONFIG_INIT(&pinCfg); + + pinCfg.Type = AcxPinTypeSink; + pinCfg.Communication = AcxPinCommunicationNone; + pinCfg.Category = &KSNODETYPE_MICROPHONE; + pinCfg.PinCallbacks = &pinCallbacks; + + // Specify how to read the custom name. + if (g_UseCustomInfName) + { + pinCfg.Name = MicCustomName; + } + else + { + pinCallbacks.EvtAcxPinRetrieveName = CodecC_EvtAcxPinRetrieveName; + } + g_UseCustomInfName = !g_UseCustomInfName; + + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.ParentObject = circuit; + + // + // The driver uses this DDI to create one or more pins on the circuits. + // + RETURN_NTSTATUS_IF_FAILED(AcxPinCreate(circuit, &attributes, &pinCfg, &(pin[CodecCaptureBridgePin]))); + + ASSERT(pin[CodecCaptureBridgePin] != nullptr); + } + + /////////////////////////////////////////////////////////// + // + // Add audio jack to bridge pin. + // For more information on audio jack see: https://docs.microsoft.com/en-us/windows/win32/api/devicetopology/ns-devicetopology-ksjack_description + // + { + ACX_JACK_CONFIG jackCfg; + ACXJACK jack; + PJACK_CONTEXT jackCtx; + + ACX_JACK_CONFIG_INIT(&jackCfg); + jackCfg.Description.ChannelMapping = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; + jackCfg.Description.Color = RGB(0, 0, 0); + jackCfg.Description.ConnectionType = AcxConnTypeAtapiInternal; + jackCfg.Description.GeoLocation = AcxGeoLocFront; + jackCfg.Description.GenLocation = AcxGenLocPrimaryBox; + jackCfg.Description.PortConnection = AcxPortConnIntegratedDevice; + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, JACK_CONTEXT); + attributes.ParentObject = pin[CodecCaptureBridgePin]; + + RETURN_NTSTATUS_IF_FAILED(AcxJackCreate(pin[CodecCaptureBridgePin], &attributes, &jackCfg, &jack)); + + ASSERT(jack != nullptr); + + jackCtx = GetJackContext(jack); + ASSERT(jackCtx); + jackCtx->Dummy = 0; + + RETURN_NTSTATUS_IF_FAILED(AcxPinAddJacks(pin[CodecCaptureBridgePin], &jack, 1)); + } + + RETURN_NTSTATUS_IF_FAILED(Capture_AllocateSupportedFormats(Device, pin, circuit, CodecCapturePinCount)); + + /////////////////////////////////////////////////////////// + // + // The driver uses this DDI post circuit creation to add ACXPINs. + // + RETURN_NTSTATUS_IF_FAILED(AcxCircuitAddPins(circuit, pin, CodecCapturePinCount)); + + // + // Set output value. + // + *Circuit = circuit; + + // + // Done. + // + status = STATUS_SUCCESS; + + return status; +} + +_Use_decl_annotations_ +NTSTATUS +CodecC_EvtCircuitPowerUp( + _In_ WDFDEVICE Device, + _In_ ACXCIRCUIT Circuit, + _In_ WDF_POWER_DEVICE_STATE PreviousState +) +{ + UNREFERENCED_PARAMETER(Device); + UNREFERENCED_PARAMETER(Circuit); + UNREFERENCED_PARAMETER(PreviousState); + + PAGED_CODE(); + + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +NTSTATUS +CodecC_EvtCircuitPowerDown( + _In_ WDFDEVICE Device, + _In_ ACXCIRCUIT Circuit, + _In_ WDF_POWER_DEVICE_STATE TargetState +) +{ + UNREFERENCED_PARAMETER(Device); + UNREFERENCED_PARAMETER(Circuit); + UNREFERENCED_PARAMETER(TargetState); + + PAGED_CODE(); + + return STATUS_SUCCESS; +} + +PAGED_CODE_SEG +NTSTATUS +CodecC_EvtCircuitCreateStream( + _In_ WDFDEVICE Device, + _In_ ACXCIRCUIT Circuit, + _In_ ACXPIN Pin, + _In_ PACXSTREAM_INIT StreamInit, + _In_ ACXDATAFORMAT StreamFormat, + _In_ const GUID * SignalProcessingMode, + _In_ ACXOBJECTBAG VarArguments +) +/*++ + +Routine Description: + + This routine creates a stream for the specified circuit. + +Return Value: + + NT status value + +--*/ +{ + NTSTATUS status; + PCAPTURE_DEVICE_CONTEXT devCtx; + WDF_OBJECT_ATTRIBUTES attributes; + ACXSTREAM stream; + STREAMENGINE_CONTEXT * streamCtx; + ACX_STREAM_CALLBACKS streamCallbacks; + ACX_RT_STREAM_CALLBACKS rtCallbacks; + CCaptureStreamEngine * streamEngine = nullptr; + CODEC_CAPTURE_CIRCUIT_CONTEXT * circuitCtx; + CODEC_PIN_CONTEXT * pinCtx; + + auto streamEngineScope = scope_exit([&streamEngine]() { + + if (streamEngine) + { + delete streamEngine; + } + + }); + + PAGED_CODE(); + UNREFERENCED_PARAMETER(SignalProcessingMode); + UNREFERENCED_PARAMETER(VarArguments); + + ASSERT(IsEqualGUID(*SignalProcessingMode, AUDIO_SIGNALPROCESSINGMODE_RAW)); + + devCtx = GetCaptureDeviceContext(Device); + ASSERT(devCtx != nullptr); + + circuitCtx = GetCaptureCircuitContext(Circuit); + ASSERT(circuitCtx != nullptr); + + pinCtx = GetCodecPinContext(Pin); + ASSERT(pinCtx != nullptr); + + // + // Init streaming callbacks. + // + ACX_STREAM_CALLBACKS_INIT(&streamCallbacks); + streamCallbacks.EvtAcxStreamPrepareHardware = EvtStreamPrepareHardware; + streamCallbacks.EvtAcxStreamReleaseHardware = EvtStreamReleaseHardware; + streamCallbacks.EvtAcxStreamRun = EvtStreamRun; + streamCallbacks.EvtAcxStreamPause = EvtStreamPause; + + RETURN_NTSTATUS_IF_FAILED(AcxStreamInitAssignAcxStreamCallbacks(StreamInit, &streamCallbacks)); + + // + // Init RT streaming callbacks. + // + ACX_RT_STREAM_CALLBACKS_INIT(&rtCallbacks); + rtCallbacks.EvtAcxStreamGetHwLatency = EvtStreamGetHwLatency; + rtCallbacks.EvtAcxStreamAllocateRtPackets = EvtStreamAllocateRtPackets; + rtCallbacks.EvtAcxStreamFreeRtPackets = EvtStreamFreeRtPackets; + rtCallbacks.EvtAcxStreamGetCapturePacket = CodecC_EvtStreamGetCapturePacket; + rtCallbacks.EvtAcxStreamGetCurrentPacket = EvtStreamGetCurrentPacket; + rtCallbacks.EvtAcxStreamGetPresentationPosition = EvtStreamGetPresentationPosition; + + RETURN_NTSTATUS_IF_FAILED(AcxStreamInitAssignAcxRtStreamCallbacks(StreamInit, &rtCallbacks)); + + // + // Buffer notifications are supported. + // + AcxStreamInitSetAcxRtStreamSupportsNotifications(StreamInit); + + // + // Create the stream. + // + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, STREAMENGINE_CONTEXT); + attributes.EvtDestroyCallback = EvtStreamDestroy; + RETURN_NTSTATUS_IF_FAILED(AcxRtStreamCreate(Device, Circuit, &attributes, &StreamInit, &stream)); + + streamCtx = GetStreamEngineContext(stream); + ASSERT(streamCtx); + + // + // Create the virtual streaming engine which will control + // streaming logic for the capture circuit. + // + streamEngine = new (POOL_FLAG_NON_PAGED, DeviceDriverTag) CCaptureStreamEngine(stream, StreamFormat); + RETURN_NTSTATUS_IF_TRUE(streamEngine == nullptr, STATUS_INSUFFICIENT_RESOURCES); + + streamCtx->StreamEngine = (PVOID)streamEngine; + + streamEngine = nullptr; + + // + // Done. + // + status = STATUS_SUCCESS; + + return status; +} + +PAGED_CODE_SEG +NTSTATUS +CodecC_EvtStreamGetCapturePacket( + _In_ ACXSTREAM Stream, + _Out_ ULONG * LastCapturePacket, + _Out_ ULONGLONG * QPCPacketStart, + _Out_ BOOLEAN * MoreData +) +{ + PSTREAMENGINE_CONTEXT ctx; + CCaptureStreamEngine* streamEngine = nullptr; + + PAGED_CODE(); + + ctx = GetStreamEngineContext(Stream); + + streamEngine = static_cast(ctx->StreamEngine); + + return streamEngine->GetCapturePacket(LastCapturePacket, QPCPacketStart, MoreData); +} + + diff --git a/audio/Acx/Samples/Common/CircuitHelper.cpp b/audio/Acx/Samples/Common/CircuitHelper.cpp new file mode 100644 index 00000000..bfff74b2 --- /dev/null +++ b/audio/Acx/Samples/Common/CircuitHelper.cpp @@ -0,0 +1,620 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + CircuitHelper.cpp + +Abstract: + + This module contains helper functions for circuits. + +Environment: + + Kernel mode + +--*/ + +#include "private.h" +#include "public.h" +#include "CircuitHelper.h" + +#ifndef __INTELLISENSE__ +#include "CircuitHelper.tmh" +#endif + +const ULONG _DSP_STREAM_PROPERTY_UI4_VALUE = 1; + +PAGED_CODE_SEG +NTSTATUS AllocateFormat( + _In_ KSDATAFORMAT_WAVEFORMATEXTENSIBLE WaveFormat, + _In_ ACXCIRCUIT Circuit, + _In_ WDFDEVICE Device, + _Out_ ACXDATAFORMAT* Format +) +{ + PAGED_CODE(); + + NTSTATUS status = STATUS_SUCCESS; + + WDF_OBJECT_ATTRIBUTES attributes; + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + + ACX_DATAFORMAT_CONFIG formatCfg; + ACX_DATAFORMAT_CONFIG_INIT_KS(&formatCfg, &WaveFormat); + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, FORMAT_CONTEXT); + attributes.ParentObject = Circuit; + + // + // Creates an ACXDATAFORMAT handle for the given wave format. + // + RETURN_NTSTATUS_IF_FAILED(AcxDataFormatCreate(Device, &attributes, &formatCfg, Format)); + + ASSERT((*Format) != NULL); + FORMAT_CONTEXT* formatCtx; + formatCtx = GetFormatContext(*Format); + ASSERT(formatCtx); + UNREFERENCED_PARAMETER(formatCtx); + + return status; +} + +PAGED_CODE_SEG +NTSTATUS CreateStreamBridge( + _In_ ACX_STREAM_BRIDGE_CONFIG StreamCfg, + _In_ ACXCIRCUIT Circuit, + _In_ ACXPIN Pin, + _In_ DSP_PIN_CONTEXT* PinCtx, + _In_ BOOL Render) +{ + PAGED_CODE(); + + NTSTATUS status = STATUS_SUCCESS; + + WDF_OBJECT_ATTRIBUTES attributes; + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + + attributes.ParentObject = Pin; + + ACX_OBJECTBAG_CONFIG objBagCfg; + ACXOBJECTBAG objBag = NULL; + ACX_OBJECTBAG_CONFIG_INIT(&objBagCfg); + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.ParentObject = Circuit; + RETURN_NTSTATUS_IF_FAILED(AcxObjectBagCreate(&attributes, &objBagCfg, &objBag)); + + DECLARE_CONST_ACXOBJECTBAG_DRIVER_PROPERTY_NAME(msft, TestUI4); + RETURN_NTSTATUS_IF_FAILED(AcxObjectBagAddUI4(objBag, &TestUI4, _DSP_STREAM_PROPERTY_UI4_VALUE)); + + // + // Add a stream BRIDGE. + // + PCGUID inModes[] = { + &AUDIO_SIGNALPROCESSINGMODE_RAW, + &AUDIO_SIGNALPROCESSINGMODE_DEFAULT, + }; + + if (Render) + { + StreamCfg.InModesCount = SIZEOF_ARRAY(inModes); + StreamCfg.InModes = inModes; + } + + // + // Do not specify InModes for capture - this will prevent the ACX framework from adding created streams to this stream + // bridge automatically. We want to add the stream bridges manually since we don't want KWS streams added. + // + StreamCfg.OutMode = &AUDIO_SIGNALPROCESSINGMODE_RAW; + StreamCfg.OutStreamVarArguments = objBag; + + // + // Uncomment this line to reverse the change-state sequence notifications. + // + // streamCfg.Flags |= AcxStreamBridgeInvertChangeStateSequence; + + ACXSTREAMBRIDGE streamBridge = NULL; + RETURN_NTSTATUS_IF_FAILED(AcxStreamBridgeCreate(Circuit, &attributes, &StreamCfg, &streamBridge)); + + if (!Render) + { + PinCtx->HostStreamBridge = streamBridge; + } + + RETURN_NTSTATUS_IF_FAILED(AcxPinAddStreamBridges(Pin, &streamBridge, 1)); + + return status; +} + +PAGED_CODE_SEG +NTSTATUS ConnectRenderCircuitElements( + _In_ ACXAUDIOENGINE AudioEngineElement, + _In_ ACXCIRCUIT Circuit +) +{ + PAGED_CODE(); + + NTSTATUS status = STATUS_SUCCESS; + + // + // Explicitly connect the circuit/elements. Note that driver doesn't + // need to perform this step when circuit/elements are connected in the + // same order as they were added to the circuit. By default ACX connects + // the elements starting from the sink circuit pin and ending with the + // source circuit pin for both render and capture devices. + // + // Circuit layout + // ----------------------------------------- + // | | + // | -------------------- | + // Host -0->|-----1->| |-0-------->|-3-> Bridge Pin + // | | Audio Engine | | + // Offload -1->|-----2->| Node |-3--| | + // | |------------------| | | + // | | | + // Loopback <-2-|<------------------------------ | | + // | | + // | | + // |---------------------------------------| + // + + ACX_CONNECTION connections[4]; + + ACX_CONNECTION_INIT(&connections[0], Circuit, AudioEngineElement); + connections[0].FromPin.Id = RenderHostPin; + connections[0].ToPin.Id = 1; + + ACX_CONNECTION_INIT(&connections[1], Circuit, AudioEngineElement); + connections[1].FromPin.Id = RenderOffloadPin; + connections[1].ToPin.Id = 2; + + ACX_CONNECTION_INIT(&connections[2], AudioEngineElement, Circuit); + connections[2].ToPin.Id = RenderLoopbackPin; + connections[2].FromPin.Id = 3; + + ACX_CONNECTION_INIT(&connections[3], AudioEngineElement, Circuit); + connections[3].ToPin.Id = RenderBridgePin; + connections[3].FromPin.Id = 0; + + // + // Add the connections linking circuit to elements. + // + RETURN_NTSTATUS_IF_FAILED(AcxCircuitAddConnections(Circuit, connections, SIZEOF_ARRAY(connections))); + + return status; + +} + +PAGED_CODE_SEG +NTSTATUS +Codec_GetModeFromAttributeList( + _In_ const PKSMULTIPLE_ITEM Attributes, + _In_ ULONG AttributesSize, + _Out_ GUID * SignalProcessingMode + ) +{ + NTSTATUS status = STATUS_NO_MORE_ENTRIES; + PKSATTRIBUTE attributeHeader = NULL; + PAGED_CODE(); + *SignalProcessingMode = AUDIO_SIGNALPROCESSINGMODE_DEFAULT; + + status = FindKsAttributeById(Attributes, + AttributesSize, + &KSATTRIBUTEID_AUDIOSIGNALPROCESSING_MODE, + sizeof(KSATTRIBUTE_AUDIOSIGNALPROCESSING_MODE), + &attributeHeader); + if (!NT_SUCCESS(status)) + { + goto exit; + } + + ASSERT(attributeHeader->Attribute == KSATTRIBUTEID_AUDIOSIGNALPROCESSING_MODE); + ASSERT(attributeHeader->Size == sizeof(KSATTRIBUTE_AUDIOSIGNALPROCESSING_MODE)); + + KSATTRIBUTE_AUDIOSIGNALPROCESSING_MODE* signalProcessingModeAttribute; + signalProcessingModeAttribute = (KSATTRIBUTE_AUDIOSIGNALPROCESSING_MODE*)attributeHeader; + *SignalProcessingMode = signalProcessingModeAttribute->SignalProcessingMode; + status = STATUS_SUCCESS; +exit: + return status; +} + +struct AFX_FIND_KSATTRIBUTE_BY_ID +{ + const _GUID * Id; + ULONG Size; + PKSATTRIBUTE Attribute; +}; + +PAGED_CODE_SEG +NTSTATUS +FindKsAttributeByIdVisitor( + _In_ PKSATTRIBUTE AttributeHeader, + _In_ PVOID Context, + _Out_ BOOLEAN * bContinue + ) +{ + NTSTATUS status = STATUS_SUCCESS; + AFX_FIND_KSATTRIBUTE_BY_ID * ctx = (AFX_FIND_KSATTRIBUTE_BY_ID *)Context; + PAGED_CODE(); + // Default: continue searching. + *bContinue = TRUE; + + if (IsEqualGUIDAligned(AttributeHeader->Attribute, *ctx->Id)) + { + // Validate its size. + if (AttributeHeader->Size < ctx->Size) + { + status = STATUS_INVALID_PARAMETER; + goto exit; + } + + ctx->Attribute = AttributeHeader; + *bContinue = FALSE; + } +exit: + return status; +} + +PAGED_CODE_SEG +NTSTATUS +FindKsAttributeById( + _In_ const PKSMULTIPLE_ITEM Attributes, + _In_ ULONG AttributesSize, + _In_ const _GUID * AttributeId, + _In_ ULONG AttributeSize, + _Out_ PKSATTRIBUTE * AttributeHeader + ) +{ + PAGED_CODE(); + NTSTATUS status; + AFX_FIND_KSATTRIBUTE_BY_ID ctx = {0}; + *AttributeHeader = NULL; + ctx.Id = AttributeId; + ctx.Size = AttributeSize; + status = TraverseKsAttributeList(Attributes, AttributesSize, FindKsAttributeByIdVisitor, &ctx); + if (!NT_SUCCESS(status)) + { + goto exit; + } + if (ctx.Attribute == NULL) + { + status = STATUS_NO_MORE_ENTRIES; + goto exit; + } + *AttributeHeader = ctx.Attribute; +exit: + return status; +} + +PAGED_CODE_SEG +NTSTATUS +TraverseKsAttributeList( + _In_ const PKSMULTIPLE_ITEM Attributes, + _In_ ULONG AttributesSize, + _In_ PFN_KSATTRIBUTES_VISITOR Visitor, + _In_ PVOID Context + ) +{ + PAGED_CODE(); + NTSTATUS status = STATUS_SUCCESS; + ULONG cbRemaining = 0; + PKSATTRIBUTE attributeHeader = NULL; + ASSERT(Visitor); + // + // Note: multiple-item ptr must have a FILE_QUAD_ALIGNMENT only in relation to the Pin's format size. + // I.e., it is not guaranteed that the attributes are FILE_QUAD_ALIGNMENT in memory, unless the caller reallocates + // them before calling this function (which is currently not done by anyone in any driver/sample). + // + //ASSERT((ULONG_PTR)Attributes == (((ULONG_PTR)Attributes + FILE_QUAD_ALIGNMENT) & ~FILE_QUAD_ALIGNMENT)); + if (AttributesSize < sizeof(KSMULTIPLE_ITEM)) + { + status = STATUS_INVALID_PARAMETER; + goto exit; + } + if (Attributes->Size < sizeof(KSMULTIPLE_ITEM)) + { + status = STATUS_INVALID_PARAMETER; + goto exit; + } + if (AttributesSize < Attributes->Size) + { + status = STATUS_INVALID_PARAMETER; + goto exit; + } + + cbRemaining = Attributes->Size; + // + // Init ptr / size of attributes of list. + // + cbRemaining -= sizeof(KSMULTIPLE_ITEM); + attributeHeader = (PKSATTRIBUTE)(Attributes + 1); + for (ULONG i = 0; i < Attributes->Count; i++) + { + BOOLEAN bContinue = TRUE; + size_t cbAttribute = 0; + + if (cbRemaining < sizeof(KSATTRIBUTE)) + { + status = STATUS_INVALID_PARAMETER; + goto exit; + } + if (attributeHeader->Size < sizeof(KSATTRIBUTE)) + { + status = STATUS_INVALID_PARAMETER; + goto exit; + } + if (cbRemaining < attributeHeader->Size) + { + status = STATUS_INVALID_PARAMETER; + goto exit; + } + // + // Invoke the descriptor enumeration routine. + // + status = Visitor(attributeHeader, Context, &bContinue); + if (!NT_SUCCESS(status)) + { + goto exit; + } + + if (!bContinue) + { + break; + } + // + // Adjust pointer and buffer size to next attribute (QWORD aligned) + // + cbAttribute = CODEC_ALIGN_SIZE_UP_CONSTANT(attributeHeader->Size, FILE_QUAD_ALIGNMENT); + if (cbRemaining < cbAttribute) + { + // + // Out of buffer, check if this was the last attribute. + // + if (i + 1 != Attributes->Count) + { + // + // This was not the last attribute, nevertheless there is no more buffer, error out. + // + status = STATUS_INVALID_PARAMETER; + goto exit; + } + // This was the final attribute. Exit loop with success status. + break; + } + // Check next attribute. + attributeHeader = (PKSATTRIBUTE)(((PBYTE)attributeHeader) + cbAttribute); + cbRemaining -= (ULONG)cbAttribute; + } + // Normalize success code. + status = STATUS_SUCCESS; +exit: + return status; +} + +PAGED_CODE_SEG +NTSTATUS +EvtJackRetrievePresence( + _In_ ACXJACK Jack, + _In_ PBOOLEAN IsConnected +) +{ + PAGED_CODE(); + + UNREFERENCED_PARAMETER(Jack); + UNREFERENCED_PARAMETER(IsConnected); + + NTSTATUS status = STATUS_SUCCESS; + + // + // Because this is a sample we always return true (jack is present). A real driver should check + // if the device is actually present before returning true. + // + *IsConnected = true; + + return status; +} + +PAGED_CODE_SEG +NTSTATUS +CreateAudioJack( + _In_ ULONG ChannelMapping, + _In_ ULONG Color, + _In_ ACX_JACK_CONNECTION_TYPE ConnectionType, + _In_ ACX_JACK_GEO_LOCATION GeoLocation, + _In_ ACX_JACK_GEN_LOCATION GenLocation, + _In_ ACX_JACK_PORT_CONNECTION PortConnection, + _In_ ULONG Flags, + _In_ ACXPIN BridgePin + ) +{ + PAGED_CODE(); + + NTSTATUS status = STATUS_SUCCESS; + ACX_JACK_CONFIG jackCfg; + ACXJACK jack; + PJACK_CONTEXT jackCtx; + ACX_JACK_CALLBACKS jackCallbacks; + + WDF_OBJECT_ATTRIBUTES attributes; + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + + ACX_JACK_CONFIG_INIT(&jackCfg); + jackCfg.Description.ChannelMapping = ChannelMapping; + jackCfg.Description.Color = Color; + jackCfg.Description.ConnectionType = ConnectionType; + jackCfg.Description.GeoLocation = GeoLocation; + jackCfg.Description.GenLocation = GenLocation; + jackCfg.Description.PortConnection = PortConnection; + jackCfg.Flags = Flags; + + ACX_JACK_CALLBACKS_INIT(&jackCallbacks); + jackCallbacks.EvtAcxJackRetrievePresenceState = EvtJackRetrievePresence; + jackCfg.Callbacks = &jackCallbacks; + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, JACK_CONTEXT); + attributes.ParentObject = BridgePin; + + status = AcxJackCreate(BridgePin, &attributes, &jackCfg, &jack); + if (!NT_SUCCESS(status)) + { + goto exit; + } + + ASSERT(jack != nullptr); + + jackCtx = GetJackContext(jack); + ASSERT(jackCtx); + jackCtx->Dummy = 0; + + status = AcxPinAddJacks(BridgePin, &jack, 1); + +exit: + return status; +} + +PAGED_CODE_SEG +VOID +CpuResourcesCallbackHelper +( + _In_ WDFOBJECT Object, + _In_ WDFREQUEST Request, + _In_ ACXELEMENT Element +) +{ + NTSTATUS ntStatus = STATUS_NOT_SUPPORTED; + ULONG_PTR outDataCb = 0; + ACX_REQUEST_PARAMETERS params; + ULONG minSize = sizeof(ULONG); + + PAGED_CODE(); + + ACX_REQUEST_PARAMETERS_INIT(¶ms); + AcxRequestGetParameters(Request, ¶ms); + + if ((params.Type != AcxRequestTypeProperty) || + (params.Parameters.Property.ItemType != AcxItemTypeElement)) + { + // Return to acx + (VOID) AcxCircuitDispatchAcxRequest((ACXCIRCUIT)Object, Request); + Request = NULL; + goto exit; + } + + if (Element == NULL) + { + ntStatus = STATUS_NOT_SUPPORTED; + goto exit; + } + + ULONG elementId = params.Parameters.Property.ItemId; + ULONG currentElementId = AcxElementGetId(Element); + ULONG valueCb = params.Parameters.Property.ValueCb; + + if (valueCb != 0) + { + if (params.Parameters.Property.Value == NULL) + { + ntStatus = STATUS_BUFFER_TOO_SMALL; + goto exit; + } + } + + // + // Check to see if the current node is the peakmeter node, if not then return the call to ACX + // + if (elementId != currentElementId) + { + (VOID) AcxCircuitDispatchAcxRequest((ACXCIRCUIT)Object, Request); + Request = NULL; + goto exit; + } + + if (params.Parameters.Property.Verb == AcxPropertyVerbGet) + { + + if (valueCb == 0) + { + outDataCb = minSize; + ntStatus = STATUS_BUFFER_OVERFLOW; + goto exit; + } + else if (valueCb < minSize) + { + outDataCb = 0; + ntStatus = STATUS_BUFFER_TOO_SMALL; + goto exit; + } + else + { + *((PULONG)params.Parameters.Property.Value) = KSAUDIO_CPU_RESOURCES_NOT_HOST_CPU; + params.Parameters.Property.ValueCb = sizeof(ULONG); + outDataCb = params.Parameters.Property.ValueCb; + ntStatus = STATUS_SUCCESS; + } + } + else if (params.Parameters.Property.Verb == AcxPropertyVerbBasicSupport) + { + if ((valueCb != sizeof(ULONG)) && (valueCb != sizeof(KSPROPERTY_DESCRIPTION))) + { + outDataCb = minSize; + ntStatus = STATUS_BUFFER_OVERFLOW; + goto exit; + } + + if (valueCb >= sizeof(KSPROPERTY_DESCRIPTION)) + { + // if return buffer can hold a KSPROPERTY_DESCRIPTION, return it + // + PKSPROPERTY_DESCRIPTION PropDesc = (PKSPROPERTY_DESCRIPTION)params.Parameters.Property.Value; + + PropDesc->AccessFlags = KSPROPERTY_TYPE_BASICSUPPORT | KSPROPERTY_TYPE_GET; + PropDesc->DescriptionSize = sizeof(KSPROPERTY_DESCRIPTION); + PropDesc->PropTypeSet.Set = KSPROPTYPESETID_General; + PropDesc->PropTypeSet.Id = VT_UI4; + PropDesc->PropTypeSet.Flags = 0; + PropDesc->MembersListCount = 0; + PropDesc->Reserved = 0; + outDataCb = sizeof(KSPROPERTY_DESCRIPTION); + ntStatus = STATUS_SUCCESS; + } + else if (valueCb >= sizeof(ULONG)) + { + // if return buffer can hold a ULONG, return the access flags + // + *((PULONG)params.Parameters.Property.Value) = KSPROPERTY_TYPE_BASICSUPPORT | KSPROPERTY_TYPE_GET; + outDataCb = minSize; + ntStatus = STATUS_SUCCESS; + } + else if (valueCb > 0) + { + outDataCb = 0; + ntStatus = STATUS_BUFFER_TOO_SMALL; + } + else + { + outDataCb = minSize; + ntStatus = STATUS_BUFFER_OVERFLOW; + } + } + else + { + // + // Just give it back to ACX. After this call the request is gone. + // + (VOID) AcxCircuitDispatchAcxRequest((ACXCIRCUIT)Object, Request); + Request = NULL; + goto exit; + } + +exit: + if (Request != NULL) + { + WdfRequestCompleteWithInformation(Request, ntStatus, outDataCb); + } +} // EvtAudioCpuResourcesCallback diff --git a/audio/Acx/Samples/Common/CircuitHelper.h b/audio/Acx/Samples/Common/CircuitHelper.h new file mode 100644 index 00000000..58938153 --- /dev/null +++ b/audio/Acx/Samples/Common/CircuitHelper.h @@ -0,0 +1,135 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + CircuitHelper.h + +Abstract: + + This module contains helper functions for endpoints. + +Environment: + + Kernel mode + +--*/ + +// size_t +// __inline +// CODEC_ALIGN_SIZE_DOWN_CONSTANT( +// IN size_t Length, +// IN size_t AlignTo +// ) +#define CODEC_ALIGN_SIZE_DOWN_CONSTANT(Length, AlignTo) ((Length) & ~((AlignTo)-1)) + +#define CODEC_ALIGN_SIZE_DOWN CODEC_ALIGN_SIZE_DOWN_CONSTANT + +// size_t +// __inline +// CODEC_ALIGN_SIZE_UP_CONSTANT( +// IN size_t Length, +// IN size_t AlignTo +// ) +#define CODEC_ALIGN_SIZE_UP_CONSTANT(Length, AlignTo) CODEC_ALIGN_SIZE_DOWN_CONSTANT((Length) + (AlignTo)-1, (AlignTo)) + +#define CODEC_ALIGN_SIZE_UP CODEC_ALIGN_SIZE_UP_CONSTANT + +PAGED_CODE_SEG +NTSTATUS +Codec_GetModeFromAttributeList( + _In_ const PKSMULTIPLE_ITEM Attributes, + _In_ ULONG AttributesSize, + _Out_ GUID * SignalProcessingMode + ); + +// +// Enumeration visitor callback. +// +typedef +NTSTATUS +(EVT_KSATTRIBUTES_VISITOR)( + _In_ PKSATTRIBUTE AttributeHeader, + _In_ PVOID Context, + _Out_ BOOLEAN * bContinue + ); + +typedef EVT_KSATTRIBUTES_VISITOR *PFN_KSATTRIBUTES_VISITOR; + +static +PAGED_CODE_SEG +EVT_KSATTRIBUTES_VISITOR FindKsAttributeByIdVisitor; + +PAGED_CODE_SEG +NTSTATUS +FindKsAttributeById( + _In_ const PKSMULTIPLE_ITEM Attributes, + _In_ ULONG AttributesSize, + _In_ const _GUID * AttributeId, + _In_ ULONG AttributeSize, + _Out_ PKSATTRIBUTE * AttributeHeader + ); + +PAGED_CODE_SEG +NTSTATUS +TraverseKsAttributeList( + _In_ const PKSMULTIPLE_ITEM Attributes, + _In_ ULONG AttributesSize, + _In_ PFN_KSATTRIBUTES_VISITOR Visitor, + _In_ PVOID Context + ); + +PAGED_CODE_SEG +NTSTATUS AllocateFormat( + _In_ KSDATAFORMAT_WAVEFORMATEXTENSIBLE WaveFormat, + _In_ ACXCIRCUIT Circuit, + _In_ WDFDEVICE Device, + _Out_ ACXDATAFORMAT* Format +); + +PAGED_CODE_SEG +NTSTATUS CreateStreamBridge( + _In_ ACX_STREAM_BRIDGE_CONFIG StreamCfg, + _In_ ACXCIRCUIT Circuit, + _In_ ACXPIN Pin, + _In_ DSP_PIN_CONTEXT* PinCtx, + _In_ BOOL Render +); + +PAGED_CODE_SEG +NTSTATUS ConnectRenderCircuitElements( + _In_ ACXAUDIOENGINE AudioEngineElement, + _In_ ACXCIRCUIT Circuit +); + +PAGED_CODE_SEG +NTSTATUS CreateAudioJack( + _In_ ULONG ChannelMapping, + _In_ ULONG Color, + _In_ ACX_JACK_CONNECTION_TYPE ConnectionType, + _In_ ACX_JACK_GEO_LOCATION GeoLocation, + _In_ ACX_JACK_GEN_LOCATION GenLocation, + _In_ ACX_JACK_PORT_CONNECTION PortConnection, + _In_ ULONG Flags, + _In_ ACXPIN BridgePin +); + +PAGED_CODE_SEG +NTSTATUS EvtJackRetrievePresence( + _In_ ACXJACK Jack, + _In_ PBOOLEAN IsConnected +); + +PAGED_CODE_SEG +VOID CpuResourcesCallbackHelper( + _In_ WDFOBJECT Object, + _In_ WDFREQUEST Request, + _In_ ACXELEMENT Element +); + diff --git a/audio/Acx/Samples/Common/KeywordDetector.cpp b/audio/Acx/Samples/Common/KeywordDetector.cpp new file mode 100644 index 00000000..f3476745 --- /dev/null +++ b/audio/Acx/Samples/Common/KeywordDetector.cpp @@ -0,0 +1,484 @@ +/*++ + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + KeywordDetector.cpp + +Abstract: + + Sample keyword detector management. + +Environment: + + Kernel mode + +--*/ + +#include "private.h" +#include "public.h" +#include +#include +#include +#include "streamengine.h" +#include "KeywordDetector.h" + +PAGED_CODE_SEG +CKeywordDetector::CKeywordDetector() + : + m_streamRunning(FALSE), + m_qpcStartCapture(0), + m_nLastQueuedPacket(-1), + m_SoundDetectorArmed1(FALSE), + m_SoundDetectorArmed2(FALSE), + m_SoundDetectorData1(0), + m_SoundDetectorData2(0), + m_ullKeywordStartTimestamp(0), + m_ullKeywordStopTimestamp(0) +{ + PAGED_CODE(); + + // Initialize our pool of packets and the list structures + KeInitializeSpinLock(&PacketPoolSpinLock); + KeInitializeSpinLock(&PacketFifoSpinLock); + ResetFifo(); +} + +PAGED_CODE_SEG +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS CKeywordDetector::ReadKeywordTimestampRegistry() +{ + PAGED_CODE(); + + NTSTATUS ntStatus; + PDRIVER_OBJECT DriverObject; + HANDLE DriverKey; + + RTL_QUERY_REGISTRY_TABLE paramTable[] = { + // QueryRoutine Flags Name EntryContext DefaultType DefaultData DefaultLength + { NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_TYPECHECK, L"KeywordDetectorStartTimestamp", &m_ullKeywordStartTimestamp, (REG_QWORD << RTL_QUERY_REGISTRY_TYPECHECK_SHIFT) | REG_QWORD, &m_ullKeywordStartTimestamp, sizeof(ULONGLONG) }, + { NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_TYPECHECK, L"KeywordDetectorStopTimestamp", &m_ullKeywordStopTimestamp, (REG_QWORD << RTL_QUERY_REGISTRY_TYPECHECK_SHIFT) | REG_QWORD, &m_ullKeywordStopTimestamp, sizeof(ULONGLONG) }, + { NULL, 0, NULL, NULL, 0, NULL, 0 } + }; + + DriverObject = WdfDriverWdmGetDriverObject(WdfGetDriver()); + DriverKey = NULL; + ntStatus = IoOpenDriverRegistryKey(DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &DriverKey); + + if (!NT_SUCCESS(ntStatus)) + { + return ntStatus; + } + + ntStatus = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PCWSTR) DriverKey, + ¶mTable[0], + NULL, + NULL); + if (DriverKey) + { + ZwClose(DriverKey); + } + + return ntStatus; +} + + +PAGED_CODE_SEG +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS CKeywordDetector::ResetDetector(_In_ GUID eventId) +{ + PAGED_CODE(); + + if (eventId == CONTOSO_KEYWORD1) + { + m_SoundDetectorData1 = 0; + m_SoundDetectorArmed1 = FALSE; + } + else if(eventId == CONTOSO_KEYWORD2) + { + m_SoundDetectorData2 = 0; + m_SoundDetectorArmed2 = FALSE; + } + else if(eventId == GUID_NULL) + { + // When DownloadDetectorData is called to set the pattern for multiple keywords + // at once, all keyword detectors must be reset. Also used during keyword detector + // initialization and cleanup to restore it back to initial state and power down. + m_SoundDetectorData1 = 0; + m_SoundDetectorArmed1 = FALSE; + m_SoundDetectorData2 = 0; + m_SoundDetectorArmed2 = FALSE; + } + else + { + return STATUS_INVALID_PARAMETER; + } + + return STATUS_SUCCESS; +} + +PAGED_CODE_SEG +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS CKeywordDetector::DownloadDetectorData(_In_ GUID eventId, _In_ LONGLONG Data) +{ + PAGED_CODE(); + + // reset the detector for this event Id + ResetDetector(eventId); + + // In this example, the driver supports detection data + // set with a single call for both detectors, or each + // detector set individually. + if (eventId == CONTOSO_KEYWORD1) + { + m_SoundDetectorData1 = Data; + } + else if(eventId == CONTOSO_KEYWORD2) + { + m_SoundDetectorData2 = Data; + } + else if(eventId == GUID_NULL) + { + // in this simplified example "Data" is set on both detectors, + // however in a real system "Data" could be a data structure which + // contains different values for each detector. + m_SoundDetectorData1 = m_SoundDetectorData2 = Data; + } + else + { + return STATUS_INVALID_PARAMETER; + } + + return STATUS_SUCCESS; +} + +// The following function is only applicable to single keyword detection systems, +// and assumes keyword detector #1. +PAGED_CODE_SEG +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS CKeywordDetector::GetDetectorData(_In_ GUID eventId, _Out_ LONGLONG *Data) +{ + PAGED_CODE(); + + if (eventId == CONTOSO_KEYWORD1) + { + *Data = m_SoundDetectorData1; + } + else if(eventId == CONTOSO_KEYWORD2) + { + *Data = m_SoundDetectorData2; + } + else + { + return STATUS_INVALID_PARAMETER; + } + + + return STATUS_SUCCESS; +} + +PAGED_CODE_SEG +_IRQL_requires_max_(PASSIVE_LEVEL) +ULONGLONG CKeywordDetector::GetStartTimestamp() +{ + PAGED_CODE(); + + return m_ullKeywordStartTimestamp; +} + +PAGED_CODE_SEG +_IRQL_requires_max_(PASSIVE_LEVEL) +ULONGLONG CKeywordDetector::GetStopTimestamp() +{ + PAGED_CODE(); + + return m_ullKeywordStopTimestamp; +} + +PAGED_CODE_SEG +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID CKeywordDetector::ResetFifo() +{ + PAGED_CODE(); + + m_qpcStartCapture = 0; + m_nLastQueuedPacket = (-1); + InitializeListHead(&PacketPoolHead); + InitializeListHead(&PacketFifoHead); + + for (int i = 0; i < ARRAYSIZE(PacketPool); i++) + { + InsertTailList(&PacketPoolHead, &PacketPool[i].ListEntry); + } + return; +} + +PAGED_CODE_SEG +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS CKeywordDetector::SetArmed(_In_ GUID eventId, _In_ BOOLEAN Arm) +{ + PAGED_CODE(); + + BOOL previousArming = FALSE; + NTSTATUS ntStatus = STATUS_SUCCESS; + + // the previous state is "armed" if either detector is armed. + // this reflects the fact that both detectors are sharing the + // same stream. + previousArming = m_SoundDetectorArmed1 || m_SoundDetectorArmed2; + + if (eventId == CONTOSO_KEYWORD1) + { + m_SoundDetectorArmed1 = Arm; + } + else if(eventId == CONTOSO_KEYWORD2) + { + m_SoundDetectorArmed2 = Arm; + } + else + { + return STATUS_INVALID_PARAMETER; + } + + if (Arm && !previousArming && m_qpcStartCapture == 0) + { + StartBufferingStream(); + } + else if (!Arm && previousArming && !m_streamRunning) + { + // if it's not actively streaming and everything has been disarmed, + // then stop buffering. + ResetFifo(); + } + + return ntStatus; +} + +PAGED_CODE_SEG +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS CKeywordDetector::GetArmed(_In_ GUID eventId, _Out_ BOOLEAN *Arm) +{ + PAGED_CODE(); + NTSTATUS ntStatus = STATUS_SUCCESS; + + if (eventId == CONTOSO_KEYWORD1) + { + *Arm = m_SoundDetectorArmed1; + } + else if(eventId == CONTOSO_KEYWORD2) + { + *Arm = m_SoundDetectorArmed2; + } + else + { + return STATUS_INVALID_PARAMETER; + } + + return ntStatus; +} + +PAGED_CODE_SEG +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID CKeywordDetector::Run() +{ + PAGED_CODE(); + + if (m_qpcStartCapture == 0) + { + StartBufferingStream(); + } + + m_streamRunning = TRUE; +} + +PAGED_CODE_SEG +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID CKeywordDetector::Stop() +{ + PAGED_CODE(); + + ResetFifo(); + m_streamRunning = FALSE; +} + +PAGED_CODE_SEG +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID CKeywordDetector::StartBufferingStream() +{ + LARGE_INTEGER qpc; + LARGE_INTEGER qpcFrequency; + + PAGED_CODE(); + + qpc = KeQueryPerformanceCounter(&qpcFrequency); + m_qpcStartCapture = qpc.QuadPart; + m_qpcFrequency = qpcFrequency.QuadPart; + + return; +} + +PAGED_CODE_SEG +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID CKeywordDetector::NotifyDetection() +{ + PAGED_CODE(); + + // A detection will only happen if armed and the + // stream is already running. If there isn't a client + // running, then set the stream start time to align + // with this detection. + if (!m_streamRunning) + { + StartBufferingStream(); + + // The following code is for testing purposes only. + // m_qpcFrequency is defined to be the number of ticks in 1 second. + // Use the stream start time (the current time retrieved in StartBufferStream) to + // mark when the keyword ended, and the start time minus 1 second worth of ticks + // to mark when the keyword started. Also, adjust the stream start time to align + // to this new keyword start time, so that the simulated stream contains the full keyword. + + m_ullKeywordStopTimestamp = m_qpcStartCapture; // stop time is the current time + m_qpcStartCapture = m_qpcStartCapture - m_qpcFrequency; // buffer start time is 1 second ago + m_ullKeywordStartTimestamp = m_qpcStartCapture; // buffer start time = keyword start time + + } + else + { + // The following code is for testing purposes only. + // If the stream is running, we cannot modify qpcStartCapture to be in + // the past, so instead make the keyword start & stop times fit within the + // time period that the keyword has been running. If it has been running + // for more than 1 second, then set the keyword start time to be 1 second back + // into the stream, as though we just figured out there was a keyword there. + // If it has been running less than one second, then the keyword size ends + // up being however long the stream has been running. + + LARGE_INTEGER qpc; + qpc = KeQueryPerformanceCounter(NULL); + + m_ullKeywordStopTimestamp = qpc.QuadPart; // stop time is the current time + + if (m_qpcStartCapture < (qpc.QuadPart - m_qpcFrequency)) + { + m_ullKeywordStartTimestamp = (qpc.QuadPart - m_qpcFrequency); + } + else + { + m_ullKeywordStartTimestamp = m_qpcStartCapture; + } + + } + + return; +} + +_IRQL_requires_min_(DISPATCH_LEVEL) +VOID CKeywordDetector::DpcRoutine(_In_ LONGLONG PerformanceCounter, _In_ LONGLONG PerformanceFrequency) +{ + LONGLONG currentPacket; + LONGLONG packetsToQueue; + + // TODO: the timer only runs when the stream is open, but really for KWS it should be building up a collection of burst data + // in the queue from 1.5 sec before the trigger happens. Is there some way to simulate that behavior here? Without doing that, + // there isn't really a burst that happens, just a trickle because while the timestamps will be right, the queue won't contain + // anything until the timer fires at the normal rate. + + if (m_qpcStartCapture <= 0) + { + return; + } + + currentPacket = (PerformanceCounter - m_qpcStartCapture) * (SamplesPerSecond / SamplesPerPacket) / PerformanceFrequency; + packetsToQueue = currentPacket - m_nLastQueuedPacket; + + while (packetsToQueue > 0) + { + LIST_ENTRY* packetListEntry; + PACKET_ENTRY* packetEntry; + + do + { + packetListEntry = ExInterlockedRemoveHeadList(&PacketPoolHead, &PacketPoolSpinLock); + if (packetListEntry != NULL) break; + + // Pool is empty, no room to buffer more, an overrun is occurring. Drop and reuse the + // oldest packet from head of fifo. + + // Since the pool is empty, the fifo should be full. However, although unlikely, the + // driver might empty the fifo before this routine removes a packet. In that case, the + // pool should have packets available again. Therefore this is a retry loop. + packetListEntry = ExInterlockedRemoveHeadList(&PacketFifoHead, &PacketFifoSpinLock); + if (packetListEntry != NULL) break; + } while (TRUE); + + packetEntry = CONTAINING_RECORD(packetListEntry, PACKET_ENTRY, ListEntry); + + packetEntry->PacketNumber = ++m_nLastQueuedPacket; + packetEntry->QpcWhenSampled = m_qpcStartCapture + (packetEntry->PacketNumber * PerformanceFrequency * SamplesPerPacket / SamplesPerSecond); + + // TODO: this should really put something real in the buffer. Use the sine tone generator maybe? + RtlZeroMemory(&packetEntry->Samples[0], sizeof(packetEntry->Samples)); + + ExInterlockedInsertTailList(&PacketFifoHead, packetListEntry, &PacketFifoSpinLock); + + packetsToQueue -= 1; + } +} + +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS CKeywordDetector::GetReadPacket +( + _In_ ULONG PacketCount, + _In_ ULONG PacketSize, + _Out_writes_(PacketSize) PVOID *Packets, + _Out_ ULONG *PacketNumber, + _Out_ ULONG64 *PerformanceCounterValue, + _Out_ BOOLEAN *MoreData +) +{ + NTSTATUS ntStatus; + BYTE *packetData; + PACKET_ENTRY *packetEntry; + LIST_ENTRY *packetListEntry = NULL; + + packetListEntry = ExInterlockedRemoveHeadList(&PacketFifoHead, &PacketFifoSpinLock); + if (packetListEntry == NULL) + { + ntStatus = STATUS_DEVICE_NOT_READY; + goto Exit; + } + packetEntry = CONTAINING_RECORD(packetListEntry, PACKET_ENTRY, ListEntry); + + ntStatus = RtlLongLongToULong(packetEntry->PacketNumber, PacketNumber); + if (!NT_SUCCESS(ntStatus)) + { + goto Exit; + } + + packetData = (PBYTE) Packets[(*PacketNumber) % PacketCount]; + + *PerformanceCounterValue = packetEntry->QpcWhenSampled; + *MoreData = !IsListEmpty(&PacketFifoHead); + + // TODO: the packet size here needs to line up to the packet size allocated. + // Also, handle the first packet offset + RtlCopyMemory(packetData, packetEntry->Samples, min(sizeof(packetEntry->Samples), PacketSize)); + +Exit: + if (packetListEntry != NULL) + { + ExInterlockedInsertTailList(&PacketPoolHead, packetListEntry, &PacketPoolSpinLock); + } + + return ntStatus; +} diff --git a/audio/Acx/Samples/Common/KeywordDetector.h b/audio/Acx/Samples/Common/KeywordDetector.h new file mode 100644 index 00000000..2d5293b8 --- /dev/null +++ b/audio/Acx/Samples/Common/KeywordDetector.h @@ -0,0 +1,145 @@ +/*++ + +Copyright (c) Microsoft Corporation All Rights Reserved + +Module Name: + + KeywordDetector.h + +Abstract: + + Sample Keyword Detector. + + +--*/ + +#pragma once + +typedef struct +{ + SOUNDDETECTOR_PATTERNHEADER Header; + LONGLONG ContosoDetectorConfigurationData; +} CONTOSO_KEYWORDCONFIGURATION; + +typedef struct +{ + SOUNDDETECTOR_PATTERNHEADER Header; + LONGLONG ContosoDetectorResultData; + ULONGLONG KeywordStartTimestamp; + ULONGLONG KeywordStopTimestamp; + GUID EventId; +} CONTOSO_KEYWORDDETECTIONRESULT; + +DEFINE_GUID(CONTOSO_KEYWORDCONFIGURATION_IDENTIFIER2, +0x207f3d0c, 0x5c79, 0x496f, 0xa9, 0x4c, 0xd3, 0xd2, 0x93, 0x4d, 0xbf, 0xa9); + +// {A537F559-2D67-463B-B10E-BEB750A21F31} +DEFINE_GUID(CONTOSO_KEYWORD1, +0xa537f559, 0x2d67, 0x463b, 0xb1, 0xe, 0xbe, 0xb7, 0x50, 0xa2, 0x1f, 0x31); +// {655E417A-80A5-4A77-B3F1-512EAF67ABCF} +DEFINE_GUID(CONTOSO_KEYWORD2, +0x655e417a, 0x80a5, 0x4a77, 0xb3, 0xf1, 0x51, 0x2e, 0xaf, 0x67, 0xab, 0xcf); + +#define KEYWORDDETECTOR_POOLTAG 'KWS0' + +class CKeywordDetector +{ +public: + PAGED_CODE_SEG + CKeywordDetector(); + + _IRQL_requires_max_(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS ResetDetector(_In_ GUID eventId); + + _IRQL_requires_max_(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS DownloadDetectorData(_In_ GUID eventId, _In_ LONGLONG Data); + + _IRQL_requires_max_(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS GetDetectorData(_In_ GUID eventId, _Out_ LONGLONG *Data); + + _IRQL_requires_max_(PASSIVE_LEVEL) + PAGED_CODE_SEG + ULONGLONG GetStartTimestamp(); + + _IRQL_requires_max_(PASSIVE_LEVEL) + PAGED_CODE_SEG + ULONGLONG GetStopTimestamp(); + + _IRQL_requires_max_(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS SetArmed(_In_ GUID eventId, _In_ BOOLEAN Arm); + + _IRQL_requires_max_(PASSIVE_LEVEL) + PAGED_CODE_SEG + VOID NotifyDetection(); + + _IRQL_requires_max_(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS GetArmed(_In_ GUID eventId, _Out_ BOOLEAN *Arm); + + _IRQL_requires_max_(PASSIVE_LEVEL) + PAGED_CODE_SEG + VOID Run(); + + _IRQL_requires_max_(PASSIVE_LEVEL) + PAGED_CODE_SEG + VOID Stop(); + + _IRQL_requires_min_(DISPATCH_LEVEL) + VOID DpcRoutine(_In_ LONGLONG PerformanceCounter, _In_ LONGLONG PerformanceFrequency); + + _IRQL_requires_max_(PASSIVE_LEVEL) + NTSTATUS GetReadPacket(_In_ ULONG PacketCount, _In_ ULONG PacketSize, _Out_writes_(PacketSize) PVOID *Packets, _Out_ ULONG *PacketNumber, _Out_ ULONGLONG *PerformanceCount, _Out_ BOOLEAN *MoreData); + +private: + _IRQL_requires_max_(PASSIVE_LEVEL) + PAGED_CODE_SEG + VOID ResetFifo(); + + _IRQL_requires_max_(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS ReadKeywordTimestampRegistry(); + + _IRQL_requires_max_(PASSIVE_LEVEL) + PAGED_CODE_SEG + VOID StartBufferingStream(); + + // The Contoso keyword detector processes 10ms packets of 16KHz 16-bit PCM + // audio samples + static const int SamplesPerSecond = 16000; + static const int SamplesPerPacket = (10 * SamplesPerSecond / 1000); + + typedef struct + { + LIST_ENTRY ListEntry; + LONGLONG PacketNumber; + LONGLONG QpcWhenSampled; + UINT16 Samples[SamplesPerPacket]; + } PACKET_ENTRY; + + BOOLEAN m_streamRunning; + + BOOLEAN m_SoundDetectorArmed1; + BOOLEAN m_SoundDetectorArmed2; + LONGLONG m_SoundDetectorData1; + LONGLONG m_SoundDetectorData2; + + LONGLONG m_qpcStartCapture; + LONGLONG m_qpcFrequency; + LONGLONG m_nLastQueuedPacket; + + ULONGLONG m_ullKeywordStartTimestamp; + ULONGLONG m_ullKeywordStopTimestamp; + + KSPIN_LOCK PacketPoolSpinLock; + LIST_ENTRY PacketPoolHead; + PACKET_ENTRY PacketPool[1 * SamplesPerSecond / SamplesPerPacket]; // Enough storage for 1 second of audio data + + KSPIN_LOCK PacketFifoSpinLock; + LIST_ENTRY PacketFifoHead; + +}; + diff --git a/audio/Acx/Samples/Common/NewDelete.cpp b/audio/Acx/Samples/Common/NewDelete.cpp new file mode 100644 index 00000000..583d36c5 --- /dev/null +++ b/audio/Acx/Samples/Common/NewDelete.cpp @@ -0,0 +1,91 @@ +/*++ + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. +Module Name: + newdelete.cpp +Abstract: + Contains overloaded placement new and delete operators +Environment: + Kernel mode +--*/ + +#include "private.h" +#include "NewDelete.h" + +/***************************************************************************** + * ::new(POOL_FLAGS) + ***************************************************************************** + * New function for creating objects with a specified pool flags. + */ +PVOID operator new( + _In_ size_t size, + _In_ POOL_FLAGS poolFlags +) +{ + PVOID result = ExAllocatePool2(poolFlags, size, 'wNwS'); + + return result; +} + +/***************************************************************************** + * ::new(POOL_FLAGS, TAG) + ***************************************************************************** + * New function for creating objects with specified pool flags and allocation tag. + */ +PVOID operator new( + _In_ size_t size, + _In_ POOL_FLAGS poolFlags, + _In_ ULONG tag +) +{ + PVOID result = ExAllocatePool2(poolFlags, size, tag); + + return result; +} + +void __cdecl operator delete(PVOID buffer) +{ + if (buffer) + { + ExFreePool(buffer); + } +} + +void __cdecl operator delete(PVOID buffer, ULONG tag) +{ + if (buffer) + { + ExFreePoolWithTag(buffer, tag); + } +} + +void __cdecl operator delete(_Pre_maybenull_ __drv_freesMem(Mem) PVOID buffer, _In_ size_t cbSize) +{ + UNREFERENCED_PARAMETER(cbSize); + + if (buffer) + { + ExFreePool(buffer); + } +} + +void __cdecl operator delete[](_Pre_maybenull_ __drv_freesMem(Mem) PVOID buffer) +{ + if (buffer) + { + ExFreePool(buffer); + } +} + +void __cdecl operator delete[](_Pre_maybenull_ __drv_freesMem(Mem) PVOID buffer, _In_ size_t cbSize) +{ + UNREFERENCED_PARAMETER(cbSize); + + if (buffer) + { + ExFreePool(buffer); + } +} + diff --git a/audio/Acx/Samples/Common/NewDelete.h b/audio/Acx/Samples/Common/NewDelete.h new file mode 100644 index 00000000..fb660ff9 --- /dev/null +++ b/audio/Acx/Samples/Common/NewDelete.h @@ -0,0 +1,58 @@ +/*++ +Copyright (c) Microsoft Corporation. All rights reserved. + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. +Module Name: + NewDelete.h +Abstract: + Contains overloaded placement new and delete operators +Environment: + Kernel mode +--*/ + +/***************************************************************************** + * ::new(POOL_FLAGS) + ***************************************************************************** + * New function for creating objects with a specified pool flags. + */ +PVOID operator new( + _In_ size_t size, + _In_ POOL_FLAGS poolFlags +); + +/***************************************************************************** + * ::new(POOL_FLAGS, TAG) + ***************************************************************************** + * New function for creating objects with specified pool flags and allocation tag. + */ +PVOID operator new( + _In_ size_t size, + _In_ POOL_FLAGS poolFlags, + _In_ ULONG tag +); + +/***************************************************************************** + * ::delete() + ***************************************************************************** + * Delete function. + */ +void __cdecl operator delete(PVOID buffer); + +/***************************************************************************** + * ::delete() + ***************************************************************************** + * Delete function. + */ +void __cdecl operator delete(PVOID buffer, ULONG tag); + +void __cdecl operator delete[](PVOID pVoid, _In_ size_t cbSize); + +void __cdecl operator delete(_Pre_maybenull_ __drv_freesMem(Mem) PVOID buffer, _In_ size_t cbSize); + +void __cdecl operator delete[](_Pre_maybenull_ __drv_freesMem(Mem) PVOID buffer); + +void __cdecl operator delete[](_Pre_maybenull_ __drv_freesMem(Mem) PVOID buffer, _In_ size_t cbSize); + + diff --git a/audio/Acx/Samples/Common/Private.h b/audio/Acx/Samples/Common/Private.h new file mode 100644 index 00000000..da89ef78 --- /dev/null +++ b/audio/Acx/Samples/Common/Private.h @@ -0,0 +1,922 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + Private.h + +Abstract: + + Contains structure definitions and function prototypes private to + the Common library. + +Environment: + + Kernel mode + +--*/ + +#ifndef _PRIVATE_H_ +#define _PRIVATE_H_ + + +#include +#include +#include "cpp_utils.h" +#include +#include +#include +#include "NewDelete.h" + +/* make prototypes usable from C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include "Trace.h" + +#include +#include + +#define PAGED_CODE_SEG __declspec(code_seg("PAGE")) +#define INIT_CODE_SEG __declspec(code_seg("INIT")) + +extern const GUID DSP_CIRCUIT_SPEAKER_GUID; +extern const GUID DSP_CIRCUIT_MICROPHONE_GUID; +extern const GUID DSP_CIRCUIT_UNIVERSALJACK_RENDER_GUID; +extern const GUID DSP_CIRCUIT_UNIVERSALJACK_CAPTURE_GUID; + +///////////////////////////////////////////////////////// +// +// Driver wide definitions +// + +// Copied from cfgmgr32.h +#if !defined(MAX_DEVICE_ID_LEN) +#define MAX_DEVICE_ID_LEN 200 +#endif + +// Number of millisecs per sec. +#define MS_PER_SEC 1000 + +// Number of hundred nanosecs per sec. +#define HNS_PER_SEC 10000000 + +#define REQUEST_TIMEOUT_SECONDS 5 + +#undef MIN +#undef MAX +#define MIN(a,b) ((a) > (b) ? (b) : (a)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +#ifndef BOOL +typedef int BOOL; +#endif + +#ifndef SIZEOF_ARRAY +#define SIZEOF_ARRAY(ar) (sizeof(ar)/sizeof((ar)[0])) +#endif // !defined(SIZEOF_ARRAY) + +#ifndef RGB +#define RGB(r, g, b) (DWORD)(r << 16 | g << 8 | b) +#endif + +#define ALL_CHANNELS_ID UINT32_MAX +#define MAX_CHANNELS 2 + +// +// Ks support. +// +#define KSPROPERTY_TYPE_ALL KSPROPERTY_TYPE_BASICSUPPORT | \ + KSPROPERTY_TYPE_GET | \ + KSPROPERTY_TYPE_SET + +// +// Define struct to hold signal processing mode and corresponding +// list of supported formats. +// +typedef struct +{ + GUID SignalProcessingMode; + KSDATAFORMAT_WAVEFORMATEXTENSIBLE* FormatList; + ULONG FormatListCount; +} SUPPORTED_FORMATS_LIST; + +// +// Define CAPTURE device context. +// +typedef struct _CAPTURE_DEVICE_CONTEXT { + ACXCIRCUIT Circuit; + BOOLEAN FirstTimePrepareHardware; +} CAPTURE_DEVICE_CONTEXT, * PCAPTURE_DEVICE_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(CAPTURE_DEVICE_CONTEXT, GetCaptureDeviceContext) + +// +// Define RENDER device context. +// +typedef struct _RENDER_DEVICE_CONTEXT { + ACXCIRCUIT Circuit; + BOOLEAN FirstTimePrepareHardware; +} RENDER_DEVICE_CONTEXT, * PRENDER_DEVICE_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(RENDER_DEVICE_CONTEXT, GetRenderDeviceContext) + +// +// Define circuit/stream element context. +// +typedef struct _ELEMENT_CONTEXT { + BOOLEAN Dummy; +} ELEMENT_CONTEXT, *PELEMENT_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(ELEMENT_CONTEXT, GetElementContext) + +// +// Define circuit/stream element context. +// +typedef struct _MUTE_ELEMENT_CONTEXT { + BOOL MuteState[MAX_CHANNELS]; +} MUTE_ELEMENT_CONTEXT, *PMUTE_ELEMENT_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(MUTE_ELEMENT_CONTEXT, GetMuteElementContext) + +// +// Define circuit/stream element context. +// +typedef struct _VOLUME_ELEMENT_CONTEXT { + LONG VolumeLevel[MAX_CHANNELS]; +} VOLUME_ELEMENT_CONTEXT, *PVOLUME_ELEMENT_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(VOLUME_ELEMENT_CONTEXT, GetVolumeElementContext) + +#define VOLUME_STEPPING 0x8000 +#define VOLUME_LEVEL_MAXIMUM 0x00000000 +#define VOLUME_LEVEL_MINIMUM (-96 * 0x10000) + +// +// Define mute timer context. +// +typedef struct _MUTE_TIMER_CONTEXT { + ACXELEMENT MuteElement; + ACXEVENT Event; +} MUTE_TIMER_CONTEXT, *PMUTE_TIMER_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(MUTE_TIMER_CONTEXT, GetMuteTimerContext) + +// +// Define format context. +// +typedef struct _FORMAT_CONTEXT { + BOOLEAN Dummy; +} FORMAT_CONTEXT, *PFORMAT_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(FORMAT_CONTEXT, GetFormatContext) + +// +// Define jack context. +// +typedef struct _JACK_CONTEXT { + ULONG Dummy; +} JACK_CONTEXT, * PJACK_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(JACK_CONTEXT, GetJackContext) + +// +// Define audio engine context. +// +typedef struct _ENGINE_CONTEXT { + ACXDATAFORMAT MixFormat; +} ENGINE_CONTEXT, * PENGINE_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(ENGINE_CONTEXT, GetEngineContext) + +// +// Define stream audio engine context. +// +typedef struct _STREAMAUDIOENGINE_CONTEXT { + BOOLEAN Dummy; +} STREAMAUDIOENGINE_CONTEXT, * PSTREAMAUDIOENGINE_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(STREAMAUDIOENGINE_CONTEXT, GetStreamAudioEngineContext) + +// +// Define keyword spotter context +// +typedef struct _KEYWORDSPOTTER_CONTEXT { + ACXPNPEVENT Event; + PVOID KeywordDetector; +} KEYWORDSPOTTER_CONTEXT, * PKEYWORDSPOTTER_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(KEYWORDSPOTTER_CONTEXT, GetKeywordSpotterContext) + +// +// Define pnp event context. +// +typedef struct _PNPEVENT_CONTEXT { + BOOLEAN Dummy; +} PNPEVENT_CONTEXT, * PPNPEVENT_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(PNPEVENT_CONTEXT, GetPnpEventContext) + +// +// Define peakmeter element context. +// +typedef struct _PEAKMETER_ELEMENT_CONTEXT { + LONG PeakMeterLevel[MAX_CHANNELS]; +} PEAKMETER_ELEMENT_CONTEXT, * PPEAKMETER_ELEMENT_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(PEAKMETER_ELEMENT_CONTEXT, GetPeakMeterElementContext) + +// +// Define DSP circuit's peakmeter element context. +// +typedef struct _DSP_PEAKMETER_ELEMENT_CONTEXT +{ + PVOID peakMeter; +} DSP_PEAKMETER_ELEMENT_CONTEXT, *PDSP_PEAKMETER_ELEMENT_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DSP_PEAKMETER_ELEMENT_CONTEXT, GetDspPeakMeterElementContext) + +// +// Define stream engine context. +// +typedef struct _STREAMENGINE_CONTEXT { + PVOID StreamEngine; +} STREAMENGINE_CONTEXT, * PSTREAMENGINE_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(STREAMENGINE_CONTEXT, GetStreamEngineContext) + +#define PEAKMETER_STEPPING_DELTA 0x1000 +#define PEAKMETER_MAXIMUM LONG_MAX +#define PEAKMETER_MINIMUM LONG_MIN + +///////////////////////////////////////////////////////////// +// Codec driver defintions +// + +typedef enum _CODEC_PIN_TYPE { + CodecPinTypeHost, + CodecPinTypeOffload, + CodecPinTypeLoopback, + CodecPinTypeKeyword, + CodecPinTypeDevice +} CODEC_PIN_TYPE, * PCODEC_PIN_TYPE; + +typedef struct _CODEC_PIN_CONTEXT { + CODEC_PIN_TYPE CodecPinType; +} CODEC_PIN_CONTEXT, * PCODEC_PIN_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(CODEC_PIN_CONTEXT, GetCodecPinContext) + +/////////////////////////////////////////////////////////// +// Dsp driver definitions +// + +typedef enum { + CaptureHostPin = 0, + CaptureBridgePin = 1, + CaptureKWSPin = 2, + CapturePinCount = 3 +} CAPTURE_PIN_TYPE; + +typedef enum { + RenderHostPin = 0, + RenderOffloadPin = 1, + RenderLoopbackPin = 2, + RenderBridgePin = 3, + RenderPinCount = 4 +} RENDER_PIN_TYPE; + +typedef struct _DSP_PIN_CONTEXT { + ACXTARGETCIRCUIT TargetCircuit; + ULONG TargetPinId; + RENDER_PIN_TYPE RenderPinType; + CAPTURE_PIN_TYPE CapturePinType; + + // The stream bridge below will only be valid for the Capture circuit Bridge Pin + + // Host stream bridge will be used to ensure host stream creations are passed + // to the downlevel circuits. Since the HostStreamBridge won't have InModes set, + // the ACX framework will not add streams automatically. We will add streams for + // non KWS pin. + ACXSTREAMBRIDGE HostStreamBridge; +} DSP_PIN_CONTEXT, * PDSP_PIN_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DSP_PIN_CONTEXT, GetDspPinContext) + +///////////////////////////////////////////////////////////// +// Multicircuit Dsp driver definitions +// + +// +// Circuit context for multi circuit dsp circuits. +// +typedef struct _DSP_CIRCUIT_CONTEXT +{ + ACXAUDIOENGINE AudioEngineElement; + ACXPEAKMETER PeakMeterElement; + PVOID peakMeter; + ACXKEYWORDSPOTTER KeywordSpotter; + BOOLEAN IsRenderCircuit; +} DSP_CIRCUIT_CONTEXT, *PDSP_CIRCUIT_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DSP_CIRCUIT_CONTEXT, GetDspCircuitContext) + +typedef struct _DSP_ENGINE_CONTEXT +{ + ACXDATAFORMAT MixFormat; + BOOLEAN GFxEnabled; +} DSP_ENGINE_CONTEXT, *PDSP_ENGINE_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DSP_ENGINE_CONTEXT, GetDspEngineContext) + +typedef struct _DSP_STREAMAUDIOENGINE_CONTEXT +{ + BOOLEAN LFxEnabled; +} DSP_STREAMAUDIOENGINE_CONTEXT, *PDSP_STREAMAUDIOENGINE_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DSP_STREAMAUDIOENGINE_CONTEXT, GetDspStreamAudioEngineContext) + +///////////////////////////////////////////////////////// +// +// Codec Render (speaker) definitions +// + +// +// Define render circuit context. +// +typedef struct _CODEC_RENDER_CIRCUIT_CONTEXT { + ACXVOLUME VolumeElement; + ACXMUTE MuteElement; + ACXPEAKMETER PeakMeterElement; + ACXAUDIOENGINE AudioEngineElement; +} CODEC_RENDER_CIRCUIT_CONTEXT, * PCODEC_RENDER_CIRCUIT_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(CODEC_RENDER_CIRCUIT_CONTEXT, GetRenderCircuitContext) + +typedef enum { + CodecRenderHostPin = 0, + CodecRenderBridgePin = 1, + CodecRenderPinCount = 2 +} CODEC_RENDER_PINS; + +typedef enum { + RenderVolumeIndex = 0, + RenderMuteIndex = 1, + RenderElementCount = 2 +} CODEC_RENDER_ELEMENTS; + +// Render callbacks. + +EVT_ACX_CIRCUIT_CREATE_STREAM CodecR_EvtCircuitCreateStream; +EVT_ACX_CIRCUIT_POWER_UP CodecR_EvtCircuitPowerUp; +EVT_ACX_CIRCUIT_POWER_DOWN CodecR_EvtCircuitPowerDown; +EVT_ACX_STREAM_SET_RENDER_PACKET CodecR_EvtStreamSetRenderPacket; +EVT_ACX_STREAM_GET_CAPTURE_PACKET CodecR_EvtStreamGetLoopbackPacket; +EVT_ACX_PIN_SET_DATAFORMAT CodecR_EvtAcxPinSetDataFormat; +EVT_WDF_DEVICE_CONTEXT_CLEANUP CodecR_EvtPinContextCleanup; +EVT_ACX_MUTE_ASSIGN_STATE CodecR_EvtMuteAssignState; +EVT_ACX_MUTE_RETRIEVE_STATE CodecR_EvtMuteRetrieveState; +EVT_ACX_VOLUME_ASSIGN_LEVEL CodecR_EvtVolumeAssignLevel; +EVT_ACX_VOLUME_RETRIEVE_LEVEL CodecR_EvtVolumeRetrieveLevel; +EVT_ACX_PEAKMETER_RETRIEVE_LEVEL CodecR_EvtPeakMeterRetrieveLevelCallback; +EVT_ACX_RAMPED_VOLUME_ASSIGN_LEVEL CodecR_EvtRampedVolumeAssignLevel; +EVT_ACX_AUDIOENGINE_RETRIEVE_BUFFER_SIZE_LIMITS CodecR_EvtAcxAudioEngineRetrieveBufferSizeLimits; +EVT_ACX_AUDIOENGINE_RETRIEVE_EFFECTS_STATE CodecR_EvtAcxAudioEngineRetrieveEffectsState; +EVT_ACX_AUDIOENGINE_ASSIGN_EFFECTS_STATE CodecR_EvtAcxAudioEngineAssignEffectsState; +EVT_ACX_AUDIOENGINE_ASSIGN_ENGINE_FORMAT CodecR_EvtAcxAudioEngineAssignEngineDeviceFormat; +EVT_ACX_AUDIOENGINE_RETRIEVE_ENGINE_FORMAT CodecR_EvtAcxAudioEngineRetrieveEngineMixFormat; +EVT_ACX_STREAMAUDIOENGINE_RETRIEVE_EFFECTS_STATE CodecR_EvtAcxStreamAudioEngineRetrieveEffectsState; +EVT_ACX_STREAMAUDIOENGINE_ASSIGN_EFFECTS_STATE CodecR_EvtAcxStreamAudioEngineAssignEffectsState; +EVT_ACX_STREAMAUDIOENGINE_RETRIEVE_PRESENTATION_POSITION CodecR_EvtAcxStreamAudioEngineRetrievePresentationPosition; +EVT_ACX_STREAMAUDIOENGINE_ASSIGN_CURRENT_WRITE_POSITION CodecR_EvtAcxStreamAudioEngineAssignCurrentWritePosition; +EVT_ACX_STREAMAUDIOENGINE_RETRIEVE_LINEAR_BUFFER_POSITION CodecR_EvtAcxStreamAudioEngineRetrieveLinearBufferPosition; +EVT_ACX_STREAMAUDIOENGINE_ASSIGN_LAST_BUFFER_POSITION CodecR_EvtAcxStreamAudioEngineAssignLastBufferPosition; +EVT_ACX_STREAMAUDIOENGINE_ASSIGN_LOOPBACK_PROTECTION CodecR_EvtAcxStreamAudioEngineAssignLoopbackProtection; + +PAGED_CODE_SEG +NTSTATUS +CodecR_CreateRenderCircuit( + _In_ WDFDEVICE Device, + _In_ const GUID * ComponentGuid, + _In_ const UNICODE_STRING * CircuitName, + _Out_ ACXCIRCUIT * Circuit +); + +///////////////////////////////////////////////////////// +// +// Codec Capture (microphone) definitions +// + +// +// Define capture circuit context. +// +typedef struct _CODEC_CAPTURE_CIRCUIT_CONTEXT { + ACXVOLUME BoostElement; + ACXVOLUME VolumeElement; + ACXKEYWORDSPOTTER KeywordSpotter; +} CODEC_CAPTURE_CIRCUIT_CONTEXT, * PCODEC_CAPTURE_CIRCUIT_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(CODEC_CAPTURE_CIRCUIT_CONTEXT, GetCaptureCircuitContext) + +typedef enum { + CodecCaptureHostPin = 0, + CodecCaptureBridgePin = 1, + CodecCapturePinCount = 2 +} CODEC_CAPTURE_PINS; + +typedef enum { + CaptureVolumeIndex = 0, + CaptureElementCount = 1 +} CAPTURE_ELEMENTS; + +// Capture callbacks. + +EVT_ACX_CIRCUIT_CREATE_STREAM CodecC_EvtCircuitCreateStream; +EVT_ACX_CIRCUIT_POWER_UP CodecC_EvtCircuitPowerUp; +EVT_ACX_CIRCUIT_POWER_DOWN CodecC_EvtCircuitPowerDown; +EVT_ACX_VOLUME_ASSIGN_LEVEL CodecC_EvtVolumeAssignLevelCallback; +EVT_ACX_VOLUME_RETRIEVE_LEVEL CodecC_EvtVolumeRetrieveLevelCallback; +EVT_ACX_VOLUME_ASSIGN_LEVEL CodecC_EvtBoostAssignLevelCallback; +EVT_ACX_VOLUME_RETRIEVE_LEVEL CodecC_EvtBoostRetrieveLevelCallback; +EVT_ACX_STREAM_GET_CAPTURE_PACKET CodecC_EvtStreamGetCapturePacket; +EVT_ACX_PIN_SET_DATAFORMAT CodecC_EvtAcxPinSetDataFormat; +EVT_ACX_PIN_RETRIEVE_NAME CodecC_EvtAcxPinRetrieveName; +EVT_WDF_DEVICE_CONTEXT_CLEANUP CodecC_EvtPinContextCleanup; +EVT_ACX_KEYWORDSPOTTER_RETRIEVE_ARM CodecC_EvtAcxKeywordSpotterRetrieveArm; +EVT_ACX_KEYWORDSPOTTER_ASSIGN_ARM CodecC_EvtAcxKeywordSpotterAssignArm; +EVT_ACX_KEYWORDSPOTTER_ASSIGN_PATTERNS CodecC_EvtAcxKeywordSpotterAssignPatterns; +EVT_ACX_KEYWORDSPOTTER_ASSIGN_RESET CodecC_EvtAcxKeywordSpotterAssignReset; + +PAGED_CODE_SEG +NTSTATUS +CodecC_CreateCaptureCircuit( + _In_ WDFDEVICE Device, + _In_ const GUID * ComponentGuid, + _In_ const GUID * MicCustomName, + _In_ const UNICODE_STRING * CircuitName, + _Out_ ACXCIRCUIT * Circuit +); + +///////////////////////////////////////////////////////// +// +// MicArray definitions +// + +// +// Define MicArray circuit context. +// +typedef struct _MICARRAY_CIRCUIT_CONTEXT { + ACXMUTE MuteElement; + ACXVOLUME VolumeElement; + ACXPEAKMETER PeakMeterElement; + ACXKEYWORDSPOTTER KeywordSpotter; +} MICARRAY_CIRCUIT_CONTEXT, * PMICARRAY_CIRCUIT_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(MICARRAY_CIRCUIT_CONTEXT, GetMicArrayCircuitContext) + +typedef enum { + MicArrayVolumeIndex = 0, + MicArrayMuteIndex = 1, + MicArrayPeakmeterIndex = 2, + MicArrayKWSIndex = 3, + MicArrayElementCount = 4 +} MICARRAY_ELEMENTS; + +// MicArray callbacks. + +EVT_ACX_MUTE_ASSIGN_STATE MicArray_EvtMuteAssignState; +EVT_ACX_MUTE_RETRIEVE_STATE MicArray_EvtMuteRetrieveState; +EVT_ACX_PEAKMETER_RETRIEVE_LEVEL MicArray_EvtPeakMeterRetrieveLevelCallback; +EVT_ACX_CIRCUIT_CREATE_STREAM MicArray_EvtCircuitCreateStream; +EVT_ACX_CIRCUIT_POWER_UP MicArray_EvtCircuitPowerUp; +EVT_ACX_CIRCUIT_POWER_DOWN MicArray_EvtCircuitPowerDown; +EVT_ACX_VOLUME_ASSIGN_LEVEL MicArray_EvtVolumeAssignLevelCallback; +EVT_ACX_VOLUME_RETRIEVE_LEVEL MicArray_EvtVolumeRetrieveLevelCallback; +EVT_ACX_STREAM_GET_CAPTURE_PACKET MicArray_EvtStreamGetCapturePacket; +EVT_ACX_PIN_SET_DATAFORMAT MicArray_EvtAcxPinSetDataFormat; +EVT_ACX_PIN_RETRIEVE_NAME MicArray_EvtAcxPinRetrieveName; +EVT_WDF_DEVICE_CONTEXT_CLEANUP MicArray_EvtPinContextCleanup; +EVT_ACX_KEYWORDSPOTTER_RETRIEVE_ARM MicArray_EvtAcxKeywordSpotterRetrieveArm; +EVT_ACX_KEYWORDSPOTTER_ASSIGN_ARM MicArray_EvtAcxKeywordSpotterAssignArm; +EVT_ACX_KEYWORDSPOTTER_ASSIGN_PATTERNS MicArray_EvtAcxKeywordSpotterAssignPatterns; +EVT_ACX_KEYWORDSPOTTER_ASSIGN_RESET MicArray_EvtAcxKeywordSpotterAssignReset; +EVT_ACX_PIN_CONNECTED MicArray_EvtPinConnected; +EVT_ACX_PIN_DISCONNECTED MicArray_EvtPinDisconnected; +EVT_WDF_DEVICE_CONTEXT_CLEANUP MicArray_EvtDeviceContextCleanup; +EVT_ACX_OBJECT_PROCESS_REQUEST MicArray_EvtPinProposeDataFormat2Callback; +EVT_ACX_OBJECT_PREPROCESS_REQUEST MicArray_EvtAudioCpuResourcesCallback; + +PAGED_CODE_SEG +NTSTATUS +MicArray_CreateCaptureCircuit( + _In_ WDFDEVICE Device, + _In_ GUID ComponentGuid, + _In_ GUID MicCustomName, + _In_ UNICODE_STRING CircuitName, + _Out_ ACXCIRCUIT * Circuit +); + +PAGED_CODE_SEG +NTSTATUS +MicArray_SetPowerPolicy( + _In_ WDFDEVICE Device +); + +///////////////////////////////////////////////////////// +// +// Microphone (external: headphone) definitions +// + +// +// Define MicrophoneHp circuit context. +// +typedef struct _MICROPHONEHP_CIRCUIT_CONTEXT { + ACXMUTE MuteElement; + ACXVOLUME VolumeElement; + ACXPEAKMETER PeakMeterElement; +} MICROPHONEHP_CIRCUIT_CONTEXT, * PMICROPHONEHP_CIRCUIT_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(MICROPHONEHP_CIRCUIT_CONTEXT, GetMicrophoneHpCircuitContext) + +typedef enum { + MicrophoneHpVolumeIndex = 0, + MicrophoneHpMuteIndex = 1, + MicrophoneHpPeakmeterIndex = 2, + MicrophoneHpElementCount = 3 +} MICROPHONEHP_ELEMENTS; + +// MicrophoneHp callbacks. + +EVT_ACX_MUTE_ASSIGN_STATE MicrophoneHp_EvtMuteAssignState; +EVT_ACX_MUTE_RETRIEVE_STATE MicrophoneHp_EvtMuteRetrieveState; +EVT_ACX_PEAKMETER_RETRIEVE_LEVEL MicrophoneHp_EvtPeakMeterRetrieveLevelCallback; +EVT_ACX_CIRCUIT_CREATE_STREAM MicrophoneHp_EvtCircuitCreateStream; +EVT_ACX_CIRCUIT_POWER_UP MicrophoneHp_EvtCircuitPowerUp; +EVT_ACX_CIRCUIT_POWER_DOWN MicrophoneHp_EvtCircuitPowerDown; +EVT_ACX_VOLUME_ASSIGN_LEVEL MicrophoneHp_EvtVolumeAssignLevelCallback; +EVT_ACX_VOLUME_RETRIEVE_LEVEL MicrophoneHp_EvtVolumeRetrieveLevelCallback; +EVT_ACX_STREAM_GET_CAPTURE_PACKET MicrophoneHp_EvtStreamGetCapturePacket; +EVT_ACX_PIN_SET_DATAFORMAT MicrophoneHp_EvtAcxPinSetDataFormat; +EVT_ACX_PIN_RETRIEVE_NAME MicrophoneHp_EvtAcxPinRetrieveName; +EVT_WDF_DEVICE_CONTEXT_CLEANUP MicrophoneHp_EvtPinContextCleanup; +EVT_ACX_PIN_CONNECTED MicrophoneHp_EvtPinConnected; +EVT_ACX_PIN_DISCONNECTED MicrophoneHp_EvtPinDisconnected; +EVT_ACX_OBJECT_PREPROCESS_REQUEST MicrophoneHp_EvtAudioCpuResourcesCallback; + +PAGED_CODE_SEG +NTSTATUS +MicrophoneHp_CreateCaptureCircuit( + _In_ WDFDEVICE Device, + _In_ GUID ComponentGuid, + _In_ GUID MicCustomName, + _In_ UNICODE_STRING CircuitName, + _Out_ ACXCIRCUIT * Circuit +); + +PAGED_CODE_SEG +NTSTATUS +MicrophoneHp_SetPowerPolicy( + _In_ WDFDEVICE Device +); + +///////////////////////////////////////////////////////// +// +// Speaker definitions +// + +// +// Define circuit context for Speaker and SpeakerHp. +// +typedef struct _DSP_RENDER_CIRCUIT_CONTEXT { + ACXPEAKMETER PeakMeterElement; + ACXAUDIOENGINE AudioEngineElement; + PVOID PeakMeter; +} DSP_RENDER_CIRCUIT_CONTEXT, * PDSP_RENDER_CIRCUIT_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DSP_RENDER_CIRCUIT_CONTEXT, GetSpeakerCircuitContext) + +// Speaker callbacks. + +EVT_ACX_CIRCUIT_CREATE_STREAM Speaker_EvtCircuitCreateStream; +EVT_ACX_CIRCUIT_POWER_UP Speaker_EvtCircuitPowerUp; +EVT_ACX_CIRCUIT_POWER_DOWN Speaker_EvtCircuitPowerDown; +EVT_ACX_STREAM_SET_RENDER_PACKET Speaker_EvtStreamSetRenderPacket; +EVT_ACX_STREAM_GET_CAPTURE_PACKET Speaker_EvtStreamGetLoopbackPacket; +EVT_ACX_PIN_SET_DATAFORMAT Speaker_EvtAcxPinSetDataFormat; +EVT_WDF_DEVICE_CONTEXT_CLEANUP Speaker_EvtPinContextCleanup; +EVT_ACX_PIN_CONNECTED Speaker_EvtPinConnected; +EVT_ACX_PIN_DISCONNECTED Speaker_EvtPinDisconnected; + +//Render Audio Engine callbacks. + +EVT_ACX_MUTE_ASSIGN_STATE Speaker_EvtMuteAssignState; +EVT_ACX_MUTE_RETRIEVE_STATE Speaker_EvtMuteRetrieveState; +EVT_ACX_VOLUME_RETRIEVE_LEVEL Speaker_EvtVolumeRetrieveLevel; +EVT_ACX_PEAKMETER_RETRIEVE_LEVEL Speaker_EvtPeakMeterRetrieveLevelCallback; +EVT_ACX_RAMPED_VOLUME_ASSIGN_LEVEL Speaker_EvtRampedVolumeAssignLevel; +EVT_ACX_AUDIOENGINE_RETRIEVE_BUFFER_SIZE_LIMITS Speaker_EvtAcxAudioEngineRetrieveBufferSizeLimits; +EVT_ACX_AUDIOENGINE_RETRIEVE_EFFECTS_STATE Speaker_EvtAcxAudioEngineRetrieveEffectsState; +EVT_ACX_AUDIOENGINE_ASSIGN_EFFECTS_STATE Speaker_EvtAcxAudioEngineAssignEffectsState; +EVT_ACX_AUDIOENGINE_ASSIGN_ENGINE_FORMAT Speaker_EvtAcxAudioEngineAssignEngineDeviceFormat; +EVT_ACX_AUDIOENGINE_RETRIEVE_ENGINE_FORMAT Speaker_EvtAcxAudioEngineRetrieveEngineMixFormat; +EVT_ACX_STREAMAUDIOENGINE_RETRIEVE_EFFECTS_STATE Speaker_EvtAcxStreamAudioEngineRetrieveEffectsState; +EVT_ACX_STREAMAUDIOENGINE_ASSIGN_EFFECTS_STATE Speaker_EvtAcxStreamAudioEngineAssignEffectsState; +EVT_ACX_STREAMAUDIOENGINE_RETRIEVE_PRESENTATION_POSITION Speaker_EvtAcxStreamAudioEngineRetrievePresentationPosition; +EVT_ACX_STREAMAUDIOENGINE_ASSIGN_CURRENT_WRITE_POSITION Speaker_EvtAcxStreamAudioEngineAssignCurrentWritePosition; +EVT_ACX_STREAMAUDIOENGINE_RETRIEVE_LINEAR_BUFFER_POSITION Speaker_EvtAcxStreamAudioEngineRetrieveLinearBufferPosition; +EVT_ACX_STREAMAUDIOENGINE_ASSIGN_LAST_BUFFER_POSITION Speaker_EvtAcxStreamAudioEngineAssignLastBufferPosition; +EVT_ACX_STREAMAUDIOENGINE_ASSIGN_LOOPBACK_PROTECTION Speaker_EvtAcxStreamAudioEngineAssignLoopbackProtection; + +PAGED_CODE_SEG +NTSTATUS +Speaker_SetPowerPolicy( + _In_ WDFDEVICE Device +); + +PAGED_CODE_SEG +NTSTATUS +Speaker_CreateRenderCircuit( + _In_ WDFDEVICE Device, + _In_ GUID ComponentGuid, + _In_ UNICODE_STRING CircuitName, + _In_ BOOLEAN IsHeadphones, + _Out_ ACXCIRCUIT * Circuit +); + +///////////////////////////////////////////////////////// +// +// HDMI definitions +// + +// +// Define HDMI circuit context. +// +typedef struct _DSP_HDMI_CIRCUIT_CONTEXT { + ACXVOLUME VolumeElement; + ACXMUTE MuteElement; + ACXPEAKMETER PeakmeterElement; +} DSP_HDMI_CIRCUIT_CONTEXT, * PDSP_HDMI_CIRCUIT_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DSP_HDMI_CIRCUIT_CONTEXT, GetHDMICircuitContext) + +typedef enum { + HDMIVolumeIndex = 0, + HDMIMuteIndex = 1, + HDMIPeakmeterIndex = 2, + HDMIElementCount = 3 +} HDMI_ELEMENTS; + +typedef enum { + HDMIHostPin = 0, + HDMILoopbackPin = 1, + HDMIBridgePin = 2, + HDMIPinCount = 3 +} HDMI_PIN_TYPE; + +typedef struct _HDMI_PIN_CONTEXT { + ACXTARGETCIRCUIT TargetCircuit; + ULONG TargetPinId; + HDMI_PIN_TYPE PinType; + CAPTURE_PIN_TYPE CapturePinType; +} HDMI_PIN_CONTEXT, * PHDMI_PIN_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(HDMI_PIN_CONTEXT, GetHDMIPinContext) + +typedef struct _HDMI_STREAM_CONTEXT { + HDMI_PIN_TYPE PinType; + CAPTURE_PIN_TYPE CapturePinType; +} HDMI_STREAM_CONTEXT, * PHDMI_STREAM_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(HDMI_STREAM_CONTEXT, GetHDMIStreamContext) + +// HDMI callbacks. +EVT_ACX_CIRCUIT_CREATE_STREAM HDMI_EvtCircuitCreateStream; +EVT_ACX_CIRCUIT_POWER_UP HDMI_EvtCircuitPowerUp; +EVT_ACX_CIRCUIT_POWER_DOWN HDMI_EvtCircuitPowerDown; +EVT_ACX_STREAM_SET_RENDER_PACKET HDMI_EvtStreamSetRenderPacket; +EVT_ACX_STREAM_GET_CAPTURE_PACKET HDMI_EvtStreamGetLoopbackPacket; +EVT_ACX_PIN_SET_DATAFORMAT HDMI_EvtAcxPinSetDataFormat; +EVT_WDF_DEVICE_CONTEXT_CLEANUP HDMI_EvtPinContextCleanup; +EVT_ACX_PIN_CONNECTED HDMI_EvtPinConnected; +EVT_ACX_PIN_DISCONNECTED HDMI_EvtPinDisconnected; +EVT_WDF_DEVICE_CONTEXT_CLEANUP HDMI_EvtDeviceContextCleanup; +EVT_ACX_MUTE_ASSIGN_STATE HDMI_EvtMuteAssignState; +EVT_ACX_MUTE_RETRIEVE_STATE HDMI_EvtMuteRetrieveState; +EVT_ACX_VOLUME_ASSIGN_LEVEL HDMI_EvtRampedVolumeAssignLevel; +EVT_ACX_VOLUME_RETRIEVE_LEVEL HDMI_EvtVolumeRetrieveLevel; +EVT_ACX_PEAKMETER_RETRIEVE_LEVEL HDMI_EvtPeakMeterRetrieveLevelCallback; +EVT_ACX_OBJECT_PREPROCESS_REQUEST HDMI_EvtAudioCpuResourcesCallback; + +PAGED_CODE_SEG +NTSTATUS +HDMI_SetPowerPolicy( + _In_ WDFDEVICE Device +); + +PAGED_CODE_SEG +NTSTATUS +HDMI_CreateRenderCircuit( + _In_ WDFDEVICE Device, + _In_ GUID ComponentGuid, + _In_ UNICODE_STRING CircuitName, + _Out_ ACXCIRCUIT * Circuit +); + +///////////////////////////////////////////////////////// +// +// Multi circuit codec Render (speaker) definitions +// + +// Uses the same circuit context, render pin, and render element definitions as Codec Render. + +// Render callbacks. +EVT_ACX_CIRCUIT_CREATE_STREAM RenderMC_EvtCircuitCreateStream; +EVT_ACX_CIRCUIT_POWER_UP RenderMC_EvtCircuitPowerUp; +EVT_ACX_CIRCUIT_POWER_DOWN RenderMC_EvtCircuitPowerDown; +EVT_ACX_PIN_SET_DATAFORMAT RenderMC_EvtAcxPinSetDataFormat; +EVT_WDF_DEVICE_CONTEXT_CLEANUP RenderMC_EvtPinContextCleanup; +EVT_ACX_MUTE_ASSIGN_STATE RenderMC_EvtMuteAssignState; +EVT_ACX_MUTE_RETRIEVE_STATE RenderMC_EvtMuteRetrieveState; +EVT_ACX_VOLUME_RETRIEVE_LEVEL RenderMC_EvtVolumeRetrieveLevel; +EVT_ACX_RAMPED_VOLUME_ASSIGN_LEVEL RenderMC_EvtRampedVolumeAssignLevel; + +PAGED_CODE_SEG +NTSTATUS +RenderMC_CreateRenderCircuit( + _In_ WDFDEVICE Device, + _In_ const GUID * ComponentGuid, + _In_ const UNICODE_STRING * CircuitName, + _In_ const UNICODE_STRING * Uri, + _Out_ ACXCIRCUIT * Circuit +); + +///////////////////////////////////////////////////////// +// +// Multi circuit codec Capture (microphone) definitions +// + +// Uses the same circuit context, render pin, and render element definitions as Codec Capture. + +// Capture callbacks. +EVT_ACX_CIRCUIT_CREATE_STREAM CaptureMC_EvtCircuitCreateStream; +EVT_ACX_CIRCUIT_POWER_UP CaptureMC_EvtCircuitPowerUp; +EVT_ACX_CIRCUIT_POWER_DOWN CaptureMC_EvtCircuitPowerDown; +EVT_ACX_STREAM_GET_CAPTURE_PACKET CaptureMC_EvtStreamGetCapturePacket; +EVT_ACX_PIN_SET_DATAFORMAT CaptureMC_EvtAcxPinSetDataFormat; +EVT_ACX_PIN_RETRIEVE_NAME CaptureMC_EvtAcxPinRetrieveName; +EVT_WDF_DEVICE_CONTEXT_CLEANUP CaptureMC_EvtPinContextCleanup; + +PAGED_CODE_SEG +NTSTATUS +CaptureMC_CreateCaptureCircuit( + _In_ WDFDEVICE Device, + _In_ const GUID * ComponentGuid, + _In_ const GUID * MicCustomName, + _In_ const UNICODE_STRING * CircuitName, + _In_ const UNICODE_STRING * Uri, + _Out_ ACXCIRCUIT * Circuit +); + +///////////////////////////////////////////////////////// +// +// Multi circuit dsp Render (speaker) definitions +// + +// Uses the same circuit context, render pin, and render element definitions as Codec Render. + +// Render callbacks. +EVT_ACX_CIRCUIT_COMPOSITE_CIRCUIT_INITIALIZE RenderMCDsp_EvtCircuitCompositeCircuitInitialize; +EVT_ACX_CIRCUIT_COMPOSITE_INITIALIZE RenderMCDsp_EvtCircuitCompositeInitialize; +EVT_WDF_DEVICE_CONTEXT_CLEANUP RenderMCDsp_EvtCircuitContextCleanup; +EVT_WDF_DEVICE_PREPARE_HARDWARE RenderMCDsp_EvtDevicePrepareHardware; +EVT_WDF_DEVICE_RELEASE_HARDWARE RenderMCDsp_EvtDeviceReleaseHardware; +EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT RenderMCDsp_EvtDeviceSelfManagedIoInit; +EVT_WDF_DEVICE_CONTEXT_CLEANUP RenderMCDsp_EvtDeviceContextCleanup; +EVT_ACX_CIRCUIT_CREATE_STREAM RenderMCDsp_EvtCircuitCreateStream; +EVT_ACX_CIRCUIT_POWER_UP RenderMCDsp_EvtCircuitPowerUp; +EVT_ACX_CIRCUIT_POWER_DOWN RenderMCDsp_EvtCircuitPowerDown; +EVT_ACX_STREAM_SET_RENDER_PACKET RenderMCDsp_EvtStreamSetRenderPacket; +EVT_ACX_PIN_SET_DATAFORMAT RenderMCDsp_EvtAcxPinSetDataFormat; +EVT_WDF_DEVICE_CONTEXT_CLEANUP RenderMCDsp_EvtPinContextCleanup; +EVT_ACX_PIN_CONNECTED RenderMCDsp_EvtPinConnected; +EVT_ACX_PIN_DISCONNECTED RenderMCDsp_EvtPinDisconnected; + +// Render Audio Engine +EVT_ACX_MUTE_ASSIGN_STATE DspR_EvtMuteAssignState; +EVT_ACX_MUTE_RETRIEVE_STATE DspR_EvtMuteRetrieveState; +EVT_ACX_VOLUME_RETRIEVE_LEVEL DspR_EvtVolumeRetrieveLevel; +EVT_ACX_PEAKMETER_RETRIEVE_LEVEL DspR_EvtPeakMeterRetrieveLevelCallback; +EVT_ACX_RAMPED_VOLUME_ASSIGN_LEVEL DspR_EvtRampedVolumeAssignLevel; +EVT_ACX_AUDIOENGINE_RETRIEVE_BUFFER_SIZE_LIMITS DspR_EvtAcxAudioEngineRetrieveBufferSizeLimits; +EVT_ACX_AUDIOENGINE_RETRIEVE_EFFECTS_STATE DspR_EvtAcxAudioEngineRetrieveEffectsState; +EVT_ACX_AUDIOENGINE_ASSIGN_EFFECTS_STATE DspR_EvtAcxAudioEngineAssignEffectsState; +EVT_ACX_AUDIOENGINE_RETRIEVE_ENGINE_FORMAT DspR_EvtAcxAudioEngineRetrieveEngineMixFormat; +EVT_ACX_AUDIOENGINE_ASSIGN_ENGINE_FORMAT DspR_EvtAcxAudioEngineAssignEngineDeviceFormat; +EVT_ACX_STREAMAUDIOENGINE_RETRIEVE_EFFECTS_STATE DspR_EvtAcxStreamAudioEngineRetrieveEffectsState; +EVT_ACX_STREAMAUDIOENGINE_ASSIGN_EFFECTS_STATE DspR_EvtAcxStreamAudioEngineAssignEffectsState; +EVT_ACX_STREAMAUDIOENGINE_RETRIEVE_PRESENTATION_POSITION DspR_EvtAcxStreamAudioEngineRetrievePresentationPosition; +EVT_ACX_STREAMAUDIOENGINE_ASSIGN_CURRENT_WRITE_POSITION DspR_EvtAcxStreamAudioEngineAssignCurrentWritePosition; +EVT_ACX_STREAMAUDIOENGINE_RETRIEVE_LINEAR_BUFFER_POSITION DspR_EvtAcxStreamAudioEngineRetrieveLinearBufferPosition; +EVT_ACX_STREAMAUDIOENGINE_ASSIGN_LAST_BUFFER_POSITION DspR_EvtAcxStreamAudioEngineAssignLastBufferPosition; +EVT_ACX_STREAMAUDIOENGINE_ASSIGN_LOOPBACK_PROTECTION DspR_EvtAcxStreamAudioEngineAssignLoopbackProtection; + +PAGED_CODE_SEG +NTSTATUS +RenderMCDsp_SetPowerPolicy( + _In_ WDFDEVICE Device +); + +PAGED_CODE_SEG +NTSTATUS CreateRenderCircuit( + _In_ PACXCIRCUIT_INIT CircuitInit, + _In_ UNICODE_STRING CircuitName, + _In_ WDFDEVICE Device, + _Out_ ACXCIRCUIT* Circuit +); + +PAGED_CODE_SEG +NTSTATUS CreateRenderMCDspPin( + _In_ ACX_PIN_TYPE PinType, + _In_ ACXCIRCUIT Circuit, + _In_ ACX_PIN_COMMUNICATION Communication, + _In_ const GUID* Category, + _In_ ACX_PIN_CALLBACKS* PinCallbacks, + _In_ bool Mic, + _Out_ ACXPIN* Pin +); + +PAGED_CODE_SEG +NTSTATUS CreateAudioEngine( + _In_ ACXCIRCUIT Circuit, + _In_reads_(PinCount) ACXPIN* Pins, + _In_ ULONG PinCount, + _Out_ ACXAUDIOENGINE* AudioEngineElement +); + +///////////////////////////////////////////////////////// +// +// Multi circuit dsp Capture (microphone) definitions +// + +// Uses the same circuit context, capture pin and capture element definitions as Codec Capture. + +// Capture callbacks. +EVT_ACX_CIRCUIT_COMPOSITE_CIRCUIT_INITIALIZE CaptureMCDsp_EvtCircuitCompositeCircuitInitialize; +EVT_ACX_CIRCUIT_COMPOSITE_INITIALIZE CaptureMCDsp_EvtCircuitCompositeInitialize; +EVT_WDF_DEVICE_PREPARE_HARDWARE CaptureMCDsp_EvtDevicePrepareHardware; +EVT_WDF_DEVICE_RELEASE_HARDWARE CaptureMCDsp_EvtDeviceReleaseHardware; +EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT CaptureMCDsp_EvtDeviceSelfManagedIoInit; +EVT_WDF_DEVICE_CONTEXT_CLEANUP CaptureMCDsp_EvtDeviceContextCleanup; +EVT_ACX_CIRCUIT_CREATE_STREAM CaptureMCDsp_EvtCircuitCreateStream; +EVT_ACX_CIRCUIT_POWER_UP CaptureMCDsp_EvtCircuitPowerUp; +EVT_ACX_CIRCUIT_POWER_DOWN CaptureMCDsp_EvtCircuitPowerDown; +EVT_ACX_STREAM_GET_CAPTURE_PACKET CaptureMCDsp_EvtStreamGetCapturePacket; +EVT_ACX_PIN_SET_DATAFORMAT CaptureMCDsp_EvtAcxPinSetDataFormat; +EVT_WDF_DEVICE_CONTEXT_CLEANUP CaptureMCDsp_EvtPinContextCleanup; +EVT_ACX_PIN_CONNECTED CaptureMCDsp_EvtPinConnected; +EVT_ACX_PIN_DISCONNECTED CaptureMCDsp_EvtPinDisconnected; + +PAGED_CODE_SEG +NTSTATUS +CaptureMCDsp_SetPowerPolicy( + _In_ WDFDEVICE Device +); + +PAGED_CODE_SEG +NTSTATUS CreateCaptureCircuit( + _In_ PACXCIRCUIT_INIT CircuitInit, + _In_ UNICODE_STRING CircuitName, + _In_ WDFDEVICE Device, + _Out_ ACXCIRCUIT* Circuit +); + +PAGED_CODE_SEG +NTSTATUS CreateCaptureMCDspPin( + _In_ ACX_PIN_TYPE PinType, + _In_ ACXCIRCUIT Circuit, + _In_ ACX_PIN_COMMUNICATION Communication, + _In_ const GUID* Category, + _In_ ACX_PIN_CALLBACKS* PinCallbacks, + _In_ bool Mic, + _Out_ ACXPIN* Pin +); + +/* make internal prototypes usable from C++ */ +#ifdef __cplusplus +} +#endif + + + +#endif // _PRIVATE_H_ diff --git a/audio/Acx/Samples/Common/RenderCircuit.cpp b/audio/Acx/Samples/Common/RenderCircuit.cpp new file mode 100644 index 00000000..2f5abd13 --- /dev/null +++ b/audio/Acx/Samples/Common/RenderCircuit.cpp @@ -0,0 +1,807 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + RenderCircuit.cpp + +Abstract: + + Render Circuit. This file contains routines to create and handle + render circuit with no offload. + +Environment: + + Kernel mode + +--*/ + +#include "private.h" +#include "public.h" +#include +#include +#include +#include "AudioFormats.h" +#include "streamengine.h" +#include "cpp_utils.h" +#include "circuithelper.h" + +#ifndef __INTELLISENSE__ +#include "renderCircuit.tmh" +#endif + +PAGED_CODE_SEG +NTSTATUS +CodecR_EvtAcxPinSetDataFormat( + _In_ ACXPIN Pin, + _In_ ACXDATAFORMAT DataFormat +) +/*++ + +Routine Description: + + This ACX pin callback sets the device/mixed format. + +Return Value: + + NTSTATUS + +--*/ +{ + UNREFERENCED_PARAMETER(Pin); + UNREFERENCED_PARAMETER(DataFormat); + + PAGED_CODE(); + + // NOTE: update device/mixed format here. + + return STATUS_NOT_SUPPORTED; +} + +/////////////////////////////////////////////////////////// +// +// For more information on mute element see: https://docs.microsoft.com/en-us/windows-hardware/drivers/audio/ksnodetype-mute +// +_Use_decl_annotations_ +NTSTATUS +NTAPI +CodecR_EvtMuteAssignState( + _In_ ACXMUTE Mute, + _In_ ULONG Channel, + _In_ ULONG State +) +{ + PMUTE_ELEMENT_CONTEXT muteCtx; + ULONG i; + + PAGED_CODE(); + + muteCtx = GetMuteElementContext(Mute); + ASSERT(muteCtx); + + // + // Use first channel for all channels setting. + // + if (Channel != ALL_CHANNELS_ID) + { + muteCtx->MuteState[Channel] = State; + } + else + { + for (i = 0; i < MAX_CHANNELS; ++i) + { + muteCtx->MuteState[i] = State; + } + } + + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +NTSTATUS +NTAPI +CodecR_EvtMuteRetrieveState( + _In_ ACXMUTE Mute, + _In_ ULONG Channel, + _Out_ ULONG * State +) +{ + PMUTE_ELEMENT_CONTEXT muteCtx; + + PAGED_CODE(); + + muteCtx = GetMuteElementContext(Mute); + ASSERT(muteCtx); + + // + // Use first channel for all channels setting. + // + if (Channel != ALL_CHANNELS_ID) + { + *State = muteCtx->MuteState[Channel]; + } + else + { + *State = muteCtx->MuteState[0]; + } + + return STATUS_SUCCESS; +} + +/////////////////////////////////////////////////////////// +// +// For more information on volume element see: https://docs.microsoft.com/en-us/windows-hardware/drivers/audio/ksnodetype-volume +// +_Use_decl_annotations_ +NTSTATUS +NTAPI +CodecR_EvtRampedVolumeAssignLevel( + _In_ ACXVOLUME Volume, + _In_ ULONG Channel, + _In_ LONG VolumeLevel, + _In_ ACX_VOLUME_CURVE_TYPE CurveType, + _In_ ULONGLONG CurveDuration +) +{ + PVOLUME_ELEMENT_CONTEXT volumeCtx; + ULONG i; + + PAGED_CODE(); + + UNREFERENCED_PARAMETER(CurveType); + UNREFERENCED_PARAMETER(CurveDuration); + + volumeCtx = GetVolumeElementContext(Volume); + ASSERT(volumeCtx); + + if (Channel != ALL_CHANNELS_ID) + { + volumeCtx->VolumeLevel[Channel] = VolumeLevel; + } + else + { + for (i = 0; i < MAX_CHANNELS; ++i) + { + volumeCtx->VolumeLevel[i] = VolumeLevel; + } + } + + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +NTSTATUS +NTAPI +CodecR_EvtVolumeRetrieveLevel( + _In_ ACXVOLUME Volume, + _In_ ULONG Channel, + _Out_ LONG * VolumeLevel +) +{ + PVOLUME_ELEMENT_CONTEXT volumeCtx; + + PAGED_CODE(); + + volumeCtx = GetVolumeElementContext(Volume); + ASSERT(volumeCtx); + + if (Channel != ALL_CHANNELS_ID) + { + *VolumeLevel = volumeCtx->VolumeLevel[Channel]; + } + else + { + *VolumeLevel = volumeCtx->VolumeLevel[0]; + } + + return STATUS_SUCCESS; +} + +VOID +CodecR_EvtPinContextCleanup( + _In_ WDFOBJECT WdfPin +) +/*++ + +Routine Description: + + In this callback, it cleans up pin context. + +Arguments: + + WdfDevice - WDF device object + +Return Value: + + nullptr + +--*/ +{ + + UNREFERENCED_PARAMETER(WdfPin); +} + +PAGED_CODE_SEG +NTSTATUS +CodecR_AddStaticRender( + _In_ WDFDEVICE Device, + _In_ const GUID * ComponentGuid, + _In_ const UNICODE_STRING * CircuitName +) +/*++ + +Routine Description: + + Creates the static render circuit (pictured below) and + adds it to the device context. This is called when a + new device is detected and the AddDevice call is made + by the pnp manager. + + *************************************************************************** + * Render Circuit * + * * + * +--------------------------------------------+ * + * | | * + * | +-------------+ +-------------+ | * + * Host ------>| | Volume Node | | Mute Node | |---> Bridge * + * Pin | +-------------+ +-------------+ | Pin * + * | | * + * +--------------------------------------------+ * + * * + *************************************************************************** + +Return Value: + + NTSTATUS + +--*/ +{ + NTSTATUS status = STATUS_SUCCESS; + PCODEC_DEVICE_CONTEXT devCtx; + PRENDER_DEVICE_CONTEXT renderDevCtx; + ACXCIRCUIT renderCircuit = nullptr; + WDF_OBJECT_ATTRIBUTES attributes; + + PAGED_CODE(); + + devCtx = GetCodecDeviceContext(Device); + ASSERT(devCtx != nullptr); + + // + // Alloc audio context to current device. + // + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, RENDER_DEVICE_CONTEXT); + RETURN_NTSTATUS_IF_FAILED(WdfObjectAllocateContext(Device, &attributes, (PVOID*)&renderDevCtx)); + ASSERT(renderDevCtx); + + // + // Create a render circuit associated with this child device. + // + RETURN_NTSTATUS_IF_FAILED(CodecR_CreateRenderCircuit(Device, ComponentGuid, CircuitName, &renderCircuit)); + + devCtx->Render = renderCircuit; + + return status; +} + +PAGED_CODE_SEG +NTSTATUS +Render_AllocateSupportedFormats( + _In_ WDFDEVICE Device, + _In_reads_bytes_(CodecRenderPinCount) ACXPIN Pin[], + _In_ ACXCIRCUIT Circuit, + _In_ size_t CodecRenderPinCount +) +{ + UNREFERENCED_PARAMETER(CodecRenderPinCount); + + NTSTATUS status = STATUS_SUCCESS; + ACXDATAFORMAT formatPcm44100c2; + ACXDATAFORMAT formatPcm48000c2; + ACXDATAFORMATLIST formatList; + + WDF_OBJECT_ATTRIBUTES attributes; + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + + /////////////////////////////////////////////////////////// + // + // Allocate the formats this circuit supports. + // + + RETURN_NTSTATUS_IF_FAILED(AllocateFormat(Pcm44100c2, Circuit, Device, &formatPcm44100c2)); + RETURN_NTSTATUS_IF_FAILED(AllocateFormat(Pcm48000c2, Circuit, Device, &formatPcm48000c2)); + + /////////////////////////////////////////////////////////// + // + // Define supported formats for the host pin. + // + + // + // The raw processing mode list is associated with each single circuit + // by ACX. The driver uses this DDI to retrieve the built-in raw + // data-format list. + // + RETURN_NTSTATUS_IF_TRUE(CodecRenderHostPin >= CodecRenderPinCount, STATUS_INVALID_PARAMETER); + formatList = AcxPinGetRawDataFormatList(Pin[CodecRenderHostPin]); + RETURN_NTSTATUS_IF_TRUE(formatList == nullptr, STATUS_INSUFFICIENT_RESOURCES); + + // + // The driver uses this DDI to add data formats to the raw + // processing mode list associated with the current circuit. + // + RETURN_NTSTATUS_IF_FAILED(AcxDataFormatListAddDataFormat(formatList, formatPcm44100c2)); + RETURN_NTSTATUS_IF_FAILED(AcxDataFormatListAddDataFormat(formatList, formatPcm48000c2)); + + return status; +} + +PAGED_CODE_SEG +NTSTATUS +CodecR_CreateRenderCircuit( + _In_ WDFDEVICE Device, + _In_ const GUID * ComponentGuid, + _In_ const UNICODE_STRING * CircuitName, + _Out_ ACXCIRCUIT* Circuit +) +/*++ + +Routine Description: + + This routine builds the CODEC render circuit. + +Return Value: + + NT status value + +--*/ +{ + NTSTATUS status = STATUS_SUCCESS; + WDF_OBJECT_ATTRIBUTES attributes; + ACXCIRCUIT circuit; + CODEC_RENDER_CIRCUIT_CONTEXT* circuitCtx; + ACXPIN pin[CodecRenderPinCount]; + + PAGED_CODE(); + + // + // Init output value. + // + *Circuit = nullptr; + + /////////////////////////////////////////////////////////// + // + // Create a circuit. + // + { + PACXCIRCUIT_INIT circuitInit = nullptr; + ACX_CIRCUIT_PNPPOWER_CALLBACKS powerCallbacks; + + // + // The driver uses this DDI to allocate an ACXCIRCUIT_INIT + // structure. This opaque structure is used when creating + // a standalone audio circuit representing an audio device. + // + circuitInit = AcxCircuitInitAllocate(Device); + + // + // The driver uses this DDI to free the allocated + // ACXCIRCUIT_INIT structure when an error is detected. + // Normally the structures is deleted/cleared by ACX when + // an ACX circuit is created successfully. + // + auto circuitInitScope = scope_exit([&circuitInit]() { + if (circuitInit) { + AcxCircuitInitFree(circuitInit); + } + }); + + // + // The driver uses this DDI to specify the Component ID + // of the ACX circuit. This ID is a guid that uniquely + // identifies the circuit instance (vendor specific). + // + AcxCircuitInitSetComponentId(circuitInit, ComponentGuid); + + // + // The driver uses this DDI to specify the circuit name. + // For standalone circuits, this is the audio device name + // which is used by clients to open handles to the audio devices. + // + (VOID)AcxCircuitInitAssignName(circuitInit, CircuitName); + + // + // The driver uses this DDI to specify the circuit type. The + // circuit type can be AcxCircuitTypeRender, AcxCircuitTypeCapture, + // AcxCircuitTypeOther, or AcxCircuitTypeMaximum (for validation). + // + AcxCircuitInitSetCircuitType(circuitInit, AcxCircuitTypeRender); + + // + // The driver uses this DDI to assign its (if any) power callbacks. + // + ACX_CIRCUIT_PNPPOWER_CALLBACKS_INIT(&powerCallbacks); + powerCallbacks.EvtAcxCircuitPowerUp = CodecR_EvtCircuitPowerUp; + powerCallbacks.EvtAcxCircuitPowerDown = CodecR_EvtCircuitPowerDown; + AcxCircuitInitSetAcxCircuitPnpPowerCallbacks(circuitInit, &powerCallbacks); + + // + // The driver uses this DDI to register for a stream-create callback. + // + RETURN_NTSTATUS_IF_FAILED(AcxCircuitInitAssignAcxCreateStreamCallback(circuitInit, CodecR_EvtCircuitCreateStream)); + + // + // The driver uses this DDI to create a new ACX circuit. + // + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, CODEC_RENDER_CIRCUIT_CONTEXT); + RETURN_NTSTATUS_IF_FAILED(AcxCircuitCreate(Device, &attributes, &circuitInit, &circuit)); + + circuitInitScope.release(); + + circuitCtx = GetRenderCircuitContext(circuit); + ASSERT(circuitCtx); + } + + // + // Post circuit creation initialization. + // + + /////////////////////////////////////////////////////////// + // + // Create mute and volume elements. + // + { + ACXELEMENT elements[RenderElementCount] = { 0 }; + + // + // The driver uses this DDI to assign its volume element callbacks. + // + ACX_VOLUME_CALLBACKS volumeCallbacks; + ACX_VOLUME_CALLBACKS_INIT(&volumeCallbacks); + volumeCallbacks.EvtAcxRampedVolumeAssignLevel = CodecR_EvtRampedVolumeAssignLevel; + volumeCallbacks.EvtAcxVolumeRetrieveLevel = CodecR_EvtVolumeRetrieveLevel; + + // + // Create Volume element + // + ACX_VOLUME_CONFIG volumeCfg; + ACX_VOLUME_CONFIG_INIT(&volumeCfg); + volumeCfg.ChannelsCount = MAX_CHANNELS; + volumeCfg.Minimum = VOLUME_LEVEL_MINIMUM; + volumeCfg.Maximum = VOLUME_LEVEL_MAXIMUM; + volumeCfg.SteppingDelta = VOLUME_STEPPING; + volumeCfg.Name = &KSAUDFNAME_VOLUME_CONTROL; + volumeCfg.Callbacks = &volumeCallbacks; + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, VOLUME_ELEMENT_CONTEXT); + attributes.ParentObject = circuit; + + RETURN_NTSTATUS_IF_FAILED(AcxVolumeCreate(circuit, &attributes, &volumeCfg, (ACXVOLUME*)&elements[RenderVolumeIndex])); + + // + // The driver uses this DDI to assign its mute element callbacks. + // + ACX_MUTE_CALLBACKS muteCallbacks; + ACX_MUTE_CALLBACKS_INIT(&muteCallbacks); + muteCallbacks.EvtAcxMuteAssignState = CodecR_EvtMuteAssignState; + muteCallbacks.EvtAcxMuteRetrieveState = CodecR_EvtMuteRetrieveState; + + // + // Create Mute element + // + ACX_MUTE_CONFIG muteCfg; + ACX_MUTE_CONFIG_INIT(&muteCfg); + muteCfg.ChannelsCount = MAX_CHANNELS; + muteCfg.Name = &KSAUDFNAME_WAVE_MUTE; + muteCfg.Callbacks = &muteCallbacks; + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, MUTE_ELEMENT_CONTEXT); + attributes.ParentObject = circuit; + + RETURN_NTSTATUS_IF_FAILED(AcxMuteCreate(circuit, &attributes, &muteCfg, (ACXMUTE*)&elements[RenderMuteIndex])); + + // + // Saving the volume and mute elements in the circuit context. + // + circuitCtx->VolumeElement = (ACXVOLUME)elements[RenderVolumeIndex]; + circuitCtx->MuteElement = (ACXMUTE)elements[RenderMuteIndex]; + + // + // The driver uses this DDI post circuit creation to add ACXELEMENTs. + // + RETURN_NTSTATUS_IF_FAILED(AcxCircuitAddElements(circuit, elements, SIZEOF_ARRAY(elements))); + } + + /////////////////////////////////////////////////////////// + // + // Create the pins for the circuit. + // + { + ACX_PIN_CONFIG pinCfg; + CODEC_PIN_CONTEXT* pinCtx; + ACX_PIN_CALLBACKS pinCallbacks; + + /////////////////////////////////////////////////////////// + // + // Create Render Pin. + // + + ACX_PIN_CALLBACKS_INIT(&pinCallbacks); + pinCallbacks.EvtAcxPinSetDataFormat = CodecR_EvtAcxPinSetDataFormat; + + ACX_PIN_CONFIG_INIT(&pinCfg); + pinCfg.Type = AcxPinTypeSink; + pinCfg.Communication = AcxPinCommunicationSink; + pinCfg.Category = &KSCATEGORY_AUDIO; + pinCfg.PinCallbacks = &pinCallbacks; + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, CODEC_PIN_CONTEXT); + attributes.EvtCleanupCallback = CodecR_EvtPinContextCleanup; + attributes.ParentObject = circuit; + + // + // The driver uses this DDI to create one or more pins on the circuits. + // + RETURN_NTSTATUS_IF_FAILED(AcxPinCreate(circuit, &attributes, &pinCfg, &pin[CodecRenderHostPin])); + + ASSERT(pin[CodecRenderHostPin] != nullptr); + pinCtx = GetCodecPinContext(pin[CodecRenderHostPin]); + ASSERT(pinCtx); + pinCtx->CodecPinType = CodecPinTypeHost; + + /////////////////////////////////////////////////////////// + // + // Create Device Bridge Pin. + // + + ACX_PIN_CONFIG_INIT(&pinCfg); + pinCfg.Type = AcxPinTypeSource; + pinCfg.Communication = AcxPinCommunicationNone; + pinCfg.Category = &KSNODETYPE_SPEAKER; + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, CODEC_PIN_CONTEXT); + attributes.EvtCleanupCallback = CodecR_EvtPinContextCleanup; + attributes.ParentObject = circuit; + + // + // The driver uses this DDI to create one or more pins on the circuits. + // + RETURN_NTSTATUS_IF_FAILED(AcxPinCreate(circuit, &attributes, &pinCfg, &pin[CodecRenderBridgePin])); + + ASSERT(pin[CodecRenderBridgePin] != nullptr); + pinCtx = GetCodecPinContext(pin[CodecRenderBridgePin]); + ASSERT(pinCtx); + pinCtx->CodecPinType = CodecPinTypeDevice; + } + + /////////////////////////////////////////////////////////// + // + // Add audio jack to bridge pin. + // For more information on audio jack see: https://docs.microsoft.com/en-us/windows/win32/api/devicetopology/ns-devicetopology-ksjack_description + // + { + ACX_JACK_CONFIG jackCfg; + ACXJACK jack; + PJACK_CONTEXT jackCtx; + + ACX_JACK_CONFIG_INIT(&jackCfg); + jackCfg.Description.ChannelMapping = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; + jackCfg.Description.Color = RGB(0, 0, 0); + jackCfg.Description.ConnectionType = AcxConnTypeAtapiInternal; + jackCfg.Description.GeoLocation = AcxGeoLocFront; + jackCfg.Description.GenLocation = AcxGenLocPrimaryBox; + jackCfg.Description.PortConnection = AcxPortConnIntegratedDevice; + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, JACK_CONTEXT); + attributes.ParentObject = pin[CodecRenderBridgePin]; + + RETURN_NTSTATUS_IF_FAILED(AcxJackCreate(pin[CodecRenderBridgePin], &attributes, &jackCfg, &jack)); + + ASSERT(jack != nullptr); + + jackCtx = GetJackContext(jack); + ASSERT(jackCtx); + jackCtx->Dummy = 0; + + RETURN_NTSTATUS_IF_FAILED(AcxPinAddJacks(pin[CodecRenderBridgePin], &jack, 1)); + } + + RETURN_NTSTATUS_IF_FAILED(Render_AllocateSupportedFormats(Device, pin, circuit, CodecRenderPinCount)); + + /////////////////////////////////////////////////////////// + // + // The driver uses this DDI post circuit creation to add ACXPINs. + // + RETURN_NTSTATUS_IF_FAILED(AcxCircuitAddPins(circuit, pin, CodecRenderPinCount)); + + // + // Set output value. + // + *Circuit = circuit; + + // + // Done. + // + status = STATUS_SUCCESS; + + return status; +} + +_Use_decl_annotations_ +NTSTATUS +CodecR_EvtCircuitPowerUp( + _In_ WDFDEVICE Device, + _In_ ACXCIRCUIT Circuit, + _In_ WDF_POWER_DEVICE_STATE PreviousState +) +{ + UNREFERENCED_PARAMETER(Device); + UNREFERENCED_PARAMETER(Circuit); + UNREFERENCED_PARAMETER(PreviousState); + + PAGED_CODE(); + + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +NTSTATUS +CodecR_EvtCircuitPowerDown( + _In_ WDFDEVICE Device, + _In_ ACXCIRCUIT Circuit, + _In_ WDF_POWER_DEVICE_STATE TargetState +) +{ + UNREFERENCED_PARAMETER(Device); + UNREFERENCED_PARAMETER(Circuit); + UNREFERENCED_PARAMETER(TargetState); + + PAGED_CODE(); + + return STATUS_SUCCESS; +} + +PAGED_CODE_SEG +NTSTATUS +CodecR_EvtCircuitCreateStream( + _In_ WDFDEVICE Device, + _In_ ACXCIRCUIT Circuit, + _In_ ACXPIN Pin, + _In_ PACXSTREAM_INIT StreamInit, + _In_ ACXDATAFORMAT StreamFormat, + _In_ const GUID* SignalProcessingMode, + _In_ ACXOBJECTBAG VarArguments +) +/*++ + +Routine Description: + + This routine creates a stream for the specified circuit. + +Return Value: + + NT status value + +--*/ +{ + NTSTATUS status; + PRENDER_DEVICE_CONTEXT devCtx; + WDF_OBJECT_ATTRIBUTES attributes; + ACXSTREAM stream; + STREAMENGINE_CONTEXT * streamCtx; + ACX_STREAM_CALLBACKS streamCallbacks; + ACX_RT_STREAM_CALLBACKS rtCallbacks; + CRenderStreamEngine* renderStreamEngine = nullptr; + CODEC_PIN_TYPE codecPinType; + PCODEC_PIN_CONTEXT pinCtx; + ACX_PIN_TYPE pinType; + CODEC_RENDER_CIRCUIT_CONTEXT* circuitCtx; + + auto streamEngineScope = scope_exit([&renderStreamEngine]() { + + delete renderStreamEngine; + + }); + + PAGED_CODE(); + UNREFERENCED_PARAMETER(SignalProcessingMode); + UNREFERENCED_PARAMETER(VarArguments); + + ASSERT(IsEqualGUID(*SignalProcessingMode, AUDIO_SIGNALPROCESSINGMODE_RAW)); + + ASSERT(Circuit != nullptr); + circuitCtx = GetRenderCircuitContext(Circuit); + ASSERT(circuitCtx); + + devCtx = GetRenderDeviceContext(Device); + ASSERT(devCtx != nullptr); + UNREFERENCED_PARAMETER(devCtx); + + pinCtx = GetCodecPinContext(Pin); + codecPinType = pinCtx->CodecPinType; + + pinType = AcxPinGetType(Pin); + + // + // Init streaming callbacks. + // + ACX_STREAM_CALLBACKS_INIT(&streamCallbacks); + streamCallbacks.EvtAcxStreamPrepareHardware = EvtStreamPrepareHardware; + streamCallbacks.EvtAcxStreamReleaseHardware = EvtStreamReleaseHardware; + streamCallbacks.EvtAcxStreamRun = EvtStreamRun; + streamCallbacks.EvtAcxStreamPause = EvtStreamPause; + + RETURN_NTSTATUS_IF_FAILED(AcxStreamInitAssignAcxStreamCallbacks(StreamInit, &streamCallbacks)); + + // + // Init RT streaming callbacks. + // + ACX_RT_STREAM_CALLBACKS_INIT(&rtCallbacks); + rtCallbacks.EvtAcxStreamGetHwLatency = EvtStreamGetHwLatency; + rtCallbacks.EvtAcxStreamAllocateRtPackets = EvtStreamAllocateRtPackets; + rtCallbacks.EvtAcxStreamFreeRtPackets = EvtStreamFreeRtPackets; + rtCallbacks.EvtAcxStreamSetRenderPacket = CodecR_EvtStreamSetRenderPacket; + rtCallbacks.EvtAcxStreamGetCurrentPacket = EvtStreamGetCurrentPacket; + rtCallbacks.EvtAcxStreamGetPresentationPosition = EvtStreamGetPresentationPosition; + + RETURN_NTSTATUS_IF_FAILED(AcxStreamInitAssignAcxRtStreamCallbacks(StreamInit, &rtCallbacks)); + + // + // Buffer notifications are supported. + // + AcxStreamInitSetAcxRtStreamSupportsNotifications(StreamInit); + + // + // Create the stream. + // + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, STREAMENGINE_CONTEXT); + attributes.EvtDestroyCallback = EvtStreamDestroy; + RETURN_NTSTATUS_IF_FAILED(AcxRtStreamCreate(Device, Circuit, &attributes, &StreamInit, &stream)); + + // + // Create the virtual streaming engine which will control + // streaming logic for the render circuit. + // + renderStreamEngine = new (POOL_FLAG_NON_PAGED, DeviceDriverTag) CRenderStreamEngine(stream, StreamFormat, FALSE, NULL); + RETURN_NTSTATUS_IF_TRUE(renderStreamEngine == nullptr, STATUS_INSUFFICIENT_RESOURCES); + + streamCtx = GetStreamEngineContext(stream); + ASSERT(streamCtx); + streamCtx->StreamEngine = (PVOID)renderStreamEngine; + + renderStreamEngine = nullptr; + + // + // Done. + // + status = STATUS_SUCCESS; + + return status; +} + +PAGED_CODE_SEG +NTSTATUS +CodecR_EvtStreamSetRenderPacket( + _In_ ACXSTREAM Stream, + _In_ ULONG Packet, + _In_ ULONG Flags, + _In_ ULONG EosPacketLength +) +{ + PSTREAMENGINE_CONTEXT ctx; + CRenderStreamEngine* streamEngine = nullptr; + + PAGED_CODE(); + + ctx = GetStreamEngineContext(Stream); + + streamEngine = static_cast(ctx->StreamEngine); + + return streamEngine->SetRenderPacket(Packet, Flags, EosPacketLength); +} + diff --git a/audio/Acx/Samples/Common/SamplesCommon.vcxproj b/audio/Acx/Samples/Common/SamplesCommon.vcxproj new file mode 100644 index 00000000..85e164d7 --- /dev/null +++ b/audio/Acx/Samples/Common/SamplesCommon.vcxproj @@ -0,0 +1,304 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + + + + {6A946D59-6690-4ED0-A77D-7D4C3D4B3241} + {497e31cb-056b-4f31-abb8-447fd55ee5a5} + v4.5 + 12.0 + Debug + Win32 + SamplesCommon + $(LatestTargetPlatformVersion) + + + + Windows10 + true + WindowsKernelModeDriver10.0 + StaticLibrary + KMDF + Windows Driver + 1 + 31 + + + Windows10 + false + WindowsKernelModeDriver10.0 + StaticLibrary + KMDF + Windows Driver + 1 + 31 + + + Windows10 + true + WindowsKernelModeDriver10.0 + StaticLibrary + KMDF + Windows Driver + 1 + 31 + + + Windows10 + false + WindowsKernelModeDriver10.0 + StaticLibrary + KMDF + Windows Driver + 1 + 31 + + + Windows10 + true + WindowsKernelModeDriver10.0 + StaticLibrary + KMDF + Windows Driver + 1 + 31 + + + Windows10 + false + WindowsKernelModeDriver10.0 + StaticLibrary + KMDF + Windows Driver + 1 + 31 + + + Windows10 + true + WindowsKernelModeDriver10.0 + StaticLibrary + KMDF + Windows Driver + 1 + 31 + + + Windows10 + false + WindowsKernelModeDriver10.0 + StaticLibrary + KMDF + Windows Driver + 1 + 31 + + + + + + + + + + + DbgengKernelDebugger + $(IntDir) + + + DbgengKernelDebugger + $(IntDir) + + + DbgengKernelDebugger + $(IntDir) + + + DbgengKernelDebugger + $(IntDir) + + + DbgengKernelDebugger + $(IntDir) + + + DbgengKernelDebugger + $(IntDir) + + + DbgengKernelDebugger + $(IntDir) + + + DbgengKernelDebugger + $(IntDir) + + + + true + true + trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\1.1;..\inc;..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + + + true + true + trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\1.1;..\inc;..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + + + true + true + trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\1.1;..\inc;..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + + + true + true + trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\1.1;..\inc;..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + + + true + true + trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\1.1;..\inc;..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + + + true + true + trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\1.1;..\inc;..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + + + true + true + trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\1.1;..\inc;..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + + + true + true + trace_macros.h + true + $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\1.1;..\inc;..\shared;%(AdditionalIncludeDirectories) + ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) + + + sha256 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/audio/Acx/Samples/Common/SaveData.cpp b/audio/Acx/Samples/Common/SaveData.cpp new file mode 100644 index 00000000..72e98850 --- /dev/null +++ b/audio/Acx/Samples/Common/SaveData.cpp @@ -0,0 +1,1103 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + SaveData.cpp + +Abstract: + + Implementation of data saving class for ACX driver samples. + + To save the playback data to disk, this class maintains a circular data + buffer, associated frame structures and worker items to save frames to + disk. + Each frame structure represents a portion of buffer. When that portion + of frame is full, a workitem is scheduled to save it to disk. + + + +--*/ +#pragma warning (disable : 4127) +#pragma warning (disable : 26165) + + +#include "private.h" +#include +#include +#include +#include +#include "savedata.h" +#include // This is for using RtlStringCbPrintf + +#define SAVEDATA_POOLTAG 'TDVS' +#define SAVEDATA_POOLTAG1 '1DVS' +#define SAVEDATA_POOLTAG2 '2DVS' +#define SAVEDATA_POOLTAG3 '3DVS' +#define SAVEDATA_POOLTAG4 '4DVS' +#define SAVEDATA_POOLTAG5 '5DVS' +#define SAVEDATA_POOLTAG6 '6DVS' +#define SAVEDATA_POOLTAG7 '7DVS' + +//============================================================================= +// Defines +//============================================================================= +#define RIFF_TAG 0x46464952; +#define WAVE_TAG 0x45564157; +#define FMT__TAG 0x20746D66; +#define DATA_TAG 0x61746164; + +#define DEFAULT_FRAME_COUNT 4 +#define DEFAULT_FRAME_SIZE PAGE_SIZE * 4 +#define DEFAULT_BUFFER_SIZE DEFAULT_FRAME_SIZE * DEFAULT_FRAME_COUNT + +#define DEFAULT_FILE_FOLDER1 L"\\DriverData\\Audio_Samples" +#define DEFAULT_FILE_FOLDER2 L"\\DriverData\\Audio_Samples\\AudioCodec" +#define DEFAULT_FILE_NAME L"\\DriverData\\Audio_Samples\\AudioCodec\\STREAM" +#define OFFLOAD_FILE_NAME L"OFFLOAD" +#define HOST_FILE_NAME L"HOST" + +#define MAX_WORKER_ITEM_COUNT 15 + + +PSAVEWORKER_PARAM CSaveData::m_pWorkItems = NULL; +PDEVICE_OBJECT CSaveData::m_pDeviceObject = NULL; + +//============================================================================= +// Statics +//============================================================================= +ULONG CSaveData::m_ulStreamId = 0; +ULONG CSaveData::m_ulOffloadStreamId = 0; + +//============================================================================= +// CSaveData +//============================================================================= + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +CSaveData::CSaveData() +: m_pDataBuffer(NULL), + m_FileHandle(NULL), + m_ulFrameCount(DEFAULT_FRAME_COUNT), + m_ulBufferSize(DEFAULT_BUFFER_SIZE), + m_ulFrameSize(DEFAULT_FRAME_SIZE), + m_ulBufferOffset(0), + m_ulFrameIndex(0), + m_fFrameUsed(NULL), + m_waveFormat(NULL), + m_pFilePtr(NULL), + m_fWriteDisabled(FALSE), + m_bInitialized(FALSE) +{ + PAGED_CODE(); + + m_FileHeader.dwRiff = RIFF_TAG; + m_FileHeader.dwFileSize = 0; + m_FileHeader.dwWave = WAVE_TAG; + m_FileHeader.dwFormat = FMT__TAG; + m_FileHeader.dwFormatLength = sizeof(WAVEFORMATEX); + + m_DataHeader.dwData = DATA_TAG; + m_DataHeader.dwDataLength = 0; + + RtlZeroMemory(&m_objectAttributes, sizeof(m_objectAttributes)); +} // CSaveData + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +CSaveData::~CSaveData() +{ + PAGED_CODE(); + Cleanup(); +} // CSaveData + +void +_Use_decl_annotations_ +PAGED_CODE_SEG +CSaveData::Cleanup +( + void +) +{ + PAGED_CODE(); + + // Update the wave header in data file with real file size. + // + if(m_pFilePtr) + { + // RIFF header, whose size is the whole file size minus RIFF header. + m_FileHeader.dwFileSize = + (DWORD)m_pFilePtr->QuadPart - 2 * sizeof(DWORD); + // The data length is the size of all the audio that was written. + // It gets calculated by taking: + m_DataHeader.dwDataLength = (DWORD)m_pFilePtr->QuadPart - // the whole file size, + sizeof(m_FileHeader) - // minus the file header, + m_FileHeader.dwFormatLength - // minus the format, + sizeof(m_DataHeader); // minus the data header itself. + + if (STATUS_SUCCESS == KeWaitForSingleObject + ( + &m_FileSync, + Executive, + KernelMode, + FALSE, + NULL + )) + { + if (NT_SUCCESS(FileOpen(FALSE))) + { + FileWriteHeader(); + + FileClose(); + } + + KeReleaseMutex(&m_FileSync, FALSE); + } + + m_FileHeader.dwRiff = RIFF_TAG; + m_FileHeader.dwFileSize = 0; + m_FileHeader.dwWave = WAVE_TAG; + m_FileHeader.dwFormat = FMT__TAG; + m_FileHeader.dwFormatLength = sizeof(WAVEFORMATEX); + + m_DataHeader.dwData = DATA_TAG; + m_DataHeader.dwDataLength = 0; + m_pFilePtr = NULL; + } + + if (m_waveFormat) + { + ExFreePoolWithTag(m_waveFormat, SAVEDATA_POOLTAG1); + m_waveFormat = NULL; + } + + if (m_fFrameUsed) + { + ExFreePoolWithTag(m_fFrameUsed, SAVEDATA_POOLTAG2); + m_fFrameUsed = NULL; + } + + if (m_FileName.Buffer) + { + ExFreePoolWithTag(m_FileName.Buffer, SAVEDATA_POOLTAG3); + m_FileName.Buffer = NULL; + } + + if (m_pDataBuffer) + { + ExFreePoolWithTag(m_pDataBuffer, SAVEDATA_POOLTAG4); + m_pDataBuffer = NULL; + } +} + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +void +CSaveData::DestroyWorkItems +( + void +) +{ + PAGED_CODE(); + + if (m_pWorkItems) + { + for (int i = 0; i < MAX_WORKER_ITEM_COUNT; i++) + { + if (m_pWorkItems[i].WorkItem!=NULL) + { + IoFreeWorkItem(m_pWorkItems[i].WorkItem); + m_pWorkItems[i].WorkItem = NULL; + } + } + ExFreePoolWithTag(m_pWorkItems, SAVEDATA_POOLTAG); + m_pWorkItems = NULL; + } + +} // DestroyWorkItems + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +void +CSaveData::Disable +( + _In_ BOOL fDisable +) +{ + PAGED_CODE(); + + m_fWriteDisabled = fDisable; +} // Disable + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CSaveData::FileClose(void) +{ + PAGED_CODE(); + + NTSTATUS ntStatus = STATUS_SUCCESS; + + if (m_FileHandle) + { + ntStatus = ZwClose(m_FileHandle); + m_FileHandle = NULL; + } + + return ntStatus; +} // FileClose + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CSaveData::FileOpen +( + _In_ BOOL fOverWrite +) +{ + PAGED_CODE(); + + NTSTATUS ntStatus = STATUS_SUCCESS; + IO_STATUS_BLOCK ioStatusBlock; + + if( FALSE == m_bInitialized ) + { + return STATUS_UNSUCCESSFUL; + } + + if(!m_FileHandle) + { + ntStatus = + ZwCreateFile + ( + &m_FileHandle, + GENERIC_WRITE | SYNCHRONIZE, + &m_objectAttributes, + &ioStatusBlock, + NULL, + FILE_ATTRIBUTE_NORMAL, + 0, + fOverWrite ? FILE_OVERWRITE_IF : FILE_OPEN_IF, + FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, + NULL, + 0 + ); + } + + return ntStatus; +} // FileOpen + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CSaveData::FileWrite +( + _In_reads_bytes_(ulDataSize) PBYTE pData, + _In_ ULONG ulDataSize +) +{ + PAGED_CODE(); + + ASSERT(pData); + ASSERT(m_pFilePtr); + + NTSTATUS ntStatus; + + if (m_FileHandle) + { + IO_STATUS_BLOCK ioStatusBlock; + + ntStatus = ZwWriteFile( m_FileHandle, + NULL, + NULL, + NULL, + &ioStatusBlock, + pData, + ulDataSize, + m_pFilePtr, + NULL); + + if (NT_SUCCESS(ntStatus)) + { + ASSERT(ioStatusBlock.Information == ulDataSize); + + m_pFilePtr->QuadPart += ulDataSize; + } + } + else + { + ntStatus = STATUS_INVALID_HANDLE; + } + + return ntStatus; +} // FileWrite + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CSaveData::FileWriteHeader(void) +{ + PAGED_CODE(); + + NTSTATUS ntStatus; + + if (m_FileHandle && m_waveFormat) + { + IO_STATUS_BLOCK ioStatusBlock; + + m_pFilePtr->QuadPart = 0; + + m_FileHeader.dwFormatLength = (m_waveFormat->wFormatTag == WAVE_FORMAT_PCM) ? + sizeof( PCMWAVEFORMAT ) : + sizeof( WAVEFORMATEX ) + m_waveFormat->cbSize; + + ntStatus = ZwWriteFile( m_FileHandle, + NULL, + NULL, + NULL, + &ioStatusBlock, + &m_FileHeader, + sizeof(m_FileHeader), + m_pFilePtr, + NULL); + + if (NT_SUCCESS(ntStatus)) + { + m_pFilePtr->QuadPart += sizeof(m_FileHeader); + + ntStatus = ZwWriteFile( m_FileHandle, + NULL, + NULL, + NULL, + &ioStatusBlock, + m_waveFormat, + m_FileHeader.dwFormatLength, + m_pFilePtr, + NULL); + } + + if (NT_SUCCESS(ntStatus)) + { + m_pFilePtr->QuadPart += m_FileHeader.dwFormatLength; + + ntStatus = ZwWriteFile( m_FileHandle, + NULL, + NULL, + NULL, + &ioStatusBlock, + &m_DataHeader, + sizeof(m_DataHeader), + m_pFilePtr, + NULL); + } + + if (NT_SUCCESS(ntStatus)) + { + m_pFilePtr->QuadPart += sizeof(m_DataHeader); + } + } + else + { + ntStatus = STATUS_INVALID_HANDLE; + } + + + return ntStatus; +} // FileWriteHeader + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CSaveData::SetDeviceObject +( + _In_ PDEVICE_OBJECT DeviceObject +) +{ + PAGED_CODE(); + + ASSERT(DeviceObject); + + NTSTATUS ntStatus = STATUS_SUCCESS; + + m_pDeviceObject = DeviceObject; + return ntStatus; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +PDEVICE_OBJECT +CSaveData::GetDeviceObject +( + void +) +{ + PAGED_CODE(); + + return m_pDeviceObject; +} + +//============================================================================= +_Use_decl_annotations_ +PSAVEWORKER_PARAM +CSaveData::GetNewWorkItem +( + void +) +{ + LARGE_INTEGER timeOut = { 0 }; + NTSTATUS ntStatus; + + for (int i = 0; i < MAX_WORKER_ITEM_COUNT; i++) + { + ntStatus = + KeWaitForSingleObject + ( + &m_pWorkItems[i].EventDone, + Executive, + KernelMode, + FALSE, + &timeOut + ); + if (STATUS_SUCCESS == ntStatus) + { + if (m_pWorkItems[i].WorkItem) + return &(m_pWorkItems[i]); + else + return NULL; + } + } + + return NULL; +} // GetNewWorkItem + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CSaveData::Initialize +( + _In_ BOOL _bOffloaded +) +{ + PAGED_CODE(); + + NTSTATUS ntStatus = STATUS_SUCCESS; + WCHAR szTemp[MAX_PATH]; + size_t cLen = 0; + IO_STATUS_BLOCK ioStatusBlock = {0}; + HANDLE fileHandle; + OBJECT_ATTRIBUTES objectAttributes; + UNICODE_STRING fileName; + + if (_bOffloaded) + { + m_ulOffloadStreamId++; + } + else + { + m_ulStreamId++; + } + + RtlInitUnicodeString(&fileName, DEFAULT_FILE_FOLDER1); + InitializeObjectAttributes( + &objectAttributes, + &fileName, + OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + // Create the folder. + ntStatus = ZwCreateFile( + &fileHandle, + 0, + &objectAttributes, + &ioStatusBlock, + NULL, + FILE_ATTRIBUTE_NORMAL, + 0, + FILE_OPEN_IF, + FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, + NULL, + 0); + + if (NT_SUCCESS(ntStatus)) + { + ZwClose(fileHandle); + fileHandle = NULL; + + RtlInitUnicodeString(&fileName, DEFAULT_FILE_FOLDER2); + InitializeObjectAttributes( + &objectAttributes, + &fileName, + OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + // Create the folder. + ntStatus = ZwCreateFile( + &fileHandle, + 0, + &objectAttributes, + &ioStatusBlock, + NULL, + FILE_ATTRIBUTE_NORMAL, + 0, + FILE_OPEN_IF, + FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, + NULL, + 0); + + if (NT_SUCCESS(ntStatus)) + { + ZwClose(fileHandle); + fileHandle = NULL; + } + } + + if (NT_SUCCESS(ntStatus)) + { + // Allocate data file name. + // + RtlStringCchPrintfW(szTemp, MAX_PATH, L"%s_%s_%d.wav", DEFAULT_FILE_NAME, _bOffloaded ? OFFLOAD_FILE_NAME : HOST_FILE_NAME, _bOffloaded ? m_ulOffloadStreamId : m_ulStreamId); + m_FileName.Length = 0; + ntStatus = RtlStringCchLengthW (szTemp, sizeof(szTemp)/sizeof(szTemp[0]), &cLen); + } + + if (NT_SUCCESS(ntStatus)) + { + m_FileName.MaximumLength = (USHORT)((cLen * sizeof(WCHAR)) + sizeof(WCHAR));//convert to wchar and add room for NULL + m_FileName.Buffer = (PWSTR) + ExAllocatePool2 + ( + POOL_FLAG_PAGED, + m_FileName.MaximumLength, + SAVEDATA_POOLTAG3 + ); + if (!m_FileName.Buffer) + { + ntStatus = STATUS_INSUFFICIENT_RESOURCES; + } + } + + // Allocate memory for data buffer. + // + if (NT_SUCCESS(ntStatus)) + { + RtlStringCbCopyW(m_FileName.Buffer, m_FileName.MaximumLength, szTemp); + m_FileName.Length = (USHORT)wcslen(m_FileName.Buffer) * sizeof(WCHAR); + + m_pDataBuffer = (PBYTE) + ExAllocatePool2 + ( + POOL_FLAG_NON_PAGED, + m_ulBufferSize, + SAVEDATA_POOLTAG4 + ); + if (!m_pDataBuffer) + { + ntStatus = STATUS_INSUFFICIENT_RESOURCES; + } + } + + // Allocate memory for frame usage flags and m_pFilePtr. + // + if (NT_SUCCESS(ntStatus)) + { + m_fFrameUsed = (PBOOL) + ExAllocatePool2 + ( + POOL_FLAG_NON_PAGED, + m_ulFrameCount * sizeof(BOOL) + + sizeof(LARGE_INTEGER), + SAVEDATA_POOLTAG2 + ); + if (!m_fFrameUsed) + { + ntStatus = STATUS_INSUFFICIENT_RESOURCES; + } + } + + // Initialize the spinlock to synchronize access to the frames + // + KeInitializeSpinLock ( &m_FrameInUseSpinLock ) ; + + // Initialize the file mutex + // + KeInitializeMutex( &m_FileSync, 1 ) ; + + // Open the data file. + // + if (NT_SUCCESS(ntStatus)) + { + // m_fFrameUsed has additional memory to hold m_pFilePtr + // + m_pFilePtr = (PLARGE_INTEGER) + (((PBYTE) m_fFrameUsed) + m_ulFrameCount * sizeof(BOOL)); + + // Create data file. + InitializeObjectAttributes + ( + &m_objectAttributes, + &m_FileName, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, + NULL + ); + + m_bInitialized = TRUE; + + // Write wave header information to data file. + ntStatus = KeWaitForSingleObject + ( + &m_FileSync, + Executive, + KernelMode, + FALSE, + NULL + ); + + if (STATUS_SUCCESS == ntStatus) + { + ntStatus = FileOpen(TRUE); + if (NT_SUCCESS(ntStatus)) + { + ntStatus = FileWriteHeader(); + + FileClose(); + } + + KeReleaseMutex( &m_FileSync, FALSE ); + } + } + + return ntStatus; +} // Initialize + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CSaveData::InitializeWorkItems +( + _In_ PDEVICE_OBJECT DeviceObject +) +{ + PAGED_CODE(); + + ASSERT(DeviceObject); + + NTSTATUS ntStatus = STATUS_SUCCESS; + + if (m_pWorkItems != NULL) + { + return ntStatus; + } + + m_pWorkItems = (PSAVEWORKER_PARAM) + ExAllocatePool2 + ( + POOL_FLAG_NON_PAGED, + sizeof(SAVEWORKER_PARAM) * MAX_WORKER_ITEM_COUNT, + SAVEDATA_POOLTAG + ); + if (m_pWorkItems) + { + for (int i = 0; i < MAX_WORKER_ITEM_COUNT; i++) + { + + m_pWorkItems[i].WorkItem = IoAllocateWorkItem(DeviceObject); + if(m_pWorkItems[i].WorkItem == NULL) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + KeInitializeEvent + ( + &m_pWorkItems[i].EventDone, + NotificationEvent, + TRUE + ); + } + } + else + { + ntStatus = STATUS_INSUFFICIENT_RESOURCES; + } + + return ntStatus; +} // InitializeWorkItems + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +VOID +SaveFrameWorkerCallback +( + _In_ PDEVICE_OBJECT pDeviceObject, + _In_opt_ PVOID Context +) +{ + UNREFERENCED_PARAMETER(pDeviceObject); + + PAGED_CODE(); + + ASSERT(Context); + + PSAVEWORKER_PARAM pParam = (PSAVEWORKER_PARAM) Context; + PCSaveData pSaveData; + + if (NULL == pParam) + { + // This is completely unexpected, assert here. + // + ASSERT(pParam); + return; + } + + ASSERT(pParam->pSaveData); + ASSERT(pParam->pSaveData->m_fFrameUsed); + + if (pParam->WorkItem) + { + pSaveData = pParam->pSaveData; + + if (STATUS_SUCCESS == KeWaitForSingleObject + ( + &pSaveData->m_FileSync, + Executive, + KernelMode, + FALSE, + NULL + )) + { + if (NT_SUCCESS(pSaveData->FileOpen(FALSE))) + { + pSaveData->FileWrite(pParam->pData, pParam->ulDataSize); + pSaveData->FileClose(); + } + InterlockedExchange( (LONG *)&(pSaveData->m_fFrameUsed[pParam->ulFrameNo]), FALSE ); + + KeReleaseMutex( &pSaveData->m_FileSync, FALSE ); + } + } + + KeSetEvent(&pParam->EventDone, 0, FALSE); +} // SaveFrameWorkerCallback + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CSaveData::SetDataFormat +( + _In_ PKSDATAFORMAT pDataFormat +) +{ + PAGED_CODE(); + NTSTATUS ntStatus = STATUS_SUCCESS; + + ASSERT(pDataFormat); + + PWAVEFORMATEX pwfx = NULL; + + if (IsEqualGUIDAligned(pDataFormat->Specifier, + KSDATAFORMAT_SPECIFIER_DSOUND)) + { + pwfx = + &(((PKSDATAFORMAT_DSOUND) pDataFormat)->BufferDesc.WaveFormatEx); + } + else if (IsEqualGUIDAligned(pDataFormat->Specifier, + KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)) + { + pwfx = &((PKSDATAFORMAT_WAVEFORMATEX) pDataFormat)->WaveFormatEx; + } + + if (pwfx) + { + // Free the previously allocated waveformat + if (m_waveFormat) + { + ExFreePoolWithTag(m_waveFormat, SAVEDATA_POOLTAG1); + } + + m_waveFormat = (PWAVEFORMATEX) + ExAllocatePool2 + ( + POOL_FLAG_NON_PAGED, + (pwfx->wFormatTag == WAVE_FORMAT_PCM) ? + sizeof( PCMWAVEFORMAT ) : + sizeof( WAVEFORMATEX ) + pwfx->cbSize, + SAVEDATA_POOLTAG1 + ); + + if(m_waveFormat) + { + RtlCopyMemory( m_waveFormat, + pwfx, + (pwfx->wFormatTag == WAVE_FORMAT_PCM) ? + sizeof( PCMWAVEFORMAT ) : + sizeof( WAVEFORMATEX ) + pwfx->cbSize); + } + else + { + ntStatus = STATUS_INSUFFICIENT_RESOURCES; + } + } + return ntStatus; +} // SetDataFormat + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CSaveData::SetMaxWriteSize +( + _In_ ULONG ulMaxWriteSize +) +{ + PAGED_CODE(); + + NTSTATUS ntStatus = STATUS_SUCCESS; + ULONG bufferSize = 0; + PBYTE buffer = NULL; + + // + // Compute new buffer size. + // + ntStatus = RtlULongMult(ulMaxWriteSize, DEFAULT_FRAME_COUNT, &bufferSize); + if (!NT_SUCCESS(ntStatus)) + { + ntStatus = STATUS_INSUFFICIENT_RESOURCES; + goto Done; + } + + // + // Alloc memory for buffer. + // + buffer = (PBYTE) + ExAllocatePool2 + ( + POOL_FLAG_NON_PAGED, + bufferSize, + SAVEDATA_POOLTAG4 + ); + if (!buffer) + { + ntStatus = STATUS_INSUFFICIENT_RESOURCES; + goto Done; + } + + // + // Free old one. + // + if (m_pDataBuffer) + { + ExFreePoolWithTag(m_pDataBuffer, SAVEDATA_POOLTAG4); + m_pDataBuffer = NULL; + } + + // + // Init new buffer settings. + // + m_pDataBuffer = buffer; + m_ulBufferSize = bufferSize; + m_ulFrameSize = ulMaxWriteSize; + + ntStatus = STATUS_SUCCESS; + +Done: + return ntStatus; +} // SetDataFormat + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +void +CSaveData::ReadData +( + _Inout_updates_bytes_all_(ulByteCount) PBYTE pBuffer, + _In_ ULONG ulByteCount +) +{ + UNREFERENCED_PARAMETER(pBuffer); + UNREFERENCED_PARAMETER(ulByteCount); + + PAGED_CODE(); + + // Not implemented yet. +} // ReadData + +//============================================================================= +_Use_decl_annotations_ +void +CSaveData::SaveFrame +( + _In_ ULONG ulFrameNo, + _In_ ULONG ulDataSize +) +{ + PSAVEWORKER_PARAM pParam = NULL; + + pParam = GetNewWorkItem(); + if (pParam) + { + pParam->pSaveData = this; + pParam->ulFrameNo = ulFrameNo; + pParam->ulDataSize = ulDataSize; + pParam->pData = m_pDataBuffer + ulFrameNo * m_ulFrameSize; + KeResetEvent(&pParam->EventDone); + IoQueueWorkItem(pParam->WorkItem, SaveFrameWorkerCallback, + CriticalWorkQueue, (PVOID)pParam); + } +} // SaveFrame + +//============================================================================= +void +_Use_decl_annotations_ +PAGED_CODE_SEG +CSaveData::WaitAllWorkItems +( + void +) +{ + PAGED_CODE(); + + // Save the last partially-filled frame + if (m_ulBufferOffset > m_ulFrameIndex * m_ulFrameSize) + { + ULONG size; + + size = m_ulBufferOffset - m_ulFrameIndex * m_ulFrameSize; + SaveFrame(m_ulFrameIndex, size); + } + + for (int i = 0; i < MAX_WORKER_ITEM_COUNT; i++) + { + KeWaitForSingleObject + ( + &(m_pWorkItems[i].EventDone), + Executive, + KernelMode, + FALSE, + NULL + ); + } +} // WaitAllWorkItems + +//============================================================================= +_Use_decl_annotations_ +void +CSaveData::WriteData +( + _In_reads_bytes_(ulByteCount) PBYTE pBuffer, + _In_ ULONG ulByteCount +) +{ + ASSERT(pBuffer); + + BOOL fSaveFrame = FALSE; + ULONG ulSaveFrameIndex = 0; + KIRQL oldIrql; + + // If stream writing is disabled, then exit. + // + if (m_fWriteDisabled) + { + return; + } + + if( 0 == ulByteCount ) + { + return; + } + + // The logic below assumes that write size is <= than frame size. + if (ulByteCount > m_ulFrameSize) + { + ulByteCount = m_ulFrameSize; + } + + // Check to see if this frame is available. + KeAcquireSpinLock(&m_FrameInUseSpinLock, &oldIrql); + if (!m_fFrameUsed[m_ulFrameIndex]) + { + KeReleaseSpinLock(&m_FrameInUseSpinLock, oldIrql ); + + ULONG ulWriteBytes = ulByteCount; + + if( (m_ulBufferSize - m_ulBufferOffset) < ulWriteBytes ) + { + ulWriteBytes = m_ulBufferSize - m_ulBufferOffset; + } + + RtlCopyMemory(m_pDataBuffer + m_ulBufferOffset, pBuffer, ulWriteBytes); + m_ulBufferOffset += ulWriteBytes; + + // Check to see if we need to save this frame + if (m_ulBufferOffset >= ((m_ulFrameIndex + 1) * m_ulFrameSize)) + { + fSaveFrame = TRUE; + } + + // Loop the buffer, if we reached the end. + if (m_ulBufferOffset == m_ulBufferSize) + { + fSaveFrame = TRUE; + m_ulBufferOffset = 0; + } + + if (fSaveFrame) + { + InterlockedExchange( (LONG *)&(m_fFrameUsed[m_ulFrameIndex]), TRUE ); + ulSaveFrameIndex = m_ulFrameIndex; + m_ulFrameIndex = (m_ulFrameIndex + 1) % m_ulFrameCount; + } + + // Write the left over if the next frame is available. + if (ulWriteBytes != ulByteCount) + { + KeAcquireSpinLock(&m_FrameInUseSpinLock, &oldIrql ); + if (!m_fFrameUsed[m_ulFrameIndex]) + { + KeReleaseSpinLock(&m_FrameInUseSpinLock, oldIrql ); + RtlCopyMemory + ( + m_pDataBuffer + m_ulBufferOffset, + pBuffer + ulWriteBytes, + ulByteCount - ulWriteBytes + ); + + m_ulBufferOffset += ulByteCount - ulWriteBytes; + } + else + { + KeReleaseSpinLock(&m_FrameInUseSpinLock, oldIrql); + } + } + + if (fSaveFrame) + { + SaveFrame(ulSaveFrameIndex, m_ulFrameSize); + } + } + else + { + KeReleaseSpinLock(&m_FrameInUseSpinLock, oldIrql ); + } + +} // WriteData + + diff --git a/audio/Acx/Samples/Common/SaveData.h b/audio/Acx/Samples/Common/SaveData.h new file mode 100644 index 00000000..9138352f --- /dev/null +++ b/audio/Acx/Samples/Common/SaveData.h @@ -0,0 +1,259 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + SaveData.h + +Abstract: + + Declaration of data saving class for ACX driver samples. This class supplies services +to save data to disk. + + +--*/ + +#pragma once + +//----------------------------------------------------------------------------- +// Forward declaration +//----------------------------------------------------------------------------- +class CSaveData; +typedef CSaveData *PCSaveData; + + +//----------------------------------------------------------------------------- +// Structs +//----------------------------------------------------------------------------- + +// Parameter to workitem. +#include +typedef struct _SAVEWORKER_PARAM { + PIO_WORKITEM WorkItem; + ULONG ulFrameNo; + ULONG ulDataSize; + PBYTE pData; + PCSaveData pSaveData; + KEVENT EventDone; +} SAVEWORKER_PARAM; +typedef SAVEWORKER_PARAM *PSAVEWORKER_PARAM; +#include + +// wave file header. +#include +typedef struct _OUTPUT_FILE_HEADER +{ + DWORD dwRiff; + DWORD dwFileSize; + DWORD dwWave; + DWORD dwFormat; + DWORD dwFormatLength; +} OUTPUT_FILE_HEADER; +typedef OUTPUT_FILE_HEADER *POUTPUT_FILE_HEADER; + +typedef struct _OUTPUT_DATA_HEADER +{ + DWORD dwData; + DWORD dwDataLength; +} OUTPUT_DATA_HEADER; +typedef OUTPUT_DATA_HEADER *POUTPUT_DATA_HEADER; + +#include + +//----------------------------------------------------------------------------- +// Classes +//----------------------------------------------------------------------------- + +/////////////////////////////////////////////////////////////////////////////// +// CSaveData +// Saves the wave data to disk. +// +__drv_maxIRQL(PASSIVE_LEVEL) +PAGED_CODE_SEG +IO_WORKITEM_ROUTINE SaveFrameWorkerCallback; + +class CSaveData +{ +protected: + UNICODE_STRING m_FileName; // DataFile name. + HANDLE m_FileHandle; // DataFile handle. + PBYTE m_pDataBuffer; // Data buffer. + ULONG m_ulBufferSize; // Total buffer size. + + ULONG m_ulFrameIndex; // Current Frame. + ULONG m_ulFrameCount; // Frame count. + ULONG m_ulFrameSize; + ULONG m_ulBufferOffset; // index in buffer. + PBOOL m_fFrameUsed; // Frame usage table. + KSPIN_LOCK m_FrameInUseSpinLock; // Spinlock for synch. + KMUTEX m_FileSync; // Synchronizes file access + + OBJECT_ATTRIBUTES m_objectAttributes; // Used for opening file. + + OUTPUT_FILE_HEADER m_FileHeader; + PWAVEFORMATEX m_waveFormat; + OUTPUT_DATA_HEADER m_DataHeader; + PLARGE_INTEGER m_pFilePtr; + + static PDEVICE_OBJECT m_pDeviceObject; + static ULONG m_ulStreamId; + static ULONG m_ulOffloadStreamId; + static PSAVEWORKER_PARAM m_pWorkItems; + + BOOL m_fWriteDisabled; + + BOOL m_bInitialized; + +public: + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + CSaveData(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + ~CSaveData(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + void + Cleanup( + void + ); + + static + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + InitializeWorkItems( + _In_ PDEVICE_OBJECT DeviceObject + ); + + static + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + void + DestroyWorkItems( + void + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + void + Disable( + _In_ BOOL fDisable + ); + + static + __drv_maxIRQL(DISPATCH_LEVEL) + PSAVEWORKER_PARAM + GetNewWorkItem( + void + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + Initialize( + _In_ BOOL _bOffloaded + ); + + static + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + SetDeviceObject( + _In_ PDEVICE_OBJECT DeviceObject + ); + + static + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + PDEVICE_OBJECT + GetDeviceObject( + void + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + void + ReadData( + _Inout_updates_bytes_all_(ulByteCount) PBYTE pBuffer, + _In_ ULONG ulByteCount + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + SetDataFormat( + _In_ PKSDATAFORMAT pDataFormat + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + SetMaxWriteSize( + _In_ ULONG ulMaxWriteSize + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + void + WaitAllWorkItems( + void + ); + + __drv_maxIRQL(DISPATCH_LEVEL) + void + WriteData( + _In_reads_bytes_(ulByteCount) PBYTE pBuffer, + _In_ ULONG ulByteCount + ); + +private: + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + FileClose( + void + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + FileOpen( + _In_ BOOL fOverWrite + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + FileWrite( + _In_reads_bytes_(ulDataSize) PBYTE pData, + _In_ ULONG ulDataSize + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + FileWriteHeader( + void + ); + + __drv_maxIRQL(DISPATCH_LEVEL) + void + SaveFrame( + _In_ ULONG ulFrameNo, + _In_ ULONG ulDataSize + ); + + friend + IO_WORKITEM_ROUTINE SaveFrameWorkerCallback; +}; +typedef CSaveData *PCSaveData; + diff --git a/audio/Acx/Samples/Common/SimPeakMeter.cpp b/audio/Acx/Samples/Common/SimPeakMeter.cpp new file mode 100644 index 00000000..0dfbd4e5 --- /dev/null +++ b/audio/Acx/Samples/Common/SimPeakMeter.cpp @@ -0,0 +1,106 @@ +/*++ + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + SimPeakMeter.cpp + +Abstract: + + Virtual Peakmeter - aggregates all streams + +Environment: + + Kernel mode + +--*/ + +#include "private.h" +#include "SimPeakMeter.h" + +#ifndef __INTELLISENSE__ +#include "SimPeakMeter.tmh" +#endif + +_Use_decl_annotations_ +PAGED_CODE_SEG +CSimPeakMeter::CSimPeakMeter() +{ + PAGED_CODE(); + m_NumStreams = 0; + m_PeakMeterIndex = 0; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +CSimPeakMeter::~CSimPeakMeter() +{ + PAGED_CODE(); +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +LONG CSimPeakMeter::GetValue(ULONG Channel) +{ + PAGED_CODE(); + + // Ignore channel + UNREFERENCED_PARAMETER(Channel); + +#define PEAKMETER_VALUE_FULL (PEAKMETER_MAXIMUM / PEAKMETER_STEPPING_DELTA * PEAKMETER_STEPPING_DELTA) +#define PEAKMETER_VALUE_HALF (PEAKMETER_MAXIMUM / 2 / PEAKMETER_STEPPING_DELTA * PEAKMETER_STEPPING_DELTA) +#define PEAKMETER_VALUE_QUARTER (PEAKMETER_MAXIMUM / 4 / PEAKMETER_STEPPING_DELTA * PEAKMETER_STEPPING_DELTA) +#define PEAKMETER_VALUE_ONE_EIGTH (PEAKMETER_MAXIMUM / 8 / PEAKMETER_STEPPING_DELTA * PEAKMETER_STEPPING_DELTA) + + LONG PeakMeterValues[] = { + PEAKMETER_VALUE_ONE_EIGTH, + PEAKMETER_VALUE_QUARTER, + PEAKMETER_VALUE_HALF, + PEAKMETER_VALUE_FULL, + PEAKMETER_VALUE_HALF, + PEAKMETER_VALUE_QUARTER + }; + + if (m_NumStreams) + { + LONG pmi = InterlockedIncrement(&m_PeakMeterIndex); + if (pmi == ARRAYSIZE(PeakMeterValues)) + { + pmi = 0; + InterlockedExchange(&m_PeakMeterIndex, 0); + } + + return PeakMeterValues[pmi]; + } + + // + // No active streams. Peak meter = 0 + // + return 0; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS CSimPeakMeter::StartStream() +{ + PAGED_CODE(); + InterlockedIncrement(&m_NumStreams); + + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS CSimPeakMeter::StopStream() +{ + PAGED_CODE(); + + ASSERT(m_NumStreams); + InterlockedDecrement(&m_NumStreams); + + return STATUS_SUCCESS; +} diff --git a/audio/Acx/Samples/Common/SimPeakMeter.h b/audio/Acx/Samples/Common/SimPeakMeter.h new file mode 100644 index 00000000..7203f299 --- /dev/null +++ b/audio/Acx/Samples/Common/SimPeakMeter.h @@ -0,0 +1,51 @@ +/*++ + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + SimPeakMeter.h + +Abstract: + + Virtual Peakmeter - aggregates all streams + +Environment: + + Kernel mode + +--*/ + +#pragma once + +class CSimPeakMeter +{ +public: + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + CSimPeakMeter(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + ~CSimPeakMeter(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + LONG GetValue(_In_ ULONG Channel); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS StartStream(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS StopStream(); + +private: + LONG m_NumStreams; + LONG m_PeakMeterIndex; +}; + diff --git a/audio/Acx/Samples/Common/StreamEngine.cpp b/audio/Acx/Samples/Common/StreamEngine.cpp new file mode 100644 index 00000000..be90bac6 --- /dev/null +++ b/audio/Acx/Samples/Common/StreamEngine.cpp @@ -0,0 +1,1345 @@ +/*++ + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + StreamEngine.cpp + +Abstract: + + Virtual Streaming Engine - this module controls streaming logic for + the device. + +Environment: + + Kernel mode + +--*/ + +#include "private.h" +#include "public.h" +#include +#include +#include +#include +#include "streamengine.h" + +#ifndef __INTELLISENSE__ +#include "streamengine.tmh" +#endif + +_Use_decl_annotations_ +PAGED_CODE_SEG +CStreamEngine::CStreamEngine( + _In_ ACXSTREAM Stream, + _In_ ACXDATAFORMAT StreamFormat, + _In_ BOOL Offload, + _In_opt_ CSimPeakMeter *CircuitPeakmeter +) + : m_PacketsCount(0), + m_PacketSize(0), + m_FirstPacketOffset(0), + m_NotificationTimer(NULL), + m_CurrentState(AcxStreamStateStop), + m_CurrentPacket(0), + m_Position(0), + m_Stream(Stream), + m_StreamFormat(StreamFormat), + m_StartTime(0), + m_StartPosition(0), + m_GlitchAdjust(0), + m_ToneFrequency(DEFAULT_FREQUENCY), + m_Offload(Offload), + m_pCircuitPeakmeter(CircuitPeakmeter) +{ + PAGED_CODE(); + + KeQueryPerformanceCounter(&m_PerformanceCounterFrequency); + RtlZeroMemory(m_Packets, sizeof(m_Packets)); +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +CStreamEngine::~CStreamEngine() +{ + PAGED_CODE(); +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CStreamEngine::AllocateRtPackets( + _In_ ULONG PacketCount, + _In_ ULONG PacketSize, + _Out_ PACX_RTPACKET* Packets +) +{ + NTSTATUS status = STATUS_SUCCESS; + PACX_RTPACKET packets = NULL; + PVOID packetBuffer = NULL; + ULONG i; + ULONG packetAllocSizeInPages = 0; + ULONG packetAllocSizeInBytes = 0; + ULONG firstPacketOffset = 0; + size_t packetsSize = 0; + + PAGED_CODE(); + + if (PacketCount > MAX_PACKET_COUNT) + { + ASSERT(FALSE); + status = STATUS_INVALID_PARAMETER; + goto exit; + } + + status = RtlSizeTMult(PacketCount, sizeof(ACX_RTPACKET), &packetsSize); + if (!NT_SUCCESS(status)) + { + ASSERT(FALSE); + goto exit; + } + + packets = (PACX_RTPACKET)ExAllocatePool2(POOL_FLAG_NON_PAGED, packetsSize, DeviceDriverTag); + if (!packets) + { + status = STATUS_NO_MEMORY; + ASSERT(FALSE); + goto exit; + } + + // + // We need to allocate page-aligned buffers, to ensure no kernel memory leaks + // to user space. Round up the packet size to page aligned, then calculate + // the first packet's buffer offset so packet 0 ends on a page boundary and + // packet 1 begins on a page boundary. + // + status = RtlULongAdd(PacketSize, PAGE_SIZE - 1, &packetAllocSizeInPages); + if (!NT_SUCCESS(status)) + { + ASSERT(FALSE); + goto exit; + } + packetAllocSizeInPages = packetAllocSizeInPages / PAGE_SIZE; + packetAllocSizeInBytes = PAGE_SIZE * packetAllocSizeInPages; + firstPacketOffset = packetAllocSizeInBytes - PacketSize; + + for (i = 0; i < PacketCount; ++i) + { + PMDL pMdl = NULL; + + ACX_RTPACKET_INIT(&packets[i]); + + packetBuffer = ExAllocatePool2(POOL_FLAG_NON_PAGED, packetAllocSizeInBytes, DeviceDriverTag); + if (packetBuffer == NULL) + { + status = STATUS_NO_MEMORY; + goto exit; + } + + pMdl = IoAllocateMdl(packetBuffer, packetAllocSizeInBytes, FALSE, TRUE, NULL); + if (pMdl == NULL) + { + status = STATUS_NO_MEMORY; + goto exit; + } + + MmBuildMdlForNonPagedPool(pMdl); + + WDF_MEMORY_DESCRIPTOR_INIT_MDL(&((packets)[i].RtPacketBuffer), pMdl, packetAllocSizeInBytes); + + packets[i].RtPacketSize = PacketSize; + if (i == 0) + { + packets[i].RtPacketOffset = firstPacketOffset; + } + else + { + packets[i].RtPacketOffset = 0; + } + m_Packets[i] = packetBuffer; + + packetBuffer = NULL; + } + + *Packets = packets; + packets = NULL; + m_PacketsCount = PacketCount; + m_PacketSize = PacketSize; + m_FirstPacketOffset = firstPacketOffset; + +exit: + if (packetBuffer) + { + ExFreePoolWithTag(packetBuffer, DeviceDriverTag); + } + if (packets) + { + FreeRtPackets(packets, PacketCount); + } + return status; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +VOID +CStreamEngine::FreeRtPackets( + _Frees_ptr_ PACX_RTPACKET Packets, + _In_ ULONG PacketCount +) +{ + ULONG i; + PVOID buffer; + + PAGED_CODE(); + + for (i = 0; i < PacketCount; ++i) + { + if (Packets[i].RtPacketBuffer.u.MdlType.Mdl) + { + buffer = MmGetMdlVirtualAddress(Packets[i].RtPacketBuffer.u.MdlType.Mdl); + IoFreeMdl(Packets[i].RtPacketBuffer.u.MdlType.Mdl); + ExFreePool(buffer); + } + } + + ExFreePool(Packets); +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CStreamEngine::PrepareHardware() +{ + NTSTATUS status = STATUS_UNSUCCESSFUL; + WDF_TIMER_CONFIG timerConfig; + WDF_OBJECT_ATTRIBUTES timerAttributes; + PSTREAM_TIMER_CONTEXT timerCtx; + + PAGED_CODE(); + + // + // If already in this state, do nothing. + // + if (m_CurrentState == AcxStreamStatePause) + { + // Nothing to do. + status = STATUS_SUCCESS; + goto exit; + } + + if (m_CurrentState != AcxStreamStateStop) + { + // Error out. + status = STATUS_INVALID_STATE_TRANSITION; + goto exit; + } + + // + // Stop to Pause. + // + WDF_TIMER_CONFIG_INIT(&timerConfig, CStreamEngine::s_EvtStreamPassCallback); + timerConfig.AutomaticSerialization = TRUE; + timerConfig.UseHighResolutionTimer = WdfTrue; + timerConfig.Period = 0; + + WDF_OBJECT_ATTRIBUTES_INIT(&timerAttributes); + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&timerAttributes, STREAM_TIMER_CONTEXT); + timerAttributes.ParentObject = m_Stream; + + status = WdfTimerCreate(&timerConfig, &timerAttributes, &m_NotificationTimer); + if (!NT_SUCCESS(status)) + { + goto exit; + } + + timerCtx = GetStreamTimerContext(m_NotificationTimer); + timerCtx->StreamEngine = this; + + m_CurrentState = AcxStreamStatePause; + status = STATUS_SUCCESS; + +exit: + return status; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CStreamEngine::ReleaseHardware() +{ + PAGED_CODE(); + + // + // If already in this state, do nothing. + // + if (m_CurrentState == AcxStreamStateStop) + { + // Nothing to do. + goto exit; + } + + // + // Just assert we are in the correct state. + // On the way down we always want to succeed. + // + ASSERT(m_CurrentState == AcxStreamStatePause); + + // + // Pause to Stop. + // + if (m_NotificationTimer) + { + WdfTimerStop(m_NotificationTimer, TRUE); + WdfObjectDelete(m_NotificationTimer); + m_NotificationTimer = NULL; + } + + KeFlushQueuedDpcs(); + + m_Position = 0; + m_GlitchAdjust = 0; + m_CurrentPacket = 0; + + m_CurrentState = AcxStreamStateStop; + +exit: + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CStreamEngine::Pause() +{ + NTSTATUS status = STATUS_UNSUCCESSFUL; + + PAGED_CODE(); + + if (m_CurrentState == AcxStreamStatePause) + { + // Nothing to do. + status = STATUS_SUCCESS; + goto exit; + } + + if (m_CurrentState != AcxStreamStateRun) + { + // Error out. + status = STATUS_INVALID_STATE_TRANSITION; + goto exit; + } + + m_PeakMeter.StopStream(); + if (m_pCircuitPeakmeter) + { + m_pCircuitPeakmeter->StopStream(); + } + + // + // Run to Pause. + // + WdfTimerStop(m_NotificationTimer, TRUE); + + // Save the position we paused at. + UpdatePosition(); + + m_CurrentState = AcxStreamStatePause; + status = STATUS_SUCCESS; + +exit: + return status; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CStreamEngine::Run() +{ + NTSTATUS status = STATUS_UNSUCCESSFUL; + + PAGED_CODE(); + + if (m_CurrentState == AcxStreamStateRun) + { + // Nothing to do. + status = STATUS_SUCCESS; + goto exit; + } + + if (m_CurrentState != AcxStreamStatePause) + { + status = STATUS_INVALID_STATE_TRANSITION; + goto exit; + } + + m_PeakMeter.StartStream(); + if (m_pCircuitPeakmeter) + { + m_pCircuitPeakmeter->StartStream(); + } + + // + // Pause to Run. + // + // Save the time and position - if we ran and paused previously, the StartTime and StartPosition will allow + // us to continue scheduling packet completions correctly, while still reporting absolute position from the + // start of the stream. + // + m_StartTime = KSCONVERT_PERFORMANCE_TIME(m_PerformanceCounterFrequency.QuadPart, KeQueryPerformanceCounter(NULL)); + m_StartPosition = m_Position; + + // Reset time we've lost to glitches + m_GlitchAdjust = 0; + + ScheduleNextPass(); + + m_CurrentState = AcxStreamStateRun; + status = STATUS_SUCCESS; + +exit: + return status; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CStreamEngine::GetPresentationPosition( + _Out_ PULONGLONG PositionInBlocks, + _Out_ PULONGLONG QPCPosition +) +{ + ULONG blockAlign; + LARGE_INTEGER qpc; + + PAGED_CODE(); + + blockAlign = AcxDataFormatGetBlockAlign(m_StreamFormat); + + // Update the position based on the current time + UpdatePosition(); + qpc = KeQueryPerformanceCounter(NULL); + + *PositionInBlocks = m_Position / blockAlign; + *QPCPosition = (ULONGLONG)qpc.QuadPart; + + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CStreamEngine::GetLinearBufferPosition( + _Out_ PULONGLONG Position +) +{ + UNREFERENCED_PARAMETER(Position); + PAGED_CODE(); + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CStreamEngine::SetCurrentWritePosition( + _In_ ULONG Position +) +{ + UNREFERENCED_PARAMETER(Position); + PAGED_CODE(); + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CStreamEngine::SetLastBufferPosition( + _In_ ULONG Position +) +{ + UNREFERENCED_PARAMETER(Position); + PAGED_CODE(); + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CStreamEngine::AssignDrmContentId( + ULONG DrmContentId, + PACXDRMRIGHTS DrmRights +) +{ + PAGED_CODE(); + + UNREFERENCED_PARAMETER(DrmContentId); + UNREFERENCED_PARAMETER(DrmRights); + + // + // At this point the driver should enforce the new DrmRights. + // + // HDMI render: if DigitalOutputDisable or CopyProtect is true, enable HDCP. + // + // From MSDN: + // + // This sample doesn't forward protected content, but if your driver uses + // lower layer drivers or a different stack to properly work, please see the + // following info from MSDN: + // + // "Before allowing protected content to flow through a data path, the system + // verifies that the data path is secure. To do so, the system authenticates + // each module in the data path beginning at the upstream end of the data path + // and moving downstream. As each module is authenticated, that module gives + // the system information about the next module in the data path so that it + // can also be authenticated. To be successfully authenticated, a module's + // binary file must be signed as DRM-compliant. + // + // Two adjacent modules in the data path can communicate with each other in + // one of several ways. If the upstream module calls the downstream module + // through IoCallDriver, the downstream module is part of a WDM driver. In + // this case, the upstream module calls the AcxDrmForwardContentToDeviceObject + // function to provide the system with the device object representing the + // downstream module. (If the two modules communicate through the downstream + // module's content handlers, the upstream module calls AcxDrmAddContentHandlers + // instead.) + // + // For more information, see MSDN's DRM Functions and Interfaces. + // + + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CStreamEngine::GetHWLatency( + _Out_ ULONG* FifoSize, + _Out_ ULONG* Delay +) +{ + PAGED_CODE(); + + *FifoSize = 128; + *Delay = 0; + + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +CSimPeakMeter * +CStreamEngine::GetPeakMeter() +{ + PAGED_CODE(); + + return &m_PeakMeter; +} + +_Use_decl_annotations_ +VOID +CStreamEngine::s_EvtStreamPassCallback( + _In_ WDFTIMER Timer +) +{ + CStreamEngine* This; + PSTREAM_TIMER_CONTEXT timerCtx; + + // Get our stream engine pointer from the timer context + timerCtx = GetStreamTimerContext(Timer); + This = timerCtx->StreamEngine; + + // Call the StreamPassCallback for the engine + This->StreamPassCallback(); +} + +// This is run every time the stream timer fires +_Use_decl_annotations_ +VOID +CStreamEngine::StreamPassCallback() +{ + ULONGLONG completedPacket; + ULONGLONG qpcCompleted; + + // Process the packet (e.g. save render to file/generate capture data) + ProcessPacket(); + + // We've completed a packet! Increment our currently active packet + completedPacket = (ULONG)InterlockedIncrement((LONG*)&m_CurrentPacket) - 1; + // Save the time at which we moved to the next packet + qpcCompleted = (ULONGLONG)KeQueryPerformanceCounter(NULL).QuadPart; + + InterlockedExchange64(&m_LastPacketStart.QuadPart, m_CurrentPacketStart.QuadPart); + InterlockedExchange64(&m_CurrentPacketStart.QuadPart, qpcCompleted); + + // Tell ACX we've completed the packet. + (void)AcxRtStreamNotifyPacketComplete(m_Stream, completedPacket, qpcCompleted); + + // Schedule when our new current packet will finish + ScheduleNextPass(); +} + +_Use_decl_annotations_ +VOID +CStreamEngine::ScheduleNextPass() +{ + LONGLONG delay = 0; + ULONG bytesPerSecond; + ULONGLONG nextPacket = 0; + ULONGLONG nextPacketStartPosition = 0; + ULONGLONG nextPacketPositionFromLastPause = 0; + ULONGLONG nextPacketTimeFromLastPauseHns = 0; + ULONGLONG nextPacketTime = 0; + ULONGLONG currentTime; + BOOLEAN inTimerQueue = FALSE; + + // Get the number of bytes per second from our stored stream format + bytesPerSecond = GetBytesPerSecond(); + + // Calculate the absolute position of the beginning of the next packet from the beginning of the stream + nextPacket = m_CurrentPacket + 1; + nextPacketStartPosition = nextPacket * m_PacketSize; + + // Adjust next packet position to account for the last time we resumed from Pause + nextPacketPositionFromLastPause = nextPacketStartPosition - m_StartPosition; + + // Convert from bytes to HNS (to prevent truncation, multiply first then divide) + nextPacketTimeFromLastPauseHns = nextPacketPositionFromLastPause * HNS_PER_SEC / bytesPerSecond; + + // Next packet time is Time @ resume from Pause, offset for lost time due to glitch, with next packet time added + nextPacketTime = m_StartTime + m_GlitchAdjust + nextPacketTimeFromLastPauseHns; + + currentTime = KSCONVERT_PERFORMANCE_TIME(m_PerformanceCounterFrequency.QuadPart, KeQueryPerformanceCounter(NULL)); + + // Determine how long we want to wait, in HNS. Negative since it's a relative wait + delay = -(LONGLONG)(nextPacketTime - currentTime); + + // If the delay isn't negative, this means we lost some time (e.g. broken into kernel debugger). Update + // our glitch adjust to account for that lost time, and attempt to schedule again + if (delay >= 0) + { + // Glitch!!! + // Update the glitch adjustment and set the new delay. + m_GlitchAdjust += delay; + + StreamPassCallback(); + + return; + } + + // Start the timer for our next pass! Note the timer isn't periodic. + inTimerQueue = WdfTimerStart(m_NotificationTimer, delay); + + // We shouldn't be scheduling our next pass if the timer was previously still pending + ASSERT(inTimerQueue == FALSE); +} + +_Use_decl_annotations_ +VOID +CStreamEngine::UpdatePosition() +{ + ULONGLONG currentTime; + ULONG bytesPerSecond; + + if (m_CurrentState != AcxStreamStateRun) + { + return; + } + bytesPerSecond = GetBytesPerSecond(); + currentTime = KSCONVERT_PERFORMANCE_TIME(m_PerformanceCounterFrequency.QuadPart, KeQueryPerformanceCounter(NULL)); + + // Update position + m_Position = m_StartPosition - m_GlitchAdjust + (currentTime - m_StartTime) * bytesPerSecond / HNS_PER_SEC; +} + +_Use_decl_annotations_ +ULONG +CStreamEngine::GetBytesPerSecond() +{ + ULONG bytesPerSecond; + + bytesPerSecond = AcxDataFormatGetAverageBytesPerSec(m_StreamFormat); + + return bytesPerSecond; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CStreamEngine::GetCurrentPacket( + _Out_ PULONG CurrentPacket +) +{ + ULONG currentPacket; + PAGED_CODE(); + + currentPacket = (ULONG)InterlockedCompareExchange((LONG*)&m_CurrentPacket, -1, -1); + + *CurrentPacket = currentPacket; + + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +CRenderStreamEngine::CRenderStreamEngine( + _In_ ACXSTREAM Stream, + _In_ ACXDATAFORMAT StreamFormat, + _In_ BOOL Offload, + _In_ CSimPeakMeter * CircuitPeakmeter + +) + : CStreamEngine(Stream, StreamFormat, Offload, CircuitPeakmeter) +{ + PAGED_CODE(); +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +CRenderStreamEngine::~CRenderStreamEngine() +{ + PAGED_CODE(); +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CRenderStreamEngine::PrepareHardware() +{ + NTSTATUS status = STATUS_SUCCESS; + + PAGED_CODE(); + + status = CStreamEngine::PrepareHardware(); + if (!NT_SUCCESS(status)) + { + goto exit; + } + + status = m_SaveData.SetDataFormat((PKSDATAFORMAT)AcxDataFormatGetKsDataFormat(m_StreamFormat)); + if (!NT_SUCCESS(status)) + { + status = STATUS_SUCCESS; + goto exit; + } + + status = m_SaveData.Initialize(m_Offload); + if (!NT_SUCCESS(status)) + { + status = STATUS_SUCCESS; + goto exit; + } + + status = m_SaveData.SetMaxWriteSize(m_PacketSize * m_PacketsCount * 16); + if (!NT_SUCCESS(status)) + { + status = STATUS_SUCCESS; + goto exit; + } + +exit: + return status; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CRenderStreamEngine::ReleaseHardware() +{ + PAGED_CODE(); + + m_SaveData.WaitAllWorkItems(); + m_SaveData.Cleanup(); + + return CStreamEngine::ReleaseHardware(); +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CRenderStreamEngine::AssignDrmContentId( + ULONG DrmContentId, + PACXDRMRIGHTS DrmRights + ) +{ + PAGED_CODE(); + + UNREFERENCED_PARAMETER(DrmContentId); + + // + // At this point the driver should enforce the new DrmRights. + // The sample driver handles DrmRights per stream basis, and + // stops writing the stream to disk, if CopyProtect = TRUE. + // + // HDMI render: if DigitalOutputDisable or CopyProtect is true, enable HDCP. + // Loopback: if CopyProtect is true, disable loopback stream. + // + + // + // Sample writes each stream seperately to disk. If the rights for this + // stream indicates that the stream is CopyProtected, stop writing to disk. + // + m_SaveData.Disable(DrmRights->CopyProtect); + + // + // From MSDN: + // + // This sample doesn't forward protected content, but if your driver uses + // lower layer drivers or a different stack to properly work, please see the + // following info from MSDN: + // + // "Before allowing protected content to flow through a data path, the system + // verifies that the data path is secure. To do so, the system authenticates + // each module in the data path beginning at the upstream end of the data path + // and moving downstream. As each module is authenticated, that module gives + // the system information about the next module in the data path so that it + // can also be authenticated. To be successfully authenticated, a module's + // binary file must be signed as DRM-compliant. + // + // Two adjacent modules in the data path can communicate with each other in + // one of several ways. If the upstream module calls the downstream module + // through IoCallDriver, the downstream module is part of a WDM driver. In + // this case, the upstream module calls the AcxDrmForwardContentToDeviceObject + // function to provide the system with the device object representing the + // downstream module. (If the two modules communicate through the downstream + // module's content handlers, the upstream module calls AcxDrmAddContentHandlers + // instead.) + // + // For more information, see MSDN's DRM Functions and Interfaces. + // + + return STATUS_SUCCESS; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CRenderStreamEngine::SetRenderPacket( + _In_ ULONG Packet, + _In_ ULONG Flags, + _In_ ULONG EosPacketLength +) +{ + NTSTATUS status = STATUS_SUCCESS; + ULONG currentPacket; + + UNREFERENCED_PARAMETER(Flags); + UNREFERENCED_PARAMETER(EosPacketLength); + + PAGED_CODE(); + + currentPacket = (ULONG)InterlockedCompareExchange((LONG*)&m_CurrentPacket, -1, -1); + + if (Packet <= currentPacket) + { + //ASSERT(FALSE); + status = STATUS_DATA_LATE_ERROR; + } + else if (Packet > currentPacket + 1) + { + //ASSERT(FALSE); + status = STATUS_DATA_OVERRUN; + } + + return status; +} + +_Use_decl_annotations_ +VOID +CRenderStreamEngine::ProcessPacket() +{ + ULONG currentPacket; + ULONG packetIndex; + PBYTE packetBuffer; + + currentPacket = (ULONG)InterlockedCompareExchange((LONG*)&m_CurrentPacket, -1, -1); + + packetIndex = currentPacket % m_PacketsCount; + packetBuffer = (PBYTE)m_Packets[packetIndex]; + // Packet 0 starts at an offset if the size isn't a multiple of page_size + if (packetIndex == 0) + { + packetBuffer += m_FirstPacketOffset; + } + + m_SaveData.WriteData(packetBuffer, m_PacketSize); +} + + +_Use_decl_annotations_ +PAGED_CODE_SEG +CCaptureStreamEngine::CCaptureStreamEngine( + _In_ ACXSTREAM Stream, + _In_ ACXDATAFORMAT StreamFormat +) + : CStreamEngine(Stream, StreamFormat, FALSE, NULL), + m_EnableWaveCapture(0) +{ + PAGED_CODE(); + + m_CurrentPacketStart.QuadPart = 0; + m_LastPacketStart.QuadPart = 0; + + RtlInitUnicodeString(&m_HostCaptureFileName, NULL); + RtlInitUnicodeString(&m_LoopbackCaptureFileName, NULL); +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +CCaptureStreamEngine::~CCaptureStreamEngine() +{ + PAGED_CODE(); + + RtlFreeUnicodeString(&m_HostCaptureFileName); + RtlFreeUnicodeString(&m_LoopbackCaptureFileName); +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CCaptureStreamEngine::PrepareHardware() +{ + NTSTATUS status = STATUS_SUCCESS; + PWAVEFORMATEXTENSIBLE pwfext = NULL; + + PAGED_CODE(); + + status = CStreamEngine::PrepareHardware(); + if (!NT_SUCCESS(status)) + { + goto exit; + } + + (void)ReadRegistrySettings(); + + pwfext = (PWAVEFORMATEXTENSIBLE)AcxDataFormatGetWaveFormatExtensible(m_StreamFormat); + if (pwfext == NULL) + { + // Cannot initialize reader or generator with a format that's not understood + status = STATUS_NO_MATCH; + ASSERT(FALSE); + goto exit; + } + + if (m_EnableWaveCapture) + { + status = m_WaveReader.Init(pwfext, &m_HostCaptureFileName); + if (!NT_SUCCESS(status)) + { + m_EnableWaveCapture = FALSE; + } + } + + if (!m_EnableWaveCapture) + { + status = m_ToneGenerator.Init(m_ToneFrequency, pwfext); + } + +exit: + return status; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CCaptureStreamEngine::ReleaseHardware() +{ + PAGED_CODE(); + + if (m_EnableWaveCapture) + { + m_WaveReader.WaitAllWorkItems(); + } + + return CStreamEngine::ReleaseHardware(); +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CCaptureStreamEngine::GetCapturePacket( + _Out_ ULONG* LastCapturePacket, + _Out_ ULONGLONG* QPCPacketStart, + _Out_ BOOLEAN* MoreData +) +{ + NTSTATUS status = STATUS_SUCCESS; + ULONG currentPacket; + LONGLONG qpcPacketStart; + + PAGED_CODE(); + + currentPacket = (ULONG)InterlockedCompareExchange((LONG*)&m_CurrentPacket, -1, -1); + qpcPacketStart = InterlockedCompareExchange64(&m_LastPacketStart.QuadPart, -1, -1); + + *LastCapturePacket = currentPacket - 1; + *QPCPacketStart = (ULONGLONG)qpcPacketStart; + *MoreData = FALSE; + + return status; +} + +_Use_decl_annotations_ +VOID +CCaptureStreamEngine::ProcessPacket() +{ + ULONG currentPacket; + ULONG packetIndex; + PBYTE packetBuffer; + + currentPacket = (ULONG)InterlockedCompareExchange((LONG*)&m_CurrentPacket, -1, -1); + + packetIndex = currentPacket % m_PacketsCount; + packetBuffer = (PBYTE)m_Packets[packetIndex]; + + // Packet 0 starts at an offset if the size isn't a multiple of page_size + if (packetIndex == 0) + { + packetBuffer += m_FirstPacketOffset; + } + + if (m_EnableWaveCapture) + { + m_WaveReader.ReadWaveData(packetBuffer, m_PacketSize); + } + else + { + m_ToneGenerator.GenerateSine(packetBuffer, m_PacketSize); + } +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CCaptureStreamEngine::ReadRegistrySettings() +{ + NTSTATUS status; + PDRIVER_OBJECT DriverObject; + HANDLE DriverKey; + + RTL_QUERY_REGISTRY_TABLE paramTable[] = { + // QueryRoutine Flags Name EntryContext DefaultType DefaultData DefaultLength + { NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_TYPECHECK, L"EnableWaveCapture", &m_EnableWaveCapture, (REG_DWORD << RTL_QUERY_REGISTRY_TYPECHECK_SHIFT) | REG_DWORD, &m_EnableWaveCapture, sizeof(DWORD) }, + { NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_TYPECHECK, L"HostCaptureFileName", &m_HostCaptureFileName, (REG_SZ << RTL_QUERY_REGISTRY_TYPECHECK_SHIFT) | REG_SZ, &m_HostCaptureFileName, sizeof(UNICODE_STRING) }, + { NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_TYPECHECK, L"LoopbackCaptureFileName", &m_LoopbackCaptureFileName, (REG_SZ << RTL_QUERY_REGISTRY_TYPECHECK_SHIFT) | REG_SZ, &m_LoopbackCaptureFileName, sizeof(UNICODE_STRING) }, + { NULL, 0, NULL, NULL, 0, NULL, 0 } + }; + + PAGED_CODE(); + + DriverObject = WdfDriverWdmGetDriverObject(WdfGetDriver()); + DriverKey = NULL; + status = IoOpenDriverRegistryKey(DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &DriverKey); + + if (!NT_SUCCESS(status)) + { + ASSERT(FALSE); + goto exit; + } + + status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PCWSTR) DriverKey, + ¶mTable[0], + NULL, + NULL); + + if (DriverKey) + { + ZwClose(DriverKey); + } + +exit: + if (!NT_SUCCESS(status)) + { + m_EnableWaveCapture = FALSE; + } + + return status; +} +_Use_decl_annotations_ +PAGED_CODE_SEG +CBufferedCaptureStreamEngine::CBufferedCaptureStreamEngine( + _In_ ACXSTREAM Stream, + _In_ ACXDATAFORMAT StreamFormat, + _In_ CKeywordDetector* KeywordDetector + +) + : CCaptureStreamEngine(Stream, StreamFormat), + m_KeywordDetector(KeywordDetector) +{ + PAGED_CODE(); +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +CBufferedCaptureStreamEngine::~CBufferedCaptureStreamEngine() +{ + PAGED_CODE(); +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CBufferedCaptureStreamEngine::Pause() +{ + PAGED_CODE(); + + m_KeywordDetector->Stop(); + return CCaptureStreamEngine::Pause(); +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CBufferedCaptureStreamEngine::Run() +{ + PAGED_CODE(); + + m_KeywordDetector->Run(); + return CCaptureStreamEngine::Run(); +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS +CBufferedCaptureStreamEngine::GetCapturePacket( + _Out_ ULONG* LastCapturePacket, + _Out_ ULONGLONG* QPCPacketStart, + _Out_ BOOLEAN* MoreData +) +{ + PAGED_CODE(); + + // retrieve the packet from the fifo queue + return m_KeywordDetector->GetReadPacket(m_PacketsCount, m_PacketSize, m_Packets, LastCapturePacket, QPCPacketStart, MoreData); +} + +_Use_decl_annotations_ +VOID +CBufferedCaptureStreamEngine::ProcessPacket() +{ + LARGE_INTEGER qpc; + LARGE_INTEGER qpcFrequency; + + qpc = KeQueryPerformanceCounter(&qpcFrequency); + + // Add the next packet to the fifo queue + m_KeywordDetector->DpcRoutine(qpc.QuadPart, qpcFrequency.QuadPart); +} + +//Streamengine callbacks + +VOID +EvtStreamDestroy( + _In_ WDFOBJECT Object +) +{ + PSTREAMENGINE_CONTEXT ctx; + CStreamEngine* streamEngine = NULL; + + ctx = GetStreamEngineContext((ACXSTREAM)Object); + + streamEngine = (CStreamEngine*)ctx->StreamEngine; + ctx->StreamEngine = NULL; + delete streamEngine; +} + +PAGED_CODE_SEG +NTSTATUS +EvtStreamGetHwLatency( + _In_ ACXSTREAM Stream, + _Out_ ULONG* FifoSize, + _Out_ ULONG* Delay +) +{ + PSTREAMENGINE_CONTEXT ctx; + CStreamEngine* streamEngine = NULL; + + PAGED_CODE(); + + ctx = GetStreamEngineContext(Stream); + + streamEngine = (CStreamEngine*)ctx->StreamEngine; + + return streamEngine->GetHWLatency(FifoSize, Delay); +} + +PAGED_CODE_SEG +NTSTATUS +EvtStreamAllocateRtPackets( + _In_ ACXSTREAM Stream, + _In_ ULONG PacketCount, + _In_ ULONG PacketSize, + _Out_ PACX_RTPACKET* Packets +) +{ + PSTREAMENGINE_CONTEXT ctx; + CStreamEngine* streamEngine = NULL; + + PAGED_CODE(); + + ctx = GetStreamEngineContext(Stream); + + streamEngine = (CStreamEngine*)ctx->StreamEngine; + + return streamEngine->AllocateRtPackets(PacketCount, PacketSize, Packets); +} + +PAGED_CODE_SEG +VOID +EvtStreamFreeRtPackets( + _In_ ACXSTREAM Stream, + _In_ PACX_RTPACKET Packets, + _In_ ULONG PacketCount +) +{ + PSTREAMENGINE_CONTEXT ctx; + CStreamEngine* streamEngine = NULL; + + PAGED_CODE(); + + ctx = GetStreamEngineContext(Stream); + + streamEngine = (CStreamEngine*)ctx->StreamEngine; + + return streamEngine->FreeRtPackets(Packets, PacketCount); +} + +PAGED_CODE_SEG +NTSTATUS +EvtStreamPrepareHardware( + _In_ ACXSTREAM Stream +) +{ + PSTREAMENGINE_CONTEXT ctx; + CStreamEngine* streamEngine = NULL; + + PAGED_CODE(); + + ctx = GetStreamEngineContext(Stream); + + streamEngine = (CStreamEngine*)ctx->StreamEngine; + + return streamEngine->PrepareHardware(); +} + +PAGED_CODE_SEG +NTSTATUS +EvtStreamReleaseHardware( + _In_ ACXSTREAM Stream +) +{ + PSTREAMENGINE_CONTEXT ctx; + CStreamEngine* streamEngine = NULL; + + PAGED_CODE(); + + ctx = GetStreamEngineContext(Stream); + + streamEngine = (CStreamEngine*)ctx->StreamEngine; + + return streamEngine->ReleaseHardware(); +} + +PAGED_CODE_SEG +NTSTATUS +EvtStreamRun( + _In_ ACXSTREAM Stream +) +{ + PSTREAMENGINE_CONTEXT ctx; + CStreamEngine* streamEngine = NULL; + + PAGED_CODE(); + + ctx = GetStreamEngineContext(Stream); + + streamEngine = (CStreamEngine*)ctx->StreamEngine; + + return streamEngine->Run(); +} + + +PAGED_CODE_SEG +NTSTATUS +EvtStreamPause( + _In_ ACXSTREAM Stream +) +{ + PSTREAMENGINE_CONTEXT ctx; + CStreamEngine* streamEngine = NULL; + + PAGED_CODE(); + + ctx = GetStreamEngineContext(Stream); + + streamEngine = (CStreamEngine*)ctx->StreamEngine; + + return streamEngine->Pause(); +} + +PAGED_CODE_SEG +NTSTATUS +EvtStreamAssignDrmContentId( + _In_ ACXSTREAM Stream, + _In_ ULONG DrmContentId, + _In_ PACXDRMRIGHTS DrmRights +) +{ + PSTREAMENGINE_CONTEXT ctx; + CStreamEngine * streamEngine = NULL; + + PAGED_CODE(); + + ctx = GetStreamEngineContext(Stream); + + streamEngine = (CStreamEngine*)ctx->StreamEngine; + + return streamEngine->AssignDrmContentId(DrmContentId, DrmRights); +} + +PAGED_CODE_SEG +NTSTATUS +EvtStreamGetCurrentPacket( + _In_ ACXSTREAM Stream, + _Out_ PULONG CurrentPacket +) +{ + PSTREAMENGINE_CONTEXT ctx; + CStreamEngine* streamEngine = NULL; + + PAGED_CODE(); + + ctx = GetStreamEngineContext(Stream); + + streamEngine = static_cast(ctx->StreamEngine); + + return streamEngine->GetCurrentPacket(CurrentPacket); +} + +PAGED_CODE_SEG +NTSTATUS +EvtStreamGetPresentationPosition( + _In_ ACXSTREAM Stream, + _Out_ PULONGLONG PositionInBlocks, + _Out_ PULONGLONG QPCPosition +) +{ + PSTREAMENGINE_CONTEXT ctx; + CStreamEngine* streamEngine = NULL; + + PAGED_CODE(); + + ctx = GetStreamEngineContext(Stream); + + streamEngine = static_cast(ctx->StreamEngine); + + return streamEngine->GetPresentationPosition(PositionInBlocks, QPCPosition); +} + diff --git a/audio/Acx/Samples/Common/StreamEngine.h b/audio/Acx/Samples/Common/StreamEngine.h new file mode 100644 index 00000000..deeff95a --- /dev/null +++ b/audio/Acx/Samples/Common/StreamEngine.h @@ -0,0 +1,449 @@ +#pragma once + +#include "savedata.h" +#include "tonegenerator.h" +#include "WaveReader.h" +#include "SimPeakMeter.h" +#include "keyworddetector.h" + +#define HNSTIME_PER_MILLISECOND 10000 + +#define MAX_PACKET_COUNT 2 + +#define DEFAULT_FREQUENCY 220 +#define LOOPBACK_FREQUENCY 500 + +// Stream callbacks shared between Capture and Render + +VOID +EvtStreamDestroy( + _In_ WDFOBJECT Object +); + +PAGED_CODE_SEG +NTSTATUS +EvtStreamGetHwLatency( + _In_ ACXSTREAM Stream, + _Out_ ULONG* FifoSize, + _Out_ ULONG* Delay +); + +PAGED_CODE_SEG +NTSTATUS +EvtStreamAllocateRtPackets( + _In_ ACXSTREAM Stream, + _In_ ULONG PacketCount, + _In_ ULONG PacketSize, + _Out_ PACX_RTPACKET* Packets +); + +PAGED_CODE_SEG +VOID +EvtStreamFreeRtPackets( + _In_ ACXSTREAM Stream, + _In_ PACX_RTPACKET Packets, + _In_ ULONG PacketCount +); + +PAGED_CODE_SEG +NTSTATUS +EvtStreamPrepareHardware( + _In_ ACXSTREAM Stream +); + +PAGED_CODE_SEG +NTSTATUS +EvtStreamReleaseHardware( + _In_ ACXSTREAM Stream +); + +PAGED_CODE_SEG +NTSTATUS +EvtStreamRun( + _In_ ACXSTREAM Stream +); + +PAGED_CODE_SEG +NTSTATUS +EvtStreamPause( + _In_ ACXSTREAM Stream +); + +PAGED_CODE_SEG +NTSTATUS +EvtStreamAssignDrmContentId( + _In_ ACXSTREAM Stream, + _In_ ULONG DrmContentId, + _In_ PACXDRMRIGHTS DrmRights +); + +PAGED_CODE_SEG +NTSTATUS +EvtStreamGetCurrentPacket( + _In_ ACXSTREAM Stream, + _Out_ PULONG CurrentPacket +); + +PAGED_CODE_SEG +NTSTATUS +EvtStreamGetPresentationPosition( + _In_ ACXSTREAM Stream, + _Out_ PULONGLONG PositionInBlocks, + _Out_ PULONGLONG QPCPosition +); + + +class CStreamEngine +{ +public: + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + AllocateRtPackets( + _In_ ULONG PacketCount, + _In_ ULONG PacketSize, + _Out_ PACX_RTPACKET * Packets + ); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + VOID + FreeRtPackets( + _Frees_ptr_ PACX_RTPACKET Packets, + _In_ ULONG PacketCount + ); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + PrepareHardware(); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + ReleaseHardware(); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + Run(); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + Pause(); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + GetPresentationPosition( + _Out_ PULONGLONG PositionInBlocks, + _Out_ PULONGLONG QPCPosition + ); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + GetLinearBufferPosition( + _Out_ PULONGLONG Position + ); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + SetCurrentWritePosition( + _In_ ULONG Position + ); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + SetLastBufferPosition( + _In_ ULONG Position + ); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + GetCurrentPacket( + _Out_ PULONG CurrentPacket + ); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + GetHWLatency( + _Out_ ULONG * FifoSize, + _Out_ ULONG * Delay + ); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + AssignDrmContentId( + _In_ ULONG DrmContentId, + _In_ PACXDRMRIGHTS DrmRights + ); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + CSimPeakMeter * + GetPeakMeter(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + CStreamEngine( + _In_ ACXSTREAM Stream, + _In_ ACXDATAFORMAT StreamFormat, + _In_ BOOL Offload, + _In_opt_ CSimPeakMeter *CircuitPeakmeter + ); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + ~CStreamEngine(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + VOID + SetFrequency( + _In_ DWORD ToneFrequency + ) + { + PAGED_CODE(); + + m_ToneFrequency = ToneFrequency; + } + +protected: + PVOID m_Packets[MAX_PACKET_COUNT]; + ULONG m_PacketsCount; + ULONG m_PacketSize; + ULONG m_FirstPacketOffset; + WDFTIMER m_NotificationTimer; + ACX_STREAM_STATE m_CurrentState; + ULONG m_CurrentPacket; + ULONGLONG m_Position; + ACXSTREAM m_Stream; + ACXDATAFORMAT m_StreamFormat; + ULONGLONG m_StartTime; + ULONGLONG m_StartPosition; + ULONGLONG m_GlitchAdjust; + LARGE_INTEGER m_PerformanceCounterFrequency; + LARGE_INTEGER m_CurrentPacketStart; + LARGE_INTEGER m_LastPacketStart; + DWORD m_ToneFrequency; + BOOL m_Offload; + CSimPeakMeter m_PeakMeter; + CSimPeakMeter* m_pCircuitPeakmeter; + + static + __drv_maxIRQL(DISPATCH_LEVEL) + _Function_class_(EVT_WDF_TIMER) + VOID s_EvtStreamPassCallback( + _In_ WDFTIMER Timer + ); + + // This is run every time the stream timer fires + virtual + __drv_maxIRQL(DISPATCH_LEVEL) + VOID + StreamPassCallback(); + + virtual + __drv_maxIRQL(DISPATCH_LEVEL) + VOID + ScheduleNextPass(); + + virtual + __drv_maxIRQL(DISPATCH_LEVEL) + VOID + UpdatePosition(); + + virtual + __drv_maxIRQL(DISPATCH_LEVEL) + ULONG + GetBytesPerSecond(); + + virtual + __drv_maxIRQL(DISPATCH_LEVEL) + VOID + ProcessPacket() = 0; +}; + +class CRenderStreamEngine : public CStreamEngine +{ +public: + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + CRenderStreamEngine( + _In_ ACXSTREAM Stream, + _In_ ACXDATAFORMAT StreamFormat, + _In_ BOOL Offload, + _In_ CSimPeakMeter *CircuitPeakmeter + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + ~CRenderStreamEngine(); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + PrepareHardware(); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + ReleaseHardware(); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + AssignDrmContentId( + _In_ ULONG DrmContentId, + _In_ PACXDRMRIGHTS DrmRights + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + SetRenderPacket( + _In_ ULONG Packet, + _In_ ULONG Flags, + _In_ ULONG EosPacketLength + ); + +protected: + CSaveData m_SaveData; + + virtual + __drv_maxIRQL(DISPATCH_LEVEL) + VOID + ProcessPacket(); + +}; + +class CCaptureStreamEngine : public CStreamEngine +{ +public: + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + CCaptureStreamEngine( + _In_ ACXSTREAM Stream, + _In_ ACXDATAFORMAT StreamFormat + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + ~CCaptureStreamEngine(); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + PrepareHardware(); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + ReleaseHardware(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + GetCapturePacket( + _Out_ ULONG * LastCapturePacket, + _Out_ ULONGLONG * QPCPacketStart, + _Out_ BOOLEAN * MoreData + ); + +protected: + ToneGenerator m_ToneGenerator; + CWaveReader m_WaveReader; + DWORD m_EnableWaveCapture; + UNICODE_STRING m_HostCaptureFileName; + UNICODE_STRING m_LoopbackCaptureFileName; + + virtual + __drv_maxIRQL(DISPATCH_LEVEL) + VOID + ProcessPacket(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + ReadRegistrySettings(); +}; + +class CBufferedCaptureStreamEngine : public CCaptureStreamEngine +{ +public: + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + CBufferedCaptureStreamEngine( + _In_ ACXSTREAM Stream, + _In_ ACXDATAFORMAT StreamFormat, + _In_ CKeywordDetector * KeywordDetector + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + ~CBufferedCaptureStreamEngine(); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + Run(); + + virtual + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + Pause(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + GetCapturePacket( + _Out_ ULONG * LastCapturePacket, + _Out_ ULONGLONG * QPCPacketStart, + _Out_ BOOLEAN * MoreData + ); + +protected: + virtual + __drv_maxIRQL(DISPATCH_LEVEL) + VOID + ProcessPacket(); + + CKeywordDetector * m_KeywordDetector; +}; + +// Define circuit/stream pin context. +// +typedef struct _STREAM_TIMER_CONTEXT { + CStreamEngine * StreamEngine; +} STREAM_TIMER_CONTEXT, *PSTREAM_TIMER_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(STREAM_TIMER_CONTEXT, GetStreamTimerContext) diff --git a/audio/Acx/Samples/Common/ToneGenerator.cpp b/audio/Acx/Samples/Common/ToneGenerator.cpp new file mode 100644 index 00000000..fc30e3b2 --- /dev/null +++ b/audio/Acx/Samples/Common/ToneGenerator.cpp @@ -0,0 +1,297 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + ToneGenerator.cpp + +Abstract: + + Implementation of sine wave generator for ACX driver samples + + +--*/ +#include "private.h" +#include "public.h" +#include +#include +#include +#include +#include "ToneGenerator.h" + +#define TONEGENERATOR_POOLTAG 'rGnT' + +const double TONE_AMPLITUDE = 0.5; // Scalar value, should be between 0.0 - 1.0 +const double TWO_PI = M_PI * 2; + +DWORD g_DisableToneGenerator = 0; // default is to generate tones. + +#define IF_FAILED_JUMP(result, tag) do {if (!NT_SUCCESS(result)) {goto tag;}} while(false) +#define IF_TRUE_JUMP(result, tag) do {if (result) {goto tag;}} while(false) +#define IF_TRUE_ACTION_JUMP(result, action, tag) do {if (result) {action; goto tag;}} while(false) + +// +// Double to short conversion. +// +__drv_maxIRQL(DISPATCH_LEVEL) +short ConvertToShort(double Value) +{ + return (short)(Value * _I16_MAX); +}; + +// +// Double to char conversion. +// +__drv_maxIRQL(DISPATCH_LEVEL) +unsigned char ConvertToUChar(double Value) +{ + const double F_127_5 = 127.5; + return (unsigned char)(Value * F_127_5 + F_127_5); +}; + +// +// Ctor: basic init. +// +_Use_decl_annotations_ +PAGED_CODE_SEG +ToneGenerator::ToneGenerator() +: m_Frequency(0), + m_ChannelCount(0), + m_BitsPerSample(0), + m_SamplesPerSecond(0), + m_Mute(false), + m_PartialFrame(NULL), + m_PartialFrameBytes(0), + m_FrameSize(0) +{ + PAGED_CODE(); + + // Theta (double) and SampleIncrement (double) are init in the Init() method + // after saving the floating point state. +} + +// +// Dtor: free resources. +// +_Use_decl_annotations_ +PAGED_CODE_SEG +ToneGenerator::~ToneGenerator() +{ + PAGED_CODE(); + + if (m_PartialFrame) + { + ExFreePoolWithTag(m_PartialFrame, TONEGENERATOR_POOLTAG); + m_PartialFrame = NULL; + m_PartialFrameBytes = 0; + } +} + +// +// Init a new frame. +// Note: caller will save and restore the floatingpoint state. +// +#pragma warning(push) +// Caller wraps this routine between KeSaveFloatingPointState/KeRestoreFloatingPointState calls. +#pragma warning(disable: 28110) + +_Use_decl_annotations_ +VOID ToneGenerator::InitNewFrame +( + _Out_writes_bytes_(FrameSize) BYTE* Frame, + _In_ DWORD FrameSize +) +{ + double sinValue = TONE_AMPLITUDE * sin( m_Theta ); + + if (FrameSize != (DWORD)m_ChannelCount * m_BitsPerSample/8) + { + ASSERT(FALSE); + RtlZeroMemory(Frame, FrameSize); + return; + } + + for(ULONG i = 0; i < m_ChannelCount; ++i) + { + if (m_BitsPerSample == 8) + { + unsigned char *dataBuffer = reinterpret_cast(Frame); + dataBuffer[i] = ConvertToUChar(sinValue); + } + else // 16 bits per sample + { + short *dataBuffer = reinterpret_cast(Frame); + dataBuffer[i] = ConvertToShort(sinValue); + } + } + + m_Theta += m_SampleIncrement; + if (m_Theta >= TWO_PI) + { + m_Theta -= TWO_PI; + } +} +#pragma warning(pop) + +// +// GenerateSamples() +// +// Generate a sine wave that fits into the specified buffer. +// +// Buffer - Buffer to hold the samples +// BufferLength - Length of the buffer. +// +// Note: this function supports 16bit and 8bit samples only. +// +_Use_decl_annotations_ +void ToneGenerator::GenerateSine +( + _Out_writes_bytes_(BufferLength) BYTE *Buffer, + _In_ size_t BufferLength +) +{ + NTSTATUS status; + KFLOATING_SAVE saveData; + BYTE * buffer; + size_t length; + size_t copyBytes; + + // if muted, or tone generator disabled via registry, + // we deliver silence. + if (m_Mute || g_DisableToneGenerator) + { + goto ZeroBuffer; + } + + status = KeSaveFloatingPointState(&saveData); + if (!NT_SUCCESS(status)) + { + goto ZeroBuffer; + } + + buffer = Buffer; + length = BufferLength; + + // + // Check if we have any residual frame bytes from the last time. + // + if (m_PartialFrameBytes) + { + ASSERT(m_FrameSize > m_PartialFrameBytes); + DWORD offset = m_FrameSize - m_PartialFrameBytes; + copyBytes = MIN(m_PartialFrameBytes, length); + RtlCopyMemory(buffer, m_PartialFrame + offset, copyBytes); + RtlZeroMemory(m_PartialFrame + offset, copyBytes); + length -= copyBytes; + buffer += copyBytes; + m_PartialFrameBytes = 0; + } + + IF_TRUE_JUMP(length == 0, Done); + + // + // Copy all the aligned frames. + // + + size_t frames = length/m_FrameSize; + + for (size_t i = 0; i < frames; ++i) + { + InitNewFrame(buffer, m_FrameSize); + buffer += m_FrameSize; + length -= m_FrameSize; + } + + IF_TRUE_JUMP(length == 0, Done); + + // + // Copy any partial frame at the end. + // + ASSERT(m_FrameSize > length); + InitNewFrame(m_PartialFrame, m_FrameSize); + RtlCopyMemory(buffer, m_PartialFrame, length); + RtlZeroMemory(m_PartialFrame, length); + m_PartialFrameBytes = m_FrameSize - (DWORD)length; + +Done: + KeRestoreFloatingPointState(&saveData); + return; + +ZeroBuffer: + RtlZeroMemory(Buffer, BufferLength); + return; +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS ToneGenerator::Init +( + _In_ DWORD ToneFrequency, + _In_ PWAVEFORMATEXTENSIBLE WfExt +) +{ + NTSTATUS status = STATUS_SUCCESS; + KFLOATING_SAVE saveData; + + PAGED_CODE(); + + // + // This sample supports PCM 16bit formats only. + // + if ((WfExt->Format.wFormatTag != WAVE_FORMAT_PCM && + !(WfExt->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE && + IsEqualGUIDAligned(WfExt->SubFormat, KSDATAFORMAT_SUBTYPE_PCM))) || + (WfExt->Format.wBitsPerSample != 16 && + WfExt->Format.wBitsPerSample != 8)) + { + status = STATUS_NOT_SUPPORTED; + } + IF_FAILED_JUMP(status, Done); + + // + // Save floating state (just in case). + // + status = KeSaveFloatingPointState(&saveData); + IF_FAILED_JUMP(status, Done); + + // + // Basic init. + // + RtlZeroMemory(&m_Theta, sizeof(m_Theta)); + m_Frequency = ToneFrequency; + m_ChannelCount = WfExt->Format.nChannels; // # channels. + m_BitsPerSample = WfExt->Format.wBitsPerSample; // bits per sample. + m_SamplesPerSecond = WfExt->Format.nSamplesPerSec; // samples per sec. + m_Mute = false; + m_SampleIncrement = (m_Frequency * TWO_PI) / (double)m_SamplesPerSecond; + m_FrameSize = (DWORD)m_ChannelCount * m_BitsPerSample/8; + ASSERT(m_FrameSize == WfExt->Format.nBlockAlign); + + // + // Restore floating state. + // + KeRestoreFloatingPointState(&saveData); + + // + // Allocate a buffer to hold a partial frame. + // + m_PartialFrame = (BYTE*)ExAllocatePool2( + POOL_FLAG_NON_PAGED, + m_FrameSize, + TONEGENERATOR_POOLTAG); + + IF_TRUE_ACTION_JUMP(m_PartialFrame == NULL, status = STATUS_INSUFFICIENT_RESOURCES, Done); + + status = STATUS_SUCCESS; + +Done: + return status; +} + + diff --git a/audio/Acx/Samples/Common/ToneGenerator.h b/audio/Acx/Samples/Common/ToneGenerator.h new file mode 100644 index 00000000..9de138f8 --- /dev/null +++ b/audio/Acx/Samples/Common/ToneGenerator.h @@ -0,0 +1,88 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + ToneGenerator.h + +Abstract: + + Declaration of sine wave generator for ACX driver samples. + + +--*/ +#pragma once + +#define _USE_MATH_DEFINES +#include +#include + +class ToneGenerator +{ +public: + DWORD m_Frequency; + WORD m_ChannelCount; + WORD m_BitsPerSample; + DWORD m_SamplesPerSecond; + double m_Theta; + double m_SampleIncrement; + bool m_Mute; + BYTE* m_PartialFrame; + DWORD m_PartialFrameBytes; + DWORD m_FrameSize; + +public: + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + ToneGenerator(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + ~ToneGenerator(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS + Init + ( + _In_ DWORD ToneFrequency, + _In_ PWAVEFORMATEXTENSIBLE WfExt + ); + + __drv_maxIRQL(DISPATCH_LEVEL) + VOID + GenerateSine + ( + _Out_writes_bytes_(BufferLength) BYTE *Buffer, + _In_ size_t BufferLength + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + VOID + SetMute + ( + _In_ bool Value + ) + { + PAGED_CODE(); + + m_Mute = Value; + } + +private: + __drv_maxIRQL(DISPATCH_LEVEL) + VOID InitNewFrame + ( + _Out_writes_bytes_(FrameSize) BYTE* Frame, + _In_ DWORD FrameSize + ); +}; + + diff --git a/audio/Acx/Samples/Common/Trace_macros.h b/audio/Acx/Samples/Common/Trace_macros.h new file mode 100644 index 00000000..5291b391 --- /dev/null +++ b/audio/Acx/Samples/Common/Trace_macros.h @@ -0,0 +1,470 @@ +#pragma once + +#include // for va_start, etc. + +#pragma region Tracing level definitions + +#if !defined(FAILED_NTSTATUS) +#define FAILED_NTSTATUS(status) (((NTSTATUS)(status)) < 0) +#endif + +#if !defined(SUCCEEDED_NTSTATUS) +#define SUCCEEDED_NTSTATUS(status) (((NTSTATUS)(status)) >= 0) +#endif + +//! Define shorter versions of the ETW trace levels +#define LEVEL_CRITICAL TRACE_LEVEL_CRITICAL +#define LEVEL_ERROR TRACE_LEVEL_ERROR +#define LEVEL_WARNING TRACE_LEVEL_WARNING +#define LEVEL_INFO TRACE_LEVEL_INFORMATION +#define LEVEL_VERBOSE TRACE_LEVEL_VERBOSE + +//! This is a special LEVEL that changes the trace macro level from ERROR to VERBOSE +//! depending on whether the return value passed to the macro was non-zero or zero, +//! respectively. +#define LEVEL_COND 0xFF +#pragma endregion + +//! Logger and Enabled that supports both level and flag. +//! \link https://msdn.microsoft.com/en-us/library/windows/hardware/ff542492(v=vs.85).aspx +#define WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) WPP_LEVEL_LOGGER(FLAGS) +#define WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) (WPP_LEVEL_ENABLED(FLAGS) && (WPP_CONTROL(WPP_BIT_ ## FLAGS).Level >= LEVEL)) + +//! This macro is to be used by the WPP custom macros below that want to do conditional +//! logging based on return value. If LEVEL_VERBOSE is specified when calling a macro that +//! uses this, the level will be set to LEVEL_INFO if return code is 0 or +//! LEVEL_ERROR if the return code is not 0. This can be called in any PRE macro. +//! +//! The "LEVEL == LEVEL_COND" check generates a compiler warning that the "conditional +//! expression is constant" so we explicitly disable that. +#define WPP_CONDITIONAL_LEVEL_FLAGS_OVERRIDE(LEVEL, FLAGS, HR) \ + BOOL bEnabled = WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS); \ + __pragma(warning(push)) \ + __pragma(warning(disable: 4127)) \ + if (LEVEL == LEVEL_COND) \ + { \ + if (SUCCEEDED(HR)) \ + { \ + bEnabled = WPP_LEVEL_FLAGS_ENABLED(LEVEL_VERBOSE, FLAGS); \ + } \ + else \ + { \ + bEnabled = WPP_LEVEL_FLAGS_ENABLED(LEVEL_ERROR, FLAGS); \ + } \ + } \ + __pragma(warning(pop)) + +#define WPP_CONDITIONAL_LEVEL_FLAGS_OVERRIDE_NTSTATUS(LEVEL, FLAGS, STATUS) \ + BOOLEAN bEnabled = WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS); \ + __pragma(warning(push)) \ + __pragma(warning(disable: 4127)) \ + if (LEVEL == LEVEL_COND) \ + { \ + if (SUCCEEDED_NTSTATUS(STATUS)) \ + { \ + bEnabled = WPP_LEVEL_FLAGS_ENABLED(LEVEL_VERBOSE, FLAGS); \ + } \ + else \ + { \ + bEnabled = WPP_LEVEL_FLAGS_ENABLED(LEVEL_ERROR, FLAGS); \ + } \ + } \ + __pragma(warning(pop)) + + +#define WPP_LEVEL_FLAGS_IFRLOG_ENABLED(LEVEL, FLAGS, IFRLOG) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) +#define WPP_LEVEL_FLAGS_IFRLOG_LOGGER(LEVEL, FLAGS, IFRLOG) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) +#define WPP_LEVEL_IFRLOG_FLAGS_ENABLED(LEVEL, IFRLOG, FLAGS) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) +#define WPP_LEVEL_IFRLOG_FLAGS_LOGGER(LEVEL, IFRLOG, FLAGS) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) + +#define WPP_LEVEL_FLAGS_HR_PRE(LEVEL, FLAGS, HR) { WPP_CONDITIONAL_LEVEL_FLAGS_OVERRIDE(LEVEL, FLAGS, HR) +#define WPP_LEVEL_FLAGS_HR_POST(LEVEL, FLAGS, HR) ;} +#define WPP_LEVEL_FLAGS_HR_ENABLED(LEVEL, FLAGS, HR) bEnabled +#define WPP_LEVEL_FLAGS_HR_LOGGER(LEVEL, FLAGS, HR) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) + +#define WPP_LEVEL_FLAGS_RETVAL_ENABLED(LEVEL, FLAGS, RETVAL) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) +#define WPP_LEVEL_FLAGS_RETVAL_LOGGER(LEVEL, FLAGS, RETVAL) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) + +#define WPP_LEVEL_FLAGS_FI_ENABLED(LEVEL, FLAGS, FI) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) +#define WPP_LEVEL_FLAGS_FI_LOGGER(LEVEL, FLAGS, FI) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) + +#define WPP_LEVEL_FLAGS_STATUS_PRE(LEVEL, FLAGS, STATUS) { WPP_CONDITIONAL_LEVEL_FLAGS_OVERRIDE_NTSTATUS(LEVEL, FLAGS, STATUS) +#define WPP_LEVEL_FLAGS_STATUS_POST(LEVEL, FLAGS, STATUS) ;} +#define WPP_LEVEL_FLAGS_STATUS_ENABLED(LEVEL, FLAGS, STATUS) bEnabled +#define WPP_LEVEL_FLAGS_STATUS_LOGGER(LEVEL, FLAGS, STATUS) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) + +#define WPP_LEVEL_FLAGS_RETSTATUS_PRE(LEVEL, FLAGS, RETSTATUS) do { NTSTATUS __statusRet = (RETSTATUS); if (FAILED_NTSTATUS(__statusRet)) { +#define WPP_LEVEL_FLAGS_RETSTATUS_POST(LEVEL, FLAGS, RETSTATUS) ; return __statusRet; } } while (0, 0) +#define WPP_LEVEL_FLAGS_RETSTATUS_ENABLED(LEVEL, FLAGS, RETSTATUS) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) +#define WPP_LEVEL_FLAGS_RETSTATUS_LOGGER(LEVEL, FLAGS, RETSTATUS) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) + +#define WPP_LEVEL_FLAGS_IFRLOG_RETSTATUS_PRE(LEVEL, FLAGS, IFRLOG, RETSTATUS) do { NTSTATUS __statusRet = (RETSTATUS); if (FAILED_NTSTATUS(__statusRet)) { +#define WPP_LEVEL_FLAGS_IFRLOG_RETSTATUS_POST(LEVEL, FLAGS, IFRLOG, RETSTATUS) ; return __statusRet; } } while (0, 0) +#define WPP_LEVEL_FLAGS_IFRLOG_RETSTATUS_ENABLED(LEVEL, FLAGS, IFRLOG, RETSTATUS) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) +#define WPP_LEVEL_FLAGS_IFRLOG_RETSTATUS_LOGGER(LEVEL, FLAGS, IFRLOG, RETSTATUS) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) + +#define WPP_LEVEL_FLAGS_IFRLOG_RETSTATUS_ALLOWEDSTATUS_PRE(LEVEL, FLAGS, IFRLOG, RETSTATUS, ALLOWEDSTATUS) do {\ +NTSTATUS __statusRet = (RETSTATUS);\ +if(__statusRet == ALLOWEDSTATUS)\ +{\ + __statusRet = STATUS_SUCCESS;\ +}\ +if (FAILED_NTSTATUS(__statusRet)) { +#define WPP_LEVEL_FLAGS_IFRLOG_RETSTATUS_ALLOWEDSTATUS_POST(LEVEL, FLAGS, IFRLOG, RETSTATUS, ALLOWEDSTATUS) ; return __statusRet; } } while (0, 0) +#define WPP_LEVEL_FLAGS_IFRLOG_RETSTATUS_ALLOWEDSTATUS_ENABLED(LEVEL, FLAGS, IFRLOG, RETSTATUS, ALLOWEDSTATUS) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) +#define WPP_LEVEL_FLAGS_IFRLOG_RETSTATUS_ALLOWEDSTATUS_LOGGER(LEVEL, FLAGS, IFRLOG, RETSTATUS, ALLOWEDSTATUS) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) + +#define WPP_LEVEL_FLAGS_RETPTR_PRE(LEVEL, FLAGS, RETPTR) do { if ((RETPTR) == nullptr) { +#define WPP_LEVEL_FLAGS_RETPTR_POST(LEVEL, FLAGS, RETPTR) ; return STATUS_INSUFFICIENT_RESOURCES; } } while (0, 0) +#define WPP_LEVEL_FLAGS_RETPTR_ENABLED(LEVEL, FLAGS, RETPTR) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) +#define WPP_LEVEL_FLAGS_RETPTR_LOGGER(LEVEL, FLAGS, RETPTR) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) + +#define WPP_LEVEL_FLAGS_RETSTATUS_RETPTR_PRE(LEVEL, FLAGS, RETSTATUS, RETPTR) do { NTSTATUS __statusRet = (RETSTATUS); if ((RETPTR) == nullptr) { +#define WPP_LEVEL_FLAGS_RETSTATUS_RETPTR_POST(LEVEL, FLAGS, RETSTATUS, RETPTR) ; return __statusRet; } } while (0, 0) +#define WPP_LEVEL_FLAGS_RETSTATUS_RETPTR_ENABLED(LEVEL, FLAGS, RETSTATUS, RETPTR) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) +#define WPP_LEVEL_FLAGS_RETSTATUS_RETPTR_LOGGER(LEVEL, FLAGS, RETSTATUS, RETPTR) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) + +#define WPP_LEVEL_FLAGS_RETSTATUS_POSCOND_PRE(LEVEL, FLAGS, RETSTATUS, POSCOND) do { NTSTATUS __statusRet = (RETSTATUS); if ((POSCOND)) { +#define WPP_LEVEL_FLAGS_RETSTATUS_POSCOND_POST(LEVEL, FLAGS, RETSTATUS, POSCOND) ; return __statusRet; } } while (0, 0) +#define WPP_LEVEL_FLAGS_RETSTATUS_POSCOND_ENABLED(LEVEL, FLAGS, RETSTATUS, POSCOND) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) +#define WPP_LEVEL_FLAGS_RETSTATUS_POSCOND_LOGGER(LEVEL, FLAGS, RETSTATUS, POSCOND) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) + +#define WPP_LEVEL_FLAGS_IFRLOG_POSCOND_RETSTATUS_PRE(LEVEL, FLAGS, IFRLOG, POSCOND, RETSTATUS) do { NTSTATUS __statusRet = (RETSTATUS); if ((POSCOND)) { +#define WPP_LEVEL_FLAGS_IFRLOG_POSCOND_RETSTATUS_POST(LEVEL, FLAGS, IFRLOG, POSCOND, RETSTATUS) ; return __statusRet; } } while (0, 0) +#define WPP_LEVEL_FLAGS_IFRLOG_POSCOND_RETSTATUS_ENABLED(LEVEL, FLAGS, IFRLOG, POSCOND, RETSTATUS) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) +#define WPP_LEVEL_FLAGS_IFRLOG_POSCOND_RETSTATUS_LOGGER(LEVEL, FLAGS, IFRLOG, POSCOND, RETSTATUS) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) + +#define WPP_LEVEL_FLAGS_RETSTATUS_NEGCOND_PRE(LEVEL, FLAGS, RETSTATUS, NEGCOND) do { NTSTATUS __statusRet = (RETSTATUS); if (!(NEGCOND)) { +#define WPP_LEVEL_FLAGS_RETSTATUS_NEGCOND_POST(LEVEL, FLAGS, RETSTATUS, NEGCOND) ; return __statusRet; } } while (0, 0) +#define WPP_LEVEL_FLAGS_RETSTATUS_NEGCOND_ENABLED(LEVEL, FLAGS, RETSTATUS, NEGCOND) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) +#define WPP_LEVEL_FLAGS_RETSTATUS_NEGCOND_LOGGER(LEVEL, FLAGS, RETSTATUS, NEGCOND) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) + +#pragma region IFR Enablement Macros + +// Opt-in to a WPP recorder feature that enables independent evaluation of conditions to decide if a +// message needs to be sent to the recorder, an enabled session, or both. +#define ENABLE_WPP_TRACE_FILTERING_WITH_WPP_RECORDER 1 + +// Logger/Enabled macros used to decide if a message that is being sent to a custom recorder should +// also go to an enabled session. These do not depend on the custom recorder itself, so just +// delegate to the default. +#define WPP_IFRLOG_LEVEL_FLAGS_LOGGER(IFRLOG, LEVEL, FLAGS) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) +#define WPP_IFRLOG_LEVEL_FLAGS_ENABLED(IFRLOG, LEVEL, FLAGS) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) + +#define WPP_RECORDER_CONDITIONAL_LEVEL_FLAGS_OVERRIDE(LEVEL, FLAGS, HR) \ + ((LEVEL == LEVEL_COND) ? \ + (FAILED(HR) ? \ + WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL_ERROR, FLAGS) : WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL_VERBOSE, FLAGS)) : \ + WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS)) + +#define WPP_RECORDER_CONDITIONAL_LEVEL_FLAGS_OVERRIDE_NTSTATUS(LEVEL, FLAGS, STATUS) \ + ((LEVEL == LEVEL_COND) ? \ + (FAILED_NTSTATUS(STATUS) ? \ + WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL_ERROR, FLAGS) : WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL_VERBOSE, FLAGS)) : \ + WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS)) + +#define WPP_RECORDER_LEVEL_FLAGS_HR_ARGS(LEVEL, FLAGS, RETVAL) WPP_RECORDER_LEVEL_FLAGS_ARGS(LEVEL, FLAGS) +#define WPP_RECORDER_LEVEL_FLAGS_HR_FILTER(LEVEL, FLAGS, RETVAL) WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS) + +#define WPP_RECORDER_LEVEL_FLAGS_RETVAL_ARGS(LEVEL, FLAGS, RETVAL) WPP_RECORDER_LEVEL_FLAGS_ARGS(LEVEL, FLAGS) +#define WPP_RECORDER_LEVEL_FLAGS_RETVAL_FILTER(LEVEL, FLAGS, RETVAL) WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS) + +#define WPP_RECORDER_LEVEL_FLAGS_FI_ARGS(LEVEL, FLAGS, RETVAL) WPP_RECORDER_LEVEL_FLAGS_ARGS(LEVEL, FLAGS) +#define WPP_RECORDER_LEVEL_FLAGS_FI_FILTER(LEVEL, FLAGS, RETVAL) WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS) + +#define WPP_RECORDER_LEVEL_FLAGS_STATUS_ARGS(LEVEL, FLAGS, STATUS) WPP_RECORDER_LEVEL_FLAGS_ARGS(LEVEL, FLAGS) +#define WPP_RECORDER_LEVEL_FLAGS_STATUS_FILTER(LEVEL, FLAGS, STATUS) WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS) + +#define WPP_RECORDER_LEVEL_FLAGS_RETSTATUS_ARGS(LEVEL, FLAGS, RETSTATUS) WPP_RECORDER_LEVEL_FLAGS_ARGS(LEVEL, FLAGS) +#define WPP_RECORDER_LEVEL_FLAGS_RETSTATUS_FILTER(LEVEL, FLAGS, RETSTATUS) WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS) + +#define WPP_RECORDER_LEVEL_FLAGS_IFRLOG_RETSTATUS_ARGS(LEVEL, FLAGS, IFRLOG, RETSTATUS) WPP_RECORDER_LEVEL_FLAGS_ARGS(LEVEL, FLAGS) +#define WPP_RECORDER_LEVEL_FLAGS_IFRLOG_RETSTATUS_FILTER(LEVEL, FLAGS, IFRLOG, RETSTATUS) WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS) + +#define WPP_RECORDER_LEVEL_FLAGS_IFRLOG_RETSTATUS_ALLOWEDSTATUS_ARGS(LEVEL, FLAGS, IFRLOG, RETSTATUS, ALLOWEDSTATUS) WPP_RECORDER_LEVEL_FLAGS_ARGS(LEVEL, FLAGS) +#define WPP_RECORDER_LEVEL_FLAGS_IFRLOG_RETSTATUS_ALLOWEDSTATUS_FILTER(LEVEL, FLAGS, IFRLOG, RETSTATUS, ALLOWEDSTATUS) WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS) + +#define WPP_RECORDER_LEVEL_FLAGS_RETPTR_ARGS(LEVEL, FLAGS, RETPTR) WPP_RECORDER_LEVEL_FLAGS_ARGS(LEVEL, FLAGS) +#define WPP_RECORDER_LEVEL_FLAGS_RETPTR_FILTER(LEVEL, FLAGS, RETPTR) WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS) + +#define WPP_RECORDER_LEVEL_FLAGS_RETSTATUS_RETPTR_ARGS(LEVEL, FLAGS, RETSTATUS, RETPTR) WPP_RECORDER_LEVEL_FLAGS_ARGS(LEVEL, FLAGS) +#define WPP_RECORDER_LEVEL_FLAGS_RETSTATUS_RETPTR_FILTER(LEVEL, FLAGS, RETSTATUS, RETPTR) WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS) + +#define WPP_RECORDER_LEVEL_FLAGS_RETSTATUS_POSCOND_ARGS(LEVEL, FLAGS, RETSTATUS, POSCOND) WPP_RECORDER_LEVEL_FLAGS_ARGS(LEVEL, FLAGS) +#define WPP_RECORDER_LEVEL_FLAGS_RETSTATUS_POSCOND_FILTER(LEVEL, FLAGS, RETSTATUS, POSCOND) WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS) + +#define WPP_RECORDER_LEVEL_FLAGS_IFRLOG_POSCOND_RETSTATUS_ARGS(LEVEL, FLAGS, IFRLOG, RETSTATUS, POSCOND) WPP_RECORDER_LEVEL_FLAGS_ARGS(LEVEL, FLAGS) +#define WPP_RECORDER_LEVEL_FLAGS_IFRLOG_POSCOND_RETSTATUS_FILTER(LEVEL, FLAGS, IFRLOG, RETSTATUS, POSCOND) WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS) + +#define WPP_RECORDER_LEVEL_FLAGS_RETSTATUS_NEGCOND_ARGS(LEVEL, FLAGS, RETSTATUS, NEGCOND) WPP_RECORDER_LEVEL_FLAGS_ARGS(LEVEL, FLAGS) +#define WPP_RECORDER_LEVEL_FLAGS_RETSTATUS_NEGCOND_FILTER(LEVEL, FLAGS, RETSTATUS, NEGCOND) WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS) +#pragma endregion + +#pragma region Custom tracing macros + +// begin_wpp config +// USEPREFIX(DrvLogCritical, "%!STDPREFIX!CRIT: "); +// USEPREFIX(DrvLogError, "%!STDPREFIX!ERROR: "); +// USEPREFIX(DrvLogWarning, "%!STDPREFIX!WARN: "); +// USEPREFIX(DrvLogInfo, "%!STDPREFIX!INFO: "); +// USEPREFIX(DrvLogVerbose, "%!STDPREFIX!VERB: "); +// USEPREFIX(DrvLogEnter, "%!STDPREFIX!ENTER"); +// USEPREFIX(DrvLogExit, "%!STDPREFIX!EXIT"); +// end_wpp + +// begin_wpp config +// FUNC DrvLogCritical{LEVEL=TRACE_LEVEL_CRITICAL}(IFRLOG,FLAGS,MSG,...); +// FUNC DrvLogError{LEVEL=TRACE_LEVEL_ERROR}(IFRLOG,FLAGS,MSG,...); +// FUNC DrvLogWarning{LEVEL=TRACE_LEVEL_WARNING}(IFRLOG,FLAGS,MSG,...); +// FUNC DrvLogInfo{LEVEL=TRACE_LEVEL_INFORMATION}(IFRLOG,FLAGS,MSG,...); +// FUNC DrvLogEnter{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=FLAG_FUNCTION}(IFRLOG,...); +// FUNC DrvLogVerbose{LEVEL=TRACE_LEVEL_VERBOSE}(IFRLOG,FLAGS,MSG,...); +// FUNC DrvLogExit{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=FLAG_FUNCTION}(IFRLOG,...); +// end_wpp + + +#ifdef __INTELLISENSE__ +#define FLAG_DEVICE_ALL 0x01 +#define FLAG_FUNCTION 0x02 +#define FLAG_INFO 0x04 +#define FLAG_PNP 0x08 +#define FLAG_POWER 0x10 +#define FLAG_STREAM 0x20 +#define FLAG_INIT 0x40 +#define FLAG_DDI 0x80 +#define FLAG_GENERIC 0x100 +void DrvLogCritical(void* log, int flags, const WCHAR* fmt, ...); +void DrvLogError(void* log, int flags, const WCHAR* fmt, ...); +void DrvLogWarning(void* log, int flags, const WCHAR* fmt, ...); +void DrvLogInfo(void* log, int flags, const WCHAR* fmt, ...); +void DrvLogEnter(void* log, ...); +void DrvLogVerbose(void* log, int flags, const WCHAR* fmt, ...); +void DrvLogExit(void* log, ...); + +void RETURN_IF_FAILED(NTSTATUS status); +void RETURN_NTSTATUS_IF_FAILED(NTSTATUS status); +void RETURN_NTSTATUS_IF_FAILED_MSG(NTSTATUS status, const WCHAR* fmt, ...); +void RETURN_NTSTATUS_IF_FAILED_UNLESS_ALLOWED(NTSTATUS returnStatus, NTSTATUS allowedStatus); +void RETURN_NTSTATUS_IF_NULL_ALLOC(PVOID ptr); +void RETURN_NTSTATUS_IF_NULL(PVOID ptr); +void RETURN_NTSTATUS_IF_TRUE(BOOL condition, NTSTATUS status); +void RETURN_NTSTATUS_IF_TRUE_MSG(BOOL condition, NTSTATUS status, const WCHAR* fmt, ...); +void RETURN_NTSTATUS_IF_FALSE(BOOL condition, NTSTATUS status); +void RETURN_NTSTATUS(NTSTATUS status); +void RETURN_NTSTATUS_MSG(NTSTATUS status, const WCHAR* fmt, ...); +#endif// __INTELLISENSE__ + +//********************************************************* +// MACRO: TRACE_METHOD_LINE +// +// begin_wpp config +// FUNC TRACE_METHOD_LINE(LEVEL, FLAGS, MSG, ...); +// USESUFFIX (TRACE_METHOD_LINE, ", this=0x%p", this); +// end_wpp + +//********************************************************* +// MACRO: TRACE_METHOD_ENTRY +// +// begin_wpp config +// FUNC TRACE_METHOD_ENTRY(LEVEL, FLAGS); +// USESUFFIX (TRACE_METHOD_ENTRY, "Enter, this=0x%p", this); +// end_wpp + +//********************************************************* +// MACRO: TRACE_METHOD_EXIT +// +// begin_wpp config +// FUNC TRACE_METHOD_EXIT(LEVEL, FLAGS); +// USESUFFIX (TRACE_METHOD_EXIT, "Exit, this=0x%p", this); +// end_wpp + +//********************************************************* +// MACRO: TRACE_METHOD_EXIT_HR +// +// begin_wpp config +// FUNC TRACE_METHOD_EXIT_HR(LEVEL, FLAGS, HR); +// USESUFFIX (TRACE_METHOD_EXIT_HR, "Exit, this=0x%p, hr=%!HRESULT!", this, HR); +// end_wpp + +//********************************************************* +// MACRO: TRACE_METHOD_EXIT_DWORD +// +// begin_wpp config +// FUNC TRACE_METHOD_EXIT_DWORD(LEVEL, FLAGS, RETVAL); +// USESUFFIX (TRACE_METHOD_EXIT_DWORD, "Exit, this=0x%p, ret=0x%08Ix ", this, RETVAL); +// end_wpp + +//********************************************************* +// MACRO: TRACE_METHOD_EXIT_PTR +// +// begin_wpp config +// FUNC TRACE_METHOD_EXIT_PTR(LEVEL, FLAGS, RETVAL); +// USESUFFIX (TRACE_METHOD_EXIT_PTR,"Exit, this=0x%p, retptr=0x%p", this, RETVAL); +// end_wpp + +//********************************************************* +// MACRO: TRACE_METHOD_EXIT_STATUS +// +// begin_wpp config +// FUNC TRACE_METHOD_EXIT_STATUS(LEVEL, FLAGS, STATUS); +// USESUFFIX (TRACE_METHOD_EXIT_STATUS, "Exit, this=0x%p, status=%!STATUS!", this, STATUS); +// end_wpp + +//********************************************************* +// MACRO: TRACE_FUNCTION_ENTRY +// +// begin_wpp config +// FUNC TRACE_FUNCTION_ENTRY(LEVEL, FLAGS); +// USESUFFIX (TRACE_FUNCTION_ENTRY, "Enter"); +// end_wpp + +//********************************************************* +// MACRO: TRACE_FUNCTION_EXIT +// +// begin_wpp config +// FUNC TRACE_FUNCTION_EXIT(LEVEL, FLAGS); +// USESUFFIX (TRACE_FUNCTION_EXIT, "Exit"); +// end_wpp + +//********************************************************* +// MACRO: TRACE_FUNCTION_EXIT_HR +// +// begin_wpp config +// FUNC TRACE_FUNCTION_EXIT_HR(LEVEL, FLAGS, HR); +// USESUFFIX (TRACE_FUNCTION_EXIT_HR, "Exit, hr=%!HRESULT!", HR); +// end_wpp + +//********************************************************* +// MACRO: TRACE_FUNCTION_EXIT_DWORD +// +// begin_wpp config +// FUNC TRACE_FUNCTION_EXIT_DWORD(LEVEL, FLAGS, RETVAL); +// USESUFFIX (TRACE_FUNCTION_EXIT_DWORD, "Exit, ret=0x%08Ix", RETVAL); +// end_wpp + +//********************************************************* +// MACRO: TRACE_FUNCTION_EXIT_PTR +// +// begin_wpp config +// FUNC TRACE_FUNCTION_EXIT_PTR(LEVEL, FLAGS, RETVAL); +// USESUFFIX (TRACE_FUNCTION_EXIT_PTR, "Exit, retptr=0x%p", RETVAL); +// end_wpp + +//********************************************************* +// MACRO: TRACE_FUNCTION_EXIT_STATUS +// +// begin_wpp config +// FUNC TRACE_FUNCTION_EXIT_STATUS(LEVEL, FLAGS, STATUS); +// USESUFFIX (TRACE_FUNCTION_EXIT_STATUS, "Exit, status=%!STATUS!", STATUS); +// end_wpp + +//********************************************************* +// MACRO: TRACE_LINE +// +// begin_wpp config +// FUNC TRACE_LINE(LEVEL, FLAGS, MSG, ...); +// end_wpp + +//********************************************************* +// MACRO: TRACE_HRESULT +// +// begin_wpp config +// FUNC TRACE_HRESULT(LEVEL, FLAGS, HR, MSG, ...); +// USESUFFIX (TRACE_HRESULT, ", ret=%!HRESULT!", HR); +// end_wpp + +//********************************************************* +// MACRO: TRACE_FAILURE_INFO (WIL FailureInfo logging) +// see: https://github.com/microsoft/wil/blob/master/include/wil/result_macros.h +// +// begin_wpp config +// FUNC TRACE_FAILURE_INFO(LEVEL, FLAGS, FI); +// USESUFFIX(TRACE_FAILURE_INFO, " [%04X] '%ws', hr=%!HRESULT! ['%s' (%u)]", FI.threadId, FI.pszMessage, FI.hr, FI.pszFile, FI.uLineNumber); +// end_wpp + +// MACRO: RETURN_IF_FAILED +// +// begin_wpp config +// FUNC RETURN_IF_FAILED{LEVEL=LEVEL_ERROR,FLAGS=FLAG_DEVICE_ALL,IFRLOG=g_AudioDspLog}(RETSTATUS); +// USEPREFIX(RETURN_IF_FAILED, "%!STDPREFIX!ERROR:"); +// USESUFFIX(RETURN_IF_FAILED, " File:%s, Line:%d - status=%!STATUS!", __FILE__, __LINE__, __statusRet); +// end_wpp + + +// MACRO: RETURN_NTSTATUS_IF_FAILED +// +// begin_wpp config +// FUNC RETURN_NTSTATUS_IF_FAILED{LEVEL=LEVEL_ERROR,FLAGS=FLAG_DEVICE_ALL,IFRLOG=g_AudioDspLog}(RETSTATUS); +// USEPREFIX(RETURN_NTSTATUS_IF_FAILED, "%!STDPREFIX!ERROR:"); +// USESUFFIX(RETURN_NTSTATUS_IF_FAILED, " File:%s, Line:%d - status=%!STATUS!", __FILE__, __LINE__, __statusRet); +// end_wpp + +// MACRO: RETURN_NTSTATUS_IF_FAILED_MSG +// +// begin_wpp config +// FUNC RETURN_NTSTATUS_IF_FAILED_MSG{LEVEL=LEVEL_ERROR,FLAGS=FLAG_DEVICE_ALL,IFRLOG=g_AudioDspLog}(RETSTATUS, MSG, ...); +// USEPREFIX(RETURN_NTSTATUS_IF_FAILED_MSG, "%!STDPREFIX!ERROR:"); +// USESUFFIX(RETURN_NTSTATUS_IF_FAILED_MSG, " - status=%!STATUS!",__statusRet); +// end_wpp + +// MACRO: RETURN_NTSTATUS_IF_FAILED_UNLESS_ALLOWED +// +// begin_wpp config +// FUNC RETURN_NTSTATUS_IF_FAILED_UNLESS_ALLOWED{LEVEL=LEVEL_ERROR,FLAGS=FLAG_DEVICE_ALL,IFRLOG=g_AudioDspLog}(RETSTATUS, ALLOWEDSTATUS); +// USEPREFIX(RETURN_NTSTATUS_IF_FAILED_UNLESS_ALLOWED, "%!STDPREFIX!ERROR:"); +// USESUFFIX(RETURN_NTSTATUS_IF_FAILED_UNLESS_ALLOWED, " File:%s, Line:%d - status=%!STATUS!", __FILE__, __LINE__, __statusRet); +// end_wpp + +// MACRO: RETURN_NTSTATUS_IF_NULL_ALLOC +// +// begin_wpp config +// FUNC RETURN_NTSTATUS_IF_NULL_ALLOC{LEVEL=LEVEL_ERROR,FLAGS=DUMMY}(RETPTR); +// USESUFFIX(RETURN_NTSTATUS_IF_NULL, "status=STATUS_INSUFFICIENT_RESOURCES"); +// end_wpp + +// MACRO: RETURN_NTSTATUS_IF_NULL +// +// begin_wpp config +// FUNC RETURN_NTSTATUS_IF_NULL{LEVEL=LEVEL_ERROR,FLAGS=DUMMY}(RETSTATUS, RETPTR); +// USESUFFIX(RETURN_NTSTATUS_IF_NULL, "status=%!STATUS!", __statusRet); +// end_wpp + +// MACRO: RETURN_NTSTATUS_IF_TRUE +// +// begin_wpp config +// FUNC RETURN_NTSTATUS_IF_TRUE{LEVEL=LEVEL_ERROR,FLAGS=FLAG_DEVICE_ALL,IFRLOG=g_AudioDspLog}(POSCOND, RETSTATUS); +// USESUFFIX(RETURN_NTSTATUS_IF_TRUE, " File:%s, Line:%d - status=%!STATUS!", __FILE__, __LINE__, __statusRet); +// end_wpp + +// MACRO: RETURN_NTSTATUS_IF_TRUE_MSG +// +// begin_wpp config +// FUNC RETURN_NTSTATUS_IF_TRUE_MSG{LEVEL=LEVEL_ERROR,FLAGS=FLAG_DEVICE_ALL,IFRLOG=g_AudioDspLog}(POSCOND, RETSTATUS, MSG, ...); +// USESUFFIX(RETURN_NTSTATUS_IF_TRUE_MSG, " - status=%!STATUS!", __statusRet); +// end_wpp + +// MACRO: RETURN_NTSTATUS_IF_FALSE +// +// begin_wpp config +// FUNC RETURN_NTSTATUS_IF_FALSE{LEVEL=LEVEL_ERROR,FLAGS=DUMMY}(RETSTATUS, NEGCOND); +// USESUFFIX(RETURN_NTSTATUS_IF_FALSE, " File:%s, Line:%d - status=%!STATUS!", __FILE__, __LINE__, __statusRet); +// end_wpp + +// MACRO: RETURN_NTSTATUS +// +// begin_wpp config +// FUNC RETURN_NTSTATUS{LEVEL=LEVEL_ERROR,FLAGS=FLAG_DEVICE_ALL,IFRLOG=g_AudioDspLog}(RETSTATUS); +// USESUFFIX(RETURN_NTSTATUS, " File:%s, Line:%d - status=%!STATUS!", __FILE__, __LINE__, __statusRet); +// end_wpp + +// MACRO: RETURN_NTSTATUS_MSG +// +// begin_wpp config +// FUNC RETURN_NTSTATUS_MSG{LEVEL=LEVEL_ERROR,FLAGS=FLAG_DEVICE_ALL,IFRLOG=g_AudioDspLog}(RETSTATUS, MSG, ...); +// USESUFFIX(RETURN_NTSTATUS_MSG, " - status=%!STATUS!", __statusRet); +// end_wpp + +#define W32 +#define WPP_CHECK_FOR_NULL_STRING //to prevent exceptions due to NULL strings + +#pragma endregion diff --git a/audio/Acx/Samples/Common/WaveReader.cpp b/audio/Acx/Samples/Common/WaveReader.cpp new file mode 100644 index 00000000..4fa6eae9 --- /dev/null +++ b/audio/Acx/Samples/Common/WaveReader.cpp @@ -0,0 +1,769 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + WaveReader.cpp + +Abstract: + Implementation of wave file reader for ACX sample drivers. + + To read data from disk, this class maintains a circular data buffer. This buffer is segmented into multiple chunks of + big buffer (Though we only need two, so it is set to two now). Initially we fill first two chunks and once a chunk gets emptied + by OS, we schedule a workitem to fill the next available chunk. + + +--*/ + +#pragma warning (disable : 4127) +#pragma warning (disable : 26165) + +#include "private.h" +#include +#include +#include +#include +#include "WaveReader.h" + +#define FILE_NAME_BUFFER_TAG 'WRT1' +#define WAVE_DATA_BUFFER_TAG 'WRT2' +#define WORK_ITEM_BUFFER_TAG 'WRT3' + +#define MAX_READ_WORKER_ITEM_COUNT 15 + +#define IF_FAILED_JUMP(result, tag) do {if (!NT_SUCCESS(result)) {goto tag;}} while(false) +#define IF_TRUE_JUMP(result, tag) do {if (result) {goto tag;}} while(false) +#define IF_TRUE_ACTION_JUMP(result, action, tag) do {if (result) {action; goto tag;}} while(false) + +PREADWORKER_PARAM CWaveReader::m_pWorkItems = NULL; +PDEVICE_OBJECT CWaveReader::m_pDeviceObject = NULL; + + +/*++ + +Routine Description: + Ctor: basic init. + +--*/ + +_Use_decl_annotations_ +PAGED_CODE_SEG +CWaveReader::CWaveReader() +: m_ChannelCount(0), + m_BitsPerSample(0), + m_SamplesPerSecond(0), + m_Mute(false), + m_FileHandle(NULL) +{ + PAGED_CODE(); + m_WaveDataQueue.pWavData = NULL; + KeInitializeMutex(&m_FileSync, 0); +} + +/*++ + +Routine Description: + Dtor: free resources. + +--*/ +_Use_decl_annotations_ +PAGED_CODE_SEG +CWaveReader::~CWaveReader() +{ + PAGED_CODE(); + if (STATUS_SUCCESS == KeWaitForSingleObject + ( + &m_FileSync, + Executive, + KernelMode, + FALSE, + NULL + )) + { + if (m_WaveDataQueue.pWavData != NULL) + { + ExFreePoolWithTag(m_WaveDataQueue.pWavData, WAVE_DATA_BUFFER_TAG); + m_WaveDataQueue.pWavData = NULL; + } + + FileClose(); + KeReleaseMutex(&m_FileSync, FALSE); + } + +} + +/*++ + +Routine Description: + - Initializing the workitems. These workitems will be scheduled asynchronously by the OS. + - When these work items will be scheduled the wave file will be read and the data + - will be put inside the big chunks. + +Arguments: + Device object + +Return Value: + NT status code. + +--*/ + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS CWaveReader::InitializeWorkItems(_In_ PDEVICE_OBJECT DeviceObject) +{ + PAGED_CODE(); + + ASSERT(DeviceObject); + + NTSTATUS ntStatus = STATUS_SUCCESS; + + if (m_pWorkItems != NULL) + { + return ntStatus; + } + + m_pWorkItems = (PREADWORKER_PARAM) + ExAllocatePool2 + ( + POOL_FLAG_NON_PAGED, + sizeof(READWORKER_PARAM) * MAX_READ_WORKER_ITEM_COUNT, + 'RDPT' + ); + if (m_pWorkItems) + { + for (int i = 0; i < MAX_READ_WORKER_ITEM_COUNT; i++) + { + + m_pWorkItems[i].WorkItem = IoAllocateWorkItem(DeviceObject); + if (m_pWorkItems[i].WorkItem == NULL) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + KeInitializeEvent + ( + &m_pWorkItems[i].EventDone, + NotificationEvent, + TRUE + ); + } + } + else + { + ntStatus = STATUS_INSUFFICIENT_RESOURCES; + } + + return ntStatus; +} + +/*++ + +Routine Description: +- Wait for all the scheduled workitems to finish. + +--*/ + + +//============================================================================= +_Use_decl_annotations_ +PAGED_CODE_SEG +void CWaveReader::WaitAllWorkItems() +{ + PAGED_CODE(); + + for (int i = 0; i < MAX_READ_WORKER_ITEM_COUNT; i++) + { + KeWaitForSingleObject + ( + &(m_pWorkItems[i].EventDone), + Executive, + KernelMode, + FALSE, + NULL + ); + } +} + +/*++ + +Routine Description: + - Deallocating the workitems. + +--*/ + + +_Use_decl_annotations_ +PAGED_CODE_SEG +VOID CWaveReader::DestroyWorkItems() +{ + PAGED_CODE(); + + if (m_pWorkItems) + { + for (int i = 0; i < MAX_READ_WORKER_ITEM_COUNT; i++) + { + if (m_pWorkItems[i].WorkItem != NULL) + { + IoFreeWorkItem(m_pWorkItems[i].WorkItem); + m_pWorkItems[i].WorkItem = NULL; + } + } + ExFreePoolWithTag(m_pWorkItems, WORK_ITEM_BUFFER_TAG); + m_pWorkItems = NULL; + } +} + +/*++ + +Routine Description: + - Get a free work item to schedule a file read operation. + +--*/ +_Use_decl_annotations_ +PREADWORKER_PARAM CWaveReader::GetNewWorkItem() +{ + LARGE_INTEGER timeOut = { 0 }; + NTSTATUS ntStatus; + + for (int i = 0; i < MAX_READ_WORKER_ITEM_COUNT; i++) + { + ntStatus = + KeWaitForSingleObject + ( + &m_pWorkItems[i].EventDone, + Executive, + KernelMode, + FALSE, + &timeOut + ); + if (STATUS_SUCCESS == ntStatus) + { + if (m_pWorkItems[i].WorkItem) + return &(m_pWorkItems[i]); + else + return NULL; + } + } + + return NULL; +} + +/*++ +Routine Description: +- This routine will enqueue a workitem for reading wave file and putting +- the data into the chunk buffer. + +Arguments: + Chunk descriptor for the chunk to be filled. +--*/ + +_Use_decl_annotations_ +VOID CWaveReader::ReadWavChunk(PCHUNKDESCRIPTOR pChunkDescriptor) +{ + PREADWORKER_PARAM pParam = NULL; + + pParam = GetNewWorkItem(); + if (pParam) + { + pParam->PtrWaveReader = this; + pParam->PtrChunkDescriptor = pChunkDescriptor; + KeResetEvent(&pParam->EventDone); + IoQueueWorkItem(pParam->WorkItem, ReadFrameWorkerCallback, + DelayedWorkQueue, (PVOID)pParam); + } +} + +_Use_decl_annotations_ +PAGED_CODE_SEG +IO_WORKITEM_ROUTINE ReadFrameWorkerCallback; +/* +Routine Description: +- This routine will be called by the OS. It will fill the chunk buffer, defined by the chunk descriptor +- If end of file is reached it will mark the end of file as true. + +Arguments: + pDeviceObject - Device object + Context - pointer to reader worker params +*/ + +_Use_decl_annotations_ +PAGED_CODE_SEG +VOID ReadFrameWorkerCallback +( + _In_ PDEVICE_OBJECT pDeviceObject, + _In_opt_ PVOID Context +) +{ + PAGED_CODE(); + UNREFERENCED_PARAMETER(pDeviceObject); + pWaveReader pWavRd; + PREADWORKER_PARAM pParam = (PREADWORKER_PARAM)Context; + + if (NULL == pParam) + { + // This is completely unexpected, assert here. + // + ASSERT(pParam); + goto exit; + } + + pWavRd = pParam->PtrWaveReader; + + if (pWavRd == NULL) + { + goto exit; + } + if (STATUS_SUCCESS == KeWaitForSingleObject + ( + &pWavRd->m_FileSync, + Executive, + KernelMode, + FALSE, + NULL + )) + { + + NTSTATUS ntStatus = STATUS_SUCCESS; + + ASSERT(Context); + + IO_STATUS_BLOCK ioStatusBlock; + + if (pParam->WorkItem) + { + if (pWavRd->m_WaveDataQueue.bEofReached || pWavRd->m_WaveDataQueue.pWavData == NULL) + { + KeReleaseMutex(&pWavRd->m_FileSync, FALSE); + goto exit; + } + + if (pParam->PtrChunkDescriptor->pStartAddress != NULL) + { + ntStatus = ZwReadFile(pWavRd->m_FileHandle, + NULL, + NULL, + NULL, + &ioStatusBlock, + pParam->PtrChunkDescriptor->pStartAddress, + pParam->PtrChunkDescriptor->ulChunkLength, + NULL, + NULL); + + pParam->PtrChunkDescriptor->bIsChunkEmpty = false; + + if (ioStatusBlock.Information != pParam->PtrChunkDescriptor->ulChunkLength) + { + pWavRd->m_WaveDataQueue.bEofReached = true; + } + } + } + + KeReleaseMutex(&pWavRd->m_FileSync, FALSE); + } + +exit: + KeSetEvent(&pParam->EventDone, 0, FALSE); +} + +/*++ + +Routine Description: +- If all the chunks are empty this resturn true. + +--*/ + +_Use_decl_annotations_ +bool CWaveReader::IsAllChunkEmpty() +{ + for (int i = 0; i < NUM_OF_CHUNK_FOR_FILE_READ; i++) + { + if (!m_WaveDataQueue.sChunkDescriptor[i].bIsChunkEmpty) + { + return false; + } + } + return true; +} + +/*++ +Routine Description: + - This routine does the actual copy of data from the chunk buffer to the buffer provided by OS. + - If it empties the current chunk buffer, then it sets it state to empty and then enqueue a workitem + - to read data from the wave file and put it to the next available chunk buffer. + +Arguments: + Buffer - Pointer to the OS buffer + BufferLength - Length of the data to be filled (in bytes) + +--*/ +_Use_decl_annotations_ +VOID CWaveReader::CopyDataFromRingBuffer +( + _Out_writes_bytes_(BufferLength) BYTE *Buffer, + _In_ ULONG BufferLength +) +{ + if (IsAllChunkEmpty()) + { + RtlZeroMemory(Buffer, BufferLength); + } + else + { + ULONG prevChunk = (m_WaveDataQueue.ulReadPtr*NUM_OF_CHUNK_FOR_FILE_READ )/ m_WaveDataQueue.ulLength; + + ///////////////// + BYTE *currentBuf = Buffer; + ULONG length = BufferLength; + while (length > 0) + { + ULONG runWrite = min(length, m_WaveDataQueue.ulLength - m_WaveDataQueue.ulReadPtr); + + // Copy the wave buffer data to OS buffer + RtlCopyMemory(currentBuf, m_WaveDataQueue.pWavData + m_WaveDataQueue.ulReadPtr, runWrite); + // Zero out the wave buffer, so that if wave end of file is reached we should copy only zeros + RtlZeroMemory(m_WaveDataQueue.pWavData + m_WaveDataQueue.ulReadPtr, runWrite); + // Update the read pointer + m_WaveDataQueue.ulReadPtr = (m_WaveDataQueue.ulReadPtr + runWrite) % m_WaveDataQueue.ulLength; + currentBuf += runWrite; + length = length - runWrite; + } + + ULONG curChunk = (m_WaveDataQueue.ulReadPtr*NUM_OF_CHUNK_FOR_FILE_READ) / m_WaveDataQueue.ulLength; + + if (curChunk != prevChunk) + { + m_WaveDataQueue.currentExecutedChunk++; + // Schedule a workitem to read data from the wave file + ULONG chunkNo = m_WaveDataQueue.currentExecutedChunk % NUM_OF_CHUNK_FOR_FILE_READ; + m_WaveDataQueue.sChunkDescriptor[chunkNo].bIsChunkEmpty = true; + if (!m_WaveDataQueue.bEofReached) + { + ReadWavChunk(&m_WaveDataQueue.sChunkDescriptor[chunkNo]); + } + } + } +} + +/*++ +Routine Description: + - Just a high level read buffer call. + + Arguments: + Buffer - Pointer to the OS buffer + BufferLength - Length of the data to be filled (in bytes) +--*/ + +_Use_decl_annotations_ +VOID CWaveReader::ReadWaveData +( + _Out_writes_bytes_(BufferLength) BYTE *Buffer, + _In_ ULONG BufferLength +) +{ + if (m_Mute) + { + RtlZeroMemory(Buffer, BufferLength); + } + else + { + CopyDataFromRingBuffer(Buffer, BufferLength); + } +} + +/*++ +Routine Description: +- initialization for the wavereader member variables, +- Allocating memory for the 1 second buffer +- Preread the one second buffer data, so that when OS comes to read the data we have it available in the memory. + +Arguments: + WfExt - Format which should be used for capture + fileNameString - name of the file to be read + +Return: + NTStatus +--*/ +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS CWaveReader::Init +( + _In_ PWAVEFORMATEXTENSIBLE WfExt, + _In_ PUNICODE_STRING puiFileName +) +{ + PAGED_CODE(); + NTSTATUS ntStatus = STATUS_SUCCESS; + KFLOATING_SAVE saveData; + + // Save floating state (just in case). + ntStatus = KeSaveFloatingPointState(&saveData); + if (!NT_SUCCESS(ntStatus)) + { + return ntStatus; + } + + // + // This sample supports PCM 16bit formats only. + // + if ((WfExt->Format.wFormatTag != WAVE_FORMAT_PCM && + !(WfExt->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE && + IsEqualGUIDAligned(WfExt->SubFormat, KSDATAFORMAT_SUBTYPE_PCM))) || + (WfExt->Format.wBitsPerSample != 16 && + WfExt->Format.wBitsPerSample != 8)) + { + ntStatus = STATUS_NOT_SUPPORTED; + } + IF_FAILED_JUMP(ntStatus, Done); + + // Basic init. + m_ChannelCount = WfExt->Format.nChannels; // # channels. + m_BitsPerSample = WfExt->Format.wBitsPerSample; // bits per sample. + m_SamplesPerSecond = WfExt->Format.nSamplesPerSec; // samples per sec. + m_Mute = false; + + // Wave data queue initialization + m_WaveDataQueue.ulLength = WfExt->Format.nAvgBytesPerSec; + m_WaveDataQueue.bEofReached = false; + m_WaveDataQueue.ulReadPtr = 0; + + // Mark all the chunk empty + for (int i = 0; i < NUM_OF_CHUNK_FOR_FILE_READ; i++) + { + m_WaveDataQueue.sChunkDescriptor[i].bIsChunkEmpty = true; + } + + ntStatus = OpenWaveFile(puiFileName); + IF_FAILED_JUMP(ntStatus, Done); + + ntStatus = AllocateBigBuffer(); + IF_FAILED_JUMP(ntStatus, Done); + + ntStatus = ReadHeaderAndFillBuffer(); + +Done: + (void)KeRestoreFloatingPointState(&saveData); + return ntStatus; +} + +/*++ +Routine Description: + This function read the wave header file and compare the header info with the + stream info. Currently we are using only number of channel, sampling frequency + and bits per sample as the primary parameters for the wave file to compare against + stream params. If the params don't match we return success but streams zeros. + +Return: + NTStatus +--*/ + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS CWaveReader::ReadHeaderAndFillBuffer() +{ + PAGED_CODE(); + NTSTATUS ntStatus = STATUS_SUCCESS; + ntStatus = FileReadHeader(); + + if(NT_SUCCESS(ntStatus)) + { + if (m_WaveHeader.numChannels != m_ChannelCount || + m_WaveHeader.bitsPerSample != m_BitsPerSample || + m_WaveHeader.sampleRate != m_SamplesPerSecond) + { + // If the wave file format don't match we wont treat this as error + // and we will stream zeros. So we return from here and will not read the + // wave file and wont fill the buffers. + return STATUS_SUCCESS; + } + } + + if (NT_SUCCESS(ntStatus)) + { + // If the wave file format is same as the stream format we will stream the data + // else we will just stream zeros. + ReadWavChunk(&m_WaveDataQueue.sChunkDescriptor[0]); // Fill the first chunk + ReadWavChunk(&m_WaveDataQueue.sChunkDescriptor[1]); // Fill the second chunk + // Set the current executed chunk to 1. Once OS finishs the data for the first chunk + // use the currentExecutedChunk to find the next chunk and schedule a workitem to fill the + // data into the next chunk + m_WaveDataQueue.currentExecutedChunk = 1; + } + + return ntStatus; +} + +/*++ +Routine Description: + This function allocates 1 second buffer. + Segments the buffer into multiple (currently two) chunks. Assigns the start pointer and length + for each chunk. + +Return: + NTStatus +--*/ + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS CWaveReader::AllocateBigBuffer() +{ + PAGED_CODE(); + NTSTATUS ntStatus = STATUS_SUCCESS; + + m_WaveDataQueue.pWavData = (PBYTE) + ExAllocatePool2 + ( + POOL_FLAG_NON_PAGED, + m_WaveDataQueue.ulLength, + WAVE_DATA_BUFFER_TAG + ); + if (!m_WaveDataQueue.pWavData) + { + ntStatus = STATUS_INSUFFICIENT_RESOURCES; + } + else + { + ULONG chunklLength = m_WaveDataQueue.ulLength / NUM_OF_CHUNK_FOR_FILE_READ; + for (int i = 0; i < NUM_OF_CHUNK_FOR_FILE_READ; i++) + { + m_WaveDataQueue.sChunkDescriptor[i].pStartAddress = m_WaveDataQueue.pWavData + chunklLength*i; + m_WaveDataQueue.sChunkDescriptor[i].ulChunkLength = chunklLength; + } + } + return ntStatus; +} + +/*++ +Routine Description: + This function opens wave file. + +Arguments: + fileNameString - Name of the wave file + +Return: + NTStatus +--*/ + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS CWaveReader::OpenWaveFile(PUNICODE_STRING puiFileName) +{ + PAGED_CODE(); + NTSTATUS ntStatus = STATUS_SUCCESS; + + if (NT_SUCCESS(ntStatus) && puiFileName->Buffer != NULL) + { + // Create data file. + InitializeObjectAttributes + ( + &m_objectAttributes, + puiFileName, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, + NULL + ); + + // Open Wave File + ntStatus = FileOpen(); + } + + return ntStatus; +} + +/*++ +Routine Description: + This function closes wave file handle. + +Return: + NTStatus +--*/ + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS CWaveReader::FileClose() +{ + PAGED_CODE(); + + NTSTATUS ntStatus = STATUS_SUCCESS; + + if (m_FileHandle) + { + ntStatus = ZwClose(m_FileHandle); + m_FileHandle = NULL; + } + + return ntStatus; +} + +/*++ +Routine Description: + Reads the wave file file header information + +Return: + NTStatus +--*/ + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS CWaveReader::FileReadHeader() +{ + PAGED_CODE(); + NTSTATUS ntStatus = STATUS_SUCCESS; + IO_STATUS_BLOCK ioStatusBlock; + + + ntStatus = ZwReadFile(m_FileHandle, + NULL, + NULL, + NULL, + &ioStatusBlock, + &m_WaveHeader, + sizeof(WAVEHEADER), + NULL, + NULL); + + return ntStatus; +} + +/*++ +Routine Description: + This function opens wave file. + +Return: + NTStatus +--*/ + +_Use_decl_annotations_ +PAGED_CODE_SEG +NTSTATUS CWaveReader::FileOpen() +{ + + PAGED_CODE(); + NTSTATUS ntStatus = STATUS_SUCCESS; + IO_STATUS_BLOCK ioStatusBlock; + + if (!m_FileHandle) + { + ntStatus = + ZwCreateFile + ( + &m_FileHandle, + GENERIC_READ, + &m_objectAttributes, + &ioStatusBlock, + NULL, + FILE_ATTRIBUTE_NORMAL, + FILE_SHARE_READ, + FILE_OPEN, + FILE_SYNCHRONOUS_IO_NONALERT, + NULL, + 0 + ); + } + + return ntStatus; +} + diff --git a/audio/Acx/Samples/Common/WaveReader.h b/audio/Acx/Samples/Common/WaveReader.h new file mode 100644 index 00000000..08516be7 --- /dev/null +++ b/audio/Acx/Samples/Common/WaveReader.h @@ -0,0 +1,196 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + WaveReader.h + +Abstract: + + Declaration of wave reader for ACX sample drivers. + + +--*/ +#pragma once + +#define _USE_MATH_DEFINES +#include +#include + +#define NUM_OF_CHUNK_FOR_FILE_READ 2 + +class CWaveReader; + +// Wave header structure decleration +typedef CWaveReader *pWaveReader; +typedef struct _WAVEHEADER +{ + BYTE chunkId[4]; + ULONG chunkSize; + BYTE format[4]; + BYTE subChunkId[4]; + ULONG subChunkSize; + WORD audioFormat; + WORD numChannels; + ULONG sampleRate; + ULONG bytesPerSecond; + WORD blockAlign; + WORD bitsPerSample; + BYTE dataChunkId[4]; + ULONG dataSize; +}WAVEHEADER; + +typedef struct _CHUNKDESCRIPTOR +{ + PBYTE pStartAddress; // Starting address of the chunk + ULONG ulChunkLength; // Length of the chunk + bool bIsChunkEmpty; // If the chunk is empty +}CHUNKDESCRIPTOR; +typedef CHUNKDESCRIPTOR *PCHUNKDESCRIPTOR; + +/* + The idea here is to allocate one second long worth of buffer and divide it into NUM_OF_CHUNK_FOR_FILE_READ chunks. + In one file read operation we read and fill one chunk data . The chunk will be emptied every 10 ms by OS. + Once the OS empties one chunk data we schedule a workitem to read and fill next available chunk. +*/ + +typedef struct _WAVEDATAQUEUE +{ + PBYTE pWavData; // Pointer to the temporary buffer for reading one second worth of data from wave file + ULONG ulLength; // length of pWavData in bytes + ULONG ulReadPtr; // current reading position in pWavData in bytes + bool bEofReached; // This will be set once the eof is reached. + WORD currentExecutedChunk; + CHUNKDESCRIPTOR sChunkDescriptor[NUM_OF_CHUNK_FOR_FILE_READ]; +}WAVEDATAQUEUE; +typedef WAVEDATAQUEUE *PWAVEDATAQUEUE; + +// Parameter to workitem. +#include +typedef struct _READWORKER_PARAM { + PIO_WORKITEM WorkItem; // Pointer to the workitem + KEVENT EventDone; // Used for synchronizing a workitem for scheduling. + pWaveReader PtrWaveReader; // pointer to the wavereader class. + PCHUNKDESCRIPTOR PtrChunkDescriptor; // chunk descriptor for the chunk, which needs to be filled after file read +} READWORKER_PARAM; +typedef READWORKER_PARAM *PREADWORKER_PARAM; +#include + +__drv_maxIRQL(PASSIVE_LEVEL) +PAGED_CODE_SEG +IO_WORKITEM_ROUTINE ReadFrameWorkerCallback; + +// Wave Reader class + +class CWaveReader +{ + +public: + HANDLE m_FileHandle; // Wave File handle. + WORD m_ChannelCount; // Number of Channels for the stream during stream init + WORD m_BitsPerSample; // Number of Bits per sample for the stream during stream init + DWORD m_SamplesPerSecond; // Number of Sample per second for the stream during stream init + bool m_Mute; // Capture Zero buffer if mute + OBJECT_ATTRIBUTES m_objectAttributes; // Used for opening file. + WAVEDATAQUEUE m_WaveDataQueue; // Big buffer data object and its current state + KMUTEX m_FileSync; // Synchronizes file access + WAVEHEADER m_WaveHeader; + +public: + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + CWaveReader(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + ~CWaveReader(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS Init + ( + _In_ PWAVEFORMATEXTENSIBLE WfExt, + _In_ PUNICODE_STRING puiFileName + ); + + __drv_maxIRQL(DISPATCH_LEVEL) + VOID ReadWaveData + ( + _Out_writes_bytes_(BufferLength) BYTE *Buffer, + _In_ ULONG BufferLength + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + VOID SetMute(_In_ bool Value) + { + PAGED_CODE(); + + m_Mute = Value; + } + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + void WaitAllWorkItems(); + + // Static allocation totally related to the workitems for reading data from wavefile and putting it to chunk buffer + static PDEVICE_OBJECT m_pDeviceObject; + static PREADWORKER_PARAM m_pWorkItems; + PAGED_CODE_SEG + static NTSTATUS InitializeWorkItems(_In_ PDEVICE_OBJECT DeviceObject); + + __drv_maxIRQL(DISPATCH_LEVEL) + static PREADWORKER_PARAM GetNewWorkItem(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + static VOID DestroyWorkItems(); + +private: + __drv_maxIRQL(DISPATCH_LEVEL) + VOID ReadWavChunk(PCHUNKDESCRIPTOR PtrChunkDescriptor); + + __drv_maxIRQL(DISPATCH_LEVEL) + bool IsAllChunkEmpty(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS OpenWaveFile(PUNICODE_STRING puiFileName); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS FileClose(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS FileReadHeader(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS FileOpen(); + + __drv_maxIRQL(DISPATCH_LEVEL) + VOID CopyDataFromRingBuffer + ( + _Out_writes_bytes_(BufferLength) BYTE *Buffer, + _In_ ULONG BufferLength + ); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS AllocateBigBuffer(); + + __drv_maxIRQL(PASSIVE_LEVEL) + PAGED_CODE_SEG + NTSTATUS ReadHeaderAndFillBuffer(); + + friend IO_WORKITEM_ROUTINE ReadFrameWorkerCallback; +}; + + diff --git a/audio/Acx/Samples/Inc/AudioFormats.h b/audio/Acx/Samples/Inc/AudioFormats.h new file mode 100644 index 00000000..8a48b1cf --- /dev/null +++ b/audio/Acx/Samples/Inc/AudioFormats.h @@ -0,0 +1,959 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + AudioFormats.h + +Abstract: + + Contains Audio formats supported for the ACX Sample Drivers + +Environment: + + Kernel mode + +--*/ + +#pragma once + +#define NOBITMAP +#include + +// +// Basic-testing formats. +// +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm44100c2 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 44100, + 176400, + 4, + 16, + sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_STEREO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm44100c2_24in32 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 44100, + 352800, + 8, + 32, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 24, + KSAUDIO_SPEAKER_STEREO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm48000c2 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 48000, + 192000, + 4, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_STEREO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm48000c2_24in32 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 48000, + 384000, + 8, + 32, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 24, + KSAUDIO_SPEAKER_STEREO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm192000c2 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 192000, + 768000, + 4, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_STEREO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm44100c1 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 1, + 44100, + 88200, + 2, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_MONO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm48000c1 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 1, + 48000, + 96000, + 2, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_MONO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm16000c1 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 1, + 16000, + 32000, + 2, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_MONO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm32000c2 = +{ // 14 + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 32000, + 128000, + 4, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_STEREO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm88200c2 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 88200, + 352800, + 4, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_STEREO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm96000c2 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 96000, + 384000, + 4, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_STEREO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm24000c2 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 24000, + 96000, + 4, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_STEREO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm16000c2 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 16000, + 64000, + 4, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + 0, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm8000c1 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 1, + 8000, + 16000, + 2, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_MONO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm11025c1 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 1, + 11025, + 22050, + 2, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_MONO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm22050c1 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 1, + 22050, + 44100, + 2, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_MONO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm24000c1 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 1, + 24000, + 48000, + 2, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_MONO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm32000c1 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 1, + 32000, + 64000, + 2, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_MONO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +// +// Definitions of HDMI specific audio formats. +// + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE DolbyDigital = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 48000, + 192000, + 4, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_STEREO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE DolbyDigitalPlus = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 192000, + 768000, + 4, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_STEREO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE DolbyDigitalPlusAtmos = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS_ATMOS), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 192000, + 768000, + 4, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_STEREO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS_ATMOS) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE DolbyMlp = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MLP), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 8, + 192000, + 3072000, + 16, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_7POINT1, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MLP) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE DolbyMlpSurround = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MLP), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 8, + 192000, + 3072000, + 16, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_7POINT1_SURROUND, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MLP) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE DtsSurround = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DTS), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 48000, + 192000, + 4, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_STEREO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DTS) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE DtsHD = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DTS_HD), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 8, + 192000, + 3072000, + 16, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_7POINT1, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DTS_HD) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE DtsHDLowBitRate = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DTS_HD), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 192000, + 3072000, + 16, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_STEREO, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DTS_HD) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE DtsXE1 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DTSX_E1), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 8, + 192000, + 3072000, + 16, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_7POINT1, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DTSX_E1) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE DtsXE2 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DTSX_E2), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 8, + 192000, + 3072000, + 16, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_7POINT1, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DTSX_E2) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE DolbyMAT20 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MAT20), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 8, + 192000, + 3072000, + 16, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_7POINT1, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MAT20) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE DolbyMAT21 = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MAT21), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 8, + 192000, + 3072000, + 16, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + KSAUDIO_SPEAKER_7POINT1, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MAT21) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm44100c2nomask = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 44100, + 176400, + 4, + 16, + sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX) + }, + 16, + 0, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +// No Mask version is used for 2ch Capture, where the mask is not meaningful +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm48000c2nomask = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 2, + 48000, + 192000, + 4, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + 0, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; + +static +KSDATAFORMAT_WAVEFORMATEXTENSIBLE Pcm16000c4nomask = +{ + { + sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), + 0, + 0, + 0, + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), + STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) + }, + { + { + WAVE_FORMAT_EXTENSIBLE, + 4, + 16000, + 128000, + 8, + 16, + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) + }, + 16, + 0, + STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) + } +}; diff --git a/audio/Acx/Samples/Inc/cpp_utils.h b/audio/Acx/Samples/Inc/cpp_utils.h new file mode 100644 index 00000000..f4ed6220 --- /dev/null +++ b/audio/Acx/Samples/Inc/cpp_utils.h @@ -0,0 +1,71 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + cpp_utils.h + +Abstract: + + Contains CPP utilities + +Environment: + + Kernel mode + +--*/ + +#pragma once + +// Function scope_exit instantiates scope_exit object +// Constructor accepts lamda as parameter. +// Assign tasks in lamdba to be executed on scope exit. +template +auto scope_exit(F f) +{ + class scope_exit + { + public: + scope_exit(F f) : + _f{ f } + { + } + + ~scope_exit() + { + if (_call) + { + _f(); + } + } + + // Ensures the scope_exit lambda will not be called + void release() + { + _call = false; + } + + // Executes the scope_exit lambda immediately if not yet run; ensures it will not run again + void reset() + { + if (_call) + { + _f(); + _call = false; + } + } + + private: + F _f; + bool _call = true; + }; + + return scope_exit{ f }; +}; + diff --git a/audio/Acx/Samples/Shared/Public.h b/audio/Acx/Samples/Shared/Public.h new file mode 100644 index 00000000..f1e9da3b --- /dev/null +++ b/audio/Acx/Samples/Shared/Public.h @@ -0,0 +1,342 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + + THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR + PURPOSE. + +Module Name: + + Public.h + +Abstract: + + Contains structure definitions and function prototypes for the driver + that are public. + +Environment: + + Kernel mode + +--*/ + +/* make prototypes usable from C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include "Trace.h" + +#include +#include + +#define PAGED_CODE_SEG __declspec(code_seg("PAGE")) +#define INIT_CODE_SEG __declspec(code_seg("INIT")) + +// Number of msec for idle timeout. +#define IDLE_POWER_TIMEOUT 5000 + +extern RECORDER_LOG g_AudioDspLog; +extern RECORDER_LOG g_AudioDspMcLog; + +// +// Define CODEC device context. +// +typedef struct _CODEC_DEVICE_CONTEXT { + ACXCIRCUIT Render; + ACXCIRCUIT Capture; + WDF_TRI_STATE ExcludeD3Cold; +} CODEC_DEVICE_CONTEXT, * PCODEC_DEVICE_CONTEXT; + +// +// Codec driver prototypes. +// +EVT_WDF_DRIVER_DEVICE_ADD Codec_EvtBusDeviceAdd; +DRIVER_INITIALIZE DriverEntry; +EVT_WDF_DRIVER_UNLOAD AudioCodecDriverUnload; + +// +// Codec device callbacks. +// +EVT_WDF_DEVICE_PREPARE_HARDWARE Codec_EvtDevicePrepareHardware; +EVT_WDF_DEVICE_RELEASE_HARDWARE Codec_EvtDeviceReleaseHardware; +EVT_WDF_DEVICE_D0_ENTRY Codec_EvtDeviceD0Entry; +EVT_WDF_DEVICE_D0_EXIT Codec_EvtDeviceD0Exit; +EVT_WDF_DEVICE_CONTEXT_CLEANUP Codec_EvtDeviceContextCleanup; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(CODEC_DEVICE_CONTEXT, GetCodecDeviceContext) + +// +// Define DSP device context. +// +typedef struct _DSP_DEVICE_CONTEXT { + ACXCIRCUIT Speaker; + ACXCIRCUIT MicArray; + ACXCIRCUIT SpeakerHp; + ACXCIRCUIT MicrophoneHp; + ACXCIRCUIT HDMI; + WDF_TRI_STATE ExcludeD3Cold; +} DSP_DEVICE_CONTEXT, * PDSP_DEVICE_CONTEXT; + +// +// Dsp driver prototypes. +// +EVT_WDF_DRIVER_DEVICE_ADD Dsp_EvtBusDeviceAdd; +EVT_WDF_DRIVER_UNLOAD AudioDspDriverUnload; + +// +// Dsp device callbacks. +// +EVT_WDF_DEVICE_PREPARE_HARDWARE Dsp_EvtDevicePrepareHardware; +EVT_WDF_DEVICE_RELEASE_HARDWARE Dsp_EvtDeviceReleaseHardware; +EVT_WDF_DEVICE_D0_ENTRY Dsp_EvtDeviceD0Entry; +EVT_WDF_DEVICE_D0_EXIT Dsp_EvtDeviceD0Exit; +EVT_WDF_DEVICE_CONTEXT_CLEANUP Dsp_EvtDeviceContextCleanup; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DSP_DEVICE_CONTEXT, GetDspDeviceContext) + +// +// Define CODECMC (multicircuit codec) device context. +// +typedef struct _CODECMC_DEVICE_CONTEXT +{ + ACXCIRCUIT Render; + ACXCIRCUIT Capture; + ACXCOMPOSITETEMPLATE Composite[2]; + ULONG refComposite[2]; + WDF_TRI_STATE ExcludeD3Cold; +} CODECMC_DEVICE_CONTEXT, *PCODECMC_DEVICE_CONTEXT; + +// +// Multicircuit codec driver prototypes. +// +EVT_WDF_DRIVER_DEVICE_ADD CodecMc_EvtBusDeviceAdd; +DRIVER_INITIALIZE DriverEntry; +EVT_WDF_DRIVER_UNLOAD AudioCodecMcDriverUnload; + +// +// Multicircuit codec device callbacks. +// +EVT_WDF_DEVICE_PREPARE_HARDWARE CodecMc_EvtDevicePrepareHardware; +EVT_WDF_DEVICE_RELEASE_HARDWARE CodecMc_EvtDeviceReleaseHardware; +EVT_WDF_DEVICE_D0_ENTRY CodecMc_EvtDeviceD0Entry; +EVT_WDF_DEVICE_D0_EXIT CodecMc_EvtDeviceD0Exit; +EVT_WDF_DEVICE_CONTEXT_CLEANUP CodecMc_EvtDeviceContextCleanup; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(CODECMC_DEVICE_CONTEXT, GetCodecMcDeviceContext) + +// +// Composite type definition used in multicircuit codec. +// +typedef enum +{ + CompositeType_RENDER, + CompositeType_CAPTURE +} CompositeType; + +// +// Define DSPMC (multicircuit dsp) device context. +// +typedef struct _DSPMC_DEVICE_CONTEXT +{ + ACXCIRCUIT Render; + ACXCIRCUIT Capture; + WDF_TRI_STATE ExcludeD3Cold; +} DSPMC_DEVICE_CONTEXT, *PDSPMC_DEVICE_CONTEXT; + +// +// Multicircuit dsp driver prototypes. +// +EVT_WDF_DRIVER_DEVICE_ADD DspMc_EvtBusDeviceAdd; +EVT_WDF_DRIVER_UNLOAD AudioDspMcDriverUnload; + +// +// Multicircuit dsp device callbacks. +// +EVT_WDF_DEVICE_PREPARE_HARDWARE DspMc_EvtDevicePrepareHardware; +EVT_WDF_DEVICE_RELEASE_HARDWARE DspMc_EvtDeviceReleaseHardware; +EVT_WDF_DEVICE_D0_ENTRY DspMc_EvtDeviceD0Entry; +EVT_WDF_DEVICE_D0_EXIT DspMc_EvtDeviceD0Exit; +EVT_WDF_DEVICE_CONTEXT_CLEANUP DspMc_EvtDeviceContextCleanup; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DSPMC_DEVICE_CONTEXT, GetDspMcDeviceContext) + +// Factory circuit callbacks for multicircuit dsp. +EVT_ACX_FACTORY_CIRCUIT_CREATE_CIRCUITDEVICE RenderMCDsp_EvtAcxFactoryCircuitCreateCircuitDevice; +EVT_ACX_FACTORY_CIRCUIT_CREATE_CIRCUIT RenderMCDsp_EvtAcxFactoryCircuitCreateCircuit; + +EVT_ACX_FACTORY_CIRCUIT_CREATE_CIRCUITDEVICE CaptureMCDsp_EvtAcxFactoryCircuitCreateCircuitDevice; +EVT_ACX_FACTORY_CIRCUIT_CREATE_CIRCUIT CaptureMCDsp_EvtAcxFactoryCircuitCreateCircuit; + + +/* make internal prototypes usable from C++ */ +#ifdef __cplusplus +} +#endif + +// Used to store the registry settings path for the driver: +extern UNICODE_STRING g_RegistryPath; + +// Driver tag name: +extern ULONG DeviceDriverTag; + +// The idle timeout in msec for power policy structure: +extern ULONG IdleTimeoutMsec; + +#define DECLARE_CONST_ACXOBJECTBAG_MULTICIRCUIT_SAMPLE_PROPERTY_NAME(name) \ + DECLARE_CONST_UNICODE_STRING(name, L"mc_" #name) + +__drv_requiresIRQL(PASSIVE_LEVEL) +PAGED_CODE_SEG +NTSTATUS +CopyRegistrySettingsPath( + _In_ PUNICODE_STRING RegistryPath +); + +PAGED_CODE_SEG +NTSTATUS +Codec_SetPowerPolicy( + _In_ WDFDEVICE Device +); + +PAGED_CODE_SEG +NTSTATUS +Dsp_SetPowerPolicy( + _In_ WDFDEVICE Device +); + +PAGED_CODE_SEG +NTSTATUS +CodecMc_SetPowerPolicy( + _In_ WDFDEVICE Device +); + +PAGED_CODE_SEG +NTSTATUS +DspMc_SetPowerPolicy( + _In_ WDFDEVICE Device +); + +PAGED_CODE_SEG +NTSTATUS +CodecR_AddStaticRender( + _In_ WDFDEVICE Device, + _In_ const GUID * ComponentGuid, + _In_ const UNICODE_STRING * CircuitName +); + +PAGED_CODE_SEG +NTSTATUS +CodecC_AddStaticCapture( + _In_ WDFDEVICE Device, + _In_ const GUID * ComponentGuid, + _In_ const GUID * MicCustomName, + _In_ const UNICODE_STRING * CircuitName +); + +PAGED_CODE_SEG +NTSTATUS +Speaker_AddStaticRender( + _In_ WDFDEVICE Device, + _In_ GUID ComponentGuid, + _In_ UNICODE_STRING CircuitName, + _In_ BOOLEAN IsHeadphones +); + +PAGED_CODE_SEG +NTSTATUS +MicArray_AddStaticCapture( + _In_ WDFDEVICE Device, + _In_ GUID ComponentGuid, + _In_ GUID MicCustomName, + _In_ UNICODE_STRING CircuitName +); + +PAGED_CODE_SEG +NTSTATUS +MicrophoneHp_AddStaticCapture( + _In_ WDFDEVICE Device, + _In_ GUID ComponentGuid, + _In_ GUID MicCustomName, + _In_ UNICODE_STRING CircuitName +); + +PAGED_CODE_SEG +NTSTATUS +SpeakerHp_AddStaticRender( + _In_ WDFDEVICE Device, + _In_ GUID ComponentGuid, + _In_ UNICODE_STRING CircuitName +); + +PAGED_CODE_SEG +NTSTATUS +HDMI_AddStaticRender( + _In_ WDFDEVICE Device, + _In_ GUID ComponentGuid, + _In_ UNICODE_STRING CircuitName +); + +PAGED_CODE_SEG +NTSTATUS +RenderMC_AddStaticRender( + _In_ WDFDEVICE Device, + _In_ const GUID * ComponentGuid, + _In_ const UNICODE_STRING * CircuitName, + _In_ const UNICODE_STRING * Uri +); + +PAGED_CODE_SEG +NTSTATUS +CaptureMC_AddStaticCapture( + _In_ WDFDEVICE Device, + _In_ const GUID * ComponentGuid, + _In_ const GUID * MicCustomName, + _In_ const UNICODE_STRING * CircuitName, + _In_ const UNICODE_STRING * Uri +); + +PAGED_CODE_SEG +NTSTATUS +CodecC_CircuitCleanup( + _In_ ACXCIRCUIT Device +); + +PAGED_CODE_SEG +NTSTATUS +MicArray_CircuitCleanup( + _In_ ACXCIRCUIT Device +); + +PAGED_CODE_SEG +NTSTATUS +CaptureMCDsp_CircuitCleanup( + _In_ ACXCIRCUIT Device +); + +PAGED_CODE_SEG +NTSTATUS +DspMc_AddFactoryCircuit( + _In_ WDFDRIVER Driver, + _In_ WDFDEVICE Device +); + +NTSTATUS +CodecMc_AddRenderComposites(_In_ WDFDEVICE Device); + +PAGED_CODE_SEG +NTSTATUS +CodecMc_AddCaptureComposites(_In_ WDFDEVICE Device); + +PAGED_CODE_SEG +NTSTATUS +CodecMc_AddComposites(_In_ WDFDEVICE Device, _In_ CompositeType compositeType); + +NTSTATUS +CodecMc_RemoveComposites(_In_ WDFDEVICE Device); diff --git a/audio/Acx/Samples/Shared/Trace.h b/audio/Acx/Samples/Shared/Trace.h new file mode 100644 index 00000000..01478bfc --- /dev/null +++ b/audio/Acx/Samples/Shared/Trace.h @@ -0,0 +1,33 @@ +/*++ + +Copyright (c) Microsoft Corporation + +Module Name: + +Trace.h + +--*/ + +#pragma once + +#include +#include // For TRACE_LEVEL definitions + +#define WPP_TOTAL_BUFFER_SIZE (PAGE_SIZE) +#define WPP_ERROR_PARTITION_SIZE (WPP_TOTAL_BUFFER_SIZE/4) + +// {1945C417-844C-48C6-9BCE-3AA2113A2B69} +#define WPP_CONTROL_GUIDS \ +WPP_DEFINE_CONTROL_GUID(DrvLogger,(1945C417,844C,48C6,9BCE,3AA2113A2B69), \ + WPP_DEFINE_BIT(FLAG_DEVICE_ALL) /* bit 0 = 0x00000001 */ \ + WPP_DEFINE_BIT(FLAG_FUNCTION) /* bit 1 = 0x00000002 */ \ + WPP_DEFINE_BIT(FLAG_INFO) /* bit 2 = 0x00000004 */ \ + WPP_DEFINE_BIT(FLAG_PNP) /* bit 3 = 0x00000008 */ \ + WPP_DEFINE_BIT(FLAG_POWER) /* bit 4 = 0x00000010 */ \ + WPP_DEFINE_BIT(FLAG_STREAM) /* bit 5 = 0x00000020 */ \ + WPP_DEFINE_BIT(FLAG_INIT) /* bit 6 = 0x00000040 */ \ + WPP_DEFINE_BIT(FLAG_DDI) /* bit 7 = 0x00000080 */ \ + WPP_DEFINE_BIT(FLAG_GENERIC) /* bit 8 = 0x00000100 */ \ + ) + +#include "trace_macros.h" -- cgit v1.3.1 From 91e07c437248cb21f5113a5f65780447abc40823 Mon Sep 17 00:00:00 2001 From: Wei Mao Date: Tue, 7 Mar 2023 11:52:41 -0800 Subject: [general\echo\umdf2] Add TargetOSVersion to INF file (#911) --- general/echo/umdf2/driver/AutoSync/echoum.inx | Bin 4032 -> 4980 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/general/echo/umdf2/driver/AutoSync/echoum.inx b/general/echo/umdf2/driver/AutoSync/echoum.inx index b012672c..3734b873 100644 Binary files a/general/echo/umdf2/driver/AutoSync/echoum.inx and b/general/echo/umdf2/driver/AutoSync/echoum.inx differ -- cgit v1.3.1 From 670397ed629b8488beef603d5a6659f104e85e16 Mon Sep 17 00:00:00 2001 From: Wei Mao Date: Tue, 7 Mar 2023 17:49:46 -0800 Subject: Remove UMDF v1 samples - nfp (#912) [UMDF v1] Remove nfp/net/driver/NetNfpProvider --- nfp/net/README.md | 2 + nfp/net/driver/Connection.cpp | 296 --------- nfp/net/driver/FileContext.cpp | 713 ---------------------- nfp/net/driver/FileContext.h | 340 ----------- nfp/net/driver/NetNfpProvider.vcxproj | 276 --------- nfp/net/driver/NetNfpProvider.vcxproj.Filters | 88 --- nfp/net/driver/Queue.cpp | 824 -------------------------- nfp/net/driver/Queue.h | 175 ------ nfp/net/driver/connection.h | 125 ---- nfp/net/driver/device.cpp | 261 -------- nfp/net/driver/device.h | 73 --- nfp/net/driver/dllsup.cpp | 112 ---- nfp/net/driver/driver.cpp | 150 ----- nfp/net/driver/driver.h | 53 -- nfp/net/driver/exports.def | 6 - nfp/net/driver/internal.h | 152 ----- nfp/net/driver/list.h | 119 ---- nfp/net/driver/netnfpprovider.inx | Bin 3870 -> 0 bytes nfp/net/driver/netnfpprovider.rc | 18 - nfp/net/driver/socketlistener.cpp | 222 ------- nfp/net/driver/socketlistener.h | 84 --- nfp/net/driver/wppdefs.h | 452 -------------- nfp/net/netnfp.sln | 13 - 23 files changed, 2 insertions(+), 4552 deletions(-) delete mode 100644 nfp/net/driver/Connection.cpp delete mode 100644 nfp/net/driver/FileContext.cpp delete mode 100644 nfp/net/driver/FileContext.h delete mode 100644 nfp/net/driver/NetNfpProvider.vcxproj delete mode 100644 nfp/net/driver/NetNfpProvider.vcxproj.Filters delete mode 100644 nfp/net/driver/Queue.cpp delete mode 100644 nfp/net/driver/Queue.h delete mode 100644 nfp/net/driver/connection.h delete mode 100644 nfp/net/driver/device.cpp delete mode 100644 nfp/net/driver/device.h delete mode 100644 nfp/net/driver/dllsup.cpp delete mode 100644 nfp/net/driver/driver.cpp delete mode 100644 nfp/net/driver/driver.h delete mode 100644 nfp/net/driver/exports.def delete mode 100644 nfp/net/driver/internal.h delete mode 100644 nfp/net/driver/list.h delete mode 100644 nfp/net/driver/netnfpprovider.inx delete mode 100644 nfp/net/driver/netnfpprovider.rc delete mode 100644 nfp/net/driver/socketlistener.cpp delete mode 100644 nfp/net/driver/socketlistener.h delete mode 100644 nfp/net/driver/wppdefs.h diff --git a/nfp/net/README.md b/nfp/net/README.md index 0df76029..159d2697 100644 --- a/nfp/net/README.md +++ b/nfp/net/README.md @@ -14,6 +14,8 @@ products: > UMDF 2 is the latest version of UMDF and supersedes UMDF 1. All new UMDF drivers should be written using UMDF 2. No new features are being added to UMDF 1 and there is limited support for UMDF 1 on newer versions of Windows 10. Universal Windows drivers must use UMDF 2. > > For more info, see [Getting Started with UMDF](https://docs.microsoft.com/windows-hardware/drivers/wdf/getting-started-with-umdf-version-2). +> +> The UMDF v1 sample can be accessed using `git checkout win11-22h2`. A direct link is: https://github.com/microsoft/Windows-driver-samples/tree/win11-22h2 This sample demonstrates how to use User-Mode Driver Framework (UMDF) version 1 to write a near-field proximity driver. diff --git a/nfp/net/driver/Connection.cpp b/nfp/net/driver/Connection.cpp deleted file mode 100644 index 1aed9008..00000000 --- a/nfp/net/driver/Connection.cpp +++ /dev/null @@ -1,296 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Author: - - Travis Martin (TravM) 06-24-2010 - ---*/ -#include "internal.h" - -#include "Connection.tmh" - -HRESULT SetSocketIpv6Only(_In_ SOCKET socket, _In_ BOOL Ipv6Only); - -HRESULT SynchronousReadSocket(_In_ SOCKET Socket, _In_reads_bytes_(cbBuffer) PVOID pBuffer, _In_ DWORD cbBuffer) -{ - HRESULT hr = S_OK; - DWORD dwIgnore; - OVERLAPPED Overlapped; - ZeroMemory(&Overlapped, sizeof(Overlapped)); - if (!ReadFile((HANDLE)Socket, pBuffer, cbBuffer, &dwIgnore, &Overlapped)) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - if (hr == HRESULT_FROM_WIN32(ERROR_IO_PENDING)) - { - if (!GetOverlappedResult((HANDLE)Socket, &Overlapped, &dwIgnore, TRUE)) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - else - { - hr = S_OK; - } - } - } - return hr; -} - -//CConnection -// static -HRESULT CConnection::Create(_In_ IConnectionCallback* pCallback, _Outptr_ CConnection** ppConnection) -{ - CConnection* pConnection; - pConnection = new CConnection(pCallback); - HRESULT hr = (pConnection != NULL ? S_OK : E_OUTOFMEMORY); - if (SUCCEEDED(hr)) - { - *ppConnection = pConnection; - } - - return hr; -} - -void CConnection::Terminate() -{ - MethodEntry("void"); - - // Only want to terminate once - STATE PriorState = (STATE)(InterlockedExchange((long*)&_State, (long)TERMINATED)); - if (PriorState != TERMINATED) - { - // Graceful shutdown - shutdown(_Socket, SD_SEND); - - // Don't wait for threadpool callbacks when this thread is actually the threadpool callback - if (_ThreadpoolThreadId != GetCurrentThreadId()) - { - // Let the ReceiveThreadProc gracefully shutdown - WaitForThreadpoolWorkCallbacks(_ThreadpoolWork, false); - } - - SOCKET Socket = (SOCKET)InterlockedExchangePointer((PVOID*)&_Socket, (PVOID)INVALID_SOCKET); - if (Socket != INVALID_SOCKET) - { - closesocket(Socket); - } - } - - MethodReturnVoid(); -} - -/* 9C7D2C68-5AD8-4A14-BE20-F8741D60D100 */ -const GUID MAGIC_PACKET = - {0x9C7D2C68, 0x5AD8, 0x4A14, {0xBE, 0x20, 0xF8, 0x74, 0x1D, 0x60, 0xD1, 0x00}}; - -HRESULT CConnection::InitializeAsClient(_In_ BEGIN_PROXIMITY_ARGS* pArgs) -{ - pArgs->szName[MAX_PATH-1] = L'\0'; - - MethodEntry("pArgs->szName = '%S'", - pArgs->szName); - - // Open a TCP/IP Socket to the remote Network NearFieldProximity device - HRESULT hr = S_OK; - - _Socket = socket(AF_INET6, SOCK_STREAM, 0); - if (_Socket == INVALID_SOCKET) - { - hr = HRESULT_FROM_WIN32(WSAGetLastError()); - } - - if (SUCCEEDED(hr)) - { - hr = SetSocketIpv6Only(_Socket, FALSE); - } - - if (SUCCEEDED(hr)) - { - SOCKADDR_STORAGE LocalAddress = {}; - SOCKADDR_STORAGE RemoteAddress = {}; - DWORD cbLocalAddress = sizeof(LocalAddress); - DWORD cbRemoteAddress = sizeof(RemoteAddress); - timeval Timeout = {8, 0}; - if (!WSAConnectByName(_Socket, pArgs->szName, L"9299", - &cbLocalAddress, (SOCKADDR*)&LocalAddress, - &cbRemoteAddress, (SOCKADDR*)&RemoteAddress, &Timeout, NULL)) - { - hr = HRESULT_FROM_WIN32(WSAGetLastError()); - TraceErrorHR(hr, L"WSAConnectByName FAILED"); - } - } - - if (SUCCEEDED(hr)) - { - if (setsockopt(_Socket, SOL_SOCKET, SO_UPDATE_CONNECT_CONTEXT, NULL, 0) == SOCKET_ERROR) - { - hr = HRESULT_FROM_WIN32(WSAGetLastError()); - } - } - - if (SUCCEEDED(hr)) - { - // Send the Magic Packet - if (send(_Socket, (char*)&MAGIC_PACKET, sizeof(MAGIC_PACKET), 0) == SOCKET_ERROR) - { - hr = HRESULT_FROM_WIN32(WSAGetLastError()); - } - - if (SUCCEEDED(hr)) - { - GUID MagicPacket = {}; - hr = SynchronousReadSocket(_Socket, &MagicPacket, sizeof(MagicPacket)); - if (SUCCEEDED(hr)) - { - if (memcmp(&MagicPacket, &MAGIC_PACKET, sizeof(MAGIC_PACKET)) != 0) - { - hr = E_FAIL; - } - } - } - - if (SUCCEEDED(hr)) - { - // This doesn't take the socket, because we're the client and already - // have the socket in _Socket. - hr = FinalizeEstablish(INVALID_SOCKET); - } - } - - - if (FAILED(hr)) - { - if (_Socket != INVALID_SOCKET) - { - // Abortive shutdown of the socket - closesocket(_Socket); - _Socket = INVALID_SOCKET; - } - } - - MethodReturnHR(hr); -} - -void CConnection::ValidateAccept(_In_ SOCKET Socket, _In_ GUID* pMagicPacket) -{ - MethodEntry("..."); - - TraceASSERT(Socket != INVALID_SOCKET); - - HRESULT hr = S_OK; - if (memcmp(pMagicPacket, &MAGIC_PACKET, sizeof(MAGIC_PACKET)) != 0) - { - hr = E_FAIL; - } - - if (SUCCEEDED(hr)) - { - // Send the MAGIC_PACKET - if (send(Socket, (char*)&MAGIC_PACKET, sizeof(MAGIC_PACKET), 0) == SOCKET_ERROR) - { - hr = HRESULT_FROM_WIN32(WSAGetLastError()); - } - } - - if (SUCCEEDED(hr)) - { - hr = FinalizeEstablish(Socket); - } - - if (FAILED(hr)) - { - // Abortive shutdown of the socket - closesocket(Socket); - } - - MethodReturnVoid(); -} - -HRESULT CConnection::FinalizeEstablish(_In_ SOCKET Socket) -{ - MethodEntry("..."); - - HRESULT hr = S_OK; - STATE PriorState = (STATE)(InterlockedCompareExchange((long*)&_State, (long)ESTABLISHED, (long)INITIAL)); - if (PriorState != INITIAL) - { - // Already established (or terminated), drop this - hr = HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED); - } - - if (SUCCEEDED(hr)) - { - // Init Threadpool work item for the receieve thread proc. - _ThreadpoolWork = CreateThreadpoolWork(s_ReceiveThreadProc, this, NULL); - if (_ThreadpoolWork == NULL) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - else - { - if (Socket != INVALID_SOCKET) - { - // Take ownership of the socket - _Socket = Socket; - } - SubmitThreadpoolWork(_ThreadpoolWork); - - _pCallback->ConnectionEstablished(this); - } - } - - MethodReturnHR(hr); -} - -BOOL CConnection::ReceiveThreadProc() -{ - MethodEntry("void"); - - MESSAGE* pMessage = new MESSAGE(); - if (pMessage == NULL) - { - Terminate(); - } - else - { - while (_Socket != INVALID_SOCKET) - { - if (recv(_Socket, (char*)pMessage, sizeof(*pMessage), MSG_WAITALL) == sizeof(*pMessage)) - { - _pCallback->HandleReceivedMessage(pMessage); - } - else - { - Terminate(); - break; - } - } - delete pMessage; - } - - // The connection is now terminated - BOOL fConnectionDeleted = _pCallback->ConnectionTerminated(this); - - MethodReturnBool(fConnectionDeleted); -} - -HRESULT CConnection::TransmitMessage(_In_ MESSAGE* pMessage) -{ - HRESULT hr = S_OK; - if (_Socket == INVALID_SOCKET) - { - hr = HRESULT_FROM_WIN32(WSAENOTSOCK); - } - else - { - if (send(_Socket, (char*)pMessage, sizeof(*pMessage), 0) == SOCKET_ERROR) - { - hr = HRESULT_FROM_WIN32(WSAGetLastError()); - Terminate(); - } - } - - return hr; -} - diff --git a/nfp/net/driver/FileContext.cpp b/nfp/net/driver/FileContext.cpp deleted file mode 100644 index 193c637a..00000000 --- a/nfp/net/driver/FileContext.cpp +++ /dev/null @@ -1,713 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - filecontext.cpp - -Abstract: - - This file implements the class for context associated with the file object - -Environment: - - user mode only - -Revision History: - ---*/ -#include "internal.h" - -#include "FileContext.tmh" - -CFileContext::~CFileContext() -{ - MethodEntry("void"); - - while (!IsListEmpty(&m_SubscribedMessageQueue)) - { - delete CMyPayload::FromListEntry(RemoveHeadList(&m_SubscribedMessageQueue)); - } - - if (m_pszType != NULL) - { - delete [] m_pszType; - m_pszType = NULL; - } - - if (m_pConnection != NULL) - { - delete m_pConnection; - m_pConnection = NULL; - } - - m_pWdfFile = NULL; - - EnterCriticalSection(&m_RoleLock); - CompleteRequest(E_ABORT, 0, true); - LeaveCriticalSection(&m_RoleLock); - - DeleteCriticalSection(&m_RoleLock); - - MethodReturnVoid(); -} - -HRESULT -CFileContext::Disable() -{ - MethodEntry("void"); - - EnterCriticalSection(&m_RoleLock); - - HRESULT hr = S_OK; - if ((m_Role == ROLE_UNDEFINED) || (m_Role == ROLE_PROXIMITY)) - { - // Only Pub/Sub handles can be disabled - hr = HRESULT_FROM_NT(STATUS_INVALID_DEVICE_STATE); - } - - if (!m_fEnabled) - { - // Already disabled - hr = HRESULT_FROM_NT(STATUS_INVALID_DEVICE_STATE); - } - - if (SUCCEEDED(hr)) - { - m_fEnabled = FALSE; - - CompleteRequest(HRESULT_FROM_NT(STATUS_CANCELLED), 0, true); - - // Purge all already received payloads - while (!IsListEmpty(&m_SubscribedMessageQueue)) - { - delete CMyPayload::FromListEntry(RemoveHeadList(&m_SubscribedMessageQueue)); - } - } - - LeaveCriticalSection(&m_RoleLock); - - MethodReturnHR(hr); -} - -HRESULT -CFileContext::Enable() -{ - MethodEntry("void"); - - EnterCriticalSection(&m_RoleLock); - - HRESULT hr = S_OK; - if ((m_Role == ROLE_UNDEFINED) || (m_Role == ROLE_PROXIMITY)) - { - // Only Pub/Sub handles can be enabled - hr = HRESULT_FROM_NT(STATUS_INVALID_DEVICE_STATE); - } - - if (m_fEnabled) - { - // Already enabled - hr = HRESULT_FROM_NT(STATUS_INVALID_DEVICE_STATE); - } - - if (SUCCEEDED(hr)) - { - m_fEnabled = TRUE; - } - - LeaveCriticalSection(&m_RoleLock); - - MethodReturnHR(hr); -} - -HRESULT -CFileContext::SetType(_In_ PCWSTR pszType) -{ - MethodEntry("pszType = '%S'", pszType); - - HRESULT hr = S_OK; - WUDF_SAMPLE_DRIVER_ASSERT(m_pszType == NULL); - - SIZE_T cchStr = wcslen(pszType) + 1; - if ((cchStr > MinCchType) && (cchStr < MaxCchType)) - { - m_pszType = new WCHAR[cchStr]; - if (m_pszType != NULL) - { - hr = StringCchCopy(m_pszType, cchStr, pszType); - } - else - { - hr = E_OUTOFMEMORY; - } - } - else - { - hr = E_INVALIDARG; - } - - MethodReturnHR(hr); -} - -#define STATUS_BUFFER_TOO_SMALL 0xC0000023L -#define STATUS_BUFFER_OVERFLOW 0x80000005L - - -bool -CFileContext::CompleteOneGetNextSubscribedMessage( - _In_ DWORD cbPayload, - _In_reads_bytes_opt_(cbPayload) PBYTE pbPayload - ) -/* - * m_RoleLock must already be acquired - */ -{ - MethodEntry("cbPayload = 0x%d", - (DWORD)cbPayload); - - WUDF_SAMPLE_DRIVER_ASSERT(m_pWdfRequest != NULL); - - bool fDelivered = false; - IWDFMemory* pWdfOutputMemory; - m_pWdfRequest->GetOutputMemory(&pWdfOutputMemory); - if (pWdfOutputMemory != NULL) - { - SIZE_T cbOutputBuffer = 0; - // Set the first 4 bytes as the size of the payload as a hint for future - // subscriptions. - HRESULT hr = pWdfOutputMemory->CopyFromBuffer(0, &cbPayload, 4); - if (SUCCEEDED(hr)) - { - cbOutputBuffer = 4; - if (pbPayload != NULL) - { - if (pWdfOutputMemory->GetSize() < (cbPayload + 4)) - { - // We are unable to copy the payload into the output memory, - // Returning this signals to the client to send a bigger buffer - hr = HRESULT_FROM_NT(STATUS_BUFFER_OVERFLOW); - } - else - { - hr = pWdfOutputMemory->CopyFromBuffer(4, pbPayload, cbPayload); - } - } - - if (SUCCEEDED(hr)) - { - fDelivered = true; - cbOutputBuffer += cbPayload; - if (m_dwQueueSize > 0) - { - m_dwQueueSize--; - } - } - } - pWdfOutputMemory->Release(); - - if (!CompleteRequest(hr, cbOutputBuffer, true)) - { - fDelivered = false; - } - } - - MethodReturnBool(fDelivered); -} - -HRESULT -CFileContext::GetNextSubscribedMessage(_In_ IRequestCallbackCancel* pCallbackCancel, _In_ IWDFIoRequest* pWdfRequest) -{ - MethodEntry("..."); - - EnterCriticalSection(&m_RoleLock); - - HRESULT hr = S_OK; - if (m_pWdfRequest != NULL) - { - // Only one pended request at a time allowed - hr = HRESULT_FROM_NT(STATUS_INVALID_DEVICE_STATE); - } - - if (!m_fEnabled) - { - // The handle is disabled - hr = HRESULT_FROM_NT(HRESULT_FROM_NT(STATUS_CANCELLED)); - } - - if (SUCCEEDED(hr)) - { - IWDFMemory* pWdfInputMemory; - pWdfRequest->GetInputMemory(&pWdfInputMemory); - SIZE_T cbInput; - if (pWdfInputMemory->GetDataBuffer(&cbInput) == NULL) - { - if (m_Role == ROLE_SUBSCRIPTION) - { - m_pWdfRequest = pWdfRequest; - m_pWdfRequest->MarkCancelable(pCallbackCancel); // MarkCancelable can run the OnCancel routine in this thread - - if ((m_pWdfRequest != NULL) && !IsListEmpty(&m_SubscribedMessageQueue)) - { - CMyPayload* pMyPayload = - CMyPayload::FromListEntry(m_SubscribedMessageQueue.Flink); - - if (CompleteOneGetNextSubscribedMessage(pMyPayload->GetSize(), - pMyPayload->GetPayload())) - { - RemoveHeadList(&m_SubscribedMessageQueue); - delete pMyPayload; - } - } - } - else if (m_Role == ROLE_ARRIVEDSUBSCRIPTION) - { - m_pWdfRequest = pWdfRequest; - m_pWdfRequest->MarkCancelable(pCallbackCancel); // MarkCancelable can run the OnCancel routine in this thread - if (m_pWdfRequest != NULL) - { - CompleteOneArrivalEvent(); - } - } - else if (m_Role == ROLE_DEPARTEDSUBSCRIPTION) - { - m_pWdfRequest = pWdfRequest; - m_pWdfRequest->MarkCancelable(pCallbackCancel); // MarkCancelable can run the OnCancel routine in this thread - if (m_pWdfRequest != NULL) - { - CompleteOneRemovalEvent(); - } - } - else - { - hr = HRESULT_FROM_NT(STATUS_INVALID_DEVICE_STATE); - } - } - else - { - hr = E_INVALIDARG; - } - pWdfInputMemory->Release(); - } - - LeaveCriticalSection(&m_RoleLock); - - MethodReturnHR(hr); -} - -HRESULT -CFileContext::SetPayload(_In_ IWDFIoRequest* pWdfRequest) -{ - MethodEntry("..."); - - EnterCriticalSection(&m_RoleLock); - - HRESULT hr = S_OK; - if ((m_Role != ROLE_PUBLICATION) || (m_MyPayload.GetPayload() != NULL)) - { - // SetPayload can only be called once per handle - hr = HRESULT_FROM_NT(STATUS_INVALID_DEVICE_STATE); - } - - if (SUCCEEDED(hr)) - { - IWDFMemory* pWdfOutputMemory; - pWdfRequest->GetOutputMemory(&pWdfOutputMemory); - SIZE_T cbOutput; - if (pWdfOutputMemory->GetDataBuffer(&cbOutput) == NULL) - { - IWDFMemory* pWdfMemory; - pWdfRequest->GetInputMemory(&pWdfMemory); - if (pWdfMemory != NULL) - { - SIZE_T cbPayload = pWdfMemory->GetSize(); - if ((cbPayload > 0) && (cbPayload <= MaxCbPayload)) - { - hr = m_MyPayload.Initialize((DWORD)cbPayload, (PBYTE)pWdfMemory->GetDataBuffer(NULL)); - } - else - { - hr = HRESULT_FROM_NT(STATUS_INVALID_BUFFER_SIZE); - } - - pWdfMemory->Release(); - } - else - { - hr = E_INVALIDARG; - } - pWdfOutputMemory->Release(); - } - else - { - hr = E_INVALIDARG; - } - } - - LeaveCriticalSection(&m_RoleLock); - - MethodReturnHR(hr); -} - -HRESULT -CFileContext::GetNextTransmittedMessage(_In_ IRequestCallbackCancel* pCallbackCancel, _In_ IWDFIoRequest* pWdfRequest) -{ - MethodEntry("..."); - - EnterCriticalSection(&m_RoleLock); - - HRESULT hr = S_OK; - if ((m_Role != ROLE_PUBLICATION) || (m_pWdfRequest != NULL)) - { - // Only one pended request at a time allowed - hr = HRESULT_FROM_NT(STATUS_INVALID_DEVICE_STATE); - } - - if (!m_fEnabled) - { - // The handle is disabled - hr = HRESULT_FROM_NT(HRESULT_FROM_NT(STATUS_CANCELLED)); - } - - if (SUCCEEDED(hr)) - { - IWDFMemory* pWdfInputMemory; - pWdfRequest->GetInputMemory(&pWdfInputMemory); - SIZE_T cbInput; - if (pWdfInputMemory->GetDataBuffer(&cbInput) == NULL) - { - IWDFMemory* pWdfOutputMemory; - pWdfRequest->GetOutputMemory(&pWdfOutputMemory); - SIZE_T cbOutput; - if (pWdfOutputMemory->GetDataBuffer(&cbOutput) == NULL) - { - m_pWdfRequest = pWdfRequest; - - if (m_cCompleteReady > 0) - { - if (CompleteRequest(S_OK, 0, false)) - { - m_cCompleteReady--; - } - } - } - else - { - hr = E_INVALIDARG; - } - pWdfOutputMemory->Release(); - } - else - { - hr = E_INVALIDARG; - } - pWdfInputMemory->Release(); - } - - if (SUCCEEDED(hr) && (m_pWdfRequest != NULL)) - { - m_pWdfRequest->MarkCancelable(pCallbackCancel); - } - - LeaveCriticalSection(&m_RoleLock); - - MethodReturnHR(hr); -} - -HRESULT -CFileContext::BeginProximity( - _In_ IWDFIoRequest* pWdfRequest, - _In_ IConnectionCallback* pCallback - ) -{ - MethodEntry("..."); - - EnterCriticalSection(&m_RoleLock); - - HRESULT hr = S_OK; - if (m_Role != ROLE_UNDEFINED) - { - // BeginProximity can only be called once per handle - hr = HRESULT_FROM_NT(STATUS_INVALID_DEVICE_STATE); - } - else - { - m_Role = ROLE_PROXIMITY; - } - - LeaveCriticalSection(&m_RoleLock); - - if (SUCCEEDED(hr)) - { - IWDFMemory* pWdfMemory; - pWdfRequest->GetInputMemory(&pWdfMemory); - if (pWdfMemory != NULL) - { - if (pWdfMemory->GetSize() == sizeof(BEGIN_PROXIMITY_ARGS)) - { - hr = CConnection::Create(pCallback, &m_pConnection); - if (SUCCEEDED(hr)) - { - BEGIN_PROXIMITY_ARGS* pArgs = - (BEGIN_PROXIMITY_ARGS*)pWdfMemory->GetDataBuffer(NULL); - hr = m_pConnection->InitializeAsClient(pArgs); - } - } - else - { - hr = E_INVALIDARG; - } - - pWdfMemory->Release(); - } - else - { - hr = E_INVALIDARG; - } - } - - - if (FAILED(hr)) - { - m_pConnection = NULL; - } - - MethodReturnHR(hr); -} - -VOID -CFileContext::HandleArrivalEvent() -{ - WUDF_SAMPLE_DRIVER_ASSERT(m_Role == ROLE_ARRIVEDSUBSCRIPTION); - - EnterCriticalSection(&m_RoleLock); - - if (m_fEnabled) - { - m_cCompleteReady++; - CompleteOneArrivalEvent(); - } - - LeaveCriticalSection(&m_RoleLock); -} - -VOID -CFileContext::HandleRemovalEvent() -{ - WUDF_SAMPLE_DRIVER_ASSERT(m_Role == ROLE_DEPARTEDSUBSCRIPTION); - - EnterCriticalSection(&m_RoleLock); - - if (m_fEnabled) - { - m_cCompleteReady++; - CompleteOneRemovalEvent(); - } - - LeaveCriticalSection(&m_RoleLock); -} - -VOID -CFileContext::CompleteOneArrivalEvent() -{ - MethodEntry("void"); - - WUDF_SAMPLE_DRIVER_ASSERT(m_Role == ROLE_ARRIVEDSUBSCRIPTION); - - EnterCriticalSection(&m_RoleLock); - - if (m_cCompleteReady > 0) - { - if (m_pWdfRequest != NULL) - { - // Arrival payload should either be a DWORD = 1 or 0 - // 1 == Device capable of bi-directional communication - // 0 == Device is a dumb tag - DWORD ArrivalFlags = 0x1; - if (CompleteOneGetNextSubscribedMessage(sizeof(ArrivalFlags), (PBYTE)&ArrivalFlags)) - { - m_cCompleteReady--; - } - } - } - - LeaveCriticalSection(&m_RoleLock); - - MethodReturnVoid(); -} - -VOID -CFileContext::CompleteOneRemovalEvent() -{ - MethodEntry("void"); - - WUDF_SAMPLE_DRIVER_ASSERT(m_Role == ROLE_DEPARTEDSUBSCRIPTION); - - EnterCriticalSection(&m_RoleLock); - - if (m_cCompleteReady > 0) - { - if (m_pWdfRequest != NULL) - { - // Removal payload should be a single zeroed DWORD - DWORD RemovalFlags = 0x0; - if (CompleteOneGetNextSubscribedMessage(sizeof(RemovalFlags), (PBYTE)&RemovalFlags)) - { - m_cCompleteReady--; - } - } - } - - LeaveCriticalSection(&m_RoleLock); - - MethodReturnVoid(); -} - -void -CFileContext::HandleReceivedPublication( - _In_ PCWSTR pszType, - _In_ DWORD cbPayload, - _In_reads_bytes_(cbPayload) PBYTE pbPayload - ) -{ - MethodEntry("..."); - - WUDF_SAMPLE_DRIVER_ASSERT(m_Role == ROLE_SUBSCRIPTION); - - EnterCriticalSection(&m_RoleLock); - - if (m_fEnabled) - { - bool fSubscriptionMatches = false; - BYTE* pbNewPayload = NULL; - - if ((CompareStringOrdinal(m_pszType, -1, WINDOWSMIME_PROTOCOL, -1, FALSE) == CSTR_EQUAL) && - (wcslen(pszType) > WINDOWSMIME_PROTOCOL_CHARS) && - (CompareStringOrdinal(pszType, WINDOWSMIME_PROTOCOL_CHARS, - WINDOWSMIME_PROTOCOL, -1, FALSE) == CSTR_EQUAL)) - { - // If this is a WindowsMime message, and the subscription is for the general WINDOWSMIME_PROTOCOL type, - // the Mime type needs to be added to the message payload. - CHAR szMimeType[MaxCchMimeType + 1] = {}; - // Copy the mime type and convert from wide to multibyte chars - if (SUCCEEDED(StringCchPrintfA(szMimeType, ARRAYSIZE(szMimeType), "%S", pszType + WINDOWSMIME_PROTOCOL_CHARS + 1))) - { - pbNewPayload = new BYTE[cbPayload + MaxCchMimeType]; - if (pbNewPayload != NULL) - { - TraceInfo("Received Mime message of type = '%s'", szMimeType); - CopyMemory(pbNewPayload, szMimeType, MaxCchMimeType); - CopyMemory(pbNewPayload + MaxCchMimeType, pbPayload, cbPayload); - cbPayload += MaxCchMimeType; - pbPayload = pbNewPayload; - - fSubscriptionMatches = true; - } - } - } - else if (CompareStringOrdinal(pszType, -1, m_pszType, -1, FALSE) == CSTR_EQUAL) - { - fSubscriptionMatches = true; - } - - if (fSubscriptionMatches) - { - bool fDelivered = false; - - if (m_pWdfRequest != NULL) - { - fDelivered = CompleteOneGetNextSubscribedMessage(cbPayload, pbPayload); - } - - if ((!fDelivered) && (m_dwQueueSize < MAX_MESSAGE_QUEUE_SIZE)) - { - // Add message to the client delivery queue - - CMyPayload* pMyPayload = new CMyPayload(); - if (pMyPayload) - { - if (SUCCEEDED(pMyPayload->Initialize(cbPayload, pbPayload))) - { - InsertTailList(&m_SubscribedMessageQueue, pMyPayload->GetListEntry()); - m_dwQueueSize++; - } - else - { - delete pMyPayload; - } - } - } - } - - delete [] pbNewPayload; - } - else - { - TraceErrorHR(HRESULT_FROM_NT(STATUS_CANCELLED), "Subscription Disabled!"); - } - - LeaveCriticalSection(&m_RoleLock); - - MethodReturnVoid(); -} - -void -CFileContext::HandleMessageTransmitted() -{ - MethodEntry("void"); - - WUDF_SAMPLE_DRIVER_ASSERT(m_Role == ROLE_PUBLICATION); - - EnterCriticalSection(&m_RoleLock); - - if (!CompleteRequest(S_OK, 0, true)) - { - m_cCompleteReady++; - } - - LeaveCriticalSection(&m_RoleLock); - - MethodReturnVoid(); -} - -void -CFileContext::OnCancel() -{ - EnterCriticalSection(&m_RoleLock); - - CompleteRequest(E_ABORT, 0, false); - - LeaveCriticalSection(&m_RoleLock); -} - -bool -CFileContext::CompleteRequest(_In_ HRESULT hr, _In_ SIZE_T cbSize, _In_ bool fIsCancelable) -/* - * m_RoleLock must already be acquired - */ -{ - MethodEntry("hr = %!HRESULT!, cbSize = %d, fIsCancelable = %!bool!", - hr, (DWORD)cbSize, fIsCancelable); - - bool fCompleted = false; - if (m_pWdfRequest != NULL) - { - bool fCompleteRequest = true; - if (fIsCancelable) - { - if (m_pWdfRequest->UnmarkCancelable() == HRESULT_FROM_WIN32(ERROR_OPERATION_ABORTED)) - { - fCompleteRequest = false; - } - } - - if (fCompleteRequest) - { - m_pWdfRequest->CompleteWithInformation(hr, cbSize); - m_pWdfRequest = NULL; - fCompleted = true; - } - } - - MethodReturnBool(fCompleted); -} diff --git a/nfp/net/driver/FileContext.h b/nfp/net/driver/FileContext.h deleted file mode 100644 index 0247636e..00000000 --- a/nfp/net/driver/FileContext.h +++ /dev/null @@ -1,340 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - filecontext.h - -Abstract: - - This header file defines the structure type for context associated with the file object - -Environment: - - user mode only - -Revision History: - ---*/ -#pragma once - -class CMyPayload -{ -public: - CMyPayload() - { - m_pbPayload = NULL; - m_cbPayload = 0; - - InitializeListHead(&m_ListEntry); - } - ~CMyPayload() - { - if (m_pbPayload != NULL) - { - delete [] m_pbPayload; - m_pbPayload = NULL; - } - } - - STDMETHOD(Initialize)( - _In_ DWORD cbPayload, - _In_reads_bytes_(cbPayload) PBYTE pbPayload - ) - { - HRESULT hr = S_OK; - m_pbPayload = new BYTE[cbPayload]; - if (m_pbPayload != NULL) - { - m_cbPayload = cbPayload; - CopyMemory(m_pbPayload, pbPayload, cbPayload); - } - else - { - hr = E_OUTOFMEMORY; - } - - return hr; - } - - PBYTE GetPayload() - { - return m_pbPayload; - } - DWORD GetSize() - { - return m_cbPayload; - } - - PLIST_ENTRY GetListEntry() - { - return &m_ListEntry; - } - static CMyPayload* FromListEntry(PLIST_ENTRY pEntry) - { - return (CMyPayload*) CONTAINING_RECORD(pEntry, CMyPayload, m_ListEntry); - } - -private: - PBYTE m_pbPayload; - DWORD m_cbPayload; - - LIST_ENTRY m_ListEntry; -}; - -/* - * Use this to refactor to only keep one copy of received messages - * -class CMyPayloadItem -{ -public: - CMyPayloadItem(_In_ CMyPayload* pPayload) - { - m_spPayload = pPayload; - InitializeListHead(&m_ListEntry); - } - ~CMyPayloadItem() - { - } - - PBYTE GetPayload() - { - return m_spPayload->GetPayload(); - } - DWORD GetSize() - { - return m_spPayload->GetSize(); - } - - PLIST_ENTRY GetListEntry() - { - return &m_ListEntry; - } - static CMyPayloadItem* FromListEntry(PLIST_ENTRY pEntry) - { - return (CMyPayloadItem*) CONTAINING_RECORD(pEntry, CMyPayloadItem, m_ListEntry); - } - -private: - CComPtr m_spPayload; - - LIST_ENTRY m_ListEntry; -}; -*/ - -class CFileContext -{ -public: - - CFileContext() : - m_Role(ROLE_UNDEFINED), - m_pszType(NULL), - m_fEnabled(TRUE), - m_dwQueueSize(0), - m_cCompleteReady(0), - m_pConnection(NULL), - m_pWdfRequest(NULL) - { - InitializeListHead(&m_SubscribedMessageQueue); - - InitializeListHead(&m_ListEntry); - - InitializeCriticalSection(&m_RoleLock); - } - - ~CFileContext(); - - HRESULT - Disable(); - - HRESULT - Enable(); - - HRESULT - SetType(_In_ PCWSTR pszType); - - HRESULT - GetNextSubscribedMessage(_In_ IRequestCallbackCancel* pCallbackCancel, _In_ IWDFIoRequest* pWdfRequest); - - HRESULT - SetPayload(_In_ IWDFIoRequest* pWdfRequest); - - HRESULT - GetNextTransmittedMessage(_In_ IRequestCallbackCancel* pCallbackCancel, _In_ IWDFIoRequest* pWdfRequest); - - HRESULT - BeginProximity( - _In_ IWDFIoRequest* pWdfRequest, - _In_ IConnectionCallback* pCallback - ); - - VOID - HandleArrivalEvent(); - VOID - HandleRemovalEvent(); - - void - HandleReceivedPublication( - _In_ PCWSTR pszType, - _In_ DWORD cbPayload, - _In_reads_bytes_(cbPayload) PBYTE pbPayload - ); - - void - HandleMessageTransmitted(); - - void - OnCancel(); - - void - SetRoleSubcription() - { - m_Role = ROLE_SUBSCRIPTION; - } - - void - SetRolePublication() - { - m_Role = ROLE_PUBLICATION; - } - - BOOL - SetRoleArrivedSubcription() - { - if (m_Role == ROLE_SUBSCRIPTION) - { - m_Role = ROLE_ARRIVEDSUBSCRIPTION; - return TRUE; - } - return FALSE; - } - - BOOL - SetRoleDepartedSubcription() - { - if (m_Role == ROLE_SUBSCRIPTION) - { - m_Role = ROLE_DEPARTEDSUBSCRIPTION; - return TRUE; - } - return FALSE; - } - - BOOL - IsNormalSubscription() - { - return (m_Role == ROLE_SUBSCRIPTION); - } - BOOL - IsArrivedSubscription() - { - return (m_Role == ROLE_ARRIVEDSUBSCRIPTION); - } - BOOL - IsDepartedSubscription() - { - return (m_Role == ROLE_DEPARTEDSUBSCRIPTION); - } - BOOL - IsSubscription() - { - return (m_Role == ROLE_SUBSCRIPTION); - } - BOOL - IsPublication() - { - return (m_Role == ROLE_PUBLICATION); - } - - PCWSTR - GetType() - { - return m_pszType; - } - - DWORD - GetSize() - { - return m_MyPayload.GetSize(); - } - - PBYTE - GetPayload() - { - return m_MyPayload.GetPayload(); - } - - BOOL - IsEnabled() - { - return m_fEnabled; - } - - PLIST_ENTRY GetListEntry() - { - return &m_ListEntry; - } - static CFileContext* FromListEntry(PLIST_ENTRY pEntry) - { - return (CFileContext*) CONTAINING_RECORD(pEntry, CFileContext, m_ListEntry); - } - -private: - - VOID - CompleteOneArrivalEvent(); - VOID - CompleteOneRemovalEvent(); - - bool - CompleteOneGetNextSubscribedMessage( - _In_ DWORD cbPayload, - _In_reads_bytes_opt_(cbPayload) PBYTE pbPayload - ); - - bool - CompleteRequest( - _In_ HRESULT hr, - _In_ SIZE_T cbSize, - _In_ bool fIsCancelable - ); - -private: - - enum ROLE - { - ROLE_UNDEFINED, - ROLE_SUBSCRIPTION, - ROLE_ARRIVEDSUBSCRIPTION, - ROLE_DEPARTEDSUBSCRIPTION, - ROLE_PUBLICATION, - ROLE_PROXIMITY - }; - - ROLE m_Role; - - PWSTR m_pszType; - - BOOL m_fEnabled; - - DWORD m_dwQueueSize; - - // Queue of received messages - LIST_ENTRY m_SubscribedMessageQueue; // Unique to ROLE_SUBSCRIPTION - - CMyPayload m_MyPayload; // Unique to ROLE_PUBLICATION - SIZE_T m_cCompleteReady; // Unique to ROLE_PUBLICATION, ROLE_ARRIVEDSUBSCRIPTION, and ROLE_DEPARTEDSUBSCRIPTION - - CConnection* m_pConnection; // Unique to ROLE_PROXIMITY - - // Pended "Get Next" Request. - IWDFIoRequest* m_pWdfRequest; - - // The Fx File object this CFileObject is a companion to - IWDFFile* m_pWdfFile; - - CRITICAL_SECTION m_RoleLock; - - LIST_ENTRY m_ListEntry; -}; diff --git a/nfp/net/driver/NetNfpProvider.vcxproj b/nfp/net/driver/NetNfpProvider.vcxproj deleted file mode 100644 index f1a034aa..00000000 --- a/nfp/net/driver/NetNfpProvider.vcxproj +++ /dev/null @@ -1,276 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {7CA060D7-267A-48BC-8FAD-F1B6BA53C2FC} - $(MSBuildProjectName) - 1 - Debug - Win32 - {0748320F-1B24-4B57-A2C3-9BF984CB3365} - - - - Windows10 - False - Desktop - UMDF - WindowsUserModeDriver10.0 - DynamicLibrary - - - Windows10 - True - Desktop - UMDF - WindowsUserModeDriver10.0 - DynamicLibrary - - - Windows10 - False - Desktop - UMDF - WindowsUserModeDriver10.0 - DynamicLibrary - - - Windows10 - True - Desktop - UMDF - WindowsUserModeDriver10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - true - true - WppDefs.h - - - $(InfArch) - true - true - .\$(IntDir)\NetNfpProvider.inf - - - true - true - WppDefs.h - - - - NetNfpProvider - Dynamic - - - NetNfpProvider - Dynamic - - - NetNfpProvider - Dynamic - - - NetNfpProvider - Dynamic - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc - - - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc - - - %(AdditionalDependencies);$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ws2_32.lib;$(SDK_LIB_PATH)\mswsock.lib - exports.def - - - sha256 - - - - - true - Level4 - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc - - - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc - - - %(AdditionalDependencies);$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ws2_32.lib;$(SDK_LIB_PATH)\mswsock.lib - exports.def - - - sha256 - - - - - true - Level4 - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc - - - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc - - - %(AdditionalDependencies);$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ws2_32.lib;$(SDK_LIB_PATH)\mswsock.lib - exports.def - - - sha256 - - - - - true - Level4 - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc - - - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc - - - %(AdditionalDependencies);$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ws2_32.lib;$(SDK_LIB_PATH)\mswsock.lib - exports.def - - - sha256 - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/nfp/net/driver/NetNfpProvider.vcxproj.Filters b/nfp/net/driver/NetNfpProvider.vcxproj.Filters deleted file mode 100644 index d19c9067..00000000 --- a/nfp/net/driver/NetNfpProvider.vcxproj.Filters +++ /dev/null @@ -1,88 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {4D4354C7-DA31-4F68-A565-3887F77EDBA7} - - - h;hpp;hxx;hm;inl;inc;xsd - {A34DD649-9226-40E4-9E8B-A7208AA93216} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {4A95486B-95A9-4771-81FD-C76F8CA7FFDD} - - - inf;inv;inx;mof;mc; - {5D7D5FF7-7AC6-413F-9538-509E52CE4046} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Driver Files - - - - - Resource Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - \ No newline at end of file diff --git a/nfp/net/driver/Queue.cpp b/nfp/net/driver/Queue.cpp deleted file mode 100644 index 129a5439..00000000 --- a/nfp/net/driver/Queue.cpp +++ /dev/null @@ -1,824 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - queue.cpp - -Abstract: - - This file implements the I/O queue interface and performs - the read/write/ioctl operations. - -Environment: - - user mode only - -Revision History: - ---*/ -#include "internal.h" - -#include "queue.tmh" - -CMyQueue::CMyQueue( - VOID - ) -{ - InitializeListHead(&m_SubsHead); - InitializeListHead(&m_ArrivalSubsHead); - InitializeListHead(&m_DepartureSubsHead); - InitializeListHead(&m_PubsHead); - InitializeListHead(&m_ConnectionHead); - - InitializeCriticalSection(&m_SubsLock); - InitializeCriticalSection(&m_PubsLock); - InitializeCriticalSection(&m_ConnectionLock); -} - -CMyQueue::~CMyQueue( - VOID - ) -{ - MethodEntry("void"); - - m_SocketListener.StopAccepting(); - - while (!IsListEmpty(&m_ConnectionHead)) - { - delete CConnection::FromListEntry(RemoveHeadList(&m_ConnectionHead)); - } - - DeleteCriticalSection(&m_SubsLock); - DeleteCriticalSection(&m_PubsLock); - DeleteCriticalSection(&m_ConnectionLock); -} - -// -// Initialize -// - -HRESULT -CMyQueue::Initialize( - _In_ CMyDevice * Device - ) -/*++ - -Routine Description: - - Queue Initialize helper routine. - This routine will Create a default parallel queue associated with the Fx device object - and pass the IUnknown for this queue - -Aruments: - Device object pointer - -Return Value: - - S_OK if Initialize succeeds - ---*/ -{ - MethodEntry("..."); - - CComPtr fxQueue; - - HRESULT hr; - - // - // Create the I/O Queue object. - // - { - CComPtr pUnk; - - HRESULT hrQI = this->QueryInterface(__uuidof(IUnknown),(void**)&pUnk); - - WUDF_SAMPLE_DRIVER_ASSERT(SUCCEEDED(hrQI)); - - hr = Device->GetFxDevice()->CreateIoQueue( - pUnk, - TRUE, - WdfIoQueueDispatchParallel, - TRUE, - FALSE, - &fxQueue - ); - } - - if (FAILED(hr)) - { - TraceErrorHR(hr, "Failed to initialize driver queue"); - } - - if (SUCCEEDED(hr)) - { - hr = m_SocketListener.Bind(); - if (FAILED(hr)) - { - TraceErrorHR(hr, "Failed to Bind"); - } - } - - if (SUCCEEDED(hr)) - { - hr = m_SocketListener.EnableAccepting(this); - if (FAILED(hr)) - { - TraceErrorHR(hr, "Failed to EnableAccepting"); - } - } - - if (SUCCEEDED(hr)) - { - m_FxQueue = fxQueue; - } - - MethodReturnHR(hr); -} - -HRESULT -CMyQueue::Configure( - VOID - ) -/*++ - -Routine Description: - - Queue configuration function . - It is called after queue object has been succesfully initialized. - -Aruments: - - NONE - - Return Value: - - S_OK if succeeds. - ---*/ -{ - MethodEntry("void"); - - HRESULT hr = S_OK; - - MethodReturnHR(hr); -} - - -STDMETHODIMP_(void) -CMyQueue::OnCreateFile( - _In_ IWDFIoQueue* /*pWdfQueue*/, - _In_ IWDFIoRequest* pWdfRequest, - _In_ IWDFFile* pWdfFile - ) - -/*++ - -Routine Description: - - Create callback from the framework for this default parallel queue - - The create request will create a socket connection , create a file i/o target associated - with the socket handle for this connection and store in the file object context. - -Aruments: - - pWdfQueue - Framework Queue instance - pWdfRequest - Framework Request instance - pWdfFile - WDF file object for this create - - Return Value: - - VOID - ---*/ -{ - MethodEntry("pWdfRequest = %p, pWdfFile = %p", - pWdfRequest, pWdfFile); - - HRESULT hr = S_OK; - - // - // Create file context for this file object - // - - CFileContext *pContext = new CFileContext(); - if (NULL == pContext) - { - hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); - TraceErrorHR(hr, "Could not create file context"); - } - - if (SUCCEEDED(hr)) - { - DWORD cchFileName = 0; - hr = pWdfFile->RetrieveFileName(NULL, &cchFileName); - if (SUCCEEDED(hr) && (cchFileName > 0) && (cchFileName <= MaxCchType)) - { - // Allocate a buffer big enough for the filename plus some extra to prevent - // overruns in the parsing below: The extra needs to be larger than the biggest - // *_CHARS value. The value 20 is overly big, but allows room to grow without - // hitting the OACR issue again. If the OACR issue is hit, just increase this - // to be larger than the biggest *_CHARS value used below in parsing. - DWORD cchFileNameBuffer = cchFileName + 20; - PWSTR pszFileNameBuffer = new WCHAR[cchFileNameBuffer]; - hr = (pszFileNameBuffer != NULL) ? S_OK : E_OUTOFMEMORY; - if (SUCCEEDED(hr)) - { - ZeroMemory(pszFileNameBuffer, cchFileNameBuffer * sizeof(WCHAR)); - - hr = pWdfFile->RetrieveFileName(pszFileNameBuffer, &cchFileName); - } - - if (SUCCEEDED(hr)) - { - PCWSTR pszFileName = pszFileNameBuffer; - if (pszFileNameBuffer[0] == L'\\') - { - // If it exists, remove the inital slash - pszFileName++; - cchFileName--; - } - - TraceInfo("cchFileName = %d, pszFileName = %S", cchFileName, pszFileName); - - PCWSTR pszProtocol = NULL; - if (CompareStringOrdinal(pszFileName, PUBS_NAMESPACE_CHARS, - PUBS_NAMESPACE, PUBS_NAMESPACE_CHARS, - TRUE) == CSTR_EQUAL) - { - pContext->SetRolePublication(); - pszProtocol = pszFileName + PUBS_NAMESPACE_CHARS; - } - else if (CompareStringOrdinal(pszFileName, SUBS_NAMESPACE_CHARS, - SUBS_NAMESPACE, SUBS_NAMESPACE_CHARS, - TRUE) == CSTR_EQUAL) - { - pContext->SetRoleSubcription(); - pszProtocol = pszFileName + SUBS_NAMESPACE_CHARS; - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - } - - if (SUCCEEDED(hr)) - { - if (CompareStringOrdinal(pszProtocol, WINDOWS_PROTOCOL_CHARS, - WINDOWS_PROTOCOL, WINDOWS_PROTOCOL_CHARS, - TRUE) == CSTR_EQUAL) - { - pContext->SetType(pszProtocol); - } - else if (CompareStringOrdinal(pszProtocol, -1, - WINDOWSURI_PROTOCOL, -1, - TRUE) == CSTR_EQUAL) - { - pContext->SetType(pszProtocol); - } - else if (CompareStringOrdinal(pszProtocol, WINDOWSMIME_PROTOCOL_CHARS, - WINDOWSMIME_PROTOCOL, WINDOWSMIME_PROTOCOL_CHARS, - TRUE) == CSTR_EQUAL) - { - pContext->SetType(pszProtocol); - } - else if (CompareStringOrdinal(pszProtocol, -1, DEVICE_ARRIVED, -1, - TRUE) == CSTR_EQUAL) - { - if (!pContext->SetRoleArrivedSubcription()) - { - hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - } - } - else if (CompareStringOrdinal(pszProtocol, -1, DEVICE_DEPARTED, -1, - TRUE) == CSTR_EQUAL) - { - if (!pContext->SetRoleDepartedSubcription()) - { - hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - } - } - else if (CompareStringOrdinal(pszProtocol, PAIRING_PROTOCOL_CHARS, - PAIRING_PROTOCOL, PAIRING_PROTOCOL_CHARS, - TRUE) == CSTR_EQUAL) - { - pContext->SetType(pszProtocol); - } - else if (CompareStringOrdinal(pszProtocol, NDEF_PROTOCOL_CHARS, - NDEF_PROTOCOL, NDEF_PROTOCOL_CHARS, - TRUE) == CSTR_EQUAL) - { - PCWSTR pszType = pszProtocol + NDEF_PROTOCOL_CHARS; - - if (CompareStringOrdinal(pszType, NDEF_EMPTY_TYPE_CHARS, - NDEF_EMPTY_TYPE, NDEF_EMPTY_TYPE_CHARS, - TRUE) != CSTR_EQUAL) - { - pContext->SetType(pszProtocol); - } - else - { - hr = HRESULT_FROM_NT(STATUS_INVALID_PARAMETER); - } - } - else - { - hr = HRESULT_FROM_NT(STATUS_OBJECT_PATH_NOT_FOUND); - } - } - } - - if (pszFileNameBuffer != NULL) - { - delete [] pszFileNameBuffer; - } - } - } - - if (SUCCEEDED(hr)) - { - hr = pWdfFile->AssignContext(NULL, (void*)pContext); - if (FAILED(hr)) - { - TraceErrorHR(hr, "Unable to Assign Context to this File Object"); - } - } - - if (SUCCEEDED(hr)) - { - EnterCriticalSection(&m_SubsLock); - - if (pContext->IsNormalSubscription()) - { - // Place this CFileContext into a list of Subscriptions - InsertHeadList(&m_SubsHead, pContext->GetListEntry()); - } - else if (pContext->IsArrivedSubscription()) - { - // Place this CFileContext into a list of arrival registrations - InsertHeadList(&m_ArrivalSubsHead, pContext->GetListEntry()); - } - else if (pContext->IsDepartedSubscription()) - { - // Place this CFileContext into a list of removal registrations - InsertHeadList(&m_DepartureSubsHead, pContext->GetListEntry()); - } - - LeaveCriticalSection(&m_SubsLock); - } - - if (FAILED(hr)) - { - if (pContext != NULL) - { - delete pContext; - pContext = NULL; - } - } - - pWdfRequest->Complete(hr); - - MethodReturnVoid(); -} - -STDMETHODIMP_(void) -CMyQueue::OnCloseFile( - _In_ IWDFFile* pWdfFileObject - ) -/*++ - - Routine Description: - - This method is called when an app closes the file handle to this device. - This will free the context memory associated with this file object, close - the connection object associated with this file object and delete the file - handle i/o target object associated with this file object. - - Arguments: - - pWdfFileObject - the framework file object for which close is handled. - - Return Value: - - None - ---*/ -{ - MethodEntry("..."); - - HRESULT hr = S_OK ; - CFileContext* pContext = NULL; - hr = pWdfFileObject->RetrieveContext((void**)&pContext); - if (SUCCEEDED(hr) && (pContext != NULL)) - { - CRITICAL_SECTION* pCritSec = NULL; - LIST_ENTRY* pHead = NULL; - - if (pContext->IsNormalSubscription()) - { - pCritSec = &m_SubsLock; - pHead = &m_SubsHead; - } - else if (pContext->IsArrivedSubscription()) - { - pCritSec = &m_SubsLock; - pHead = &m_ArrivalSubsHead; - } - else if (pContext->IsDepartedSubscription()) - { - pCritSec = &m_SubsLock; - pHead = &m_DepartureSubsHead; - } - else if (pContext->IsPublication()) - { - pCritSec = &m_PubsLock; - pHead = &m_PubsHead; - } - - if (pHead != NULL) - { - EnterCriticalSection(pCritSec); - - LIST_ENTRY* pFindEntry = pContext->GetListEntry(); - LIST_ENTRY* pEntry = pHead->Flink; - while (pEntry != pHead) - { - if (pEntry == pFindEntry) - { - RemoveEntryList(pEntry); - break; - } - - pEntry = pEntry->Flink; - } - - LeaveCriticalSection(pCritSec); - } - - delete pContext; - } - - MethodReturnVoid(); -} - -STDMETHODIMP_ (void) -CMyQueue::OnCancel( - _In_ IWDFIoRequest* pWdfRequest - ) -{ - MethodEntry("pWdfRequest = %p", - pWdfRequest); - - IWDFFile* pFxFile; - pWdfRequest->GetFileObject(&pFxFile); - if (pFxFile != NULL) - { - CFileContext* pFileContext; - HRESULT hr = pFxFile->RetrieveContext((void**)&pFileContext); - if (SUCCEEDED(hr)) - { - pFileContext->OnCancel(); - } - } - - MethodReturnVoid(); -} - -#define IOCTL_BEGIN_PROXIMITY CTL_CODE(FILE_DEVICE_UNKNOWN, 0x1000, METHOD_BUFFERED, FILE_ANY_ACCESS) - -STDMETHODIMP_ (void) -CMyQueue::OnDeviceIoControl( - _In_ IWDFIoQueue* /*pWdfQueue*/, - _In_ IWDFIoRequest* pWdfRequest, - _In_ ULONG ControlCode, - _In_ SIZE_T /*InBufferSize*/, - _In_ SIZE_T /*OutBufferSize*/ - ) -{ - MethodEntry("pWdfRequest = %p, ControlCode = %d", - pWdfRequest, ControlCode); - - IWDFFile* pFxFile; - - pWdfRequest->GetFileObject(&pFxFile); - - bool fCompleteRequest = true; - - CFileContext *pFileContext; - HRESULT hr = pFxFile->RetrieveContext((void**)&pFileContext); - if (SUCCEEDED(hr)) - { - switch (ControlCode) - { - case IOCTL_NFP_GET_MAX_MESSAGE_BYTES: - { - IWDFMemory* pWdfOutputMemory; - pWdfRequest->GetOutputMemory(&pWdfOutputMemory); - if (pWdfOutputMemory != NULL) - { - SIZE_T cbOutputBuffer = 0; - // Set the first 4 bytes as the maximum message size of this device/driver - DWORD dwMaxCbPayload = MaxCbPayload; - hr = pWdfOutputMemory->CopyFromBuffer(0, &dwMaxCbPayload, 4); - if (SUCCEEDED(hr)) - { - cbOutputBuffer = 4; - } - pWdfOutputMemory->Release(); - - pWdfRequest->CompleteWithInformation(hr, cbOutputBuffer); - fCompleteRequest = false; - } - } - break; - - case IOCTL_NFP_GET_KILO_BYTES_PER_SECOND: - { - IWDFMemory* pWdfOutputMemory; - pWdfRequest->GetOutputMemory(&pWdfOutputMemory); - if (pWdfOutputMemory != NULL) - { - SIZE_T cbOutputBuffer = 0; - // Set the first 4 bytes as transfer speed of this device/driver - DWORD dwKilobytesPerSecond = KilobytesPerSecond; - hr = pWdfOutputMemory->CopyFromBuffer(0, &dwKilobytesPerSecond, 4); - if (SUCCEEDED(hr)) - { - cbOutputBuffer = 4; - } - pWdfOutputMemory->Release(); - - pWdfRequest->CompleteWithInformation(hr, cbOutputBuffer); - fCompleteRequest = false; - } - } - break; - - case IOCTL_NFP_DISABLE: - hr = pFileContext->Disable(); - break; - - case IOCTL_NFP_ENABLE: - hr = pFileContext->Enable(); - break; - - case IOCTL_NFP_SET_PAYLOAD: - hr = pFileContext->SetPayload(pWdfRequest); - if (SUCCEEDED(hr)) - { - MESSAGE* pMessage = new MESSAGE(); - hr = (pMessage != NULL) ? S_OK : E_OUTOFMEMORY; - if (SUCCEEDED(hr)) - { - pMessage->Initialize(pFileContext->GetType(), pFileContext->GetSize(), pFileContext->GetPayload()); - - EnterCriticalSection(&m_ConnectionLock); - - for (LIST_ENTRY* pEntry = m_ConnectionHead.Flink; - pEntry != &m_ConnectionHead; - pEntry = pEntry->Flink) - { - CConnection* pConnection = CConnection::FromListEntry(pEntry); - if (SUCCEEDED(pConnection->TransmitMessage(pMessage))) - { - pFileContext->HandleMessageTransmitted(); - } - } - - LeaveCriticalSection(&m_ConnectionLock); - - // Place this CFileContext into a list of published messages - EnterCriticalSection(&m_PubsLock); - InsertHeadList(&m_PubsHead, pFileContext->GetListEntry()); - LeaveCriticalSection(&m_PubsLock); - - delete pMessage; - } - } - break; - - case IOCTL_BEGIN_PROXIMITY: - hr = pFileContext->BeginProximity(pWdfRequest, this); - break; - - case IOCTL_NFP_GET_NEXT_SUBSCRIBED_MESSAGE: - hr = pFileContext->GetNextSubscribedMessage(this, pWdfRequest); - if (SUCCEEDED(hr)) - { - fCompleteRequest = false; - } - break; - - case IOCTL_NFP_GET_NEXT_TRANSMITTED_MESSAGE: - hr = pFileContext->GetNextTransmittedMessage(this, pWdfRequest); - if (SUCCEEDED(hr)) - { - fCompleteRequest = false; - } - break; - - default: - hr = HRESULT_FROM_NT(STATUS_INVALID_DEVICE_STATE); - break; - } - } - - if (fCompleteRequest) - { - TraceInfo("Completing Request: %!HRESULT!", hr); - pWdfRequest->Complete(hr); - } - - MethodReturnVoid(); -} - -void -CMyQueue::ValidateAccept(_In_ SOCKET Socket, _In_ GUID* pMagicPacket) -{ - MethodEntry("..."); - - CConnection* pConnection; - HRESULT hr = CConnection::Create(this, &pConnection); - if (SUCCEEDED(hr)) - { - // Mark it as an Inbound connection, so we know to delete it when - // it's removed from the list - pConnection->SetInboundConnection(); - - pConnection->ValidateAccept(Socket, pMagicPacket); - Socket = INVALID_SOCKET; - } - - if (Socket != INVALID_SOCKET) - { - closesocket(Socket); - } - - MethodReturnVoid(); -} - -void -CMyQueue::HandleReceivedMessage(_In_ MESSAGE* pMessage) -{ - MethodEntry("pMessage->m_szType = '%S'", - pMessage->m_szType); - - if ((pMessage->m_cbPayload > 0) && (pMessage->m_cbPayload <= MaxCbPayload)) - { - EnterCriticalSection(&m_SubsLock); - - LIST_ENTRY* pEntry = m_SubsHead.Flink; - while (pEntry != &m_SubsHead) - { - CFileContext* pSub = CFileContext::FromListEntry(pEntry); - - pSub->HandleReceivedPublication(pMessage->m_szType, - pMessage->m_cbPayload, - pMessage->m_Payload); - - pEntry = pEntry->Flink; - } - - LeaveCriticalSection(&m_SubsLock); - } - - MethodReturnVoid(); -} - -void -CMyQueue::ConnectionEstablished(_In_ CConnection* pConnection) -{ - MethodEntry("..."); - - EnterCriticalSection(&m_ConnectionLock); - BOOL fFirstConnection = IsListEmpty(&m_ConnectionHead); - InsertHeadList(&m_ConnectionHead, pConnection->GetListEntry()); - LeaveCriticalSection(&m_ConnectionLock); - - if (fFirstConnection) - { - AddArrivalEvent(); - } - - MESSAGE* pMessage = new MESSAGE(); - if (pMessage != NULL) - { - EnterCriticalSection(&m_PubsLock); - - LIST_ENTRY* pEntry = m_PubsHead.Flink; - while (pEntry != &m_PubsHead) - { - CFileContext* pPub = CFileContext::FromListEntry(pEntry); - if (pPub->IsEnabled()) - { - pMessage->Initialize(pPub->GetType(), pPub->GetSize(), pPub->GetPayload()); - if (SUCCEEDED(pConnection->TransmitMessage(pMessage))) - { - pPub->HandleMessageTransmitted(); - } - } - pEntry = pEntry->Flink; - } - - LeaveCriticalSection(&m_PubsLock); - delete pMessage; - } - - MethodReturnVoid(); -} - -BOOL -CMyQueue::ConnectionTerminated(_In_ CConnection* pConnection) -{ - MethodEntry("pConnection = 0x%p", - pConnection); - - LIST_ENTRY* pRemoveListEntry = pConnection->GetListEntry(); - - EnterCriticalSection(&m_ConnectionLock); - LIST_ENTRY* pEntry = m_ConnectionHead.Flink; - while (pEntry != &m_ConnectionHead) - { - if (pEntry == pRemoveListEntry) - { - RemoveEntryList(pEntry); - break; - } - pEntry = pEntry->Flink; - } - BOOL fNoMoreConnections = IsListEmpty(&m_ConnectionHead); - - LeaveCriticalSection(&m_ConnectionLock); - - BOOL fConnectionDeleted = FALSE; - if (pConnection->IsInboundConnection()) - { - delete pConnection; - fConnectionDeleted = TRUE; - } - - if (fNoMoreConnections) - { - AddRemovalEvent(); - } - - MethodReturnBool(fConnectionDeleted); -} - -void -CMyQueue::AddArrivalEvent() -{ - MethodEntry("void"); - - EnterCriticalSection(&m_SubsLock); - - for (LIST_ENTRY* pEntry = m_ArrivalSubsHead.Flink; - pEntry != &m_ArrivalSubsHead; - pEntry = pEntry->Flink) - { - CFileContext::FromListEntry(pEntry)->HandleArrivalEvent(); - } - - LeaveCriticalSection(&m_SubsLock); - - MethodReturnVoid(); -} - -void -CMyQueue::AddRemovalEvent() -{ - MethodEntry("void"); - - EnterCriticalSection(&m_SubsLock); - - for (LIST_ENTRY* pEntry = m_DepartureSubsHead.Flink; - pEntry != &m_DepartureSubsHead; - pEntry = pEntry->Flink) - { - CFileContext::FromListEntry(pEntry)->HandleRemovalEvent(); - } - - LeaveCriticalSection(&m_SubsLock); - - MethodReturnVoid(); -} - -STDMETHODIMP_(void) -CMyQueue::OnCleanup( - _In_ IWDFObject* /*pWdfObject*/ - ) -{ - MethodEntry("..."); - - // - // CMyQueue has a reference to framework device object via m_Queue. - // Framework queue object has a reference to CMyQueue object via the callbacks. - // This leads to circular reference and both the objects can't be destroyed until this circular reference is broken. - // To break the circular reference we release the reference to the framework queue object here in OnCleanup. - // - - m_FxQueue = NULL; - - MethodReturnVoid(); -} diff --git a/nfp/net/driver/Queue.h b/nfp/net/driver/Queue.h deleted file mode 100644 index 55b2ff39..00000000 --- a/nfp/net/driver/Queue.h +++ /dev/null @@ -1,175 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - queue.h - -Abstract: - - This file defines the queue callback interface. - -Environment: - - user mode only - -Revision History: - ---*/ - -#pragma once - -#include "device.h" -#include "Connection.h" - -static const int KilobytesPerSecond = 20; - -static const int MaxCbPayload = 10240; -static const int MaxCchType = 507; // maximum message type length is 5 for "?ubs\\", 250 for protocol + 250 for subtype + 1 each for dot "." and NULL terminator. -static const int MaxCchTypeNetwork = 502; // maximum message type length over the network is 250 for protocol + 250 for subtype + 1 each for dot "." and NULL terminator. -static const int MinCchType = 2; -static const int MaxCchMimeType = 256; - -#define WINDOWS_PROTOCOL L"Windows." -#define WINDOWS_PROTOCOL_CHARS 8 - -#define WINDOWSURI_PROTOCOL L"WindowsUri" - -#define WINDOWSMIME_PROTOCOL L"WindowsMime" -#define WINDOWSMIME_PROTOCOL_CHARS 11 - -#define PUBS_NAMESPACE L"Pubs\\" -#define PUBS_NAMESPACE_CHARS 5 - -#define SUBS_NAMESPACE L"Subs\\" -#define SUBS_NAMESPACE_CHARS 5 - -#define DEVICE_ARRIVED L"DeviceArrived" -#define DEVICE_DEPARTED L"DeviceDeparted" - -#define PAIRING_PROTOCOL L"Pairing:" -#define PAIRING_PROTOCOL_CHARS 8 - -#define NDEF_PROTOCOL L"NDEF" -#define NDEF_PROTOCOL_CHARS 4 - -#define NDEF_EMPTY_TYPE L"Empty" -#define NDEF_EMPTY_TYPE_CHARS 5 - -struct MESSAGE -{ - MESSAGE() : - m_cbPayload(0) - { - ZeroMemory(m_szType, sizeof(m_szType)); - ZeroMemory(m_Payload, sizeof(m_Payload)); - } - - void Initialize( - _In_ PCWSTR szType, - _In_ DWORD cbPayload, - _In_reads_bytes_(cbPayload) PBYTE pbPayload - ) - { - ZeroMemory(m_szType, sizeof(m_szType)); - ZeroMemory(m_Payload, sizeof(m_Payload)); - - m_cbPayload = cbPayload; - StringCchCopy(m_szType, ARRAY_SIZE(m_szType), szType); - CopyMemory(m_Payload, pbPayload, cbPayload); - } - - wchar_t m_szType[MaxCchTypeNetwork]; - DWORD m_cbPayload; - BYTE m_Payload[MaxCbPayload]; -}; - - -// -// Queue Callback Object. -// - -class ATL_NO_VTABLE CMyQueue : - public CComObjectRootEx, - public IQueueCallbackCreate, - public IQueueCallbackDeviceIoControl, - public IRequestCallbackCancel, - public IObjectCleanup, - public IValidateAccept, - public IConnectionCallback -{ -public: - -DECLARE_NOT_AGGREGATABLE(CMyQueue) - -BEGIN_COM_MAP(CMyQueue) - COM_INTERFACE_ENTRY(IQueueCallbackCreate) - COM_INTERFACE_ENTRY(IQueueCallbackDeviceIoControl) - COM_INTERFACE_ENTRY(IRequestCallbackCancel) - COM_INTERFACE_ENTRY(IObjectCleanup) -END_COM_MAP() - -public: - - //IQueueCallbackCreate - STDMETHOD_(void,OnCreateFile)(_In_ IWDFIoQueue* pWdfQueue, _In_ IWDFIoRequest* pWDFRequest, _In_ IWDFFile* pWdfFileObject); - - //IQueueCallbackDeviceIoControl - STDMETHOD_(void,OnDeviceIoControl)(_In_ IWDFIoQueue* pWdfQueue, _In_ IWDFIoRequest* pWDFRequest, _In_ ULONG ControlCode, _In_ SIZE_T InBufferSize, _In_ SIZE_T OutBufferSize); - - //IObjectCleanup - STDMETHOD_(void,OnCleanup)(_In_ IWDFObject* pWdfObject); - - //IValidateAccept - void ValidateAccept(_In_ SOCKET Socket, _In_ GUID* pMagicPacket); - - - //IRequestCallbackCancel - STDMETHODIMP_(void) - OnCancel( - _In_ IWDFIoRequest* pWdfRequest - ); - - //IConnectionCallback - virtual void HandleReceivedMessage(_In_ MESSAGE* pMessageData); - virtual void ConnectionEstablished(_In_ CConnection* pBthConnection); - virtual BOOL ConnectionTerminated(_In_ CConnection* pBthConnection); - -public: - CMyQueue(); - ~CMyQueue(); - - STDMETHOD(Initialize)(_In_ CMyDevice * Device); - - HRESULT - Configure( - VOID - ); - - STDMETHODIMP_(void) - OnCloseFile( - _In_ IWDFFile* pWdfFileObject - ); - -private: - - void AddArrivalEvent(); - void AddRemovalEvent(); - -private: - CComPtr m_FxQueue; - - LIST_ENTRY m_SubsHead; - LIST_ENTRY m_ArrivalSubsHead; - LIST_ENTRY m_DepartureSubsHead; - CRITICAL_SECTION m_SubsLock; - - LIST_ENTRY m_PubsHead; - CRITICAL_SECTION m_PubsLock; - - LIST_ENTRY m_ConnectionHead; - CRITICAL_SECTION m_ConnectionLock; - - CSocketListener m_SocketListener; -}; diff --git a/nfp/net/driver/connection.h b/nfp/net/driver/connection.h deleted file mode 100644 index 6ab900e0..00000000 --- a/nfp/net/driver/connection.h +++ /dev/null @@ -1,125 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Abstract: - - Defines a simple NearFieldProximity Provider implementation using the network - for use in selfhosting. - -Author: - - Travis Martin (TravM) 06-24-2010 - ---*/ -#pragma once - -#include "SocketListener.h" - -class CConnection; - -struct MESSAGE; - -interface IConnectionCallback -{ - virtual void HandleReceivedMessage(_In_ MESSAGE* pMessage) = 0; - virtual void ConnectionEstablished(_In_ CConnection* pConnection) = 0; - virtual BOOL ConnectionTerminated(_In_ CConnection* pConnection) = 0; -}; - -class CConnection : public IValidateAccept -{ -private: - CConnection(_In_ IConnectionCallback* pCallback) : - _State(INITIAL), - _Socket(INVALID_SOCKET), - _pCallback(pCallback), - _ThreadpoolWork(NULL), - _fInboundConnection(false) - { - } - -public: - - virtual ~CConnection() - { - Terminate(); - - if (_ThreadpoolWork != NULL) - { - // Don't wait for threadpool callbacks when this thread is actually the threadpool callback - if (_ThreadpoolThreadId != GetCurrentThreadId()) - { - WaitForThreadpoolWorkCallbacks(_ThreadpoolWork, false); - } - CloseThreadpoolWork(_ThreadpoolWork); - _ThreadpoolWork = NULL; - } - } - - static HRESULT Create(_In_ IConnectionCallback* pCallback, _Outptr_ CConnection** ppConnection); - - void SetInboundConnection() { _fInboundConnection = true; } - bool IsInboundConnection() { return _fInboundConnection; } - - //IValidateAccept - void ValidateAccept(_In_ SOCKET Socket, _In_ GUID* pMagicPacket); - - HRESULT FinalizeEstablish(_In_ SOCKET Socket); - - HRESULT InitializeAsClient(_In_ BEGIN_PROXIMITY_ARGS* pArgs); - - HRESULT TransmitMessage(_In_ MESSAGE* pMessage); - - BOOL ReceiveThreadProc(); - static VOID CALLBACK s_ReceiveThreadProc( - _Inout_ PTP_CALLBACK_INSTANCE Instance, - _Inout_ PVOID Context, - _Inout_ PTP_WORK /*Work*/) - { - CallbackMayRunLong(Instance); - - CConnection* pConnection = (CConnection*)Context; - pConnection->_ThreadpoolThreadId = GetCurrentThreadId(); - BOOL fConnectionDeleted = pConnection->ReceiveThreadProc(); - - if (!fConnectionDeleted) - { - // Only clear the member variable if the connection object wasn't deleted. - pConnection->_ThreadpoolThreadId = 0; - } - } - - LIST_ENTRY* GetListEntry() { return &_ListEntry; } - static CConnection* FromListEntry(LIST_ENTRY* pListEntry) - { - return (CConnection*) CONTAINING_RECORD(pListEntry, CConnection, _ListEntry); - } - -private: - - void Terminate(); - -private: - - enum STATE - { - INITIAL = 0, - ESTABLISHED, - TERMINATED - }; - - volatile STATE _State; - - SOCKET _Socket; - - PTP_WORK _ThreadpoolWork; - DWORD _ThreadpoolThreadId; - - IConnectionCallback* _pCallback; - - bool _fInboundConnection; - - LIST_ENTRY _ListEntry; - -}; diff --git a/nfp/net/driver/device.cpp b/nfp/net/driver/device.cpp deleted file mode 100644 index 599d57b5..00000000 --- a/nfp/net/driver/device.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - Device.cpp - -Abstract: - - This module contains the implementation of the UMDF sample - driver's device callback object. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "internal.h" -#include "device.tmh" - -HRESULT -CMyDevice::Initialize( - _In_ IWDFDriver* FxDriver, - _In_ IWDFDeviceInitialize* FxDeviceInit - ) -/*++ - - Routine Description: - - This method initializes the device callback object and creates the - partner device object. - - The method should perform any device-specific configuration that: - * could fail (these can't be done in the constructor) - * must be done before the partner object is created -or- - * can be done after the partner object is created and which aren't - influenced by any device-level parameters the parent (the driver - in this case) might set. - - Arguments: - - FxDeviceInit - the settings for this device. - FxDriver - IWDF Driver for this device. - - Return Value: - - status. - ---*/ -{ - MethodEntry("..."); - - CComPtr fxDevice; - HRESULT hr; - - // - // Configure things like the locking model before we go to create our - // partner device. - // - - // - // Set the locking model - // - - FxDeviceInit->SetLockingConstraint(None); - - // - // TODO: Any per-device initialization which must be done before - // creating the partner object. - // - - // - // Create a new FX device object and assign the new callback object to - // handle any device level events that occur. - // - - // - // QueryIUnknown references the IUnknown interface that it returns - // (which is the same as referencing the device). We pass that to - // CreateDevice, which takes its own reference if everything works. - // - - CComPtr pUnk; - HRESULT hrQI = this->QueryInterface(__uuidof(IUnknown),(void**)&pUnk); - WUDF_SAMPLE_DRIVER_ASSERT(SUCCEEDED(hrQI)); - - hr = FxDriver->CreateDevice(FxDeviceInit, pUnk, &fxDevice); - - // - // If that succeeded then set our FxDevice member variable. - // - - if (SUCCEEDED(hr)) - { - m_FxDevice = fxDevice; - } - - MethodReturnHR(hr); -} - -HRESULT -CMyDevice::Configure( - VOID - ) -/*++ - - Routine Description: - - This method is called after the device callback object has been initialized - and returned to the driver. It would setup the device's queues and their - corresponding callback objects. - - Arguments: - - FxDevice - the framework device object for which we're handling events. - - Return Value: - - status - ---*/ -{ - MethodEntry("void"); - - // - // Create a new instance of our Queue callback object - // - CComObject * defaultQueue = NULL; - HRESULT hr = CComObject::CreateInstance(&defaultQueue); - - if (SUCCEEDED(hr)) - { - defaultQueue->AddRef(); - hr = defaultQueue->Initialize(this); - } - - if (SUCCEEDED(hr)) - { - hr = defaultQueue->Configure(); - } - - // - // Create and Enable Device Interfaces for this device. - // - if (SUCCEEDED(hr)) - { - hr = m_FxDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_NETNFP, - NULL); - } - - if (SUCCEEDED(hr)) - { - hr = m_FxDevice->AssignDeviceInterfaceState(&GUID_DEVINTERFACE_NETNFP, - NULL, - TRUE); - } - - if (SUCCEEDED(hr)) - { - hr = m_FxDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_NFP, - NULL); - } - - if (SUCCEEDED(hr)) - { - hr = m_FxDevice->AssignDeviceInterfaceState(&GUID_DEVINTERFACE_NFP, - NULL, - TRUE); - } - - if (SUCCEEDED(hr)) - { - // - // Save a pointer to our queue, so we can lock it during file cleanup - // - m_MyQueue = defaultQueue; - } - - // - // Release the reference we took on the queue object. - // The framework took its own references on the object's callback interfaces - // when we called m_FxDevice->CreateIoQueue, and will manage the object's lifetime. - // - SAFE_RELEASE(defaultQueue); - - MethodReturnHR(hr); -} - -STDMETHODIMP_(void) -CMyDevice::OnCloseFile( - _In_ IWDFFile* pWdfFileObject - ) -{ - MethodEntry("..."); - - m_MyQueue->OnCloseFile(pWdfFileObject); - - MethodReturnVoid(); -} - -STDMETHODIMP_(void) -CMyDevice::OnCleanupFile( - _In_ IWDFFile* /*pWdfFileObject*/ - ) -/*++ - - Routine Description: - - This method is when app with open handle device terminates. - - Arguments: - - pWdfFileObject - the framework file object for which close is handled. - - Return Value: - - None - ---*/ -{ -} - -STDMETHODIMP_(void) -CMyDevice::OnCleanup( - _In_ IWDFObject* pWdfObject - ) -/*++ - - Routine Description: - - This device callback method is invoked by the framework when the WdfObject - is about to be released by the framework. - - Arguments: - - pWdfObject - the framework device object for which OnCleanup. - - Return Value: - - None - ---*/ -{ - MethodEntry("..."); - - WUDF_SAMPLE_DRIVER_ASSERT(pWdfObject == m_FxDevice); - - m_MyQueue = NULL; - - // - // CMyDevice has a reference to framework device object via m_Device. - // Framework device object has a reference to CMyDevice object via the callbacks. - // This leads to circular reference and both the objects can't be destroyed until this circular reference is broken. - // To break the circular reference we release the reference to the framework device object here in OnCleanup. - // - m_FxDevice = NULL; - - MethodReturnVoid(); -} diff --git a/nfp/net/driver/device.h b/nfp/net/driver/device.h deleted file mode 100644 index c4eeb121..00000000 --- a/nfp/net/driver/device.h +++ /dev/null @@ -1,73 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Device.h - -Abstract: - - This module contains the type definitions for the sample - driver's device callback class. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ -#pragma once - -class CMyQueue; - -class ATL_NO_VTABLE CMyDevice : - public CComObjectRootEx, - public IFileCallbackCleanup, - public IFileCallbackClose, - public IObjectCleanup -{ -public: - -DECLARE_NOT_AGGREGATABLE(CMyDevice) - -BEGIN_COM_MAP(CMyDevice) - COM_INTERFACE_ENTRY(IFileCallbackCleanup) - COM_INTERFACE_ENTRY(IFileCallbackClose) - COM_INTERFACE_ENTRY(IObjectCleanup) -END_COM_MAP() - -public: - - //IFileCallbackCleanup - STDMETHOD_(void,OnCleanupFile)(_In_ IWDFFile* pWdfFileObject); - //IFileCallbackClose - STDMETHOD_(void,OnCloseFile)(_In_ IWDFFile* pWdfFileObject); - //IObjectCleanup - STDMETHOD_(void,OnCleanup)(_In_ IWDFObject* pWdfObject); - -public: - - STDMETHOD(Initialize)(_In_ IWDFDriver* pWdfDriver, _In_ IWDFDeviceInitialize* pWdfDeviceInit); - - HRESULT - Configure( - VOID - ); - - IWDFDevice * - GetFxDevice( - VOID - ) - { - return m_FxDevice; - } - -private: - CComPtr m_FxDevice; - - CMyQueue* m_MyQueue; - - HRESULT ReadAndAssignPropertyStoreValue(); - HRESULT GetAnsiValFromPropVariant(_In_ PROPVARIANT val, _Inout_ LPSTR *PropertyValueA); - -}; diff --git a/nfp/net/driver/dllsup.cpp b/nfp/net/driver/dllsup.cpp deleted file mode 100644 index 85c866ec..00000000 --- a/nfp/net/driver/dllsup.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - dllsup.cpp - -Abstract: - - This module contains the implementation of the UMDF Socktecho Sample - Driver's entry point and its exported functions for providing COM support. - - This module can be copied without modification to a new UMDF driver. It - depends on some of the code in comsup.cpp & comsup.h to handle DLL - registration and creating the first class factory. - - This module is dependent on the following defines: - - MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing - tracing. - - MYDRIVER_CLASS_ID - A GUID encoded in struct format used to - initialize the driver's ClassID. - - These are defined in internal.h for the sample. If you choose - to use a different primary include file, you should ensure they are - defined there as well. - -Environment: - - WDF User-Mode Driver Framework (WDF:UMDF) - ---*/ - -#include "internal.h" -#include "dllsup.tmh" - -const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID; - -class CNetNfpProviderModule : public CAtlDllModuleT< CNetNfpProviderModule > -{ -}; - - -OBJECT_ENTRY_AUTO(CLSID_MyDriverCoClass, CMyDriver) - - -CNetNfpProviderModule _AtlModule; - -BOOL -WINAPI -DllMain( - HINSTANCE ModuleHandle, - DWORD Reason, - PVOID Reserved - ) -/*++ - - Routine Description: - - This is the entry point and exit point for the I/O trace driver. This - does very little as the I/O trace driver has minimal global data. - - This method initializes tracing. - - Arguments: - - ModuleHandle - the DLL handle for this module. - - Reason - the reason this entry point was called. - - Reserved - unused - - Return Value: - - TRUE - ---*/ -{ - - UNREFERENCED_PARAMETER( ModuleHandle ); - - if (DLL_PROCESS_ATTACH == Reason) - { - // - // Initialize tracing. - // - - WPP_INIT_TRACING(MYDRIVER_TRACING_ID); - TracingTlsInitialize(); - - } - else if (DLL_PROCESS_DETACH == Reason) - { - // - // Cleanup tracing. - // - - TracingTlsFree(); - WPP_CLEANUP(); - } - - return _AtlModule.DllMain(Reason, Reserved); -; -} - -_Check_return_ -STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID* ppv) -{ - return _AtlModule.DllGetClassObject(rclsid, riid, ppv); -} diff --git a/nfp/net/driver/driver.cpp b/nfp/net/driver/driver.cpp deleted file mode 100644 index 2c28f16e..00000000 --- a/nfp/net/driver/driver.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - Driver.cpp - -Abstract: - - This module contains the implementation of the UMDF Socketecho Sample's - core driver callback object. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ -#include "internal.h" - -#include "driver.tmh" - -DECLARE_TRACING_TLS; - -STDMETHODIMP -CMyDriver::OnInitialize( - _In_ IWDFDriver* /*pWdfDriver*/ - ) - - -/*++ - - Routine Description: - - This routine is invoked by the framework at driver load . - This method will invoke the Winsock Library for using - Winsock API in this driver. - - Arguments: - - pWdfDriver - Framework driver object - - Return Value: - - S_OK if successful, or error otherwise. - ---*/ - -{ - MethodEntry("..."); - - HRESULT hr = S_OK; - - WSADATA wsaData; - int result = WSAStartup(MAKEWORD(2,2), &wsaData); - if (result != 0) - { - hr = HRESULT_FROM_WIN32(WSAGetLastError()); - TraceErrorHR(hr, "Failed to initialize Winsock 2.0"); - } - - MethodReturnHR(hr); -} - -STDMETHODIMP_(void) -CMyDriver::OnDeinitialize( - _In_ IWDFDriver* /*pWdfDriver*/ - ) - -/*++ - Routine Description: - - The FX invokes this method when it unloads the driver. - This routine will Cleanup Winsock library - - Arguments: - - pWdfDriver - the Fx driver object. - - Return Value: - - None - - --*/ -{ - MethodEntry("..."); - - WSACleanup(); - - MethodReturnVoid(); -} - -STDMETHODIMP -CMyDriver::OnDeviceAdd( - _In_ IWDFDriver *FxWdfDriver, - _In_ IWDFDeviceInitialize *FxDeviceInit - ) -/*++ - - Routine Description: - - The FX invokes this method when it wants to install our driver on a device - stack. This method creates a device callback object, then calls the Fx - to create an Fx device object and associate the new callback object with - it. - - Arguments: - - FxWdfDriver - the Fx driver object. - - FxDeviceInit - the initialization information for the device. - - Return Value: - - status - ---*/ -{ - MethodEntry("..."); - - // - // Create a new instance of our device callback object - // - - CComObject * device; - HRESULT hr = CComObject::CreateInstance(&device); - if (SUCCEEDED(hr)) - { - device->AddRef(); - hr = device->Initialize(FxWdfDriver, FxDeviceInit); - if (SUCCEEDED(hr)) - { - // - // If that succeeded then call the device's configure method. This - // allows the device to create any queues or other structures that it - // needs now that the corresponding fx device object has been created. - // - hr = device->Configure(); - } - - // - // Release the reference we took on the device object. - // The framework took its own references on the object's callback interfaces - // when we called FxWdfDriver->CreateDevice, and will manage the object's lifetime. - // - SAFE_RELEASE(device); - } - - MethodReturnHR(hr); -} diff --git a/nfp/net/driver/driver.h b/nfp/net/driver/driver.h deleted file mode 100644 index 6affa20f..00000000 --- a/nfp/net/driver/driver.h +++ /dev/null @@ -1,53 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Driver.h - -Abstract: - - This module contains the type definitions for the UMDF Socketecho sample's - driver callback class. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -// -// This class handles driver events for the socktecho sample. In particular -// it supports the OnDeviceAdd event, which occurs when the driver is called -// to setup per-device handlers for a new device stack. -// - -extern const GUID CLSID_MyDriverCoClass; - -class ATL_NO_VTABLE CMyDriver : - public CComObjectRootEx, - public CComCoClass, - public IDriverEntry -{ -public: - -DECLARE_NOT_AGGREGATABLE(CMyDriver) - -DECLARE_CLASSFACTORY(); - -DECLARE_NO_REGISTRY(); - -BEGIN_COM_MAP(CMyDriver) - COM_INTERFACE_ENTRY(IDriverEntry) -END_COM_MAP() - -public: - // IDriverEntry - STDMETHOD(OnInitialize)(_In_ IWDFDriver* pWdfDriver); - STDMETHOD(OnDeviceAdd)(_In_ IWDFDriver* pWdfDriver, _In_ IWDFDeviceInitialize* pWdfDeviceInit); - STDMETHOD_(void,OnDeinitialize)(_In_ IWDFDriver* pWdfDriver); -}; - diff --git a/nfp/net/driver/exports.def b/nfp/net/driver/exports.def deleted file mode 100644 index 964e5f79..00000000 --- a/nfp/net/driver/exports.def +++ /dev/null @@ -1,6 +0,0 @@ -; exports.def : Declares the module parameters. - -LIBRARY "NetNfpProvider" - -EXPORTS - DllGetClassObject PRIVATE diff --git a/nfp/net/driver/internal.h b/nfp/net/driver/internal.h deleted file mode 100644 index 80aa0152..00000000 --- a/nfp/net/driver/internal.h +++ /dev/null @@ -1,152 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Internal.h - -Abstract: - - This module contains the local type definitions for the UMDF Socketecho sample - driver sample. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - -// -// Include the winsock headers before any other windows headers. -// -#include -#include - -// -// Include the WUDF DDI -// - -#include "wudfddi.h" - -// -// Use specstrings for in/out annotation of function parameters. -// - -#include "specstrings.h" - -// -// Define the tracing GUID for this driver -// - -#define TRACE_CONTROL_GUID (12579E92,1B46,40A6,9CFC,C718A677830B) - - -// -// Driver specific #defines -// - -#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\NetNfpProvider" - -/* 278F44F0-FF5C-4FE3-BF20-F8AA158EA7BC */ -#define MYDRIVER_CLASS_ID { 0x278F44F0, 0xFF5C, 0x4FE3, {0xBF, 0x20, 0xF8, 0xAA, 0x15, 0x8E, 0xA7, 0xBC} } -#ifndef SAFE_RELEASE -#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }} -#endif - -__forceinline -#ifdef _PREFAST_ -__declspec(noreturn) -#endif -VOID -WdfTestNoReturn( - VOID - ) -{ - // do nothing. -} - -#define WUDF_SAMPLE_DRIVER_ASSERT(p) \ -{ \ - if ( !(p) ) \ - { \ - DebugBreak(); \ - WdfTestNoReturn(); \ - } \ -} - -// -// define the maximum size of the message queue -// - -#define MAX_MESSAGE_QUEUE_SIZE 50 - -// -// MessageId: STATUS_CANCELLED -// -// MessageText: -// -// The I/O request was canceled. -// -#define STATUS_CANCELLED (0xC0000120L) - -// -// MessageId: STATUS_INVALID_DEVICE_STATE -// -// MessageText: -// -// The device is not in a valid state to perform this request. -// -#define STATUS_INVALID_DEVICE_STATE (0xC0000184L) - -// -// MessageId: STATUS_INVALID_BUFFER_SIZE -// -// MessageText: -// -// The size of the buffer is invalid for the specified operation. -// -#define STATUS_INVALID_BUFFER_SIZE (0xC0000206L) - -// -// MessageId: STATUS_OBJECT_PATH_NOT_FOUND -// -// MessageText: -// -// {Path Not Found} -// The path %hs does not exist. -// -#define STATUS_OBJECT_PATH_NOT_FOUND ((NTSTATUS)0xC000003AL) - -// -// Include the type specific headers. -// -#include -#include - -// Windows Headers -#include -#include -#include -#include -#include -#include - -// Sample headers -#include "NetNfp.h" -#include "WppDefs.h" -#include "list.h" -#include "connection.h" -#include "filecontext.h" -#include "driver.h" -#include "device.h" -#include "queue.h" - -_Analysis_mode_(_Analysis_operator_new_null_) - diff --git a/nfp/net/driver/list.h b/nfp/net/driver/list.h deleted file mode 100644 index d2bfce3f..00000000 --- a/nfp/net/driver/list.h +++ /dev/null @@ -1,119 +0,0 @@ -#pragma once - -FORCEINLINE -VOID -InitializeListHead( - _Out_ PLIST_ENTRY ListHead - ) -{ - ListHead->Flink = ListHead->Blink = ListHead; -} - -_Check_return_ -BOOLEAN -FORCEINLINE -IsListEmpty( - _In_ const LIST_ENTRY * ListHead - ) -{ - return (BOOLEAN)(ListHead->Flink == ListHead); -} - -FORCEINLINE -BOOLEAN -RemoveEntryList( - _In_ PLIST_ENTRY Entry - ) -{ - PLIST_ENTRY Blink; - PLIST_ENTRY Flink; - - Flink = Entry->Flink; - Blink = Entry->Blink; - Blink->Flink = Flink; - Flink->Blink = Blink; - return (BOOLEAN)(Flink == Blink); -} - -FORCEINLINE -PLIST_ENTRY -RemoveHeadList( - _Inout_ PLIST_ENTRY ListHead - ) -{ - PLIST_ENTRY Flink; - PLIST_ENTRY Entry; - - Entry = ListHead->Flink; - Flink = Entry->Flink; - ListHead->Flink = Flink; - Flink->Blink = ListHead; - return Entry; -} - - - -FORCEINLINE -PLIST_ENTRY -RemoveTailList( - _Inout_ PLIST_ENTRY ListHead - ) -{ - PLIST_ENTRY Blink; - PLIST_ENTRY Entry; - - Entry = ListHead->Blink; - Blink = Entry->Blink; - ListHead->Blink = Blink; - Blink->Flink = ListHead; - return Entry; -} - - -FORCEINLINE -VOID -InsertTailList( - _Inout_ PLIST_ENTRY ListHead, - _Inout_ __drv_aliasesMem PLIST_ENTRY Entry - ) -{ - PLIST_ENTRY Blink; - - Blink = ListHead->Blink; - Entry->Flink = ListHead; - Entry->Blink = Blink; - Blink->Flink = Entry; - ListHead->Blink = Entry; -} - - -FORCEINLINE -VOID -InsertHeadList( - _Inout_ PLIST_ENTRY ListHead, - _Inout_ __drv_aliasesMem PLIST_ENTRY Entry - ) -{ - PLIST_ENTRY Flink; - - Flink = ListHead->Flink; - Entry->Flink = Flink; - Entry->Blink = ListHead; - Flink->Blink = Entry; - ListHead->Flink = Entry; -} - -FORCEINLINE -VOID -AppendTailList( - _Inout_ PLIST_ENTRY ListHead, - _Inout_ PLIST_ENTRY ListToAppend - ) -{ - PLIST_ENTRY ListEnd = ListHead->Blink; - - ListHead->Blink->Flink = ListToAppend; - ListHead->Blink = ListToAppend->Blink; - ListToAppend->Blink->Flink = ListHead; - ListToAppend->Blink = ListEnd; -} diff --git a/nfp/net/driver/netnfpprovider.inx b/nfp/net/driver/netnfpprovider.inx deleted file mode 100644 index e9a7281c..00000000 Binary files a/nfp/net/driver/netnfpprovider.inx and /dev/null differ diff --git a/nfp/net/driver/netnfpprovider.rc b/nfp/net/driver/netnfpprovider.rc deleted file mode 100644 index 98d1f8ab..00000000 --- a/nfp/net/driver/netnfpprovider.rc +++ /dev/null @@ -1,18 +0,0 @@ -//--------------------------------------------------------------------------- -// Skeleton.rc -// -// Copyright (c) Microsoft Corporation, All Rights Reserved -//--------------------------------------------------------------------------- - - -#include -#include - - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT_UNKNOWN -#define VER_FILEDESCRIPTION_STR "WDF:UMDF Network NearFieldProximity Provider" -#define VER_INTERNALNAME_STR "NetNfpProvider" -#define VER_ORIGINALFILENAME_STR "NetNfpProvider.dll" - -#include "common.ver" diff --git a/nfp/net/driver/socketlistener.cpp b/nfp/net/driver/socketlistener.cpp deleted file mode 100644 index 3aaa687b..00000000 --- a/nfp/net/driver/socketlistener.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Abstract: - - Implements a socket listener class - -Author: - - Travis Martin (TravM) 06-24-2010 - -Environment: - - User-mode only. - ---*/ -#include "internal.h" - -#include "SocketListener.tmh" - -HRESULT SetSocketIpv6Only(_In_ SOCKET socket, _In_ BOOL Ipv6Only) -{ - HRESULT hr = S_OK; - if (setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&Ipv6Only, sizeof(Ipv6Only)) == SOCKET_ERROR) - { - hr = HRESULT_FROM_WIN32(WSAGetLastError()); - USE_DEFAULT_TRACING_CONTEXT; - TraceErrorHR(hr, "setsockopt IPV6_V6ONLY"); - } - return hr; -} - -HRESULT CSocketListener::EnableAccepting(_In_ IValidateAccept* pValidator) -{ - HRESULT hr = S_OK; - if (_pValidator == NULL) - { - USE_DEFAULT_TRACING_CONTEXT; - - _ThreadpoolIo = CreateThreadpoolIo((HANDLE)_ListenSocket, s_AcceptThreadProc, this, NULL); - if (_ThreadpoolIo == NULL) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - - if (SUCCEEDED(hr)) - { - int backlog = 2; - if (listen(_ListenSocket, backlog) == SOCKET_ERROR) - { - hr = HRESULT_FROM_WIN32(WSAGetLastError()); - } - } - - if (SUCCEEDED(hr)) - { - // We're now accepting - _pValidator = pValidator; - - hr = BeginAccept(); - if (hr == HRESULT_FROM_WIN32(ERROR_IO_PENDING)) - { - hr = S_OK; - } - } - - TraceInfo("EnableAccepting(): %!HRESULT!", hr); - } - - return hr; -} - -void CSocketListener::StopAccepting() -{ - MethodEntry("void"); - - SOCKET listenSocket = InterlockedExchange(&_ListenSocket, INVALID_SOCKET); - if (listenSocket != INVALID_SOCKET) - { - closesocket(listenSocket); - } - - PTP_IO threadpoolIo = (PTP_IO)InterlockedExchangePointer((PVOID*)&_ThreadpoolIo, NULL); - if (threadpoolIo != NULL) - { - // Don't wait for threadpool callbacks when this thread is actually the threadpool callback - if (_ThreadpoolThreadId != GetCurrentThreadId()) - { - WaitForThreadpoolIoCallbacks(threadpoolIo, false); - } - CloseThreadpoolIo(threadpoolIo); - } - - _pValidator = NULL; - - if (_ClientSocket != INVALID_SOCKET) - { - closesocket(_ClientSocket); - _ClientSocket = INVALID_SOCKET; - } - - MethodReturnVoid(); -} - -HRESULT CSocketListener::BeginAccept() -{ - MethodEntry("void"); - - HRESULT hr = S_OK; - _ClientSocket = socket(AF_INET6, SOCK_STREAM, 0); - if (_ClientSocket == INVALID_SOCKET) - { - hr = HRESULT_FROM_WIN32(WSAGetLastError()); - } - - if (SUCCEEDED(hr)) - { - hr = SetSocketIpv6Only(_ClientSocket, FALSE); - } - - if (SUCCEEDED(hr)) - { - PTP_IO threadpoolIo = _ThreadpoolIo; - if (threadpoolIo != NULL) - { - StartThreadpoolIo(threadpoolIo); - - ULONG_PTR cbReceived = 0; - ZeroMemory(&_Overlapped, sizeof(_Overlapped)); - if (!AcceptEx(_ListenSocket, _ClientSocket, &_AcceptBuffer, - sizeof(_AcceptBuffer.MagicPacket), - sizeof(_AcceptBuffer.DestAddress), - sizeof(_AcceptBuffer.SourceAddress), - (LPDWORD)&cbReceived, &_Overlapped)) - { - hr = HRESULT_FROM_WIN32(WSAGetLastError()); - if (hr != HRESULT_FROM_WIN32(ERROR_IO_PENDING)) - { - // Failed to accept, so cleanup - CancelThreadpoolIo(threadpoolIo); - StopAccepting(); - } - } - } - } - - MethodReturnHR(hr); -} - -void CSocketListener::AcceptThreadProc(_In_ HRESULT hr, _In_ ULONG_PTR cbReceived) -{ - MethodEntry("hr = %!HRESULT!, cbReceived = %d", - hr, (ULONG)cbReceived); - - if (SUCCEEDED(hr)) - { - if (cbReceived == sizeof(_AcceptBuffer.MagicPacket)) - { - // Transfer ownership of _ClientSocket - _pValidator->ValidateAccept(_ClientSocket, &_AcceptBuffer.MagicPacket); - } - else - { - // Wrong header size, close immediately - closesocket(_ClientSocket); - } - _ClientSocket = INVALID_SOCKET; - } - - // Start up another accept request - BeginAccept(); - - MethodReturnVoid(); -} - -HRESULT CSocketListener::Bind() -{ - MethodEntry("void"); - - // Create a SOCKET for connecting to this server - HRESULT hr = S_OK; - addrinfoW* pResult = NULL; - addrinfoW Hints = {}; - Hints.ai_family = AF_INET6; - Hints.ai_socktype = SOCK_STREAM; - Hints.ai_flags = AI_PASSIVE; - - // Resolve the server address and port - if (GetAddrInfoW(NULL, L"9299", &Hints, &pResult) != ERROR_SUCCESS ) - { - hr = HRESULT_FROM_WIN32(WSAGetLastError()); - } - - if (SUCCEEDED(hr)) - { - // Create a SOCKET for connecting to server - _ListenSocket = socket(AF_INET6, SOCK_STREAM, 0); - if (_ListenSocket == INVALID_SOCKET) - { - hr = HRESULT_FROM_WIN32(WSAGetLastError()); - } - - if (SUCCEEDED(hr)) - { - hr = SetSocketIpv6Only(_ListenSocket, FALSE); - } - - if (SUCCEEDED(hr)) - { - // Setup the TCP listening socket - if (bind(_ListenSocket, pResult->ai_addr, (int)pResult->ai_addrlen) == SOCKET_ERROR) - { - hr = HRESULT_FROM_WIN32(WSAGetLastError()); - } - } - FreeAddrInfoW(pResult); - } - - MethodReturnHR(hr); -} - diff --git a/nfp/net/driver/socketlistener.h b/nfp/net/driver/socketlistener.h deleted file mode 100644 index dffb11a2..00000000 --- a/nfp/net/driver/socketlistener.h +++ /dev/null @@ -1,84 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Abstract: - - Declares a socket listener class - -Author: - - Travis Martin (TravM) 06-24-2010 - -Environment: - - User-mode only. - ---*/ -#pragma once - -struct ACCEPT_BUFFER -{ - GUID MagicPacket; - - SOCKADDR_STORAGE DestAddress; - SOCKADDR_STORAGE SourceAddress; -}; - -interface IValidateAccept -{ - virtual void ValidateAccept(_In_ SOCKET Socket, _In_ GUID* pMagicPacket) = 0; -}; - -class CSocketListener -{ -public: - CSocketListener() : - _pValidator(NULL), - _ThreadpoolIo(NULL), - _ListenSocket(INVALID_SOCKET), - _ClientSocket(INVALID_SOCKET) - { - ZeroMemory(&_Overlapped, sizeof(_Overlapped)); - } - - ~CSocketListener() - { - StopAccepting(); - } - -public: - HRESULT Bind(); - HRESULT EnableAccepting(_In_ IValidateAccept* pValidator); - void StopAccepting(); - -private: - - HRESULT BeginAccept(); - void AcceptThreadProc(_In_ HRESULT hr, _In_ ULONG_PTR cbReceived); - static void CALLBACK s_AcceptThreadProc( - _Inout_ PTP_CALLBACK_INSTANCE /*Instance*/, - _Inout_ PVOID Context, - _Inout_opt_ PVOID /*Overlapped*/, - _In_ ULONG IoResult, - _In_ ULONG_PTR NumberOfBytesTransferred, - _Inout_ PTP_IO /*Io*/) - { - CSocketListener* pSocketListener = (CSocketListener*)Context; - pSocketListener->_ThreadpoolThreadId = GetCurrentThreadId(); - pSocketListener->AcceptThreadProc(HRESULT_FROM_WIN32(IoResult), NumberOfBytesTransferred); - pSocketListener->_ThreadpoolThreadId = 0; - } - -private: - ACCEPT_BUFFER _AcceptBuffer; - - OVERLAPPED _Overlapped; - volatile PTP_IO _ThreadpoolIo; - DWORD _ThreadpoolThreadId; - - IValidateAccept* _pValidator; - - SOCKET _ListenSocket; - SOCKET _ClientSocket; -}; diff --git a/nfp/net/driver/wppdefs.h b/nfp/net/driver/wppdefs.h deleted file mode 100644 index da0a176e..00000000 --- a/nfp/net/driver/wppdefs.h +++ /dev/null @@ -1,452 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All Rights Reserved - -Abstract: - - WPP Macro definitions. - -Author: - - Travis Martin (TravM) - ---*/ - -// -// Helpful macros -// - -#ifndef WIDEN2 -#define WIDEN2(x) L ## x -#define WIDEN(x) WIDEN2(x) -#endif - - -// -// WPP definitions. Listed below is a set of WPP Trace macros. The comments -// between "//begin_wpp config" and "//end_wpp" are used by the WPP pre-processor -// to create the *.tmh files -// - - -#define PROXIMITY_COMMON_TRACE L"Microsoft\\Windows\\ProximityCommon" - -#ifndef TRACE_CONTROL_GUID -#define TRACE_CONTROL_GUID (93bfc19b, a967, 4339, a3e6, 3a4cc30681d1) -#endif - -#define WPP_CONTROL_GUIDS \ - WPP_DEFINE_CONTROL_GUID(PROXIMITY, TRACE_CONTROL_GUID, \ - WPP_DEFINE_BIT(EntryExit) \ - WPP_DEFINE_BIT(AllocFree) \ - WPP_DEFINE_BIT(Info) \ - WPP_DEFINE_BIT(Warning) \ - WPP_DEFINE_BIT(Error) \ - \ - WPP_DEFINE_BIT(NoisyEntryExit) \ - WPP_DEFINE_BIT(NoisyAllocFree) \ - WPP_DEFINE_BIT(NoisyInfo) \ - WPP_DEFINE_BIT(NoisyWarning)) - - -// -// Used for trace messages indentation -// -const char __indentSpacer[] = -" " -" " -" " -" " -" " -" "; - -#define INDENT_STR(indent) \ - (__indentSpacer + ((sizeof(__indentSpacer) >= (indent)*5) ? (sizeof(__indentSpacer)-2-(indent)*5) : 0)) - - -//--------------------------------------------------------------------------- -// Stores a pointer to current tracing context -//--------------------------------------------------------------------------- -extern DWORD __g_tracingTlsSlot; - -//--------------------------------------------------------------------------- -// This macro declares the global variable that will store TLS index for the -// tracing context pointer. -//--------------------------------------------------------------------------- -#define DECLARE_TRACING_TLS DWORD __g_tracingTlsSlot = TLS_OUT_OF_INDEXES - -//--------------------------------------------------------------------------- -// To be used only within non-WDTF EXE init routines or by the Tracer. -//--------------------------------------------------------------------------- -inline bool TracingTlsInitialize() -{ - if (__g_tracingTlsSlot == TLS_OUT_OF_INDEXES) - { - __g_tracingTlsSlot = TlsAlloc(); - if (__g_tracingTlsSlot == TLS_OUT_OF_INDEXES) - { - // Return error: cannot allocate TLS slot - return false; - } - } - return true; -} - -//--------------------------------------------------------------------------- -// To be used only within non-WDTF EXE exit routines or by the Tracer. -//--------------------------------------------------------------------------- -inline void TracingTlsFree() -{ - if (__g_tracingTlsSlot != TLS_OUT_OF_INDEXES) - { - TlsFree(__g_tracingTlsSlot); - __g_tracingTlsSlot = TLS_OUT_OF_INDEXES; - } -} - - -namespace TracingInternal -{ - -//--------------------------------------------------------------------------- -// Used for storing current tracing context within a TLS slot -//--------------------------------------------------------------------------- -struct TracingContext -{ - ULONG CallDepth; // Current depth of internal calls - DWORD Context; // A context value (used to correlate scenarios that cross-threads) -}; - -//--------------------------------------------------------------------------- -// Auto-incrementing and decrementing variable -//--------------------------------------------------------------------------- -class AutoStackDepth -{ -public: - __forceinline AutoStackDepth(ULONG *pCallDepth) - : _pCallDepth(pCallDepth) - { - WUDF_SAMPLE_DRIVER_ASSERT(_pCallDepth); - if (_pCallDepth) - { - ++*_pCallDepth; - } - } - - __forceinline ~AutoStackDepth() - { - if (_pCallDepth) - { - --*_pCallDepth; - } - } - -private: - AutoStackDepth(AutoStackDepth& rh); - const AutoStackDepth& operator =(AutoStackDepth& rh); - -private: - ULONG* _pCallDepth; -}; - -//--------------------------------------------------------------------------- -// Sets new value to a variable but saves old value and restores it on -// destrutcion -//--------------------------------------------------------------------------- -template -class AutoRestoredValue -{ -public: - __forceinline AutoRestoredValue(T* pVar, T newVal) - : _pVar(pVar) - , _oldVal() - { - WUDF_SAMPLE_DRIVER_ASSERT(_pVar); - if (_pVar) - { - _oldVal = *_pVar; - *_pVar = newVal; - } - } - - __forceinline ~AutoRestoredValue() - { - if (_pVar) - { - *_pVar = _oldVal; - } - } - -private: - AutoRestoredValue(AutoRestoredValue& rh); - const AutoRestoredValue& operator =(AutoRestoredValue& rh); - -private: - - T* _pVar; - T _oldVal; -}; - -//--------------------------------------------------------------------------- -// Auto-pointer stored in TLS -//--------------------------------------------------------------------------- -template -class AutoTlsPtr -{ -public: - __forceinline AutoTlsPtr() - : _dwSlotIndex(TLS_OUT_OF_INDEXES) - { - } - - __forceinline ~AutoTlsPtr() - { - if (_dwSlotIndex != TLS_OUT_OF_INDEXES) - { - LPVOID pCtx = TlsGetValue(_dwSlotIndex); - if (pCtx) - { - TlsSetValue(_dwSlotIndex, NULL); - } - } - } - - __forceinline Attach(Pointee* pCtx, DWORD dwSlotIndex) - { - _dwSlotIndex = dwSlotIndex; - TlsSetValue(_dwSlotIndex, pCtx); - } - -private: - - DWORD _dwSlotIndex; -}; - -} - - -//--------------------------------------------------------------------------- -// This macro should be used at entry point of all functions with tracing. -// It reads from a Tracing context structure stored in the TLS. -// If the slot contains a NULL a new TracingContext is used. An object -// is created that increments CallDepth and auto-decrements it on function exit. -//--------------------------------------------------------------------------- -#define USE_DEFAULT_TRACING_CONTEXT \ - TracingInternal::TracingContext* __pCtx = (TracingInternal::TracingContext*)TlsGetValue(__g_tracingTlsSlot); \ - TracingInternal::AutoTlsPtr __autoTlsPtr; \ - TracingInternal::TracingContext __ctx; \ - if (__pCtx == NULL) \ - { \ - __pCtx = &__ctx; \ - __pCtx->CallDepth = 0; \ - __autoTlsPtr.Attach(__pCtx, __g_tracingTlsSlot); \ - } \ - TracingInternal::AutoStackDepth __autoStackDepth(&__pCtx->CallDepth); - - -//MACRO: MethodEntry -// -//begin_wpp config -//USEPREFIX (MethodEntry, "%!STDPREFIX!%s-->this(%p):%!FUNC!(", INDENT_STR(__pCtx->CallDepth), this); -//FUNC MethodEntry{ENTRYLEVEL=EntryExit}(MSG, ...); -//USESUFFIX (MethodEntry, ")"); -//end_wpp -#define WPP_ENTRYLEVEL_ENABLED(LEVEL) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_ENTRYLEVEL_LOGGER(LEVEL) WPP_LEVEL_LOGGER(LEVEL) -#define WPP_ENTRYLEVEL_PRE(LEVEL) USE_DEFAULT_TRACING_CONTEXT; - - -//MACRO: MethodReturn -// -//begin_wpp config -//USEPREFIX (MethodReturn, "%!STDPREFIX!%s<--this(%p):%!FUNC!(): ", INDENT_STR(__pCtx->CallDepth), this); -//FUNC MethodReturn{RETURNLEVEL=EntryExit}(RET, MSG, ...); -//end_wpp -#define WPP_RETURNLEVEL_RET_ENABLED(LEVEL, Ret) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_RETURNLEVEL_RET_LOGGER(LEVEL, Ret) WPP_LEVEL_LOGGER(LEVEL) -#define WPP_RETURNLEVEL_RET_POST(LEVEL, Ret) ;return Ret; - - -//MACRO: MethodReturnHR -// -//begin_wpp config -//USEPREFIX (MethodReturnHR, "%!STDPREFIX!%s<--this(%p):%!FUNC!(): %!HRESULT!", INDENT_STR(__pCtx->CallDepth), this, __hr); -//FUNC MethodReturnHR{RETURNHRLEVEL=EntryExit}(HR); -//end_wpp -#define WPP_RETURNHRLEVEL_HR_ENABLED(LEVEL, hr) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_RETURNHRLEVEL_HR_LOGGER(LEVEL, hr) WPP_LEVEL_LOGGER(LEVEL) -#define WPP_RETURNHRLEVEL_HR_PRE(LEVEL, hr) { \ - HRESULT __hr = hr; -#define WPP_RETURNHRLEVEL_HR_POST(LEVEL, hr) /*TraceMessage()*/; \ - return __hr; \ - } -//MACRO: MethodReturnVoid -// -//begin_wpp config -//USEPREFIX (MethodReturnVoid, "%!STDPREFIX!%s<--this(%p):%!FUNC!()", INDENT_STR(__pCtx->CallDepth), this); -//FUNC MethodReturnVoid{RETURNVOIDLEVEL=EntryExit}(...); -//end_wpp -#define WPP_RETURNVOIDLEVEL_ENABLED(LEVEL) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_RETURNVOIDLEVEL_LOGGER(LEVEL) WPP_LEVEL_LOGGER(LEVEL) -#define WPP_RETURNVOIDLEVEL_POST(LEVEL) ;return; - - -//MACRO: MethodReturnBool -// -//begin_wpp config -//USEPREFIX (MethodReturnBool, "%!STDPREFIX!%s<--this(%p):%!FUNC!(): %!bool!", INDENT_STR(__pCtx->CallDepth), this, __bRet); -//FUNC MethodReturnBool{RETURNBOOLLEVEL=EntryExit}(BOOLRETVAL); -//end_wpp -#define WPP_RETURNBOOLLEVEL_BOOLRETVAL_ENABLED(LEVEL, bRet) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_RETURNBOOLLEVEL_BOOLRETVAL_LOGGER(LEVEL, bRet) WPP_LEVEL_LOGGER(LEVEL) -#define WPP_RETURNBOOLLEVEL_BOOLRETVAL_PRE(LEVEL, bRet) { \ - bool __bRet = (bRet ? true : false); -#define WPP_RETURNBOOLLEVEL_BOOLRETVAL_POST(LEVEL, bRet) /*TraceMessage()*/; \ - return __bRet; \ - } -//MACRO: MethodReturnPtr -// -//begin_wpp config -//USEPREFIX (MethodReturnPtr, "%!STDPREFIX!%s<--this(%p):%!FUNC!(): %p", INDENT_STR(__pCtx->CallDepth), this, __ptrRetVal); -//FUNC MethodReturnPtr{RETURNPTRLEVEL=EntryExit}(TYPE, PRET); -//end_wpp -#define WPP_RETURNPTRLEVEL_TYPE_PRET_ENABLED(LEVEL, Type, pRet) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_RETURNPTRLEVEL_TYPE_PRET_LOGGER(LEVEL, Type, pRet) WPP_LEVEL_LOGGER(LEVEL) -#define WPP_RETURNPTRLEVEL_TYPE_PRET_PRE(LEVEL, Type, pRet) { \ - Type __pRet = pRet; -#define WPP_RETURNPTRLEVEL_TYPE_PRET_POST(LEVEL, Type, pRet) /*TraceMessage()*/; \ - return __pRet; \ - } -//MACRO: MethodReturnIfNull -// -//begin_wpp config -//USEPREFIX (MethodReturnIfNull, "%!STDPREFIX!%s<-this(%p):%!FUNC!(): E_POINTER %s=NULL, bailing out!", INDENT_STR(__pCtx->CallDepth), this, #PTR); -//FUNC MethodReturnIfNull{METHOD_POINTER_LEVEL=EntryExit}(PTR); -//end_wpp -#define WPP_METHOD_POINTER_LEVEL_PTR_ENABLED(LEVEL, PTR) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_METHOD_POINTER_LEVEL_PTR_LOGGER(LEVEL, PTR) WPP_LEVEL_LOGGER(LEVEL) -#define WPP_METHOD_POINTER_LEVEL_PTR_PRE(LEVEL, PTR) if ((PTR) == NULL) \ - { -#define WPP_METHOD_POINTER_LEVEL_PTR_POST(LEVEL, PTR) /*TraceMessage()*/; \ - return E_POINTER; \ - } -//MACRO: FunctionEntry -// -//begin_wpp config -//USEPREFIX (FunctionEntry, "%!STDPREFIX!%s-->%!FUNC!(", INDENT_STR(__pCtx->CallDepth)); -//FUNC FunctionEntry{FUNCENTRYLEVEL=EntryExit}(MSG, ...); -//USESUFFIX (FunctionEntry, ")"); -//end_wpp -#define WPP_FUNCENTRYLEVEL_ENABLED(LEVEL) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_FUNCENTRYLEVEL_LOGGER(LEVEL) WPP_LEVEL_LOGGER(LEVEL) -#define WPP_FUNCENTRYLEVEL_PRE(LEVEL) USE_DEFAULT_TRACING_CONTEXT; - - -//MACRO: FunctionReturn -// -//begin_wpp config -//USEPREFIX (FunctionReturn, "%!STDPREFIX!%s<--%!FUNC!(): ", INDENT_STR(__pCtx->CallDepth)); -//FUNC FunctionReturn{FUNCRETURNLEVEL=EntryExit}(RET, MSG, ...); -//end_wpp -#define WPP_FUNCRETURNLEVEL_RET_ENABLED(LEVEL, Ret) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_FUNCRETURNLEVEL_RET_LOGGER(LEVEL, Ret) WPP_LEVEL_LOGGER(LEVEL) -#define WPP_FUNCRETURNLEVEL_RET_POST(LEVEL, Ret) ;return Ret; - - -//MACRO: FunctionReturnHR -// -//begin_wpp config -//USEPREFIX (FunctionReturnHR, "%!STDPREFIX!%s<--%!FUNC!(): %!HRESULT!", INDENT_STR(__pCtx->CallDepth), __hr); -//FUNC FunctionReturnHR{FUNCRETURNHRLEVEL=EntryExit}(HR); -//end_wpp -#define WPP_FUNCRETURNHRLEVEL_HR_ENABLED(LEVEL, hr) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_FUNCRETURNHRLEVEL_HR_LOGGER(LEVEL, hr) WPP_LEVEL_LOGGER(LEVEL) -#define WPP_FUNCRETURNHRLEVEL_HR_PRE(LEVEL, hr) { \ - HRESULT __hr = hr; -#define WPP_FUNCRETURNHRLEVEL_HR_POST(LEVEL, hr) /*TraceMessage()*/; \ - return __hr; \ - } -//MACRO: FunctionReturnVoid -// -//begin_wpp config -//USEPREFIX (FunctionReturnVoid, "%!STDPREFIX!%s<--%!FUNC!()", INDENT_STR(__pCtx->CallDepth)); -//FUNC FunctionReturnVoid{FUNCRETURNLEVELVOID=EntryExit}(...); -//end_wpp -#define WPP_FUNCRETURNLEVELVOID_ENABLED(LEVEL) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_FUNCRETURNLEVELVOID_LOGGER(LEVEL) WPP_LEVEL_LOGGER(LEVEL) -#define WPP_FUNCRETURNLEVELVOID_POST(LEVEL) ;return; - - -//MACRO: FunctionReturnBool -// -//begin_wpp config -//USEPREFIX (FunctionReturnBool, "%!STDPREFIX!%s<--%!FUNC!(): %!bool!", INDENT_STR(__pCtx->CallDepth), __bRet); -//FUNC FunctionReturnBool{FUNCRETURNLEVELBOOL=EntryExit}(BOOLRETVAL); -//end_wpp -#define WPP_FUNCRETURNLEVELBOOL_BOOLRETVAL_ENABLED(LEVEL, bRet) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_FUNCRETURNLEVELBOOL_BOOLRETVAL_LOGGER(LEVEL, bRet) WPP_LEVEL_LOGGER(LEVEL) -#define WPP_FUNCRETURNLEVELBOOL_BOOLRETVAL_PRE(LEVEL, bRet) { \ - bool __bRet = (bRet ? true : false); -#define WPP_FUNCRETURNLEVELBOOL_BOOLRETVAL_POST(LEVEL, bRet) /*TraceMessage()*/; \ - return __bRet; \ - } -//MACRO: FunctionReturnPtr -// -//begin_wpp config -//USEPREFIX (FunctionReturnPtr, "%!STDPREFIX!%s<--%!FUNC!(): %p", INDENT_STR(__pCtx->CallDepth), __pRet); -//FUNC FunctionReturnPtr{FUNCRETURNLEVELPTR=EntryExit}(TYPE, PRET); -//end_wpp -#define WPP_FUNCRETURNLEVELPTR_TYPE_PRET_ENABLED(LEVEL, Type, pRet) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_FUNCRETURNLEVELPTR_TYPE_PRET_LOGGER(LEVEL, Type, pRet) WPP_LEVEL_LOGGER(LEVEL) -#define WPP_FUNCRETURNLEVELPTR_TYPE_PRET_PRE(LEVEL, Type, pRet) { \ - Type __pRet = pRet; -#define WPP_FUNCRETURNLEVELPTR_TYPE_PRET_POST(LEVEL, Type, pRet) /*TraceMessage()*/; \ - return __pRet; \ - } - - - -// Define Non-empty debug break for checked builds only -#ifndef NDEBUG - #define DEBUG_BREAK() __debugbreak() -#else - #define DEBUG_BREAK() do {} while (false) -#endif - - -//MACRO: TraceASSERT -// -// ASSERT with tracing -// -//begin_wpp config -//USEPREFIX (TraceASSERT, "%!STDPREFIX!%sWARN: ASSERTION FAILED - expression \"%s\" is false.", INDENT_STR(__pCtx->CallDepth+1), #EXPR); -//FUNC TraceASSERT{ASSERTLEVEL=Warning}(EXPR); -//end_wpp -#define WPP_ASSERTLEVEL_EXPR_ENABLED(LEVEL, EXPR) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_ASSERTLEVEL_EXPR_LOGGER(LEVEL, EXPR) WPP_LEVEL_LOGGER(LEVEL) -#define WPP_ASSERTLEVEL_EXPR_PRE(LEVEL, EXPR) if (!(EXPR)) \ - { -#define WPP_ASSERTLEVEL_EXPR_POST(LEVEL, EXPR) /*TraceMessage()*/; \ - WUDF_SAMPLE_DRIVER_ASSERT(FALSE); \ - } - -//MACRO: TraceErrorHR -// -// ERROR trace -// -//begin_wpp config -//USEPREFIX (TraceErrorHR, "%!STDPREFIX!%sERROR: ", INDENT_STR(__pCtx->CallDepth+1)); -//FUNC TraceErrorHR{ERRORLEVEL=Error}(HR, MSG, ...); -//USESUFFIX (TraceErrorHR, ": %!HRESULT!", HR); -//end_wpp -#define WPP_ERRORLEVEL_HR_ENABLED(LEVEL, HR) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_ERRORLEVEL_HR_LOGGER(LEVEL, HR) WPP_LEVEL_LOGGER(LEVEL) - -//MACRO: TraceInfo -// -//begin_wpp config -//USEPREFIX (TraceInfo, "%!STDPREFIX!%s", INDENT_STR(__pCtx->CallDepth+1)); -//FUNC TraceInfo{INFOLEVEL=Info}(MSG, ...); -//end_wpp -#define WPP_INFOLEVEL_ENABLED(LEVEL) WPP_LEVEL_ENABLED(LEVEL) -#define WPP_INFOLEVEL_LOGGER(LEVEL) WPP_LEVEL_LOGGER(LEVEL) \ No newline at end of file diff --git a/nfp/net/netnfp.sln b/nfp/net/netnfp.sln index d8897915..dff6f191 100644 --- a/nfp/net/netnfp.sln +++ b/nfp/net/netnfp.sln @@ -3,12 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 VisualStudioVersion = 12.0 MinimumVisualStudioVersion = 12.0 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Driver", "Driver", "{BFCC1107-0069-463E-B32F-5796262F79AB}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Exe", "Exe", "{4AD37F99-392D-419E-91D1-E8CB02B5E908}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NetNfpProvider", "driver\NetNfpProvider.vcxproj", "{7CA060D7-267A-48BC-8FAD-F1B6BA53C2FC}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NetNfpControl", "exe\NetNfpControl.vcxproj", "{6F9C9973-9703-40D9-AA4B-F3D4610DDDB1}" EndProject Global @@ -19,14 +15,6 @@ Global Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7CA060D7-267A-48BC-8FAD-F1B6BA53C2FC}.Debug|Win32.ActiveCfg = Debug|Win32 - {7CA060D7-267A-48BC-8FAD-F1B6BA53C2FC}.Debug|Win32.Build.0 = Debug|Win32 - {7CA060D7-267A-48BC-8FAD-F1B6BA53C2FC}.Release|Win32.ActiveCfg = Release|Win32 - {7CA060D7-267A-48BC-8FAD-F1B6BA53C2FC}.Release|Win32.Build.0 = Release|Win32 - {7CA060D7-267A-48BC-8FAD-F1B6BA53C2FC}.Debug|x64.ActiveCfg = Debug|x64 - {7CA060D7-267A-48BC-8FAD-F1B6BA53C2FC}.Debug|x64.Build.0 = Debug|x64 - {7CA060D7-267A-48BC-8FAD-F1B6BA53C2FC}.Release|x64.ActiveCfg = Release|x64 - {7CA060D7-267A-48BC-8FAD-F1B6BA53C2FC}.Release|x64.Build.0 = Release|x64 {6F9C9973-9703-40D9-AA4B-F3D4610DDDB1}.Debug|Win32.ActiveCfg = Debug|Win32 {6F9C9973-9703-40D9-AA4B-F3D4610DDDB1}.Debug|Win32.Build.0 = Debug|Win32 {6F9C9973-9703-40D9-AA4B-F3D4610DDDB1}.Release|Win32.ActiveCfg = Release|Win32 @@ -40,7 +28,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {7CA060D7-267A-48BC-8FAD-F1B6BA53C2FC} = {BFCC1107-0069-463E-B32F-5796262F79AB} {6F9C9973-9703-40D9-AA4B-F3D4610DDDB1} = {4AD37F99-392D-419E-91D1-E8CB02B5E908} EndGlobalSection EndGlobal -- cgit v1.3.1 From be97ab4846375ead2c997517ade7127fd123eeea Mon Sep 17 00:00:00 2001 From: Wei Mao Date: Tue, 7 Mar 2023 21:51:56 -0800 Subject: [usb/usbview] Fix wrong-type-format-argument (#915) --- usb/usbview/display.c | 18 +- usb/usbview/dispvid.c | 628 +++++++++++++++++++++++++------------------------- 2 files changed, 323 insertions(+), 323 deletions(-) diff --git a/usb/usbview/display.c b/usb/usbview/display.c index f0b4ce66..2cb2c54a 100644 --- a/usb/usbview/display.c +++ b/usb/usbview/display.c @@ -1977,7 +1977,7 @@ DisplayConfigDesc ( AppendTextBuffer("*!*ERROR: bLength of %d for Device Qualifier incorrect, "\ "should be %d\r\n", commonDesc->bLength, - sizeof(USB_DEVICE_QUALIFIER_DESCRIPTOR)); + (UCHAR) sizeof(USB_DEVICE_QUALIFIER_DESCRIPTOR)); OOPS(); displayUnknown = TRUE; break; @@ -1997,7 +1997,7 @@ DisplayConfigDesc ( AppendTextBuffer("*!*ERROR: bLength of %d for Other Speed Configuration "\ "incorrect, should be %d\r\n", commonDesc->bLength, - sizeof(USB_CONFIGURATION_DESCRIPTOR)); + (UCHAR) sizeof(USB_CONFIGURATION_DESCRIPTOR)); OOPS(); displayUnknown = TRUE; } @@ -2019,7 +2019,7 @@ DisplayConfigDesc ( AppendTextBuffer("*!*ERROR: bLength of %d for Configuration incorrect, "\ "should be %d\r\n", commonDesc->bLength, - sizeof(USB_CONFIGURATION_DESCRIPTOR)); + (UCHAR) sizeof(USB_CONFIGURATION_DESCRIPTOR)); OOPS(); displayUnknown = TRUE; break; @@ -2042,8 +2042,8 @@ DisplayConfigDesc ( AppendTextBuffer("*!*ERROR: bLength of %d for Interface incorrect, "\ "should be %d or %d\r\n", commonDesc->bLength, - sizeof(USB_INTERFACE_DESCRIPTOR), - sizeof(USB_INTERFACE_DESCRIPTOR2)); + (UCHAR) sizeof(USB_INTERFACE_DESCRIPTOR), + (UCHAR) sizeof(USB_INTERFACE_DESCRIPTOR2)); OOPS(); displayUnknown = TRUE; break; @@ -2078,8 +2078,8 @@ DisplayConfigDesc ( AppendTextBuffer("*!*ERROR: bLength of %d for Endpoint incorrect, "\ "should be %d or %d\r\n", commonDesc->bLength, - sizeof(USB_ENDPOINT_DESCRIPTOR), - sizeof(USB_ENDPOINT_DESCRIPTOR2)); + (UCHAR) sizeof(USB_ENDPOINT_DESCRIPTOR), + (UCHAR) sizeof(USB_ENDPOINT_DESCRIPTOR2)); OOPS(); displayUnknown = TRUE; break; @@ -2506,7 +2506,7 @@ DisplayUsb20ExtensionCapabilityDescriptor ( AppendTextBuffer("bDevCapabilityType: 0x%02X\r\n", extCapDesc->bDevCapabilityType); AppendTextBuffer("bmAttributes: 0x%08X", - extCapDesc->bmAttributes); + extCapDesc->bmAttributes.AsUlong); if (extCapDesc->bmAttributes.AsUlong & USB_DEVICE_CAPABILITY_USB20_EXTENSION_BMATTRIBUTES_RESERVED_MASK) { if(gDoAnnotation) @@ -2955,7 +2955,7 @@ DisplayBillboardCapabilityDescriptor ( billboardCapDesc->bPreferredAlternateMode); AppendTextBuffer("VCONN Power: 0x%04X", - billboardCapDesc->VconnPower); + billboardCapDesc->VconnPower.AsUshort); if (billboardCapDesc->VconnPower.NoVconnPowerRequired) { diff --git a/usb/usbview/dispvid.c b/usb/usbview/dispvid.c index fa7765fb..b3e3f9df 100644 --- a/usb/usbview/dispvid.c +++ b/usb/usbview/dispvid.c @@ -259,7 +259,7 @@ BOOL DisplayVCInputTerminal ( PVIDEO_INPUT_TERMINAL VidITDesc, PSTRING_DESCRIPTOR_NODE StringDescs, - DEVICE_POWER_STATE LatestDevicePowerState + DEVICE_POWER_STATE LatestDevicePowerState ); BOOL @@ -521,9 +521,9 @@ DisplayVideoDescriptor ( #endif #ifdef H264_SUPPORT - case MAX_TYPE_UNIT+1: + case MAX_TYPE_UNIT+1: // for H.264, the bDescriptorSubtype = 7, which is equal to MAX_TYPE_UNIT - // so now MAX_TYPE_UNIT needs to be set to 8 + // so now MAX_TYPE_UNIT needs to be set to 8 //(TODO: need to change nt\sdpublic\internal\drivers\inc\uvcdesc.h's define // of MAX_TYPE_UNIT from7 to 8, and ad the type for H.264 = 8) #else @@ -897,7 +897,7 @@ DisplayVCHeader ( } AppendTextBuffer("wTotalLength: 0x%04X", VCInterfaceDesc->wTotalLength); - // Verify the total interface size (size of this header and all descriptors + // Verify the total interface size (size of this header and all descriptors // following until and not including the first endpoint) uSize = GetVCInterfaceSize(VCInterfaceDesc); if (uSize != VCInterfaceDesc->wTotalLength) { @@ -906,21 +906,21 @@ DisplayVCHeader ( } else { AppendTextBuffer(" -> Validated\r\n"); } - AppendTextBuffer("dwClockFreq: 0x%08X", + AppendTextBuffer("dwClockFreq: 0x%08X", VCInterfaceDesc->dwClockFreq); - if (gDoAnnotation) + if (gDoAnnotation) { - AppendTextBuffer(" = (%d) Hz", VCInterfaceDesc->dwClockFreq); + AppendTextBuffer(" = (%d) Hz", VCInterfaceDesc->dwClockFreq); } - AppendTextBuffer("\r\nbInCollection: 0x%02X\r\n", + AppendTextBuffer("\r\nbInCollection: 0x%02X\r\n", VCInterfaceDesc->bInCollection); // baInterfaceNr is a variable length field // Size is in bInCollection - for (i = 1, pData = (PUCHAR) &VCInterfaceDesc->bInCollection; + for (i = 1, pData = (PUCHAR) &VCInterfaceDesc->bInCollection; i <= VCInterfaceDesc->bInCollection; i++, pData++) { - AppendTextBuffer("baInterfaceNr[%d]: 0x%02X\r\n", + AppendTextBuffer("baInterfaceNr[%d]: 0x%02X\r\n", i, *pData); } @@ -930,7 +930,7 @@ DisplayVCHeader ( //@@TestCase B2.1 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength - //@@The declared length in the device descriptor is less than required length in + //@@The declared length in the device descriptor is less than required length in //@@ the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n", VCInterfaceDesc->bLength, uSize); @@ -962,8 +962,8 @@ DisplayVCHeader ( //@@Not yet implemented - Priority 1 //@@Descriptor Field - baInterfaceNr //@@We should test to verify each interface number is valid? - // for (i=0; ibInCollection; i++) - // {AppendTextBuffer("baInterfaceNr[%d]: 0x%02X\r\n", i+1, + // for (i=0; ibInCollection; i++) + // {AppendTextBuffer("baInterfaceNr[%d]: 0x%02X\r\n", i+1, // VCInterfaceDesc->baInterfaceNr[i]);} @@ -1016,25 +1016,25 @@ DisplayVCInputTerminal ( AppendTextBuffer("wTerminalType: 0x%04X", VidITDesc->wTerminalType); if(gDoAnnotation) { - pStr = GetStringFromList(slInputTermTypes, + pStr = GetStringFromList(slInputTermTypes, sizeof(slInputTermTypes) / sizeof(STRINGLIST), - VidITDesc->wTerminalType, + VidITDesc->wTerminalType, "Invalid Input Terminal Type"); - AppendTextBuffer(" = (%s)", pStr); + AppendTextBuffer(" = (%s)", pStr); } AppendTextBuffer("\r\n"); - + AppendTextBuffer("bAssocTerminal: 0x%02X\r\n", VidITDesc->bAssocTerminal); AppendTextBuffer("iTerminal: 0x%02X\r\n", VidITDesc->iTerminal); if (gDoAnnotation) { if (VidITDesc->iTerminal) { - // if executing this code, the configuration descriptor has been + // if executing this code, the configuration descriptor has been // obtained. If a device is suspended, then its configuration - // descriptor was not obtained and we do not want errors to be + // descriptor was not obtained and we do not want errors to be // displayed when string descriptors were not obtained. - DisplayStringDescriptor(VidITDesc->iTerminal, StringDescs, LatestDevicePowerState); + DisplayStringDescriptor(VidITDesc->iTerminal, StringDescs, LatestDevicePowerState); } } @@ -1043,7 +1043,7 @@ DisplayVCInputTerminal ( //@@TestCase B3.1 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength - //@@The declared length in the device descriptor is less than required length in + //@@The declared length in the device descriptor is less than required length in //@@ the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d is too small\r\n", VidITDesc->bLength); OOPS(); @@ -1131,11 +1131,11 @@ DisplayVCOutputTerminal ( AppendTextBuffer("wTerminalType: 0x%04X", VidOTDesc->wTerminalType); if(gDoAnnotation) { - pStr = GetStringFromList(slOutputTermTypes, + pStr = GetStringFromList(slOutputTermTypes, sizeof(slOutputTermTypes) / sizeof(STRINGLIST), - VidOTDesc->wTerminalType, + VidOTDesc->wTerminalType, "Invalid Output Terminal Type"); - AppendTextBuffer(" = (%s)", pStr); + AppendTextBuffer(" = (%s)", pStr); } AppendTextBuffer("\r\n"); AppendTextBuffer("bAssocTerminal: 0x%02X\r\n", VidOTDesc->bAssocTerminal); @@ -1145,9 +1145,9 @@ DisplayVCOutputTerminal ( { if (VidOTDesc->iTerminal) { - // if executing this code, the configuration descriptor has been + // if executing this code, the configuration descriptor has been // obtained. If a device is suspended, then its configuration - // descriptor was not obtained and we do not want errors to be + // descriptor was not obtained and we do not want errors to be // displayed when string descriptors were not obtained. DisplayStringDescriptor(VidOTDesc->iTerminal, StringDescs, LatestDevicePowerState); } @@ -1158,7 +1158,7 @@ DisplayVCOutputTerminal ( //@@TestCase B4.1 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength - //@@The declared length in the device descriptor is less than required length in + //@@The declared length in the device descriptor is less than required length in //@@ the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d is too small\r\n", VidOTDesc->bLength); OOPS(); @@ -1252,7 +1252,7 @@ DisplayVCMediaTransInputTerminal( bLength = SizeOfVideoInputMTT(MediaTransportInDesc); AppendTextBuffer("===>Additional Media Transport Input Terminal Data\r\n"); - AppendTextBuffer("bControlSize: 0x%02X\r\n", + AppendTextBuffer("bControlSize: 0x%02X\r\n", MediaTransportInDesc->bControlSize); // point to bControlSize @@ -1263,12 +1263,12 @@ DisplayVCMediaTransInputTerminal( { UINT uBitIndex = 0; BYTE cCheckBit = 0; - BYTE cMask = 1; + BYTE cMask = 1; AppendTextBuffer("bmControls : "); VDisplayBytes(pData + 1, *pData); - - // map the first control + + // map the first control for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData + 1); @@ -1277,9 +1277,9 @@ DisplayVCMediaTransInputTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slMediaTransportControls, + GetStringFromList(slMediaTransportControls, sizeof(slMediaTransportControls) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid MediaTransportCtrl bmControl value")); cMask = cMask << 1; @@ -1294,12 +1294,12 @@ DisplayVCMediaTransInputTerminal( { UINT uBitIndex = 0; BYTE cCheckBit = 0; - BYTE cMask = 1; + BYTE cMask = 1; AppendTextBuffer("bmControls : "); VDisplayBytes(pData + 1, *pData); - - // map the first control + + // map the first control for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData + 1); @@ -1308,18 +1308,18 @@ DisplayVCMediaTransInputTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slMediaTransportModes1, + GetStringFromList(slMediaTransportModes1, sizeof(slMediaTransportModes1) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid MediaTransportMode value")); cMask = cMask << 1; } - + // Is there a second control? if (1 < * pData) { - // map the second control + // map the second control for ( uBitIndex = 8, cMask = 1; uBitIndex < 16; uBitIndex++ ) { cCheckBit = cMask & *(pData + 2); @@ -1328,9 +1328,9 @@ DisplayVCMediaTransInputTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slMediaTransportModes2, + GetStringFromList(slMediaTransportModes2, sizeof(slMediaTransportModes2) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid MediaTransportMode value")); cMask = cMask << 1; @@ -1339,7 +1339,7 @@ DisplayVCMediaTransInputTerminal( // Is there a third control? if (2 < * pData) { - // map the third control + // map the third control for ( uBitIndex = 16, cMask = 1; uBitIndex < 24; uBitIndex++ ) { cCheckBit = cMask & *(pData + 3); @@ -1348,9 +1348,9 @@ DisplayVCMediaTransInputTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slMediaTransportModes3, + GetStringFromList(slMediaTransportModes3, sizeof(slMediaTransportModes3) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid MediaTransportMode value")); cMask = cMask << 1; @@ -1359,7 +1359,7 @@ DisplayVCMediaTransInputTerminal( // Is there a fourth control? if (3 < * pData) { - // map the fourth control + // map the fourth control for ( uBitIndex = 24, cMask = 1; uBitIndex < 32; uBitIndex++ ) { cCheckBit = cMask & *(pData + 4); @@ -1368,9 +1368,9 @@ DisplayVCMediaTransInputTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slMediaTransportModes4, + GetStringFromList(slMediaTransportModes4, sizeof(slMediaTransportModes4) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid MediaTransportMode value")); cMask = cMask << 1; @@ -1379,7 +1379,7 @@ DisplayVCMediaTransInputTerminal( // Is there a fifth control? if (4 < * pData) { - // map the fifth control + // map the fifth control for ( uBitIndex = 32, cMask = 1; uBitIndex < 40; uBitIndex++ ) { cCheckBit = cMask & *(pData + 5); @@ -1388,9 +1388,9 @@ DisplayVCMediaTransInputTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slMediaTransportModes5, + GetStringFromList(slMediaTransportModes5, sizeof(slMediaTransportModes5) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid MediaTransportMode value")); cMask = cMask << 1; @@ -1398,13 +1398,13 @@ DisplayVCMediaTransInputTerminal( } } - // The size of a Media Transport Descriptor is + // The size of a Media Transport Descriptor is // the size of the Descriptor plus // (bControlSize - 1) plus // IF bmControls & 1 THEN 1 (bTransportModeSize) plus // bTransportModeSize - // -// p = sizeof(VIDEO_INPUT_MTT) + + // +// p = sizeof(VIDEO_INPUT_MTT) + // (MediaTransportInDesc->bControlSize - 1); // if (MediaTransportInDesc->bmControls[0] & 1) // p += 1 + (*pData); @@ -1440,7 +1440,7 @@ DisplayVCMediaTransOutputTerminal( PUCHAR pData = NULL; AppendTextBuffer("===>Additional Media Transport Output Terminal Data\r\n"); - AppendTextBuffer("bControlSize: 0x%02X\r\n", + AppendTextBuffer("bControlSize: 0x%02X\r\n", MediaTransportOutDesc->bControlSize); // point to bControlSize @@ -1451,12 +1451,12 @@ DisplayVCMediaTransOutputTerminal( { UINT uBitIndex = 0; BYTE cCheckBit = 0; - BYTE cMask = 1; + BYTE cMask = 1; AppendTextBuffer("bmControls : "); VDisplayBytes(pData + 1, *pData); - - // map the first control + + // map the first control for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData + 1); @@ -1465,9 +1465,9 @@ DisplayVCMediaTransOutputTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slMediaTransportControls, + GetStringFromList(slMediaTransportControls, sizeof(slMediaTransportControls) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid MediaTransportCtrl bmControl value")); cMask = cMask << 1; @@ -1482,12 +1482,12 @@ DisplayVCMediaTransOutputTerminal( { UINT uBitIndex = 0; BYTE cCheckBit = 0; - BYTE cMask = 1; + BYTE cMask = 1; AppendTextBuffer("bmControls : "); VDisplayBytes(pData + 1, *pData); - - // map the first control + + // map the first control for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData + 1); @@ -1496,18 +1496,18 @@ DisplayVCMediaTransOutputTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slMediaTransportModes1, + GetStringFromList(slMediaTransportModes1, sizeof(slMediaTransportModes1) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid MediaTransportMode value")); cMask = cMask << 1; } - + // Is there a second control? if (1 < * pData) { - // map the second control + // map the second control for ( uBitIndex = 8, cMask = 1; uBitIndex < 16; uBitIndex++ ) { cCheckBit = cMask & *(pData + 2); @@ -1516,9 +1516,9 @@ DisplayVCMediaTransOutputTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slMediaTransportModes2, + GetStringFromList(slMediaTransportModes2, sizeof(slMediaTransportModes2) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid MediaTransportMode value")); cMask = cMask << 1; @@ -1527,7 +1527,7 @@ DisplayVCMediaTransOutputTerminal( // Is there a third control? if (2 < * pData) { - // map the third control + // map the third control for ( uBitIndex = 16, cMask = 1; uBitIndex < 24; uBitIndex++ ) { cCheckBit = cMask & *(pData + 3); @@ -1536,9 +1536,9 @@ DisplayVCMediaTransOutputTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slMediaTransportModes3, + GetStringFromList(slMediaTransportModes3, sizeof(slMediaTransportModes3) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid MediaTransportMode value")); cMask = cMask << 1; @@ -1547,7 +1547,7 @@ DisplayVCMediaTransOutputTerminal( // Is there a fourth control? if (3 < * pData) { - // map the fourth control + // map the fourth control for ( uBitIndex = 24, cMask = 1; uBitIndex < 32; uBitIndex++ ) { cCheckBit = cMask & *(pData + 4); @@ -1556,9 +1556,9 @@ DisplayVCMediaTransOutputTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slMediaTransportModes4, + GetStringFromList(slMediaTransportModes4, sizeof(slMediaTransportModes4) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid MediaTransportMode value")); cMask = cMask << 1; @@ -1567,7 +1567,7 @@ DisplayVCMediaTransOutputTerminal( // Is there a fifth control? if (4 < * pData) { - // map the fourth control + // map the fourth control for ( uBitIndex = 32, cMask = 1; uBitIndex < 40; uBitIndex++ ) { cCheckBit = cMask & *(pData + 5); @@ -1576,9 +1576,9 @@ DisplayVCMediaTransOutputTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slMediaTransportModes5, + GetStringFromList(slMediaTransportModes5, sizeof(slMediaTransportModes5) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid MediaTransportMode value")); cMask = cMask << 1; @@ -1586,13 +1586,13 @@ DisplayVCMediaTransOutputTerminal( } } - // The size of a Media Transport Descriptor is + // The size of a Media Transport Descriptor is // the size of the Descriptor plus // (bControlSize - 1) plus // IF bmControls & 1 THEN 1 (bTransportModeSize) plus // bTransportModeSize - // - p = sizeof(VIDEO_OUTPUT_MTT) + + // + p = sizeof(VIDEO_OUTPUT_MTT) + (MediaTransportOutDesc->bControlSize - 1); if (MediaTransportOutDesc->bmControls[0] & 1) p += 1 + (*pData); @@ -1640,12 +1640,12 @@ DisplayVCCameraTerminal( { UINT uBitIndex = 0; BYTE cCheckBit = 0; - BYTE cMask = 1; + BYTE cMask = 1; AppendTextBuffer("bmControls : "); VDisplayBytes(pData + 1, *pData); - - // map the first control + + // map the first control for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData + 1); @@ -1654,18 +1654,18 @@ DisplayVCCameraTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slCameraControl1, + GetStringFromList(slCameraControl1, sizeof(slCameraControl1) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid CamCtrl bmControl value")); cMask = cMask << 1; } - + // Is there a second control? if (1 < * pData) { - // map the second control + // map the second control for ( uBitIndex = 8, cMask = 1; uBitIndex < 16; uBitIndex++ ) { cCheckBit = cMask & *(pData + 2); @@ -1674,9 +1674,9 @@ DisplayVCCameraTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slCameraControl2, + GetStringFromList(slCameraControl2, sizeof(slCameraControl2) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid CamCtrl bmControl value")); cMask = cMask << 1; @@ -1685,7 +1685,7 @@ DisplayVCCameraTerminal( // Is there a third control? if (2 < * pData) { - // map the third control + // map the third control for ( uBitIndex = 16, cMask = 1; uBitIndex < 24; uBitIndex++ ) { cCheckBit = cMask & *(pData + 3); @@ -1694,9 +1694,9 @@ DisplayVCCameraTerminal( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slCameraControl3, + GetStringFromList(slCameraControl3, sizeof(slCameraControl3) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid CamCtrl bmControl value")); cMask = cMask << 1; @@ -1710,7 +1710,7 @@ DisplayVCCameraTerminal( //@@TestCase B7.1 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength - //@@The descriptor should be the size of the descriptor structure + //@@The descriptor should be the size of the descriptor structure //@@ plus the number of controls AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n", CameraDesc->bLength, p); @@ -1784,16 +1784,16 @@ DisplayVCSelectorUnit ( AppendTextBuffer("bDescriptorSubtype: 0x%02X\r\n", VidSelectorDesc->bDescriptorSubtype); AppendTextBuffer("bUnitID: 0x%02X\r\n", VidSelectorDesc->bUnitID); AppendTextBuffer("bNrInPins: 0x%02X\r\n", VidSelectorDesc->bNrInPins); - if (gDoAnnotation) + if (gDoAnnotation) { AppendTextBuffer("===>List of Connected Unit and Terminal ID's\r\n"); } // baSourceID is a variable length field // Size is in bNrInPins, must be at least 1 (so index starts at 1) - for (i = 1, pData = (PUCHAR) &VidSelectorDesc->baSourceID; + for (i = 1, pData = (PUCHAR) &VidSelectorDesc->baSourceID; i <= VidSelectorDesc->bNrInPins; i++, pData++) { - AppendTextBuffer("baSourceID[%d]: 0x%02X\r\n", + AppendTextBuffer("baSourceID[%d]: 0x%02X\r\n", i, *pData); } @@ -1804,9 +1804,9 @@ DisplayVCSelectorUnit ( { if (*pData) { - // if executing this code, the configuration descriptor has been + // if executing this code, the configuration descriptor has been // obtained. If a device is suspended, then its configuration - // descriptor was not obtained and we do not want errors to be + // descriptor was not obtained and we do not want errors to be // displayed when string descriptors were not obtained. DisplayStringDescriptor(*pData, StringDescs, LatestDevicePowerState); } @@ -1848,7 +1848,7 @@ DisplayVCSelectorUnit ( // baSourceID is a variable length field // Size is in bNrInPins, must be at least 1 (so index starts at 1) - for (i = 1, pData = (PUCHAR) &VidSelectorDesc->baSourceID; + for (i = 1, pData = (PUCHAR) &VidSelectorDesc->baSourceID; i <= VidSelectorDesc->bNrInPins; i++, pData++) { if (*pData < 1) @@ -1908,12 +1908,12 @@ DisplayVCProcessingUnit ( { UINT uBitIndex = 0; BYTE cCheckBit = 0; - BYTE cMask = 1; + BYTE cMask = 1; AppendTextBuffer("bmControls : "); VDisplayBytes(pData + 1, *pData); - - // map the first control + + // map the first control for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData + 1); @@ -1922,18 +1922,18 @@ DisplayVCProcessingUnit ( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slProcessorControls1, + GetStringFromList(slProcessorControls1, sizeof(slProcessorControls1) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid PU bmControl value")); cMask = cMask << 1; } - + // Is there a second control? if (1 < * pData) { - // map the second control + // map the second control for ( uBitIndex = 8, cMask = 1; uBitIndex < 16; uBitIndex++ ) { cCheckBit = cMask & *(pData + 2); @@ -1942,19 +1942,19 @@ DisplayVCProcessingUnit ( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slProcessorControls2, + GetStringFromList(slProcessorControls2, sizeof(slProcessorControls2) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid PU bmControl value")); cMask = cMask << 1; } } - + // Is there a third control? if (2 < * pData) { - // map the third control + // map the third control for ( uBitIndex = 16, cMask = 1; uBitIndex < 24; uBitIndex++ ) { cCheckBit = cMask & *(pData + 3); @@ -1963,9 +1963,9 @@ DisplayVCProcessingUnit ( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slProcessorControls3, + GetStringFromList(slProcessorControls3, sizeof(slProcessorControls3) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid PU bmControl value")); cMask = cMask << 1; @@ -1991,9 +1991,9 @@ DisplayVCProcessingUnit ( { if (*pData) { - // if executing this code, the configuration descriptor has been + // if executing this code, the configuration descriptor has been // obtained. If a device is suspended, then its configuration - // descriptor was not obtained and we do not want errors to be + // descriptor was not obtained and we do not want errors to be // displayed when string descriptors were not obtained. DisplayStringDescriptor(*pData, StringDescs, LatestDevicePowerState); } @@ -2004,14 +2004,14 @@ DisplayVCProcessingUnit ( { UINT uBitIndex = 0; BYTE cCheckBit = 0; - BYTE cMask = 1; + BYTE cMask = 1; pData = (PUCHAR) VidProcessingDesc + (VidProcessingDesc->bLength - 1); AppendTextBuffer("bmVideoStandards : "); VDisplayBytes(pData, 1); - // map the first control + // map the first control for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData); @@ -2020,9 +2020,9 @@ DisplayVCProcessingUnit ( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slProcessorVideoStandards, + GetStringFromList(slProcessorVideoStandards, sizeof(slProcessorVideoStandards) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid PU bmVideoStandards value")); cMask = cMask << 1; @@ -2106,16 +2106,16 @@ DisplayVCExtensionUnit ( AppendTextBuffer("guidExtensionCode: %S\r\n", szGUID); AppendTextBuffer("bNumControls: 0x%02X\r\n", VidExtensionDesc->bNumControls); AppendTextBuffer("bNrInPins: 0x%02X\r\n", VidExtensionDesc->bNrInPins); - if (gDoAnnotation) - { + if (gDoAnnotation) + { AppendTextBuffer("===>List of Connected Units and Terminal ID's\r\n"); } // baSourceID is a variable length field // Size is in bNrInPins, must be at least 1 (so index starts at 1) - for (i = 1, pData = (PUCHAR) &VidExtensionDesc->baSourceID; + for (i = 1, pData = (PUCHAR) &VidExtensionDesc->baSourceID; i <= VidExtensionDesc->bNrInPins; i++, pData++) { - AppendTextBuffer("baSourceID[%d]: 0x%02X\r\n", + AppendTextBuffer("baSourceID[%d]: 0x%02X\r\n", i, *pData); } // point to bControlSize (address of bNrInPins plus number of fields in bNrInPins @@ -2135,9 +2135,9 @@ DisplayVCExtensionUnit ( { UINT uBitIndex = 0; BYTE cCheckBit = 0; - BYTE cMask = 1; - - // map byte + BYTE cMask = 1; + + // map byte for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData + i); @@ -2149,7 +2149,7 @@ DisplayVCExtensionUnit ( "Vendor-Specific (Optional)"); cMask = cMask << 1; - } + } } } @@ -2166,15 +2166,15 @@ DisplayVCExtensionUnit ( } // size of descriptor struct size (23) + bNrInPins + bControlSize + iExtension size - // -// p = (sizeof(VIDEO_EXTENSION_UNIT) + // +// p = (sizeof(VIDEO_EXTENSION_UNIT) // + VidExtensionDesc->bNrInPins + bControlSize + 1); if (VidExtensionDesc->bLength != bLength) { //@@TestCase B10.1 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength - //@@The declared length in the device descriptor is not equal to the + //@@The declared length in the device descriptor is not equal to the //@@ required length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of 0x%02X incorrect, should be 0x%02X\r\n", VidExtensionDesc->bLength, p); @@ -2204,7 +2204,7 @@ DisplayVCExtensionUnit ( OOPS(); } - for (i = 1, pData = (PUCHAR) &VidExtensionDesc->baSourceID; + for (i = 1, pData = (PUCHAR) &VidExtensionDesc->baSourceID; i <= VidExtensionDesc->bNrInPins; i++, pData++) { if (*pData == 0) @@ -2252,13 +2252,13 @@ DisplayVidInHeader ( AppendTextBuffer(" -> Validated\r\n"); } - AppendTextBuffer("bEndpointAddress: 0x%02X", + AppendTextBuffer("bEndpointAddress: 0x%02X", VidInHeaderDesc->bEndpointAddress); - if (USB_ENDPOINT_DIRECTION_IN(VidInHeaderDesc->bEndpointAddress)) + if (USB_ENDPOINT_DIRECTION_IN(VidInHeaderDesc->bEndpointAddress)) { if (gDoAnnotation) - { - AppendTextBuffer(" -> Direction: IN - EndpointID: %d", + { + AppendTextBuffer(" -> Direction: IN - EndpointID: %d", (VidInHeaderDesc->bEndpointAddress & 0x0F)); } AppendTextBuffer("\r\n"); @@ -2269,9 +2269,9 @@ DisplayVidInHeader ( AppendTextBuffer(" -> Dynamic Format Change %sSupported", ! (VidInHeaderDesc->bmInfo & 0x01) ? "not " : " "); } - AppendTextBuffer("\r\nbTerminalLink: 0x%02X\r\n", + AppendTextBuffer("\r\nbTerminalLink: 0x%02X\r\n", VidInHeaderDesc->bTerminalLink); - AppendTextBuffer("bStillCaptureMethod: 0x%02X", + AppendTextBuffer("bStillCaptureMethod: 0x%02X", VidInHeaderDesc->bStillCaptureMethod); // globally save the StillMethod, then verify value @@ -2287,35 +2287,35 @@ DisplayVidInHeader ( if (gDoAnnotation) { AppendTextBuffer(" -> Invalid Still Capture Method"); - } + } } else { if (0 == StillMethod) - { + { AppendTextBuffer(" -> No Still Capture"); } else { - AppendTextBuffer(" -> Still Capture Method %d", + AppendTextBuffer(" -> Still Capture Method %d", VidInHeaderDesc->bStillCaptureMethod); } } - AppendTextBuffer("\r\nbTriggerSupport: 0x%02X", + AppendTextBuffer("\r\nbTriggerSupport: 0x%02X", VidInHeaderDesc->bTriggerSupport); if(gDoAnnotation) { AppendTextBuffer(" -> "); - if (! VidInHeaderDesc->bTriggerSupport) + if (! VidInHeaderDesc->bTriggerSupport) AppendTextBuffer("No "); AppendTextBuffer("Hardware Triggering Support"); } AppendTextBuffer("\r\n"); - AppendTextBuffer("bTriggerUsage: 0x%02X", + AppendTextBuffer("bTriggerUsage: 0x%02X", VidInHeaderDesc->bTriggerUsage); - if (gDoAnnotation) + if (gDoAnnotation) { if (VidInHeaderDesc->bTriggerSupport != 0) { @@ -2326,7 +2326,7 @@ DisplayVidInHeader ( } } - AppendTextBuffer("\r\nbControlSize: 0x%02X\r\n", + AppendTextBuffer("\r\nbControlSize: 0x%02X\r\n", VidInHeaderDesc->bControlSize); // are there formats to display? @@ -2335,7 +2335,7 @@ DisplayVidInHeader ( UINT uFormatIndex = 1; UINT uBitIndex = 0; BYTE cCheckBit = 0; - BYTE cMask = 1; + BYTE cMask = 1; // There are (bNumFormats) bmaControls fields, each with size (bControlSize) pData = (PUCHAR) &(VidInHeaderDesc->bControlSize); @@ -2355,8 +2355,8 @@ DisplayVidInHeader ( else { VDisplayBytes(pData, VidInHeaderDesc->bControlSize); - - // map the first control + + // map the first control for (uBitIndex = 0, cMask = 1; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData); @@ -2365,9 +2365,9 @@ DisplayVidInHeader ( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slInputHeaderControls, + GetStringFromList(slInputHeaderControls, sizeof(slInputHeaderControls) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid Control value")); cMask = cMask << 1; @@ -2376,16 +2376,16 @@ DisplayVidInHeader ( pData += VidInHeaderDesc->bControlSize; } } - - p = (sizeof(VIDEO_STREAMING_INPUT_HEADER) + + + p = (sizeof(VIDEO_STREAMING_INPUT_HEADER) + (VidInHeaderDesc->bNumFormats * VidInHeaderDesc->bControlSize)); - if (VidInHeaderDesc->bLength != p) + if (VidInHeaderDesc->bLength != p) { //@@TestCase B11.2 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength - //@@The descriptor should be the size of the descriptor structure - //@@ plus the number of formats times the size of each format + //@@The descriptor should be the size of the descriptor structure + //@@ plus the number of formats times the size of each format AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n", VidInHeaderDesc->bLength, p); OOPS(); @@ -2514,7 +2514,7 @@ DisplayVidOutHeader ( // point to first bmaControls pControls++; - // Size of UVC 1.1 Video Output Header is 1.0 size + // Size of UVC 1.1 Video Output Header is 1.0 size // plus 1 (bControlSize field) plus (number of formats * bControlSize) bLength += 1 + (VidOutHeaderDesc->bNumFormats * bControlSize); @@ -2527,7 +2527,7 @@ DisplayVidOutHeader ( UINT uFormatIndex = 1; UINT uBitIndex = 0; BYTE cCheckBit = 0; - BYTE cMask = 1; + BYTE cMask = 1; // There are (bNumFormats) bmaControls fields, each with size (bControlSize) for ( ; uFormatIndex <= VidOutHeaderDesc->bNumFormats; uFormatIndex++, pControls ++) @@ -2542,8 +2542,8 @@ DisplayVidOutHeader ( else { VDisplayBytes(pControls, bControlSize); - - // map the first control + + // map the first control for (uBitIndex = 0, cMask = 1; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pControls); @@ -2552,9 +2552,9 @@ DisplayVidOutHeader ( uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - ", - GetStringFromList(slOutputHeaderControls, + GetStringFromList(slOutputHeaderControls, sizeof(slOutputHeaderControls) / sizeof(STRINGLIST), - cMask, + cMask, "Invalid control value")); cMask = cMask << 1; @@ -2569,11 +2569,11 @@ DisplayVidOutHeader ( //@@TestCase B12.1 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength - //@@The declared length in the device descriptor is not equal to the + //@@The declared length in the device descriptor is not equal to the //@@ required length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n", VidOutHeaderDesc->bLength, - sizeof(VIDEO_STREAMING_OUTPUT_HEADER)); + (UCHAR) sizeof(VIDEO_STREAMING_OUTPUT_HEADER)); OOPS(); } @@ -2665,7 +2665,7 @@ DisplayStillImageFrame ( AppendTextBuffer("bDescriptorType: 0x%02X\r\n", StillFrameDesc->bDescriptorType); AppendTextBuffer("bDescriptorSubtype: 0x%02X\r\n", StillFrameDesc->bDescriptorSubtype); AppendTextBuffer("bEndpointAddress: 0x%02X\r\n", StillFrameDesc->bEndpointAddress); - AppendTextBuffer("bNumImageSizePatterns: 0x%02X\r\n", + AppendTextBuffer("bNumImageSizePatterns: 0x%02X\r\n", StillFrameDesc->bNumImageSizePatterns); if (StillFrameDesc->bNumImageSizePatterns < 1) { @@ -2681,7 +2681,7 @@ DisplayStillImageFrame ( // point to first StillFrameDesc->dwStillImage structure pXY = (VIDEO_STILL_IMAGE_RECT *) &StillFrameDesc->aStillRect[0]; - for (i = 1; i <= StillFrameDesc->bNumImageSizePatterns; i++, pXY++) + for (i = 1; i <= StillFrameDesc->bNumImageSizePatterns; i++, pXY++) { AppendTextBuffer("wWidth[%d]: 0x%04X\r\n", i, pXY->wWidth); @@ -2694,10 +2694,10 @@ DisplayStillImageFrame ( uNumComp = *pbCurr; AppendTextBuffer("bNumCompressionPattern: 0x%02X\r\n", *pbCurr++); - for (i = 1; i <= uNumComp; i++) + for (i = 1; i <= uNumComp; i++) { - AppendTextBuffer("bCompression[%d]: 0x%02X\r\n", - i, *pbCurr++); + AppendTextBuffer("bCompression[%d]: 0x%02X\r\n", + i, *pbCurr++); } switch(StillMethod) { @@ -2747,9 +2747,9 @@ DisplayStillImageFrame ( "This should be non-zero when using StillMethod 3.\r\n", (StillFrameDesc->bEndpointAddress)); OOPS(); } - if (gDoAnnotation) + if (gDoAnnotation) { - AppendTextBuffer(" -> Direction: IN - EndpointID: %d", + AppendTextBuffer(" -> Direction: IN - EndpointID: %d", (StillFrameDesc->bEndpointAddress & 0x0F)); } AppendTextBuffer("\r\n"); @@ -2807,7 +2807,7 @@ DisplayColorMatching ( //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n", ColorMatchDesc->bLength, - sizeof(VIDEO_COLORFORMAT)); + (UCHAR) sizeof(VIDEO_COLORFORMAT)); OOPS(); } @@ -2835,7 +2835,7 @@ DisplayColorMatching ( //***************************************************************************** // -// DisplayUncompressedFormat() +// DisplayUncompressedFormat() // //***************************************************************************** @@ -2865,13 +2865,13 @@ DisplayUncompressedFormat ( AppendTextBuffer("guidFormat: %S", szGUID); pStr = VidFormatGUIDCodeToName((REFGUID) &UnCompFormatDesc->guidFormat); - if ( pStr ) + if ( pStr ) { if ( gDoAnnotation ) { AppendTextBuffer(" = %s Format", pStr); } - } + } AppendTextBuffer("\r\n"); AppendTextBuffer("bBitsPerPixel: 0x%02X\r\n", UnCompFormatDesc->bBitsPerPixel); AppendTextBuffer("bDefaultFrameIndex: 0x%02X\r\n", UnCompFormatDesc->bDefaultFrameIndex); @@ -2881,11 +2881,11 @@ DisplayUncompressedFormat ( //@@TestCase B15.1 (descript.c line 925) //@@ERROR //@@Descriptor Field - bLength - //@@The declared length in the device descriptor is not equal to the required + //@@The declared length in the device descriptor is not equal to the required //@@length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n", UnCompFormatDesc->bLength, - sizeof(VIDEO_FORMAT_UNCOMPRESSED)); + (UCHAR) sizeof(VIDEO_FORMAT_UNCOMPRESSED)); OOPS(); } @@ -2904,7 +2904,7 @@ DisplayUncompressedFormat ( //@@TestCase B15.3 (descript.c line 930) //@@ERROR //@@Descriptor Field - bNumFrameDescriptors - //@@bNumFrameDescriptors is set to zero which is not in accordance with the + //@@bNumFrameDescriptors is set to zero which is not in accordance with the //@@USB Video Device Specification AppendTextBuffer("*!*ERROR: bNumFrameDescriptors = 0, must have at least 1 Frame descriptor\r\n"); OOPS(); @@ -2930,7 +2930,7 @@ DisplayUncompressedFormat ( OOPS(); } - if (UnCompFormatDesc->bDefaultFrameIndex == 0 || UnCompFormatDesc->bDefaultFrameIndex > + if (UnCompFormatDesc->bDefaultFrameIndex == 0 || UnCompFormatDesc->bDefaultFrameIndex > UnCompFormatDesc->bNumFrameDescriptors) { //@@TestCase B15.6 (desctipt.c line 945) @@ -2943,28 +2943,28 @@ DisplayUncompressedFormat ( OOPS(); } - AppendTextBuffer("bAspectRatioX: 0x%02X\r\n", + AppendTextBuffer("bAspectRatioX: 0x%02X\r\n", UnCompFormatDesc->bAspectRatioX); - AppendTextBuffer("bAspectRatioY: 0x%02X", + AppendTextBuffer("bAspectRatioY: 0x%02X", UnCompFormatDesc->bAspectRatioY); - if (((UnCompFormatDesc->bmInterlaceFlags & 0x01) && - (UnCompFormatDesc->bAspectRatioY != 0 && + if (((UnCompFormatDesc->bmInterlaceFlags & 0x01) && + (UnCompFormatDesc->bAspectRatioY != 0 && UnCompFormatDesc->bAspectRatioX != 0))) { - if(gDoAnnotation) + if(gDoAnnotation) { AppendTextBuffer(" -> Aspect Ratio is set for a %d:%d display", - (UnCompFormatDesc->bAspectRatioX),(UnCompFormatDesc->bAspectRatioY)); - } - else + (UnCompFormatDesc->bAspectRatioX),(UnCompFormatDesc->bAspectRatioY)); + } + else { if (UnCompFormatDesc->bAspectRatioY != 0 || UnCompFormatDesc->bAspectRatioX != 0) { //@@TestCase B15.7 //@@ERROR //@@Descriptor Field - bAspectRatioX, bAspectRatioY - //@@Verify that that bAspectRatioX and bAspectRatioY are set to zero + //@@Verify that that bAspectRatioX and bAspectRatioY are set to zero //@@ if stream is non-interlaced AppendTextBuffer("\r\n*!*ERROR: Both bAspectRatioX and bAspectRatioY "\ "must equal 0 if stream is non-interlaced"); @@ -2972,27 +2972,27 @@ DisplayUncompressedFormat ( } } } - AppendTextBuffer("\r\nbmInterlaceFlags: 0x%02X\r\n", + AppendTextBuffer("\r\nbmInterlaceFlags: 0x%02X\r\n", UnCompFormatDesc->bmInterlaceFlags); - if (gDoAnnotation) + if (gDoAnnotation) { - AppendTextBuffer(" D0 = 0x%02X Interlaced stream or variable: %s\r\n", + AppendTextBuffer(" D0 = 0x%02X Interlaced stream or variable: %s\r\n", (UnCompFormatDesc->bmInterlaceFlags & 1), (UnCompFormatDesc->bmInterlaceFlags & 1) ? "Yes" : "No"); - AppendTextBuffer(" D1 = 0x%02X Fields per frame: %s\r\n", + AppendTextBuffer(" D1 = 0x%02X Fields per frame: %s\r\n", ((UnCompFormatDesc->bmInterlaceFlags >> 1) & 1), ((UnCompFormatDesc->bmInterlaceFlags >> 1) & 1) ? "1 field" : "2 fields"); - AppendTextBuffer(" D2 = 0x%02X Field 1 first: %s\r\n", + AppendTextBuffer(" D2 = 0x%02X Field 1 first: %s\r\n", ((UnCompFormatDesc->bmInterlaceFlags >> 2) & 1), ((UnCompFormatDesc->bmInterlaceFlags >> 2) & 1) ? "Yes" : "No"); //@@TestCase B15.9 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bmInterlaceFlags //@@Validate that reserved bits (D3) are set to zero. - AppendTextBuffer(" D3 = 0x%02X Reserved%s\r\n", + AppendTextBuffer(" D3 = 0x%02X Reserved%s\r\n", ((UnCompFormatDesc->bmInterlaceFlags >> 3) & 1), - ((UnCompFormatDesc->bmInterlaceFlags >> 3) & 1) ? + ((UnCompFormatDesc->bmInterlaceFlags >> 3) & 1) ? "\r\n*!*ERROR: Reserved to 0" : "" ); AppendTextBuffer(" D4..5 = 0x%02X Field patterns ->", ((UnCompFormatDesc->bmInterlaceFlags >> 4) & 3)); @@ -3038,11 +3038,11 @@ DisplayUncompressedFormat ( //@@TestCase B15.11 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bCopyProtect - //@@Question - Are their reserved bits and should we validate that + //@@Question - Are their reserved bits and should we validate that //@@ reserved bits are set to zero? - AppendTextBuffer("\r\nbCopyProtect: 0x%02X", + AppendTextBuffer("\r\nbCopyProtect: 0x%02X", UnCompFormatDesc->bCopyProtect); - if (gDoAnnotation) + if (gDoAnnotation) { if (UnCompFormatDesc->bCopyProtect) AppendTextBuffer(" -> Duplication Restricted"); @@ -3079,10 +3079,10 @@ DisplayUncompressedFrameType ( //@@DisplayUncompressedFrameType -Uncompressed Frame AppendTextBuffer("\r\n ===>Video Streaming Uncompressed Frame Type Descriptor<===\r\n"); - if (gDoAnnotation) + if (gDoAnnotation) { if(UnCompFrameDesc->bFrameIndex == g_chUNCFrameDefault) - { + { AppendTextBuffer(" --->This is the Default (optimum) Frame index\r\n"); } } @@ -3103,7 +3103,7 @@ DisplayUncompressedFrameType ( // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse - AppendTextBuffer("dwDefaultFrameInterval: 0x%08X = %lf mSec (%4.2f Hz)\r\n", + AppendTextBuffer("dwDefaultFrameInterval: 0x%08X = %lf mSec (%4.2f Hz)\r\n", UnCompFrameDesc->dwDefaultFrameInterval, ((double)UnCompFrameDesc->dwDefaultFrameInterval)/10000.0, (10000000.0/((double)UnCompFrameDesc->dwDefaultFrameInterval)) @@ -3115,10 +3115,10 @@ DisplayUncompressedFrameType ( //@@TestCase B15.1 (descript.c line 925) //@@ERROR //@@Descriptor Field - bLength - //@@The declared length in the device descriptor is not equal to the required + //@@The declared length in the device descriptor is not equal to the required //@@length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n", - UnCompFrameDesc->bLength, bLength); + UnCompFrameDesc->bLength, (UCHAR) bLength); OOPS(); } @@ -3127,7 +3127,7 @@ DisplayUncompressedFrameType ( //@@TestCase B16.2 (descript.c line 991) //@@ERROR //@@Descriptor Field - bFrameIndex - //@@bFrameIndex must be nonzero + //@@bFrameIndex must be nonzero AppendTextBuffer("*!*ERROR: bFrameIndex = 0, this is a 1 based index\r\n"); OOPS(); } @@ -3187,9 +3187,9 @@ DisplayUncompressedFrameType ( AppendTextBuffer("*!*ERROR: dwMinBitRate should be less than dwMaxBitRate\r\n"); OOPS(); } - else + else { - if (UnCompFrameDesc->bFrameIntervalType == 1 && + if (UnCompFrameDesc->bFrameIntervalType == 1 && UnCompFrameDesc->dwMinBitRate != UnCompFrameDesc->dwMaxBitRate) { //@@TestCase B16.9 @@ -3257,12 +3257,12 @@ DisplayUnComContinuousFrameType( // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse - AppendTextBuffer("dwMinFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", + AppendTextBuffer("dwMinFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", dwMinFrameInterval, ((double)dwMinFrameInterval)/10000.0, (ULONG)(10000000.0/((double)dwMinFrameInterval) + 0.5)); - - AppendTextBuffer("dwMaxFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", + + AppendTextBuffer("dwMaxFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", dwMaxFrameInterval, ((double)dwMaxFrameInterval)/10000.0, (ULONG)(10000000.0/((double)dwMaxFrameInterval) + 0.5)); @@ -3367,7 +3367,7 @@ DisplayUnComDiscreteFrameType( // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse - AppendTextBuffer("dwFrameInterval[%d]: 0x%08X = %lf mSec (%4.2f Hz)\r\n", + AppendTextBuffer("dwFrameInterval[%d]: 0x%08X = %lf mSec (%4.2f Hz)\r\n", iNdex, *ulFrameInterval, ((double)*ulFrameInterval)/10000.0, (10000000.0/((double)*ulFrameInterval)) @@ -3422,11 +3422,11 @@ DisplayMJPEGFormat ( //@@TestCase B19.1 (descript.c line 1098) //@@ERROR //@@Descriptor Field - bLength - //@@The declared length in the device descriptor is not equal to the + //@@The declared length in the device descriptor is not equal to the //@@ required length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n", MJPEGFormatDesc->bLength, - sizeof(VIDEO_FORMAT_MJPEG)); + (UCHAR) sizeof(VIDEO_FORMAT_MJPEG)); OOPS(); } @@ -3435,7 +3435,7 @@ DisplayMJPEGFormat ( //@@TestCase B19.2 (descript.c line 1103) //@@ERROR //@@Descriptor Field - bFormatIndex - //@@bFormatIndex is set to zero which is not in accordance with + //@@bFormatIndex is set to zero which is not in accordance with //@@ the USB Video Device Specification AppendTextBuffer("*!*ERROR: bFormatIndex must be non-zero\r\n"); OOPS(); @@ -3446,41 +3446,41 @@ DisplayMJPEGFormat ( //@@TestCase B19.3 (descript.c line 1108) //@@ERROR //@@Descriptor Field - bNumFrameDescriptors - //@@bNumFrameDescriptors is set to zero which is not in accordance + //@@bNumFrameDescriptors is set to zero which is not in accordance //@@ with the USB Video Device Specification AppendTextBuffer("*!*ERROR: bNumFrameDescriptors must be non-zero\r\n"); OOPS(); } - AppendTextBuffer("bmFlags: 0x%02X", + AppendTextBuffer("bmFlags: 0x%02X", (MJPEGFormatDesc->bmFlags & 0x01)); //@@TestCase B19.4 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bmFlags //@@We should validate that reserved bits are set to zero. - if (gDoAnnotation) + if (gDoAnnotation) { if(MJPEGFormatDesc->bmFlags & 0x01) - { + { AppendTextBuffer(" -> Sample Size is Fixed"); } else - { + { AppendTextBuffer(" -> Sample Size is Not Fixed"); } } - AppendTextBuffer("\r\nbDefaultFrameIndex: 0x%02X\r\n", + AppendTextBuffer("\r\nbDefaultFrameIndex: 0x%02X\r\n", MJPEGFormatDesc->bDefaultFrameIndex); - if (MJPEGFormatDesc->bDefaultFrameIndex == 0 || - MJPEGFormatDesc->bDefaultFrameIndex > + if (MJPEGFormatDesc->bDefaultFrameIndex == 0 || + MJPEGFormatDesc->bDefaultFrameIndex > MJPEGFormatDesc->bNumFrameDescriptors) { //@@TestCase B19.5 (descript.c line 1113) //@@ERROR //@@Descriptor Field - bDefaultFrameIndex - //@@bDefaultFrameIndex is not in the domain of constrained by + //@@bDefaultFrameIndex is not in the domain of constrained by //@@ bNumFrameDescriptors AppendTextBuffer("*!*ERROR: bDefaultFrameIndex 0x%02X invalid, should "\ "be between 1 and 0x%02x/r/n", @@ -3489,56 +3489,56 @@ DisplayMJPEGFormat ( OOPS(); } - AppendTextBuffer("bAspectRatioX: 0x%02X\r\n", + AppendTextBuffer("bAspectRatioX: 0x%02X\r\n", MJPEGFormatDesc->bAspectRatioX); - AppendTextBuffer("bAspectRatioY: 0x%02X", + AppendTextBuffer("bAspectRatioY: 0x%02X", MJPEGFormatDesc->bAspectRatioY); - if(((MJPEGFormatDesc->bmInterlaceFlags & 0x01) && - ((MJPEGFormatDesc->bAspectRatioY != 0) && - (MJPEGFormatDesc->bAspectRatioX != 0)))) + if(((MJPEGFormatDesc->bmInterlaceFlags & 0x01) && + ((MJPEGFormatDesc->bAspectRatioY != 0) && + (MJPEGFormatDesc->bAspectRatioX != 0)))) { if (gDoAnnotation) { - AppendTextBuffer(" -> Aspect Ratio is set for a %d:%d display", + AppendTextBuffer(" -> Aspect Ratio is set for a %d:%d display", (MJPEGFormatDesc->bAspectRatioX), (MJPEGFormatDesc->bAspectRatioY)); } } - else + else { if (MJPEGFormatDesc->bAspectRatioY != 0 || MJPEGFormatDesc->bAspectRatioX != 0) { //@@TestCase B19.6 //@@ERROR //@@Descriptor Field - bAspectRatioX and bAspectRatioY - //@@Verify that that bAspectRatioX and bAspectRatioY are set to zero + //@@Verify that that bAspectRatioX and bAspectRatioY are set to zero //@@ if stream is non-interlaced AppendTextBuffer("\r\n*!*ERROR: bAspectRatioX and bAspectRatioY must "\ "be 0 if stream non-Interlaced"); OOPS(); } } - AppendTextBuffer("\r\nbmInterlaceFlags: 0x%02X\r\n", + AppendTextBuffer("\r\nbmInterlaceFlags: 0x%02X\r\n", MJPEGFormatDesc->bmInterlaceFlags); if (gDoAnnotation) { - AppendTextBuffer(" D00 = %x %sInterlaced stream or variable\r\n", + AppendTextBuffer(" D00 = %x %sInterlaced stream or variable\r\n", (MJPEGFormatDesc->bmInterlaceFlags & 1), (MJPEGFormatDesc->bmInterlaceFlags & 1) ? "" : " non-"); - AppendTextBuffer(" D01 = %x %s per frame\r\n", + AppendTextBuffer(" D01 = %x %s per frame\r\n", ((MJPEGFormatDesc->bmInterlaceFlags >> 1) & 1), ((MJPEGFormatDesc->bmInterlaceFlags >> 1) & 1) ? " 1 field" : " 2 fields"); - AppendTextBuffer(" D02 = %x Field 1 %sfirst\r\n", + AppendTextBuffer(" D02 = %x Field 1 %sfirst\r\n", ((MJPEGFormatDesc->bmInterlaceFlags >> 2) & 1), ((MJPEGFormatDesc->bmInterlaceFlags >> 2) & 1) ? "" : "not "); //@@TestCase B19.7 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bmInterlaceFlags //@@Validate that reserved bits (D3) are set to zero. - AppendTextBuffer(" D03 = %x Reserved%s\r\n", + AppendTextBuffer(" D03 = %x Reserved%s\r\n", ((MJPEGFormatDesc->bmInterlaceFlags >> 3) & 1), - ((MJPEGFormatDesc->bmInterlaceFlags >> 3) & 1) ? + ((MJPEGFormatDesc->bmInterlaceFlags >> 3) & 1) ? "\r\n*!*ERROR: non zero" : "" ); AppendTextBuffer(" D4..5 = %x Field patterns ->", ((MJPEGFormatDesc->bmInterlaceFlags >> 4) & 3)); @@ -3583,11 +3583,11 @@ DisplayMJPEGFormat ( //@@TestCase B19.9 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bCopyProtect - //@@Question - Are their reserved bits and should we validate that + //@@Question - Are their reserved bits and should we validate that //@@ reserved bits are set to zero? - AppendTextBuffer("\r\nbCopyProtect: 0x%02X", + AppendTextBuffer("\r\nbCopyProtect: 0x%02X", MJPEGFormatDesc->bCopyProtect); - if (gDoAnnotation) + if (gDoAnnotation) { if (MJPEGFormatDesc->bCopyProtect) AppendTextBuffer(" -> Duplication Restricted"); @@ -3620,10 +3620,10 @@ DisplayMJPEGFrameType ( bLength = SizeOfVideoFrameMjpeg(MJPEGFrameDesc); AppendTextBuffer("\r\n ===>Video Streaming MJPEG Frame Type Descriptor<===\r\n"); - if (gDoAnnotation) + if (gDoAnnotation) { if(MJPEGFrameDesc->bFrameIndex == g_chMJPEGFrameDefault) - { + { AppendTextBuffer(" --->This is the Default (optimum) Frame index\r\n"); } } @@ -3645,7 +3645,7 @@ DisplayMJPEGFrameType ( // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse - AppendTextBuffer("dwDefaultFrameInterval: 0x%08X = %lf mSec (%4.2f Hz)\r\n", + AppendTextBuffer("dwDefaultFrameInterval: 0x%08X = %lf mSec (%4.2f Hz)\r\n", MJPEGFrameDesc->dwDefaultFrameInterval, ((double)MJPEGFrameDesc->dwDefaultFrameInterval)/10000.0, (10000000.0/((double)MJPEGFrameDesc->dwDefaultFrameInterval)) @@ -3659,7 +3659,7 @@ DisplayMJPEGFrameType ( //@@Descriptor Field - bLength //@@The declared length in the device descriptor is less than required length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d is incorrect, should be %d\r\n", - MJPEGFrameDesc->bLength, bLength); + MJPEGFrameDesc->bLength, (UCHAR) bLength); OOPS(); } @@ -3796,12 +3796,12 @@ DisplayMJPEGContinuousFrameType( // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse - AppendTextBuffer("dwMinFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", + AppendTextBuffer("dwMinFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", dwMinFrameInterval, ((double)dwMinFrameInterval)/10000.0, (ULONG)(10000000.0/((double)dwMinFrameInterval) + 0.5)); - - AppendTextBuffer("dwMaxFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", + + AppendTextBuffer("dwMaxFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", dwMaxFrameInterval, ((double)dwMaxFrameInterval)/10000.0, (ULONG)(10000000.0/((double)dwMaxFrameInterval) + 0.5)); @@ -3907,7 +3907,7 @@ DisplayMJPEGDiscreteFrameType( // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse - AppendTextBuffer("dwFrameInterval[%d]: 0x%08X = %lf mSec (%4.2f Hz)\r\n", + AppendTextBuffer("dwFrameInterval[%d]: 0x%08X = %lf mSec (%4.2f Hz)\r\n", iNdex, *ulFrameInterval, ((double)*ulFrameInterval)/10000.0, (10000000.0/((double)*ulFrameInterval)) @@ -3969,7 +3969,7 @@ DisplayMPEG1SSFormat ( //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d. USBView cannot correctly display descriptor\r\n", MPEG1SSFormatDesc->bLength, - sizeof(VIDEO_FORMAT_MPEG1SS)); + (UCHAR) sizeof(VIDEO_FORMAT_MPEG1SS)); OOPS(); } @@ -4035,7 +4035,7 @@ DisplayMPEG2PSFormat ( //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d. USBView cannot correctly display descriptor\r\n", MPEG2PSFormatDesc->bLength, - sizeof(VIDEO_FORMAT_MPEG2PS)); + (UCHAR) sizeof(VIDEO_FORMAT_MPEG2PS)); OOPS(); AppendTextBuffer("*!*USBView will try to display the rest of the descriptor but results may not be accurate\r\n"); } @@ -4115,13 +4115,13 @@ DisplayMPEG2TSFormat ( i++; AppendTextBuffer("guidStrideFormat: %S", szGUID); pStr = VidFormatGUIDCodeToName((REFGUID) pStrideGuid); - if(gDoAnnotation) + if(gDoAnnotation) { if (pStr) { AppendTextBuffer(" = %s Format", pStr); } - } + } AppendTextBuffer("\r\n"); bLength = sizeof(VIDEO_FORMAT_MPEG2TS) + sizeof(GUID); } @@ -4134,7 +4134,7 @@ DisplayMPEG2TSFormat ( //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n", MPEG2TSFormatDesc->bLength, - sizeof(VIDEO_FORMAT_MPEG2TS)); + (UCHAR) sizeof(VIDEO_FORMAT_MPEG2TS)); OOPS(); } @@ -4186,7 +4186,7 @@ DisplayMPEG4SLFormat ( //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d. USBView cannot correctly display descriptor\r\n", MPEG4SLFormatDesc->bLength, - sizeof(VIDEO_FORMAT_MPEG4SL)); + (UCHAR) sizeof(VIDEO_FORMAT_MPEG4SL)); OOPS(); } @@ -4244,13 +4244,13 @@ DisplayStreamPayload ( AppendTextBuffer("guidFormat: %S", szGUID); pStr = VidFormatGUIDCodeToName((REFGUID) &StreamPayloadDesc->guidFormat); - if(gDoAnnotation) + if(gDoAnnotation) { if (pStr) { AppendTextBuffer(" = %s Format", pStr); } - } + } AppendTextBuffer("\r\n"); AppendTextBuffer("dwPacketLength: 0x%02X\r\n", StreamPayloadDesc->dwPacketLength); @@ -4261,7 +4261,7 @@ DisplayStreamPayload ( //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n", StreamPayloadDesc->bLength, - sizeof(PVIDEO_FORMAT_STREAM)); + (UCHAR) sizeof(PVIDEO_FORMAT_STREAM)); OOPS(); } @@ -4302,10 +4302,10 @@ DisplayDVFormat ( AppendTextBuffer("bFormatIndex: 0x%02X\r\n", DVFormatDesc->bFormatIndex); AppendTextBuffer("dwMaxVideoFrameBufferSize: 0x%08X\r\n", DVFormatDesc->dwMaxVideoFrameBufferSize); AppendTextBuffer("bFormatType: 0x%02X\r\n", DVFormatDesc->bFormatType); - if (gDoAnnotation) + if (gDoAnnotation) { AppendTextBuffer(" D0..6 = Format Type ->"); - switch(DVFormatDesc->bFormatType & 0x03) + switch(DVFormatDesc->bFormatType & 0x03) { case 0x00: AppendTextBuffer(" SD-DV\r\n"); @@ -4334,7 +4334,7 @@ DisplayDVFormat ( //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n", DVFormatDesc->bLength, - sizeof(VIDEO_FORMAT_DV)); + (UCHAR) sizeof(VIDEO_FORMAT_DV)); OOPS(); } @@ -4344,7 +4344,7 @@ DisplayDVFormat ( //@@ERROR //@@Descriptor Field - bFormatIndex //@@bFormatIndex invalid - AppendTextBuffer("*!*ERROR: bFormatIndex of 0x%02X is invalid\r\n", + AppendTextBuffer("*!*ERROR: bFormatIndex of 0x%02X is invalid\r\n", DVFormatDesc->bFormatIndex); OOPS(); } @@ -4355,7 +4355,7 @@ DisplayDVFormat ( //@@ERROR //@@Descriptor Field - dwMaxVideoFrameBufferSize //@@dwMaxVideoFrameBufferSize invalid - AppendTextBuffer("*!*ERROR: dwMaxVideoFrameBufferSize of 0x%02X is invalid\r\n", + AppendTextBuffer("*!*ERROR: dwMaxVideoFrameBufferSize of 0x%02X is invalid\r\n", DVFormatDesc->dwMaxVideoFrameBufferSize); OOPS(); } @@ -4420,7 +4420,7 @@ DisplayVendorVidFormat ( //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d. USBView cannot correctly display descriptor\r\n", VendorVidFormatDesc->bLength, - sizeof(VIDEO_FORMAT_VENDOR)); + (UCHAR) sizeof(VIDEO_FORMAT_VENDOR)); OOPS(); } @@ -4528,10 +4528,10 @@ DisplayVendorVidFrameType ( bLength = SizeOfVideoFrameVendor(VendorVidFrameDesc); AppendTextBuffer("\r\n ===>Video Streaming Vendor Video Frame Type Descriptor<===\r\n"); - if (gDoAnnotation) + if (gDoAnnotation) { if(VendorVidFrameDesc->bFrameIndex == g_chVendorFrameDefault) - { + { AppendTextBuffer(" --->This is the Default (optimum) Frame index\r\n"); } } @@ -4547,7 +4547,7 @@ DisplayVendorVidFrameType ( //@@Descriptor Field - bLength //@@The declared length in the device descriptor is less than required length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n", - VendorVidFrameDesc->bLength, bLength); + VendorVidFrameDesc->bLength, (UCHAR) bLength); OOPS(); } @@ -4587,7 +4587,7 @@ DisplayVendorVidFrameType ( // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse - AppendTextBuffer("dwDefaultFrameInterval: 0x%08X = %lf mSec (%4.2f Hz)\r\n", + AppendTextBuffer("dwDefaultFrameInterval: 0x%08X = %lf mSec (%4.2f Hz)\r\n", VendorVidFrameDesc->dwDefaultFrameInterval, ((double)VendorVidFrameDesc->dwDefaultFrameInterval)/10000.0, (10000000.0/((double)VendorVidFrameDesc->dwDefaultFrameInterval)) @@ -4645,7 +4645,7 @@ DisplayVendorVidFrameType ( } else { - if (VendorVidFrameDesc->bFrameIntervalType == 1 && + if (VendorVidFrameDesc->bFrameIntervalType == 1 && VendorVidFrameDesc->dwMinBitRate != VendorVidFrameDesc->dwMaxBitRate) { //@@TestCase B29.9 @@ -4726,12 +4726,12 @@ DisplayVendorVidContinuousFrameType( // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse - AppendTextBuffer("dwMinFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", + AppendTextBuffer("dwMinFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", dwMinFrameInterval, ((double)dwMinFrameInterval)/10000.0, (ULONG)(10000000.0/((double)dwMinFrameInterval) + 0.5)); - - AppendTextBuffer("dwMaxFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", + + AppendTextBuffer("dwMaxFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", dwMaxFrameInterval, ((double)dwMaxFrameInterval)/10000.0, (ULONG)(10000000.0/((double)dwMaxFrameInterval) + 0.5)); @@ -4836,7 +4836,7 @@ DisplayVendorVidDiscreteFrameType( // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse - AppendTextBuffer("dwFrameInterval[%d]: 0x%08X = %lf mSec (%4.2f Hz)\r\n", + AppendTextBuffer("dwFrameInterval[%d]: 0x%08X = %lf mSec (%4.2f Hz)\r\n", iNdex, *ulFrameInterval, ((double)*ulFrameInterval)/10000.0, (10000000.0/((double)*ulFrameInterval)) @@ -4867,7 +4867,7 @@ DisplayVendorVidDiscreteFrameType( //***************************************************************************** // -// DisplayFramePayloadFormat() +// DisplayFramePayloadFormat() // //***************************************************************************** @@ -4897,13 +4897,13 @@ DisplayFramePayloadFormat ( AppendTextBuffer("guidFormat: %S", szGUID); pStr = VidFormatGUIDCodeToName((REFGUID) &FramePayloadFormatDesc->guidFormat); - if ( pStr ) + if ( pStr ) { if ( gDoAnnotation ) { AppendTextBuffer(" = %s Format", pStr); } - } + } AppendTextBuffer("\r\n"); AppendTextBuffer("bBitsPerPixel: 0x%02X\r\n", FramePayloadFormatDesc->bBitsPerPixel); AppendTextBuffer("bDefaultFrameIndex: 0x%02X\r\n", FramePayloadFormatDesc->bDefaultFrameIndex); @@ -4912,11 +4912,11 @@ DisplayFramePayloadFormat ( { //@@ERROR //@@Descriptor Field - bLength - //@@The declared length in the device descriptor is not equal to the required + //@@The declared length in the device descriptor is not equal to the required //@@length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n", FramePayloadFormatDesc->bLength, - sizeof(VIDEO_FORMAT_FRAME)); + (UCHAR) sizeof(VIDEO_FORMAT_FRAME)); OOPS(); } @@ -4933,7 +4933,7 @@ DisplayFramePayloadFormat ( { //@@ERROR //@@Descriptor Field - bNumFrameDescriptors - //@@bNumFrameDescriptors is set to zero which is not in accordance with the + //@@bNumFrameDescriptors is set to zero which is not in accordance with the //@@USB Video Device Specification AppendTextBuffer("*!*ERROR: bNumFrameDescriptors = 0, must have at least 1 Frame descriptor\r\n"); OOPS(); @@ -4957,7 +4957,7 @@ DisplayFramePayloadFormat ( OOPS(); } - if (FramePayloadFormatDesc->bDefaultFrameIndex == 0 || FramePayloadFormatDesc->bDefaultFrameIndex > + if (FramePayloadFormatDesc->bDefaultFrameIndex == 0 || FramePayloadFormatDesc->bDefaultFrameIndex > FramePayloadFormatDesc->bNumFrameDescriptors) { //@@ERROR @@ -4969,27 +4969,27 @@ DisplayFramePayloadFormat ( OOPS(); } - AppendTextBuffer("bAspectRatioX: 0x%02X\r\n", + AppendTextBuffer("bAspectRatioX: 0x%02X\r\n", FramePayloadFormatDesc->bAspectRatioX); - AppendTextBuffer("bAspectRatioY: 0x%02X", + AppendTextBuffer("bAspectRatioY: 0x%02X", FramePayloadFormatDesc->bAspectRatioY); - if (((FramePayloadFormatDesc->bmInterlaceFlags & 0x01) && - (FramePayloadFormatDesc->bAspectRatioY != 0 && + if (((FramePayloadFormatDesc->bmInterlaceFlags & 0x01) && + (FramePayloadFormatDesc->bAspectRatioY != 0 && FramePayloadFormatDesc->bAspectRatioX != 0))) { - if(gDoAnnotation) + if(gDoAnnotation) { AppendTextBuffer(" -> Aspect Ratio is set for a %d:%d display", - (FramePayloadFormatDesc->bAspectRatioX),(FramePayloadFormatDesc->bAspectRatioY)); - } - else + (FramePayloadFormatDesc->bAspectRatioX),(FramePayloadFormatDesc->bAspectRatioY)); + } + else { if (FramePayloadFormatDesc->bAspectRatioY != 0 || FramePayloadFormatDesc->bAspectRatioX != 0) { //@@ERROR //@@Descriptor Field - bAspectRatioX, bAspectRatioY - //@@Verify that that bAspectRatioX and bAspectRatioY are set to zero + //@@Verify that that bAspectRatioX and bAspectRatioY are set to zero //@@ if stream is non-interlaced AppendTextBuffer("\r\n*!*ERROR: Both bAspectRatioX and bAspectRatioY "\ "must equal 0 if stream is non-interlaced"); @@ -4997,25 +4997,25 @@ DisplayFramePayloadFormat ( } } } - AppendTextBuffer("\r\nbmInterlaceFlags: 0x%02X\r\n", + AppendTextBuffer("\r\nbmInterlaceFlags: 0x%02X\r\n", FramePayloadFormatDesc->bmInterlaceFlags); - if (gDoAnnotation) + if (gDoAnnotation) { - AppendTextBuffer(" D0 = 0x%02X Interlaced stream or variable: %s\r\n", + AppendTextBuffer(" D0 = 0x%02X Interlaced stream or variable: %s\r\n", (FramePayloadFormatDesc->bmInterlaceFlags & 1), (FramePayloadFormatDesc->bmInterlaceFlags & 1) ? "Yes" : "No"); - AppendTextBuffer(" D1 = 0x%02X Fields per frame: %s\r\n", + AppendTextBuffer(" D1 = 0x%02X Fields per frame: %s\r\n", ((FramePayloadFormatDesc->bmInterlaceFlags >> 1) & 1), ((FramePayloadFormatDesc->bmInterlaceFlags >> 1) & 1) ? "1 field" : "2 fields"); - AppendTextBuffer(" D2 = 0x%02X Field 1 first: %s\r\n", + AppendTextBuffer(" D2 = 0x%02X Field 1 first: %s\r\n", ((FramePayloadFormatDesc->bmInterlaceFlags >> 2) & 1), ((FramePayloadFormatDesc->bmInterlaceFlags >> 2) & 1) ? "Yes" : "No"); //@@Descriptor Field - bmInterlaceFlags //@@Validate that reserved bits (D3) are set to zero. - AppendTextBuffer(" D3 = 0x%02X Reserved%s\r\n", + AppendTextBuffer(" D3 = 0x%02X Reserved%s\r\n", ((FramePayloadFormatDesc->bmInterlaceFlags >> 3) & 1), - ((FramePayloadFormatDesc->bmInterlaceFlags >> 3) & 1) ? + ((FramePayloadFormatDesc->bmInterlaceFlags >> 3) & 1) ? "\r\n*!*ERROR: Reserved to 0" : "" ); AppendTextBuffer(" D4..5 = 0x%02X Field patterns ->", ((FramePayloadFormatDesc->bmInterlaceFlags >> 4) & 3)); @@ -5057,11 +5057,11 @@ DisplayFramePayloadFormat ( } //@@Descriptor Field - bCopyProtect - //@@Question - Are their reserved bits and should we validate that + //@@Question - Are their reserved bits and should we validate that //@@ reserved bits are set to zero? - AppendTextBuffer("\r\nbCopyProtect: 0x%02X", + AppendTextBuffer("\r\nbCopyProtect: 0x%02X", FramePayloadFormatDesc->bCopyProtect); - if (gDoAnnotation) + if (gDoAnnotation) { if (FramePayloadFormatDesc->bCopyProtect) AppendTextBuffer(" -> Duplication Restricted"); @@ -5070,9 +5070,9 @@ DisplayFramePayloadFormat ( } //@@Descriptor Field - bVariableSize - AppendTextBuffer("\r\nbVariableSize: 0x%02X", + AppendTextBuffer("\r\nbVariableSize: 0x%02X", FramePayloadFormatDesc->bVariableSize); - if (gDoAnnotation) + if (gDoAnnotation) { if (FramePayloadFormatDesc->bVariableSize) AppendTextBuffer(" -> Variable Size"); @@ -5112,10 +5112,10 @@ DisplayFramePayloadFrame ( //@@DisplayFramePayloadFrame -Frame Based Payload Frame AppendTextBuffer("\r\n ===>Video Streaming Frame Based Payload Frame Type Descriptor<===\r\n"); - if (gDoAnnotation) + if (gDoAnnotation) { if(FramePayloadFrameDesc->bFrameIndex == g_chFrameBasedFrameDefault) - { + { AppendTextBuffer(" --->This is the Default (optimum) Frame index\r\n"); } } @@ -5135,7 +5135,7 @@ DisplayFramePayloadFrame ( // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse - AppendTextBuffer("dwDefaultFrameInterval: 0x%08X = %lf mSec (%4.2f Hz)\r\n", + AppendTextBuffer("dwDefaultFrameInterval: 0x%08X = %lf mSec (%4.2f Hz)\r\n", FramePayloadFrameDesc->dwDefaultFrameInterval, ((double)FramePayloadFrameDesc->dwDefaultFrameInterval)/10000.0, (10000000.0/((double)FramePayloadFrameDesc->dwDefaultFrameInterval)) @@ -5146,10 +5146,10 @@ DisplayFramePayloadFrame ( { //@@ERROR //@@Descriptor Field - bLength - //@@The declared length in the device descriptor is not equal to the required + //@@The declared length in the device descriptor is not equal to the required //@@length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n", - FramePayloadFrameDesc->bLength, bLength); + FramePayloadFrameDesc->bLength, (UCHAR) bLength); OOPS(); } @@ -5157,7 +5157,7 @@ DisplayFramePayloadFrame ( { //@@ERROR //@@Descriptor Field - bFrameIndex - //@@bFrameIndex must be nonzero + //@@bFrameIndex must be nonzero AppendTextBuffer("*!*ERROR: bFrameIndex = 0, this is a 1 based index\r\n"); OOPS(); } @@ -5210,9 +5210,9 @@ DisplayFramePayloadFrame ( AppendTextBuffer("*!*ERROR: dwMinBitRate should be less than dwMaxBitRate\r\n"); OOPS(); } - else + else { - if (FramePayloadFrameDesc->bFrameIntervalType == 1 && + if (FramePayloadFrameDesc->bFrameIntervalType == 1 && FramePayloadFrameDesc->dwMinBitRate != FramePayloadFrameDesc->dwMaxBitRate) { //@@WARNING @@ -5275,12 +5275,12 @@ DisplayFramePayloadContinuousFrameType( // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse - AppendTextBuffer("dwMinFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", + AppendTextBuffer("dwMinFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", dwMinFrameInterval, ((double)dwMinFrameInterval)/10000.0, (ULONG)(10000000.0/((double)dwMinFrameInterval) + 0.5)); - - AppendTextBuffer("dwMaxFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", + + AppendTextBuffer("dwMaxFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n", dwMaxFrameInterval, ((double)dwMaxFrameInterval)/10000.0, (ULONG)(10000000.0/((double)dwMaxFrameInterval) + 0.5)); @@ -5378,7 +5378,7 @@ DisplayFramePayloadDiscreteFrameType( // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse - AppendTextBuffer("dwFrameInterval[%d]: 0x%08X = %lf mSec (%4.2f Hz)\r\n", + AppendTextBuffer("dwFrameInterval[%d]: 0x%08X = %lf mSec (%4.2f Hz)\r\n", iNdex, *ulFrameInterval, ((double)*ulFrameInterval)/10000.0, (10000000.0/((double)*ulFrameInterval)) @@ -5435,7 +5435,7 @@ DisplayVSEndpoint ( //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d. USBView cannot correctly display descriptor\r\n", VidEndpointDesc->bLength, - sizeof(VIDEO_CS_INTERRUPT)); + (UCHAR) sizeof(VIDEO_CS_INTERRUPT)); OOPS(); } @@ -5489,17 +5489,17 @@ VidFormatGUIDCodeToName ( if (IsEqualGUID(VidFormatGUIDCode, (REFGUID) &YUY2_Format)) { return (PCHAR) &"YUY2"; - } + } if (IsEqualGUID(VidFormatGUIDCode, (REFGUID) &NV12_Format)) { return (PCHAR) &"NV12"; - } + } #ifdef H264_SUPPORT // GUID pH264 = H264_Format; if (IsEqualGUID(VidFormatGUIDCode, (REFGUID) &H264_Format)) { return (PCHAR) &"H.264"; - } + } #endif return FALSE; -- cgit v1.3.1 From 7d7f9388ae3077ca010a719dbcd3da0534272046 Mon Sep 17 00:00:00 2001 From: Julia D'Zmura <78620953+judzmura@users.noreply.github.com> Date: Thu, 9 Mar 2023 10:19:19 -0800 Subject: Updates to Sysvad and SimpleAudioSample. (#917) * Updates to Sysvad and simpleAudioSample. * Changing dash to ASCII. --- audio/simpleaudiosample/Source/Main/adapter.cpp | 2 ++ audio/simpleaudiosample/Source/Main/common.cpp | 5 ++++- audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp | 4 ++-- audio/sysvad/APO/DelayAPO/DelayAPOSFX.cpp | 2 +- .../TabletAudioSample/ComponentizedApoSample.inx | Bin 22572 -> 22624 bytes .../ComponentizedAudioSampleExtension.inx | Bin 13608 -> 13660 bytes .../TabletAudioSample/TabletAudioSample.vcxproj | 12 ++++++------ 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/audio/simpleaudiosample/Source/Main/adapter.cpp b/audio/simpleaudiosample/Source/Main/adapter.cpp index bbe23f26..a66ee5a2 100644 --- a/audio/simpleaudiosample/Source/Main/adapter.cpp +++ b/audio/simpleaudiosample/Source/Main/adapter.cpp @@ -59,6 +59,8 @@ UNICODE_STRING g_RegistryPath; // This is used to store the registry settin #pragma code_seg("PAGE") void ReleaseRegistryStringBuffer() { + PAGED_CODE(); + if (g_RegistryPath.Buffer != NULL) { ExFreePool(g_RegistryPath.Buffer); diff --git a/audio/simpleaudiosample/Source/Main/common.cpp b/audio/simpleaudiosample/Source/Main/common.cpp index 8843d3a4..457bdb17 100644 --- a/audio/simpleaudiosample/Source/Main/common.cpp +++ b/audio/simpleaudiosample/Source/Main/common.cpp @@ -2547,6 +2547,7 @@ Exit: return ntStatus; } +#pragma code_seg("PAGE") NTSTATUS CopyRegistryKey(HANDLE _hSourceKey, HANDLE _hDestinationKey, BOOL _bOverwrite = FALSE) /*++ @@ -2686,7 +2687,7 @@ Exit: return ntStatus; } - +#pragma code_seg("PAGE") NTSTATUS CAdapterCommon::MigrateDeviceInterfaceTemplateParameters ( _In_ PUNICODE_STRING SymbolicLinkName, @@ -2729,6 +2730,8 @@ Return Value: UNICODE_STRING TemplateSymbolicLinkName; UNICODE_STRING referenceString; + PAGED_CODE(); + RtlInitUnicodeString(&TemplateSymbolicLinkName, NULL); RtlInitUnicodeString(&referenceString, TemplateReferenceString); diff --git a/audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp b/audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp index e7492131..af67571b 100644 --- a/audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp +++ b/audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp @@ -292,7 +292,7 @@ STDMETHODIMP CDelayAPOMFX::LockForProcess(UINT32 u32NumInputConnections, // // A more typical approach would be to allocate the memory using AERT_Allocate, which locks the memory // But for the purposes of this APO, CoTaskMemAlloc suffices, and the risk of glitches is not important - m_pf32DelayBuffer.Allocate(GetSamplesPerFrame() * m_nDelayFrames); + m_pf32DelayBuffer.Allocate((size_t) GetSamplesPerFrame() * m_nDelayFrames); WriteSilence(m_pf32DelayBuffer, m_nDelayFrames, GetSamplesPerFrame()); if (nullptr == m_pf32DelayBuffer) { @@ -1166,4 +1166,4 @@ HRESULT CDelayAPOMFX::CheckCustomFormats(IAudioMediaType *pRequestedFormat) } return hResult; -} \ No newline at end of file +} diff --git a/audio/sysvad/APO/DelayAPO/DelayAPOSFX.cpp b/audio/sysvad/APO/DelayAPO/DelayAPOSFX.cpp index c37abb7c..67ae2788 100644 --- a/audio/sysvad/APO/DelayAPO/DelayAPOSFX.cpp +++ b/audio/sysvad/APO/DelayAPO/DelayAPOSFX.cpp @@ -241,7 +241,7 @@ STDMETHODIMP CDelayAPOSFX::LockForProcess(UINT32 u32NumInputConnections, // // A more typical approach would be to allocate the memory using AERT_Allocate, which locks the memory // But for the purposes of this APO, CoTaskMemAlloc suffices, and the risk of glitches is not important - m_pf32DelayBuffer.Allocate(GetSamplesPerFrame() * m_nDelayFrames); + m_pf32DelayBuffer.Allocate((size_t) GetSamplesPerFrame() * m_nDelayFrames); WriteSilence(m_pf32DelayBuffer, m_nDelayFrames, GetSamplesPerFrame()); if (nullptr == m_pf32DelayBuffer) diff --git a/audio/sysvad/TabletAudioSample/ComponentizedApoSample.inx b/audio/sysvad/TabletAudioSample/ComponentizedApoSample.inx index 34b8401a..b18b528c 100644 Binary files a/audio/sysvad/TabletAudioSample/ComponentizedApoSample.inx and b/audio/sysvad/TabletAudioSample/ComponentizedApoSample.inx differ diff --git a/audio/sysvad/TabletAudioSample/ComponentizedAudioSampleExtension.inx b/audio/sysvad/TabletAudioSample/ComponentizedAudioSampleExtension.inx index 4afba224..aa6928d0 100644 Binary files a/audio/sysvad/TabletAudioSample/ComponentizedAudioSampleExtension.inx and b/audio/sysvad/TabletAudioSample/ComponentizedAudioSampleExtension.inx differ diff --git a/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj b/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj index fe70dacf..6e4e4c44 100644 --- a/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj +++ b/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj @@ -40,7 +40,7 @@ Windows10 False - Windows Driver + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -48,7 +48,7 @@ Windows10 False - Windows Driver + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -56,7 +56,7 @@ Windows10 True - Windows Driver + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -64,7 +64,7 @@ Windows10 True - Windows Driver + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -72,7 +72,7 @@ Windows10 False - Windows Driver + Universal KMDF WindowsKernelModeDriver10.0 Driver @@ -80,7 +80,7 @@ Windows10 True - Windows Driver + Universal KMDF WindowsKernelModeDriver10.0 Driver -- cgit v1.3.1 From 1f3fcf168dc9884af735facc5de233e17ea880c2 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 9 Mar 2023 16:04:23 -0800 Subject: INFs using DIRID 13 should target only build 16299 or later - audio updates (#923) INFs using DIRID 13 should only target build 16299 and later - audio updates Co-authored-by: Jason Knichel --- audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf | Bin 8474 -> 8526 bytes .../Source/Main/SimpleAudioSample.inx | Bin 15164 -> 15216 bytes .../TabletAudioSample/ComponentizedAudioSample.inx | Bin 52900 -> 52950 bytes avstream/avscamera/sys/avscamera.inx | Bin 25302 -> 25352 bytes avstream/avshws/avshws.inx | Bin 5974 -> 6028 bytes avstream/avssamp/avssamp.inx | Bin 3256 -> 3278 bytes 6 files changed, 0 insertions(+), 0 deletions(-) diff --git a/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf index 240efa85..70a0bb0c 100644 Binary files a/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf and b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf differ diff --git a/audio/simpleaudiosample/Source/Main/SimpleAudioSample.inx b/audio/simpleaudiosample/Source/Main/SimpleAudioSample.inx index a63bb0ba..93d07c78 100644 Binary files a/audio/simpleaudiosample/Source/Main/SimpleAudioSample.inx and b/audio/simpleaudiosample/Source/Main/SimpleAudioSample.inx differ diff --git a/audio/sysvad/TabletAudioSample/ComponentizedAudioSample.inx b/audio/sysvad/TabletAudioSample/ComponentizedAudioSample.inx index 2f2f9638..5b50b8af 100644 Binary files a/audio/sysvad/TabletAudioSample/ComponentizedAudioSample.inx and b/audio/sysvad/TabletAudioSample/ComponentizedAudioSample.inx differ diff --git a/avstream/avscamera/sys/avscamera.inx b/avstream/avscamera/sys/avscamera.inx index a8507243..c4cee29b 100644 Binary files a/avstream/avscamera/sys/avscamera.inx and b/avstream/avscamera/sys/avscamera.inx differ diff --git a/avstream/avshws/avshws.inx b/avstream/avshws/avshws.inx index 238ce187..9409635d 100644 Binary files a/avstream/avshws/avshws.inx and b/avstream/avshws/avshws.inx differ diff --git a/avstream/avssamp/avssamp.inx b/avstream/avssamp/avssamp.inx index 61d66fa3..c06925ea 100644 Binary files a/avstream/avssamp/avssamp.inx and b/avstream/avssamp/avssamp.inx differ -- cgit v1.3.1 From 728ec466537c4d46104323c2c77f113ac16598e2 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 13 Mar 2023 08:47:30 -0700 Subject: INFs using DIRID 13 should target only build 16299 or later - toaster updates (#924) Co-authored-by: Jason Knichel --- .../toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx | Bin 4742 -> 4794 bytes general/toaster/toastDrv/kmdf/bus/static/statbus.inx | Bin 4684 -> 4696 bytes general/toaster/toastDrv/kmdf/filter/filter.inx | Bin 6210 -> 6262 bytes .../toastDrv/kmdf/func/featured/wdffeatured.inx | Bin 5024 -> 5076 bytes .../toaster/toastDrv/kmdf/func/simple/wdfsimple.inx | Bin 6018 -> 6070 bytes .../toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx | Bin 3912 -> 3964 bytes general/toaster/toastpkg/inf/toastpkg.inf | 6 +++--- general/toaster/toastpkg/toastcd/toastpkg.inf | 6 +++--- general/toaster/umdf2/filter/generic/filterum.inx | Bin 4910 -> 4922 bytes general/toaster/umdf2/func/featured/wdffeaturedum.inx | Bin 5014 -> 5066 bytes general/toaster/umdf2/func/simple/wdfsimpleum.inx | Bin 4890 -> 4942 bytes 11 files changed, 6 insertions(+), 6 deletions(-) diff --git a/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx b/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx index bb22add8..82d7615d 100644 Binary files a/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx and b/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx differ diff --git a/general/toaster/toastDrv/kmdf/bus/static/statbus.inx b/general/toaster/toastDrv/kmdf/bus/static/statbus.inx index a8b4b39e..1468728d 100644 Binary files a/general/toaster/toastDrv/kmdf/bus/static/statbus.inx and b/general/toaster/toastDrv/kmdf/bus/static/statbus.inx differ diff --git a/general/toaster/toastDrv/kmdf/filter/filter.inx b/general/toaster/toastDrv/kmdf/filter/filter.inx index eb656e9f..9694c0a0 100644 Binary files a/general/toaster/toastDrv/kmdf/filter/filter.inx and b/general/toaster/toastDrv/kmdf/filter/filter.inx differ diff --git a/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx b/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx index a294267b..9a54b635 100644 Binary files a/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx and b/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx differ diff --git a/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx b/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx index 3a4998d5..199221a6 100644 Binary files a/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx and b/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx differ diff --git a/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx b/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx index ea61cea9..cd2ca48d 100644 Binary files a/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx and b/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx differ diff --git a/general/toaster/toastpkg/inf/toastpkg.inf b/general/toaster/toastpkg/inf/toastpkg.inf index 1011794d..8f0bb025 100644 --- a/general/toaster/toastpkg/inf/toastpkg.inf +++ b/general/toaster/toastpkg/inf/toastpkg.inf @@ -61,12 +61,12 @@ HKR,,DeviceCharacteristics,0x10001,0x100 ; Use same security checks on re ;***************************************** [Manufacturer] -%ToastRUs%=ToastRUs,NTx86, NTamd64 +%ToastRUs%=ToastRUs,NTx86.10.0...16299, NTamd64.10.0...16299 -[ToastRUs.NTx86] +[ToastRUs.NTx86.10.0...16299] %ToasterDevice.DeviceDesc%=Toaster_Device, {b85b7c50-6a01-11d2-b841-00c04fad5171}\MsToaster -[ToastRUs.NTamd64] +[ToastRUs.NTamd64.10.0...16299] %ToasterDevice.DeviceDesc%=Toaster_Device, {b85b7c50-6a01-11d2-b841-00c04fad5171}\MsToaster diff --git a/general/toaster/toastpkg/toastcd/toastpkg.inf b/general/toaster/toastpkg/toastcd/toastpkg.inf index 1011794d..8f0bb025 100644 --- a/general/toaster/toastpkg/toastcd/toastpkg.inf +++ b/general/toaster/toastpkg/toastcd/toastpkg.inf @@ -61,12 +61,12 @@ HKR,,DeviceCharacteristics,0x10001,0x100 ; Use same security checks on re ;***************************************** [Manufacturer] -%ToastRUs%=ToastRUs,NTx86, NTamd64 +%ToastRUs%=ToastRUs,NTx86.10.0...16299, NTamd64.10.0...16299 -[ToastRUs.NTx86] +[ToastRUs.NTx86.10.0...16299] %ToasterDevice.DeviceDesc%=Toaster_Device, {b85b7c50-6a01-11d2-b841-00c04fad5171}\MsToaster -[ToastRUs.NTamd64] +[ToastRUs.NTamd64.10.0...16299] %ToasterDevice.DeviceDesc%=Toaster_Device, {b85b7c50-6a01-11d2-b841-00c04fad5171}\MsToaster diff --git a/general/toaster/umdf2/filter/generic/filterum.inx b/general/toaster/umdf2/filter/generic/filterum.inx index 6b631a57..bbc0da9c 100644 Binary files a/general/toaster/umdf2/filter/generic/filterum.inx and b/general/toaster/umdf2/filter/generic/filterum.inx differ diff --git a/general/toaster/umdf2/func/featured/wdffeaturedum.inx b/general/toaster/umdf2/func/featured/wdffeaturedum.inx index cc2d6bd8..a3b05569 100644 Binary files a/general/toaster/umdf2/func/featured/wdffeaturedum.inx and b/general/toaster/umdf2/func/featured/wdffeaturedum.inx differ diff --git a/general/toaster/umdf2/func/simple/wdfsimpleum.inx b/general/toaster/umdf2/func/simple/wdfsimpleum.inx index fb8578af..1ddd21c6 100644 Binary files a/general/toaster/umdf2/func/simple/wdfsimpleum.inx and b/general/toaster/umdf2/func/simple/wdfsimpleum.inx differ -- cgit v1.3.1 From cfc659babba6133028ade3cf571c6b90922fc273 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 13 Mar 2023 16:39:56 -0700 Subject: INFs using DIRID 13 should target only build 16299 or later - USB updates (#925) Co-authored-by: Jason Knichel --- usb/UcmCxUcsi/UcmCxUcsi.inf | Bin 3888 -> 3940 bytes usb/UcmTcpciCxClientSample/UcmTcpciCxClientSample.inf | Bin 3300 -> 3352 bytes .../UcmUcsiAcpiSample/UcmUcsiAcpiSample.inf | 6 +++--- usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx | Bin 5278 -> 5330 bytes usb/kmdf_fx2/driver/osrusbfx2.inx | Bin 6954 -> 7006 bytes usb/ufxclientsample/UfxClientSample.inx | Bin 4418 -> 4470 bytes usb/umdf2_fx2/driver/osrusbfx2um.inx | Bin 6510 -> 6562 bytes usb/usbsamp/sys/driver/usbsamp.inx | Bin 5768 -> 5820 bytes usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx | Bin 4994 -> 5046 bytes usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx | Bin 4990 -> 5042 bytes usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx | Bin 4990 -> 5042 bytes usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx | Bin 4990 -> 5042 bytes usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx | Bin 4990 -> 5042 bytes 13 files changed, 3 insertions(+), 3 deletions(-) diff --git a/usb/UcmCxUcsi/UcmCxUcsi.inf b/usb/UcmCxUcsi/UcmCxUcsi.inf index e5b7ae7b..661424db 100644 Binary files a/usb/UcmCxUcsi/UcmCxUcsi.inf and b/usb/UcmCxUcsi/UcmCxUcsi.inf differ diff --git a/usb/UcmTcpciCxClientSample/UcmTcpciCxClientSample.inf b/usb/UcmTcpciCxClientSample/UcmTcpciCxClientSample.inf index 51dc78c4..5a526ab9 100644 Binary files a/usb/UcmTcpciCxClientSample/UcmTcpciCxClientSample.inf and b/usb/UcmTcpciCxClientSample/UcmTcpciCxClientSample.inf differ diff --git a/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.inf b/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.inf index acd7fd49..39b3c16a 100644 --- a/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.inf +++ b/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.inf @@ -10,7 +10,7 @@ ; INF for installing the UCM-UCSI ACPI client driver. ; ; Important: -; This INF depends on features for the Driver Store DIRIDs which are available starting Windows 10 1809 +; This INF depends on features for the Driver Store DIRIDs which are available starting Windows 10 1709 ; [Version] @@ -32,9 +32,9 @@ DefaultDestDir = 13 UcmUcsiAcpiSample.sys = 3426 [Manufacturer] -%ProviderName% = UcmUcsiAcpiSample, NT$ARCH$ +%ProviderName% = UcmUcsiAcpiSample, NT$ARCH$.10.0...16299 -[UcmUcsiAcpiSample.NT$ARCH$] +[UcmUcsiAcpiSample.NT$ARCH$.10.0...16299] %UcmUcsiAcpiSample.DeviceDesc% = UcmUcsiAcpiSample.Install, ACPI\USBC000, ACPI\PNP0CA0 [UcmUcsiAcpiSample.Install.NT] diff --git a/usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx b/usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx index cbd8fb15..d9d1366b 100644 Binary files a/usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx and b/usb/kmdf_enumswitches/sys/kmdf_enumswitches.inx differ diff --git a/usb/kmdf_fx2/driver/osrusbfx2.inx b/usb/kmdf_fx2/driver/osrusbfx2.inx index 4d53d79a..1185053e 100644 Binary files a/usb/kmdf_fx2/driver/osrusbfx2.inx and b/usb/kmdf_fx2/driver/osrusbfx2.inx differ diff --git a/usb/ufxclientsample/UfxClientSample.inx b/usb/ufxclientsample/UfxClientSample.inx index 098e442e..01c37a10 100644 Binary files a/usb/ufxclientsample/UfxClientSample.inx and b/usb/ufxclientsample/UfxClientSample.inx differ diff --git a/usb/umdf2_fx2/driver/osrusbfx2um.inx b/usb/umdf2_fx2/driver/osrusbfx2um.inx index febd8d7f..4d22fdbe 100644 Binary files a/usb/umdf2_fx2/driver/osrusbfx2um.inx and b/usb/umdf2_fx2/driver/osrusbfx2um.inx differ diff --git a/usb/usbsamp/sys/driver/usbsamp.inx b/usb/usbsamp/sys/driver/usbsamp.inx index eee41d30..57dc4bf3 100644 Binary files a/usb/usbsamp/sys/driver/usbsamp.inx and b/usb/usbsamp/sys/driver/usbsamp.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx index cc1817a7..0fc45d1a 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx index 6c0fee93..f7e12d74 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx index 6c0fee93..f7e12d74 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx index 6c0fee93..f7e12d74 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.inx differ diff --git a/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx b/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx index 6c0fee93..f7e12d74 100644 Binary files a/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx and b/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.inx differ -- cgit v1.3.1 From 9a288c48adfb093d3fe1436d2433c14b743bf447 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 13 Mar 2023 16:47:40 -0700 Subject: Fix TargetOSVersion for INFs with UMDF drivers. Fix comments in toaster samples (#926) Co-authored-by: Jason Knichel --- .../toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx | Bin 4794 -> 4794 bytes general/toaster/toastDrv/kmdf/bus/static/statbus.inx | Bin 4696 -> 4696 bytes general/toaster/toastDrv/kmdf/filter/filter.inx | Bin 6262 -> 6262 bytes .../toastDrv/kmdf/func/featured/wdffeatured.inx | Bin 5076 -> 5076 bytes .../toaster/toastDrv/kmdf/func/simple/wdfsimple.inx | Bin 6070 -> 6070 bytes .../toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx | Bin 3964 -> 3964 bytes general/toaster/toastpkg/inf/toastpkg.inf | 2 +- general/toaster/toastpkg/toastcd/toastpkg.inf | 2 +- general/toaster/umdf2/filter/generic/filterum.inx | Bin 4922 -> 4922 bytes general/toaster/umdf2/func/featured/wdffeaturedum.inx | Bin 5066 -> 5066 bytes general/toaster/umdf2/func/simple/wdfsimpleum.inx | Bin 4942 -> 4942 bytes 11 files changed, 2 insertions(+), 2 deletions(-) diff --git a/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx b/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx index 82d7615d..f557b6e3 100644 Binary files a/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx and b/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx differ diff --git a/general/toaster/toastDrv/kmdf/bus/static/statbus.inx b/general/toaster/toastDrv/kmdf/bus/static/statbus.inx index 1468728d..094bce09 100644 Binary files a/general/toaster/toastDrv/kmdf/bus/static/statbus.inx and b/general/toaster/toastDrv/kmdf/bus/static/statbus.inx differ diff --git a/general/toaster/toastDrv/kmdf/filter/filter.inx b/general/toaster/toastDrv/kmdf/filter/filter.inx index 9694c0a0..8a2ca006 100644 Binary files a/general/toaster/toastDrv/kmdf/filter/filter.inx and b/general/toaster/toastDrv/kmdf/filter/filter.inx differ diff --git a/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx b/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx index 9a54b635..b91edc1b 100644 Binary files a/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx and b/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx differ diff --git a/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx b/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx index 199221a6..549f20e1 100644 Binary files a/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx and b/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx differ diff --git a/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx b/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx index cd2ca48d..0c1a410b 100644 Binary files a/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx and b/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx differ diff --git a/general/toaster/toastpkg/inf/toastpkg.inf b/general/toaster/toastpkg/inf/toastpkg.inf index 8f0bb025..1c39e9b4 100644 --- a/general/toaster/toastpkg/inf/toastpkg.inf +++ b/general/toaster/toastpkg/inf/toastpkg.inf @@ -19,7 +19,7 @@ ; x86 and amd64 platforms. ; ; Important: -; This INF depends on features for the Driver Store DIRIDs which are available starting Windows 10 1809 +; This INF depends on features for the Driver Store DIRIDs which are available starting Windows 10 1709 ; ;--*/ [Version] diff --git a/general/toaster/toastpkg/toastcd/toastpkg.inf b/general/toaster/toastpkg/toastcd/toastpkg.inf index 8f0bb025..1c39e9b4 100644 --- a/general/toaster/toastpkg/toastcd/toastpkg.inf +++ b/general/toaster/toastpkg/toastcd/toastpkg.inf @@ -19,7 +19,7 @@ ; x86 and amd64 platforms. ; ; Important: -; This INF depends on features for the Driver Store DIRIDs which are available starting Windows 10 1809 +; This INF depends on features for the Driver Store DIRIDs which are available starting Windows 10 1709 ; ;--*/ [Version] diff --git a/general/toaster/umdf2/filter/generic/filterum.inx b/general/toaster/umdf2/filter/generic/filterum.inx index bbc0da9c..7ea0032e 100644 Binary files a/general/toaster/umdf2/filter/generic/filterum.inx and b/general/toaster/umdf2/filter/generic/filterum.inx differ diff --git a/general/toaster/umdf2/func/featured/wdffeaturedum.inx b/general/toaster/umdf2/func/featured/wdffeaturedum.inx index a3b05569..411a4835 100644 Binary files a/general/toaster/umdf2/func/featured/wdffeaturedum.inx and b/general/toaster/umdf2/func/featured/wdffeaturedum.inx differ diff --git a/general/toaster/umdf2/func/simple/wdfsimpleum.inx b/general/toaster/umdf2/func/simple/wdfsimpleum.inx index 1ddd21c6..4918c778 100644 Binary files a/general/toaster/umdf2/func/simple/wdfsimpleum.inx and b/general/toaster/umdf2/func/simple/wdfsimpleum.inx differ -- cgit v1.3.1 From 3dc2444a6f728a59ed17db41b9b3a43d01b03285 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 13 Mar 2023 16:50:51 -0700 Subject: INFs using DIRID 13 should target only build 16299 or later - HID and Input updates (#927) Co-authored-by: Jason Knichel --- hid/firefly/driver/firefly.inx | Bin 6500 -> 6552 bytes hid/hidusbfx2/sys/hidusbfx2.inx | Bin 7020 -> 7072 bytes hid/vhidmini2/driver/kmdf/vhidmini.inx | Bin 4474 -> 4526 bytes input/kbfiltr/sys/kbfiltr.inx | Bin 4924 -> 4976 bytes input/moufiltr/moufiltr.inx | Bin 4900 -> 4952 bytes 5 files changed, 0 insertions(+), 0 deletions(-) diff --git a/hid/firefly/driver/firefly.inx b/hid/firefly/driver/firefly.inx index deff9919..caab90fc 100644 Binary files a/hid/firefly/driver/firefly.inx and b/hid/firefly/driver/firefly.inx differ diff --git a/hid/hidusbfx2/sys/hidusbfx2.inx b/hid/hidusbfx2/sys/hidusbfx2.inx index 615056e0..7d65ab56 100644 Binary files a/hid/hidusbfx2/sys/hidusbfx2.inx and b/hid/hidusbfx2/sys/hidusbfx2.inx differ diff --git a/hid/vhidmini2/driver/kmdf/vhidmini.inx b/hid/vhidmini2/driver/kmdf/vhidmini.inx index dbb4deb4..007f0062 100644 Binary files a/hid/vhidmini2/driver/kmdf/vhidmini.inx and b/hid/vhidmini2/driver/kmdf/vhidmini.inx differ diff --git a/input/kbfiltr/sys/kbfiltr.inx b/input/kbfiltr/sys/kbfiltr.inx index 190d458b..1412bc67 100644 Binary files a/input/kbfiltr/sys/kbfiltr.inx and b/input/kbfiltr/sys/kbfiltr.inx differ diff --git a/input/moufiltr/moufiltr.inx b/input/moufiltr/moufiltr.inx index 4268a83a..c3cf47c4 100644 Binary files a/input/moufiltr/moufiltr.inx and b/input/moufiltr/moufiltr.inx differ -- cgit v1.3.1 From 5f8fffcb34404fdc929e835b756a083d74fd533d Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 13 Mar 2023 16:54:54 -0700 Subject: INFs using DIRID 13 should target only build 16299 or later - network updates (#928) Co-authored-by: Jason Knichel --- .../samples/passthrough/mspassthroughext.inf | 8 +- network/ndis/netvmini/6x/60/netvmini60.inf | Bin 8090 -> 8190 bytes network/ndis/netvmini/6x/620/netvmini620.inf | Bin 12836 -> 12936 bytes network/ndis/netvmini/6x/630/netvmini630.inf | Bin 15546 -> 15798 bytes network/ndis/netvmini/6x/680/netvmini680.inf | Bin 15546 -> 15798 bytes .../WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf | 2136 ++++++++++---------- network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf | 4 +- 7 files changed, 1074 insertions(+), 1074 deletions(-) diff --git a/network/ndis/extension/samples/passthrough/mspassthroughext.inf b/network/ndis/extension/samples/passthrough/mspassthroughext.inf index 6a5e0915..47236828 100644 --- a/network/ndis/extension/samples/passthrough/mspassthroughext.inf +++ b/network/ndis/extension/samples/passthrough/mspassthroughext.inf @@ -12,15 +12,15 @@ DriverVer = 08/29/2011,1.0.0.0 PnpLockdown = 1 [Manufacturer] -%ManufacturerName%=Standard,NTx86,NTia64,NTamd64 +%ManufacturerName%=Standard,NTx86.10.0...16299,NTia64.10.0...16299,NTamd64.10.0...16299 -[Standard.NTx86] +[Standard.NTx86.10.0...16299] %MSPassthroughExt_Desc%=Install, MS_passthroughext -[Standard.NTia64] +[Standard.NTia64.10.0...16299] %MSPassthroughExt_Desc%=Install, MS_passthroughext -[Standard.NTamd64] +[Standard.NTamd64.10.0...16299] %MSPassthroughExt_Desc%=Install, MS_passthroughext ;------------------------------------------------------------------------- diff --git a/network/ndis/netvmini/6x/60/netvmini60.inf b/network/ndis/netvmini/6x/60/netvmini60.inf index ed2c0b30..47cf37e5 100644 Binary files a/network/ndis/netvmini/6x/60/netvmini60.inf and b/network/ndis/netvmini/6x/60/netvmini60.inf differ diff --git a/network/ndis/netvmini/6x/620/netvmini620.inf b/network/ndis/netvmini/6x/620/netvmini620.inf index fbe4f8c4..f2b71c25 100644 Binary files a/network/ndis/netvmini/6x/620/netvmini620.inf and b/network/ndis/netvmini/6x/620/netvmini620.inf differ diff --git a/network/ndis/netvmini/6x/630/netvmini630.inf b/network/ndis/netvmini/6x/630/netvmini630.inf index 89bd114e..8029e8ab 100644 Binary files a/network/ndis/netvmini/6x/630/netvmini630.inf and b/network/ndis/netvmini/6x/630/netvmini630.inf differ diff --git a/network/ndis/netvmini/6x/680/netvmini680.inf b/network/ndis/netvmini/6x/680/netvmini680.inf index ac471b09..87227149 100644 Binary files a/network/ndis/netvmini/6x/680/netvmini680.inf and b/network/ndis/netvmini/6x/680/netvmini680.inf differ diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf index 181700f1..3d90c006 100644 --- a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf +++ b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf @@ -1,1068 +1,1068 @@ -;; netrtwlans.inf -;; -;; Realtek Wireless 802.11b/g/n SDIO Network Adapter -;; -;; Copyright (C) 2012 Realtek Semiconductor Corp. -;; -;; This release is primarily for WHQL test. -;; - -;; FOR XP/Vista/Win7/Win8 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} -Provider = %Realtek% -PnpLockdown = 1 -CatalogFile.NT = netrtwlans.cat ;; for WHQL certified -DriverVer = 11/23/2015,3008.22.1030.2015 - -[Manufacturer] -%Realtek% = Realtek,NTamd64.10.0 - -[ControlFlags] -ExcludeFromSelect = * - -[Realtek.NTamd64.10.0] -;; For 8723 RTK common ================================================================ - -;; For 8723 RTK common ================================================================ -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_8753 -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_B723 -;; Acer -%RTL8723bs.DeviceDesc% = ACER8723bs.ndi, SD\VID_024C&PID_0623 -;; HP -%RTL8723bs.DeviceDesc% = HP8723bs.ndi, SD\VID_024C&PID_0523 -;; ECS -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0524 -;; bestbuy -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0240 -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0241 -;; For Braswell platform -%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0626 -;; Reserved -%RTL8723bs.DeviceDesc% = RSVD8723bs.ndi, SD\VID_024C&PID_0624 - -;; For 8188E RTK common ================================================================ -%RTL8188es.DeviceDesc% = RTL8188es.ndi, SD\VID_024C&PID_8188 -%RTL8188es.DeviceDesc% = RTL8188es.ndi, SD\VID_024C&PID_8179 - -;; For 8812A RTK common ================================================================ - -;; For 8814A RTK common ================================================================ -%RTL8814as.DeviceDesc% = RTL8814as.ndi, SD\VID_024C&PID_8813 - -;; For 8821A RTK common ================================================================ -%RTL8821as.DeviceDesc% = RTL8821as.ndi, SD\VID_024C&PID_8821 - -;; For 8192ES RTK common ================================================================ -%RTL8192es.DeviceDesc% = RTL8192es.ndi, SD\VID_024C&PID_818B - - -;; For 8703 RTK common ================================================================ -%RTL8703bs.DeviceDesc% = RTL8703bs.ndi, SD\VID_024C&PID_B703 - -;; For 8188 RTK common ================================================================ -%RTL8188fs.DeviceDesc% = RTL8188fs.ndi, SD\VID_024C&PID_F179 - -;; For 8822B RTK common ================================================================ -%RTL8822bs.DeviceDesc% = RTL8822bs.ndi, SD\VID_024C&PID_B822 - -;; For 8723D RTK common ================================================================ -%RTL8723ds.DeviceDesc% = RTL8723ds.ndi, SD\VID_024C&PID_D723 - -;;---------------------------------------------------------------------------- -;; Realtek 8723bs default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8723bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, MCC.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8723bs.ndi.NT.Services] -AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8723bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration.HW -;;---------------------------------------------------------------------------- -;; Acer 8723bs installation -;;---------------------------------------------------------------------------- - - - - - -[ACER8723bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, RSSI2GridMode_2.reg, MCC.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[ACER8723bs.ndi.NT.Services] -AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[ACER8723bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration.HW -;;---------------------------------------------------------------------------- -;; HP 8723bs installation -;;---------------------------------------------------------------------------- - - - - - -[HP8723bs.ndi.NT] -AddReg = NDIS_64.reg, HP8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[HP8723bs.ndi.NT.Services] -AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[HP8723bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration.HW - - -;;---------------------------------------------------------------------------- -;; RSVD 8723bs installation -;;---------------------------------------------------------------------------- - - - - - -[RSVD8723bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, WowlanDisable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RSVD8723bs.ndi.NT.Services] -AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RSVD8723bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration.HW - - -;;---------------------------------------------------------------------------- -;; Realtek 8188eu default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8188es.ndi.NT] -AddReg = NDIS_64.reg, RTLWLAN.reg, 11nWirelessMode.reg, Ndis6Set.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8188es.ndi.NT.Services] -AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8188es.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration.HW - - -;;---------------------------------------------------------------------------- -;; Realtek 8821as default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8821as.ndi.NT] -AddReg = NDIS_64.reg, RTL8821as.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8821as.ndi.NT.Services] -AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8821as.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration.HW - - -;;---------------------------------------------------------------------------- -;; Realtek 8814as default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8814as.ndi.NT] -AddReg = NDIS_64.reg, RTL8814as.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8814as.ndi.NT.Services] -AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8814as.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration.HW - - -;;---------------------------------------------------------------------------- -;; Realtek 8192es default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8192es.ndi.NT] -AddReg = NDIS_64.reg, RTL8192es.common.reg, RTLWLAN.reg, 11nWirelessMode.reg, Ndis6Set.reg, CIHVS.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8192es.ndi.NT.Services] -AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8192es.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration.HW - - -;;---------------------------------------------------------------------------- -;; Realtek 8703bs default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8703bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8703bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, KFREE_COMMON.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8703bs.ndi.NT.Services] -AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8703bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration.HW - - -;;---------------------------------------------------------------------------- -;; Realtek 8188fs default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8188fs.ndi.NT] -AddReg = NDIS_64.reg, RTL8703bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, CIHVS.reg, PnpPreTransOn.reg, AutoChnlSelon.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8188fs.ndi.NT.Services] -AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8188fs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration.HW - -;;---------------------------------------------------------------------------- -;; Realtek 8822bs default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8822bs.ndi.NT] -AddReg = NDIS_64.reg, RTL8822bs.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8822bs.ndi.NT.Services] -AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8822bs.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistratio.HW - - -;;---------------------------------------------------------------------------- -;; Realtek 8723ds default installation -;;---------------------------------------------------------------------------- - - - - - -[RTL8723ds.ndi.NT] -AddReg = NDIS_64.reg, RTL8723ds.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, CIHVS.reg, PnpPreTransOn.reg, AutoChnlSelon.reg -Include = netvwifibus.inf -Needs = VWiFiBus.CopyFiles -Characteristics = 0x84 -BusType = 15 -;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; TODO: IF IHV provided the Rtlihvs.dll. -CopyFiles = RTWlanS.CopyFiles -*IfType = 71 ; IF_TYPE_IEEE80211 -*MediaType = 16 ; NdisMediumNative802_11 -*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 - -[RTL8723ds.ndi.NT.Services] -AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog -Include = netvwifibus.inf -Needs = VWiFiBus.Services - -[RTL8723ds.ndi.NT.HW] -Include = netvwifibus.inf -Needs = VWiFiBus.PnPFilterRegistration.HW - -;;---------------------------------------------------------------------------- -;; OS relative registry. -;;---------------------------------------------------------------------------- -[NDIS_64.reg] -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5,mdcwifi" -HKR, Ndi\Interfaces, LowerRange, 0, "wlan,ethernet,vwifi" -HKR, Ndi, Service, 0, "RtlWlans" -;; -;; OS relative service. -;; -[RtlWlans.Service] -DisplayName = %RtlWlans.DeviceDesc.DispName% -ServiceType = 1 ; %SERVICE_KERNEL_DRIVER% -StartType = 3 ; %SERRVICE_DEMAND_START% -ErrorControl = 1 ; %SERRVICE_ERROR_NORMAL% -ServiceBinary = %13%\rtwlans.sys -LoadOrderGroup = NDIS - -;; -;; OS relative event log. -;; -[RtlWlans.EventLog] -AddReg = RtlWlans.AddEventLog.reg - -[RtlWlans.AddEventLog.reg] -HKR, , EventMessageFile, 0x00020000, "%%SystemRoot%%\System32\netevent.dll" -HKR, , TypesSupported , 0x00010001, 7 - -[CIHVS.reg] -HKR, Ndi\IHVExtensions, ExtensibilityDLL, 0, "%13%\Rtlihvs.dll" -HKR, Ndi\IHVExtensions, UIExtensibilityCLSID, 0, "{6C2A8CCA-B2A2-4d81-A3B2-4E15F445C312}" -HKR, Ndi\IHVExtensions, GroupName, 0, "Realtek CCX SDK IHV Service" -HKR, Ndi\IHVExtensions, AdapterOUI, 0x00010001, 0x00e04c - - -;******************************************************************************* -; RTL8723bs common paramters -;******************************************************************************* -[RTL8723bs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,RomDLFwEnable,0,"1" -HKR,,RomDLFwEnable,0,"1" - -HKR,defaults,bFwCtrlPwrOff,0,"1" -HKR,,bFwCtrlPwrOff,0,"1" - -;;HKR,defaults,EnableAdaptivity,0,"0" -;;HKR,,EnableAdaptivity,0,"0" - -HKR,defaults,EnableCarrierSense,0,"0" -HKR,,EnableCarrierSense,0,"0" - -; AOAC reconnect -HKR,defaults,PnpKeepLink,0,"1" -HKR,,PnpKeepLink,0,"1" - -;; $$ End of RTL8723bs.common.reg - -[HP8723bs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,RomDLFwEnable,0,"1" -HKR,,RomDLFwEnable,0,"1" - -HKR,defaults,bFwCtrlPwrOff,0,"1" -HKR,,bFwCtrlPwrOff,0,"1" - -; Enable Adaptivity -;;HKR,defaults,EnableAdaptivity,0,"1" -;;HKR,,EnableAdaptivity,0,"1" - -HKR,defaults,EnableCarrierSense,0,"0" -HKR,,EnableCarrierSense,0,"0" - -; Enable Customeized PowerLimit Table -HKR,,EnableTxPowerLimit,0,"1" -HKR,,DecryptCustomFile,,"1" -HKR,,PwrLimitFile,0,"TXPWR_LMT_IEC0921_Enc.txt" - -; Regulation WorldWide -HKR,defaults,PwrTblSel,0,"4" -HKR,,PwrTblSel,0,"4" - -; AOAC reconnect -HKR,defaults,PnpKeepLink,0,"1" -HKR,,PnpKeepLink,0,"1" - -;; $$ End of HP8723bs.common.reg - -;******************************************************************************* -; RTL8703bs common paramters -;******************************************************************************* -[RTL8703bs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,RomDLFwEnable,0,"1" -HKR,,RomDLFwEnable,0,"1" - -HKR,defaults,bFwCtrlPwrOff,0,"1" -HKR,,bFwCtrlPwrOff,0,"1" - -;******************************************************************************* -; RTL8821as common paramters -;******************************************************************************* -[RTL8821as.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -HKR,,StbcCap,0,"17" -HKR,,LdpcCap,0,"34" -HKR,,BeamformCap,0,"34" - - -;******************************************************************************* -; RTL8814as common paramters -;******************************************************************************* -[RTL8814as.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -;; Add for 8814AS, based on 8821AS's modification -HKR,,StbcCap,0,"17" -HKR,,LdpcCap,0,"34" -HKR,,BeamformCap,0,"34" - - -;******************************************************************************* -; RTL8192es common paramters -;******************************************************************************* -[RTL8192es.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -;******************************************************************************* -; RTL8822bs common paramters -;******************************************************************************* -[RTL8822bs.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -HKR,,StbcCap,0,"17" -HKR,,LdpcCap,0,"34" -HKR,,BeamformCap,0,"34" -HKR,,ValidRFPath,0,"51" -HKR,,PreInitMem,0,"1" - - -;******************************************************************************* -; RTL8723ds common paramters -;******************************************************************************* -[RTL8723ds.common.reg] -HKR,defaults,LedCtrl,0,"1" -HKR,,LedCtrl,0,"1" - -HKR,defaults,QoS,0,"1" -HKR,,QoS,0,"1" - -HKR,defaults,CcxRm,0,"1" -HKR,,CcxRm,0,"1" - -HKR,defaults,CcxOffLineDurUpLimit,0,"0" -HKR,,CcxOffLineDurUpLimit,0,"0" - -HKR,defaults,UsbRxAggMode,0,"1" -HKR,,UsbRxAggMode,0,"1" - -HKR,defaults,bEarlymodeEnable,0,"0" -HKR,,bEarlymodeEnable,0,"0" - -HKR,defaults,LdpcCap,0,"0" - - -;;---------------------------------------------------------------------------- -;; Realtek WLAN NIC parameters -;;---------------------------------------------------------------------------- -[RTLWLAN.reg] - -; Enable Adaptivity -HKR,,EnableAdaptivity,0,"1" - -HKR,defaults,Channel,0,"1" -HKR,,Channel,0,"1" - -;; Antenna Diversity Type -HKR,defaults,AntennaDivType,0,"0" -HKR,,AntennaDivType,0,"0" - -HKR,defaults,NetworkType,0,"1" -HKR,,NetworkType,0,"1" - -HKR,defaults,StaUapsd,0,"0" -HKR,,StaUapsd,0,"0" - -; For B/G mode and B/G/N mode switch, we will use different wireless mode registry in later section -HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% -HKR,Ndi\params\WirelessMode, type, 0, "enum" -HKR,Ndi\params\WirelessMode, default, 0, "8" -HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% -HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% -HKR,Ndi\params\WirelessMode\enum, "8", 0, %IEEE_802_11BGN_STR% -HKR,defaults,WirelessMode, 0, "8" -HKR,,WirelessMode, 0, "8" - - -;; For WiFi test, 1: WiFi Config and 0: Performance Config -HKR,defaults,WiFiConfg,0,"0" -HKR,,WiFiConfg,0,"0" - -HKR,defaults,RxReorder,0,"1" -HKR,,RxReorder,0,"1" - -HKR,,DefaultKeyID,,"0" -HKR,,DefaultKey0,,"" -HKR,,DefaultKey1,,"" -HKR,,DefaultKey2,,"" -HKR,,DefaultKey3,,"" - -;Inactive Power Save -HKR,defaults,InactivePs,0,"0" -HKR,,InactivePs,0,"0" - -;Leisure Power Save -HKR,defaults,bLeisurePs,0,"2" -HKR,,bLeisurePs,0,"2" - -;Fw Control LPS -HKR,defaults,bFwCtrlLPS,0,"1" -HKR,,bFwCtrlLPS,0,"1" - -;; LPS Interval -;HKR,defaults,LPSIntvl,0,"3" -HKR,,LPSIntvl,0,"3" - -HKR,,WEPinNmode,0,"0" - -HKR,defaults,RxSC,0,"0" -HKR,,RxSC,0,"0" - -HKR,defaults,TxSC,0,"0" -HKR,,TxSC,0,"0" - -HKR,defaults,NblRacingWA,0,"1" -HKR,,NblRacingWA,0,"1" - -HKR,defaults,SuspendTimerInLowPwr,0,"1" -HKR,,SuspendTimerInLowPwr,0,"1" - -;; Rx reorder pending time -HKR,,RxReorder_PendTime,0,"100" - -;Antenna Diversity -HKR,Ndi\params\AntDiv, ParamDesc, 0, "Antenna Diversity" -HKR,Ndi\params\AntDiv, default, 0, "0" -HKR,Ndi\params\AntDiv, type, 0, "enum" -HKR,Ndi\params\AntDiv\enum, "0", 0, %DISABLED_STR% -HKR,Ndi\params\AntDiv\enum, "1", 0, %ENABLED_STR% - -[Ndis6Set.reg] -;Inactive Power Save -HKR,defaults,InactivePs,0,"2" -HKR,,InactivePs,0,"2" - - -;;---------------------------------------------------------------------------- -;; Wireless mode option parameters -;;---------------------------------------------------------------------------- -[11nWirelessMode.reg] -HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% -HKR,Ndi\params\WirelessMode, type, 0, "enum" -HKR,Ndi\params\WirelessMode, default, 0, "8" -HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% -HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% -HKR,Ndi\params\WirelessMode\enum, "8", 0, %IEEE_802_11BGN_STR% -HKR,defaults,WirelessMode, 0, "8" -HKR,,WirelessMode, 0, "8" - -;; 40MHz Support in 11n -HKR,Ndi\params\BWSetting, ParamDesc, 0, "Bandwidth" -HKR,Ndi\params\BWSetting, type, 0, "enum" -HKR,Ndi\params\BWSetting, default, 0, "1" -HKR,Ndi\params\BWSetting\enum, "0", 0, "20MHz Only" -HKR,Ndi\params\BWSetting\enum, "1", 0, "20_40MHz" -HKR,defaults,BWSetting,0,"1" -HKR,,BWSetting,0,"1" -HKR,,BWSetting,,"1" - -HKR,,Channel,0,"10" - -[11acWirelessMode.reg] -HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% -HKR,Ndi\params\WirelessMode, type, 0, "enum" -HKR,Ndi\params\WirelessMode, default, 0, "8" -HKR,Ndi\params\WirelessMode\enum, "8", 0, %AUTO_STR% -HKR,Ndi\params\WirelessMode\enum, "1", 0, %IEEE_802_11A_STR% -HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% -HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% -HKR,Ndi\params\WirelessMode\enum, "16", 0, %IEEE_802_11BGN_STR% -HKR,Ndi\params\WirelessMode\enum, "32", 0, %IEEE_802_11AN_STR% -HKR,Ndi\params\WirelessMode\enum, "64", 0, %IEEE_802_11ANAC_STR% -HKR,defaults,WirelessMode, 0, "8" -HKR,,WirelessMode, 0, "8" - -HKR,,Channel,0,"36" - -;; RF Type -HKR,,RFType,0,"15" - - -HKR,defaults,BWSetting,0,"2" -HKR,,BWSetting,0,"2" - -;;---------------------------------------------------------------------------- -;; LPS 32k Control Parameters -;;---------------------------------------------------------------------------- -[32kEnable.reg] -HKR,,bLowPowerEnable,0,"1" - -;------------------------------------------------------------------------------- -; PnP pre-transition handling -;------------------------------------------------------------------------------- -[PnpPreTransOn.reg] -HKR,,PreTransPnP,0,"1" - -;;---------------------------------------------------------------------------- -;; WOWLAN Control Parameters -;;---------------------------------------------------------------------------- - -[WowlanDisable.reg] -HKR,,WoWLANLPSLevel,0,"0" -HKR,,ARPOffloadEnable,0,"0" -HKR,,GTKOffloadEnable,0,"0" - -[ConnectedStandbyEnable.reg] -HKR,,WoWLANLPSLevel,0,"2" -HKR,,ARPOffloadEnable,0,"1" -HKR,,GTKOffloadEnable,0,"1" -HKR,,D2ListenIntvl,0,"4" -HKR,,NSOffloadEnable,0,"1" -HKR,,NLOEnable,0,"1" - -HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% -HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "0" -HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" -HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnMagicPacket,0,"0" - -HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% -HKR, Ndi\params\*WakeOnPattern, default, 0, "1" -HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" -HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% -HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% -HKR,,*WakeOnPattern,0,"1" - -;; Packet coalescing should be enabled in WHCK test -HKR,defaults,*PacketCoalescing,0,"0" -HKR,,*PacketCoalescing,0,"0" - -;------------------------------------------------------------------------------- -; Auto Channel Selection -;------------------------------------------------------------------------------- -[AutoChnlSelon.reg] -HKR,,AutoChnlSel,0,"1" - -;;---------------------------------------------------------------------------- -;; RSSI to Grid Mode Parameters -;;---------------------------------------------------------------------------- -[RSSI2GridMode_2.reg] -HKR,,RSSI2GridMode,0,"2" - -;;---------------------------------------------------------------------------- -;; KFREE parameters -;;---------------------------------------------------------------------------- -[KFREE_COMMON.reg] -HKR,,RfKFreeEnable,0,"0" - -;******************************************************************************* -; Multi-Channel Concurrent section -;******************************************************************************* -[MCC.reg] -HKR,Ndi\params\MultiChannelFcsMode, ParamDesc, 0, %MCC_STR% -HKR,Ndi\params\MultiChannelFcsMode, type, 0, "enum" -HKR,Ndi\params\MultiChannelFcsMode, default, 0, "0" -HKR,Ndi\params\MultiChannelFcsMode\enum, "0", 0, %DISABLED_STR% -HKR,Ndi\params\MultiChannelFcsMode\enum, "4", 0, %ENABLED_STR% -HKR,defaults,MultiChannelFcsMode, 0, "0" -HKR,,MultiChannelFcsMode, 0, "0" - -;******************************************************************************* -; Destination Directory -;******************************************************************************* -[DestinationDirs] -DefaultDestDir = 13 -RTWlanS.CopyFiles = 13 -;CIHVS.CopyFiles = 13 - -;;**************************************************************************** -;; Source Files -;;**************************************************************************** -[RTWlanS.CopyFiles] -rtwlans.sys,,,2 - -;TODO, The following section should be included in CopyFiles -; But current solution not found the Rtlihvs.dll file. -; so comment out; -;[CIHVS.CopyFiles] -;Rtlihvs.dll,,,2 - -[SourceDisksFiles] -rtwlans.sys = 1 -;Rtlihvs.dll = 1 - -[SourceDisksNames] -1=%DISKNAME%,,, - - -;******************************************************************************* -; Strings -;******************************************************************************* -[Strings] -SSID_STR = "SSID" -CHANNEL_STR = "Channel" -NETWORK_TYPE_STR = "Network Type" -LED_CONTROL_STR = "LED Control" -POWER_SAVE_STR = "Power Save Mode" -WIFI_IBSS_STR = "IBSS Default 11b Mode" -RATE_ADAPTIVE_STR = "Rate Adaptive" -QOS_STR = "QoS" -WiFiConfg_STR = "WiFiConfg" -WMM_APSD = "WMM APSD" -CCX_RM_STR = "CCX Radio Measurement" -CCX_OFF_LINE_DUR_UP_LIMIT_STR = "CCX Max Off-Line Measurement (0: unlimited)" -FORCE_PRIORITY_STR = "Forced Priority" -HW_PARA_STR = "Init from HwParaFile" -THREE_WIRE_MODE_STR = "Three Wire Programming Mode" -BOARD_TYPE_STR = "Board Type" -PROTECTION_MODE_STR = "Protection Mode" -TPC_STR = "Transmit Power Control" -TPC_POLARITY_STR = "TPC Polarity Select" -HIGH_POWER_STR = "High Power Mechanism" -INIT_GAIN_STR = "Initial Gain State" -CW_MAX_MIN_STR = "Contention Window" -PSP_XLINK_STR = "PSP XLink Mode" -DISABLE_STR = "Disable" -ENABLE_STR = "Enable" -DISABLED_STR = "Disabled" -ENABLED_STR = "Enabled" -AUTO_STR = "Auto" -AD_HOC_STR = "Ad Hoc" -INFRASTRUCTURE_STR = "Infrastructure" -AUTO_SELECT = "Auto select" -WL_MODE_STR = "Wireless Mode" -RX_REORDER_STR = "Rx Reorder" -CAM_STR = "CAM" -MAX_PSP_STR = "MAX_PSP" -Fast_PSP_STR = "Fast_PSP" -NO_AC_STR = "No AC (Disable)" -ALL_AC_STR = "ALL AC" -IEEE_802_11A_STR = "IEEE 802.11a" -IEEE_802_11B_STR = "IEEE 802.11b" -IEEE_802_11BG_STR = "IEEE 802.11b/g" -IEEE_802_11BGN_STR = "IEEE 802.11b/g/n" -IEEE_802_11AN_STR = "IEEE 802.11a/n" -IEEE_802_11ANAC_STR = "IEEE 802.11a/n/ac" -IEEE_802_11AC_STR = "IEEE 802.11 ac" -WakeOnMagicPacket = "Wake on Magic Packet" -WakeOnPattern = "Wake on Pattern Match" -MCC_STR = "Multi-Channel Concurrent" - -;******************************************************************************* -; manufacture description -;******************************************************************************* -Realtek = "Realtek Semiconductor Corp." - - -;******************************************************************************* -; Source disk name -;******************************************************************************* -DISKNAME = "Realtek Wireless LAN 802.11n SDIO Network Adapter Driver Disk" -RtlWlans.DeviceDesc = "Realtek Wireless LAN 802.11n SDIO Network Adapter" -RtlWlans.DeviceDesc.DispName = "Realtek Wireless LAN 802.11n SDIO Network Adapter" - -;******************************************************************************* -; RTL8723as Device description -;******************************************************************************* -RTL8723as.DeviceDesc = "Realtek RTL8723AS Wireless LAN 802.11n SDIO Network Adapter" -RTL8723as.DeviceDesc.DispName = "Realtek RTL8723AS Wireless LAN 802.11n SDIO Network Adapter" - - - -;******************************************************************************* -; RTL8723bs Device description -;******************************************************************************* -RTL8723bs.DeviceDesc = "Realtek RTL8723BS Wireless LAN 802.11n SDIO Network Adapter" -RTL8723bs.DeviceDesc.DispName = "Realtek RTL8723BS Wireless LAN 802.11n SDIO Network Adapter" - -;******************************************************************************* -; RTL8814as Device description -;******************************************************************************* -RTL8814as.DeviceDesc = "Realtek RTL8814AS Wireless LAN 802.11ac SDIO Network Adapter" -RTL8814as.DeviceDesc.DispName = "Realtek RTL8814AS Wireless LAN 802.11ac SDIO Network Adapter" - -;******************************************************************************* -; RTL8188ES Device description -;******************************************************************************* -RTL8188es.DeviceDesc = "Realtek RTL8189ES Wireless LAN 802.11n USB 2.0 Network Adapter" -RTL8188es.DeviceDesc.DispName = "Realtek RTL8189ES Wireless LAN 802.11n USB 2.0 Network Adapter" -;******************************************************************************* -; RTL8821as Device description -;******************************************************************************* -RTL8821as.DeviceDesc = "Realtek RTL8821AS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" -RTL8821as.DeviceDesc.DispName = "Realtek RTL8821AS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" -;******************************************************************************* -; RTL8192E Device description -;******************************************************************************* -RTL8192es.DeviceDesc = "Realtek RTL8192ES Wireless LAN 802.11n USB 2.0 Network Adapter" -RTL8192es.DeviceDesc.DispName = "Realtek RTL8192ES Wireless LAN 802.11n USB 2.0 Network Adapter" - -;******************************************************************************* -; RTL8703bs Device description -;******************************************************************************* -RTL8703bs.DeviceDesc = "Realtek RTL8703BS Wireless LAN 802.11n SDIO Network Adapter" -RTL8703bs.DeviceDesc.DispName = "Realtek RTL8703BS Wireless LAN 802.11n SDIO Network Adapter" - -;******************************************************************************* -; RTL8188Fs Device description -;******************************************************************************* -RTL8188fs.DeviceDesc = "Realtek RTL8189FTV Wireless LAN 802.11n SDIO Network Adapter" -RTL8188fs.DeviceDesc.DispName = "Realtek RTL8189FTV Wireless LAN 802.11n SDIO Network Adapter" -;******************************************************************************* -; RTL8822bs Device description -;******************************************************************************* -RTL8822bs.DeviceDesc = "Realtek RTL8822BS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" -RTL8822bs.DeviceDesc.DispName = "Realtek RTL8822BS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" - -;******************************************************************************* -; RTL8723ds Device description -;******************************************************************************* -RTL8723ds.DeviceDesc = "Realtek RTL8723DS Wireless LAN 802.11n SDIO Network Adapter" -RTL8723ds.DeviceDesc.DispName = "Realtek RTL8723DS Wireless LAN 802.11n SDIO Network Adapter" +;; netrtwlans.inf +;; +;; Realtek Wireless 802.11b/g/n SDIO Network Adapter +;; +;; Copyright (C) 2012 Realtek Semiconductor Corp. +;; +;; This release is primarily for WHQL test. +;; + +;; FOR XP/Vista/Win7/Win8 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} +Provider = %Realtek% +PnpLockdown = 1 +CatalogFile.NT = netrtwlans.cat ;; for WHQL certified +DriverVer = 11/23/2015,3008.22.1030.2015 + +[Manufacturer] +%Realtek% = Realtek,NTamd64.10.0...16299 + +[ControlFlags] +ExcludeFromSelect = * + +[Realtek.NTamd64.10.0...16299] +;; For 8723 RTK common ================================================================ + +;; For 8723 RTK common ================================================================ +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_8753 +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_B723 +;; Acer +%RTL8723bs.DeviceDesc% = ACER8723bs.ndi, SD\VID_024C&PID_0623 +;; HP +%RTL8723bs.DeviceDesc% = HP8723bs.ndi, SD\VID_024C&PID_0523 +;; ECS +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0524 +;; bestbuy +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0240 +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0241 +;; For Braswell platform +%RTL8723bs.DeviceDesc% = RTL8723bs.ndi, SD\VID_024C&PID_0626 +;; Reserved +%RTL8723bs.DeviceDesc% = RSVD8723bs.ndi, SD\VID_024C&PID_0624 + +;; For 8188E RTK common ================================================================ +%RTL8188es.DeviceDesc% = RTL8188es.ndi, SD\VID_024C&PID_8188 +%RTL8188es.DeviceDesc% = RTL8188es.ndi, SD\VID_024C&PID_8179 + +;; For 8812A RTK common ================================================================ + +;; For 8814A RTK common ================================================================ +%RTL8814as.DeviceDesc% = RTL8814as.ndi, SD\VID_024C&PID_8813 + +;; For 8821A RTK common ================================================================ +%RTL8821as.DeviceDesc% = RTL8821as.ndi, SD\VID_024C&PID_8821 + +;; For 8192ES RTK common ================================================================ +%RTL8192es.DeviceDesc% = RTL8192es.ndi, SD\VID_024C&PID_818B + + +;; For 8703 RTK common ================================================================ +%RTL8703bs.DeviceDesc% = RTL8703bs.ndi, SD\VID_024C&PID_B703 + +;; For 8188 RTK common ================================================================ +%RTL8188fs.DeviceDesc% = RTL8188fs.ndi, SD\VID_024C&PID_F179 + +;; For 8822B RTK common ================================================================ +%RTL8822bs.DeviceDesc% = RTL8822bs.ndi, SD\VID_024C&PID_B822 + +;; For 8723D RTK common ================================================================ +%RTL8723ds.DeviceDesc% = RTL8723ds.ndi, SD\VID_024C&PID_D723 + +;;---------------------------------------------------------------------------- +;; Realtek 8723bs default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8723bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, MCC.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8723bs.ndi.NT.Services] +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8723bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration.HW +;;---------------------------------------------------------------------------- +;; Acer 8723bs installation +;;---------------------------------------------------------------------------- + + + + + +[ACER8723bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, RSSI2GridMode_2.reg, MCC.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[ACER8723bs.ndi.NT.Services] +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[ACER8723bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration.HW +;;---------------------------------------------------------------------------- +;; HP 8723bs installation +;;---------------------------------------------------------------------------- + + + + + +[HP8723bs.ndi.NT] +AddReg = NDIS_64.reg, HP8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[HP8723bs.ndi.NT.Services] +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[HP8723bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration.HW + + +;;---------------------------------------------------------------------------- +;; RSVD 8723bs installation +;;---------------------------------------------------------------------------- + + + + + +[RSVD8723bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8723bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, WowlanDisable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RSVD8723bs.ndi.NT.Services] +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RSVD8723bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration.HW + + +;;---------------------------------------------------------------------------- +;; Realtek 8188eu default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8188es.ndi.NT] +AddReg = NDIS_64.reg, RTLWLAN.reg, 11nWirelessMode.reg, Ndis6Set.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8188es.ndi.NT.Services] +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8188es.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration.HW + + +;;---------------------------------------------------------------------------- +;; Realtek 8821as default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8821as.ndi.NT] +AddReg = NDIS_64.reg, RTL8821as.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8821as.ndi.NT.Services] +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8821as.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration.HW + + +;;---------------------------------------------------------------------------- +;; Realtek 8814as default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8814as.ndi.NT] +AddReg = NDIS_64.reg, RTL8814as.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8814as.ndi.NT.Services] +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8814as.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration.HW + + +;;---------------------------------------------------------------------------- +;; Realtek 8192es default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8192es.ndi.NT] +AddReg = NDIS_64.reg, RTL8192es.common.reg, RTLWLAN.reg, 11nWirelessMode.reg, Ndis6Set.reg, CIHVS.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8192es.ndi.NT.Services] +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8192es.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration.HW + + +;;---------------------------------------------------------------------------- +;; Realtek 8703bs default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8703bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8703bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, AutoChnlSelon.reg, CIHVS.reg, KFREE_COMMON.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8703bs.ndi.NT.Services] +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8703bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration.HW + + +;;---------------------------------------------------------------------------- +;; Realtek 8188fs default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8188fs.ndi.NT] +AddReg = NDIS_64.reg, RTL8703bs.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, CIHVS.reg, PnpPreTransOn.reg, AutoChnlSelon.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8188fs.ndi.NT.Services] +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8188fs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration.HW + +;;---------------------------------------------------------------------------- +;; Realtek 8822bs default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8822bs.ndi.NT] +AddReg = NDIS_64.reg, RTL8822bs.common.reg, RTLWLAN.reg, 11acWirelessMode.reg, Ndis6Set.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; IF IHV provided the Rtlihvs.dll. +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8822bs.ndi.NT.Services] +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8822bs.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistratio.HW + + +;;---------------------------------------------------------------------------- +;; Realtek 8723ds default installation +;;---------------------------------------------------------------------------- + + + + + +[RTL8723ds.ndi.NT] +AddReg = NDIS_64.reg, RTL8723ds.common.reg, RTLWLAN.reg, Ndis6Set.reg, 11nWirelessMode.reg, ConnectedStandbyEnable.reg, 32kEnable.reg, CIHVS.reg, PnpPreTransOn.reg, AutoChnlSelon.reg +Include = netvwifibus.inf +Needs = VWiFiBus.CopyFiles +Characteristics = 0x84 +BusType = 15 +;CopyFiles = RTWlanS.CopyFiles,CIHVS.CopyFiles; TODO: IF IHV provided the Rtlihvs.dll. +CopyFiles = RTWlanS.CopyFiles +*IfType = 71 ; IF_TYPE_IEEE80211 +*MediaType = 16 ; NdisMediumNative802_11 +*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11 + +[RTL8723ds.ndi.NT.Services] +AddService = RtlWlans, 0x10002, RtlWlans.Service, RtlWlans.EventLog +Include = netvwifibus.inf +Needs = VWiFiBus.Services + +[RTL8723ds.ndi.NT.HW] +Include = netvwifibus.inf +Needs = VWiFiBus.PnPFilterRegistration.HW + +;;---------------------------------------------------------------------------- +;; OS relative registry. +;;---------------------------------------------------------------------------- +[NDIS_64.reg] +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5,mdcwifi" +HKR, Ndi\Interfaces, LowerRange, 0, "wlan,ethernet,vwifi" +HKR, Ndi, Service, 0, "RtlWlans" +;; +;; OS relative service. +;; +[RtlWlans.Service] +DisplayName = %RtlWlans.DeviceDesc.DispName% +ServiceType = 1 ; %SERVICE_KERNEL_DRIVER% +StartType = 3 ; %SERRVICE_DEMAND_START% +ErrorControl = 1 ; %SERRVICE_ERROR_NORMAL% +ServiceBinary = %13%\rtwlans.sys +LoadOrderGroup = NDIS + +;; +;; OS relative event log. +;; +[RtlWlans.EventLog] +AddReg = RtlWlans.AddEventLog.reg + +[RtlWlans.AddEventLog.reg] +HKR, , EventMessageFile, 0x00020000, "%%SystemRoot%%\System32\netevent.dll" +HKR, , TypesSupported , 0x00010001, 7 + +[CIHVS.reg] +HKR, Ndi\IHVExtensions, ExtensibilityDLL, 0, "%13%\Rtlihvs.dll" +HKR, Ndi\IHVExtensions, UIExtensibilityCLSID, 0, "{6C2A8CCA-B2A2-4d81-A3B2-4E15F445C312}" +HKR, Ndi\IHVExtensions, GroupName, 0, "Realtek CCX SDK IHV Service" +HKR, Ndi\IHVExtensions, AdapterOUI, 0x00010001, 0x00e04c + + +;******************************************************************************* +; RTL8723bs common paramters +;******************************************************************************* +[RTL8723bs.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,RomDLFwEnable,0,"1" +HKR,,RomDLFwEnable,0,"1" + +HKR,defaults,bFwCtrlPwrOff,0,"1" +HKR,,bFwCtrlPwrOff,0,"1" + +;;HKR,defaults,EnableAdaptivity,0,"0" +;;HKR,,EnableAdaptivity,0,"0" + +HKR,defaults,EnableCarrierSense,0,"0" +HKR,,EnableCarrierSense,0,"0" + +; AOAC reconnect +HKR,defaults,PnpKeepLink,0,"1" +HKR,,PnpKeepLink,0,"1" + +;; $$ End of RTL8723bs.common.reg + +[HP8723bs.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,RomDLFwEnable,0,"1" +HKR,,RomDLFwEnable,0,"1" + +HKR,defaults,bFwCtrlPwrOff,0,"1" +HKR,,bFwCtrlPwrOff,0,"1" + +; Enable Adaptivity +;;HKR,defaults,EnableAdaptivity,0,"1" +;;HKR,,EnableAdaptivity,0,"1" + +HKR,defaults,EnableCarrierSense,0,"0" +HKR,,EnableCarrierSense,0,"0" + +; Enable Customeized PowerLimit Table +HKR,,EnableTxPowerLimit,0,"1" +HKR,,DecryptCustomFile,,"1" +HKR,,PwrLimitFile,0,"TXPWR_LMT_IEC0921_Enc.txt" + +; Regulation WorldWide +HKR,defaults,PwrTblSel,0,"4" +HKR,,PwrTblSel,0,"4" + +; AOAC reconnect +HKR,defaults,PnpKeepLink,0,"1" +HKR,,PnpKeepLink,0,"1" + +;; $$ End of HP8723bs.common.reg + +;******************************************************************************* +; RTL8703bs common paramters +;******************************************************************************* +[RTL8703bs.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,RomDLFwEnable,0,"1" +HKR,,RomDLFwEnable,0,"1" + +HKR,defaults,bFwCtrlPwrOff,0,"1" +HKR,,bFwCtrlPwrOff,0,"1" + +;******************************************************************************* +; RTL8821as common paramters +;******************************************************************************* +[RTL8821as.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +HKR,,StbcCap,0,"17" +HKR,,LdpcCap,0,"34" +HKR,,BeamformCap,0,"34" + + +;******************************************************************************* +; RTL8814as common paramters +;******************************************************************************* +[RTL8814as.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +;; Add for 8814AS, based on 8821AS's modification +HKR,,StbcCap,0,"17" +HKR,,LdpcCap,0,"34" +HKR,,BeamformCap,0,"34" + + +;******************************************************************************* +; RTL8192es common paramters +;******************************************************************************* +[RTL8192es.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +;******************************************************************************* +; RTL8822bs common paramters +;******************************************************************************* +[RTL8822bs.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +HKR,,StbcCap,0,"17" +HKR,,LdpcCap,0,"34" +HKR,,BeamformCap,0,"34" +HKR,,ValidRFPath,0,"51" +HKR,,PreInitMem,0,"1" + + +;******************************************************************************* +; RTL8723ds common paramters +;******************************************************************************* +[RTL8723ds.common.reg] +HKR,defaults,LedCtrl,0,"1" +HKR,,LedCtrl,0,"1" + +HKR,defaults,QoS,0,"1" +HKR,,QoS,0,"1" + +HKR,defaults,CcxRm,0,"1" +HKR,,CcxRm,0,"1" + +HKR,defaults,CcxOffLineDurUpLimit,0,"0" +HKR,,CcxOffLineDurUpLimit,0,"0" + +HKR,defaults,UsbRxAggMode,0,"1" +HKR,,UsbRxAggMode,0,"1" + +HKR,defaults,bEarlymodeEnable,0,"0" +HKR,,bEarlymodeEnable,0,"0" + +HKR,defaults,LdpcCap,0,"0" + + +;;---------------------------------------------------------------------------- +;; Realtek WLAN NIC parameters +;;---------------------------------------------------------------------------- +[RTLWLAN.reg] + +; Enable Adaptivity +HKR,,EnableAdaptivity,0,"1" + +HKR,defaults,Channel,0,"1" +HKR,,Channel,0,"1" + +;; Antenna Diversity Type +HKR,defaults,AntennaDivType,0,"0" +HKR,,AntennaDivType,0,"0" + +HKR,defaults,NetworkType,0,"1" +HKR,,NetworkType,0,"1" + +HKR,defaults,StaUapsd,0,"0" +HKR,,StaUapsd,0,"0" + +; For B/G mode and B/G/N mode switch, we will use different wireless mode registry in later section +HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% +HKR,Ndi\params\WirelessMode, type, 0, "enum" +HKR,Ndi\params\WirelessMode, default, 0, "8" +HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% +HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% +HKR,Ndi\params\WirelessMode\enum, "8", 0, %IEEE_802_11BGN_STR% +HKR,defaults,WirelessMode, 0, "8" +HKR,,WirelessMode, 0, "8" + + +;; For WiFi test, 1: WiFi Config and 0: Performance Config +HKR,defaults,WiFiConfg,0,"0" +HKR,,WiFiConfg,0,"0" + +HKR,defaults,RxReorder,0,"1" +HKR,,RxReorder,0,"1" + +HKR,,DefaultKeyID,,"0" +HKR,,DefaultKey0,,"" +HKR,,DefaultKey1,,"" +HKR,,DefaultKey2,,"" +HKR,,DefaultKey3,,"" + +;Inactive Power Save +HKR,defaults,InactivePs,0,"0" +HKR,,InactivePs,0,"0" + +;Leisure Power Save +HKR,defaults,bLeisurePs,0,"2" +HKR,,bLeisurePs,0,"2" + +;Fw Control LPS +HKR,defaults,bFwCtrlLPS,0,"1" +HKR,,bFwCtrlLPS,0,"1" + +;; LPS Interval +;HKR,defaults,LPSIntvl,0,"3" +HKR,,LPSIntvl,0,"3" + +HKR,,WEPinNmode,0,"0" + +HKR,defaults,RxSC,0,"0" +HKR,,RxSC,0,"0" + +HKR,defaults,TxSC,0,"0" +HKR,,TxSC,0,"0" + +HKR,defaults,NblRacingWA,0,"1" +HKR,,NblRacingWA,0,"1" + +HKR,defaults,SuspendTimerInLowPwr,0,"1" +HKR,,SuspendTimerInLowPwr,0,"1" + +;; Rx reorder pending time +HKR,,RxReorder_PendTime,0,"100" + +;Antenna Diversity +HKR,Ndi\params\AntDiv, ParamDesc, 0, "Antenna Diversity" +HKR,Ndi\params\AntDiv, default, 0, "0" +HKR,Ndi\params\AntDiv, type, 0, "enum" +HKR,Ndi\params\AntDiv\enum, "0", 0, %DISABLED_STR% +HKR,Ndi\params\AntDiv\enum, "1", 0, %ENABLED_STR% + +[Ndis6Set.reg] +;Inactive Power Save +HKR,defaults,InactivePs,0,"2" +HKR,,InactivePs,0,"2" + + +;;---------------------------------------------------------------------------- +;; Wireless mode option parameters +;;---------------------------------------------------------------------------- +[11nWirelessMode.reg] +HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% +HKR,Ndi\params\WirelessMode, type, 0, "enum" +HKR,Ndi\params\WirelessMode, default, 0, "8" +HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% +HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% +HKR,Ndi\params\WirelessMode\enum, "8", 0, %IEEE_802_11BGN_STR% +HKR,defaults,WirelessMode, 0, "8" +HKR,,WirelessMode, 0, "8" + +;; 40MHz Support in 11n +HKR,Ndi\params\BWSetting, ParamDesc, 0, "Bandwidth" +HKR,Ndi\params\BWSetting, type, 0, "enum" +HKR,Ndi\params\BWSetting, default, 0, "1" +HKR,Ndi\params\BWSetting\enum, "0", 0, "20MHz Only" +HKR,Ndi\params\BWSetting\enum, "1", 0, "20_40MHz" +HKR,defaults,BWSetting,0,"1" +HKR,,BWSetting,0,"1" +HKR,,BWSetting,,"1" + +HKR,,Channel,0,"10" + +[11acWirelessMode.reg] +HKR,Ndi\params\WirelessMode, ParamDesc, 0, %WL_MODE_STR% +HKR,Ndi\params\WirelessMode, type, 0, "enum" +HKR,Ndi\params\WirelessMode, default, 0, "8" +HKR,Ndi\params\WirelessMode\enum, "8", 0, %AUTO_STR% +HKR,Ndi\params\WirelessMode\enum, "1", 0, %IEEE_802_11A_STR% +HKR,Ndi\params\WirelessMode\enum, "2", 0, %IEEE_802_11B_STR% +HKR,Ndi\params\WirelessMode\enum, "4", 0, %IEEE_802_11BG_STR% +HKR,Ndi\params\WirelessMode\enum, "16", 0, %IEEE_802_11BGN_STR% +HKR,Ndi\params\WirelessMode\enum, "32", 0, %IEEE_802_11AN_STR% +HKR,Ndi\params\WirelessMode\enum, "64", 0, %IEEE_802_11ANAC_STR% +HKR,defaults,WirelessMode, 0, "8" +HKR,,WirelessMode, 0, "8" + +HKR,,Channel,0,"36" + +;; RF Type +HKR,,RFType,0,"15" + + +HKR,defaults,BWSetting,0,"2" +HKR,,BWSetting,0,"2" + +;;---------------------------------------------------------------------------- +;; LPS 32k Control Parameters +;;---------------------------------------------------------------------------- +[32kEnable.reg] +HKR,,bLowPowerEnable,0,"1" + +;------------------------------------------------------------------------------- +; PnP pre-transition handling +;------------------------------------------------------------------------------- +[PnpPreTransOn.reg] +HKR,,PreTransPnP,0,"1" + +;;---------------------------------------------------------------------------- +;; WOWLAN Control Parameters +;;---------------------------------------------------------------------------- + +[WowlanDisable.reg] +HKR,,WoWLANLPSLevel,0,"0" +HKR,,ARPOffloadEnable,0,"0" +HKR,,GTKOffloadEnable,0,"0" + +[ConnectedStandbyEnable.reg] +HKR,,WoWLANLPSLevel,0,"2" +HKR,,ARPOffloadEnable,0,"1" +HKR,,GTKOffloadEnable,0,"1" +HKR,,D2ListenIntvl,0,"4" +HKR,,NSOffloadEnable,0,"1" +HKR,,NLOEnable,0,"1" + +HKR, Ndi\params\*WakeOnMagicPacket, ParamDesc, 0, %WakeOnMagicPacket% +HKR, Ndi\params\*WakeOnMagicPacket, default, 0, "0" +HKR, Ndi\params\*WakeOnMagicPacket, type, 0, "enum" +HKR, Ndi\params\*WakeOnMagicPacket\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnMagicPacket\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnMagicPacket,0,"0" + +HKR, Ndi\params\*WakeOnPattern , ParamDesc, 0, %WakeOnPattern% +HKR, Ndi\params\*WakeOnPattern, default, 0, "1" +HKR, Ndi\params\*WakeOnPattern, type, 0, "enum" +HKR, Ndi\params\*WakeOnPattern\enum, "0", 0, %DISABLED_STR% +HKR, Ndi\params\*WakeOnPattern\enum, "1", 0, %ENABLED_STR% +HKR,,*WakeOnPattern,0,"1" + +;; Packet coalescing should be enabled in WHCK test +HKR,defaults,*PacketCoalescing,0,"0" +HKR,,*PacketCoalescing,0,"0" + +;------------------------------------------------------------------------------- +; Auto Channel Selection +;------------------------------------------------------------------------------- +[AutoChnlSelon.reg] +HKR,,AutoChnlSel,0,"1" + +;;---------------------------------------------------------------------------- +;; RSSI to Grid Mode Parameters +;;---------------------------------------------------------------------------- +[RSSI2GridMode_2.reg] +HKR,,RSSI2GridMode,0,"2" + +;;---------------------------------------------------------------------------- +;; KFREE parameters +;;---------------------------------------------------------------------------- +[KFREE_COMMON.reg] +HKR,,RfKFreeEnable,0,"0" + +;******************************************************************************* +; Multi-Channel Concurrent section +;******************************************************************************* +[MCC.reg] +HKR,Ndi\params\MultiChannelFcsMode, ParamDesc, 0, %MCC_STR% +HKR,Ndi\params\MultiChannelFcsMode, type, 0, "enum" +HKR,Ndi\params\MultiChannelFcsMode, default, 0, "0" +HKR,Ndi\params\MultiChannelFcsMode\enum, "0", 0, %DISABLED_STR% +HKR,Ndi\params\MultiChannelFcsMode\enum, "4", 0, %ENABLED_STR% +HKR,defaults,MultiChannelFcsMode, 0, "0" +HKR,,MultiChannelFcsMode, 0, "0" + +;******************************************************************************* +; Destination Directory +;******************************************************************************* +[DestinationDirs] +DefaultDestDir = 13 +RTWlanS.CopyFiles = 13 +;CIHVS.CopyFiles = 13 + +;;**************************************************************************** +;; Source Files +;;**************************************************************************** +[RTWlanS.CopyFiles] +rtwlans.sys,,,2 + +;TODO, The following section should be included in CopyFiles +; But current solution not found the Rtlihvs.dll file. +; so comment out; +;[CIHVS.CopyFiles] +;Rtlihvs.dll,,,2 + +[SourceDisksFiles] +rtwlans.sys = 1 +;Rtlihvs.dll = 1 + +[SourceDisksNames] +1=%DISKNAME%,,, + + +;******************************************************************************* +; Strings +;******************************************************************************* +[Strings] +SSID_STR = "SSID" +CHANNEL_STR = "Channel" +NETWORK_TYPE_STR = "Network Type" +LED_CONTROL_STR = "LED Control" +POWER_SAVE_STR = "Power Save Mode" +WIFI_IBSS_STR = "IBSS Default 11b Mode" +RATE_ADAPTIVE_STR = "Rate Adaptive" +QOS_STR = "QoS" +WiFiConfg_STR = "WiFiConfg" +WMM_APSD = "WMM APSD" +CCX_RM_STR = "CCX Radio Measurement" +CCX_OFF_LINE_DUR_UP_LIMIT_STR = "CCX Max Off-Line Measurement (0: unlimited)" +FORCE_PRIORITY_STR = "Forced Priority" +HW_PARA_STR = "Init from HwParaFile" +THREE_WIRE_MODE_STR = "Three Wire Programming Mode" +BOARD_TYPE_STR = "Board Type" +PROTECTION_MODE_STR = "Protection Mode" +TPC_STR = "Transmit Power Control" +TPC_POLARITY_STR = "TPC Polarity Select" +HIGH_POWER_STR = "High Power Mechanism" +INIT_GAIN_STR = "Initial Gain State" +CW_MAX_MIN_STR = "Contention Window" +PSP_XLINK_STR = "PSP XLink Mode" +DISABLE_STR = "Disable" +ENABLE_STR = "Enable" +DISABLED_STR = "Disabled" +ENABLED_STR = "Enabled" +AUTO_STR = "Auto" +AD_HOC_STR = "Ad Hoc" +INFRASTRUCTURE_STR = "Infrastructure" +AUTO_SELECT = "Auto select" +WL_MODE_STR = "Wireless Mode" +RX_REORDER_STR = "Rx Reorder" +CAM_STR = "CAM" +MAX_PSP_STR = "MAX_PSP" +Fast_PSP_STR = "Fast_PSP" +NO_AC_STR = "No AC (Disable)" +ALL_AC_STR = "ALL AC" +IEEE_802_11A_STR = "IEEE 802.11a" +IEEE_802_11B_STR = "IEEE 802.11b" +IEEE_802_11BG_STR = "IEEE 802.11b/g" +IEEE_802_11BGN_STR = "IEEE 802.11b/g/n" +IEEE_802_11AN_STR = "IEEE 802.11a/n" +IEEE_802_11ANAC_STR = "IEEE 802.11a/n/ac" +IEEE_802_11AC_STR = "IEEE 802.11 ac" +WakeOnMagicPacket = "Wake on Magic Packet" +WakeOnPattern = "Wake on Pattern Match" +MCC_STR = "Multi-Channel Concurrent" + +;******************************************************************************* +; manufacture description +;******************************************************************************* +Realtek = "Realtek Semiconductor Corp." + + +;******************************************************************************* +; Source disk name +;******************************************************************************* +DISKNAME = "Realtek Wireless LAN 802.11n SDIO Network Adapter Driver Disk" +RtlWlans.DeviceDesc = "Realtek Wireless LAN 802.11n SDIO Network Adapter" +RtlWlans.DeviceDesc.DispName = "Realtek Wireless LAN 802.11n SDIO Network Adapter" + +;******************************************************************************* +; RTL8723as Device description +;******************************************************************************* +RTL8723as.DeviceDesc = "Realtek RTL8723AS Wireless LAN 802.11n SDIO Network Adapter" +RTL8723as.DeviceDesc.DispName = "Realtek RTL8723AS Wireless LAN 802.11n SDIO Network Adapter" + + + +;******************************************************************************* +; RTL8723bs Device description +;******************************************************************************* +RTL8723bs.DeviceDesc = "Realtek RTL8723BS Wireless LAN 802.11n SDIO Network Adapter" +RTL8723bs.DeviceDesc.DispName = "Realtek RTL8723BS Wireless LAN 802.11n SDIO Network Adapter" + +;******************************************************************************* +; RTL8814as Device description +;******************************************************************************* +RTL8814as.DeviceDesc = "Realtek RTL8814AS Wireless LAN 802.11ac SDIO Network Adapter" +RTL8814as.DeviceDesc.DispName = "Realtek RTL8814AS Wireless LAN 802.11ac SDIO Network Adapter" + +;******************************************************************************* +; RTL8188ES Device description +;******************************************************************************* +RTL8188es.DeviceDesc = "Realtek RTL8189ES Wireless LAN 802.11n USB 2.0 Network Adapter" +RTL8188es.DeviceDesc.DispName = "Realtek RTL8189ES Wireless LAN 802.11n USB 2.0 Network Adapter" +;******************************************************************************* +; RTL8821as Device description +;******************************************************************************* +RTL8821as.DeviceDesc = "Realtek RTL8821AS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" +RTL8821as.DeviceDesc.DispName = "Realtek RTL8821AS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" +;******************************************************************************* +; RTL8192E Device description +;******************************************************************************* +RTL8192es.DeviceDesc = "Realtek RTL8192ES Wireless LAN 802.11n USB 2.0 Network Adapter" +RTL8192es.DeviceDesc.DispName = "Realtek RTL8192ES Wireless LAN 802.11n USB 2.0 Network Adapter" + +;******************************************************************************* +; RTL8703bs Device description +;******************************************************************************* +RTL8703bs.DeviceDesc = "Realtek RTL8703BS Wireless LAN 802.11n SDIO Network Adapter" +RTL8703bs.DeviceDesc.DispName = "Realtek RTL8703BS Wireless LAN 802.11n SDIO Network Adapter" + +;******************************************************************************* +; RTL8188Fs Device description +;******************************************************************************* +RTL8188fs.DeviceDesc = "Realtek RTL8189FTV Wireless LAN 802.11n SDIO Network Adapter" +RTL8188fs.DeviceDesc.DispName = "Realtek RTL8189FTV Wireless LAN 802.11n SDIO Network Adapter" +;******************************************************************************* +; RTL8822bs Device description +;******************************************************************************* +RTL8822bs.DeviceDesc = "Realtek RTL8822BS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" +RTL8822bs.DeviceDesc.DispName = "Realtek RTL8822BS Wireless LAN 802.11ac SDIO 2.0 Network Adapter" + +;******************************************************************************* +; RTL8723ds Device description +;******************************************************************************* +RTL8723ds.DeviceDesc = "Realtek RTL8723DS Wireless LAN 802.11n SDIO Network Adapter" +RTL8723ds.DeviceDesc.DispName = "Realtek RTL8723DS Wireless LAN 802.11n SDIO Network Adapter" diff --git a/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf b/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf index 69055bfb..496e5c6a 100644 --- a/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf +++ b/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf @@ -22,9 +22,9 @@ cxwmbclass.sys = 3426 DefaultDestDir=13 [Manufacturer] -%ManufacturerName% = Msft,NT$ARCH$ +%ManufacturerName% = Msft,NT$ARCH$.10.0...16299 -[Msft.NT$ARCH$] +[Msft.NT$ARCH$.10.0...16299] ; DisplayName Section DeviceID ; ----------- ------- -------- ;%wmbclass.DeviceDesc% = wmbclass.ndi, USB\MS_COMP_MBIM -- cgit v1.3.1 From 336cb2f16b38129a6a1fd2cf24deab80aaef654f Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 13 Mar 2023 16:58:29 -0700 Subject: INFs using DIRID 13 should target only build 16299 or later - misc general updates (#929) Co-authored-by: Jason Knichel --- .../osrfx2_DCHU_component/osrfx2_DCHU_component.inx | 4 ++-- .../osrfx2_DCHU_component/osrfx2_DCHU_component.inx | 4 ++-- general/PLX9x5x/sys/pci9x5x.inx | Bin 5282 -> 5334 bytes .../SimpleMediaSourceDriver.inf | Bin 6716 -> 6768 bytes general/echo/kmdf/driver/AutoSync/echo.inx | Bin 4086 -> 4138 bytes general/echo/kmdf/driver/DriverSync/echo_2.inx | Bin 4220 -> 4272 bytes general/pcidrv/kmdf/genpci.inx | Bin 6246 -> 6298 bytes 7 files changed, 4 insertions(+), 4 deletions(-) diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx index fefa0931..cc9e43a9 100644 --- a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx @@ -27,9 +27,9 @@ CatalogFile = osrfx2_DCHU_component.cat PnpLockdown = 1 [Manufacturer] -%ManufacturerName% = OsrFx2Component, NT$ARCH$.10.0...15063 +%ManufacturerName% = OsrFx2Component, NT$ARCH$.10.0...16299 -[OsrFx2Component.NT$ARCH$.10.0...15063] +[OsrFx2Component.NT$ARCH$.10.0...16299] %DeviceName% = OsrFx2Component_Install, SWC\VID_045e&PID_94ab [SourceDisksFiles] diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx index fefa0931..cc9e43a9 100644 --- a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx @@ -27,9 +27,9 @@ CatalogFile = osrfx2_DCHU_component.cat PnpLockdown = 1 [Manufacturer] -%ManufacturerName% = OsrFx2Component, NT$ARCH$.10.0...15063 +%ManufacturerName% = OsrFx2Component, NT$ARCH$.10.0...16299 -[OsrFx2Component.NT$ARCH$.10.0...15063] +[OsrFx2Component.NT$ARCH$.10.0...16299] %DeviceName% = OsrFx2Component_Install, SWC\VID_045e&PID_94ab [SourceDisksFiles] diff --git a/general/PLX9x5x/sys/pci9x5x.inx b/general/PLX9x5x/sys/pci9x5x.inx index 8340d1fa..8fdb2eea 100644 Binary files a/general/PLX9x5x/sys/pci9x5x.inx and b/general/PLX9x5x/sys/pci9x5x.inx differ diff --git a/general/SimpleMediaSource/SimpleMediaSourceDriver/SimpleMediaSourceDriver.inf b/general/SimpleMediaSource/SimpleMediaSourceDriver/SimpleMediaSourceDriver.inf index b182e169..d9f05402 100644 Binary files a/general/SimpleMediaSource/SimpleMediaSourceDriver/SimpleMediaSourceDriver.inf and b/general/SimpleMediaSource/SimpleMediaSourceDriver/SimpleMediaSourceDriver.inf differ diff --git a/general/echo/kmdf/driver/AutoSync/echo.inx b/general/echo/kmdf/driver/AutoSync/echo.inx index bd3f5bf5..cd83b6c0 100644 Binary files a/general/echo/kmdf/driver/AutoSync/echo.inx and b/general/echo/kmdf/driver/AutoSync/echo.inx differ diff --git a/general/echo/kmdf/driver/DriverSync/echo_2.inx b/general/echo/kmdf/driver/DriverSync/echo_2.inx index f52fb578..b4cf3c25 100644 Binary files a/general/echo/kmdf/driver/DriverSync/echo_2.inx and b/general/echo/kmdf/driver/DriverSync/echo_2.inx differ diff --git a/general/pcidrv/kmdf/genpci.inx b/general/pcidrv/kmdf/genpci.inx index 058e81e6..a6d0d21c 100644 Binary files a/general/pcidrv/kmdf/genpci.inx and b/general/pcidrv/kmdf/genpci.inx differ -- cgit v1.3.1 From 198e6dc2c56dadddf1a88b1ddfffacba43167011 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 13 Mar 2023 17:03:14 -0700 Subject: INFs using DIRID 13 should target only build 16299 or later - remaining updates (#930) Co-authored-by: Jason Knichel --- bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx | Bin 4530 -> 4570 bytes bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx | Bin 4538 -> 4578 bytes .../windows-drivertemplate-nfc.inf | Bin 3264 -> 3316 bytes .../SingleComp/SingleComponentSingleStateUm.inx | Bin 4552 -> 4604 bytes pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.inx | Bin 3556 -> 3608 bytes .../SingleComp/SingleComponentFStateSample.inx | Bin 5208 -> 5090 bytes serial/VirtualSerial2/ComPort/virtualserial2um.inx | Bin 4388 -> 4440 bytes serial/VirtualSerial2/FakeModem/fakemodem2um.inx | Bin 16766 -> 16818 bytes serial/serial/serial.inx | Bin 5574 -> 5586 bytes spb/SkeletonI2C/skeletoni2c.inx | Bin 4032 -> 3914 bytes spb/SpbTestTool/sys/spbtesttool.inx | Bin 4964 -> 4846 bytes wia/ProdScan/ProdScan.inx | Bin 3734 -> 3786 bytes wia/microdrv/testmcro.inx | Bin 3240 -> 3292 bytes wia/wiadriverex/usd/WiaDriver.inx | Bin 7514 -> 7566 bytes wmi/wmisamp/wmisamp.inx | Bin 5160 -> 5212 bytes 15 files changed, 0 insertions(+), 0 deletions(-) diff --git a/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx b/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx index 23387a7c..6f326ff3 100644 Binary files a/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx and b/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.inx differ diff --git a/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx b/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx index f8f62e88..3079c6d0 100644 Binary files a/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx and b/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.inx differ diff --git a/nfc/NfcCxSample/windows-drivertemplate-nfc/windows-drivertemplate-nfc.inf b/nfc/NfcCxSample/windows-drivertemplate-nfc/windows-drivertemplate-nfc.inf index d1fb92b8..5d1afa6e 100644 Binary files a/nfc/NfcCxSample/windows-drivertemplate-nfc/windows-drivertemplate-nfc.inf and b/nfc/NfcCxSample/windows-drivertemplate-nfc/windows-drivertemplate-nfc.inf differ diff --git a/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx b/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx index 313cfdb2..25b799f0 100644 Binary files a/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx and b/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx differ diff --git a/pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.inx b/pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.inx index a78c06cf..4642ce27 100644 Binary files a/pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.inx and b/pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.inx differ diff --git a/pofx/WDF/Driver/SingleComp/SingleComponentFStateSample.inx b/pofx/WDF/Driver/SingleComp/SingleComponentFStateSample.inx index 3508c702..adaa2411 100644 Binary files a/pofx/WDF/Driver/SingleComp/SingleComponentFStateSample.inx and b/pofx/WDF/Driver/SingleComp/SingleComponentFStateSample.inx differ diff --git a/serial/VirtualSerial2/ComPort/virtualserial2um.inx b/serial/VirtualSerial2/ComPort/virtualserial2um.inx index 1252a64c..1194ae6a 100644 Binary files a/serial/VirtualSerial2/ComPort/virtualserial2um.inx and b/serial/VirtualSerial2/ComPort/virtualserial2um.inx differ diff --git a/serial/VirtualSerial2/FakeModem/fakemodem2um.inx b/serial/VirtualSerial2/FakeModem/fakemodem2um.inx index 4e550c87..235bdddd 100644 Binary files a/serial/VirtualSerial2/FakeModem/fakemodem2um.inx and b/serial/VirtualSerial2/FakeModem/fakemodem2um.inx differ diff --git a/serial/serial/serial.inx b/serial/serial/serial.inx index 2a2cdc66..d6bfc3bb 100644 Binary files a/serial/serial/serial.inx and b/serial/serial/serial.inx differ diff --git a/spb/SkeletonI2C/skeletoni2c.inx b/spb/SkeletonI2C/skeletoni2c.inx index 4c42c7db..056423f9 100644 Binary files a/spb/SkeletonI2C/skeletoni2c.inx and b/spb/SkeletonI2C/skeletoni2c.inx differ diff --git a/spb/SpbTestTool/sys/spbtesttool.inx b/spb/SpbTestTool/sys/spbtesttool.inx index bf337b3e..baf82127 100644 Binary files a/spb/SpbTestTool/sys/spbtesttool.inx and b/spb/SpbTestTool/sys/spbtesttool.inx differ diff --git a/wia/ProdScan/ProdScan.inx b/wia/ProdScan/ProdScan.inx index 33d0da88..6e8036ef 100644 Binary files a/wia/ProdScan/ProdScan.inx and b/wia/ProdScan/ProdScan.inx differ diff --git a/wia/microdrv/testmcro.inx b/wia/microdrv/testmcro.inx index 5cd679a7..86e3d220 100644 Binary files a/wia/microdrv/testmcro.inx and b/wia/microdrv/testmcro.inx differ diff --git a/wia/wiadriverex/usd/WiaDriver.inx b/wia/wiadriverex/usd/WiaDriver.inx index d7feb02f..5d394e80 100644 Binary files a/wia/wiadriverex/usd/WiaDriver.inx and b/wia/wiadriverex/usd/WiaDriver.inx differ diff --git a/wmi/wmisamp/wmisamp.inx b/wmi/wmisamp/wmisamp.inx index c4c48070..bdf4152f 100644 Binary files a/wmi/wmisamp/wmisamp.inx and b/wmi/wmisamp/wmisamp.inx differ -- cgit v1.3.1 From 10d84c5ee0fd313f2021180f901b7d3c5f951ad7 Mon Sep 17 00:00:00 2001 From: Heesung Kim Date: Tue, 14 Mar 2023 23:44:24 +0900 Subject: Fix error logging `dwErrCode` which is always 0. --- filesys/miniFilter/avscan/user/userscan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/filesys/miniFilter/avscan/user/userscan.c b/filesys/miniFilter/avscan/user/userscan.c index 71527823..5808c2ce 100644 --- a/filesys/miniFilter/avscan/user/userscan.c +++ b/filesys/miniFilter/avscan/user/userscan.c @@ -759,7 +759,6 @@ Return Value: HRESULT hr = S_OK; ULONG bytesReturned = 0; HANDLE sectionHandle = NULL; - DWORD dwErrCode = 0; PVOID scanAddress = NULL; MEMORY_BASIC_INFORMATION memoryInfo; PAV_SCANNER_NOTIFICATION notification = &Message->Notification; @@ -847,7 +846,7 @@ Cleanup: if (!CloseHandle(sectionHandle)) { fprintf(stderr, "[UserScanHandleStartScanMsg]: Failed to close the section handle.\n"); - DisplayError(HRESULT_FROM_WIN32(dwErrCode)); + DisplayError(HRESULT_FROM_WIN32(GetLastError())); } // -- cgit v1.3.1 From a73c1cd20a5c668ccce29e15fc62ab904c1aa743 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 14 Mar 2023 13:27:16 -0700 Subject: Fix file encoding of osrfx2_DCHU_base.inx (#933) Co-authored-by: Jason Knichel --- .../osrfx2_DCHU_base/osrfx2_DCHU_base.inx | Bin 4274 -> 8542 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx index 1e72c7ee..49b51884 100644 Binary files a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx and b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx differ -- cgit v1.3.1 From 0ad416560c5e2bb12a996d29a22ee74acb1b08e8 Mon Sep 17 00:00:00 2001 From: Wei Mao Date: Tue, 14 Mar 2023 11:56:05 -0700 Subject: Use WudfRd.inf instead of AddService --- general/toaster/umdf2/filter/generic/filterum.inx | Bin 4922 -> 4586 bytes general/toaster/umdf2/func/featured/wdffeaturedum.inx | Bin 5066 -> 4730 bytes general/toaster/umdf2/func/simple/wdfsimpleum.inx | Bin 4942 -> 4606 bytes .../SingleComp/SingleComponentSingleStateUm.inx | Bin 4604 -> 4262 bytes 4 files changed, 0 insertions(+), 0 deletions(-) diff --git a/general/toaster/umdf2/filter/generic/filterum.inx b/general/toaster/umdf2/filter/generic/filterum.inx index 7ea0032e..e7e04b65 100644 Binary files a/general/toaster/umdf2/filter/generic/filterum.inx and b/general/toaster/umdf2/filter/generic/filterum.inx differ diff --git a/general/toaster/umdf2/func/featured/wdffeaturedum.inx b/general/toaster/umdf2/func/featured/wdffeaturedum.inx index 411a4835..7b5f9c07 100644 Binary files a/general/toaster/umdf2/func/featured/wdffeaturedum.inx and b/general/toaster/umdf2/func/featured/wdffeaturedum.inx differ diff --git a/general/toaster/umdf2/func/simple/wdfsimpleum.inx b/general/toaster/umdf2/func/simple/wdfsimpleum.inx index 4918c778..e07cf3a1 100644 Binary files a/general/toaster/umdf2/func/simple/wdfsimpleum.inx and b/general/toaster/umdf2/func/simple/wdfsimpleum.inx differ diff --git a/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx b/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx index 25b799f0..ffdf5414 100644 Binary files a/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx and b/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.inx differ -- cgit v1.3.1 From 5ccdeee0a0ee3bafb9a6d2920e0e2fabfef24286 Mon Sep 17 00:00:00 2001 From: Wei Mao Date: Fri, 17 Mar 2023 13:28:05 -0700 Subject: [general/toaster/toastpkg] update INF; remove toastcd (#936) - Remove reference to coinstaller. They are deprecated. - Remove support for multiple-arch. No many needs for such a feature, and they do not play well with InfVerif - Remove toastcd folder. They are basically the binary result of sibling folders. --- general/toaster/toastpkg/inf/toastpkg.inf | 31 +----- .../toaster/toastpkg/toastcd/ToastApp/setup.exe | Bin 44032 -> 0 bytes .../toaster/toastpkg/toastcd/ToastApp/setup.ini | Bin 758 -> 0 bytes .../toaster/toastpkg/toastcd/ToastApp/toastapp.msi | Bin 181760 -> 0 bytes general/toaster/toastpkg/toastcd/amd64/toaster.sys | Bin 41472 -> 0 bytes general/toaster/toastpkg/toastcd/amd64/toastva.exe | Bin 98304 -> 0 bytes .../toaster/toastpkg/toastcd/amd64/tostrco2.dll | Bin 17920 -> 0 bytes general/toaster/toastpkg/toastcd/autorun.inf | 12 -- general/toaster/toastpkg/toastcd/i386/toaster.sys | Bin 24064 -> 0 bytes general/toaster/toastpkg/toastcd/i386/toastva.exe | Bin 95744 -> 0 bytes general/toaster/toastpkg/toastcd/i386/tostrco2.dll | Bin 14336 -> 0 bytes general/toaster/toastpkg/toastcd/toastpkg.inf | 123 --------------------- general/toaster/toastpkg/toastcd/toastpkg.tag | 0 general/toaster/toastpkg/toastcd/tostx86.cat | Bin 7892 -> 0 bytes general/toaster/toastpkg/toastcd/tstamd64.cat | Bin 7794 -> 0 bytes 15 files changed, 3 insertions(+), 163 deletions(-) delete mode 100644 general/toaster/toastpkg/toastcd/ToastApp/setup.exe delete mode 100644 general/toaster/toastpkg/toastcd/ToastApp/setup.ini delete mode 100644 general/toaster/toastpkg/toastcd/ToastApp/toastapp.msi delete mode 100644 general/toaster/toastpkg/toastcd/amd64/toaster.sys delete mode 100644 general/toaster/toastpkg/toastcd/amd64/toastva.exe delete mode 100644 general/toaster/toastpkg/toastcd/amd64/tostrco2.dll delete mode 100644 general/toaster/toastpkg/toastcd/autorun.inf delete mode 100644 general/toaster/toastpkg/toastcd/i386/toaster.sys delete mode 100644 general/toaster/toastpkg/toastcd/i386/toastva.exe delete mode 100644 general/toaster/toastpkg/toastcd/i386/tostrco2.dll delete mode 100644 general/toaster/toastpkg/toastcd/toastpkg.inf delete mode 100644 general/toaster/toastpkg/toastcd/toastpkg.tag delete mode 100644 general/toaster/toastpkg/toastcd/tostx86.cat delete mode 100644 general/toaster/toastpkg/toastcd/tstamd64.cat diff --git a/general/toaster/toastpkg/inf/toastpkg.inf b/general/toaster/toastpkg/inf/toastpkg.inf index 1c39e9b4..772fbc03 100644 --- a/general/toaster/toastpkg/inf/toastpkg.inf +++ b/general/toaster/toastpkg/inf/toastpkg.inf @@ -15,8 +15,6 @@ ; ; INF file for installing toaster device drivers (and, optionally, value- ; added software) via device-specific coinstaller. -; This is a mutlios INF file. Same INF file cab be used on -; x86 and amd64 platforms. ; ; Important: ; This INF depends on features for the Driver Store DIRIDs which are available starting Windows 10 1709 @@ -28,23 +26,17 @@ Class=TOASTER ClassGuid={B85B7C50-6A01-11d2-B841-00C04FAD5171} Provider=%ProviderName% DriverVer=09/21/2006,6.0.5736.1 -CatalogFile.NTx86 = tostx86.cat -CatalogFile.NTAMD64 = tstamd64.cat +CatalogFile = toastpkg.cat PnpLockdown = 1 [DestinationDirs] DefaultDestDir = 13 -CoInstaller_CopyFiles = 11 -[SourceDisksNames.x86] -1 = %DiskId1%, toastpkg.tag,,\i386 - -[SourceDisksNames.amd64] -1 = %DiskId1%, toastpkg.tag,,\amd64 +[SourceDisksNames] +1 = %DiskId1% [SourceDisksFiles] toaster.sys = 1,, -tostrco2.dll = 1,, ; ================= Class section ===================== @@ -95,23 +87,6 @@ StartType = 3 ; SERVICE_DEMAND_START ErrorControl = 1 ; SERVICE_ERROR_NORMAL ServiceBinary = %13%\toaster.sys -;-------------- Coinstaller installation - -[Toaster_Device.NT.CoInstallers] -AddReg=CoInstaller_AddReg -CopyFiles=CoInstaller_CopyFiles - -[CoInstaller_CopyFiles] -tostrco2.dll - -[CoInstaller_AddReg] -HKR,,CoInstallers32,0x00010000,"tostrco2.dll,ToasterCoInstaller" - -[ToastCoInfo] -; Used by the toaster co-installer to figure out where the original media is -; located (so it can launch value-added setup programs). -OriginalInfSourcePath = %1% - [Strings] SPSVCINST_ASSOCSERVICE= 0x00000002 ProviderName = "TODO-Set-Provider" diff --git a/general/toaster/toastpkg/toastcd/ToastApp/setup.exe b/general/toaster/toastpkg/toastcd/ToastApp/setup.exe deleted file mode 100644 index 9fcedf96..00000000 Binary files a/general/toaster/toastpkg/toastcd/ToastApp/setup.exe and /dev/null differ diff --git a/general/toaster/toastpkg/toastcd/ToastApp/setup.ini b/general/toaster/toastpkg/toastcd/ToastApp/setup.ini deleted file mode 100644 index 81d61154..00000000 Binary files a/general/toaster/toastpkg/toastcd/ToastApp/setup.ini and /dev/null differ diff --git a/general/toaster/toastpkg/toastcd/ToastApp/toastapp.msi b/general/toaster/toastpkg/toastcd/ToastApp/toastapp.msi deleted file mode 100644 index 0bdfaa65..00000000 Binary files a/general/toaster/toastpkg/toastcd/ToastApp/toastapp.msi and /dev/null differ diff --git a/general/toaster/toastpkg/toastcd/amd64/toaster.sys b/general/toaster/toastpkg/toastcd/amd64/toaster.sys deleted file mode 100644 index d51da6c4..00000000 Binary files a/general/toaster/toastpkg/toastcd/amd64/toaster.sys and /dev/null differ diff --git a/general/toaster/toastpkg/toastcd/amd64/toastva.exe b/general/toaster/toastpkg/toastcd/amd64/toastva.exe deleted file mode 100644 index ebd46df9..00000000 Binary files a/general/toaster/toastpkg/toastcd/amd64/toastva.exe and /dev/null differ diff --git a/general/toaster/toastpkg/toastcd/amd64/tostrco2.dll b/general/toaster/toastpkg/toastcd/amd64/tostrco2.dll deleted file mode 100644 index 58dfab32..00000000 Binary files a/general/toaster/toastpkg/toastcd/amd64/tostrco2.dll and /dev/null differ diff --git a/general/toaster/toastpkg/toastcd/autorun.inf b/general/toaster/toastpkg/toastcd/autorun.inf deleted file mode 100644 index ee67cf9a..00000000 --- a/general/toaster/toastpkg/toastcd/autorun.inf +++ /dev/null @@ -1,12 +0,0 @@ -[AutoRun] -open=i386\toastva.exe -icon=i386\toastva.exe,0 - -[AutoRun.i386] -open=i386\toastva.exe - -[AutoRun.amd64] -open=amd64\toastva.exe - -[DeviceInstall] -DriverPath=\ diff --git a/general/toaster/toastpkg/toastcd/i386/toaster.sys b/general/toaster/toastpkg/toastcd/i386/toaster.sys deleted file mode 100644 index 19184dc9..00000000 Binary files a/general/toaster/toastpkg/toastcd/i386/toaster.sys and /dev/null differ diff --git a/general/toaster/toastpkg/toastcd/i386/toastva.exe b/general/toaster/toastpkg/toastcd/i386/toastva.exe deleted file mode 100644 index 7bbb4a47..00000000 Binary files a/general/toaster/toastpkg/toastcd/i386/toastva.exe and /dev/null differ diff --git a/general/toaster/toastpkg/toastcd/i386/tostrco2.dll b/general/toaster/toastpkg/toastcd/i386/tostrco2.dll deleted file mode 100644 index 3f7b3ed1..00000000 Binary files a/general/toaster/toastpkg/toastcd/i386/tostrco2.dll and /dev/null differ diff --git a/general/toaster/toastpkg/toastcd/toastpkg.inf b/general/toaster/toastpkg/toastcd/toastpkg.inf deleted file mode 100644 index 1c39e9b4..00000000 --- a/general/toaster/toastpkg/toastcd/toastpkg.inf +++ /dev/null @@ -1,123 +0,0 @@ -;/*++ -; -;Copyright (c) Microsoft Corporation. All rights reserved. -; -; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY -; KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -; IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR -; PURPOSE. -; -;Module Name: -; -; TOASTPKG.INF -; -;Abstract: -; -; INF file for installing toaster device drivers (and, optionally, value- -; added software) via device-specific coinstaller. -; This is a mutlios INF file. Same INF file cab be used on -; x86 and amd64 platforms. -; -; Important: -; This INF depends on features for the Driver Store DIRIDs which are available starting Windows 10 1709 -; -;--*/ -[Version] -Signature="$WINDOWS NT$" -Class=TOASTER -ClassGuid={B85B7C50-6A01-11d2-B841-00C04FAD5171} -Provider=%ProviderName% -DriverVer=09/21/2006,6.0.5736.1 -CatalogFile.NTx86 = tostx86.cat -CatalogFile.NTAMD64 = tstamd64.cat -PnpLockdown = 1 - -[DestinationDirs] -DefaultDestDir = 13 -CoInstaller_CopyFiles = 11 - -[SourceDisksNames.x86] -1 = %DiskId1%, toastpkg.tag,,\i386 - -[SourceDisksNames.amd64] -1 = %DiskId1%, toastpkg.tag,,\amd64 - -[SourceDisksFiles] -toaster.sys = 1,, -tostrco2.dll = 1,, - -; ================= Class section ===================== - -[ClassInstall32] -Addreg=ToasterClassReg - -[ToasterClassReg] -HKR,,,0,%ClassName% -HKR,,Icon,,100 -HKR,,DeviceCharacteristics,0x10001,0x100 ; Use same security checks on relative opens - -;***************************************** -; Toaster Device Install Section -;***************************************** - -[Manufacturer] -%ToastRUs%=ToastRUs,NTx86.10.0...16299, NTamd64.10.0...16299 - -[ToastRUs.NTx86.10.0...16299] -%ToasterDevice.DeviceDesc%=Toaster_Device, {b85b7c50-6a01-11d2-b841-00c04fad5171}\MsToaster - -[ToastRUs.NTamd64.10.0...16299] -%ToasterDevice.DeviceDesc%=Toaster_Device, {b85b7c50-6a01-11d2-b841-00c04fad5171}\MsToaster - - -[Toaster_Device.NT] -CopyFiles=Toaster_Device.NT.Copy -FriendlyNameFormat=%FriendlyNameFormat% - -[Toaster_Device.NT.Copy] -toaster.sys - -[Toaster_Device.NT.HW] -AddReg=Toaster_Device.NT.HW.AddReg - -[Toaster_Device.NT.HW.AddReg] -HKR,,"BeepCount",0x00010003,4 - -;-------------- Service installation - -[Toaster_Device.NT.Services] -AddService = toaster, %SPSVCINST_ASSOCSERVICE%, toaster_Service_Inst - -[toaster_Service_Inst] -DisplayName = %toaster.SVCDESC% -ServiceType = 1 ; SERVICE_KERNEL_DRIVER -StartType = 3 ; SERVICE_DEMAND_START -ErrorControl = 1 ; SERVICE_ERROR_NORMAL -ServiceBinary = %13%\toaster.sys - -;-------------- Coinstaller installation - -[Toaster_Device.NT.CoInstallers] -AddReg=CoInstaller_AddReg -CopyFiles=CoInstaller_CopyFiles - -[CoInstaller_CopyFiles] -tostrco2.dll - -[CoInstaller_AddReg] -HKR,,CoInstallers32,0x00010000,"tostrco2.dll,ToasterCoInstaller" - -[ToastCoInfo] -; Used by the toaster co-installer to figure out where the original media is -; located (so it can launch value-added setup programs). -OriginalInfSourcePath = %1% - -[Strings] -SPSVCINST_ASSOCSERVICE= 0x00000002 -ProviderName = "TODO-Set-Provider" -ToastRUs = "Toast'R'Us" -ClassName = "Toaster" -DiskId1 = "Toaster Device Installation Disk #1" -ToasterDevice.DeviceDesc = "Toaster Package Sample Toaster" -toaster.SVCDESC = "Toaster Device Driver" -FriendlyNameFormat = "ToasterDevice%1!u!" diff --git a/general/toaster/toastpkg/toastcd/toastpkg.tag b/general/toaster/toastpkg/toastcd/toastpkg.tag deleted file mode 100644 index e69de29b..00000000 diff --git a/general/toaster/toastpkg/toastcd/tostx86.cat b/general/toaster/toastpkg/toastcd/tostx86.cat deleted file mode 100644 index e8b604b5..00000000 Binary files a/general/toaster/toastpkg/toastcd/tostx86.cat and /dev/null differ diff --git a/general/toaster/toastpkg/toastcd/tstamd64.cat b/general/toaster/toastpkg/toastcd/tstamd64.cat deleted file mode 100644 index cd1a8eb6..00000000 Binary files a/general/toaster/toastpkg/toastcd/tstamd64.cat and /dev/null differ -- cgit v1.3.1 From 0250f5db3ef51843d27570c83dc59acd1c1b14b8 Mon Sep 17 00:00:00 2001 From: Wei Mao Date: Mon, 20 Mar 2023 17:12:34 -0700 Subject: [usb/usbview] Enumerate HostController with multiple DeviceInterfaces (#938) --- usb/usbview/enum.c | 119 ++++++++++++++++++++++++++--------------------------- 1 file changed, 58 insertions(+), 61 deletions(-) diff --git a/usb/usbview/enum.c b/usb/usbview/enum.c index fd427f68..297e0d32 100644 --- a/usb/usbview/enum.c +++ b/usb/usbview/enum.c @@ -296,77 +296,74 @@ EnumerateHostControllers ( { deviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA); - success = SetupDiEnumDeviceInterfaces(deviceInfo, - 0, - (LPGUID)&GUID_CLASS_USB_HOST_CONTROLLER, - index, - &deviceInterfaceData); - - if (!success) + for (int devInterfaceIndex = 0; + SetupDiEnumDeviceInterfaces(deviceInfo, + &deviceInfoData, + (LPGUID)&GUID_CLASS_USB_HOST_CONTROLLER, + devInterfaceIndex, + &deviceInterfaceData); + devInterfaceIndex++) { - OOPS(); - break; - } - - success = SetupDiGetDeviceInterfaceDetail(deviceInfo, - &deviceInterfaceData, - NULL, - 0, - &requiredLength, - NULL); + success = SetupDiGetDeviceInterfaceDetail(deviceInfo, + &deviceInterfaceData, + NULL, + 0, + &requiredLength, + NULL); - if (!success && GetLastError() != ERROR_INSUFFICIENT_BUFFER) - { - OOPS(); - break; - } + if (!success && GetLastError() != ERROR_INSUFFICIENT_BUFFER) + { + OOPS(); + break; + } - deviceDetailData = ALLOC(requiredLength); - if (deviceDetailData == NULL) - { - OOPS(); - break; - } + deviceDetailData = ALLOC(requiredLength); + if (deviceDetailData == NULL) + { + OOPS(); + break; + } - deviceDetailData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); + deviceDetailData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); - success = SetupDiGetDeviceInterfaceDetail(deviceInfo, - &deviceInterfaceData, - deviceDetailData, - requiredLength, - &requiredLength, - NULL); + success = SetupDiGetDeviceInterfaceDetail(deviceInfo, + &deviceInterfaceData, + deviceDetailData, + requiredLength, + &requiredLength, + NULL); - if (!success) - { - OOPS(); - break; - } + if (!success) + { + OOPS(); + break; + } - hHCDev = CreateFile(deviceDetailData->DevicePath, - GENERIC_WRITE, - FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - 0, - NULL); + hHCDev = CreateFile(deviceDetailData->DevicePath, + GENERIC_WRITE, + FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + 0, + NULL); + + // If the handle is valid, then we've successfully opened a Host + // Controller. Display some info about the Host Controller itself, + // then enumerate the Root Hub attached to the Host Controller. + // + if (hHCDev != INVALID_HANDLE_VALUE) + { + EnumerateHostController(hTreeParent, + hHCDev, + deviceDetailData->DevicePath, + deviceInfo, + &deviceInfoData); - // If the handle is valid, then we've successfully opened a Host - // Controller. Display some info about the Host Controller itself, - // then enumerate the Root Hub attached to the Host Controller. - // - if (hHCDev != INVALID_HANDLE_VALUE) - { - EnumerateHostController(hTreeParent, - hHCDev, - deviceDetailData->DevicePath, - deviceInfo, - &deviceInfoData); + CloseHandle(hHCDev); + } - CloseHandle(hHCDev); + FREE(deviceDetailData); } - - FREE(deviceDetailData); } SetupDiDestroyDeviceInfoList(deviceInfo); -- cgit v1.3.1 From 688890a21b00c9781e64aa84bfdc58e762973f6a Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 21 Mar 2023 14:55:30 -0700 Subject: Add PnpLockdown=1 to file system filter samples (#937) Co-authored-by: Jason Knichel --- filesys/miniFilter/MetadataManager/fmm.inf | 1 + filesys/miniFilter/NameChanger/NameChanger.inf | 1 + filesys/miniFilter/avscan/avscan.inf | 1 + filesys/miniFilter/cancelSafe/cancelSafe.inf | 1 + filesys/miniFilter/cdo/cdo.inf | 1 + filesys/miniFilter/change/change.inf | 1 + filesys/miniFilter/ctx/ctx.inf | 1 + filesys/miniFilter/delete/delete.inf | 1 + filesys/miniFilter/minispy/minispy.inf | 1 + filesys/miniFilter/nullFilter/nullFilter.inf | 1 + filesys/miniFilter/passThrough/passThrough.inf | 1 + filesys/miniFilter/scanner/scanner.inf | 1 + filesys/miniFilter/simrep/simrep.inf | 1 + filesys/miniFilter/swapBuffers/swapBuffers.inf | 1 + 14 files changed, 14 insertions(+) diff --git a/filesys/miniFilter/MetadataManager/fmm.inf b/filesys/miniFilter/MetadataManager/fmm.inf index 5c39ed06..f1feb1e4 100644 --- a/filesys/miniFilter/MetadataManager/fmm.inf +++ b/filesys/miniFilter/MetadataManager/fmm.inf @@ -12,6 +12,7 @@ ClassGuid = {b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2} Provider = %ProviderString% DriverVer = 06/16/2007,1.0.0.1 CatalogFile = fmm.cat +PnpLockdown = 1 [DestinationDirs] diff --git a/filesys/miniFilter/NameChanger/NameChanger.inf b/filesys/miniFilter/NameChanger/NameChanger.inf index cd74fb44..94e455e8 100644 --- a/filesys/miniFilter/NameChanger/NameChanger.inf +++ b/filesys/miniFilter/NameChanger/NameChanger.inf @@ -12,6 +12,7 @@ ClassGuid = {b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2} ;This value is determine Provider = %ProviderString% DriverVer = 06/05/2009,1.0.0.1 CatalogFile = NameChanger.cat +PnpLockdown = 1 [SourceDisksNames] 12=%ServiceDescription%,,, diff --git a/filesys/miniFilter/avscan/avscan.inf b/filesys/miniFilter/avscan/avscan.inf index 2162f0b4..f88c0436 100644 --- a/filesys/miniFilter/avscan/avscan.inf +++ b/filesys/miniFilter/avscan/avscan.inf @@ -12,6 +12,7 @@ ClassGuid = {3e3f0674-c83c-4558-bb26-9820e1eba5c5} ;This value is determine Provider = %ProviderString% DriverVer = 06/16/2011,1.0.0.1 CatalogFile = avscan.cat +PnpLockdown = 1 [DestinationDirs] diff --git a/filesys/miniFilter/cancelSafe/cancelSafe.inf b/filesys/miniFilter/cancelSafe/cancelSafe.inf index 132eea1e..810d3a98 100644 --- a/filesys/miniFilter/cancelSafe/cancelSafe.inf +++ b/filesys/miniFilter/cancelSafe/cancelSafe.inf @@ -12,6 +12,7 @@ ClassGuid = {b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2} ;This value is determine Provider = %ProviderString% DriverVer = 06/16/2007,1.0.0.0 CatalogFile = cancelsafe.cat +PnpLockdown = 1 [DestinationDirs] diff --git a/filesys/miniFilter/cdo/cdo.inf b/filesys/miniFilter/cdo/cdo.inf index 52dc6c06..078f31a2 100644 --- a/filesys/miniFilter/cdo/cdo.inf +++ b/filesys/miniFilter/cdo/cdo.inf @@ -12,6 +12,7 @@ ClassGuid = {b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2} Provider = %ProviderString% DriverVer = 06/16/2007,1.0.0.1 CatalogFile = cdo.cat +PnpLockdown = 1 [DestinationDirs] diff --git a/filesys/miniFilter/change/change.inf b/filesys/miniFilter/change/change.inf index 9a495e76..4dbdc827 100644 --- a/filesys/miniFilter/change/change.inf +++ b/filesys/miniFilter/change/change.inf @@ -12,6 +12,7 @@ ClassGuid = {b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2} ;This value is determine Provider = %ProviderString% DriverVer = 06/16/2011,1.0.0.1 CatalogFile = change.cat +PnpLockdown = 1 [DestinationDirs] diff --git a/filesys/miniFilter/ctx/ctx.inf b/filesys/miniFilter/ctx/ctx.inf index 27a7f674..6b0dd10e 100644 --- a/filesys/miniFilter/ctx/ctx.inf +++ b/filesys/miniFilter/ctx/ctx.inf @@ -12,6 +12,7 @@ ClassGuid = {b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2} Provider = %ProviderString% DriverVer = 06/16/2007,1.0.0.1 CatalogFile = ctx.cat +PnpLockdown = 1 [DestinationDirs] diff --git a/filesys/miniFilter/delete/delete.inf b/filesys/miniFilter/delete/delete.inf index aa974b47..b372f736 100644 --- a/filesys/miniFilter/delete/delete.inf +++ b/filesys/miniFilter/delete/delete.inf @@ -12,6 +12,7 @@ ClassGuid = {b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2} ;This value is determine Provider = %ProviderString% DriverVer = 06/16/2007,1.0.0.1 CatalogFile = delete.cat +PnpLockdown = 1 [DestinationDirs] diff --git a/filesys/miniFilter/minispy/minispy.inf b/filesys/miniFilter/minispy/minispy.inf index c5cc24bb..069bc83a 100644 --- a/filesys/miniFilter/minispy/minispy.inf +++ b/filesys/miniFilter/minispy/minispy.inf @@ -12,6 +12,7 @@ ClassGuid = {b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2} ;This value is determine Provider = %ProviderString% DriverVer = 06/16/2007,1.0.0.0 CatalogFile = minispy.cat +PnpLockdown = 1 [DestinationDirs] diff --git a/filesys/miniFilter/nullFilter/nullFilter.inf b/filesys/miniFilter/nullFilter/nullFilter.inf index 5f1c45c2..bc0669b0 100644 --- a/filesys/miniFilter/nullFilter/nullFilter.inf +++ b/filesys/miniFilter/nullFilter/nullFilter.inf @@ -12,6 +12,7 @@ ClassGuid = {b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2} ;This value is determine Provider = %ProviderString% DriverVer = 06/16/2007,1.0.0.0 CatalogFile = nullfilter.cat +PnpLockdown = 1 [DestinationDirs] diff --git a/filesys/miniFilter/passThrough/passThrough.inf b/filesys/miniFilter/passThrough/passThrough.inf index 91d59655..134d0a47 100644 --- a/filesys/miniFilter/passThrough/passThrough.inf +++ b/filesys/miniFilter/passThrough/passThrough.inf @@ -12,6 +12,7 @@ ClassGuid = {b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2} ;This value is determine Provider = %ProviderString% DriverVer = 06/16/2007,1.0.0.1 CatalogFile = passthrough.cat +PnpLockdown = 1 [DestinationDirs] diff --git a/filesys/miniFilter/scanner/scanner.inf b/filesys/miniFilter/scanner/scanner.inf index df5cc857..37147d71 100644 --- a/filesys/miniFilter/scanner/scanner.inf +++ b/filesys/miniFilter/scanner/scanner.inf @@ -12,6 +12,7 @@ ClassGuid = {3e3f0674-c83c-4558-bb26-9820e1eba5c5} ;This value is determine Provider = %ProviderString% DriverVer = 06/16/2007,1.0.0.0 CatalogFile = scanner.cat +PnpLockdown = 1 [DestinationDirs] diff --git a/filesys/miniFilter/simrep/simrep.inf b/filesys/miniFilter/simrep/simrep.inf index 2d01803d..a98890b0 100644 --- a/filesys/miniFilter/simrep/simrep.inf +++ b/filesys/miniFilter/simrep/simrep.inf @@ -12,6 +12,7 @@ ClassGuid = {b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2} Provider = %ProviderString% DriverVer = 01/01/2004,1.0.0.1 CatalogFile = simrep.cat +PnpLockdown = 1 [DestinationDirs] DefaultDestDir = 12 diff --git a/filesys/miniFilter/swapBuffers/swapBuffers.inf b/filesys/miniFilter/swapBuffers/swapBuffers.inf index 34298e6b..9f4c9d1d 100644 --- a/filesys/miniFilter/swapBuffers/swapBuffers.inf +++ b/filesys/miniFilter/swapBuffers/swapBuffers.inf @@ -12,6 +12,7 @@ ClassGuid = {a0a701c0-a511-42ff-aa6c-06dc0395576f} ;This value is determine Provider = %ProviderString% DriverVer = 06/16/2007,1.0.0.3 CatalogFile = swapbuffers.cat +PnpLockdown = 1 [DestinationDirs] -- cgit v1.3.1 From afa69cdeeb4644e8cd9a1a567dc91a7f29947a5b Mon Sep 17 00:00:00 2001 From: mvillalpando06 <116905813+mvillalpando06@users.noreply.github.com> Date: Fri, 24 Mar 2023 12:31:24 -0700 Subject: Fix driver violations for energy team owned drivers (#880) * Fix driver violations for energy team owned drivers * Address comments * remove simbatt wdf inf * Fix build failures * Fix sampleacpipep inx file * re isolate sample acpipep * add target os --- pofx/PEP/acpi/sampleacpipep.inx | Bin 4238 -> 4270 bytes pofx/PEP/acpi/sampleacpipep.vcxproj | 8 +- simbatt/func/simbatt-wdfcoinstall.inx | 109 ---------------------------- simbatt/func/simbatt.inx | Bin 3892 -> 3944 bytes simbatt/func/simbatt.vcxproj | 10 +-- simbatt/func/simbatt.vcxproj.Filters | 5 +- thermal/simsensor/simsensor.inf | 20 ++--- thermal/simsensor/simsensor.vcxproj | 3 + thermal/simsensor/simsensor.vcxproj.Filters | 10 +++ thermal/thermalclient/simtc.inf | 20 ++--- thermal/thermalclient/simtc.vcxproj | 20 ++++- thermal/thermalclient/simtc.vcxproj.Filters | 10 +++ 12 files changed, 69 insertions(+), 146 deletions(-) delete mode 100644 simbatt/func/simbatt-wdfcoinstall.inx diff --git a/pofx/PEP/acpi/sampleacpipep.inx b/pofx/PEP/acpi/sampleacpipep.inx index 4dfa0a29..9f93ad5b 100644 Binary files a/pofx/PEP/acpi/sampleacpipep.inx and b/pofx/PEP/acpi/sampleacpipep.inx differ diff --git a/pofx/PEP/acpi/sampleacpipep.vcxproj b/pofx/PEP/acpi/sampleacpipep.vcxproj index 77709aa2..357b2205 100644 --- a/pofx/PEP/acpi/sampleacpipep.vcxproj +++ b/pofx/PEP/acpi/sampleacpipep.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/simbatt/func/simbatt-wdfcoinstall.inx b/simbatt/func/simbatt-wdfcoinstall.inx deleted file mode 100644 index 15c596ab..00000000 --- a/simbatt/func/simbatt-wdfcoinstall.inx +++ /dev/null @@ -1,109 +0,0 @@ -;/*++ -; -;Copyright (c) Microsoft Corporation All rights Reserved -; -;Module Name: -; -; simbatt.inf -; -;Abstract: -; -; INF file for installing Simulated Battery WDF driver. -; -; N.B. Search the file for TODO comments and make necessary changes to make -; this INF file functional. -; -; N.B. Place the WdfCoInstaller files in the same directory as this file to -; make this INF file functional. -; -;--*/ - -[Version] -Signature="$WINDOWS NT$" -Class=Battery -ClassGuid={72631e54-78a4-11d0-bcf7-00aa00b7b32a} -Provider=%ProviderName% -DriverVer=04/30/2008, 6.01.6598 -CatalogFile=simbatt-wdfcoinstall.cat ; TODO: Add a signed catalog file -PnpLockdown=1 - -[DestinationDirs] -DefaultDestDir = 12 -SimBatt_Device_CoInstaller_CopyFiles = 11 - -[SourceDisksNames] -1 = %DiskId1%,,,"" - -[SourceDisksFiles] -simbatt.sys = 1 -WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll = 1 - -;***************************************** -; Simulated Battery Install Section -;***************************************** - -[Manufacturer] -%StdMfg%=Standard,NT$ARCH$ - -[Standard.NT$ARCH$] -%SimBatt.DeviceDesc% = SimBatt_Device,{6B34C467-CE1F-4c0d-A3E4-F98A5718A9D6}\SimBatt - -[SimBatt_Device.NT] -CopyFiles=SimBatt_Device_Drivers -Include=battery.inf -Needs=Battery_Inst - -[SimBatt_Device.NT.HW] -AddReg=SimBatt_Device.NT.AddReg - -[SimBatt_Device.NT.AddReg] -HKR,,Security,,"D:P(A;;GA;;;AU)(A;;GA;;;S-1-15-2-1)" ; Allow generic-all users and appcontainers - -[SimBatt_Device_Drivers] -simbatt.sys - -;-------------- Service installation - -[SimBatt_Device.NT.Services] -AddService = simbatt,%SPSVCINST_ASSOCSERVICE%,SimBatt_Service_Inst - -; -------------- simbatt driver install sections - -[SimBatt_Service_Inst] -DisplayName = %SimBatt.SVCDESC% -ServiceType = 1 ; SERVICE_KERNEL_DRIVER -StartType = 3 ; SERVICE_DEMAND_START -ErrorControl = 1 ; SERVICE_ERROR_NORMAL -ServiceBinary = %12%\simbatt.sys - -;***************************************** -; WDF CoInstaller -;***************************************** - -[SimBatt_Device.NT.CoInstallers] -AddReg=SimBatt_Device_CoInstaller_AddReg -CopyFiles=SimBatt_Device_CoInstaller_CopyFiles - -[SimBatt_Device_CoInstaller_AddReg] -HKR,,CoInstallers32,0x00010000, "WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller" - -[SimBatt_Device_CoInstaller_CopyFiles] -WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll - -[SimBatt_Device.NT.Wdf] -KmdfService = SimBatt, SimBatt_wdfsect - -[SimBatt_wdfsect] -KmdfLibraryVersion = $KMDFVERSION$ - -;***************************************** -; Literals -;***************************************** - -[Strings] -SPSVCINST_ASSOCSERVICE= 0x00000002 -ProviderName = "TODO-Set-Provider" -StdMfg = "TODO-Set-Manufacturer" -DiskId1 = "Simulated Battery Installation Disk" -SimBatt.DeviceDesc = "Simulated Battery" -SimBatt.SVCDESC = "Simulated Battery" diff --git a/simbatt/func/simbatt.inx b/simbatt/func/simbatt.inx index 3b138e05..02163c10 100644 Binary files a/simbatt/func/simbatt.inx and b/simbatt/func/simbatt.inx differ diff --git a/simbatt/func/simbatt.vcxproj b/simbatt/func/simbatt.vcxproj index a9ab3b9b..342480fb 100644 --- a/simbatt/func/simbatt.vcxproj +++ b/simbatt/func/simbatt.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -190,7 +190,7 @@ - + diff --git a/simbatt/func/simbatt.vcxproj.Filters b/simbatt/func/simbatt.vcxproj.Filters index 42b85d1a..bef5fc96 100644 --- a/simbatt/func/simbatt.vcxproj.Filters +++ b/simbatt/func/simbatt.vcxproj.Filters @@ -43,10 +43,7 @@ - - Driver Files - - + Driver Files diff --git a/thermal/simsensor/simsensor.inf b/thermal/simsensor/simsensor.inf index 63f7a368..0f8fb7cd 100644 --- a/thermal/simsensor/simsensor.inf +++ b/thermal/simsensor/simsensor.inf @@ -22,7 +22,7 @@ CatalogFile=simsensor.cat PnpLockdown=1 [DestinationDirs] -DefaultDestDir = 12 +DefaultDestDir = 13 [SourceDisksNames] 1 = %DiskId1%,,,"" @@ -35,21 +35,21 @@ simsensor.sys = 1,, ;******************************************** [Manufacturer] -%StdMfg%=Standard,NTx86 -%StdMfg%=Standard,NTamd64 -%StdMfg%=Standard,NTarm -%StdMfg%=Standard,NTarm64 +%StdMfg%=Standard,NTx86.10.0...16299 +%StdMfg%=Standard,NTamd64.10.0...16299 +%StdMfg%=Standard,NTarm.10.0...16299 +%StdMfg%=Standard,NTarm64.10.0...16299 -[Standard.NTx86] +[Standard.NTx86.10.0...16299] %simsensor.DeviceDesc% = simsensor_Device, ACPI\MSNS0042 -[Standard.NTamd64] +[Standard.NTamd64.10.0...16299] %simsensor.DeviceDesc% = simsensor_Device, ACPI\MSNS0042 -[Standard.NTarm] +[Standard.NTarm.10.0...16299] %simsensor.DeviceDesc% = simsensor_Device, ACPI\MSNS0042 -[Standard.NTarm64] +[Standard.NTarm64.10.0...16299] %simsensor.DeviceDesc% = simsensor_Device, ACPI\MSNS0042 [simsensor_Device.NT] @@ -78,7 +78,7 @@ DisplayName = %simsensor.SVCDESC% ServiceType = 1 ; SERVICE_KERNEL_DRIVER StartType = 3 ; SERVICE_DEMAND_START ErrorControl = 1 ; SERVICE_ERROR_NORMAL -ServiceBinary = %12%\simsensor.sys +ServiceBinary = %13%\simsensor.sys [Temperature_Power_Setting] SubGroup = {7D54AE13-7A01-469d-8AF3-6FF4662C5371} diff --git a/thermal/simsensor/simsensor.vcxproj b/thermal/simsensor/simsensor.vcxproj index efbdd2dc..a155d12a 100644 --- a/thermal/simsensor/simsensor.vcxproj +++ b/thermal/simsensor/simsensor.vcxproj @@ -105,6 +105,9 @@ %(PreprocessorDefinitions);DRIVER=1;STRICT=1 %(AdditionalIncludeDirectories);..\inc\ + + SHA256 + diff --git a/thermal/simsensor/simsensor.vcxproj.Filters b/thermal/simsensor/simsensor.vcxproj.Filters index c4d812c1..20f76bc5 100644 --- a/thermal/simsensor/simsensor.vcxproj.Filters +++ b/thermal/simsensor/simsensor.vcxproj.Filters @@ -28,4 +28,14 @@ Resource Files + + + Header Files + + + + + Driver Files + + \ No newline at end of file diff --git a/thermal/thermalclient/simtc.inf b/thermal/thermalclient/simtc.inf index 7e607612..41d0d667 100644 --- a/thermal/thermalclient/simtc.inf +++ b/thermal/thermalclient/simtc.inf @@ -22,7 +22,7 @@ CatalogFile=thermalclient.cat PnpLockdown=1 [DestinationDirs] -DefaultDestDir = 12 +DefaultDestDir = 13 [SourceDisksNames] 1 = %DiskId1%,,,"" @@ -35,21 +35,21 @@ simtc.sys = 1,, ;******************************************** [Manufacturer] -%StdMfg%=Standard,NTx86 -%StdMfg%=Standard,NTamd64 -%StdMfg%=Standard,NTarm -%StdMfg%=Standard,NTarm64 +%StdMfg%=Standard,NTx86.10.0...16299 +%StdMfg%=Standard,NTamd64.10.0...16299 +%StdMfg%=Standard,NTarm.10.0...16299 +%StdMfg%=Standard,NTarm64.10.0...16299 -[Standard.NTx86] +[Standard.NTx86.10.0...16299] %SimTc.DeviceDesc% = SimTc_Device, ACPI\STCL0001 -[Standard.NTamd64] +[Standard.NTamd64.10.0...16299] %SimTc.DeviceDesc% = SimTc_Device, ACPI\STCL0001 -[Standard.NTarm] +[Standard.NTarm.10.0...16299] %SimTc.DeviceDesc% = SimTc_Device, ACPI\STCL0001 -[Standard.NTarm64] +[Standard.NTarm64.10.0...16299] %SimTc.DeviceDesc% = SimTc_Device, ACPI\STCL0001 [SimTc_Device.NT] @@ -77,7 +77,7 @@ DisplayName = %SimTc.SVCDESC% ServiceType = 1 ; SERVICE_KERNEL_DRIVER StartType = 3 ; SERVICE_DEMAND_START ErrorControl = 1 ; SERVICE_ERROR_NORMAL -ServiceBinary = %12%\simtc.sys +ServiceBinary = %13%\simtc.sys [Strings] SPSVCINST_ASSOCSERVICE= 0x00000002 diff --git a/thermal/thermalclient/simtc.vcxproj b/thermal/thermalclient/simtc.vcxproj index b3ac6743..2ce2a1dc 100644 --- a/thermal/thermalclient/simtc.vcxproj +++ b/thermal/thermalclient/simtc.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -105,6 +105,9 @@ %(PreprocessorDefinitions);DRIVER=1 %(AdditionalIncludeDirectories) + + SHA256 + @@ -123,6 +126,9 @@ %(PreprocessorDefinitions);DRIVER=1 %(AdditionalIncludeDirectories) + + SHA256 + @@ -141,6 +147,9 @@ %(PreprocessorDefinitions);DRIVER=1 %(AdditionalIncludeDirectories) + + SHA256 + @@ -159,6 +168,9 @@ %(PreprocessorDefinitions);DRIVER=1 %(AdditionalIncludeDirectories) + + SHA256 + diff --git a/thermal/thermalclient/simtc.vcxproj.Filters b/thermal/thermalclient/simtc.vcxproj.Filters index efa1939f..2f8f2a5b 100644 --- a/thermal/thermalclient/simtc.vcxproj.Filters +++ b/thermal/thermalclient/simtc.vcxproj.Filters @@ -28,4 +28,14 @@ Resource Files + + + Header Files + + + + + Driver Files + + \ No newline at end of file -- cgit v1.3.1 From f8738aea301d07eec82147a1ef3b2a48b11209c5 Mon Sep 17 00:00:00 2001 From: kahashimoto-ms <117399367+kahashimoto-ms@users.noreply.github.com> Date: Fri, 24 Mar 2023 12:52:28 -0700 Subject: Netvmini arch fix (#940) * Enable stampinf arch replacement for netvmini60 * delete stray comma * Enable stampinf arch replacement for netvmini620 * Enable stampinf arch replacement for netvmini630 * Enable stampinf arch replacement for netvmini680 * Enable the CET Shadow Stack mitigation for each netvmini60,620,630,680 projects --- network/ndis/netvmini/6x/60/netvmini60.inf | Bin 8190 -> 6470 bytes network/ndis/netvmini/6x/60/netvmini60.vcxproj | 1 + network/ndis/netvmini/6x/620/netvmini620.inf | Bin 12936 -> 11196 bytes network/ndis/netvmini/6x/620/netvmini620.vcxproj | 1 + network/ndis/netvmini/6x/630/netvmini630.inf | Bin 15798 -> 12318 bytes network/ndis/netvmini/6x/630/netvmini630.vcxproj | 1 + network/ndis/netvmini/6x/680/netvmini680.inf | Bin 15798 -> 12314 bytes network/ndis/netvmini/6x/680/netvmini680.vcxproj | 1 + 8 files changed, 4 insertions(+) diff --git a/network/ndis/netvmini/6x/60/netvmini60.inf b/network/ndis/netvmini/6x/60/netvmini60.inf index 47cf37e5..63382e9b 100644 Binary files a/network/ndis/netvmini/6x/60/netvmini60.inf and b/network/ndis/netvmini/6x/60/netvmini60.inf differ diff --git a/network/ndis/netvmini/6x/60/netvmini60.vcxproj b/network/ndis/netvmini/6x/60/netvmini60.vcxproj index b1b647f8..b438c8de 100644 --- a/network/ndis/netvmini/6x/60/netvmini60.vcxproj +++ b/network/ndis/netvmini/6x/60/netvmini60.vcxproj @@ -121,6 +121,7 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\ndis.lib + true sha256 diff --git a/network/ndis/netvmini/6x/620/netvmini620.inf b/network/ndis/netvmini/6x/620/netvmini620.inf index f2b71c25..4dc1c9b6 100644 Binary files a/network/ndis/netvmini/6x/620/netvmini620.inf and b/network/ndis/netvmini/6x/620/netvmini620.inf differ diff --git a/network/ndis/netvmini/6x/620/netvmini620.vcxproj b/network/ndis/netvmini/6x/620/netvmini620.vcxproj index 74b53571..b068ad0b 100644 --- a/network/ndis/netvmini/6x/620/netvmini620.vcxproj +++ b/network/ndis/netvmini/6x/620/netvmini620.vcxproj @@ -121,6 +121,7 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\ndis.lib + true sha256 diff --git a/network/ndis/netvmini/6x/630/netvmini630.inf b/network/ndis/netvmini/6x/630/netvmini630.inf index 8029e8ab..eb7d61c8 100644 Binary files a/network/ndis/netvmini/6x/630/netvmini630.inf and b/network/ndis/netvmini/6x/630/netvmini630.inf differ diff --git a/network/ndis/netvmini/6x/630/netvmini630.vcxproj b/network/ndis/netvmini/6x/630/netvmini630.vcxproj index 6e9ae38c..e3c7f876 100644 --- a/network/ndis/netvmini/6x/630/netvmini630.vcxproj +++ b/network/ndis/netvmini/6x/630/netvmini630.vcxproj @@ -121,6 +121,7 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\ndis.lib + true sha256 diff --git a/network/ndis/netvmini/6x/680/netvmini680.inf b/network/ndis/netvmini/6x/680/netvmini680.inf index 87227149..4160c520 100644 Binary files a/network/ndis/netvmini/6x/680/netvmini680.inf and b/network/ndis/netvmini/6x/680/netvmini680.inf differ diff --git a/network/ndis/netvmini/6x/680/netvmini680.vcxproj b/network/ndis/netvmini/6x/680/netvmini680.vcxproj index 55497606..47da5562 100644 --- a/network/ndis/netvmini/6x/680/netvmini680.vcxproj +++ b/network/ndis/netvmini/6x/680/netvmini680.vcxproj @@ -121,6 +121,7 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\ndis.lib + true sha256 -- cgit v1.3.1 From 1904b79bdb26196d4dbf50110208b50950e06f4e Mon Sep 17 00:00:00 2001 From: kahashimoto-ms <117399367+kahashimoto-ms@users.noreply.github.com> Date: Fri, 24 Mar 2023 12:55:13 -0700 Subject: Mspassthroughext arch fix (#942) * Use Stampinf architecture * Enable the CET Shadow Stack mitigation * Change the encoding of inf to UTF-16LE --- .../samples/passthrough/mspassthroughext.inf | Bin 2732 -> 5218 bytes .../samples/passthrough/mspassthroughext.vcxproj | 1 + 2 files changed, 1 insertion(+) diff --git a/network/ndis/extension/samples/passthrough/mspassthroughext.inf b/network/ndis/extension/samples/passthrough/mspassthroughext.inf index 47236828..8339e7c8 100644 Binary files a/network/ndis/extension/samples/passthrough/mspassthroughext.inf and b/network/ndis/extension/samples/passthrough/mspassthroughext.inf differ diff --git a/network/ndis/extension/samples/passthrough/mspassthroughext.vcxproj b/network/ndis/extension/samples/passthrough/mspassthroughext.vcxproj index 791d2493..f688d064 100644 --- a/network/ndis/extension/samples/passthrough/mspassthroughext.vcxproj +++ b/network/ndis/extension/samples/passthrough/mspassthroughext.vcxproj @@ -82,6 +82,7 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\ndis.lib;.\..\..\base\$(IntDir)\sxbase.lib + true true -- cgit v1.3.1 From 55787da9a0b0ec1e20c29909041d53f178a815ef Mon Sep 17 00:00:00 2001 From: kahashimoto-ms <117399367+kahashimoto-ms@users.noreply.github.com> Date: Mon, 27 Mar 2023 09:21:38 -0700 Subject: User/kahashimoto ms/msforwardext inf violation (#941) * Add PnpLockdown=1 to the version section of the INF * Add segments to DriverVer in INF * Change DIRID from 12 to 13 * Enable the Control-flow Enforcement Technology (CET) Shadow Stack mitigation. * Use Stampinf architecture * Change the encoding of inf to UTF-16LE --- .../ndis/extension/samples/forward/msforwardext.inf | Bin 2533 -> 5048 bytes .../extension/samples/forward/msforwardext.vcxproj | 1 + 2 files changed, 1 insertion(+) diff --git a/network/ndis/extension/samples/forward/msforwardext.inf b/network/ndis/extension/samples/forward/msforwardext.inf index 2b9093a2..4af1b0fb 100644 Binary files a/network/ndis/extension/samples/forward/msforwardext.inf and b/network/ndis/extension/samples/forward/msforwardext.inf differ diff --git a/network/ndis/extension/samples/forward/msforwardext.vcxproj b/network/ndis/extension/samples/forward/msforwardext.vcxproj index f55e93b8..b2dfc516 100644 --- a/network/ndis/extension/samples/forward/msforwardext.vcxproj +++ b/network/ndis/extension/samples/forward/msforwardext.vcxproj @@ -82,6 +82,7 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\ndis.lib;.\..\..\base\$(IntDir)\sxbase.lib + true true -- cgit v1.3.1 From 3035684cf7b5a5dd2ab76e61a8165c0877b5e410 Mon Sep 17 00:00:00 2001 From: kahashimoto-ms <117399367+kahashimoto-ms@users.noreply.github.com> Date: Mon, 27 Mar 2023 09:32:00 -0700 Subject: Ndisprot60 inf violations (#943) * Add PnpLockdown=1 to the version section of the INF * Add segments to the DriverVer * Change Service name from Ndisprot to Ndisprot60 because Ndisprot is reserved * Edit INF to install used DIRID 13 above a certain release number * Add section Install_Update.Remove.Services * Change names Install->Install_NC and Install_Update->Install * Move things around so Install appears before Install_NC * enable the Control-flow Enforcement Technology (CET) Shadow Stack mitigation * Network driver INF that target DIRID 13 should only build 25319 or later * Update comment --- network/ndis/ndisprot/6x/ndisprot60.sln | 25 ++++++++++++--------- network/ndis/ndisprot/6x/sys/60/ndisprot60.inf | Bin 5612 -> 3475 bytes network/ndis/ndisprot/6x/sys/60/ndisprot60.vcxproj | 1 + 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/network/ndis/ndisprot/6x/ndisprot60.sln b/network/ndis/ndisprot/6x/ndisprot60.sln index 474b2ff0..4c2e55ed 100644 --- a/network/ndis/ndisprot/6x/ndisprot60.sln +++ b/network/ndis/ndisprot/6x/ndisprot60.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33213.308 MinimumVisualStudioVersion = 12.0 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "60", "60", "{09F8A71E-BD45-42F5-8CB5-82F137773350}" EndProject @@ -20,33 +20,33 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {F27914B8-F3D9-4164-BF33-42BBFA19AED4}.Debug|Win32.ActiveCfg = Debug|Win32 {F27914B8-F3D9-4164-BF33-42BBFA19AED4}.Debug|Win32.Build.0 = Debug|Win32 - {F27914B8-F3D9-4164-BF33-42BBFA19AED4}.Release|Win32.ActiveCfg = Release|Win32 - {F27914B8-F3D9-4164-BF33-42BBFA19AED4}.Release|Win32.Build.0 = Release|Win32 {F27914B8-F3D9-4164-BF33-42BBFA19AED4}.Debug|x64.ActiveCfg = Debug|x64 {F27914B8-F3D9-4164-BF33-42BBFA19AED4}.Debug|x64.Build.0 = Debug|x64 + {F27914B8-F3D9-4164-BF33-42BBFA19AED4}.Release|Win32.ActiveCfg = Release|Win32 + {F27914B8-F3D9-4164-BF33-42BBFA19AED4}.Release|Win32.Build.0 = Release|Win32 {F27914B8-F3D9-4164-BF33-42BBFA19AED4}.Release|x64.ActiveCfg = Release|x64 {F27914B8-F3D9-4164-BF33-42BBFA19AED4}.Release|x64.Build.0 = Release|x64 {C0748EAB-F425-488A-9F39-77D5DE2DD251}.Debug|Win32.ActiveCfg = Debug|Win32 {C0748EAB-F425-488A-9F39-77D5DE2DD251}.Debug|Win32.Build.0 = Debug|Win32 - {C0748EAB-F425-488A-9F39-77D5DE2DD251}.Release|Win32.ActiveCfg = Release|Win32 - {C0748EAB-F425-488A-9F39-77D5DE2DD251}.Release|Win32.Build.0 = Release|Win32 {C0748EAB-F425-488A-9F39-77D5DE2DD251}.Debug|x64.ActiveCfg = Debug|x64 {C0748EAB-F425-488A-9F39-77D5DE2DD251}.Debug|x64.Build.0 = Debug|x64 + {C0748EAB-F425-488A-9F39-77D5DE2DD251}.Release|Win32.ActiveCfg = Release|Win32 + {C0748EAB-F425-488A-9F39-77D5DE2DD251}.Release|Win32.Build.0 = Release|Win32 {C0748EAB-F425-488A-9F39-77D5DE2DD251}.Release|x64.ActiveCfg = Release|x64 {C0748EAB-F425-488A-9F39-77D5DE2DD251}.Release|x64.Build.0 = Release|x64 {34A953AA-28CB-472E-B438-1BE26FDF1D54}.Debug|Win32.ActiveCfg = Debug|Win32 {34A953AA-28CB-472E-B438-1BE26FDF1D54}.Debug|Win32.Build.0 = Debug|Win32 - {34A953AA-28CB-472E-B438-1BE26FDF1D54}.Release|Win32.ActiveCfg = Release|Win32 - {34A953AA-28CB-472E-B438-1BE26FDF1D54}.Release|Win32.Build.0 = Release|Win32 {34A953AA-28CB-472E-B438-1BE26FDF1D54}.Debug|x64.ActiveCfg = Debug|x64 {34A953AA-28CB-472E-B438-1BE26FDF1D54}.Debug|x64.Build.0 = Debug|x64 + {34A953AA-28CB-472E-B438-1BE26FDF1D54}.Release|Win32.ActiveCfg = Release|Win32 + {34A953AA-28CB-472E-B438-1BE26FDF1D54}.Release|Win32.Build.0 = Release|Win32 {34A953AA-28CB-472E-B438-1BE26FDF1D54}.Release|x64.ActiveCfg = Release|x64 {34A953AA-28CB-472E-B438-1BE26FDF1D54}.Release|x64.Build.0 = Release|x64 EndGlobalSection @@ -54,10 +54,13 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution + {09F8A71E-BD45-42F5-8CB5-82F137773350} = {40B41B7C-63E0-4BEC-9BF6-2AE9002E0670} + {7B0AA49C-0A8C-4EED-8ACE-1A80EC2E5AEB} = {20D7328F-9929-4D3A-BC1D-08E2442A929D} {F27914B8-F3D9-4164-BF33-42BBFA19AED4} = {09F8A71E-BD45-42F5-8CB5-82F137773350} {C0748EAB-F425-488A-9F39-77D5DE2DD251} = {7B0AA49C-0A8C-4EED-8ACE-1A80EC2E5AEB} {34A953AA-28CB-472E-B438-1BE26FDF1D54} = {20D7328F-9929-4D3A-BC1D-08E2442A929D} - {09F8A71E-BD45-42F5-8CB5-82F137773350} = {40B41B7C-63E0-4BEC-9BF6-2AE9002E0670} - {7B0AA49C-0A8C-4EED-8ACE-1A80EC2E5AEB} = {40B41B7C-63E0-4BEC-9BF6-2AE9002E0670} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2A8BDEF4-DEBC-4BDD-A1E5-F767E2EC8D5B} EndGlobalSection EndGlobal diff --git a/network/ndis/ndisprot/6x/sys/60/ndisprot60.inf b/network/ndis/ndisprot/6x/sys/60/ndisprot60.inf index 0c294311..7022c0e6 100644 Binary files a/network/ndis/ndisprot/6x/sys/60/ndisprot60.inf and b/network/ndis/ndisprot/6x/sys/60/ndisprot60.inf differ diff --git a/network/ndis/ndisprot/6x/sys/60/ndisprot60.vcxproj b/network/ndis/ndisprot/6x/sys/60/ndisprot60.vcxproj index df548983..738100d5 100644 --- a/network/ndis/ndisprot/6x/sys/60/ndisprot60.vcxproj +++ b/network/ndis/ndisprot/6x/sys/60/ndisprot60.vcxproj @@ -142,6 +142,7 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\ndis.lib;$(DDK_LIB_PATH)\wdmsec.lib + true %(AdditionalIncludeDirectories);.. -- cgit v1.3.1 From 730161a9834d4e6f47844383c0891f877444c8fd Mon Sep 17 00:00:00 2001 From: kahashimoto-ms <117399367+kahashimoto-ms@users.noreply.github.com> Date: Mon, 27 Mar 2023 09:47:20 -0700 Subject: User/kahashimoto ms/ndislwf dirid 13 fix (#945) * removed unused Common.Params.reg section * Change DIRID from 12 to 13 * add PnpLockdown = 1 to the version section of the inf * Edit inf so that it uses DIRID 13 for installation above certain release * add the x86 and ia64 archs that were previously removed for simplicity * add comment on why there is a different installation for newer build versions * Move sections so updated ones appear first * Change Install_Update->Install and Install->Install_NC * Enable CET Shadow Stack Compatible * remove white space * Use the stampinf ARCH variable to replace all the hard coded architectures * Network driver INF that use DIRID 13 should only target build 25319 or later * Update comment * delete some white space * Change encoding of inf to UTF-16LE --- network/ndis/filter/ndislwf.vcxproj | 1 + network/ndis/filter/netlwf.inf | Bin 8824 -> 19952 bytes 2 files changed, 1 insertion(+) diff --git a/network/ndis/filter/ndislwf.vcxproj b/network/ndis/filter/ndislwf.vcxproj index 8dfd9637..456ac131 100644 --- a/network/ndis/filter/ndislwf.vcxproj +++ b/network/ndis/filter/ndislwf.vcxproj @@ -206,6 +206,7 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\ndis.lib + true diff --git a/network/ndis/filter/netlwf.inf b/network/ndis/filter/netlwf.inf index ae728775..e59b56fb 100644 Binary files a/network/ndis/filter/netlwf.inf and b/network/ndis/filter/netlwf.inf differ -- cgit v1.3.1 From 901112d0fbcf4f000f14c8132ea2639f61d3c482 Mon Sep 17 00:00:00 2001 From: kahashimoto-ms <117399367+kahashimoto-ms@users.noreply.github.com> Date: Mon, 27 Mar 2023 11:34:47 -0700 Subject: Ndisprot630 inf violations (#944) * Add PnPLockdown=1 to the veresion section to the inf * Added segments to the DriverVer * Change Service name to Ndisprot630 * Edit INF to install used DIRID 13 above a certain release number * Change names Install->Install_NC and Install_Update->Install * Move things around so Install appears before Install_NC * enable the Control-flow Enforcement Technology (CET) Shadow Stack mitigation * Network driver INF that target DIRID 13 should only build 25319 or later * Update comment * Enable CET Shadow Stack compatiblility --- network/ndis/ndisprot/6x/sys/630/ndisprot630.inf | Bin 7576 -> 8974 bytes network/ndis/ndisprot/6x/sys/630/ndisprot630.vcxproj | 1 + 2 files changed, 1 insertion(+) diff --git a/network/ndis/ndisprot/6x/sys/630/ndisprot630.inf b/network/ndis/ndisprot/6x/sys/630/ndisprot630.inf index 849195f7..c5d7adb6 100644 Binary files a/network/ndis/ndisprot/6x/sys/630/ndisprot630.inf and b/network/ndis/ndisprot/6x/sys/630/ndisprot630.inf differ diff --git a/network/ndis/ndisprot/6x/sys/630/ndisprot630.vcxproj b/network/ndis/ndisprot/6x/sys/630/ndisprot630.vcxproj index b7b2dbda..67f57490 100644 --- a/network/ndis/ndisprot/6x/sys/630/ndisprot630.vcxproj +++ b/network/ndis/ndisprot/6x/sys/630/ndisprot630.vcxproj @@ -153,6 +153,7 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\ndis.lib;$(DDK_LIB_PATH)\wdmsec.lib + true sha256 -- cgit v1.3.1 From 16d01e32ecf371d2000d46fa3e6cec59ff66dc87 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 31 Mar 2023 13:05:48 -0700 Subject: Fix up malformed DriverVer directives (#948) Co-authored-by: Jason Knichel --- gpio/samples/simgpio_i2c/simgpio_i2c.inx | Bin 3786 -> 3782 bytes sd/miniport/sdhc/sdhc.inx | Bin 7860 -> 7864 bytes simbatt/func/simbatt.inx | Bin 3944 -> 3946 bytes thermal/simsensor/simsensor.inf | 2 +- thermal/thermalclient/simtc.inf | 2 +- 5 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gpio/samples/simgpio_i2c/simgpio_i2c.inx b/gpio/samples/simgpio_i2c/simgpio_i2c.inx index 7706cfbf..32ec1573 100644 Binary files a/gpio/samples/simgpio_i2c/simgpio_i2c.inx and b/gpio/samples/simgpio_i2c/simgpio_i2c.inx differ diff --git a/sd/miniport/sdhc/sdhc.inx b/sd/miniport/sdhc/sdhc.inx index 83bbe195..8ae9f303 100644 Binary files a/sd/miniport/sdhc/sdhc.inx and b/sd/miniport/sdhc/sdhc.inx differ diff --git a/simbatt/func/simbatt.inx b/simbatt/func/simbatt.inx index 02163c10..5aab816a 100644 Binary files a/simbatt/func/simbatt.inx and b/simbatt/func/simbatt.inx differ diff --git a/thermal/simsensor/simsensor.inf b/thermal/simsensor/simsensor.inf index 0f8fb7cd..e83aea31 100644 --- a/thermal/simsensor/simsensor.inf +++ b/thermal/simsensor/simsensor.inf @@ -17,7 +17,7 @@ Signature="$WINDOWS NT$" Class=System ClassGuid={4D36E97D-E325-11CE-BFC1-08002BE10318} Provider=%ProviderString% -DriverVer=09/02/2011, 6.02.8105 +DriverVer=09/02/2011, 6.2.8105.0 CatalogFile=simsensor.cat PnpLockdown=1 diff --git a/thermal/thermalclient/simtc.inf b/thermal/thermalclient/simtc.inf index 41d0d667..75c9c541 100644 --- a/thermal/thermalclient/simtc.inf +++ b/thermal/thermalclient/simtc.inf @@ -17,7 +17,7 @@ Signature="$WINDOWS NT$" Class=System ClassGuid={4D36E97D-E325-11CE-BFC1-08002BE10318} Provider=%ProviderString% -DriverVer=07/22/2011, 6.02.8040 +DriverVer=07/22/2011, 6.2.8040.0 CatalogFile=thermalclient.cat PnpLockdown=1 -- cgit v1.3.1 From 1adffc43251aa98f542c5134628f761a9ecfd119 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 31 Mar 2023 13:08:50 -0700 Subject: Add PnpLockdown=1 to remaining samples (#949) Co-authored-by: Jason Knichel --- network/ndis/mux/driver/60/mux_mp.inf | 11 ++++++----- network/ndis/mux/driver/60/muxp.inf | 5 +++-- network/ndis/ndisprot_kmdf/60/ndisprot.inx | Bin 9278 -> 9312 bytes .../trans/WFPSampler/sys/WFPSamplerCalloutDriver.InX | 1 + network/trans/msnmntr/sys/msnmntr.inf | 1 + .../wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf | 3 ++- network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf | 3 ++- .../wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf | 3 ++- wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx | 1 + 9 files changed, 18 insertions(+), 10 deletions(-) diff --git a/network/ndis/mux/driver/60/mux_mp.inf b/network/ndis/mux/driver/60/mux_mp.inf index 9c5f998c..601b77ac 100644 --- a/network/ndis/mux/driver/60/mux_mp.inf +++ b/network/ndis/mux/driver/60/mux_mp.inf @@ -5,11 +5,12 @@ ; Copyright (c) 1993-2004, Microsoft Corporation [Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} -Provider = %ProviderString% -DriverVer =10/01/2002,6.0.5019.0 +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} +Provider = %ProviderString% +DriverVer = 10/01/2002,6.0.5019.0 +PnpLockdown = 1 [ControlFlags] ExcludeFromSelect = MS_MUXMP diff --git a/network/ndis/mux/driver/60/muxp.inf b/network/ndis/mux/driver/60/muxp.inf index 836e60e1..d68c405b 100644 --- a/network/ndis/mux/driver/60/muxp.inf +++ b/network/ndis/mux/driver/60/muxp.inf @@ -9,7 +9,8 @@ Signature = "$Windows NT$" Class = NetTrans ClassGUID = {4D36E975-E325-11CE-BFC1-08002BE10318} Provider = %ProviderString% -DriverVer =10/01/2002,6.0.5019.0 +DriverVer = 10/01/2002,6.0.5019.0 +PnpLockdown = 1 [Manufacturer] %ManufacturerName% = Standard,NTx86,NTia64,NTamd64 @@ -32,7 +33,7 @@ DriverVer =10/01/2002,6.0.5019.0 AddReg = MUXP.ndi.AddReg Characteristics = 0x80 ; NCF_HAS_UI copyfiles = MUXP.CopyFiles.DLL, MUXP.CopyFiles.sys -CopyInf = mux_mp.inf +CopyInf = mux_mp.inf [SourceDisksNames] 1=%DiskDescription%,"",, diff --git a/network/ndis/ndisprot_kmdf/60/ndisprot.inx b/network/ndis/ndisprot_kmdf/60/ndisprot.inx index a25033cf..45305bb7 100644 Binary files a/network/ndis/ndisprot_kmdf/60/ndisprot.inx and b/network/ndis/ndisprot_kmdf/60/ndisprot.inx differ diff --git a/network/trans/WFPSampler/sys/WFPSamplerCalloutDriver.InX b/network/trans/WFPSampler/sys/WFPSamplerCalloutDriver.InX index b101c772..620f1e64 100644 --- a/network/trans/WFPSampler/sys/WFPSamplerCalloutDriver.InX +++ b/network/trans/WFPSampler/sys/WFPSamplerCalloutDriver.InX @@ -25,6 +25,7 @@ Provider = %ProviderString% CatalogFile = WFPSamplerCalloutDriver.Cat DriverVer = + PnpLockdown = 1 [SourceDisksNames.$ARCH$] 1 = %WFPSamplerCalloutDriverDiskId%,,,"" diff --git a/network/trans/msnmntr/sys/msnmntr.inf b/network/trans/msnmntr/sys/msnmntr.inf index 17ebcb7c..830c253e 100644 --- a/network/trans/msnmntr/sys/msnmntr.inf +++ b/network/trans/msnmntr/sys/msnmntr.inf @@ -12,6 +12,7 @@ Provider = %ProviderString% CatalogFile = MSNMntr.cat DriverVer = 11/24/2014,14.24.55.836 + PnpLockdown = 1 [SourceDisksNames] 1 = %MSNMntrDisk%,,,"" diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf index fdd046e4..1ecc052d 100644 --- a/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf +++ b/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf @@ -15,7 +15,8 @@ Class = Net ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} Provider = %Realtek% CatalogFile.NT = netrtwlans.cat ;; for WHQL certified -DriverVer = 11/23/2015,3008.22.1030.2015 +DriverVer = 11/23/2015,3008.22.1030.2015 +PnpLockdown = 1 [Manufacturer] %Realtek% = Realtek,NTArm.10.0 diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf index bfbbcc1a..cae95759 100644 --- a/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf +++ b/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf @@ -15,7 +15,8 @@ Class = Net ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} Provider = %Realtek% CatalogFile.NT = netrtwlans.cat ;; for WHQL certified -DriverVer = 10/30/2015,3008.22.1030.2015 +DriverVer = 10/30/2015,3008.22.1030.2015 +PnpLockdown = 1 [Manufacturer] %Realtek% = Realtek, NTx86, NTamd64, NTx86.6.0, NTamd64.6.0, NTx86.6.1, NTamd64.6.1, NTx86.6.2, NTamd64.6.2, NTx86.6.3, NTamd64.6.3, NTx86.10.0, NTamd64.10.0, NTArm.10.0 diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf index 0b40143e..c7b9e589 100644 --- a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf +++ b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf @@ -15,7 +15,8 @@ Class = Net ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} Provider = %Realtek% CatalogFile.NT = netrtwlans.cat ;; for WHQL certified -DriverVer = 11/23/2015,3008.22.1030.2015 +DriverVer = 11/23/2015,3008.22.1030.2015 +PnpLockdown = 1 [Manufacturer] %Realtek% = Realtek,NTx86.10.0 diff --git a/wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx b/wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx index f79d7810..99b24fbd 100644 --- a/wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx +++ b/wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx @@ -9,6 +9,7 @@ ClassGuid={EEC5AD98-8080-425f-922A-DABF3DE3F69A} Provider=%Provider% CatalogFile=WpdHelloWorldDriver.cat DriverVer=01/24/2005,1.1.1.1 +PnpLockdown=1 [Manufacturer] %Mfg%=Standard,NT$ARCH$ -- cgit v1.3.1 From 4ef6624c8ffb641539cdf9db485304ac28f53186 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 31 Mar 2023 14:52:29 -0700 Subject: Remove references to XP in INFs (#950) Co-authored-by: Jason Knichel --- general/pcidrv/kmdf/genpci.inx | Bin 6298 -> 6258 bytes .../wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf | 2 -- network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf | 4 +--- .../wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf | 2 -- .../wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf | 2 -- .../DV-FailDriver-WDM/driver/defect_toastmon.inf | 1 - 6 files changed, 1 insertion(+), 10 deletions(-) diff --git a/general/pcidrv/kmdf/genpci.inx b/general/pcidrv/kmdf/genpci.inx index a6d0d21c..f8581414 100644 Binary files a/general/pcidrv/kmdf/genpci.inx and b/general/pcidrv/kmdf/genpci.inx differ diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf index 1ecc052d..264d8142 100644 --- a/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf +++ b/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf @@ -7,8 +7,6 @@ ;; This release is primarily for WHQL test. ;; -;; FOR XP/Vista/Win7/Win8 - [Version] Signature = "$Windows NT$" Class = Net diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf index cae95759..a9f44b2e 100644 --- a/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf +++ b/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf @@ -7,8 +7,6 @@ ;; This release is primarily for WHQL test. ;; -;; FOR XP/Vista/Win7/Win8 - [Version] Signature = "$Windows NT$" Class = Net @@ -19,7 +17,7 @@ DriverVer = 10/30/2015,3008.22.1030.2015 PnpLockdown = 1 [Manufacturer] -%Realtek% = Realtek, NTx86, NTamd64, NTx86.6.0, NTamd64.6.0, NTx86.6.1, NTamd64.6.1, NTx86.6.2, NTamd64.6.2, NTx86.6.3, NTamd64.6.3, NTx86.10.0, NTamd64.10.0, NTArm.10.0 +%Realtek% = Realtek, NTx86, NTamd64, NTx86.6.0, NTamd64.6.0, NTx86.6.1, NTamd64.6.1, NTx86.6.2, NTamd64.6.2, NTx86.6.3, NTamd64.6.3, NTx86.10.0, NTamd64.10.0, NTArm.10.0 [ControlFlags] ExcludeFromSelect = * diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf index 3d90c006..4640bc85 100644 --- a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf +++ b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf @@ -7,8 +7,6 @@ ;; This release is primarily for WHQL test. ;; -;; FOR XP/Vista/Win7/Win8 - [Version] Signature = "$Windows NT$" Class = Net diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf index c7b9e589..72575fb9 100644 --- a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf +++ b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf @@ -7,8 +7,6 @@ ;; This release is primarily for WHQL test. ;; -;; FOR XP/Vista/Win7/Win8 - [Version] Signature = "$Windows NT$" Class = Net diff --git a/tools/dv/samples/DV-FailDriver-WDM/driver/defect_toastmon.inf b/tools/dv/samples/DV-FailDriver-WDM/driver/defect_toastmon.inf index 1ac1660a..6b7bde78 100644 --- a/tools/dv/samples/DV-FailDriver-WDM/driver/defect_toastmon.inf +++ b/tools/dv/samples/DV-FailDriver-WDM/driver/defect_toastmon.inf @@ -29,7 +29,6 @@ DefaultDestDir = 12 [Manufacturer] %ManufacturerString%=Sample_Manufacturer,NTx86, NTamd64, NTARM, NTARM64 -; For XP and later [Sample_Manufacturer.NTx86] %Defect_ToastMon.DRVDESC%=Defect_ToastMon_Inst,root\defect_toastmon -- cgit v1.3.1 From 706716afeecd7172a157164f8d360f1c3360739b Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 31 Mar 2023 15:58:34 -0700 Subject: Fix file encoding of various OSR FX2 DCHU samples (#951) Co-authored-by: Jason Knichel --- .../osrfx2_DCHU_component/osrfx2_DCHU_component.inx | Bin 1628 -> 3386 bytes .../osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx | Bin 1455 -> 3020 bytes .../osrfx2_DCHU_component/osrfx2_DCHU_component.inx | Bin 1628 -> 3386 bytes .../osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx | Bin 1416 -> 2942 bytes 4 files changed, 0 insertions(+), 0 deletions(-) diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx index cc9e43a9..045fc91f 100644 Binary files a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx and b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx differ diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx index d824d08b..a762b235 100644 Binary files a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx and b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx differ diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx index cc9e43a9..045fc91f 100644 Binary files a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx and b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx differ diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx index 28f1dd0b..7916c90b 100644 Binary files a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx and b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx differ -- cgit v1.3.1 From f5419dcf0b7dda34bda55b1c0b5e28fc5afdfd28 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 4 Apr 2023 11:51:49 -0700 Subject: Address violations in osrfx2_DCHU_extension.inx (#952) Co-authored-by: Jason Knichel --- .../osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx | Bin 2942 -> 2994 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx index 7916c90b..17670efa 100644 Binary files a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx and b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx differ -- cgit v1.3.1 From 204beeb16b7cef56d28b201750a67c59fcaff102 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 4 Apr 2023 11:53:35 -0700 Subject: Update filesystem filter INF file encoding to be UTF-16 LE (#953) Co-authored-by: Jason Knichel --- filesys/miniFilter/MetadataManager/fmm.inf | Bin 2422 -> 5040 bytes filesys/miniFilter/NameChanger/NameChanger.inf | Bin 2778 -> 5770 bytes filesys/miniFilter/avscan/avscan.inf | Bin 2796 -> 5808 bytes filesys/miniFilter/cancelSafe/cancelSafe.inf | Bin 2665 -> 5532 bytes filesys/miniFilter/cdo/cdo.inf | Bin 2441 -> 5078 bytes filesys/miniFilter/change/change.inf | Bin 2438 -> 5070 bytes filesys/miniFilter/ctx/ctx.inf | Bin 2404 -> 5004 bytes filesys/miniFilter/delete/delete.inf | Bin 2480 -> 5156 bytes filesys/miniFilter/minispy/minispy.inf | Bin 3231 -> 6688 bytes filesys/miniFilter/nullFilter/nullFilter.inf | Bin 2410 -> 5014 bytes filesys/miniFilter/passThrough/passThrough.inf | Bin 2512 -> 5220 bytes filesys/miniFilter/scanner/scanner.inf | Bin 2675 -> 5562 bytes filesys/miniFilter/simrep/simrep.inf | Bin 3099 -> 6422 bytes filesys/miniFilter/swapBuffers/swapBuffers.inf | Bin 2491 -> 5176 bytes 14 files changed, 0 insertions(+), 0 deletions(-) diff --git a/filesys/miniFilter/MetadataManager/fmm.inf b/filesys/miniFilter/MetadataManager/fmm.inf index f1feb1e4..caf4bc8f 100644 Binary files a/filesys/miniFilter/MetadataManager/fmm.inf and b/filesys/miniFilter/MetadataManager/fmm.inf differ diff --git a/filesys/miniFilter/NameChanger/NameChanger.inf b/filesys/miniFilter/NameChanger/NameChanger.inf index 94e455e8..36b99019 100644 Binary files a/filesys/miniFilter/NameChanger/NameChanger.inf and b/filesys/miniFilter/NameChanger/NameChanger.inf differ diff --git a/filesys/miniFilter/avscan/avscan.inf b/filesys/miniFilter/avscan/avscan.inf index f88c0436..26fb6c22 100644 Binary files a/filesys/miniFilter/avscan/avscan.inf and b/filesys/miniFilter/avscan/avscan.inf differ diff --git a/filesys/miniFilter/cancelSafe/cancelSafe.inf b/filesys/miniFilter/cancelSafe/cancelSafe.inf index 810d3a98..d526b3dc 100644 Binary files a/filesys/miniFilter/cancelSafe/cancelSafe.inf and b/filesys/miniFilter/cancelSafe/cancelSafe.inf differ diff --git a/filesys/miniFilter/cdo/cdo.inf b/filesys/miniFilter/cdo/cdo.inf index 078f31a2..c51cae2c 100644 Binary files a/filesys/miniFilter/cdo/cdo.inf and b/filesys/miniFilter/cdo/cdo.inf differ diff --git a/filesys/miniFilter/change/change.inf b/filesys/miniFilter/change/change.inf index 4dbdc827..86a7b868 100644 Binary files a/filesys/miniFilter/change/change.inf and b/filesys/miniFilter/change/change.inf differ diff --git a/filesys/miniFilter/ctx/ctx.inf b/filesys/miniFilter/ctx/ctx.inf index 6b0dd10e..39e935af 100644 Binary files a/filesys/miniFilter/ctx/ctx.inf and b/filesys/miniFilter/ctx/ctx.inf differ diff --git a/filesys/miniFilter/delete/delete.inf b/filesys/miniFilter/delete/delete.inf index b372f736..b9a572fe 100644 Binary files a/filesys/miniFilter/delete/delete.inf and b/filesys/miniFilter/delete/delete.inf differ diff --git a/filesys/miniFilter/minispy/minispy.inf b/filesys/miniFilter/minispy/minispy.inf index 069bc83a..c210097c 100644 Binary files a/filesys/miniFilter/minispy/minispy.inf and b/filesys/miniFilter/minispy/minispy.inf differ diff --git a/filesys/miniFilter/nullFilter/nullFilter.inf b/filesys/miniFilter/nullFilter/nullFilter.inf index bc0669b0..0e710e2d 100644 Binary files a/filesys/miniFilter/nullFilter/nullFilter.inf and b/filesys/miniFilter/nullFilter/nullFilter.inf differ diff --git a/filesys/miniFilter/passThrough/passThrough.inf b/filesys/miniFilter/passThrough/passThrough.inf index 134d0a47..6db4d0d0 100644 Binary files a/filesys/miniFilter/passThrough/passThrough.inf and b/filesys/miniFilter/passThrough/passThrough.inf differ diff --git a/filesys/miniFilter/scanner/scanner.inf b/filesys/miniFilter/scanner/scanner.inf index 37147d71..762f5eec 100644 Binary files a/filesys/miniFilter/scanner/scanner.inf and b/filesys/miniFilter/scanner/scanner.inf differ diff --git a/filesys/miniFilter/simrep/simrep.inf b/filesys/miniFilter/simrep/simrep.inf index a98890b0..93632e33 100644 Binary files a/filesys/miniFilter/simrep/simrep.inf and b/filesys/miniFilter/simrep/simrep.inf differ diff --git a/filesys/miniFilter/swapBuffers/swapBuffers.inf b/filesys/miniFilter/swapBuffers/swapBuffers.inf index 9f4c9d1d..ad88200e 100644 Binary files a/filesys/miniFilter/swapBuffers/swapBuffers.inf and b/filesys/miniFilter/swapBuffers/swapBuffers.inf differ -- cgit v1.3.1 From db0f176538ecfdff9eb53e7f62b88a3134ef8d07 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 4 Apr 2023 17:13:03 -0700 Subject: Update all network sample INFs to use UTF-16 LE file encoding (#957) Co-authored-by: Jason Knichel --- network/ndis/mux/driver/60/mux_mp.inf | Bin 1942 -> 4028 bytes network/ndis/mux/driver/60/muxp.inf | Bin 2421 -> 5044 bytes network/ndis/ndisprot/6x/sys/60/ndisprot60.inf | Bin 3475 -> 7168 bytes .../WFPSampler/sys/WFPSamplerCalloutDriver.InX | Bin 4268 -> 8726 bytes network/trans/ddproxy/sys/ddproxy.inf | Bin 2277 -> 4682 bytes network/trans/inspect/sys/inspect.inf | Bin 2355 -> 4842 bytes network/trans/msnmntr/sys/msnmntr.inf | Bin 1772 -> 3654 bytes network/trans/stmedit/sys/stmedit.inf | Bin 2362 -> 4864 bytes .../WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf | Bin 42036 -> 86590 bytes .../wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf | Bin 91914 -> 189248 bytes .../WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf | Bin 36123 -> 74380 bytes .../WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf | Bin 42036 -> 86590 bytes network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf | Bin 4013 -> 8266 bytes 13 files changed, 0 insertions(+), 0 deletions(-) diff --git a/network/ndis/mux/driver/60/mux_mp.inf b/network/ndis/mux/driver/60/mux_mp.inf index 601b77ac..a8694916 100644 Binary files a/network/ndis/mux/driver/60/mux_mp.inf and b/network/ndis/mux/driver/60/mux_mp.inf differ diff --git a/network/ndis/mux/driver/60/muxp.inf b/network/ndis/mux/driver/60/muxp.inf index d68c405b..637b2252 100644 Binary files a/network/ndis/mux/driver/60/muxp.inf and b/network/ndis/mux/driver/60/muxp.inf differ diff --git a/network/ndis/ndisprot/6x/sys/60/ndisprot60.inf b/network/ndis/ndisprot/6x/sys/60/ndisprot60.inf index 7022c0e6..bae3936c 100644 Binary files a/network/ndis/ndisprot/6x/sys/60/ndisprot60.inf and b/network/ndis/ndisprot/6x/sys/60/ndisprot60.inf differ diff --git a/network/trans/WFPSampler/sys/WFPSamplerCalloutDriver.InX b/network/trans/WFPSampler/sys/WFPSamplerCalloutDriver.InX index 620f1e64..fdd4f950 100644 Binary files a/network/trans/WFPSampler/sys/WFPSamplerCalloutDriver.InX and b/network/trans/WFPSampler/sys/WFPSamplerCalloutDriver.InX differ diff --git a/network/trans/ddproxy/sys/ddproxy.inf b/network/trans/ddproxy/sys/ddproxy.inf index 3792b003..44c5d13e 100644 Binary files a/network/trans/ddproxy/sys/ddproxy.inf and b/network/trans/ddproxy/sys/ddproxy.inf differ diff --git a/network/trans/inspect/sys/inspect.inf b/network/trans/inspect/sys/inspect.inf index 9fb9674e..644c4eee 100644 Binary files a/network/trans/inspect/sys/inspect.inf and b/network/trans/inspect/sys/inspect.inf differ diff --git a/network/trans/msnmntr/sys/msnmntr.inf b/network/trans/msnmntr/sys/msnmntr.inf index 830c253e..79fa3be0 100644 Binary files a/network/trans/msnmntr/sys/msnmntr.inf and b/network/trans/msnmntr/sys/msnmntr.inf differ diff --git a/network/trans/stmedit/sys/stmedit.inf b/network/trans/stmedit/sys/stmedit.inf index 39cd2109..04734b1a 100644 Binary files a/network/trans/stmedit/sys/stmedit.inf and b/network/trans/stmedit/sys/stmedit.inf differ diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf index 264d8142..7de18adb 100644 Binary files a/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf and b/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf differ diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf index a9f44b2e..71d52227 100644 Binary files a/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf and b/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf differ diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf index 4640bc85..e7753ef3 100644 Binary files a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf and b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x64/netrtwlans.inf differ diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf index 72575fb9..00079d29 100644 Binary files a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf and b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf differ diff --git a/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf b/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf index 496e5c6a..48f893c6 100644 Binary files a/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf and b/network/wwan/cxwmbclass/cxwmbclass/cxwmbclass.inf differ -- cgit v1.3.1 From 6643bc05259035e78d5a3be1b28d2130cdeefe06 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 4 Apr 2023 17:56:26 -0700 Subject: Update file encoding to UTF-16 LE for printer sample INFs (#958) Co-authored-by: Jason Knichel --- .../C++/PTPCPlPr/install/ptpcplpr.inf | Bin 2195 -> 4590 bytes .../C++/bitmap.inf | Bin 2311 -> 4860 bytes .../C++/gdl/res/gdlsmpl.inf | Bin 1716 -> 3622 bytes .../C++/oemdll.inf | Bin 5064 -> 10570 bytes .../C++/oemprean.inf | Bin 2411 -> 5058 bytes .../C++/uisamples.inf | Bin 2775 -> 5820 bytes .../C++/uniuirep/res/uniuirep.inf | Bin 1760 -> 3710 bytes .../C++/winxp.inf | Bin 3373 -> 7046 bytes print/XPSDrvSmpl/install/xdsmpl.inf | Bin 3381 -> 7036 bytes print/XpsRasFilter/install/xpsrassmpl.inf | Bin 2132 -> 4440 bytes print/autoconfig/AutoCnfg.inf | Bin 2951 -> 6140 bytes .../usb_host_based_sample.inf | Bin 2788 -> 5802 bytes 12 files changed, 0 insertions(+), 0 deletions(-) diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf index 0f615192..067896bd 100644 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf and b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf b/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf index 3a13228c..5d01b260 100644 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf and b/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf b/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf index 7c65f562..8794fa8e 100644 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf and b/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf b/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf index d70c1568..5f49b577 100644 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf and b/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf b/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf index 6885d73a..e2905f70 100644 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf and b/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf b/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf index aed12762..6c07b2c7 100644 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf and b/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf index 46ce3677..2dba999f 100644 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf and b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/winxp.inf b/print/OEM Printer Customization Plug-in Samples/C++/winxp.inf index 1692dbd5..cf0ab050 100644 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/winxp.inf and b/print/OEM Printer Customization Plug-in Samples/C++/winxp.inf differ diff --git a/print/XPSDrvSmpl/install/xdsmpl.inf b/print/XPSDrvSmpl/install/xdsmpl.inf index 37a0b569..e696a264 100644 Binary files a/print/XPSDrvSmpl/install/xdsmpl.inf and b/print/XPSDrvSmpl/install/xdsmpl.inf differ diff --git a/print/XpsRasFilter/install/xpsrassmpl.inf b/print/XpsRasFilter/install/xpsrassmpl.inf index fbfdcf94..d080e428 100644 Binary files a/print/XpsRasFilter/install/xpsrassmpl.inf and b/print/XpsRasFilter/install/xpsrassmpl.inf differ diff --git a/print/autoconfig/AutoCnfg.inf b/print/autoconfig/AutoCnfg.inf index 2a64ab8d..8e0f0859 100644 Binary files a/print/autoconfig/AutoCnfg.inf and b/print/autoconfig/AutoCnfg.inf differ diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.inf b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.inf index 7c237031..ae7f6e05 100644 Binary files a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.inf and b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.inf differ -- cgit v1.3.1 From 2013b48616d87a7ef6334cb6c424b959cf020ff7 Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 5 Apr 2023 13:28:34 -0700 Subject: Update file encoding to be UTF-16 LE for misc INFs (#959) Co-authored-by: Jason Knichel --- .../Toaster Driver/toaster/toaster.inx | Bin 548 -> 1148 bytes general/toaster/toastpkg/inf/toastpkg.inf | Bin 2590 -> 5378 bytes .../SampleMagneticStripeReaderDrv.inf | Bin 1731 -> 3604 bytes .../barcodescanner/SampleBarcodeScannerDrv.inf | Bin 1667 -> 3476 bytes storage/class/disk/src/diskdev.inf | Bin 1838 -> 3892 bytes thermal/simsensor/simsensor.inf | Bin 3066 -> 6348 bytes thermal/thermalclient/simtc.inf | Bin 2204 -> 4586 bytes .../DV-FailDriver-WDM/driver/defect_toastmon.inf | Bin 2058 -> 4284 bytes .../UcmUcsiAcpiSample/UcmUcsiAcpiSample.inf | Bin 1563 -> 3250 bytes wpd/WpdBasicHardwareDriver/WpdBasicHardwareDriver.inx | Bin 1898 -> 3962 bytes wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx | Bin 1980 -> 4130 bytes .../WpdMultiTransportDriver.inx | Bin 2075 -> 4322 bytes wpd/WpdServiceSampleDriver/WpdServiceSampleDriver.inx | Bin 1911 -> 3986 bytes 13 files changed, 0 insertions(+), 0 deletions(-) diff --git a/general/WinHEC 2017 Lab/Toaster Driver/toaster/toaster.inx b/general/WinHEC 2017 Lab/Toaster Driver/toaster/toaster.inx index 91a1d73c..2fff1924 100644 Binary files a/general/WinHEC 2017 Lab/Toaster Driver/toaster/toaster.inx and b/general/WinHEC 2017 Lab/Toaster Driver/toaster/toaster.inx differ diff --git a/general/toaster/toastpkg/inf/toastpkg.inf b/general/toaster/toastpkg/inf/toastpkg.inf index 772fbc03..d1e3fbff 100644 Binary files a/general/toaster/toastpkg/inf/toastpkg.inf and b/general/toaster/toastpkg/inf/toastpkg.inf differ diff --git a/pos/drivers/MagneticStripeReader/SampleMagneticStripeReaderDrv.inf b/pos/drivers/MagneticStripeReader/SampleMagneticStripeReaderDrv.inf index 44dead0a..4257d513 100644 Binary files a/pos/drivers/MagneticStripeReader/SampleMagneticStripeReaderDrv.inf and b/pos/drivers/MagneticStripeReader/SampleMagneticStripeReaderDrv.inf differ diff --git a/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.inf b/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.inf index db0c975f..41c18afb 100644 Binary files a/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.inf and b/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.inf differ diff --git a/storage/class/disk/src/diskdev.inf b/storage/class/disk/src/diskdev.inf index 70e8fad1..96948f38 100644 Binary files a/storage/class/disk/src/diskdev.inf and b/storage/class/disk/src/diskdev.inf differ diff --git a/thermal/simsensor/simsensor.inf b/thermal/simsensor/simsensor.inf index e83aea31..9775caa5 100644 Binary files a/thermal/simsensor/simsensor.inf and b/thermal/simsensor/simsensor.inf differ diff --git a/thermal/thermalclient/simtc.inf b/thermal/thermalclient/simtc.inf index 75c9c541..102a010e 100644 Binary files a/thermal/thermalclient/simtc.inf and b/thermal/thermalclient/simtc.inf differ diff --git a/tools/dv/samples/DV-FailDriver-WDM/driver/defect_toastmon.inf b/tools/dv/samples/DV-FailDriver-WDM/driver/defect_toastmon.inf index 6b7bde78..4af8f55b 100644 Binary files a/tools/dv/samples/DV-FailDriver-WDM/driver/defect_toastmon.inf and b/tools/dv/samples/DV-FailDriver-WDM/driver/defect_toastmon.inf differ diff --git a/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.inf b/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.inf index 39b3c16a..c52e7865 100644 Binary files a/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.inf and b/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.inf differ diff --git a/wpd/WpdBasicHardwareDriver/WpdBasicHardwareDriver.inx b/wpd/WpdBasicHardwareDriver/WpdBasicHardwareDriver.inx index 4f11ac23..53feb155 100644 Binary files a/wpd/WpdBasicHardwareDriver/WpdBasicHardwareDriver.inx and b/wpd/WpdBasicHardwareDriver/WpdBasicHardwareDriver.inx differ diff --git a/wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx b/wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx index 99b24fbd..fe1a0b4b 100644 Binary files a/wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx and b/wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx differ diff --git a/wpd/WpdMultiTransportDriver/WpdMultiTransportDriver.inx b/wpd/WpdMultiTransportDriver/WpdMultiTransportDriver.inx index b8504e04..3cd7d91b 100644 Binary files a/wpd/WpdMultiTransportDriver/WpdMultiTransportDriver.inx and b/wpd/WpdMultiTransportDriver/WpdMultiTransportDriver.inx differ diff --git a/wpd/WpdServiceSampleDriver/WpdServiceSampleDriver.inx b/wpd/WpdServiceSampleDriver/WpdServiceSampleDriver.inx index cbf328ca..5802867f 100644 Binary files a/wpd/WpdServiceSampleDriver/WpdServiceSampleDriver.inx and b/wpd/WpdServiceSampleDriver/WpdServiceSampleDriver.inx differ -- cgit v1.3.1 From 06e54613afa8995f9761ccf66b3c88bc6f434ae2 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 6 Apr 2023 13:29:06 -0700 Subject: Update osrfx2_DCHU_base.inx to Include/Needs wudfrd.inf (#960) Co-authored-by: Jason Knichel --- .../osrfx2_DCHU_base/osrfx2_DCHU_base.inx | Bin 8542 -> 7898 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx index 49b51884..39bd5468 100644 Binary files a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx and b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx differ -- cgit v1.3.1 From 5603733767a8387e9e1e8f5ecfb9f2f9cb18539e Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 6 Apr 2023 18:01:25 -0700 Subject: Update bthecho sample projects to use a driver target platform of 'Windows Driver' (#961) Co-authored-by: Jason Knichel --- bluetooth/bthecho/bthcli/app/BthEcho.vcxproj | 8 ++++---- bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.vcxproj | 8 ++++---- bluetooth/bthecho/bthsrv/inst/bthsrvinst.vcxproj | 8 ++++---- bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.vcxproj | 8 ++++---- bluetooth/bthecho/common/lib/bthecho.vcxproj | 8 ++++---- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/bluetooth/bthecho/bthcli/app/BthEcho.vcxproj b/bluetooth/bthecho/bthcli/app/BthEcho.vcxproj index 382f447b..2d15392b 100644 --- a/bluetooth/bthecho/bthcli/app/BthEcho.vcxproj +++ b/bluetooth/bthecho/bthcli/app/BthEcho.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.vcxproj b/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.vcxproj index a2a6aec8..389e659e 100644 --- a/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.vcxproj +++ b/bluetooth/bthecho/bthcli/sys/BthEchoSampleCli.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/bluetooth/bthecho/bthsrv/inst/bthsrvinst.vcxproj b/bluetooth/bthecho/bthsrv/inst/bthsrvinst.vcxproj index c5f3d960..035024e8 100644 --- a/bluetooth/bthecho/bthsrv/inst/bthsrvinst.vcxproj +++ b/bluetooth/bthecho/bthsrv/inst/bthsrvinst.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.vcxproj b/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.vcxproj index c8db174a..6c186f8e 100644 --- a/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.vcxproj +++ b/bluetooth/bthecho/bthsrv/sys/BthEchoSampleSrv.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/bluetooth/bthecho/common/lib/bthecho.vcxproj b/bluetooth/bthecho/common/lib/bthecho.vcxproj index 247ba48a..329d8f30 100644 --- a/bluetooth/bthecho/common/lib/bthecho.vcxproj +++ b/bluetooth/bthecho/common/lib/bthecho.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary -- cgit v1.3.1 From 03dbb616869946fd74cd73efb6ff684da9f60213 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 6 Apr 2023 18:49:00 -0700 Subject: Update some filesys projects' DriverTargetPlatform to be 'Windows Driver' (#962) Co-authored-by: Jason Knichel --- filesys/cdfs/cdfs.vcxproj | 8 ++++---- filesys/fastfat/fastfat.vcxproj | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/filesys/cdfs/cdfs.vcxproj b/filesys/cdfs/cdfs.vcxproj index 5e053a30..9a32ad6c 100644 --- a/filesys/cdfs/cdfs.vcxproj +++ b/filesys/cdfs/cdfs.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/filesys/fastfat/fastfat.vcxproj b/filesys/fastfat/fastfat.vcxproj index 09c805a2..8ad4848e 100644 --- a/filesys/fastfat/fastfat.vcxproj +++ b/filesys/fastfat/fastfat.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver -- cgit v1.3.1 From 9f509fd5ff9a2ca6481d5b2caca96bfdca1b7fbc Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 7 Apr 2023 08:50:33 -0700 Subject: Update toaster projects' DriverTargetPlatform to be 'Windows Driver' (#963) Co-authored-by: Jason Knichel --- general/toaster/toastDrv/exe/enum/Enum.vcxproj | 8 ++++---- general/toaster/toastDrv/exe/notify/notify.vcxproj | 8 ++++---- general/toaster/toastDrv/exe/toast/toast.vcxproj | 8 ++++---- general/toaster/toastDrv/exe/wmi/WmiToast.vcxproj | 8 ++++---- general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.vcxproj | 8 ++++---- general/toaster/toastDrv/kmdf/bus/static/StatBus.vcxproj | 8 ++++---- general/toaster/toastDrv/kmdf/filter/generic/filter.vcxproj | 8 ++++---- general/toaster/toastDrv/kmdf/filter/sideband/filter.vcxproj | 8 ++++---- general/toaster/toastDrv/kmdf/func/featured/wdffeatured.vcxproj | 8 ++++---- general/toaster/toastDrv/kmdf/func/simple/wdfsimple.vcxproj | 8 ++++---- general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.vcxproj | 8 ++++---- general/toaster/toastpkg/toastapp/toastapp.vcxproj | 8 ++++---- general/toaster/umdf2/exe/enum/Enum.vcxproj | 8 ++++---- general/toaster/umdf2/filter/generic/filterum.vcxproj | 8 ++++---- general/toaster/umdf2/func/featured/wdffeaturedum.vcxproj | 8 ++++---- general/toaster/umdf2/func/simple/wdfsimpleum.vcxproj | 8 ++++---- 16 files changed, 64 insertions(+), 64 deletions(-) diff --git a/general/toaster/toastDrv/exe/enum/Enum.vcxproj b/general/toaster/toastDrv/exe/enum/Enum.vcxproj index 3638bd18..3b8bcbb6 100644 --- a/general/toaster/toastDrv/exe/enum/Enum.vcxproj +++ b/general/toaster/toastDrv/exe/enum/Enum.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/toaster/toastDrv/exe/notify/notify.vcxproj b/general/toaster/toastDrv/exe/notify/notify.vcxproj index 38bb67b7..6a4c3d43 100644 --- a/general/toaster/toastDrv/exe/notify/notify.vcxproj +++ b/general/toaster/toastDrv/exe/notify/notify.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/toaster/toastDrv/exe/toast/toast.vcxproj b/general/toaster/toastDrv/exe/toast/toast.vcxproj index a8787a63..8c0739a0 100644 --- a/general/toaster/toastDrv/exe/toast/toast.vcxproj +++ b/general/toaster/toastDrv/exe/toast/toast.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/toaster/toastDrv/exe/wmi/WmiToast.vcxproj b/general/toaster/toastDrv/exe/wmi/WmiToast.vcxproj index 9be78de1..d740026b 100644 --- a/general/toaster/toastDrv/exe/wmi/WmiToast.vcxproj +++ b/general/toaster/toastDrv/exe/wmi/WmiToast.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.vcxproj b/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.vcxproj index d71efb10..deddc2c7 100644 --- a/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.vcxproj +++ b/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.vcxproj @@ -32,7 +32,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -40,7 +40,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -56,7 +56,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/toaster/toastDrv/kmdf/bus/static/StatBus.vcxproj b/general/toaster/toastDrv/kmdf/bus/static/StatBus.vcxproj index 3894601b..089dc141 100644 --- a/general/toaster/toastDrv/kmdf/bus/static/StatBus.vcxproj +++ b/general/toaster/toastDrv/kmdf/bus/static/StatBus.vcxproj @@ -32,7 +32,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -40,7 +40,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -56,7 +56,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/toaster/toastDrv/kmdf/filter/generic/filter.vcxproj b/general/toaster/toastDrv/kmdf/filter/generic/filter.vcxproj index fbfe0c69..4a949834 100644 --- a/general/toaster/toastDrv/kmdf/filter/generic/filter.vcxproj +++ b/general/toaster/toastDrv/kmdf/filter/generic/filter.vcxproj @@ -32,7 +32,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -40,7 +40,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -56,7 +56,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/toaster/toastDrv/kmdf/filter/sideband/filter.vcxproj b/general/toaster/toastDrv/kmdf/filter/sideband/filter.vcxproj index b9dbcbf1..0bcd8cc1 100644 --- a/general/toaster/toastDrv/kmdf/filter/sideband/filter.vcxproj +++ b/general/toaster/toastDrv/kmdf/filter/sideband/filter.vcxproj @@ -32,7 +32,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -40,7 +40,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -56,7 +56,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.vcxproj b/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.vcxproj index 7c876472..20b24f1b 100644 --- a/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.vcxproj +++ b/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.vcxproj @@ -32,7 +32,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -40,7 +40,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -56,7 +56,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.vcxproj b/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.vcxproj index 11188669..757978dd 100644 --- a/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.vcxproj +++ b/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.vcxproj @@ -32,7 +32,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -40,7 +40,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -56,7 +56,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.vcxproj b/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.vcxproj index 3d1468bc..f32bcee1 100644 --- a/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.vcxproj +++ b/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.vcxproj @@ -32,7 +32,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -40,7 +40,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -56,7 +56,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/toaster/toastpkg/toastapp/toastapp.vcxproj b/general/toaster/toastpkg/toastapp/toastapp.vcxproj index 99f5d3ed..86840c1c 100644 --- a/general/toaster/toastpkg/toastapp/toastapp.vcxproj +++ b/general/toaster/toastpkg/toastapp/toastapp.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/toaster/umdf2/exe/enum/Enum.vcxproj b/general/toaster/umdf2/exe/enum/Enum.vcxproj index 3638bd18..3b8bcbb6 100644 --- a/general/toaster/umdf2/exe/enum/Enum.vcxproj +++ b/general/toaster/umdf2/exe/enum/Enum.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/toaster/umdf2/filter/generic/filterum.vcxproj b/general/toaster/umdf2/filter/generic/filterum.vcxproj index e292101c..bd2da646 100644 --- a/general/toaster/umdf2/filter/generic/filterum.vcxproj +++ b/general/toaster/umdf2/filter/generic/filterum.vcxproj @@ -32,7 +32,7 @@ Windows10 False - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -40,7 +40,7 @@ Windows10 True - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -56,7 +56,7 @@ Windows10 True - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary diff --git a/general/toaster/umdf2/func/featured/wdffeaturedum.vcxproj b/general/toaster/umdf2/func/featured/wdffeaturedum.vcxproj index def844d2..9bd4dfb7 100644 --- a/general/toaster/umdf2/func/featured/wdffeaturedum.vcxproj +++ b/general/toaster/umdf2/func/featured/wdffeaturedum.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary diff --git a/general/toaster/umdf2/func/simple/wdfsimpleum.vcxproj b/general/toaster/umdf2/func/simple/wdfsimpleum.vcxproj index d12c5713..05353419 100644 --- a/general/toaster/umdf2/func/simple/wdfsimpleum.vcxproj +++ b/general/toaster/umdf2/func/simple/wdfsimpleum.vcxproj @@ -32,7 +32,7 @@ Windows10 False - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -40,7 +40,7 @@ Windows10 True - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -56,7 +56,7 @@ Windows10 True - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary -- cgit v1.3.1 From 3f5fc4bf0990abb5619377c9162d999f981c497f Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 7 Apr 2023 11:54:55 -0700 Subject: Update some biometric projects' DriverTargetPlatform to be 'Windows Driver' (#964) Co-authored-by: Jason Knichel --- biometrics/adapters/engine_adapter/EngineAdapter.vcxproj | 8 ++++---- biometrics/adapters/sensor_adapter/SensorAdapter.vcxproj | 8 ++++---- biometrics/adapters/storage_adapter/StorageAdapter.vcxproj | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/biometrics/adapters/engine_adapter/EngineAdapter.vcxproj b/biometrics/adapters/engine_adapter/EngineAdapter.vcxproj index aa87c108..4c462ac4 100644 --- a/biometrics/adapters/engine_adapter/EngineAdapter.vcxproj +++ b/biometrics/adapters/engine_adapter/EngineAdapter.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -39,7 +39,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -47,7 +47,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -55,7 +55,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/biometrics/adapters/sensor_adapter/SensorAdapter.vcxproj b/biometrics/adapters/sensor_adapter/SensorAdapter.vcxproj index 008320a3..166f8076 100644 --- a/biometrics/adapters/sensor_adapter/SensorAdapter.vcxproj +++ b/biometrics/adapters/sensor_adapter/SensorAdapter.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -39,7 +39,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -47,7 +47,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -55,7 +55,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/biometrics/adapters/storage_adapter/StorageAdapter.vcxproj b/biometrics/adapters/storage_adapter/StorageAdapter.vcxproj index d9b4caf0..217ba760 100644 --- a/biometrics/adapters/storage_adapter/StorageAdapter.vcxproj +++ b/biometrics/adapters/storage_adapter/StorageAdapter.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -39,7 +39,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -47,7 +47,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -55,7 +55,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary -- cgit v1.3.1 From 14a15b163172854c0314ef47f0dd3388f290120c Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 7 Apr 2023 11:55:51 -0700 Subject: Update HID projects' DriverTargetPlatform to be 'Windows Driver' (#965) Co-authored-by: Jason Knichel --- hid/firefly/app/flicker.vcxproj | 8 ++++---- hid/firefly/driver/firefly.vcxproj | 8 ++++---- hid/firefly/lib/Luminous.vcxproj | 8 ++++---- hid/firefly/sauron/SAURON.vcxproj | 8 ++++---- hid/hidusbfx2/hidkmdf/hidkmdf.vcxproj | 8 ++++---- hid/hidusbfx2/sys/hidusbfx2.vcxproj | 8 ++++---- hid/vhidmini2/app/testvhid.vcxproj | 8 ++++---- hid/vhidmini2/driver/kmdf/vhidmini.vcxproj | 8 ++++---- hid/vhidmini2/driver/umdf2/VhidminiUm.vcxproj | 8 ++++---- 9 files changed, 36 insertions(+), 36 deletions(-) diff --git a/hid/firefly/app/flicker.vcxproj b/hid/firefly/app/flicker.vcxproj index eabedfbb..4fad0493 100644 --- a/hid/firefly/app/flicker.vcxproj +++ b/hid/firefly/app/flicker.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/hid/firefly/driver/firefly.vcxproj b/hid/firefly/driver/firefly.vcxproj index a86c03a8..1530c39d 100644 --- a/hid/firefly/driver/firefly.vcxproj +++ b/hid/firefly/driver/firefly.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/hid/firefly/lib/Luminous.vcxproj b/hid/firefly/lib/Luminous.vcxproj index 83515b31..e879b7fc 100644 --- a/hid/firefly/lib/Luminous.vcxproj +++ b/hid/firefly/lib/Luminous.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 StaticLibrary @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 StaticLibrary @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 StaticLibrary @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 StaticLibrary diff --git a/hid/firefly/sauron/SAURON.vcxproj b/hid/firefly/sauron/SAURON.vcxproj index 4fc980dd..ae077a7d 100644 --- a/hid/firefly/sauron/SAURON.vcxproj +++ b/hid/firefly/sauron/SAURON.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/hid/hidusbfx2/hidkmdf/hidkmdf.vcxproj b/hid/hidusbfx2/hidkmdf/hidkmdf.vcxproj index e2c14745..e1352f60 100644 --- a/hid/hidusbfx2/hidkmdf/hidkmdf.vcxproj +++ b/hid/hidusbfx2/hidkmdf/hidkmdf.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -39,7 +39,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -47,7 +47,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -55,7 +55,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/hid/hidusbfx2/sys/hidusbfx2.vcxproj b/hid/hidusbfx2/sys/hidusbfx2.vcxproj index 72916d1e..8df137b8 100644 --- a/hid/hidusbfx2/sys/hidusbfx2.vcxproj +++ b/hid/hidusbfx2/sys/hidusbfx2.vcxproj @@ -32,7 +32,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -40,7 +40,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -56,7 +56,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/hid/vhidmini2/app/testvhid.vcxproj b/hid/vhidmini2/app/testvhid.vcxproj index e728b88c..f87a1a07 100644 --- a/hid/vhidmini2/app/testvhid.vcxproj +++ b/hid/vhidmini2/app/testvhid.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/hid/vhidmini2/driver/kmdf/vhidmini.vcxproj b/hid/vhidmini2/driver/kmdf/vhidmini.vcxproj index 7e818e1c..d1f5ba70 100644 --- a/hid/vhidmini2/driver/kmdf/vhidmini.vcxproj +++ b/hid/vhidmini2/driver/kmdf/vhidmini.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/hid/vhidmini2/driver/umdf2/VhidminiUm.vcxproj b/hid/vhidmini2/driver/umdf2/VhidminiUm.vcxproj index a7607db8..0bc198e8 100644 --- a/hid/vhidmini2/driver/umdf2/VhidminiUm.vcxproj +++ b/hid/vhidmini2/driver/umdf2/VhidminiUm.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary -- cgit v1.3.1 From f3711c572641c9f5005dcb44c4bbfda6d40a3281 Mon Sep 17 00:00:00 2001 From: Gerrit Swaneveld <55601905+gerritsMSFT@users.noreply.github.com> Date: Fri, 7 Apr 2023 13:48:00 -0700 Subject: [avstream/avscamera] Update Device.cpp (#956) Add Paged Code Macro --- avstream/avscamera/sys/Device.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/avstream/avscamera/sys/Device.cpp b/avstream/avscamera/sys/Device.cpp index 2741da08..38d4f555 100644 --- a/avstream/avscamera/sys/Device.cpp +++ b/avstream/avscamera/sys/Device.cpp @@ -110,6 +110,7 @@ IrpSynchronousCompletion( IN PVOID pKevent ) { + PAGED_CODE(); if (Irp->PendingReturned) { NT_ASSERT(pKevent); -- cgit v1.3.1 From e553f426293dc4a244ab6315617456e3c5149f00 Mon Sep 17 00:00:00 2001 From: Gerrit Swaneveld <55601905+gerritsMSFT@users.noreply.github.com> Date: Fri, 7 Apr 2023 13:48:18 -0700 Subject: [avstream/avscamera] Update Capture.cpp (#955) Add Paged Code Macro --- avstream/avscamera/sys/Capture.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/avstream/avscamera/sys/Capture.cpp b/avstream/avscamera/sys/Capture.cpp index 25e6a5f8..730370e6 100644 --- a/avstream/avscamera/sys/Capture.cpp +++ b/avstream/avscamera/sys/Capture.cpp @@ -2294,6 +2294,7 @@ SetFramingSizes( PKSALLOCATOR_FRAMING_EX Framing ) { + PAGED_CODE(); Framing->FramingItem[0].PhysicalRange.MinFrameSize = m_VideoInfoHeader->bmiHeader.biSizeImage; Framing->FramingItem[0].PhysicalRange.MaxFrameSize = m_VideoInfoHeader->bmiHeader.biSizeImage; Framing->FramingItem[0].FramingRange.Range.MinFrameSize = m_VideoInfoHeader->bmiHeader.biSizeImage; -- cgit v1.3.1 From 5440e4c498a8d4fb08ad105c384ac96cb8c3eeb8 Mon Sep 17 00:00:00 2001 From: Gerrit Swaneveld <55601905+gerritsMSFT@users.noreply.github.com> Date: Fri, 7 Apr 2023 13:48:32 -0700 Subject: [avstream/avscamera] Update hwsim.cpp (#954) Add Paged Code Macros --- avstream/avscamera/sys/hwsim.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/avstream/avscamera/sys/hwsim.cpp b/avstream/avscamera/sys/hwsim.cpp index fdf7b367..80a4adcf 100644 --- a/avstream/avscamera/sys/hwsim.cpp +++ b/avstream/avscamera/sys/hwsim.cpp @@ -796,6 +796,7 @@ bool CHardwareSimulation:: CheckForAvailableBuffer() { + PAGED_CODE(); return true; } @@ -803,6 +804,7 @@ NTSTATUS CHardwareSimulation:: CommitImageData(PSCATTER_GATHER_ENTRY sGEntry, ULONG stride) { + PAGED_CODE(); // Have the synthesizer output a frame to the buffer. ULONG CommitBufferSize = sGEntry->ByteCount; PUCHAR CommitBufferAddress = sGEntry->Virtual; @@ -818,6 +820,7 @@ NTSTATUS CHardwareSimulation:: ValidateBuffer(PSCATTER_GATHER_ENTRY sGEntry) { + PAGED_CODE(); return STATUS_SUCCESS; } -- cgit v1.3.1 From feab60e77a91e3f1daff3b9bd1b0c0057a0c9ca9 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 7 Apr 2023 17:02:07 -0700 Subject: Update input projects' DriverTargetPlatform to be 'Windows Drivers' (#966) Co-authored-by: Jason Knichel --- input/kbfiltr/sys/kbfiltr.vcxproj | 8 ++++---- input/layout/all_kbds/kbdfr/kbdfr.vcxproj | 8 ++++---- input/layout/all_kbds/kbdgr/kbdgr.vcxproj | 8 ++++---- input/layout/fe_kbds/jpn/101/kbd101.vcxproj | 8 ++++---- input/layout/fe_kbds/jpn/106/kbd106.vcxproj | 8 ++++---- input/layout/kbdus/kbdus.vcxproj | 8 ++++---- input/moufiltr/moufiltr.vcxproj | 8 ++++---- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/input/kbfiltr/sys/kbfiltr.vcxproj b/input/kbfiltr/sys/kbfiltr.vcxproj index f26a765d..ad4d5a32 100644 --- a/input/kbfiltr/sys/kbfiltr.vcxproj +++ b/input/kbfiltr/sys/kbfiltr.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/input/layout/all_kbds/kbdfr/kbdfr.vcxproj b/input/layout/all_kbds/kbdfr/kbdfr.vcxproj index d4252520..08adb730 100644 --- a/input/layout/all_kbds/kbdfr/kbdfr.vcxproj +++ b/input/layout/all_kbds/kbdfr/kbdfr.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/input/layout/all_kbds/kbdgr/kbdgr.vcxproj b/input/layout/all_kbds/kbdgr/kbdgr.vcxproj index c59a9625..c2e9fb82 100644 --- a/input/layout/all_kbds/kbdgr/kbdgr.vcxproj +++ b/input/layout/all_kbds/kbdgr/kbdgr.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/input/layout/fe_kbds/jpn/101/kbd101.vcxproj b/input/layout/fe_kbds/jpn/101/kbd101.vcxproj index 0c56f44c..40bfd37e 100644 --- a/input/layout/fe_kbds/jpn/101/kbd101.vcxproj +++ b/input/layout/fe_kbds/jpn/101/kbd101.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/input/layout/fe_kbds/jpn/106/kbd106.vcxproj b/input/layout/fe_kbds/jpn/106/kbd106.vcxproj index 0d14c18d..70a9e8ad 100644 --- a/input/layout/fe_kbds/jpn/106/kbd106.vcxproj +++ b/input/layout/fe_kbds/jpn/106/kbd106.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/input/layout/kbdus/kbdus.vcxproj b/input/layout/kbdus/kbdus.vcxproj index 7e14a70b..2c1fa83a 100644 --- a/input/layout/kbdus/kbdus.vcxproj +++ b/input/layout/kbdus/kbdus.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/input/moufiltr/moufiltr.vcxproj b/input/moufiltr/moufiltr.vcxproj index bc0ea8fd..eae59cdb 100644 --- a/input/moufiltr/moufiltr.vcxproj +++ b/input/moufiltr/moufiltr.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver -- cgit v1.3.1 From fe08b65f2b7cb6490476181d82dfb21c5ea36c8a Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 7 Apr 2023 17:03:07 -0700 Subject: Update pofx projects' DriverTargetPlatform to be 'Windows Driver' (#967) Co-authored-by: Jason Knichel --- pofx/PEP/common/pepcommon.vcxproj | 8 ++++---- pofx/UMDF2/App/PowerFxApp.vcxproj | 8 ++++---- pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.vcxproj | 8 ++++---- pofx/WDF/App/PowerFxApp.vcxproj | 8 ++++---- pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.vcxproj | 8 ++++---- pofx/WDF/Driver/MultiComp/lib/WdfPoFx.vcxproj | 8 ++++---- pofx/WDF/Driver/SingleComp/SingleComponentFStateDriver.vcxproj | 8 ++++---- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/pofx/PEP/common/pepcommon.vcxproj b/pofx/PEP/common/pepcommon.vcxproj index b3e90eea..d17289da 100644 --- a/pofx/PEP/common/pepcommon.vcxproj +++ b/pofx/PEP/common/pepcommon.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -38,7 +38,7 @@ Windows10 True - Desktop + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -46,7 +46,7 @@ Windows10 False - Desktop + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -54,7 +54,7 @@ Windows10 True - Desktop + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary diff --git a/pofx/UMDF2/App/PowerFxApp.vcxproj b/pofx/UMDF2/App/PowerFxApp.vcxproj index 2a0233b3..54e81f3e 100644 --- a/pofx/UMDF2/App/PowerFxApp.vcxproj +++ b/pofx/UMDF2/App/PowerFxApp.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.vcxproj b/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.vcxproj index a148bb1b..f7c2fbe3 100644 --- a/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.vcxproj +++ b/pofx/UMDF2/Driver/SingleComp/SingleComponentSingleStateUm.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary diff --git a/pofx/WDF/App/PowerFxApp.vcxproj b/pofx/WDF/App/PowerFxApp.vcxproj index 2f099791..89952032 100644 --- a/pofx/WDF/App/PowerFxApp.vcxproj +++ b/pofx/WDF/App/PowerFxApp.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.vcxproj b/pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.vcxproj index ac397edc..fa74c793 100644 --- a/pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.vcxproj +++ b/pofx/WDF/Driver/MultiComp/driver/WdfMultiComp.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/pofx/WDF/Driver/MultiComp/lib/WdfPoFx.vcxproj b/pofx/WDF/Driver/MultiComp/lib/WdfPoFx.vcxproj index eeac3859..6248d1b3 100644 --- a/pofx/WDF/Driver/MultiComp/lib/WdfPoFx.vcxproj +++ b/pofx/WDF/Driver/MultiComp/lib/WdfPoFx.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Desktop + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -38,7 +38,7 @@ Windows10 True - Desktop + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -46,7 +46,7 @@ Windows10 False - Desktop + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary @@ -54,7 +54,7 @@ Windows10 True - Desktop + Windows Driver KMDF WindowsKernelModeDriver10.0 StaticLibrary diff --git a/pofx/WDF/Driver/SingleComp/SingleComponentFStateDriver.vcxproj b/pofx/WDF/Driver/SingleComp/SingleComponentFStateDriver.vcxproj index caf40e5d..3fa11719 100644 --- a/pofx/WDF/Driver/SingleComp/SingleComponentFStateDriver.vcxproj +++ b/pofx/WDF/Driver/SingleComp/SingleComponentFStateDriver.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver -- cgit v1.3.1 From 19bdef5ff2fb0046d58db16da551b1a0f1394ba1 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 10 Apr 2023 08:34:23 -0700 Subject: Update USB projects' DriverTargetPlatform to be 'Windows Driver' (#968) Update usb projects' DriverTargetPlatform to be 'Windows Driver' Co-authored-by: Jason Knichel --- usb/UcmCxUcsi/UcmCxUcsi.vcxproj | 2 +- .../UcmTcpciCxClientSample.vcxproj | 16 ++++++++-------- .../UcmUcsiAcpiSample/UcmUcsiAcpiSample.vcxproj | 8 ++++---- usb/kmdf_enumswitches/sys/kmdf_enumswitches.vcxproj | 8 ++++---- usb/kmdf_fx2/driver/osrusbfx2.vcxproj | 8 ++++---- usb/kmdf_fx2/exe/osrusbfx2.vcxproj | 8 ++++---- usb/ufxclientsample/ufxclientsample.vcxproj | 8 ++++---- usb/umdf2_fx2/exe/osrusbfx2.vcxproj | 8 ++++---- usb/usbsamp/exe/usbsamp.vcxproj | 8 ++++---- usb/usbsamp/sys/driver/usbsamp.vcxproj | 8 ++++---- usb/wdf_osrfx2_lab/kmdf/exe/osrusbfx2.vcxproj | 8 ++++---- usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.vcxproj | 8 ++++---- usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.vcxproj | 8 ++++---- usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.vcxproj | 8 ++++---- usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.vcxproj | 8 ++++---- usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.vcxproj | 8 ++++---- 16 files changed, 65 insertions(+), 65 deletions(-) diff --git a/usb/UcmCxUcsi/UcmCxUcsi.vcxproj b/usb/UcmCxUcsi/UcmCxUcsi.vcxproj index c7371dd5..66355942 100644 --- a/usb/UcmCxUcsi/UcmCxUcsi.vcxproj +++ b/usb/UcmCxUcsi/UcmCxUcsi.vcxproj @@ -50,7 +50,7 @@ WindowsKernelModeDriver10.0 Driver KMDF - Universal + Windows Driver true 1 0 diff --git a/usb/UcmTcpciCxClientSample/UcmTcpciCxClientSample.vcxproj b/usb/UcmTcpciCxClientSample/UcmTcpciCxClientSample.vcxproj index d7722879..f6433899 100644 --- a/usb/UcmTcpciCxClientSample/UcmTcpciCxClientSample.vcxproj +++ b/usb/UcmTcpciCxClientSample/UcmTcpciCxClientSample.vcxproj @@ -74,7 +74,7 @@ WindowsKernelModeDriver10.0 Driver KMDF - Universal + Windows Driver Windows10 @@ -82,7 +82,7 @@ WindowsKernelModeDriver10.0 Driver KMDF - Universal + Windows Driver Windows10 @@ -90,7 +90,7 @@ WindowsKernelModeDriver10.0 Driver KMDF - Universal + Windows Driver Windows10 @@ -98,7 +98,7 @@ WindowsKernelModeDriver10.0 Driver KMDF - Universal + Windows Driver Windows10 @@ -106,7 +106,7 @@ WindowsKernelModeDriver10.0 Driver KMDF - Universal + Windows Driver Windows10 @@ -114,7 +114,7 @@ WindowsKernelModeDriver10.0 Driver KMDF - Universal + Windows Driver Windows10 @@ -122,7 +122,7 @@ WindowsKernelModeDriver10.0 Driver KMDF - Universal + Windows Driver Windows10 @@ -130,7 +130,7 @@ WindowsKernelModeDriver10.0 Driver KMDF - Universal + Windows Driver diff --git a/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.vcxproj b/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.vcxproj index d08edaa3..136932e7 100644 --- a/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.vcxproj +++ b/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.vcxproj @@ -34,7 +34,7 @@ WindowsKernelModeDriver10.0 Driver KMDF - Universal + Windows Driver Windows10 @@ -42,7 +42,7 @@ WindowsKernelModeDriver10.0 Driver KMDF - Universal + Windows Driver Windows10 @@ -50,7 +50,7 @@ WindowsKernelModeDriver10.0 Driver KMDF - Universal + Windows Driver Windows10 @@ -58,7 +58,7 @@ WindowsKernelModeDriver10.0 Driver KMDF - Universal + Windows Driver diff --git a/usb/kmdf_enumswitches/sys/kmdf_enumswitches.vcxproj b/usb/kmdf_enumswitches/sys/kmdf_enumswitches.vcxproj index 883f548c..9f2c505c 100644 --- a/usb/kmdf_enumswitches/sys/kmdf_enumswitches.vcxproj +++ b/usb/kmdf_enumswitches/sys/kmdf_enumswitches.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/usb/kmdf_fx2/driver/osrusbfx2.vcxproj b/usb/kmdf_fx2/driver/osrusbfx2.vcxproj index 49ec0221..de6d2627 100644 --- a/usb/kmdf_fx2/driver/osrusbfx2.vcxproj +++ b/usb/kmdf_fx2/driver/osrusbfx2.vcxproj @@ -32,7 +32,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -40,7 +40,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -48,7 +48,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -56,7 +56,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/usb/kmdf_fx2/exe/osrusbfx2.vcxproj b/usb/kmdf_fx2/exe/osrusbfx2.vcxproj index 379f780d..dfcc81e1 100644 --- a/usb/kmdf_fx2/exe/osrusbfx2.vcxproj +++ b/usb/kmdf_fx2/exe/osrusbfx2.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/usb/ufxclientsample/ufxclientsample.vcxproj b/usb/ufxclientsample/ufxclientsample.vcxproj index 4d2164ba..47191de8 100644 --- a/usb/ufxclientsample/ufxclientsample.vcxproj +++ b/usb/ufxclientsample/ufxclientsample.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/usb/umdf2_fx2/exe/osrusbfx2.vcxproj b/usb/umdf2_fx2/exe/osrusbfx2.vcxproj index 379f780d..dfcc81e1 100644 --- a/usb/umdf2_fx2/exe/osrusbfx2.vcxproj +++ b/usb/umdf2_fx2/exe/osrusbfx2.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/usb/usbsamp/exe/usbsamp.vcxproj b/usb/usbsamp/exe/usbsamp.vcxproj index 20fe67ba..8e9de3b1 100644 --- a/usb/usbsamp/exe/usbsamp.vcxproj +++ b/usb/usbsamp/exe/usbsamp.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/usb/usbsamp/sys/driver/usbsamp.vcxproj b/usb/usbsamp/sys/driver/usbsamp.vcxproj index a4ab4576..528d765b 100644 --- a/usb/usbsamp/sys/driver/usbsamp.vcxproj +++ b/usb/usbsamp/sys/driver/usbsamp.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/usb/wdf_osrfx2_lab/kmdf/exe/osrusbfx2.vcxproj b/usb/wdf_osrfx2_lab/kmdf/exe/osrusbfx2.vcxproj index 379f780d..dfcc81e1 100644 --- a/usb/wdf_osrfx2_lab/kmdf/exe/osrusbfx2.vcxproj +++ b/usb/wdf_osrfx2_lab/kmdf/exe/osrusbfx2.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.vcxproj b/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.vcxproj index 24e5f83e..673d4bdc 100644 --- a/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.vcxproj +++ b/usb/wdf_osrfx2_lab/kmdf/step1/osrusbfx2.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.vcxproj b/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.vcxproj index d0fcebe4..bd29a7db 100644 --- a/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.vcxproj +++ b/usb/wdf_osrfx2_lab/kmdf/step2/osrusbfx2.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.vcxproj b/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.vcxproj index 7bfade55..869d9caf 100644 --- a/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.vcxproj +++ b/usb/wdf_osrfx2_lab/kmdf/step3/osrusbfx2.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.vcxproj b/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.vcxproj index a6527eaa..fbe15747 100644 --- a/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.vcxproj +++ b/usb/wdf_osrfx2_lab/kmdf/step4/osrusbfx2.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.vcxproj b/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.vcxproj index 98cde2a1..e4206603 100644 --- a/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.vcxproj +++ b/usb/wdf_osrfx2_lab/kmdf/step5/osrusbfx2.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver -- cgit v1.3.1 From 189640fc699918e02d79554704906c690895f53a Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 10 Apr 2023 13:01:14 -0700 Subject: Update various general projects to use DriverTargetPlatform of 'Windows Driver' (#969) Co-authored-by: Jason Knichel --- general/PLX9x5x/sys/Pci9x5x.vcxproj | 8 ++++---- general/SystemDma/wdm/exe/SystemDmaApp.vcxproj | 8 ++++---- general/SystemDma/wdm/sys/SDma.vcxproj | 8 ++++---- general/cancel/exe/canclapp.vcxproj | 8 ++++---- general/cancel/startio/cancel.vcxproj | 8 ++++---- general/cancel/sys/cancel.vcxproj | 8 ++++---- general/echo/kmdf/driver/AutoSync/echo.vcxproj | 8 ++++---- general/echo/kmdf/driver/DriverSync/echo_2.vcxproj | 8 ++++---- general/echo/kmdf/exe/echoapp.vcxproj | 8 ++++---- general/echo/umdf2/exe/echoapp.vcxproj | 8 ++++---- general/event/exe/event.vcxproj | 8 ++++---- general/event/wdm/event.vcxproj | 8 ++++---- general/ioctl/kmdf/exe/nonpnpapp.vcxproj | 8 ++++---- general/ioctl/kmdf/sys/nonpnp.vcxproj | 8 ++++---- general/ioctl/wdm/exe/ioctlapp.vcxproj | 8 ++++---- general/ioctl/wdm/sys/sioctl.vcxproj | 8 ++++---- general/obcallback/control/ObCallbackTestCtrl.vcxproj | 8 ++++---- general/obcallback/driver/ObCallbackTest.vcxproj | 8 ++++---- general/pcidrv/kmdf/HW/PCIDRV.vcxproj | 8 ++++---- general/perfcounters/kcs/kcs.vcxproj | 8 ++++---- general/registry/regfltr/exe/regctrl.vcxproj | 8 ++++---- general/registry/regfltr/sys/regfltr.vcxproj | 8 ++++---- general/tracing/evntdrv/Eventdrv/Eventdrv.vcxproj | 8 ++++---- general/tracing/evntdrv/evntctrl/evntctrl.vcxproj | 8 ++++---- general/tracing/tracedriver/tracectl/tracectl.vcxproj | 8 ++++---- general/tracing/tracedriver/tracedrv/tracedrv.vcxproj | 8 ++++---- 26 files changed, 104 insertions(+), 104 deletions(-) diff --git a/general/PLX9x5x/sys/Pci9x5x.vcxproj b/general/PLX9x5x/sys/Pci9x5x.vcxproj index 1c3cb7e1..d319a284 100644 --- a/general/PLX9x5x/sys/Pci9x5x.vcxproj +++ b/general/PLX9x5x/sys/Pci9x5x.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -39,7 +39,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -47,7 +47,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -55,7 +55,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/SystemDma/wdm/exe/SystemDmaApp.vcxproj b/general/SystemDma/wdm/exe/SystemDmaApp.vcxproj index 636d5d5f..eaf152f4 100644 --- a/general/SystemDma/wdm/exe/SystemDmaApp.vcxproj +++ b/general/SystemDma/wdm/exe/SystemDmaApp.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/SystemDma/wdm/sys/SDma.vcxproj b/general/SystemDma/wdm/sys/SDma.vcxproj index 799c158b..57c4d115 100644 --- a/general/SystemDma/wdm/sys/SDma.vcxproj +++ b/general/SystemDma/wdm/sys/SDma.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/cancel/exe/canclapp.vcxproj b/general/cancel/exe/canclapp.vcxproj index d6943213..e1c06591 100644 --- a/general/cancel/exe/canclapp.vcxproj +++ b/general/cancel/exe/canclapp.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/cancel/startio/cancel.vcxproj b/general/cancel/startio/cancel.vcxproj index 7d6687ec..80f03006 100644 --- a/general/cancel/startio/cancel.vcxproj +++ b/general/cancel/startio/cancel.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/cancel/sys/cancel.vcxproj b/general/cancel/sys/cancel.vcxproj index 8478a962..e10bd582 100644 --- a/general/cancel/sys/cancel.vcxproj +++ b/general/cancel/sys/cancel.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/echo/kmdf/driver/AutoSync/echo.vcxproj b/general/echo/kmdf/driver/AutoSync/echo.vcxproj index 0dc8b18e..09263c87 100644 --- a/general/echo/kmdf/driver/AutoSync/echo.vcxproj +++ b/general/echo/kmdf/driver/AutoSync/echo.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/echo/kmdf/driver/DriverSync/echo_2.vcxproj b/general/echo/kmdf/driver/DriverSync/echo_2.vcxproj index 7640e6c4..b5da58a8 100644 --- a/general/echo/kmdf/driver/DriverSync/echo_2.vcxproj +++ b/general/echo/kmdf/driver/DriverSync/echo_2.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/echo/kmdf/exe/echoapp.vcxproj b/general/echo/kmdf/exe/echoapp.vcxproj index 8fb2f51f..bdbd9cc5 100644 --- a/general/echo/kmdf/exe/echoapp.vcxproj +++ b/general/echo/kmdf/exe/echoapp.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/echo/umdf2/exe/echoapp.vcxproj b/general/echo/umdf2/exe/echoapp.vcxproj index 8fb2f51f..bdbd9cc5 100644 --- a/general/echo/umdf2/exe/echoapp.vcxproj +++ b/general/echo/umdf2/exe/echoapp.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/event/exe/event.vcxproj b/general/event/exe/event.vcxproj index 430000f4..03a276be 100644 --- a/general/event/exe/event.vcxproj +++ b/general/event/exe/event.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/event/wdm/event.vcxproj b/general/event/wdm/event.vcxproj index f47abce7..cf701e3c 100644 --- a/general/event/wdm/event.vcxproj +++ b/general/event/wdm/event.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/ioctl/kmdf/exe/nonpnpapp.vcxproj b/general/ioctl/kmdf/exe/nonpnpapp.vcxproj index aff8e836..0fd29fb5 100644 --- a/general/ioctl/kmdf/exe/nonpnpapp.vcxproj +++ b/general/ioctl/kmdf/exe/nonpnpapp.vcxproj @@ -31,7 +31,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -39,7 +39,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -47,7 +47,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -55,7 +55,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/ioctl/kmdf/sys/nonpnp.vcxproj b/general/ioctl/kmdf/sys/nonpnp.vcxproj index c1b3ec29..6050a825 100644 --- a/general/ioctl/kmdf/sys/nonpnp.vcxproj +++ b/general/ioctl/kmdf/sys/nonpnp.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/ioctl/wdm/exe/ioctlapp.vcxproj b/general/ioctl/wdm/exe/ioctlapp.vcxproj index 226320d9..582af4ca 100644 --- a/general/ioctl/wdm/exe/ioctlapp.vcxproj +++ b/general/ioctl/wdm/exe/ioctlapp.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/ioctl/wdm/sys/sioctl.vcxproj b/general/ioctl/wdm/sys/sioctl.vcxproj index 663855c2..8781185f 100644 --- a/general/ioctl/wdm/sys/sioctl.vcxproj +++ b/general/ioctl/wdm/sys/sioctl.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/obcallback/control/ObCallbackTestCtrl.vcxproj b/general/obcallback/control/ObCallbackTestCtrl.vcxproj index 0f407b4f..80b7eba8 100644 --- a/general/obcallback/control/ObCallbackTestCtrl.vcxproj +++ b/general/obcallback/control/ObCallbackTestCtrl.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/obcallback/driver/ObCallbackTest.vcxproj b/general/obcallback/driver/ObCallbackTest.vcxproj index 9898a7da..28b3f60e 100644 --- a/general/obcallback/driver/ObCallbackTest.vcxproj +++ b/general/obcallback/driver/ObCallbackTest.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/pcidrv/kmdf/HW/PCIDRV.vcxproj b/general/pcidrv/kmdf/HW/PCIDRV.vcxproj index f3cb00ce..11a432bb 100644 --- a/general/pcidrv/kmdf/HW/PCIDRV.vcxproj +++ b/general/pcidrv/kmdf/HW/PCIDRV.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/general/perfcounters/kcs/kcs.vcxproj b/general/perfcounters/kcs/kcs.vcxproj index 1852b871..ae15fb1c 100644 --- a/general/perfcounters/kcs/kcs.vcxproj +++ b/general/perfcounters/kcs/kcs.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/registry/regfltr/exe/regctrl.vcxproj b/general/registry/regfltr/exe/regctrl.vcxproj index 35c4e051..61ba2e53 100644 --- a/general/registry/regfltr/exe/regctrl.vcxproj +++ b/general/registry/regfltr/exe/regctrl.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/registry/regfltr/sys/regfltr.vcxproj b/general/registry/regfltr/sys/regfltr.vcxproj index 84ca9581..1c08f595 100644 --- a/general/registry/regfltr/sys/regfltr.vcxproj +++ b/general/registry/regfltr/sys/regfltr.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/tracing/evntdrv/Eventdrv/Eventdrv.vcxproj b/general/tracing/evntdrv/Eventdrv/Eventdrv.vcxproj index 74127e2d..ad45a08e 100644 --- a/general/tracing/evntdrv/Eventdrv/Eventdrv.vcxproj +++ b/general/tracing/evntdrv/Eventdrv/Eventdrv.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/general/tracing/evntdrv/evntctrl/evntctrl.vcxproj b/general/tracing/evntdrv/evntctrl/evntctrl.vcxproj index 83d793ef..4a21b1aa 100644 --- a/general/tracing/evntdrv/evntctrl/evntctrl.vcxproj +++ b/general/tracing/evntdrv/evntctrl/evntctrl.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/tracing/tracedriver/tracectl/tracectl.vcxproj b/general/tracing/tracedriver/tracectl/tracectl.vcxproj index fb27137f..50f62668 100644 --- a/general/tracing/tracedriver/tracectl/tracectl.vcxproj +++ b/general/tracing/tracedriver/tracectl/tracectl.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/general/tracing/tracedriver/tracedrv/tracedrv.vcxproj b/general/tracing/tracedriver/tracedrv/tracedrv.vcxproj index b731b60b..121e210c 100644 --- a/general/tracing/tracedriver/tracedrv/tracedrv.vcxproj +++ b/general/tracing/tracedriver/tracedrv/tracedrv.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver -- cgit v1.3.1 From b440de9ba4181725a68ddcd3cc4ba8c778b88ad7 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 10 Apr 2023 15:17:43 -0700 Subject: Update various network projects to use DriverTargetPlatform of 'Windows Driver' (#971) Co-authored-by: Jason Knichel --- network/ndis/extension/base/sxbase.vcxproj | 4 ++-- network/ndis/extension/samples/forward/msforwardext.vcxproj | 4 ++-- .../ndis/extension/samples/passthrough/mspassthroughext.vcxproj | 4 ++-- network/ndis/ndisprot/6x/test/prottest.vcxproj | 8 ++++---- network/ndis/netvmini/6x/60/netvmini60.vcxproj | 8 ++++---- network/ndis/netvmini/6x/620/netvmini620.vcxproj | 8 ++++---- network/ndis/netvmini/6x/630/netvmini630.vcxproj | 8 ++++---- network/ndis/netvmini/6x/680/netvmini680.vcxproj | 8 ++++---- network/radio/RadioManagerSample/cpp/SampleRM.vcxproj | 8 ++++---- network/wsk/echosrv/echosrv.vcxproj | 8 ++++---- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/network/ndis/extension/base/sxbase.vcxproj b/network/ndis/extension/base/sxbase.vcxproj index 40b69bc3..aa23ad51 100644 --- a/network/ndis/extension/base/sxbase.vcxproj +++ b/network/ndis/extension/base/sxbase.vcxproj @@ -21,7 +21,7 @@ Windows10 False - Desktop + Windows Driver WDM WindowsKernelModeDriver10.0 StaticLibrary @@ -29,7 +29,7 @@ Windows10 True - Desktop + Windows Driver WDM WindowsKernelModeDriver10.0 StaticLibrary diff --git a/network/ndis/extension/samples/forward/msforwardext.vcxproj b/network/ndis/extension/samples/forward/msforwardext.vcxproj index b2dfc516..7efe88a3 100644 --- a/network/ndis/extension/samples/forward/msforwardext.vcxproj +++ b/network/ndis/extension/samples/forward/msforwardext.vcxproj @@ -21,7 +21,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -29,7 +29,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/extension/samples/passthrough/mspassthroughext.vcxproj b/network/ndis/extension/samples/passthrough/mspassthroughext.vcxproj index f688d064..f18ca5fa 100644 --- a/network/ndis/extension/samples/passthrough/mspassthroughext.vcxproj +++ b/network/ndis/extension/samples/passthrough/mspassthroughext.vcxproj @@ -21,7 +21,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -29,7 +29,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/ndisprot/6x/test/prottest.vcxproj b/network/ndis/ndisprot/6x/test/prottest.vcxproj index 9ef15c25..bbe324c4 100644 --- a/network/ndis/ndisprot/6x/test/prottest.vcxproj +++ b/network/ndis/ndisprot/6x/test/prottest.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/network/ndis/netvmini/6x/60/netvmini60.vcxproj b/network/ndis/netvmini/6x/60/netvmini60.vcxproj index b438c8de..5e5a4ed9 100644 --- a/network/ndis/netvmini/6x/60/netvmini60.vcxproj +++ b/network/ndis/netvmini/6x/60/netvmini60.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/netvmini/6x/620/netvmini620.vcxproj b/network/ndis/netvmini/6x/620/netvmini620.vcxproj index b068ad0b..90d22072 100644 --- a/network/ndis/netvmini/6x/620/netvmini620.vcxproj +++ b/network/ndis/netvmini/6x/620/netvmini620.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/netvmini/6x/630/netvmini630.vcxproj b/network/ndis/netvmini/6x/630/netvmini630.vcxproj index e3c7f876..65b5dd78 100644 --- a/network/ndis/netvmini/6x/630/netvmini630.vcxproj +++ b/network/ndis/netvmini/6x/630/netvmini630.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/ndis/netvmini/6x/680/netvmini680.vcxproj b/network/ndis/netvmini/6x/680/netvmini680.vcxproj index 47da5562..01b8736e 100644 --- a/network/ndis/netvmini/6x/680/netvmini680.vcxproj +++ b/network/ndis/netvmini/6x/680/netvmini680.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/network/radio/RadioManagerSample/cpp/SampleRM.vcxproj b/network/radio/RadioManagerSample/cpp/SampleRM.vcxproj index 0e5f41be..e6c3e212 100644 --- a/network/radio/RadioManagerSample/cpp/SampleRM.vcxproj +++ b/network/radio/RadioManagerSample/cpp/SampleRM.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/network/wsk/echosrv/echosrv.vcxproj b/network/wsk/echosrv/echosrv.vcxproj index 378dfd8e..d511133d 100644 --- a/network/wsk/echosrv/echosrv.vcxproj +++ b/network/wsk/echosrv/echosrv.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver -- cgit v1.3.1 From 45990c49d5b0f3a8c7716f8f088cd5c4164afcbf Mon Sep 17 00:00:00 2001 From: Julia D'Zmura <78620953+judzmura@users.noreply.github.com> Date: Mon, 10 Apr 2023 16:17:54 -0700 Subject: Inf Updates to Audio Samples (#970) Updating target versions for inf. --- audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf | Bin 8526 -> 8526 bytes .../Source/Main/SimpleAudioSample.inx | Bin 15216 -> 15216 bytes .../TabletAudioSample/ComponentizedApoSample.inx | Bin 22624 -> 22624 bytes .../TabletAudioSample/ComponentizedAudioSample.inx | Bin 52950 -> 52952 bytes .../ComponentizedAudioSampleExtension.inx | Bin 13660 -> 13660 bytes 5 files changed, 0 insertions(+), 0 deletions(-) diff --git a/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf index 70a0bb0c..889f9bdb 100644 Binary files a/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf and b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.inf differ diff --git a/audio/simpleaudiosample/Source/Main/SimpleAudioSample.inx b/audio/simpleaudiosample/Source/Main/SimpleAudioSample.inx index 93d07c78..07a5593c 100644 Binary files a/audio/simpleaudiosample/Source/Main/SimpleAudioSample.inx and b/audio/simpleaudiosample/Source/Main/SimpleAudioSample.inx differ diff --git a/audio/sysvad/TabletAudioSample/ComponentizedApoSample.inx b/audio/sysvad/TabletAudioSample/ComponentizedApoSample.inx index b18b528c..7c08f86a 100644 Binary files a/audio/sysvad/TabletAudioSample/ComponentizedApoSample.inx and b/audio/sysvad/TabletAudioSample/ComponentizedApoSample.inx differ diff --git a/audio/sysvad/TabletAudioSample/ComponentizedAudioSample.inx b/audio/sysvad/TabletAudioSample/ComponentizedAudioSample.inx index 5b50b8af..1c638273 100644 Binary files a/audio/sysvad/TabletAudioSample/ComponentizedAudioSample.inx and b/audio/sysvad/TabletAudioSample/ComponentizedAudioSample.inx differ diff --git a/audio/sysvad/TabletAudioSample/ComponentizedAudioSampleExtension.inx b/audio/sysvad/TabletAudioSample/ComponentizedAudioSampleExtension.inx index aa6928d0..2ce2f6a0 100644 Binary files a/audio/sysvad/TabletAudioSample/ComponentizedAudioSampleExtension.inx and b/audio/sysvad/TabletAudioSample/ComponentizedAudioSampleExtension.inx differ -- cgit v1.3.1 From 8526a742cd5721ff53f244bf5071bcf3d27dded6 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 11 Apr 2023 10:16:27 -0700 Subject: Update misc projects to use a DriverTargetPlatform of 'Windows Driver' (#972) Co-authored-by: Jason Knichel --- nfp/net/exe/NetNfpControl.vcxproj | 8 ++++---- security/elam/elamsample.vcxproj | 8 ++++---- serial/VirtualSerial2/FakeModem/fakemodem2um.vcxproj | 8 ++++---- serial/serenum/SerEnum_sample.vcxproj | 8 ++++---- serial/serial/wdfserial.vcxproj | 8 ++++---- spb/SkeletonI2C/skeletoni2c.vcxproj | 8 ++++---- spb/SpbTestTool/exe/SpbTestTool.vcxproj | 8 ++++---- spb/SpbTestTool/sys/SpbTestTool.vcxproj | 8 ++++---- storage/class/classpnp/src/classpnp.vcxproj | 8 ++++---- storage/filters/addfilter/src/addfilter.vcxproj | 8 ++++---- storage/miniports/storahci/src/inbox/storahci.vcxproj | 8 ++++---- storage/tools/spti/src/spti.vcxproj | 8 ++++---- video/pixlib/PixLib.vcxproj | 8 ++++---- wia/microdrv/testmcro.vcxproj | 8 ++++---- wia/wiadriverex/errhandler/errhandler.vcxproj | 8 ++++---- wia/wiadriverex/segfilter/segfilter.vcxproj | 8 ++++---- wia/wiadriverex/uiext2/uiext2.vcxproj | 8 ++++---- wmi/wmiacpi/acpimof.vcxproj | 8 ++++---- wmi/wmisamp/WmiSamp.vcxproj | 8 ++++---- 19 files changed, 76 insertions(+), 76 deletions(-) diff --git a/nfp/net/exe/NetNfpControl.vcxproj b/nfp/net/exe/NetNfpControl.vcxproj index 9d80e0eb..6dbe997c 100644 --- a/nfp/net/exe/NetNfpControl.vcxproj +++ b/nfp/net/exe/NetNfpControl.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/security/elam/elamsample.vcxproj b/security/elam/elamsample.vcxproj index a442079c..e4148795 100644 --- a/security/elam/elamsample.vcxproj +++ b/security/elam/elamsample.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/serial/VirtualSerial2/FakeModem/fakemodem2um.vcxproj b/serial/VirtualSerial2/FakeModem/fakemodem2um.vcxproj index a729333c..3b1e4751 100644 --- a/serial/VirtualSerial2/FakeModem/fakemodem2um.vcxproj +++ b/serial/VirtualSerial2/FakeModem/fakemodem2um.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver UMDF WindowsUserModeDriver10.0 DynamicLibrary diff --git a/serial/serenum/SerEnum_sample.vcxproj b/serial/serenum/SerEnum_sample.vcxproj index 09753b00..d189ece0 100644 --- a/serial/serenum/SerEnum_sample.vcxproj +++ b/serial/serenum/SerEnum_sample.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -37,7 +37,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -45,7 +45,7 @@ Windows10 False - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver @@ -53,7 +53,7 @@ Windows10 True - Universal + Windows Driver WDM WindowsKernelModeDriver10.0 Driver diff --git a/serial/serial/wdfserial.vcxproj b/serial/serial/wdfserial.vcxproj index fb761163..9627ed14 100644 --- a/serial/serial/wdfserial.vcxproj +++ b/serial/serial/wdfserial.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/spb/SkeletonI2C/skeletoni2c.vcxproj b/spb/SkeletonI2C/skeletoni2c.vcxproj index 2a244d4b..2844d1a8 100644 --- a/spb/SkeletonI2C/skeletoni2c.vcxproj +++ b/spb/SkeletonI2C/skeletoni2c.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/spb/SpbTestTool/exe/SpbTestTool.vcxproj b/spb/SpbTestTool/exe/SpbTestTool.vcxproj index 55d651e9..a4b8d011 100644 --- a/spb/SpbTestTool/exe/SpbTestTool.vcxproj +++ b/spb/SpbTestTool/exe/SpbTestTool.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/spb/SpbTestTool/sys/SpbTestTool.vcxproj b/spb/SpbTestTool/sys/SpbTestTool.vcxproj index 4b2b263e..072066dc 100644 --- a/spb/SpbTestTool/sys/SpbTestTool.vcxproj +++ b/spb/SpbTestTool/sys/SpbTestTool.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver diff --git a/storage/class/classpnp/src/classpnp.vcxproj b/storage/class/classpnp/src/classpnp.vcxproj index 2727ab87..4b092509 100644 --- a/storage/class/classpnp/src/classpnp.vcxproj +++ b/storage/class/classpnp/src/classpnp.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver ExportDriver WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver ExportDriver WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver ExportDriver WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver ExportDriver WindowsKernelModeDriver10.0 Driver diff --git a/storage/filters/addfilter/src/addfilter.vcxproj b/storage/filters/addfilter/src/addfilter.vcxproj index 1cb9300f..7216a90a 100644 --- a/storage/filters/addfilter/src/addfilter.vcxproj +++ b/storage/filters/addfilter/src/addfilter.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/storage/miniports/storahci/src/inbox/storahci.vcxproj b/storage/miniports/storahci/src/inbox/storahci.vcxproj index cd55b82a..fbe46739 100644 --- a/storage/miniports/storahci/src/inbox/storahci.vcxproj +++ b/storage/miniports/storahci/src/inbox/storahci.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver Miniport WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver Miniport WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver Miniport WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver Miniport WindowsKernelModeDriver10.0 Driver diff --git a/storage/tools/spti/src/spti.vcxproj b/storage/tools/spti/src/spti.vcxproj index 25cb31d5..6118b8d4 100644 --- a/storage/tools/spti/src/spti.vcxproj +++ b/storage/tools/spti/src/spti.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 Application diff --git a/video/pixlib/PixLib.vcxproj b/video/pixlib/PixLib.vcxproj index 673a9ad8..abd7956b 100644 --- a/video/pixlib/PixLib.vcxproj +++ b/video/pixlib/PixLib.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 StaticLibrary @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 StaticLibrary @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 StaticLibrary @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 StaticLibrary diff --git a/wia/microdrv/testmcro.vcxproj b/wia/microdrv/testmcro.vcxproj index aba1deda..e382e4de 100644 --- a/wia/microdrv/testmcro.vcxproj +++ b/wia/microdrv/testmcro.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/wia/wiadriverex/errhandler/errhandler.vcxproj b/wia/wiadriverex/errhandler/errhandler.vcxproj index 5d1b8a2f..054b4828 100644 --- a/wia/wiadriverex/errhandler/errhandler.vcxproj +++ b/wia/wiadriverex/errhandler/errhandler.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/wia/wiadriverex/segfilter/segfilter.vcxproj b/wia/wiadriverex/segfilter/segfilter.vcxproj index 32c9db8c..ff4321ca 100644 --- a/wia/wiadriverex/segfilter/segfilter.vcxproj +++ b/wia/wiadriverex/segfilter/segfilter.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/wia/wiadriverex/uiext2/uiext2.vcxproj b/wia/wiadriverex/uiext2/uiext2.vcxproj index e38167ab..b9baba93 100644 --- a/wia/wiadriverex/uiext2/uiext2.vcxproj +++ b/wia/wiadriverex/uiext2/uiext2.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/wmi/wmiacpi/acpimof.vcxproj b/wmi/wmiacpi/acpimof.vcxproj index c0965bad..15803d3c 100644 --- a/wmi/wmiacpi/acpimof.vcxproj +++ b/wmi/wmiacpi/acpimof.vcxproj @@ -29,7 +29,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -37,7 +37,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -45,7 +45,7 @@ Windows10 False - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary @@ -53,7 +53,7 @@ Windows10 True - Desktop + Windows Driver WindowsApplicationForDrivers10.0 DynamicLibrary diff --git a/wmi/wmisamp/WmiSamp.vcxproj b/wmi/wmisamp/WmiSamp.vcxproj index 098d3cef..a0ae2b2a 100644 --- a/wmi/wmisamp/WmiSamp.vcxproj +++ b/wmi/wmisamp/WmiSamp.vcxproj @@ -30,7 +30,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Windows Driver KMDF WindowsKernelModeDriver10.0 Driver -- cgit v1.3.1 From 9d83452366f0bdca802d068b91f1957c4339078d Mon Sep 17 00:00:00 2001 From: kahashimoto-ms <117399367+kahashimoto-ms@users.noreply.github.com> Date: Thu, 13 Apr 2023 09:59:25 -0700 Subject: Ndisprot inf violations (#974) * Add PnpLockdown=1 to the version section of the inf * Change service name to Ndisprot60 * Change Section 'wdfsection' to 'Install.Wdf' so it can be referenced. Change service to NdisProt60 in that section * Change all DIRID to 13 * Add different manufacturer entires so installtion is different for Windows 7 vs Windows 10 and above * Add another manufacturer so the driver installs in DriverStore for newest builds * Enable the Control-flow Enforcement Technology (CET) Shadow Stack mitigation * Add SAL annotation to the DllCanUnloadNow definition to match declaration * Use stampinf ARCH variable to replace hard coded architectures * Fix a comment * Add the correct build number for installing network drivers using Dlls and update comment. --- network/ndis/ndisprot_kmdf/60/ndisprot.inx | Bin 9312 -> 13478 bytes network/ndis/ndisprot_kmdf/60/nprt6wdf.vcxproj | 1 + network/ndis/ndisprot_kmdf/notifyob/dllmain.cpp | 2 +- 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/network/ndis/ndisprot_kmdf/60/ndisprot.inx b/network/ndis/ndisprot_kmdf/60/ndisprot.inx index 45305bb7..ecd932c1 100644 Binary files a/network/ndis/ndisprot_kmdf/60/ndisprot.inx and b/network/ndis/ndisprot_kmdf/60/ndisprot.inx differ diff --git a/network/ndis/ndisprot_kmdf/60/nprt6wdf.vcxproj b/network/ndis/ndisprot_kmdf/60/nprt6wdf.vcxproj index 980c6052..81a2d78e 100644 --- a/network/ndis/ndisprot_kmdf/60/nprt6wdf.vcxproj +++ b/network/ndis/ndisprot_kmdf/60/nprt6wdf.vcxproj @@ -143,6 +143,7 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\ndis.lib;$(DDK_LIB_PATH)\wdmsec.lib + true diff --git a/network/ndis/ndisprot_kmdf/notifyob/dllmain.cpp b/network/ndis/ndisprot_kmdf/notifyob/dllmain.cpp index b3e3a66c..2452d95c 100644 --- a/network/ndis/ndisprot_kmdf/notifyob/dllmain.cpp +++ b/network/ndis/ndisprot_kmdf/notifyob/dllmain.cpp @@ -92,7 +92,7 @@ DllMain( return TRUE; } - +__control_entrypoint(DllExport) STDAPI DllCanUnloadNow( ) { -- cgit v1.3.1 From 24f196d40fee8c6fb48618ac7c3bc4ff00cdcbe5 Mon Sep 17 00:00:00 2001 From: Adonais Romero González Date: Tue, 18 Apr 2023 14:26:24 -0700 Subject: [general/simplemediasource] Fix architecture in solution (#977) --- exclusions.csv | 1 - general/SimpleMediaSource/SimpleMediaSource.sln | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/exclusions.csv b/exclusions.csv index 39bc53c7..f9b51140 100644 --- a/exclusions.csv +++ b/exclusions.csv @@ -2,7 +2,6 @@ Path,Reason general\dchu\osrfx2_dchu_base,Wrong Toolset - needs migration general\dchu\osrfx2_dchu_extension_loose,Needs fix for project not found general\dchu\osrfx2_dchu_extension_tight,Wrong Toolset - needs migration -general\simplemediasource,ARM64 LNK1181: cannot open input file 'SimpleMediaSource.lib' general\winhec 2017 lab\toaster driver,Needs input from end user general\winhec 2017 lab\toaster support app,Needs input from end user network\trans\stmedit,Invalid Win32 architecture diff --git a/general/SimpleMediaSource/SimpleMediaSource.sln b/general/SimpleMediaSource/SimpleMediaSource.sln index f6bd620c..95ba61da 100644 --- a/general/SimpleMediaSource/SimpleMediaSource.sln +++ b/general/SimpleMediaSource/SimpleMediaSource.sln @@ -19,8 +19,10 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {43AD9BF7-E765-48FE-9826-71A8F2CB12DD}.Debug|ARM.ActiveCfg = Debug|Win32 - {43AD9BF7-E765-48FE-9826-71A8F2CB12DD}.Debug|ARM64.ActiveCfg = Debug|Win32 + {43AD9BF7-E765-48FE-9826-71A8F2CB12DD}.Debug|ARM.ActiveCfg = Debug|ARM + {43AD9BF7-E765-48FE-9826-71A8F2CB12DD}.Debug|ARM.Build.0 = Debug|ARM + {43AD9BF7-E765-48FE-9826-71A8F2CB12DD}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {43AD9BF7-E765-48FE-9826-71A8F2CB12DD}.Debug|ARM64.Build.0 = Debug|ARM64 {43AD9BF7-E765-48FE-9826-71A8F2CB12DD}.Debug|x64.ActiveCfg = Debug|x64 {43AD9BF7-E765-48FE-9826-71A8F2CB12DD}.Debug|x64.Build.0 = Debug|x64 {43AD9BF7-E765-48FE-9826-71A8F2CB12DD}.Debug|x86.ActiveCfg = Debug|Win32 -- cgit v1.3.1 From 10a103a40e75f4b98092c99e6f1b9ff9c3b20504 Mon Sep 17 00:00:00 2001 From: kahashimoto-ms <117399367+kahashimoto-ms@users.noreply.github.com> Date: Fri, 21 Apr 2023 14:16:04 -0700 Subject: Ndis mux inf violations (#973) * Delete deprecated directives DelFiles and DelService * Add PnpLockdown=1 to the version section of the inf * Add catalog file in muxp.inf * Add PnpLockdown=1 to the version section of mux_mp.inf * Add catalog file in mux_mp.inf * include mux_mp.inf in the muxvaln project * include muxp.inf in mux project. Add mux.dll as file to package. Note as of now the Notifyob proj must be built then mux.dll must be moved to the Project Directory * Changed all DIRID to 13 * change all DIRID to 13 * Create build dependency so that mux.dll is generated before other projects. * Include the mux.dll from the notifyob project into the build package * Delete comments * Edit muxp.inf so that DIRID 13 is used for installation above certain releases * Change MUXP->MUXP_NC and MUXP_Update->MUXP. This makes the updated version look like the default. Old version called _NC for non-compliant * Edit muxp.inf so that MUXP comes before MUXP_NC * Make same edits to mux_mp.inf * Enable the Control-flow Enforcement Technology (CET) Shadow Stack mitigation * Fix Warning from runing Prefast static analysis * Fix more warnings from running Prefast * Use stampinf ARCH variable to replace all the hard coded architecures in mux_mp.inf * Use stampinf ARCH variable to replace all the hard coded architecures in muxp.inf * Delete extra comma typo * Change encoding of mux_mp.inf to UTF-16 LE * Change encoding of muxp.inf to UTF-16 LE * Add the correct build number for installing network drivers with Dlls and upate comment in muxp.inf * Add the correct build number for installing network drivers with Dlls and upate comment in mux_mp.inf * Change all instances of MUXP tp MUXMP in mux_mp.inf * Change Brace style to match existing code * Fix mistakes returning win32 err for HRESULT, and leaking memory * Fix mux_mp.inf to payload muxvlan.sys * Edit to sln and vcxproj files to edit how build directories are made * Edit vcxproj files to package correct files. Edit Target name for muxvlan project to be mux so the same inf files can be used for both projects * Remove comments * Fix mux_mp.inf to payload mux.sys * fix mistakes returning win32 err instead of HRESULT, and leaking mem * Change comment on mux_mp.inf explaining why build 25341 is used * Free lpszBindName before return. --- network/ndis/mux/driver/60/miniport.c | 26 ++++++------- network/ndis/mux/driver/60/mux_mp.inf | Bin 4028 -> 7718 bytes network/ndis/mux/driver/60/muxp.inf | Bin 5044 -> 7380 bytes network/ndis/mux/driver/60/novlan/mux.vcxproj | 16 +++++++- .../ndis/mux/driver/60/novlan/mux.vcxproj.Filters | 8 ++++ network/ndis/mux/driver/60/vlan/muxvlan.vcxproj | 24 +++++++++--- .../mux/driver/60/vlan/muxvlan.vcxproj.Filters | 8 ++++ network/ndis/mux/mux.sln | 33 +++++++++++------ network/ndis/mux/notifyob/adapter.cpp | 41 ++++++++++++++++++--- network/ndis/mux/notifyob/common.cpp | 22 ++++++++++- network/ndis/mux/notifyob/dllmain.cpp | 2 + network/ndis/mux/notifyob/notify.cpp | 10 +++-- network/ndis/mux/notifyob/virtual.cpp | 34 ++++++++++++++--- 13 files changed, 175 insertions(+), 49 deletions(-) diff --git a/network/ndis/mux/driver/60/miniport.c b/network/ndis/mux/driver/60/miniport.c index e0c3e380..f30c4b62 100644 --- a/network/ndis/mux/driver/60/miniport.c +++ b/network/ndis/mux/driver/60/miniport.c @@ -710,25 +710,23 @@ Return Value: NDIS_STATISTICS_FLAGS_VALID_RCV_ERROR | NDIS_STATISTICS_FLAGS_VALID_XMIT_ERROR; - StatisticsInfo.ifInDiscards = pVElan->RcvCrcErrors + - pVElan->RcvAlignmentErrors + - pVElan->RcvResourceErrors + - pVElan->RcvDmaOverrunErrors + - pVElan->RcvRuntErrors; + StatisticsInfo.ifInDiscards = + (ULONG64)pVElan->RcvCrcErrors + + (ULONG64)pVElan->RcvAlignmentErrors + + (ULONG64)pVElan->RcvResourceErrors + + (ULONG64)pVElan->RcvDmaOverrunErrors + + (ULONG64)pVElan->RcvRuntErrors; #if IEEE_VLAN_SUPPORT - StatisticsInfo.ifInDiscards += (pVElan->RcvVlanIdErrors + - pVElan->RcvFormatErrors); + StatisticsInfo.ifInDiscards += ((ULONG64)pVElan->RcvVlanIdErrors + (ULONG64)pVElan->RcvFormatErrors); #endif - StatisticsInfo.ifInErrors = StatisticsInfo.ifInDiscards - - pVElan->RcvResourceErrors; + (ULONG64)pVElan->RcvResourceErrors; - - StatisticsInfo.ifOutErrors = pVElan->TxAbortExcessCollisions + - pVElan->TxDmaUnderrun + - pVElan->TxLostCRS + - pVElan->TxLateCollisions; + StatisticsInfo.ifOutErrors = (ULONG64)pVElan->TxAbortExcessCollisions + + (ULONG64)pVElan->TxDmaUnderrun + + (ULONG64)pVElan->TxLostCRS + + (ULONG64)pVElan->TxLateCollisions; pInfo = &StatisticsInfo; break; diff --git a/network/ndis/mux/driver/60/mux_mp.inf b/network/ndis/mux/driver/60/mux_mp.inf index a8694916..f216ac16 100644 Binary files a/network/ndis/mux/driver/60/mux_mp.inf and b/network/ndis/mux/driver/60/mux_mp.inf differ diff --git a/network/ndis/mux/driver/60/muxp.inf b/network/ndis/mux/driver/60/muxp.inf index 637b2252..f9c4c04e 100644 Binary files a/network/ndis/mux/driver/60/muxp.inf and b/network/ndis/mux/driver/60/muxp.inf differ diff --git a/network/ndis/mux/driver/60/novlan/mux.vcxproj b/network/ndis/mux/driver/60/novlan/mux.vcxproj index 1eac45e0..758f450f 100644 --- a/network/ndis/mux/driver/60/novlan/mux.vcxproj +++ b/network/ndis/mux/driver/60/novlan/mux.vcxproj @@ -182,6 +182,7 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\ndis.lib + true %(AdditionalIncludeDirectories);.. @@ -283,8 +284,21 @@ + + + + + + + + + + + + - + + diff --git a/network/ndis/mux/driver/60/novlan/mux.vcxproj.Filters b/network/ndis/mux/driver/60/novlan/mux.vcxproj.Filters index ff91d92c..fe979006 100644 --- a/network/ndis/mux/driver/60/novlan/mux.vcxproj.Filters +++ b/network/ndis/mux/driver/60/novlan/mux.vcxproj.Filters @@ -37,4 +37,12 @@ Resource Files + + + Driver Files + + + Driver Files + + \ No newline at end of file diff --git a/network/ndis/mux/driver/60/vlan/muxvlan.vcxproj b/network/ndis/mux/driver/60/vlan/muxvlan.vcxproj index 423e7bde..eb2ff474 100644 --- a/network/ndis/mux/driver/60/vlan/muxvlan.vcxproj +++ b/network/ndis/mux/driver/60/vlan/muxvlan.vcxproj @@ -76,16 +76,16 @@ - muxvlan + mux - muxvlan + mux - muxvlan + mux - muxvlan + mux @@ -194,6 +194,7 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\ndis.lib + true %(AdditionalIncludeDirectories);.. @@ -295,8 +296,21 @@ + + + + + + + + + + + + - + + diff --git a/network/ndis/mux/driver/60/vlan/muxvlan.vcxproj.Filters b/network/ndis/mux/driver/60/vlan/muxvlan.vcxproj.Filters index 8bd7f5bf..64862290 100644 --- a/network/ndis/mux/driver/60/vlan/muxvlan.vcxproj.Filters +++ b/network/ndis/mux/driver/60/vlan/muxvlan.vcxproj.Filters @@ -37,4 +37,12 @@ Resource Files + + + Driver Files + + + Driver Files + + \ No newline at end of file diff --git a/network/ndis/mux/mux.sln b/network/ndis/mux/mux.sln index 551a21b7..bf78d7a4 100644 --- a/network/ndis/mux/mux.sln +++ b/network/ndis/mux/mux.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33213.308 MinimumVisualStudioVersion = 12.0 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Vlan", "Vlan", "{DFD0A31B-8B62-4BAA-998E-161F01D1A01B}" EndProject @@ -14,41 +14,47 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notifyob", "Notifyob", "{2CAF23FF-28F8-4D52-B6C9-B76C8BCD5F67}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "muxvlan", "driver\60\vlan\muxvlan.vcxproj", "{015D7470-0FC8-4597-A67E-BD9C754F0681}" + ProjectSection(ProjectDependencies) = postProject + {92E3B437-C258-47FB-8856-D3FEA56A3BCC} = {92E3B437-C258-47FB-8856-D3FEA56A3BCC} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mux", "driver\60\novlan\mux.vcxproj", "{B2DE2C37-B3F2-491E-94AE-402A7B4D3308}" + ProjectSection(ProjectDependencies) = postProject + {92E3B437-C258-47FB-8856-D3FEA56A3BCC} = {92E3B437-C258-47FB-8856-D3FEA56A3BCC} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mux", "notifyob\mux.vcxproj", "{92E3B437-C258-47FB-8856-D3FEA56A3BCC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {015D7470-0FC8-4597-A67E-BD9C754F0681}.Debug|Win32.ActiveCfg = Debug|Win32 {015D7470-0FC8-4597-A67E-BD9C754F0681}.Debug|Win32.Build.0 = Debug|Win32 - {015D7470-0FC8-4597-A67E-BD9C754F0681}.Release|Win32.ActiveCfg = Release|Win32 - {015D7470-0FC8-4597-A67E-BD9C754F0681}.Release|Win32.Build.0 = Release|Win32 {015D7470-0FC8-4597-A67E-BD9C754F0681}.Debug|x64.ActiveCfg = Debug|x64 {015D7470-0FC8-4597-A67E-BD9C754F0681}.Debug|x64.Build.0 = Debug|x64 + {015D7470-0FC8-4597-A67E-BD9C754F0681}.Release|Win32.ActiveCfg = Release|Win32 + {015D7470-0FC8-4597-A67E-BD9C754F0681}.Release|Win32.Build.0 = Release|Win32 {015D7470-0FC8-4597-A67E-BD9C754F0681}.Release|x64.ActiveCfg = Release|x64 {015D7470-0FC8-4597-A67E-BD9C754F0681}.Release|x64.Build.0 = Release|x64 {B2DE2C37-B3F2-491E-94AE-402A7B4D3308}.Debug|Win32.ActiveCfg = Debug|Win32 {B2DE2C37-B3F2-491E-94AE-402A7B4D3308}.Debug|Win32.Build.0 = Debug|Win32 - {B2DE2C37-B3F2-491E-94AE-402A7B4D3308}.Release|Win32.ActiveCfg = Release|Win32 - {B2DE2C37-B3F2-491E-94AE-402A7B4D3308}.Release|Win32.Build.0 = Release|Win32 {B2DE2C37-B3F2-491E-94AE-402A7B4D3308}.Debug|x64.ActiveCfg = Debug|x64 {B2DE2C37-B3F2-491E-94AE-402A7B4D3308}.Debug|x64.Build.0 = Debug|x64 + {B2DE2C37-B3F2-491E-94AE-402A7B4D3308}.Release|Win32.ActiveCfg = Release|Win32 + {B2DE2C37-B3F2-491E-94AE-402A7B4D3308}.Release|Win32.Build.0 = Release|Win32 {B2DE2C37-B3F2-491E-94AE-402A7B4D3308}.Release|x64.ActiveCfg = Release|x64 {B2DE2C37-B3F2-491E-94AE-402A7B4D3308}.Release|x64.Build.0 = Release|x64 {92E3B437-C258-47FB-8856-D3FEA56A3BCC}.Debug|Win32.ActiveCfg = Debug|Win32 {92E3B437-C258-47FB-8856-D3FEA56A3BCC}.Debug|Win32.Build.0 = Debug|Win32 - {92E3B437-C258-47FB-8856-D3FEA56A3BCC}.Release|Win32.ActiveCfg = Release|Win32 - {92E3B437-C258-47FB-8856-D3FEA56A3BCC}.Release|Win32.Build.0 = Release|Win32 {92E3B437-C258-47FB-8856-D3FEA56A3BCC}.Debug|x64.ActiveCfg = Debug|x64 {92E3B437-C258-47FB-8856-D3FEA56A3BCC}.Debug|x64.Build.0 = Debug|x64 + {92E3B437-C258-47FB-8856-D3FEA56A3BCC}.Release|Win32.ActiveCfg = Release|Win32 + {92E3B437-C258-47FB-8856-D3FEA56A3BCC}.Release|Win32.Build.0 = Release|Win32 {92E3B437-C258-47FB-8856-D3FEA56A3BCC}.Release|x64.ActiveCfg = Release|x64 {92E3B437-C258-47FB-8856-D3FEA56A3BCC}.Release|x64.Build.0 = Release|x64 EndGlobalSection @@ -56,11 +62,14 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {015D7470-0FC8-4597-A67E-BD9C754F0681} = {DFD0A31B-8B62-4BAA-998E-161F01D1A01B} - {B2DE2C37-B3F2-491E-94AE-402A7B4D3308} = {2D3D13DE-5985-4A6C-8562-3E954D634F1E} - {92E3B437-C258-47FB-8856-D3FEA56A3BCC} = {2CAF23FF-28F8-4D52-B6C9-B76C8BCD5F67} {DFD0A31B-8B62-4BAA-998E-161F01D1A01B} = {BB781269-F74A-43E0-AD7D-DBD32BBF2012} {BB781269-F74A-43E0-AD7D-DBD32BBF2012} = {26B59072-BF66-4E06-83CA-3F4F95378A23} {2D3D13DE-5985-4A6C-8562-3E954D634F1E} = {BB781269-F74A-43E0-AD7D-DBD32BBF2012} + {015D7470-0FC8-4597-A67E-BD9C754F0681} = {DFD0A31B-8B62-4BAA-998E-161F01D1A01B} + {B2DE2C37-B3F2-491E-94AE-402A7B4D3308} = {2D3D13DE-5985-4A6C-8562-3E954D634F1E} + {92E3B437-C258-47FB-8856-D3FEA56A3BCC} = {2CAF23FF-28F8-4D52-B6C9-B76C8BCD5F67} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D56D7C7C-8F28-4702-A8D4-D0FDB5A2756C} EndGlobalSection EndGlobal diff --git a/network/ndis/mux/notifyob/adapter.cpp b/network/ndis/mux/notifyob/adapter.cpp index ea964c7a..a208aa57 100644 --- a/network/ndis/mux/notifyob/adapter.cpp +++ b/network/ndis/mux/notifyob/adapter.cpp @@ -146,9 +146,13 @@ HRESULT CMuxPhysicalAdapter::LoadConfiguration (VOID) // device IDs of the virtual miniports are stored. // - StringFromGUID2( m_guidAdapter, + int numChars = StringFromGUID2( m_guidAdapter, szAdapterGuid, MAX_PATH+1 ); + if (numChars == 0) { + + return HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW); + } StringCchPrintfW ( szAdapterGuidKey, celems(szAdapterGuidKey), @@ -225,9 +229,14 @@ HRESULT CMuxPhysicalAdapter::LoadConfiguration (VOID) if ( lpMiniportGuid != NULL ) { - CLSIDFromString( lpMiniportGuid, + HRESULT hrResult = CLSIDFromString( lpMiniportGuid, &guidMiniport ); - + + if (hrResult != S_OK) { + + lResult = ERROR_INVALID_PARAMETER; + } + // // Create an instance representing the virtual miniport. // @@ -532,10 +541,16 @@ HRESULT CMuxPhysicalAdapter::ApplyRegistryChanges (ConfigAction eApplyAction) // Open/create and then close the registry key to ensure that it does exist. // - StringFromGUID2( m_guidAdapter, + int numChars = StringFromGUID2( m_guidAdapter, szAdapterGuid, MAX_PATH+1 ); + if (numChars == 0) { + + return HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW); + } + + lResult = RegCreateKeyExW( HKEY_LOCAL_MACHINE, c_szAdapterList, 0, @@ -786,9 +801,16 @@ HRESULT CMuxPhysicalAdapter::ApplyPnpChanges( // Notify the driver that one or more virtual miniports have been added. // - StringFromGUID2( guidMiniport, + int numChars = StringFromGUID2( guidMiniport, szMiniportGuid, MAX_PATH+1 ); + if (numChars == 0) { + + CoTaskMemFree(lpszBindName); + + return HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW); + } + lpDevice = AddDevicePrefix( szMiniportGuid ); if ( lpDevice ) { @@ -865,9 +887,16 @@ HRESULT CMuxPhysicalAdapter::ApplyPnpChanges( if ( eApplyAction != eActRemove ) { - StringFromGUID2( guidMiniport, + int numChars = StringFromGUID2( guidMiniport, szMiniportGuid, MAX_PATH+1 ); + if(numChars == 0) { + + CoTaskMemFree(lpszBindName); + + return HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW); + } + lpDevice = AddDevicePrefix( szMiniportGuid ); if ( lpDevice ) { diff --git a/network/ndis/mux/notifyob/common.cpp b/network/ndis/mux/notifyob/common.cpp index 24c7b486..5ca2ca7f 100644 --- a/network/ndis/mux/notifyob/common.cpp +++ b/network/ndis/mux/notifyob/common.cpp @@ -328,6 +328,7 @@ HRESULT HrFindInstance (INetCfg *pnc, ULONG ulCount; BOOL found; HRESULT hr; + int numChars; TraceMsg( L"-->HrFindInstance.\n" ); @@ -336,10 +337,17 @@ HRESULT HrFindInstance (INetCfg *pnc, if ( hr == S_OK ) { - StringFromGUID2( guidInstance, + numChars = StringFromGUID2( guidInstance, szGuid, MAX_PATH+1 ); + if (numChars == 0) { + + ReleaseObj(pencc); + + return HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW); + } + TraceMsg( L" Looking for component with InstanceGuid %s\n", szGuid ); @@ -353,10 +361,20 @@ HRESULT HrFindInstance (INetCfg *pnc, if ( hr == S_OK ) { - StringFromGUID2( guid, + numChars = StringFromGUID2( guid, szGuid, MAX_PATH+1 ); + if (numChars == 0) { + + ReleaseObj(pncc); + + ReleaseObj(pencc); + + return HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW); + } + + TraceMsg( L" Found component with InstanceGuid %s\n", szGuid ); diff --git a/network/ndis/mux/notifyob/dllmain.cpp b/network/ndis/mux/notifyob/dllmain.cpp index d9785cd6..636f2c8a 100644 --- a/network/ndis/mux/notifyob/dllmain.cpp +++ b/network/ndis/mux/notifyob/dllmain.cpp @@ -68,6 +68,7 @@ BOOL WINAPI DllMain (HINSTANCE hInstance, ///////////////////////////////////////////////////////////////////////////// // Used to determine whether the DLL can be unloaded by OLE +__control_entrypoint(DllExport) STDAPI DllCanUnloadNow(void) { HRESULT hr; @@ -85,6 +86,7 @@ STDAPI DllCanUnloadNow(void) ///////////////////////////////////////////////////////////////////////////// // Returns a class factory to create an object of the requested type +_Check_return_ STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID* ppv) { TraceMsg( L"-->DllGetClassObject.\n"); diff --git a/network/ndis/mux/notifyob/notify.cpp b/network/ndis/mux/notifyob/notify.cpp index be239fcd..3d0a55ff 100644 --- a/network/ndis/mux/notifyob/notify.cpp +++ b/network/ndis/mux/notifyob/notify.cpp @@ -1041,11 +1041,8 @@ STDMETHODIMP CMuxNotify::ApplyProperties (VOID) INetLanConnectionUiInfo *pLanConnUiInfo; CMuxPhysicalAdapter *pAdapter; GUID guidAdapter; - INetCfgComponent *pncc; HRESULT hr = S_OK; - UNREFERENCED_PARAMETER(pncc); - TraceMsg(L"-->CMuxNotify INetCfgPropertyUi::ApplyProperties\n"); if ( m_pUnkContext ) { @@ -1232,9 +1229,14 @@ HRESULT CMuxNotify::HrLoadAdapterConfiguration (VOID) // Subkeys are actually a guid/bindname of the adapters. // szAdapterGuid[MAX_PATH]='\0'; - CLSIDFromString( szAdapterGuid, + HRESULT hrResult = CLSIDFromString( szAdapterGuid, &guidAdapter ); + if (hrResult != S_OK) { + + lResult = ERROR_INVALID_PARAMETER; + } + // // Create an instance representing the adapter. // diff --git a/network/ndis/mux/notifyob/virtual.cpp b/network/ndis/mux/notifyob/virtual.cpp index 5b6cde80..fd3cce0e 100644 --- a/network/ndis/mux/notifyob/virtual.cpp +++ b/network/ndis/mux/notifyob/virtual.cpp @@ -330,17 +330,22 @@ HRESULT CMuxVirtualMiniport::ApplyRegistryChanges(ConfigAction eApplyAction) WCHAR szMiniportGuid[MAX_PATH+1]; LPWSTR lpDevice; LONG lResult = 0; - + int numChars; TraceMsg( L"-->CMuxVirtualMiniport::ApplyRegistryChanges.\n" ); switch( eApplyAction ) { case eActAdd: // Virtual miniport added. - StringFromGUID2( m_guidAdapter, + numChars = StringFromGUID2( m_guidAdapter, szAdapterGuid, MAX_PATH+1 ); + if (numChars == 0) { + + return HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW); + } + StringCchPrintfW ( szAdapterGuidKey, celems(szAdapterGuidKey), L"%s\\%s", @@ -361,10 +366,17 @@ HRESULT CMuxVirtualMiniport::ApplyRegistryChanges(ConfigAction eApplyAction) if ( lResult == ERROR_SUCCESS ) { - StringFromGUID2( m_guidMiniport, + numChars = StringFromGUID2( m_guidMiniport, szMiniportGuid, MAX_PATH+1 ); + if (numChars == 0) { + + RegCloseKey(hkeyAdapterGuid); + + return HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW); + } + lpDevice = AddDevicePrefix( szMiniportGuid ); if ( lpDevice ) { @@ -411,10 +423,15 @@ HRESULT CMuxVirtualMiniport::ApplyRegistryChanges(ConfigAction eApplyAction) case eActRemove: // Virtual miniport removed. - StringFromGUID2( m_guidAdapter, + numChars = StringFromGUID2( m_guidAdapter, szAdapterGuid, MAX_PATH+1 ); + if (numChars == 0) { + + return HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW); + } + StringCchPrintfW( szAdapterGuidKey, celems(szAdapterGuidKey), L"%s\\%s", @@ -434,10 +451,17 @@ HRESULT CMuxVirtualMiniport::ApplyRegistryChanges(ConfigAction eApplyAction) if ( lResult == ERROR_SUCCESS ) { - StringFromGUID2( m_guidMiniport, + numChars = StringFromGUID2( m_guidMiniport, szMiniportGuid, MAX_PATH+1 ); + if (numChars == 0) { + + RegCloseKey(hkeyAdapterGuid); + + return HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW); + } + lpDevice = AddDevicePrefix( szMiniportGuid ); TraceMsg( L" Deleting %s at %s.\n", lpDevice, -- cgit v1.3.1 From c25e09d5d97a284adf83e3824527c133ad69fd6d Mon Sep 17 00:00:00 2001 From: Adonais Romero González Date: Mon, 1 May 2023 11:15:00 -0700 Subject: [network/trans/stmedit] Fix architecture in solution (#976) --- exclusions.csv | 1 - network/trans/stmedit/stmedit.sln | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/exclusions.csv b/exclusions.csv index f9b51140..af7bb3e3 100644 --- a/exclusions.csv +++ b/exclusions.csv @@ -4,7 +4,6 @@ general\dchu\osrfx2_dchu_extension_loose,Needs fix for project not found general\dchu\osrfx2_dchu_extension_tight,Wrong Toolset - needs migration general\winhec 2017 lab\toaster driver,Needs input from end user general\winhec 2017 lab\toaster support app,Needs input from end user -network\trans\stmedit,Invalid Win32 architecture network\trans\wfpsampler,Missing INF section; missing libs network\wlan\wdi,Invalid architecture print\oem printer customization plug-in samples\c++,Invalid architecture diff --git a/network/trans/stmedit/stmedit.sln b/network/trans/stmedit/stmedit.sln index 8ae2d839..e6b3f49a 100644 --- a/network/trans/stmedit/stmedit.sln +++ b/network/trans/stmedit/stmedit.sln @@ -15,9 +15,9 @@ Global GlobalSection(ProjectConfigurationPlatforms) = postSolution {9CE912A5-6210-4EF8-B22D-611D13254D4C}.Debug|Win32.ActiveCfg = Debug|Win32 {9CE912A5-6210-4EF8-B22D-611D13254D4C}.Debug|Win32.Build.0 = Debug|Win32 - {9CE912A5-6210-4EF8-B22D-611D13254D4C}.Debug|x64.ActiveCfg = Release|Win32 - {9CE912A5-6210-4EF8-B22D-611D13254D4C}.Debug|x64.Build.0 = Release|Win32 - {9CE912A5-6210-4EF8-B22D-611D13254D4C}.Debug|x64.Deploy.0 = Release|Win32 + {9CE912A5-6210-4EF8-B22D-611D13254D4C}.Debug|x64.ActiveCfg = Release|x64 + {9CE912A5-6210-4EF8-B22D-611D13254D4C}.Debug|x64.Build.0 = Release|x64 + {9CE912A5-6210-4EF8-B22D-611D13254D4C}.Debug|x64.Deploy.0 = Release|x64 {9CE912A5-6210-4EF8-B22D-611D13254D4C}.Release|Win32.ActiveCfg = Release|Win32 {9CE912A5-6210-4EF8-B22D-611D13254D4C}.Release|Win32.Build.0 = Release|Win32 {9CE912A5-6210-4EF8-B22D-611D13254D4C}.Release|x64.ActiveCfg = Release|x64 -- cgit v1.3.1 From 95037b3f77f3a745f7682f991ac80e81f91f5362 Mon Sep 17 00:00:00 2001 From: "Yang You(UU)" Date: Wed, 3 May 2023 00:18:34 +0000 Subject: Cleanup the ARM and X86, (#982) Cleanup the ARM and X86, both of them are out of date, currently not able to succesfully build. --- network/wlan/WDI/COMMON/common.vcxproj | 276 --------- network/wlan/WDI/LIB/Arm/hal.lib | Bin 5935768 -> 0 bytes network/wlan/WDI/LIB/Arm/rtklibcom.lib | Bin 3149800 -> 0 bytes network/wlan/WDI/LIB/x86/hal.lib | Bin 3481260 -> 0 bytes network/wlan/WDI/LIB/x86/rtklibcom.lib | Bin 1773422 -> 0 bytes network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj | 621 --------------------- .../wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj | 542 ------------------ .../WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf | Bin 86590 -> 0 bytes .../wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf | Bin 189248 -> 0 bytes .../WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf | Bin 86590 -> 0 bytes network/wlan/WDI/windows.msbuild.rtwssample.sln | 44 +- 11 files changed, 2 insertions(+), 1481 deletions(-) delete mode 100644 network/wlan/WDI/LIB/Arm/hal.lib delete mode 100644 network/wlan/WDI/LIB/Arm/rtklibcom.lib delete mode 100644 network/wlan/WDI/LIB/x86/hal.lib delete mode 100644 network/wlan/WDI/LIB/x86/rtklibcom.lib delete mode 100644 network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf delete mode 100644 network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf delete mode 100644 network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf diff --git a/network/wlan/WDI/COMMON/common.vcxproj b/network/wlan/WDI/COMMON/common.vcxproj index 3de209fa..7f177241 100644 --- a/network/wlan/WDI/COMMON/common.vcxproj +++ b/network/wlan/WDI/COMMON/common.vcxproj @@ -1,26 +1,10 @@  - - Win10 Debug - Arm - - - Win10 Debug - Win32 - Win10 Debug x64 - - Win10 Release - Arm - - - Win10 Release - Win32 - Win10 Release x64 @@ -38,7 +22,6 @@ 1.0 $(Configuration.Replace(' ','')) $(BUILD_ALT_DIR)\$(Platform)\ - $(BUILD_ALT_DIR)\ $(SolutionDir)COMMON\$(Configuration)\$(Platform)\ @@ -47,33 +30,10 @@ {956B060D-1055-4584-9CF4-9FE14C428545} - - Windows10 - True - Windows Driver - - - - - Windows10 - False - Windows Driver - - - - - True - Windows Driver - Win8 True - - Windows10 - False - Windows Driver - Windows10 True @@ -88,41 +48,6 @@ DbgengKernelDebugger DbgengRemoteDebugger - - $(VC_IncludePath);$(WindowsSDK_IncludePath); - - - $(VC_ReferencesPath_x86); - $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86 - $(WindowsSDK_MetadataPath); - $(VC_SourcePath); - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x86); - *.cdf;*.cache;*.obj;*.ilk;*.ipdb;*.iobj;*.resources;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;*.tlog;*.manifest;*.res;*.pch;*.exp;*.idb;*.rep;*.xdc;*.pdb;*_manifest.rc;*.bsc;*.sbr;*.xml;*.metagen;*.bi - - - $(VC_IncludePath);$(WindowsSDK_IncludePath); - $(VC_ReferencePath_x86); - $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86 - $(WindowsSDK_MetadataPath); - $(VC_SourcePath); - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x86); - - - $(VC_IncludePath);$(WindowsSDK_IncludePath); - $(VC_ReferencePath_Arm); - $(VC_LibraryPath_Arm);$(WindowsSDK_LibraryPath_Arm);$(NETFXKitsDir)Lib\um\arm - $(WindowsSDK_MetadataPath); - $(VC_SourcePath); - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_arm); - - - $(VC_IncludePath);$(WindowsSDK_IncludePath); - $(VC_ReferencePath_Arm); - $(VC_LibraryPath_Arm);$(WindowsSDK_LibraryPath_Arm);$(NETFXKitsDir)Lib\um\arm - $(WindowsSDK_MetadataPath); - $(VC_SourcePath); - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_arm); - $(VC_IncludePath);$(WindowsSDK_IncludePath); $(VC_ReferencesPath_x64); @@ -139,207 +64,6 @@ $(VC_SourcePath); $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x64); - - - _X86_;DBG;USE_KLOCKS=1;BINARY_COMPATIBLE=0;NDIS650_MINIPORT=1;NDIS640_MINIPORT=1;NDIS630_MINIPORT=1;NDIS620_MINIPORT=1;NDIS61_MINIPORT=1;NDIS_MINIPORT_DRIVER;%(PreprocessorDefinitions) - Disabled - Default - false - Cdecl - Default - $(WindowsSdkDir)\Include\km\;$(WindowsSdkDir)\Include\shared\;$(WindowsSdkDir)\Include\wdf\kmdf\1.15\;$(WindowsSdkDir)\Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)PLATFORM\NDIS6\SDIO\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\; - Neither - false - false - false - true - - - false - EnableFastChecks - MultiThreadedDebugDLL - Default - false - true - true - true - NotUsing - true - false - false - false - false - false - false - false - false - Prompt - true - - - - - $(OutDir)$(TargetName)$(TargetExt) - true - - - false - - - sha256 - - - - - true - Disabled - Default - false - Neither - false - false - false - false - false - false - false - false - true - false - EnableFastChecks - MultiThreadedDebugDLL - Default - false - true - true - true - NotUsing - Cdecl - Default - false - false - false - Prompt - $(WindowsSdkDir)\Include\km\;$(WindowsSdkDir)\Include\shared\;$(WindowsSdkDir)\Include\wdf\kmdf\1.15\;$(WindowsSdkDir)\Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)PLATFORM\NDIS6\SDIO\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\; - _X86_;USE_KLOCKS=1;BINARY_COMPATIBLE=0;NDIS650_MINIPORT=1;NDIS640_MINIPORT=1;NDIS630_MINIPORT=1;NDIS620_MINIPORT=1;NDIS61_MINIPORT=1;NDIS_MINIPORT_DRIVER;%(PreprocessorDefinitions) - true - None - - - $(OutDir)$(TargetName)$(TargetExt) - - - true - - - false - - - sha256 - - - - - $(WindowsSdkDir)\Include\km\;$(WindowsSdkDir)\Include\shared\;$(WindowsSdkDir)\Include\wdf\kmdf\1.15\;$(WindowsSdkDir)\Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)PLATFORM\NDIS6\SDIO\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\; - None - true - Disabled - Default - false - Neither - false - false - false - _ARM_;USE_KLOCKS=1;BINARY_COMPATIBLE=0;NDIS650_MINIPORT=1;NDIS640_MINIPORT=1;NDIS630_MINIPORT=1;NDIS620_MINIPORT=1;NDIS61_MINIPORT=1;NDIS_MINIPORT_DRIVER;%(PreprocessorDefinitions) - false - false - false - false - false - true - false - EnableFastChecks - MultiThreadedDebugDLL - Default - false - true - true - true - NotUsing - Cdecl - Default - false - false - false - Prompt - true - - - $(OutDir)$(TargetName)$(TargetExt) - true - - - false - - - sha256 - - - - - $(WindowsSdkDir)\Include\km\;$(WindowsSdkDir)\Include\shared\;$(WindowsSdkDir)\Include\wdf\kmdf\1.15\;$(WindowsSdkDir)\Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)PLATFORM\NDIS6\SDIO\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\; - - - - - None - - - - - true - Disabled - Default - false - Neither - false - false - false - _ARM_;DBG;USE_KLOCKS=1;BINARY_COMPATIBLE=0;NDIS650_MINIPORT=1;NDIS640_MINIPORT=1;NDIS630_MINIPORT=1;NDIS620_MINIPORT=1;NDIS61_MINIPORT=1;NDIS_MINIPORT_DRIVER;%(PreprocessorDefinitions) - false - false - false - false - false - true - false - EnableFastChecks - MultiThreadedDebugDLL - Default - false - true - true - true - NotUsing - Cdecl - Default - false - false - false - Prompt - true - - - $(OutDir)$(TargetName)$(TargetExt) - true - - - false - - - sha256 - - $(WindowsSdkDir)\Include\km\;$(WindowsSdkDir)\Include\shared\;$(WindowsSdkDir)\Include\wdf\kmdf\1.15\;$(WindowsSdkDir)\Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)PLATFORM\NDIS6\SDIO\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\; diff --git a/network/wlan/WDI/LIB/Arm/hal.lib b/network/wlan/WDI/LIB/Arm/hal.lib deleted file mode 100644 index 794359a7..00000000 Binary files a/network/wlan/WDI/LIB/Arm/hal.lib and /dev/null differ diff --git a/network/wlan/WDI/LIB/Arm/rtklibcom.lib b/network/wlan/WDI/LIB/Arm/rtklibcom.lib deleted file mode 100644 index 356e3860..00000000 Binary files a/network/wlan/WDI/LIB/Arm/rtklibcom.lib and /dev/null differ diff --git a/network/wlan/WDI/LIB/x86/hal.lib b/network/wlan/WDI/LIB/x86/hal.lib deleted file mode 100644 index 41be4e25..00000000 Binary files a/network/wlan/WDI/LIB/x86/hal.lib and /dev/null differ diff --git a/network/wlan/WDI/LIB/x86/rtklibcom.lib b/network/wlan/WDI/LIB/x86/rtklibcom.lib deleted file mode 100644 index b18054af..00000000 Binary files a/network/wlan/WDI/LIB/x86/rtklibcom.lib and /dev/null differ diff --git a/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj b/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj index 057df090..5770eb62 100644 --- a/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj +++ b/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj @@ -1,110 +1,14 @@  - - Win10 Debug - Arm - - - WinBlue Debug - Arm - - - Win8 Debug - Arm - - - Win10 Release - Arm - - - WinBlue Release - Arm - - - Win8 Release - Arm - - - Win10 Debug - Win32 - - - WinBlue Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Vista Debug - Win32 - - - Win10 Release - Win32 - - - WinBlue Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Vista Release - Win32 - Win10 Debug x64 - - WinBlue Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Vista Debug - x64 - Win10 Release x64 - - WinBlue Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - Vista Release - x64 - WindowsKernelModeDriver10.0 @@ -118,8 +22,6 @@ 1.0 $(Configuration.Replace(' ','')) $(BUILD_ALT_DIR)\$(Platform)\ - - $(SolutionDir)\DrvBin\$(Configuration)\$(Platform) @@ -128,185 +30,22 @@ {105EA485-B9B6-48AE-B8B0-96BBEA575973} - - - - True - Windows Driver - true - - - WindowsV6.3 - True - - - Win8 - True - - - - - False - Windows Driver - - - - - WindowsV6.3 - False - - - Win8 - False - - - Windows10 - True - Windows Driver - - - - - WindowsV6.3 - True - - - Win8 - True - - - Win7 - True - - - Vista - True - - - Windows10 - False - Windows Driver - true - - - WindowsV6.3 - False - - - Win8 - False - - - Win7 - False - - - Vista - False - Windows10 True Windows Driver true - - WindowsV6.3 - True - - - Win8 - True - - - Win7 - True - - - Vista - True - Windows10 False Windows Driver true - - WindowsV6.3 - False - - - Win8 - False - - - Win7 - False - - - Vista - False - DbgengKernelDebugger DbgengRemoteDebugger - - $(VC_IncludePath);$(WindowsSDK_IncludePath); - .sys - $(VC_ReferencesPath_x86); - $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86 - $(WindowsSDK_MetadataPath); - $(VC_SourcePath); - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x86); - true - http://timestamp.verisign.com/scripts/timstamp.dll - true - true - false - 10_x86;$(Inf2CatWindowsVersionList) - true - - - $(VC_IncludePath);$(WindowsSDK_IncludePath); - $(VC_ReferencesPath_x86); - $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86 - $(WindowsSDK_MetadataPath); - $(VC_SourcePath); - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x86); - true - http://timestamp.verisign.com/scripts/timstamp.dll - .sys - 10_X86;$(Inf2CatWindowsVersionList) - true - - - .sys - $(VC_IncludePath);$(WindowsSDK_IncludePath); - $(VC_ReferencesPath_arm); - $(VC_LibraryPath_arm);$(WindowsSDK_LibraryPath_arm);$(NETFXKitsDir)Lib\um\arm - $(WindowsSDK_MetadataPath); - $(VC_SourcePath); - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_arm); - false - 6_3_ARM;$(Inf2CatWindowsVersionList) - true - http://timestamp.verisign.com/scripts/timstamp.dll - - - .sys - $(VC_IncludePath);$(WindowsSDK_IncludePath); - $(VC_ReferencesPath_arm); - $(VC_LibraryPath_arm);$(WindowsSDK_LibraryPath_arm);$(NETFXKitsDir)Lib\um\arm - $(WindowsSDK_MetadataPath); - $(VC_SourcePath); - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_arm); - false - 6_3_Arm;$(Inf2CatWindowsVersionList) - true - http://timestamp.verisign.com/scripts/timstamp.dll - http://timestamp.verisign.com/scripts/timstamp.dll true @@ -333,232 +72,6 @@ true http://timestamp.verisign.com/scripts/timstamp.dll - - - $(SolutionDir)COMMON\$(Configuration)\common.lib;$(SolutionDir)PLATFORM\NdisComm\$(Configuration)\NdisComm.lib;$(SolutionDir)\LIB\x86\hal.lib;$(SolutionDir)\LIB\x86\rtklibcom.lib;$(WindowsSDK_LibraryPath_x86)km\x86\ndis.lib;$(WindowsSDK_LibraryPath_x86)km\x86\ntoskrnl.lib;$(WindowsSDK_LibraryPath_x86)km\x86\sdbus.lib;$(WindowsSDK_LibraryPath_x86)km\x86\wlan\1.0\TlvGeneratorParser.lib; - - $(AdditionalOptions) /IGNORE:4099 - $(OutDir)$(TargetName)$(TargetExt) - - - _X86_;DBG;NDIS60_MINIPORT;USE_KLOCKS=1;BINARY_COMPATIBLE=0;NDIS650_MINIPORT=1;NDIS640_MINIPORT=1;NDIS630_MINIPORT=1;NDIS620_MINIPORT=1;NDIS61_MINIPORT=1;NDIS_MINIPORT_DRIVER;%(PreprocessorDefinitions) - Cdecl - Default - $(WindowsSdkDir)Include\km\;$(WindowsSdkDir)Include\shared\;$(WindowsSdkDir)Include\wdf\kmdf\1.15\;$(WindowsSdkDir)Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NDIS6\SDIO;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\;$(SolutionDir)PLATFORM\NDIS6\SDIO;$(SolutionDir)COMMON\;$(SolutionDir)PLATFORM\NDIS6; - Disabled - Default - false - Neither - false - false - false - true - - - false - EnableFastChecks - MultiThreadedDebugDLL - Default - false - true - true - true - NotUsing - true - true - false - false - false - false - false - false - false - false - Prompt - true - true - - - true - false - - - sha256 - - - - - $(WindowsSdkDir)Include\km\;$(WindowsSdkDir)Include\shared\;$(WindowsSdkDir)Include\wdf\kmdf\1.15\;$(WindowsSdkDir)Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NDIS6\SDIO;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\;$(SolutionDir)PLATFORM\NDIS6\SDIO;$(SolutionDir)COMMON\;$(SolutionDir)PLATFORM\NDIS6; - true - true - Disabled - Default - false - Neither - false - false - false - _X86_;NDIS60_MINIPORT;USE_KLOCKS=1;BINARY_COMPATIBLE=0;NDIS650_MINIPORT=1;NDIS640_MINIPORT=1;NDIS630_MINIPORT=1;NDIS620_MINIPORT=1;NDIS61_MINIPORT=1;NDIS_MINIPORT_DRIVER;%(PreprocessorDefinitions) - false - false - false - false - false - true - false - EnableFastChecks - MultiThreadedDebugDLL - Default - false - true - true - true - NotUsing - Cdecl - Default - false - false - false - Prompt - true - None - - - - $(AdditionalOptions) /IGNORE:4099 - $(OutDir)$(TargetName)$(TargetExt) - $(SolutionDir)COMMON\$(Configuration)\common.lib;$(SolutionDir)PLATFORM\NdisComm\$(Configuration)\NdisComm.lib;$(SolutionDir)\LIB\x86\hal.lib;$(SolutionDir)\LIB\x86\rtklibcom.lib;$(WindowsSDK_LibraryPath_x86)km\x86\ndis.lib;$(WindowsSDK_LibraryPath_x86)km\x86\ntoskrnl.lib;$(WindowsSDK_LibraryPath_x86)km\x86\sdbus.lib;$(WindowsSDK_LibraryPath_x86)km\x86\wlan\1.0\TlvGeneratorParser.lib; - - - - - - - - - true - - - false - - - sha256 - - - - - $(WindowsSdkDir)Include\km\;$(WindowsSdkDir)Include\shared\;$(WindowsSdkDir)Include\wdf\kmdf\1.15\;$(WindowsSdkDir)Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NDIS6\SDIO;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\;$(SolutionDir)PLATFORM\NDIS6\SDIO;$(SolutionDir)COMMON\;$(SolutionDir)PLATFORM\NDIS6; - None - true - true - Disabled - Default - false - Neither - false - false - false - _ARM_;NDIS60_MINIPORT;USE_KLOCKS=1;BINARY_COMPATIBLE=0;NDIS650_MINIPORT=1;NDIS640_MINIPORT=1;NDIS630_MINIPORT=1;NDIS620_MINIPORT=1;NDIS61_MINIPORT=1;NDIS_MINIPORT_DRIVER;%(PreprocessorDefinitions) - false - false - false - false - false - true - false - EnableFastChecks - MultiThreadedDebugDLL - Default - false - true - true - true - NotUsing - Cdecl - Default - false - false - false - Prompt - true - - - $(OutDir)$(TargetName)$(TargetExt) - $(SolutionDir)COMMON\$(Configuration)\$(Platform)\common.lib;$(SolutionDir)PLATFORM\NdisComm\$(Configuration)\$(Platform)\NdisComm.lib;$(SolutionDir)\LIB\Arm\hal.lib;$(SolutionDir)\LIB\Arm\rtklibcom.lib;$(WindowsSDK_LibraryPath_arm)km\arm\ndis.lib;$(WindowsSDK_LibraryPath_arm)km\arm\ntoskrnl.lib;$(WindowsSDK_LibraryPath_arm)km\arm\sdbus.lib;$(WindowsSDK_LibraryPath_arm)km\arm\wlan\1.0\TlvGeneratorParser.lib; - - - true - - - false - - - sha256 - - - - - $(WindowsSdkDir)Include\km\;$(WindowsSdkDir)Include\shared\;$(WindowsSdkDir)Include\wdf\kmdf\1.15\;$(WindowsSdkDir)Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NDIS6\SDIO;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\;$(SolutionDir)PLATFORM\NDIS6\SDIO;$(SolutionDir)COMMON\;$(SolutionDir)PLATFORM\NDIS6; - None - true - true - Disabled - Default - false - Neither - false - false - false - _ARM_;DBG;NDIS60_MINIPORT;USE_KLOCKS=1;BINARY_COMPATIBLE=0;NDIS650_MINIPORT=1;NDIS640_MINIPORT=1;NDIS630_MINIPORT=1;NDIS620_MINIPORT=1;NDIS61_MINIPORT=1;NDIS_MINIPORT_DRIVER;%(PreprocessorDefinitions) - false - false - false - false - false - true - false - EnableFastChecks - MultiThreadedDebugDLL - Default - false - true - true - true - NotUsing - Cdecl - Default - false - false - false - Prompt - true - - - $(OutDir)$(TargetName)$(TargetExt) - $(SolutionDir)COMMON\$(Configuration)\common.lib;$(SolutionDir)PLATFORM\NdisComm\$(Configuration)\NdisComm.lib;$(SolutionDir)\LIB\Arm\hal.lib;$(SolutionDir)\LIB\Arm\rtklibcom.lib;$(WindowsSDK_LibraryPath_arm)km\arm\ndis.lib;$(WindowsSDK_LibraryPath_arm)km\arm\ntoskrnl.lib;$(WindowsSDK_LibraryPath_arm)km\arm\sdbus.lib;$(WindowsSDK_LibraryPath_arm)km\arm\wlan\1.0\TlvGeneratorParser.lib; - - - true - - - false - - - sha256 - - - sha256 - - - sha256 - - - sha256 - - - sha256 - - true @@ -665,106 +178,6 @@ sha256 - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - @@ -779,20 +192,6 @@ - - - - - - - - - - - - - - @@ -801,26 +200,6 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/network/wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj b/network/wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj index ec170811..eecb8f97 100644 --- a/network/wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj +++ b/network/wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj @@ -1,110 +1,14 @@  - - Win10 Debug - Arm - - - Win10 Debug - Win32 - Win10 Debug x64 - - Win10 Release - Arm - - - Win10 Release - Win32 - Win10 Release x64 - - WinBlue Debug - Arm - - - Win8 Debug - Arm - - - WinBlue Release - Arm - - - Win8 Release - Arm - - - WinBlue Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Vista Debug - Win32 - - - WinBlue Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Vista Release - Win32 - - - WinBlue Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Vista Debug - x64 - - - WinBlue Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - Vista Release - x64 - WindowsKernelModeDriver10.0 @@ -119,7 +23,6 @@ 1.0 $(Configuration.Replace(' ','')) $(BUILD_ALT_DIR)\$(Platform)\ - $(BUILD_ALT_DIR)\ $(SolutionDir)PLATFORM\NdisComm\$(Configuration)\$(Platform)\ @@ -128,152 +31,20 @@ {C0A51792-1338-4294-ADAA-EDC4EE30CF05} - - WindowsV6.3 - True - - - Windows10 - True - Windows Driver - - - Win8 - True - - - WindowsV6.3 - False - - - Windows10 - False - Windows Driver - - - Win8 - False - - - WindowsV6.3 - True - - - Windows10 - True - Windows Driver - - - Win8 - True - - - Win7 - True - - - Vista - True - - - WindowsV6.3 - False - - - Windows10 - False - Windows Driver - - - Win8 - False - - - Win7 - False - - - Vista - False - - - WindowsV6.3 - True - Windows10 True Windows Driver - - Win8 - True - - - Win7 - True - - - Vista - True - - - WindowsV6.3 - False - Windows10 False Windows Driver - - Win8 - False - - - Win7 - False - - - Vista - False - DbgengKernelDebugger DbgengRemoteDebugger - - $(VC_IncludePath);$(WindowsSDK_IncludePath); - $(VC_ReferencesPath_x86); - $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86 - $(WindowsSDK_MetadataPath); - $(VC_SourcePath); - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x86); - - - $(VC_IncludePath);$(WindowsSDK_IncludePath); - $(VC_ReferencePath_x86); - $(WindowsSDK_MetadataPath); - $(VC_SourcePath); - $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86 - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x86); - - - $(VC_IncludePath);$(WindowsSDK_IncludePath); - $(VC_ReferencePath_arm); - $(VC_LibraryPath_arm);$(WindowsSDK_LibraryPath_arm);$(NETFXKitsDir)Lib\um\arm - $(WindowsSDK_MetadataPath); - $(VC_SourcePath); - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_arm); - - - $(VC_IncludePath);$(WindowsSDK_IncludePath); - $(VC_ReferencePath_arm); - $(VC_LibraryPath_arm);$(WindowsSDK_LibraryPath_arm);$(NETFXKitsDir)Lib\um\arm - $(WindowsSDK_MetadataPath); - $(VC_SourcePath); - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_arm); - $(VC_IncludePath);$(WindowsSDK_IncludePath); $(VC_ReferencesPath_x64); @@ -290,219 +61,6 @@ $(VC_SourcePath); $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x64); - - - _X86_;DBG;USE_KLOCKS=1;BINARY_COMPATIBLE=0;NDIS650_MINIPORT=1;NDIS640_MINIPORT=1;NDIS630_MINIPORT=1;NDIS620_MINIPORT=1;NDIS61_MINIPORT=1;NDIS_MINIPORT_DRIVER;%(PreprocessorDefinitions) - Cdecl - Default - $(WindowsSdkDir)\Include\km\;$(WindowsSdkDir)\Include\shared\;$(WindowsSdkDir)\Include\wdf\kmdf\1.15\;$(WindowsSdkDir)\Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)PLATFORM\NDIS6\SDIO\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\;$(SolutionDir)COMMON\; - Disabled - Default - false - Neither - false - false - false - true - - - false - EnableFastChecks - MultiThreadedDebugDLL - Default - false - true - true - true - NotUsing - false - None - true - true - false - false - false - false - false - false - false - false - Prompt - true - - - $(OutDir)$(TargetName)$(TargetExt) - true - - - false - - - sha256 - - - - - $(OutDir)$(TargetName)$(TargetExt) - - - - - true - - - - - false - - - true - Disabled - Default - false - Neither - false - false - false - false - false - false - false - false - true - false - EnableFastChecks - MultiThreadedDebugDLL - Default - false - true - true - true - NotUsing - Cdecl - Default - false - false - false - Prompt - $(WindowsSdkDir)\Include\km\;$(WindowsSdkDir)\Include\shared\;$(WindowsSdkDir)\Include\wdf\kmdf\1.15\;$(WindowsSdkDir)\Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)PLATFORM\NDIS6\SDIO\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\;$(SolutionDir)COMMON\; - None - true - _X86_;USE_KLOCKS=1;BINARY_COMPATIBLE=0;NDIS650_MINIPORT=1;NDIS640_MINIPORT=1;NDIS630_MINIPORT=1;NDIS620_MINIPORT=1;NDIS61_MINIPORT=1;NDIS_MINIPORT_DRIVER;%(PreprocessorDefinitions) - true - - - sha256 - - - - - $(WindowsSdkDir)\Include\km\;$(WindowsSdkDir)\Include\shared\;$(WindowsSdkDir)\Include\wdf\kmdf\1.15\;$(WindowsSdkDir)\Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)PLATFORM\NDIS6\SDIO\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\;$(SolutionDir)COMMON\; - None - true - true - Disabled - Default - false - Neither - false - false - false - _ARM_;USE_KLOCKS=1;BINARY_COMPATIBLE=0;NDIS650_MINIPORT=1;NDIS640_MINIPORT=1;NDIS630_MINIPORT=1;NDIS620_MINIPORT=1;NDIS61_MINIPORT=1;NDIS_MINIPORT_DRIVER;%(PreprocessorDefinitions) - false - false - false - false - false - true - false - EnableFastChecks - MultiThreadedDebugDLL - Default - false - true - true - true - NotUsing - Cdecl - Default - false - false - false - Prompt - true - - - $(OutDir)$(TargetName)$(TargetExt) - true - - - false - - - sha256 - - - - - true - $(WindowsSdkDir)\Include\km\;$(WindowsSdkDir)\Include\shared\;$(WindowsSdkDir)\Include\wdf\kmdf\1.15\;$(WindowsSdkDir)\Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)PLATFORM\NDIS6\SDIO\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\;$(SolutionDir)COMMON\; - None - true - true - Disabled - Default - false - Neither - false - false - false - _ARM_;DBG;USE_KLOCKS=1;BINARY_COMPATIBLE=0;NDIS650_MINIPORT=1;NDIS640_MINIPORT=1;NDIS630_MINIPORT=1;NDIS620_MINIPORT=1;NDIS61_MINIPORT=1;NDIS_MINIPORT_DRIVER;%(PreprocessorDefinitions) - false - false - false - false - false - true - false - EnableFastChecks - MultiThreadedDebugDLL - Default - false - true - true - true - NotUsing - Cdecl - Default - false - false - false - Prompt - - - $(OutDir)$(TargetName)$(TargetExt) - true - - - false - - - sha256 - - - sha256 - - - sha256 - - - sha256 - - - sha256 - - true @@ -603,106 +161,6 @@ sha256 - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf deleted file mode 100644 index 7de18adb..00000000 Binary files a/network/wlan/WDI/PLATFORM/WinInf/SDIO/arm/netrtwlans.inf and /dev/null differ diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf deleted file mode 100644 index 71d52227..00000000 Binary files a/network/wlan/WDI/PLATFORM/WinInf/SDIO/netrtwlans.inf and /dev/null differ diff --git a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf b/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf deleted file mode 100644 index 00079d29..00000000 Binary files a/network/wlan/WDI/PLATFORM/WinInf/SDIO/x86/netrtwlans.inf and /dev/null differ diff --git a/network/wlan/WDI/windows.msbuild.rtwssample.sln b/network/wlan/WDI/windows.msbuild.rtwssample.sln index 0d8732a8..ccca5278 100644 --- a/network/wlan/WDI/windows.msbuild.rtwssample.sln +++ b/network/wlan/WDI/windows.msbuild.rtwssample.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33530.505 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdio", "PLATFORM\NDIS6\SDIO\sdio.vcxproj", "{105EA485-B9B6-48AE-B8B0-96BBEA575973}" ProjectSection(ProjectDependencies) = postProject @@ -15,65 +15,25 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NdisComm", "PLATFORM\NdisCo EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Win10 Debug|Arm = Win10 Debug|Arm - Win10 Debug|Win32 = Win10 Debug|Win32 Win10 Debug|x64 = Win10 Debug|x64 - Win10 Release|Arm = Win10 Release|Arm - Win10 Release|Win32 = Win10 Release|Win32 Win10 Release|x64 = Win10 Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Debug|Arm.ActiveCfg = Win10 Debug|Arm - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Debug|Arm.Build.0 = Win10 Debug|Arm - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Debug|Arm.Deploy.0 = Win10 Debug|Arm - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Debug|Win32.Deploy.0 = Win10 Debug|Win32 {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Debug|x64.Deploy.0 = Win10 Debug|x64 - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Release|Arm.ActiveCfg = Win10 Release|Arm - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Release|Arm.Build.0 = Win10 Release|Arm - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Release|Arm.Deploy.0 = Win10 Release|Arm - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Release|Win32.Deploy.0 = Win10 Release|Win32 {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Release|x64.Build.0 = Win10 Release|x64 {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Release|x64.Deploy.0 = Win10 Release|x64 - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Debug|Arm.ActiveCfg = Win10 Debug|Arm - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Debug|Arm.Build.0 = Win10 Debug|Arm - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Debug|Arm.Deploy.0 = Win10 Debug|Arm - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Debug|Win32.Deploy.0 = Win10 Debug|Win32 {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Debug|x64.Deploy.0 = Win10 Debug|x64 - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Release|Arm.ActiveCfg = Win10 Release|Arm - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Release|Arm.Build.0 = Win10 Release|Arm - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Release|Arm.Deploy.0 = Win10 Release|Arm - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Release|Win32.Deploy.0 = Win10 Release|Win32 {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Release|x64.Build.0 = Win10 Release|x64 {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Release|x64.Deploy.0 = Win10 Release|x64 - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Debug|Arm.ActiveCfg = Win10 Debug|Arm - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Debug|Arm.Build.0 = Win10 Debug|Arm - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Debug|Arm.Deploy.0 = Win10 Debug|Arm - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Debug|Win32.Deploy.0 = Win10 Debug|Win32 {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Debug|x64.Deploy.0 = Win10 Debug|x64 - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Release|Arm.ActiveCfg = Win10 Release|Arm - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Release|Arm.Build.0 = Win10 Release|Arm - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Release|Arm.Deploy.0 = Win10 Release|Arm - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Release|Win32.Deploy.0 = Win10 Release|Win32 {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Release|x64.Build.0 = Win10 Release|x64 {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Release|x64.Deploy.0 = Win10 Release|x64 -- cgit v1.3.1 From c1a5bd8668e2f3bfe36fcdf64e665e3205f432c6 Mon Sep 17 00:00:00 2001 From: Julia D'Zmura <78620953+judzmura@users.noreply.github.com> Date: Thu, 1 Jun 2023 09:34:32 -0700 Subject: [audio/Acx] Remove ARM and x86 platforms from AudioCodec sample driver (#987) --- audio/Acx/Samples/AudioCodec/Driver/AudioCodec.sln | 28 ----- .../Samples/AudioCodec/Driver/AudioCodec.vcxproj | 131 +-------------------- audio/Acx/Samples/Common/SamplesCommon.vcxproj | 127 +------------------- 3 files changed, 2 insertions(+), 284 deletions(-) diff --git a/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.sln b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.sln index 980e7ad6..1cedca27 100644 --- a/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.sln +++ b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.sln @@ -16,64 +16,36 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AudioCodec", "AudioCodec.vc EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|ARM = Release|ARM Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 - Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|ARM.ActiveCfg = Debug|ARM - {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|ARM.Build.0 = Debug|ARM - {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|ARM.Deploy.0 = Debug|ARM {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|ARM64.ActiveCfg = Debug|ARM64 {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|ARM64.Build.0 = Debug|ARM64 {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|ARM64.Deploy.0 = Debug|ARM64 {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|x64.ActiveCfg = Debug|x64 {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|x64.Build.0 = Debug|x64 {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|x64.Deploy.0 = Debug|x64 - {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|x86.ActiveCfg = Debug|Win32 - {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|x86.Build.0 = Debug|Win32 - {C575002D-5FDE-43C7-AB19-EE846A20083A}.Debug|x86.Deploy.0 = Debug|Win32 - {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|ARM.ActiveCfg = Release|ARM - {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|ARM.Build.0 = Release|ARM - {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|ARM.Deploy.0 = Release|ARM {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|ARM64.ActiveCfg = Release|ARM64 {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|ARM64.Build.0 = Release|ARM64 {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|ARM64.Deploy.0 = Release|ARM64 {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|x64.ActiveCfg = Release|x64 {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|x64.Build.0 = Release|x64 {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|x64.Deploy.0 = Release|x64 - {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|x86.ActiveCfg = Release|Win32 - {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|x86.Build.0 = Release|Win32 - {C575002D-5FDE-43C7-AB19-EE846A20083A}.Release|x86.Deploy.0 = Release|Win32 - {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|ARM.ActiveCfg = Debug|ARM - {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|ARM.Build.0 = Debug|ARM - {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|ARM.Deploy.0 = Debug|ARM {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|ARM64.ActiveCfg = Debug|ARM64 {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|ARM64.Build.0 = Debug|ARM64 {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|ARM64.Deploy.0 = Debug|ARM64 {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|x64.ActiveCfg = Debug|x64 {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|x64.Build.0 = Debug|x64 {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|x64.Deploy.0 = Debug|x64 - {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|x86.ActiveCfg = Debug|Win32 - {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|x86.Build.0 = Debug|Win32 - {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Debug|x86.Deploy.0 = Debug|Win32 - {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|ARM.ActiveCfg = Release|ARM - {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|ARM.Build.0 = Release|ARM - {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|ARM.Deploy.0 = Release|ARM {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|ARM64.ActiveCfg = Release|ARM64 {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|ARM64.Build.0 = Release|ARM64 {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|ARM64.Deploy.0 = Release|ARM64 {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|x64.ActiveCfg = Release|x64 {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|x64.Build.0 = Release|x64 {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|x64.Deploy.0 = Release|x64 - {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|x86.ActiveCfg = Release|Win32 - {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|x86.Build.0 = Release|Win32 - {6A946D59-6690-4ED0-A77D-7D4C3D4B3241}.Release|x86.Deploy.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.vcxproj b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.vcxproj index 68389954..0cdc9e61 100644 --- a/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.vcxproj +++ b/audio/Acx/Samples/AudioCodec/Driver/AudioCodec.vcxproj @@ -1,14 +1,6 @@ - - Debug - Win32 - - - Release - Win32 - Debug x64 @@ -17,14 +9,6 @@ Release x64 - - Debug - ARM - - - Release - ARM - Debug ARM64 @@ -57,27 +41,10 @@ v4.5 12.0 Debug - Win32 AudioCodec $(LatestTargetPlatformVersion) - - Windows10 - true - WindowsKernelModeDriver10.0 - Driver - KMDF - Windows Driver - - - Windows10 - false - WindowsKernelModeDriver10.0 - Driver - KMDF - Windows Driver - Windows10 true @@ -94,22 +61,6 @@ KMDF Windows Driver - - Windows10 - true - WindowsKernelModeDriver10.0 - Driver - KMDF - Windows Driver - - - Windows10 - false - WindowsKernelModeDriver10.0 - Driver - KMDF - Windows Driver - Windows10 true @@ -134,14 +85,6 @@ - - DbgengKernelDebugger - $(IntDir) - - - DbgengKernelDebugger - $(IntDir) - DbgengKernelDebugger $(IntDir) @@ -150,14 +93,6 @@ DbgengKernelDebugger $(IntDir) - - DbgengKernelDebugger - $(IntDir) - - - DbgengKernelDebugger - $(IntDir) - DbgengKernelDebugger $(IntDir) @@ -166,38 +101,6 @@ DbgengKernelDebugger $(IntDir) - - - true - true - ..\..\common\trace_macros.h - true - $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR);..\..\common;..\..\inc;..\..\shared;%(AdditionalIncludeDirectories) - ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) - - - sha256 - - - $(DDK_LIB_PATH)\libcntpr.lib;wpprecorder.lib;acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR)\acxstub.lib;..\..\Common\$(IntDir)\SamplesCommon.lib;%(AdditionalDependencies) - - - - - true - true - ..\..\common\trace_macros.h - true - $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR);..\..\common;..\..\inc;..\..\shared;%(AdditionalIncludeDirectories) - ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) - - - sha256 - - - $(DDK_LIB_PATH)\libcntpr.lib;wpprecorder.lib;acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR)\acxstub.lib;..\..\Common\$(IntDir)\SamplesCommon.lib;%(AdditionalDependencies) - - true @@ -230,38 +133,6 @@ $(DDK_LIB_PATH)\libcntpr.lib;wpprecorder.lib;acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR)\acxstub.lib;..\..\Common\$(IntDir)\SamplesCommon.lib;%(AdditionalDependencies) - - - true - true - ..\..\common\trace_macros.h - true - $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR);..\..\common;..\..\inc;..\..\shared;%(AdditionalIncludeDirectories) - ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) - - - sha256 - - - $(DDK_LIB_PATH)\libcntpr.lib;wpprecorder.lib;acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR)\acxstub.lib;..\..\Common\$(IntDir)\SamplesCommon.lib;%(AdditionalDependencies) - - - - - true - true - ..\..\common\trace_macros.h - true - $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR);..\..\common;..\..\inc;..\..\shared;%(AdditionalIncludeDirectories) - ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=25;%(PreprocessorDefinitions) - - - sha256 - - - $(DDK_LIB_PATH)\libcntpr.lib;wpprecorder.lib;acx\km\$(ACX_VERSION_MAJOR).$(ACX_VERSION_MINOR)\acxstub.lib;..\..\Common\$(IntDir)\SamplesCommon.lib;%(AdditionalDependencies) - - true @@ -300,4 +171,4 @@ - \ No newline at end of file + diff --git a/audio/Acx/Samples/Common/SamplesCommon.vcxproj b/audio/Acx/Samples/Common/SamplesCommon.vcxproj index 85e164d7..0932d59a 100644 --- a/audio/Acx/Samples/Common/SamplesCommon.vcxproj +++ b/audio/Acx/Samples/Common/SamplesCommon.vcxproj @@ -1,14 +1,6 @@ - - Debug - Win32 - - - Release - Win32 - Debug x64 @@ -17,14 +9,6 @@ Release x64 - - Debug - ARM - - - Release - ARM - Debug ARM64 @@ -40,31 +24,10 @@ v4.5 12.0 Debug - Win32 SamplesCommon $(LatestTargetPlatformVersion) - - Windows10 - true - WindowsKernelModeDriver10.0 - StaticLibrary - KMDF - Windows Driver - 1 - 31 - - - Windows10 - false - WindowsKernelModeDriver10.0 - StaticLibrary - KMDF - Windows Driver - 1 - 31 - Windows10 true @@ -85,26 +48,6 @@ 1 31 - - Windows10 - true - WindowsKernelModeDriver10.0 - StaticLibrary - KMDF - Windows Driver - 1 - 31 - - - Windows10 - false - WindowsKernelModeDriver10.0 - StaticLibrary - KMDF - Windows Driver - 1 - 31 - Windows10 true @@ -133,14 +76,6 @@ - - DbgengKernelDebugger - $(IntDir) - - - DbgengKernelDebugger - $(IntDir) - DbgengKernelDebugger $(IntDir) @@ -149,14 +84,6 @@ DbgengKernelDebugger $(IntDir) - - DbgengKernelDebugger - $(IntDir) - - - DbgengKernelDebugger - $(IntDir) - DbgengKernelDebugger $(IntDir) @@ -165,32 +92,6 @@ DbgengKernelDebugger $(IntDir) - - - true - true - trace_macros.h - true - $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\1.1;..\inc;..\shared;%(AdditionalIncludeDirectories) - ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) - - - sha256 - - - - - true - true - trace_macros.h - true - $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\1.1;..\inc;..\shared;%(AdditionalIncludeDirectories) - ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) - - - sha256 - - true @@ -217,32 +118,6 @@ sha256 - - - true - true - trace_macros.h - true - $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\1.1;..\inc;..\shared;%(AdditionalIncludeDirectories) - ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) - - - sha256 - - - - - true - true - trace_macros.h - true - $(SDK_INC_PATH);$(DDK_INC_PATH)\acx\km\1.1;..\inc;..\shared;%(AdditionalIncludeDirectories) - ACX_VERSION_MAJOR=1;ACX_VERSION_MINOR=1;KMDF_VERSION_MAJOR=1;KMDF_VERSION_MINOR=31;%(PreprocessorDefinitions) - - - sha256 - - true @@ -301,4 +176,4 @@ - \ No newline at end of file + -- cgit v1.3.1 From d2c881061d1545ff449ca64b72c2c4bdc37d622b Mon Sep 17 00:00:00 2001 From: Adonais Romero González Date: Thu, 1 Jun 2023 15:48:54 -0700 Subject: [network/wlan/WDI] Rename configurations (#988) --- exclusions.csv | 1 - network/wlan/WDI/COMMON/common.vcxproj | 22 ++++++------ network/wlan/WDI/HAL/HALSOURCE/hal.vcxproj | 36 +++++++++---------- network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj | 28 +++++++-------- .../wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj | 20 +++++------ network/wlan/WDI/windows.msbuild.rtwssample.sln | 40 +++++++++++----------- 6 files changed, 73 insertions(+), 74 deletions(-) diff --git a/exclusions.csv b/exclusions.csv index af7bb3e3..83e5a880 100644 --- a/exclusions.csv +++ b/exclusions.csv @@ -5,7 +5,6 @@ general\dchu\osrfx2_dchu_extension_tight,Wrong Toolset - needs migration general\winhec 2017 lab\toaster driver,Needs input from end user general\winhec 2017 lab\toaster support app,Needs input from end user network\trans\wfpsampler,Missing INF section; missing libs -network\wlan\wdi,Invalid architecture print\oem printer customization plug-in samples\c++,Invalid architecture print\v4printdriversamples\printerextensionsample,Invalid architecture tree,Missing headers diff --git a/network/wlan/WDI/COMMON/common.vcxproj b/network/wlan/WDI/COMMON/common.vcxproj index 7f177241..e6f6a941 100644 --- a/network/wlan/WDI/COMMON/common.vcxproj +++ b/network/wlan/WDI/COMMON/common.vcxproj @@ -1,12 +1,12 @@  - - Win10 Debug + + Debug x64 - - Win10 Release + + Release x64 @@ -15,7 +15,7 @@ StaticLibrary KMDF $(ProjectName) - Win10 Debug + Debug @@ -34,12 +34,12 @@ Win8 True - + Windows10 True Windows Driver - + Windows10 False Windows Driver @@ -48,7 +48,7 @@ DbgengKernelDebugger DbgengRemoteDebugger - + $(VC_IncludePath);$(WindowsSDK_IncludePath); $(VC_ReferencesPath_x64); $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 @@ -56,7 +56,7 @@ $(VC_SourcePath); $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x64); - + $(VC_IncludePath);$(WindowsSDK_IncludePath); $(VC_ReferencesPath_x64); $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 @@ -64,7 +64,7 @@ $(VC_SourcePath); $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x64); - + $(WindowsSdkDir)\Include\km\;$(WindowsSdkDir)\Include\shared\;$(WindowsSdkDir)\Include\wdf\kmdf\1.15\;$(WindowsSdkDir)\Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)PLATFORM\NDIS6\SDIO\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\; true @@ -112,7 +112,7 @@ sha256 - + true $(WindowsSdkDir)\Include\km\;$(WindowsSdkDir)\Include\shared\;$(WindowsSdkDir)\Include\wdf\kmdf\1.15\;$(WindowsSdkDir)\Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)PLATFORM\NDIS6\SDIO\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\; diff --git a/network/wlan/WDI/HAL/HALSOURCE/hal.vcxproj b/network/wlan/WDI/HAL/HALSOURCE/hal.vcxproj index 7fe68165..30586499 100644 --- a/network/wlan/WDI/HAL/HALSOURCE/hal.vcxproj +++ b/network/wlan/WDI/HAL/HALSOURCE/hal.vcxproj @@ -1,28 +1,28 @@  - - Win10 Debug + + Debug Arm - - Win10 Debug + + Debug Win32 - - Win10 Debug + + Debug x64 - - Win10 Release + + Release Arm - - Win10 Release + + Release Win32 - - Win10 Release + + Release x64 @@ -132,7 +132,7 @@ WindowsV6.3 True - + Windows10 True Mobile @@ -145,7 +145,7 @@ WindowsV6.3 False - + Windows10 False Mobile @@ -158,7 +158,7 @@ WindowsV6.3 True - + Windows10 True @@ -178,7 +178,7 @@ WindowsV6.3 False - + Windows10 False @@ -198,7 +198,7 @@ WindowsV6.3 True - + Windows10 True @@ -218,7 +218,7 @@ WindowsV6.3 False - + Windows10 False diff --git a/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj b/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj index 5770eb62..cfc0e2fa 100644 --- a/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj +++ b/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj @@ -1,12 +1,12 @@  - - Win10 Debug + + Debug x64 - - Win10 Release + + Release x64 @@ -30,13 +30,13 @@ {105EA485-B9B6-48AE-B8B0-96BBEA575973} - + Windows10 True Windows Driver true - + Windows10 False Windows Driver @@ -46,7 +46,7 @@ DbgengKernelDebugger DbgengRemoteDebugger - + http://timestamp.verisign.com/scripts/timstamp.dll true 10_x64;$(Inf2CatWindowsVersionList) @@ -59,7 +59,7 @@ $(VC_SourcePath); $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x64); - + .sys $(VC_IncludePath);$(WindowsSDK_IncludePath); $(VC_ReferencesPath_x64); @@ -72,7 +72,7 @@ true http://timestamp.verisign.com/scripts/timstamp.dll - + true $(WindowsSdkDir)Include\km\;$(WindowsSdkDir)Include\shared\;$(WindowsSdkDir)Include\wdf\kmdf\1.15\;$(WindowsSdkDir)Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NDIS6\SDIO;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\;$(SolutionDir)PLATFORM\NDIS6\SDIO;$(SolutionDir)COMMON\;$(SolutionDir)PLATFORM\NDIS6; @@ -125,7 +125,7 @@ sha256 - + $(WindowsSdkDir)Include\km\;$(WindowsSdkDir)Include\shared\;$(WindowsSdkDir)Include\wdf\kmdf\1.15\;$(WindowsSdkDir)Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NDIS6\SDIO;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\;$(SolutionDir)PLATFORM\NDIS6\SDIO;$(SolutionDir)COMMON\;$(SolutionDir)PLATFORM\NDIS6; None @@ -184,19 +184,19 @@ - + - + - + - + diff --git a/network/wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj b/network/wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj index eecb8f97..a7bdea25 100644 --- a/network/wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj +++ b/network/wlan/WDI/PLATFORM/NdisComm/NdisComm.vcxproj @@ -1,12 +1,12 @@  - - Win10 Debug + + Debug x64 - - Win10 Release + + Release x64 @@ -31,12 +31,12 @@ {C0A51792-1338-4294-ADAA-EDC4EE30CF05} - + Windows10 True Windows Driver - + Windows10 False Windows Driver @@ -45,7 +45,7 @@ DbgengKernelDebugger DbgengRemoteDebugger - + $(VC_IncludePath);$(WindowsSDK_IncludePath); $(VC_ReferencesPath_x64); $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 @@ -53,7 +53,7 @@ $(VC_SourcePath); $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x64); - + $(VC_IncludePath);$(WindowsSDK_IncludePath); $(VC_ReferencesPath_x64); $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 @@ -61,7 +61,7 @@ $(VC_SourcePath); $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x64); - + true $(WindowsSdkDir)\Include\km\;$(WindowsSdkDir)\Include\shared\;$(WindowsSdkDir)\Include\wdf\kmdf\1.15\;$(WindowsSdkDir)\Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)PLATFORM\NDIS6\SDIO\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\;$(SolutionDir)COMMON\; @@ -111,7 +111,7 @@ sha256 - + true $(WindowsSdkDir)\Include\km\;$(WindowsSdkDir)\Include\shared\;$(WindowsSdkDir)\Include\wdf\kmdf\1.15\;$(WindowsSdkDir)\Include\km\crt\;$(SolutionDir)HEADER;$(SolutionDir)PLATFORM\NDIS6\;$(SolutionDir)PLATFORM\NdisComm\;$(SolutionDir)PLATFORM\NDIS6\SDIO\;$(SolutionDir)HAL\;$(SolutionDir)HAL\phydm\;$(SolutionDir)HAL\rtl8723B\;$(SolutionDir)HAL\rtl8723B\rtl8723bs\;$(SolutionDir)HAL\phydm\rtl8723b\;$(SolutionDir)COMMON\; diff --git a/network/wlan/WDI/windows.msbuild.rtwssample.sln b/network/wlan/WDI/windows.msbuild.rtwssample.sln index ccca5278..291992f1 100644 --- a/network/wlan/WDI/windows.msbuild.rtwssample.sln +++ b/network/wlan/WDI/windows.msbuild.rtwssample.sln @@ -15,28 +15,28 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NdisComm", "PLATFORM\NdisCo EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Win10 Debug|x64 = Win10 Debug|x64 - Win10 Release|x64 = Win10 Release|x64 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Debug|x64.Deploy.0 = Win10 Debug|x64 - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Win10 Release|x64.Deploy.0 = Win10 Release|x64 - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Debug|x64.Deploy.0 = Win10 Debug|x64 - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {956B060D-1055-4584-9CF4-9FE14C428545}.Win10 Release|x64.Deploy.0 = Win10 Release|x64 - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Debug|x64.Deploy.0 = Win10 Debug|x64 - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Win10 Release|x64.Deploy.0 = Win10 Release|x64 + {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Debug|x64.ActiveCfg = Debug|x64 + {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Debug|x64.Build.0 = Debug|x64 + {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Debug|x64.Deploy.0 = Debug|x64 + {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Release|x64.ActiveCfg = Release|x64 + {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Release|x64.Build.0 = Release|x64 + {105EA485-B9B6-48AE-B8B0-96BBEA575973}.Release|x64.Deploy.0 = Release|x64 + {956B060D-1055-4584-9CF4-9FE14C428545}.Debug|x64.ActiveCfg = Debug|x64 + {956B060D-1055-4584-9CF4-9FE14C428545}.Debug|x64.Build.0 = Debug|x64 + {956B060D-1055-4584-9CF4-9FE14C428545}.Debug|x64.Deploy.0 = Debug|x64 + {956B060D-1055-4584-9CF4-9FE14C428545}.Release|x64.ActiveCfg = Release|x64 + {956B060D-1055-4584-9CF4-9FE14C428545}.Release|x64.Build.0 = Release|x64 + {956B060D-1055-4584-9CF4-9FE14C428545}.Release|x64.Deploy.0 = Release|x64 + {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Debug|x64.ActiveCfg = Debug|x64 + {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Debug|x64.Build.0 = Debug|x64 + {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Debug|x64.Deploy.0 = Debug|x64 + {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Release|x64.ActiveCfg = Release|x64 + {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Release|x64.Build.0 = Release|x64 + {C0A51792-1338-4294-ADAA-EDC4EE30CF05}.Release|x64.Deploy.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE -- cgit v1.3.1 From 5ece081af0a34c3cfd4ed2f7e0870b78036ed311 Mon Sep 17 00:00:00 2001 From: Adonais Romero González Date: Mon, 12 Jun 2023 17:26:49 -0700 Subject: [general/DCHU] Fix toolset, target version and signing errors (#994) * Set WindowsTargetPlatformVersion to target latest one instead of a fixed version * Set PlatformToolset to target latest one instead of a fixed version * Set FileDigestAlgorithm to clear errors caused by a digest algorithm not being specified * Removed exception for general\dchu\osrfx2_dchu_base; sample now builds successfully --- exclusions.csv | 3 +-- .../osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj | 14 ++++++++++++- .../osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj | 14 ++++++++++++- .../osrfx2_DCHU_testapp/osrusbfx2.vcxproj | 2 +- .../osrfx2_DCHU_usersvc.vcxproj | 10 ++++----- .../osrfx2_DCHU_componentsoftware.vcxproj | 10 ++++----- .../osrfx2_DCHU_extension.vcxproj | 24 ++++++++++++++++++++++ .../osrfx2_DCHU_componentsoftware.vcxproj | 10 ++++----- .../osrfx2_DCHU_extension.vcxproj | 12 +++++++++++ 9 files changed, 79 insertions(+), 20 deletions(-) diff --git a/exclusions.csv b/exclusions.csv index 83e5a880..2d977973 100644 --- a/exclusions.csv +++ b/exclusions.csv @@ -1,7 +1,6 @@ Path,Reason -general\dchu\osrfx2_dchu_base,Wrong Toolset - needs migration general\dchu\osrfx2_dchu_extension_loose,Needs fix for project not found -general\dchu\osrfx2_dchu_extension_tight,Wrong Toolset - needs migration +general\dchu\osrfx2_dchu_extension_tight,InfVerif error 1144: Device software with SoftwareType 1 may not execute on all product types general\winhec 2017 lab\toaster driver,Needs input from end user general\winhec 2017 lab\toaster support app,Needs input from end user network\trans\wfpsampler,Missing INF section; missing libs diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj index f78f16b4..1d839558 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj @@ -26,7 +26,7 @@ Win32 {F915ED95-7BE9-4CDB-B09A-0D3F4C9657FE} osrfx2_DCHU_base - 10.0.17134.0 + $(LatestTargetPlatformVersion) @@ -142,6 +142,9 @@ 1.0.0.0 + + sha256 + @@ -168,6 +171,9 @@ 1.0.0.0 + + sha256 + @@ -194,6 +200,9 @@ 1.0.0.0 + + sha256 + @@ -220,6 +229,9 @@ 1.0.0.0 + + sha256 + diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj index 09724ba5..02dc1573 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj @@ -27,7 +27,7 @@ Debug Win32 {1A4A32BA-1596-4F52-BC48-B85A6D8D5D12} - 10.0.17134.0 + $(LatestTargetPlatformVersion) osrfx2_DCHU_filter @@ -109,6 +109,9 @@ %(AdditionalIncludeDirectories);..\..\inc + + sha256 + @@ -127,6 +130,9 @@ %(AdditionalIncludeDirectories);..\..\inc + + sha256 + @@ -145,6 +151,9 @@ %(AdditionalIncludeDirectories);..\..\inc + + sha256 + @@ -163,6 +172,9 @@ %(AdditionalIncludeDirectories);..\..\inc + + sha256 + diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_testapp/osrusbfx2.vcxproj b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_testapp/osrusbfx2.vcxproj index bc56feac..e1450faf 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_testapp/osrusbfx2.vcxproj +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_testapp/osrusbfx2.vcxproj @@ -25,7 +25,7 @@ Win32 {F19E45AF-8B05-4204-A66B-9BDBFE333233} osrfx2_DCHU_testapp - 10.0.17134.0 + $(LatestTargetPlatformVersion) diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj index 60174c56..af9fe1c7 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj @@ -23,30 +23,30 @@ osrfx2_DCHU_usersvc Win32Proj osrfx2_DCHU_usersvc - 10.0.17134.0 + $(LatestTargetPlatformVersion) Application Unicode true - v141 + $(DefaultPlatformToolset) Application Unicode - v141 + $(DefaultPlatformToolset) Application Unicode false - v141 + $(DefaultPlatformToolset) Application Unicode - v141 + $(DefaultPlatformToolset) diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj index 8cbf7180..8819665e 100644 --- a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj @@ -22,33 +22,33 @@ {26D91630-B8FF-4102-A258-32F7D1C84E20} Win32Proj osrfx2_DCHU_componentsoftware - 10.0.16299.0 + $(LatestTargetPlatformVersion) osrfx2_DCHU_componentsoftware Application true - v141 + $(DefaultPlatformToolset) Unicode Application false - v141 + $(DefaultPlatformToolset) false Unicode Application true - v141 + $(DefaultPlatformToolset) Unicode Application false - v141 + $(DefaultPlatformToolset) false Unicode diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj index 770f6ebb..1a0a21a3 100644 --- a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj @@ -169,48 +169,72 @@ $(InfArch) 1.0.0.0 + + sha256 + $(InfArch) 1.0.0.0 + + sha256 + $(InfArch) 1.0.0.0 + + sha256 + $(InfArch) 1.0.0.0 + + sha256 + $(InfArch) 1.0.0.0 + + sha256 + $(InfArch) 1.0.0.0 + + sha256 + $(InfArch) 1.0.0.0 + + sha256 + $(InfArch) 1.0.0.0 + + sha256 + diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj index e15ff8f9..24bd79ea 100644 --- a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj @@ -22,33 +22,33 @@ {26D91630-B8FF-4102-A258-32F7D1C84E20} Win32Proj osrfx2_DCHU_componentsoftware - 10.0.16299.0 + $(LatestTargetPlatformVersion) osrfx2_DCHU_componentsoftware Application true - v141 + $(DefaultPlatformToolset) Unicode Application false - v141 + $(DefaultPlatformToolset) false Unicode Application true - v141 + $(DefaultPlatformToolset) Unicode Application false - v141 + $(DefaultPlatformToolset) false Unicode diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj index 41d8a9c8..557c8a24 100644 --- a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj @@ -139,24 +139,36 @@ $(InfArch) 1.0.0.0 + + sha256 + $(InfArch) 1.0.0.0 + + sha256 + $(InfArch) 1.0.0.0 + + sha256 + $(InfArch) 1.0.0.0 + + sha256 + -- cgit v1.3.1 From f7a5f2d76982e063720a3ca7a767706b7962e504 Mon Sep 17 00:00:00 2001 From: CJ Lee <95255209+cheoljinms@users.noreply.github.com> Date: Mon, 10 Jul 2023 09:20:03 -0700 Subject: Install the driver to driver store (DIRID 13), replace legacy pattern… (#1003) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Install the driver to driver store (DIRID 13), replace legacy pattern (2086 error), remove CoInstallers and GnssDriver_Device_AddReg for cleanup, remove WUDFRD_ServiceInstall, and add target OS version to 22000 to avoid DIRID compat issue * set the min build 16299 * set the min build 16299 * address feedback * Update gnssUmdf.inf --- gnss/gnssUmdf/gnssUmdf.inf | Bin 3622 -> 2672 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/gnss/gnssUmdf/gnssUmdf.inf b/gnss/gnssUmdf/gnssUmdf.inf index c09496cf..b7f3363e 100644 Binary files a/gnss/gnssUmdf/gnssUmdf.inf and b/gnss/gnssUmdf/gnssUmdf.inf differ -- cgit v1.3.1 From d314c5402c62e1278adf42be4669c23e3ad93ed3 Mon Sep 17 00:00:00 2001 From: CJ Lee <95255209+cheoljinms@users.noreply.github.com> Date: Tue, 11 Jul 2023 09:01:10 -0700 Subject: Windows Driver (#1005) --- gnss/gnssUmdf/gnssUmdf.vcxproj | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gnss/gnssUmdf/gnssUmdf.vcxproj b/gnss/gnssUmdf/gnssUmdf.vcxproj index fde7569c..f58175b1 100644 --- a/gnss/gnssUmdf/gnssUmdf.vcxproj +++ b/gnss/gnssUmdf/gnssUmdf.vcxproj @@ -66,42 +66,42 @@ WindowsUserModeDriver10.0 DynamicLibrary - Universal + Windows Driver WindowsUserModeDriver10.0 DynamicLibrary - Universal + Windows Driver WindowsUserModeDriver10.0 DynamicLibrary - Universal + Windows Driver WindowsUserModeDriver10.0 DynamicLibrary - Universal + Windows Driver WindowsUserModeDriver10.0 DynamicLibrary - Universal + Windows Driver WindowsUserModeDriver10.0 DynamicLibrary - Universal + Windows Driver WindowsUserModeDriver10.0 DynamicLibrary - Universal + Windows Driver WindowsUserModeDriver10.0 DynamicLibrary - Universal + Windows Driver -- cgit v1.3.1 From 713297235bc1de929404221824b88c6b4228376b Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 24 Jul 2023 08:35:10 -0700 Subject: Update some sample drivers to Include/Needs wudfrd.inf instead of AddService for WudfRd (#1011) Co-authored-by: Jason Knichel --- .../SampleMagneticStripeReaderDrv.inf | Bin 3604 -> 3040 bytes .../barcodescanner/SampleBarcodeScannerDrv.inf | Bin 3476 -> 2912 bytes sensors/ADXL345Acc/ADXL345Acc.inx | Bin 5020 -> 4398 bytes sensors/Activity/Activity.inx | Bin 4824 -> 4250 bytes sensors/CustomSensors/CustomSensors.inx | Bin 5088 -> 4524 bytes sensors/Fusion/FusionSensor.inx | Bin 5024 -> 4458 bytes sensors/Pedometer/Pedometer.inx | Bin 4874 -> 4302 bytes sensors/SensorsComboDriver/SensorsComboDriver.inx | Bin 5296 -> 4746 bytes .../SimpleDeviceOrientationSensor.inx | Bin 6006 -> 5444 bytes .../IddSampleDriver/IddSampleDriver.inf | Bin 4580 -> 4198 bytes 10 files changed, 0 insertions(+), 0 deletions(-) diff --git a/pos/drivers/MagneticStripeReader/SampleMagneticStripeReaderDrv.inf b/pos/drivers/MagneticStripeReader/SampleMagneticStripeReaderDrv.inf index 4257d513..1dbdcc58 100644 Binary files a/pos/drivers/MagneticStripeReader/SampleMagneticStripeReaderDrv.inf and b/pos/drivers/MagneticStripeReader/SampleMagneticStripeReaderDrv.inf differ diff --git a/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.inf b/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.inf index 41c18afb..28a173ea 100644 Binary files a/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.inf and b/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.inf differ diff --git a/sensors/ADXL345Acc/ADXL345Acc.inx b/sensors/ADXL345Acc/ADXL345Acc.inx index fefa0961..73fd9d97 100644 Binary files a/sensors/ADXL345Acc/ADXL345Acc.inx and b/sensors/ADXL345Acc/ADXL345Acc.inx differ diff --git a/sensors/Activity/Activity.inx b/sensors/Activity/Activity.inx index e7591ddb..5d111d86 100644 Binary files a/sensors/Activity/Activity.inx and b/sensors/Activity/Activity.inx differ diff --git a/sensors/CustomSensors/CustomSensors.inx b/sensors/CustomSensors/CustomSensors.inx index 4792a9c0..86438b0d 100644 Binary files a/sensors/CustomSensors/CustomSensors.inx and b/sensors/CustomSensors/CustomSensors.inx differ diff --git a/sensors/Fusion/FusionSensor.inx b/sensors/Fusion/FusionSensor.inx index 07757f3a..44d590c4 100644 Binary files a/sensors/Fusion/FusionSensor.inx and b/sensors/Fusion/FusionSensor.inx differ diff --git a/sensors/Pedometer/Pedometer.inx b/sensors/Pedometer/Pedometer.inx index 9b88aeac..91a304bf 100644 Binary files a/sensors/Pedometer/Pedometer.inx and b/sensors/Pedometer/Pedometer.inx differ diff --git a/sensors/SensorsComboDriver/SensorsComboDriver.inx b/sensors/SensorsComboDriver/SensorsComboDriver.inx index 5ce6c23e..699be4de 100644 Binary files a/sensors/SensorsComboDriver/SensorsComboDriver.inx and b/sensors/SensorsComboDriver/SensorsComboDriver.inx differ diff --git a/sensors/SimpleDeviceOrientationSensor/SimpleDeviceOrientationSensor.inx b/sensors/SimpleDeviceOrientationSensor/SimpleDeviceOrientationSensor.inx index 273a9f66..b2ccfaba 100644 Binary files a/sensors/SimpleDeviceOrientationSensor/SimpleDeviceOrientationSensor.inx and b/sensors/SimpleDeviceOrientationSensor/SimpleDeviceOrientationSensor.inx differ diff --git a/video/IndirectDisplay/IddSampleDriver/IddSampleDriver.inf b/video/IndirectDisplay/IddSampleDriver/IddSampleDriver.inf index d70c8a87..dc63f6ad 100644 Binary files a/video/IndirectDisplay/IddSampleDriver/IddSampleDriver.inf and b/video/IndirectDisplay/IddSampleDriver/IddSampleDriver.inf differ -- cgit v1.3.1 From b45ffd69a7205e46bbdd5d415ac591f9446fb04f Mon Sep 17 00:00:00 2001 From: zlockard Date: Mon, 31 Jul 2023 17:28:46 -0700 Subject: Update file system filter samples to use isolated state locations --- .../MetadataManager/MetadataManagerInit.c | 124 ++- filesys/miniFilter/MetadataManager/fmm.inf | Bin 5040 -> 7812 bytes filesys/miniFilter/NameChanger/NameChanger.inf | Bin 5770 -> 8938 bytes filesys/miniFilter/NameChanger/nc.c | 2 +- filesys/miniFilter/NameChanger/nc.h | 73 +- filesys/miniFilter/NameChanger/ncinit.c | 61 +- filesys/miniFilter/avscan/avscan.inf | Bin 5808 -> 9104 bytes filesys/miniFilter/avscan/filter/avscan.c | 971 +++++++++++---------- filesys/miniFilter/avscan/filter/avscan.vcxproj | 1 + .../avscan/filter/avscan.vcxproj.Filters | 22 + filesys/miniFilter/cancelSafe/cancelSafe.c | 64 +- filesys/miniFilter/cancelSafe/cancelSafe.inf | Bin 5532 -> 8548 bytes filesys/miniFilter/cdo/CdoInit.c | 120 ++- filesys/miniFilter/cdo/cdo.inf | Bin 5078 -> 7790 bytes filesys/miniFilter/change/change.inf | Bin 5070 -> 7586 bytes filesys/miniFilter/ctx/CtxInit.c | 98 ++- filesys/miniFilter/ctx/ctx.inf | Bin 5004 -> 7776 bytes filesys/miniFilter/delete/delete.inf | Bin 5156 -> 7760 bytes filesys/miniFilter/minispy/filter/minispy.vcxproj | 1 + .../minispy/filter/minispy.vcxproj.Filters | 10 + filesys/miniFilter/minispy/minispy.inf | Bin 6688 -> 10090 bytes filesys/miniFilter/nullFilter/nullFilter.inf | Bin 5014 -> 7608 bytes filesys/miniFilter/passThrough/passThrough.inf | Bin 5220 -> 7866 bytes filesys/miniFilter/scanner/filter/scanner.c | 66 +- filesys/miniFilter/scanner/filter/scanner.vcxproj | 1 + .../scanner/filter/scanner.vcxproj.Filters | 10 + filesys/miniFilter/scanner/scanner.inf | Bin 5562 -> 8382 bytes filesys/miniFilter/simrep/simrep.c | 62 +- filesys/miniFilter/simrep/simrep.inf | Bin 6422 -> 9052 bytes filesys/miniFilter/swapBuffers/swapBuffers.inf | Bin 5176 -> 7946 bytes 30 files changed, 1036 insertions(+), 650 deletions(-) diff --git a/filesys/miniFilter/MetadataManager/MetadataManagerInit.c b/filesys/miniFilter/MetadataManager/MetadataManagerInit.c index 222159f7..d2824241 100644 --- a/filesys/miniFilter/MetadataManager/MetadataManagerInit.c +++ b/filesys/miniFilter/MetadataManager/MetadataManagerInit.c @@ -88,6 +88,7 @@ FmmInstanceTeardownComplete ( VOID FmmInitializeDebugLevel ( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ); @@ -115,11 +116,11 @@ FmmInitializeDebugLevel ( // // If we need to verify that the metadata file is indeed open whenever -// a create suceeds on the volume, then we need to monitor all creates +// a create suceeds on the volume, then we need to monitor all creates // not just DASD creates. -// If that is not the case, then we are better off telling filter manager -// to show us only DASD creates. That way we can avoid the performance +// If that is not the case, then we are better off telling filter manager +// to show us only DASD creates. That way we can avoid the performance // penalty of being called for all creates when we only have use for DASD // creates. // @@ -241,7 +242,7 @@ Return Value: // // Default to NonPagedPoolNx for non paged pool allocations where supported. // - + ExInitializeDriverRuntime( DrvRtPoolNxOptIn ); @@ -253,7 +254,7 @@ Return Value: // Initialize global debug level // - FmmInitializeDebugLevel( RegistryPath ); + FmmInitializeDebugLevel( DriverObject, RegistryPath ); #else @@ -301,6 +302,7 @@ Return Value: VOID FmmInitializeDebugLevel ( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ) /*++ @@ -313,6 +315,9 @@ Routine Description: Arguments: + DriverObject - Pointer to driver object created by the system to + represent this driver. + RegistryPath - The path key passed to the driver during DriverEntry. Return Value: @@ -322,7 +327,8 @@ Return Value: --*/ { OBJECT_ATTRIBUTES attributes; - HANDLE driverRegKey; + OSVERSIONINFOW versionInfo; + HANDLE driverRegKey = NULL; NTSTATUS status; ULONG resultLength; UNICODE_STRING valueName; @@ -330,48 +336,84 @@ Return Value: Globals.DebugLevel = DEBUG_TRACE_ERROR; + RtlZeroMemory( &versionInfo, sizeof( versionInfo ) ); + // - // Open the desired registry key + // Determine the OS version being run. // - InitializeObjectAttributes( &attributes, - RegistryPath, - OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, - NULL, - NULL ); + versionInfo.dwOSVersionInfoSize = sizeof( versionInfo ); - status = ZwOpenKey( &driverRegKey, - KEY_READ, - &attributes ); + status = RtlGetVersion( &versionInfo ); - if (NT_SUCCESS( status )) { + if (!NT_SUCCESS( status )) { + goto cleanup; + } + + // + // Open the desired registry key + // + + if (versionInfo.dwBuildNumber >= 25900) { // - // Read the DebugFlags value from the registry. + // Open the Parameters key for the service. // - RtlInitUnicodeString( &valueName, L"DebugLevel" ); + status = IoOpenDriverRegistryKey( DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &driverRegKey ); + + if (!NT_SUCCESS( status )) { - status = ZwQueryValueKey( driverRegKey, - &valueName, - KeyValuePartialInformation, - buffer, - sizeof(buffer), - &resultLength ); + goto cleanup; + } + } else { + InitializeObjectAttributes( &attributes, + RegistryPath, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, + NULL ); - if (NT_SUCCESS( status )) { + status = ZwOpenKey( &driverRegKey, + KEY_READ, + &attributes ); - Globals.DebugLevel = *((PULONG) &(((PKEY_VALUE_PARTIAL_INFORMATION) buffer)->Data)); + if (!NT_SUCCESS( status )) { + + goto cleanup; } - - // - // Close the registry entry - // - - ZwClose( driverRegKey ); - } + // + // Read the DebugFlags value from the registry. + // + + RtlInitUnicodeString( &valueName, L"DebugLevel" ); + + status = ZwQueryValueKey( driverRegKey, + &valueName, + KeyValuePartialInformation, + buffer, + sizeof(buffer), + &resultLength ); + + if (NT_SUCCESS( status )) { + + Globals.DebugLevel = *((PULONG) &(((PKEY_VALUE_PARTIAL_INFORMATION) buffer)->Data)); + } + +cleanup: + + // + // Close the registry entry + // + + if (driverRegKey != NULL) { + ZwClose( driverRegKey ); + } } #endif @@ -678,22 +720,22 @@ FmmInstanceSetupCleanup: } // - // If this is an automatic attachment (mount, load, etc) and we are not - // attaching to this volume because we do not support attaching to this - // volume, then simply return STATUS_FLT_DO_NOT_ATTACH. If we return - // anything else fltmgr logs an event log indicating failure to attach. - // Since this failure to attach is not really an error, we do not want + // If this is an automatic attachment (mount, load, etc) and we are not + // attaching to this volume because we do not support attaching to this + // volume, then simply return STATUS_FLT_DO_NOT_ATTACH. If we return + // anything else fltmgr logs an event log indicating failure to attach. + // Since this failure to attach is not really an error, we do not want // this failure to be logged as an error in the event log. For all other // error codes besides the ones we consider "normal", if is ok for fltmgr // to actually log the failure to attach. // - // If this is a manual attach attempt that we have failed then we want to - // give the user a clear indication of why the attachment failed. Hence in + // If this is a manual attach attempt that we have failed then we want to + // give the user a clear indication of why the attachment failed. Hence in // this case, we will not override the error status with STATUS_FLT_DO_NOT_ATTACH // irrespective of the cause of the failure to attach // - if (status == STATUS_NOT_SUPPORTED && + if (status == STATUS_NOT_SUPPORTED && !FlagOn( Flags, FLTFL_INSTANCE_SETUP_MANUAL_ATTACHMENT )) { status = STATUS_FLT_DO_NOT_ATTACH; diff --git a/filesys/miniFilter/MetadataManager/fmm.inf b/filesys/miniFilter/MetadataManager/fmm.inf index caf4bc8f..64d3723c 100644 Binary files a/filesys/miniFilter/MetadataManager/fmm.inf and b/filesys/miniFilter/MetadataManager/fmm.inf differ diff --git a/filesys/miniFilter/NameChanger/NameChanger.inf b/filesys/miniFilter/NameChanger/NameChanger.inf index 36b99019..d8660653 100644 Binary files a/filesys/miniFilter/NameChanger/NameChanger.inf and b/filesys/miniFilter/NameChanger/NameChanger.inf differ diff --git a/filesys/miniFilter/NameChanger/nc.c b/filesys/miniFilter/NameChanger/nc.c index 9bcdc094..c59742e5 100644 --- a/filesys/miniFilter/NameChanger/nc.c +++ b/filesys/miniFilter/NameChanger/nc.c @@ -988,7 +988,7 @@ Return Value: NcCompatInit( ); - Status = NcInitializeMapping( RegistryPath ); + Status = NcInitializeMapping( DriverObject, RegistryPath ); if (!NT_SUCCESS( Status )) { return Status; } diff --git a/filesys/miniFilter/NameChanger/nc.h b/filesys/miniFilter/NameChanger/nc.h index c2509faa..47d582b4 100644 --- a/filesys/miniFilter/NameChanger/nc.h +++ b/filesys/miniFilter/NameChanger/nc.h @@ -59,7 +59,7 @@ // // Typedefs for dynamically imported routines -// +// typedef NTSTATUS @@ -277,27 +277,27 @@ typedef struct _NC_DIR_NOT_IO_CACHE { // Stores the state of the cache. // If the pointer is NULL, there is nothing in cache. // - + NC_CACHE_ENTRY Cache; // // If ReadyToIssue is TRUE, then its safe to fire off the request. // - + BOOLEAN ReadyToIssue; // // Io is a pointer to the callback data. // When ReadyToUse new io can be issued. // - + PFLT_CALLBACK_DATA Io; // // SystemBuffer is a pointer to a system buffer which will // be used to issue the IO. // - + char * SystemBuffer; ULONG SystemBufferLength; @@ -479,7 +479,7 @@ extern NC_GLOBAL_DATA NcGlobalData; // // Function declarations -// +// // // The following functions exist in nchelper.c @@ -487,18 +487,18 @@ extern NC_GLOBAL_DATA NcGlobalData; _When_(Data == NULL, _Pre_satisfies_(FileObject != NULL && Instance != NULL)) _When_(FileObject == NULL || Instance == NULL, _Pre_satisfies_(Data != NULL)) -NTSTATUS +NTSTATUS NcGetFileNameInformation( _In_opt_ PFLT_CALLBACK_DATA Data, _In_opt_ PFILE_OBJECT FileObject, _In_opt_ PFLT_INSTANCE Instance, _In_ FLT_FILE_NAME_OPTIONS NameOptions, - _Outptr_ PFLT_FILE_NAME_INFORMATION *FileNameInformation + _Outptr_ PFLT_FILE_NAME_INFORMATION *FileNameInformation ); NTSTATUS NcAllocateEResource( - _Out_ PERESOURCE * OutputLock + _Out_ PERESOURCE * OutputLock ); VOID @@ -600,8 +600,9 @@ NcBuildMapping ( // The following functions exist in ncinit.c // -NTSTATUS +NTSTATUS NcInitializeMapping( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ); @@ -642,7 +643,7 @@ NcParseFinalComponent ( // NTSTATUS -NcStreamHandleContextAllocAndAttach( +NcStreamHandleContextAllocAndAttach( _In_ PFLT_FILTER Filter, _In_ PFLT_INSTANCE Instance, _In_ PFILE_OBJECT FileObject, @@ -709,7 +710,7 @@ NcDetermineStructureOffsets ( _In_ FILE_INFORMATION_CLASS Information ); -VOID +VOID NcCalculateDirectoryNotificationOffsets ( PDIRECTORY_CONTROL_OFFSETS Offsets ); @@ -762,7 +763,7 @@ NcSetNextEntryOffset ( _In_ CONST PDIRECTORY_CONTROL_OFFSETS Offsets, _In_ BOOLEAN ForceLast); -VOID +VOID NcSetFileName ( _In_ PVOID Entry, _In_ PWSTR NewName, @@ -771,7 +772,7 @@ NcSetFileName ( _In_ BOOLEAN ForceLast ); -VOID +VOID NcSetShortName ( _In_ PVOID Entry, _In_ PWSTR NewShortName, @@ -800,7 +801,7 @@ NcEnumerateDirectorySetupInjection ( ); VOID -NcEnumerateDirectoryReset ( +NcEnumerateDirectoryReset ( _Inout_ PNC_DIR_QRY_CONTEXT dirCtx ); @@ -818,9 +819,9 @@ NcPopulateCacheEntry ( _Out_ PNC_CACHE_ENTRY Cache ); -PNC_CACHE_ENTRY -NcDirEnumSelectNextEntry ( - _Inout_ PNC_DIR_QRY_CONTEXT Context, +PNC_CACHE_ENTRY +NcDirEnumSelectNextEntry ( + _Inout_ PNC_DIR_QRY_CONTEXT Context, _In_ PDIRECTORY_CONTROL_OFFSETS Offsets, _In_ BOOLEAN IgnoreCase ); @@ -828,7 +829,7 @@ NcDirEnumSelectNextEntry ( BOOLEAN NcSkipName ( _In_ PDIRECTORY_CONTROL_OFFSETS Offsets, - _In_ PNC_DIR_QRY_CONTEXT Context, + _In_ PNC_DIR_QRY_CONTEXT Context, _In_ NC_PATH_OVERLAP RealOverlap, _In_ PNC_MAPPING Mapping, _In_ BOOLEAN IgnoreCase @@ -836,22 +837,22 @@ NcSkipName ( _Success_(*Copied) ULONG -NcCopyDirEnumEntry ( - _Out_ PVOID UserBuffer, - _In_ ULONG UserOffset, - _In_ ULONG UserSize, +NcCopyDirEnumEntry ( + _Out_ PVOID UserBuffer, + _In_ ULONG UserOffset, + _In_ ULONG UserSize, _Inout_ PNC_CACHE_ENTRY Entry, _In_ PDIRECTORY_CONTROL_OFFSETS Offsets, - _Out_ PBOOLEAN Copied + _Out_ PBOOLEAN Copied ); NTSTATUS NcStreamHandleContextDirEnumCreate ( - _Out_ PNC_DIR_QRY_CONTEXT Context + _Out_ PNC_DIR_QRY_CONTEXT Context ); NTSTATUS -NcStreamHandleContextEnumSetup ( +NcStreamHandleContextEnumSetup ( _Inout_ PNC_DIR_QRY_CONTEXT DirContext, _In_ PNC_INSTANCE_CONTEXT InstanceContext, _In_ PDIRECTORY_CONTROL_OFFSETS Offsets, @@ -861,9 +862,9 @@ NcStreamHandleContextEnumSetup ( _Out_ PBOOLEAN FirstUsage ); -VOID +VOID NcStreamHandleContextEnumClose ( - _In_ PNC_DIR_QRY_CONTEXT DirContext + _In_ PNC_DIR_QRY_CONTEXT DirContext ); // @@ -885,19 +886,19 @@ NcPostNotifyDirectory ( _In_ FLT_POST_OPERATION_FLAGS Flags ); -NTSTATUS -NcStreamHandleContextNotCreate ( +NTSTATUS +NcStreamHandleContextNotCreate ( _Out_ PNC_DIR_NOT_CONTEXT Context ); -VOID +VOID NcStreamHandleContextNotCleanup( - _In_ PNC_STREAM_HANDLE_CONTEXT HandleContext + _In_ PNC_STREAM_HANDLE_CONTEXT HandleContext ); -VOID +VOID NcStreamHandleContextNotClose ( - _In_ PNC_DIR_NOT_CONTEXT DirContext + _In_ PNC_DIR_NOT_CONTEXT DirContext ); // @@ -970,10 +971,10 @@ NcPostEnumUsnData ( NTSTATUS NcStreamHandleContextFindBySidCreate ( - _Out_ PNC_FIND_BY_SID_CONTEXT Context + _Out_ PNC_FIND_BY_SID_CONTEXT Context ); -VOID +VOID NcStreamHandleContextFindBySidClose ( _In_ PNC_FIND_BY_SID_CONTEXT Context ); diff --git a/filesys/miniFilter/NameChanger/ncinit.c b/filesys/miniFilter/NameChanger/ncinit.c index d34dc0f0..e9b2d642 100644 --- a/filesys/miniFilter/NameChanger/ncinit.c +++ b/filesys/miniFilter/NameChanger/ncinit.c @@ -280,6 +280,7 @@ NcIs8DOT3Compatible ( NTSTATUS NcInitializeMapping( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ) /*++ @@ -292,6 +293,9 @@ Routine Descrition: Arguments: + DriverObject - Pointer to driver object created by the system to + represent this driver. + RegistryPath - The path key passed to the driver during DriverEntry. Return Value: @@ -301,6 +305,7 @@ Return Value: --*/ { NTSTATUS Status; + OSVERSIONINFOW versionInfo; OBJECT_ATTRIBUTES Attributes; HANDLE DriverRegKey = NULL; UNICODE_STRING TempPath = EMPTY_UNICODE_STRING; @@ -310,26 +315,62 @@ Return Value: RtlZeroMemory( &NcGlobalData, sizeof( NcGlobalData )); + RtlZeroMemory( &versionInfo, sizeof( versionInfo ) ); + // - // Open the mapping registry key. + // Determine the OS version being run. // - InitializeObjectAttributes( &Attributes, - RegistryPath, - OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, - NULL, - NULL ); + versionInfo.dwOSVersionInfoSize = sizeof( versionInfo ); - Status = ZwOpenKey( &DriverRegKey, - KEY_READ, - &Attributes ); + Status = RtlGetVersion( &versionInfo ); if (!NT_SUCCESS( Status )) { - FLT_ASSERT( DriverRegKey == NULL ); goto NcInitializeMappingCleanup; } + // + // Open the desired registry key + // + + if (versionInfo.dwBuildNumber >= 25900) { + // + // Open the Parameters key for the service. + // + + Status = IoOpenDriverRegistryKey( DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &DriverRegKey ); + + if (!NT_SUCCESS( Status )) { + + goto NcInitializeMappingCleanup; + } + } else { + // + // Open legacy registry key. + // + + InitializeObjectAttributes( &Attributes, + RegistryPath, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, + NULL ); + + Status = ZwOpenKey( &DriverRegKey, + KEY_READ, + &Attributes ); + + if (!NT_SUCCESS( Status )) { + + FLT_ASSERT( DriverRegKey == NULL ); + goto NcInitializeMappingCleanup; + } + } + Status = NcLoadRegistryString( DriverRegKey, L"UserMapping", &TempPath ); diff --git a/filesys/miniFilter/avscan/avscan.inf b/filesys/miniFilter/avscan/avscan.inf index 26fb6c22..12fa79c7 100644 Binary files a/filesys/miniFilter/avscan/avscan.inf and b/filesys/miniFilter/avscan/avscan.inf differ diff --git a/filesys/miniFilter/avscan/filter/avscan.c b/filesys/miniFilter/avscan/filter/avscan.c index 82e1045c..821dd733 100644 --- a/filesys/miniFilter/avscan/filter/avscan.c +++ b/filesys/miniFilter/avscan/filter/avscan.c @@ -9,9 +9,9 @@ Module Name: Abstract: This is the main module of the avscan mini-filter driver. - This filter demonstrates how to implement a transaction-aware + This filter demonstrates how to implement a transaction-aware anti-virus filter. - + Av prefix denotes "Anti-virus" module. Environment: @@ -22,7 +22,7 @@ Environment: #include #include "avscan.h" - + /************************************************************************* Local Function Prototypes *************************************************************************/ @@ -34,8 +34,9 @@ DriverEntry ( _In_ PUNICODE_STRING RegistryPath ); -NTSTATUS -AvSetConfiguration ( +NTSTATUS +AvSetConfiguration ( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ); @@ -112,20 +113,20 @@ AvKtmNotificationCallback ( _In_ PFLT_CONTEXT TransactionContext, _In_ ULONG TransactionNotification ); - + NTSTATUS AvScanAbortCallbackAsync ( _Unreferenced_parameter_ PFLT_INSTANCE Instance, _In_ PFLT_CONTEXT Context, _Unreferenced_parameter_ PFLT_CALLBACK_DATA Data ); - + // // Local routines // BOOLEAN -AvOperationsModifyingFile ( +AvOperationsModifyingFile ( _In_ PFLT_CALLBACK_DATA Data ); @@ -134,14 +135,14 @@ AvQueryTransactionOutcome( _In_ PKTRANSACTION Transaction, _Out_ PULONG TxOutcome ); - + NTSTATUS AvProcessPreviousTransaction ( _In_ PCFLT_RELATED_OBJECTS FltObjects, _Inout_ PAV_STREAM_CONTEXT StreamContext ); - -NTSTATUS + +NTSTATUS AvProcessTransactionOutcome ( _Inout_ PAV_TRANSACTION_CONTEXT TransactionContext, _In_ ULONG TransactionOutcome @@ -154,9 +155,9 @@ AvLoadFileStateFromCache ( _Out_ LONG volatile* State, _Out_ PLONGLONG VolumeRevision, _Out_ PLONGLONG CacheRevision, - _Out_ PLONGLONG FileRevision + _Out_ PLONGLONG FileRevision ); - + NTSTATUS AvSyncCache ( _In_ PFLT_INSTANCE Instance, @@ -168,12 +169,12 @@ AvIsPrefetchEcpPresent ( _In_ PFLT_FILTER Filter, _In_ PFLT_CALLBACK_DATA Data ); - + BOOLEAN AvIsStreamAlternate ( _Inout_ PFLT_CALLBACK_DATA Data ); - + NTSTATUS AvScan ( _Inout_ PFLT_CALLBACK_DATA Data, @@ -183,18 +184,18 @@ AvScan ( _In_ BOOLEAN IsInTxWriter, _Inout_ PAV_STREAM_CONTEXT StreamContext ); - + VOID AvDoCancelScanAndRelease ( _In_ PAV_SCAN_CONTEXT ScanContext, _In_ PAV_SECTION_CONTEXT SectionContext ); - + NTSTATUS -AvSendUnloadingToUser ( +AvSendUnloadingToUser ( VOID - ); - + ); + // // Assign text sections for each routine. // @@ -225,7 +226,7 @@ AvSendUnloadingToUser ( #pragma alloc_text(PAGE, AvDoCancelScanAndRelease) #pragma alloc_text(PAGE, AvSendAbortToUser) #pragma alloc_text(PAGE, AvSendUnloadingToUser) -#endif +#endif // // operation registration @@ -251,7 +252,7 @@ CONST FLT_OPERATION_REGISTRATION Callbacks[] = { 0, AvPreOperationCallback, NULL }, - + { IRP_MJ_FILE_SYSTEM_CONTROL, 0, AvPreFsControl, @@ -330,7 +331,7 @@ Return Value: NTSTATUS status; PAV_INSTANCE_CONTEXT instanceContext = NULL; BOOLEAN isOnCsv = FALSE; - + UNREFERENCED_PARAMETER( Flags ); PAGED_CODE(); @@ -348,13 +349,13 @@ Return Value: } // - // Determine if the filter is attaching to the hidden NTFS volume - // that corresponds to a CSV volume. If so do not attach. Note - // that it would be feasible for the filter to attach to this + // Determine if the filter is attaching to the hidden NTFS volume + // that corresponds to a CSV volume. If so do not attach. Note + // that it would be feasible for the filter to attach to this // volume as part of a distrubuted filter implementation but that // is beyond the scope of this sample. // - + if (VolumeFilesystemType == FLT_FSTYPE_NTFS) { isOnCsv = AvIsVolumeOnCsvDisk( FltObjects->Volume ); if (isOnCsv) { @@ -362,7 +363,7 @@ Return Value: return STATUS_FLT_DO_NOT_ATTACH; } } - + status = FltAllocateContext( Globals.Filter, FLT_INSTANCE_CONTEXT, AV_INSTANCE_CONTEXT_SIZE, @@ -373,46 +374,46 @@ Return Value: AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[AV] AvInstanceSetup: allocate instance context failed. status = 0x%x\n", status) ); - + return STATUS_FLT_DO_NOT_ATTACH; } // // Setup instance context // - + RtlZeroMemory(instanceContext, AV_INSTANCE_CONTEXT_SIZE); instanceContext->Volume = FltObjects->Volume; instanceContext->Instance = FltObjects->Instance; instanceContext->VolumeFSType = VolumeFilesystemType; instanceContext->IsOnCsvMDS = isOnCsv; - + // // There will be a file state cache table for each NTFS volume instance. - // As for other file systems, file id is not unique, and thus we do - // not have cache for other kinds of file systems. Since the cache - // table is not mandatory to implement an anti-virus filter, we + // As for other file systems, file id is not unique, and thus we do + // not have cache for other kinds of file systems. Since the cache + // table is not mandatory to implement an anti-virus filter, we // only have the volatile cache for NTFS, CSVFS and REFS. // - // It is worth mentioning that the table is potentially very large. - // We use an AVL tree to improve insertion and query times. We do not - // set an upper bound for the size of the tree which is not optimal. + // It is worth mentioning that the table is potentially very large. + // We use an AVL tree to improve insertion and query times. We do not + // set an upper bound for the size of the tree which is not optimal. // Consider limiting the size of the tree for a production filter. // - + if (FS_SUPPORTS_FILE_STATE_CACHE( VolumeFilesystemType )) { - + // // Initialize file state cache in the instance context. // ExInitializeResourceLite( &instanceContext->Resource ); - + RtlInitializeGenericTable( &instanceContext->FileStateCacheTable, AvCompareEntry, AvAllocateGenericTableEntry, AvFreeGenericTableEntry, - NULL ); + NULL ); } status = FltSetInstanceContext( FltObjects->Instance, @@ -435,22 +436,22 @@ Return Value: } // - // Register this instance as a datascan filter. If this call - // fails the underlying filesystem does not support using + // Register this instance as a datascan filter. If this call + // fails the underlying filesystem does not support using // the filter manager datascan API. Currently only the // the namedpipe and mailslot file systems are unsupported. - // - + // + status = FltRegisterForDataScan( FltObjects->Instance ); if (!NT_SUCCESS( status )) { - + AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[AV] AvInstanceSetup: FltRegisterForDataScan failed. status = 0x%x\n", status) ); return STATUS_FLT_DO_NOT_ATTACH; } - + return STATUS_SUCCESS; } @@ -525,36 +526,36 @@ Return Value: PLIST_ENTRY next; PAV_SCAN_CONTEXT scanCtx = NULL; PAV_INSTANCE_CONTEXT instanceContext = NULL; - + UNREFERENCED_PARAMETER( Flags ); PAGED_CODE(); - + AV_DBG_PRINT( AVDBG_TRACE_DEBUG, ("[AV] AvInstanceTeardownStart: Entered\n") ); - + status = FltGetInstanceContext( FltObjects->Instance, &instanceContext ); - + if (!NT_SUCCESS( status )) { AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[AV] AvInstanceTeardownStart: FltGetInstanceContext failed. status = 0x%x\n", status) ); return; } - + // // Search the scan context from the global list. // - + AvAcquireResourceExclusive( &Globals.ScanCtxListLock ); - + LIST_FOR_EACH_SAFE( scan, next, &Globals.ScanCtxListHead ) { - + scanCtx = CONTAINING_RECORD( scan, AV_SCAN_CONTEXT, List ); - + if (scanCtx->FilterInstance != FltObjects->Instance) { - + continue; } @@ -564,45 +565,45 @@ Return Value: status = AvSendAbortToUser(scanCtx->ScanThreadId, scanCtx->ScanId); - + // - // If we fail to send message to the user, then we - // do the cancel and cleanup by ourself; otherwise, - // the listening thread will call back to cleanup and + // If we fail to send message to the user, then we + // do the cancel and cleanup by ourself; otherwise, + // the listening thread will call back to cleanup and // I/O request thred will tear down the scan context. // - + if (!NT_SUCCESS( status ) || status == STATUS_TIMEOUT) { AvFinalizeScanAndSection(scanCtx); } } - + AvReleaseResource( &Globals.ScanCtxListLock ); - + // // Clean up the cache table if the volume supports one. // - + if (FS_SUPPORTS_FILE_STATE_CACHE( instanceContext->VolumeFSType )) { PAV_GENERIC_TABLE_ENTRY entry = NULL; AvAcquireResourceExclusive( &instanceContext->Resource ); - + while (!RtlIsGenericTableEmpty( &instanceContext->FileStateCacheTable ) ) { entry = RtlGetElementGenericTable(&instanceContext->FileStateCacheTable, 0); AV_DBG_PRINT( AVDBG_TRACE_ROUTINES, - ("[AV] AvInstanceTeardownStart: %I64x,%I64x requesting deletion, state:%d\n", + ("[AV] AvInstanceTeardownStart: %I64x,%I64x requesting deletion, state:%d\n", entry->FileId.FileId64.UpperZeroes, entry->FileId.FileId64.Value, entry->InfectedState) ); RtlDeleteElementGenericTable(&instanceContext->FileStateCacheTable, entry); } - + AvReleaseResource( &instanceContext->Resource ); } - + FltReleaseContext( instanceContext ); - + FltDeleteInstanceContext( FltObjects->Instance, NULL ); } @@ -673,15 +674,13 @@ Return Value: NTSTATUS status = STATUS_SUCCESS; PSECURITY_DESCRIPTOR sd = NULL; - UNREFERENCED_PARAMETER( RegistryPath ); - AV_DBG_PRINT( AVDBG_TRACE_ROUTINES, ("[AV] DriverEntry: Entered\n") ); // // Set default global configuration // - + RtlZeroMemory( &Globals, sizeof(Globals) ); InitializeListHead( &Globals.ScanCtxListHead ); ExInitializeResourceLite( &Globals.ScanCtxListLock ); @@ -691,7 +690,7 @@ Return Value: Globals.NetworkScanTimeout = 60000; #if DBG - + Globals.DebugLevel = 0xffffffff; // AVDBG_TRACE_ERROR | AVDBG_TRACE_DEBUG; #endif @@ -702,7 +701,7 @@ Return Value: // Set the filter configuration based on registry keys // - status = AvSetConfiguration( RegistryPath ); + status = AvSetConfiguration( DriverObject, RegistryPath ); if (!NT_SUCCESS( status )) { @@ -710,7 +709,7 @@ Return Value: ("[AV]: DriverEntry: SetConfiguration FAILED. status = 0x%x\n", status) ); leave; - } + } // // Register with FltMgr to tell it our callback routines @@ -721,19 +720,19 @@ Return Value: &Globals.Filter ); if (!NT_SUCCESS( status )) { - + AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[AV] DriverEntry: FltRegisterFilter FAILED. status = 0x%x\n", status) ); leave; } - + // // Builds a default security descriptor for use with FltCreateCommunicationPort. // - + status = FltBuildDefaultSecurityDescriptor( &sd, FLT_PORT_ALL_ACCESS ); - + if (!NT_SUCCESS( status )) { @@ -744,34 +743,34 @@ Return Value: // // Prepare ports between kernel and user. // - + status = AvPrepareServerPort( sd, AvConnectForScan ); - + if (!NT_SUCCESS( status )) { AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[AV] DriverEntry: AvPrepareServerPort Scan Port FAILED. status = 0x%x\n", status) ); leave; } - + status = AvPrepareServerPort( sd, AvConnectForAbort ); - + if (!NT_SUCCESS( status )) { AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[AV] DriverEntry: AvPrepareServerPort Abort Port FAILED. status = 0x%x\n", status) ); leave; } - + status = AvPrepareServerPort( sd, AvConnectForQuery ); - + if (!NT_SUCCESS( status )) { AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[AV] DriverEntry: AvPrepareServerPort Query Port FAILED. status = 0x%x\n", status) ); leave; } - + // // Start filtering i/o // @@ -784,16 +783,16 @@ Return Value: ("[AV] DriverEntry: FltStartFiltering FAILED. status = 0x%x\n", status) ); leave; } - + } finally { - + if ( sd != NULL ) { - + FltFreeSecurityDescriptor( sd ); } - + if (!NT_SUCCESS( status ) ) { - + if (NULL != Globals.ScanServerPort) { FltCloseCommunicationPort( Globals.ScanServerPort ); @@ -807,13 +806,13 @@ Return Value: FltCloseCommunicationPort( Globals.QueryServerPort ); } if (NULL != Globals.Filter) { - + FltUnregisterFilter( Globals.Filter ); Globals.Filter = NULL; } - ExDeleteResourceLite( &Globals.ScanCtxListLock ); - } + ExDeleteResourceLite( &Globals.ScanCtxListLock ); + } } return status; @@ -848,20 +847,20 @@ Return Value: AV_DBG_PRINT( AVDBG_TRACE_DEBUG, ("[AV] AvUnload: Entered\n") ); - + // // Traverse the scan context list, and cancel the scan if it exists. // - + AvAcquireResourceExclusive( &Globals.ScanCtxListLock ); Globals.Unloading = TRUE; AvReleaseResource( &Globals.ScanCtxListLock ); - + // - // This function will wait for the user to abort the outstanding scan and - // close the section + // This function will wait for the user to abort the outstanding scan and + // close the section // - + AvSendUnloadingToUser(); FltCloseCommunicationPort( Globals.ScanServerPort ); @@ -872,7 +871,7 @@ Return Value: Globals.QueryServerPort = NULL; FltUnregisterFilter( Globals.Filter ); // This will typically trigger instance tear down. Globals.Filter = NULL; - + ExDeleteResourceLite( &Globals.ScanCtxListLock ); return STATUS_SUCCESS; @@ -884,7 +883,7 @@ Return Value: *************************************************************************/ BOOLEAN -AvOperationsModifyingFile ( +AvOperationsModifyingFile ( _In_ PFLT_CALLBACK_DATA Data ) /*++ @@ -905,14 +904,14 @@ Return Value: --*/ { PFLT_IO_PARAMETER_BLOCK iopb = Data->Iopb; - + PAGED_CODE(); switch(iopb->MajorFunction) { - + case IRP_MJ_WRITE: return TRUE; - + case IRP_MJ_FILE_SYSTEM_CONTROL: switch ( iopb->Parameters.FileSystemControl.Common.FsControlCode ) { case FSCTL_OFFLOAD_WRITE: @@ -922,7 +921,7 @@ Return Value: default: break; } break; - + case IRP_MJ_SET_INFORMATION: switch ( iopb->Parameters.SetFileInformation.FileInformationClass ) { case FileEndOfFileInformation: @@ -947,11 +946,11 @@ AvQueryTransactionOutcome( Routine Description: This is a helper function that qeury the KTM that how trasnaction was ended. - + Arguments: Transaction - Pointer to transaction object. - + TxOutcome - Output. Specifies the type of transaction outcome. Return Value: @@ -962,9 +961,9 @@ Return Value: HANDLE transactionHandle; NTSTATUS status; TRANSACTION_BASIC_INFORMATION txBasicInfo = {0}; - + PAGED_CODE(); - + status = ObOpenObjectByPointer( Transaction, OBJ_KERNEL_HANDLE, NULL, @@ -972,9 +971,9 @@ Return Value: *TmTransactionObjectType, KernelMode, &transactionHandle ); - + if (!NT_SUCCESS(status)) { - + AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[AV] AvQueryTransactionOutcome: ObOpenObjectByPointer failed.\n") ); return status; @@ -986,18 +985,18 @@ Return Value: sizeof(TRANSACTION_BASIC_INFORMATION), NULL ); if (!NT_SUCCESS(status)) { - + AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[AV] AvQueryTransactionOutcome: ObOpenObjectByPointer failed.\n") ); goto Cleanup; } - + *TxOutcome = txBasicInfo.Outcome; - + Cleanup: ZwClose(transactionHandle); - + return status; } @@ -1012,46 +1011,46 @@ AvPropagateFileState( Routine Description: An inline function that propagate the TxState to State in stream context. - + Arguments: StreamContext - The stream context to be propagated. - + TransactionOutcome - TRANSACTION_OUTCOME enumeration indicating how transaction was ended. - + Return Value: None. - + --*/ { // // Only when the transaction was committed will we propagate the state. // - + if (TransactionOutcome == TransactionOutcomeCommitted) { - + AV_FILE_INFECTED_STATE oldTxState = InterlockedExchange( &StreamContext->TxState, AvFileModified ); switch (oldTxState) { case AvFileModified: case AvFileInfected: case AvFileNotInfected: - + // // Propagate the file state from TxState to State. // - + InterlockedExchange( &StreamContext->State, oldTxState ); break; case AvFileScanning: - + // // It is possible at KTM callback, file Tx state is still in scanning. - // All we can do here is to be conservative, that is to assume that + // All we can do here is to be conservative, that is to assume that // this commit did involve the modification of the file. // - + InterlockedExchange( &StreamContext->State, AvFileModified ); break; default: @@ -1059,15 +1058,15 @@ Return Value: break; } } - + // // Either cleanup or commited, we need to reset TxState to be default state. // - + SET_FILE_TX_MODIFIED( StreamContext ); } -NTSTATUS +NTSTATUS AvProcessTransactionOutcome ( _Inout_ PAV_TRANSACTION_CONTEXT TransactionContext, _In_ ULONG TransactionOutcome @@ -1076,21 +1075,21 @@ AvProcessTransactionOutcome ( Routine Description: - This is a helper function that process transaction commitment or rollback - + This is a helper function that process transaction commitment or rollback + Arguments: TransactionContext - Pointer to the minifilter driver's transaction context set at PostCreate. - + TransactionOutcome - Specifies the type of notifications. Should be either TransactionOutcomeCommitted or TransactionOutcomeAborted Return Value: - STATUS_SUCCESS - Returning this status value indicates that the minifilter + STATUS_SUCCESS - Returning this status value indicates that the minifilter driver is finished with the transaction. This is a success code. - + --*/ { PLIST_ENTRY scan; @@ -1099,7 +1098,7 @@ Return Value: PAV_TRANSACTION_CONTEXT oldTxCtx = NULL; PAGED_CODE(); - + // // Tranversing the stream context list, and // sync the TxState -> State. @@ -1107,21 +1106,21 @@ Return Value: // Either commit or rollback, we need to cleanup the list // Tear down stream context list inside transactionContext // - + AvAcquireResourceExclusive( TransactionContext->Resource ); - + LIST_FOR_EACH_SAFE( scan, next, &TransactionContext->ScListHead ) { - + streamContext = CONTAINING_RECORD( scan, AV_STREAM_CONTEXT, ListInTransaction ); oldTxCtx = InterlockedCompareExchangePointer( &streamContext->TxContext, NULL, TransactionContext ); if (oldTxCtx == TransactionContext) { - + // // The exchange pointer was successful // RemoveEntryList ( scan ); - + AV_DBG_PRINT( AVDBG_TRACE_DEBUG, ("[AV] AvProcessTransactionOutcome: Requesting deletion of entry in transaction context: %I64x,%I64x, modified: %d\n", streamContext->FileId.FileId64.UpperZeroes, @@ -1134,7 +1133,7 @@ Return Value: } SetFlag( TransactionContext->Flags, AV_TXCTX_LISTDRAINED ); AvReleaseResource( TransactionContext->Resource ); - + return STATUS_SUCCESS; } @@ -1145,20 +1144,20 @@ AvLoadFileStateFromCache ( _Out_ LONG volatile *State, _Out_ PLONGLONG VolumeRevision, _Out_ PLONGLONG CacheRevision, - _Out_ PLONGLONG FileRevision + _Out_ PLONGLONG FileRevision ) /*++ Routine Description: - This routine lookups the file state in the cache table. + This routine lookups the file state in the cache table. Arguments: Instance - Opaque filter pointer for the caller. This parameter is required and cannot be NULL. - + FileID - The ID to lookup in the cache - + State - The cached state for the file Return Value: @@ -1171,7 +1170,7 @@ Return Value: PAV_INSTANCE_CONTEXT instanceContext = NULL; AV_GENERIC_TABLE_ENTRY query = {0}; PAV_GENERIC_TABLE_ENTRY entry = NULL; - + PAGED_CODE(); // @@ -1195,8 +1194,8 @@ Return Value: goto Cleanup; } - RtlCopyMemory( &query.FileId, FileId, sizeof(query.FileId) ); - + RtlCopyMemory( &query.FileId, FileId, sizeof(query.FileId) ); + AvAcquireResourceShared( &instanceContext->Resource ); entry = RtlLookupElementGenericTable( &instanceContext->FileStateCacheTable, @@ -1234,9 +1233,9 @@ Routine Description: Arguments: Instance - Opaque filter pointer for the caller. This parameter is required and cannot be NULL. - + StreamContext - The stream context of the target file. - + Return Value: Returns the final status of this operation. @@ -1274,7 +1273,7 @@ Return Value: } // - // If originally, we failed to get the file id, + // If originally, we failed to get the file id, // then we do not cache it. // @@ -1286,7 +1285,7 @@ Return Value: // If the file system is NTFS, CSVFS or REFS, overwrite the entry in the // cache table if exists // - + RtlCopyMemory( &entry.FileId, &StreamContext->FileId, sizeof(entry.FileId) ); AvAcquireResourceExclusive( &instanceContext->Resource ); @@ -1302,9 +1301,9 @@ Return Value: // // - // It is possible that after entering the following else-if - // branch, thread A modifies the file, and before thread A - // closes the handle, thread B opens the same file. This + // It is possible that after entering the following else-if + // branch, thread A modifies the file, and before thread A + // closes the handle, thread B opens the same file. This // is fine because in such a case, the streamcontext exists // AvLoadFileStateFromCache would return the state in stream // context. Thus, thread B will need to scan the file. @@ -1327,7 +1326,7 @@ Return Value: Cleanup: FltReleaseContext( instanceContext ); - return status; + return status; } BOOLEAN @@ -1340,13 +1339,13 @@ AvIsPrefetchEcpPresent ( Routine Description: This local function will return if this data stream is alternate or not. - It by default returns FALSE if it fails to retrieve the name information + It by default returns FALSE if it fails to retrieve the name information from the file system. - + Arguments: Data - Pointer to the filter callbackData that is passed to us. - + Return Value: TRUE - This data stream is alternate. @@ -1357,13 +1356,13 @@ Return Value: NTSTATUS status; PECP_LIST ecpList; PVOID ecpContext; - + PAGED_CODE(); status = FltGetEcpListFromCallbackData( Filter, Data, &ecpList ); if (NT_SUCCESS(status) && (ecpList != NULL)) { - + status = FltFindExtraCreateParameter( Filter, ecpList, &GUID_ECP_PREFETCH_OPEN, @@ -1373,7 +1372,7 @@ Return Value: if (NT_SUCCESS(status)) { if (!FltIsEcpFromUserMode( Filter, ecpContext )) { - return TRUE; + return TRUE; } } } @@ -1390,13 +1389,13 @@ AvIsStreamAlternate( Routine Description: This local function will return if this data stream is alternate or not. - It by default returns FALSE if it fails to retrieve the name information + It by default returns FALSE if it fails to retrieve the name information from the file system. - + Arguments: Data - Pointer to the filter callbackData that is passed to us. - + Return Value: TRUE - This data stream is alternate. @@ -1409,32 +1408,32 @@ Return Value: PFLT_FILE_NAME_INFORMATION nameInfo = NULL; PAGED_CODE(); - + status = FltGetFileNameInformation( Data, FLT_FILE_NAME_OPENED | FLT_FILE_NAME_QUERY_ALWAYS_ALLOW_CACHE_LOOKUP, &nameInfo ); - + if (!NT_SUCCESS(status)) { - + goto Cleanup; } status = FltParseFileNameInformation( nameInfo ); if (!NT_SUCCESS(status)) { - + goto Cleanup; } AV_DBG_PRINT( AVDBG_TRACE_ROUTINES, - ("[Av]: Dir: %wZ, FinalComponent: %wZ, Stream: %wZ, sLen: %d\n", + ("[Av]: Dir: %wZ, FinalComponent: %wZ, Stream: %wZ, sLen: %d\n", nameInfo->ParentDir, nameInfo->FinalComponent, nameInfo->Stream, nameInfo->Stream.Length) ); - + alternate = (nameInfo->Stream.Length > 0); - + Cleanup: if (nameInfo != NULL) { @@ -1466,13 +1465,13 @@ Arguments: FltObjects - Pointer to the FLT_RELATED_OBJECTS data structure containing opaque handles to this filter, instance, its associated volume and file object. - + ScanMode - Can either be AvUserMode or AvKernelMode. - + IOMajorFunctionAtScan - Major function of an IRP. - + StreamContext - The stream context of the target file. - + Return Value: Returns the final status of this operation. @@ -1485,20 +1484,20 @@ Return Value: LONGLONG fileSize; FLT_VOLUME_PROPERTIES volumeProperties; ULONG volumePropertiesLength; - + PAGED_CODE(); - + // // Skip the empty file. // - + status = AvGetFileSize( FltObjects->Instance, - FltObjects->FileObject, + FltObjects->FileObject, &fileSize ); - if (NT_SUCCESS( status ) && + if (NT_SUCCESS( status ) && (0 == fileSize)) { - + AV_DBG_PRINT( AVDBG_TRACE_ROUTINES, ("[Av]: AvScan: Skip the EMPTY file.\n") ); @@ -1511,9 +1510,9 @@ Return Value: // We could cause deadlocks if the thread were suspended once // we have started scanning so enter a critical region. // - + FsRtlEnterFileSystem(); - + // // Wait here for an existing scan on the stream to complete. // We wait indefinitely since scans themselves will timeout. @@ -1531,7 +1530,7 @@ Return Value: // if (IS_FILE_NEED_SCAN( StreamContext )){ - + if (ScanMode == AvUserMode) { status = FltGetVolumeProperties( FltObjects->Volume, @@ -1541,21 +1540,21 @@ Return Value: if (!NT_SUCCESS(status)) { volumeProperties.DeviceType = FILE_DEVICE_NETWORK; } - + // - // If the scan mode is user mode, the section context will + // If the scan mode is user mode, the section context will // be created as needed (at MessageNotification callback). // - // Setting the file state will be done at + // Setting the file state will be done at // MessageNotification callback as well. // - + status = AvScanInUser( Data, FltObjects, IOMajorFunctionAtScan, IsInTxWriter, volumeProperties.DeviceType ); - + if (!NT_SUCCESS( status ) || status == STATUS_TIMEOUT) { AV_DBG_PRINT( AVDBG_TRACE_ROUTINES, @@ -1564,37 +1563,37 @@ Return Value: } else { - status = AvScanInKernel( FltObjects, + status = AvScanInKernel( FltObjects, IOMajorFunctionAtScan, IsInTxWriter, StreamContext ); - + if (!NT_SUCCESS( status )) { - + AV_DBG_PRINT( AVDBG_TRACE_ROUTINES, ("[AV] AvScan: failed to scan the file.\n") ); } } - + } // // Signal ScanSynchronizationEvent to release any con-current scan of the stream, - // - KeSetEvent( StreamContext->ScanSynchronizationEvent, 0, FALSE ); + // + KeSetEvent( StreamContext->ScanSynchronizationEvent, 0, FALSE ); } else if (IOMajorFunctionAtScan == IRP_MJ_CREATE) { // - // I/O requesting thread if waiting on synchronization event is cancelled, + // I/O requesting thread if waiting on synchronization event is cancelled, // we need to clean up the file object too. // AvCancelFileOpen(Data, FltObjects, status); } - + FsRtlExitFileSystem(); - + return status; } @@ -1612,7 +1611,7 @@ Routine Description: Arguments: ScanContext - The scan context. - + SectionContext - The section context associated with the scan context. Return Value: @@ -1623,9 +1622,9 @@ Return Value: { NTSTATUS status; PAV_STREAM_CONTEXT streamContext = NULL; - + PAGED_CODE(); - + AvFinalizeSectionContext( SectionContext ); status = FltGetStreamContext( ScanContext->FilterInstance, @@ -1633,21 +1632,21 @@ Return Value: &streamContext ); if (NT_SUCCESS( status )) { - + KeSetEvent( streamContext->ScanSynchronizationEvent, 0, FALSE ); FltReleaseContext( streamContext ); } - + // // Release I/O request thread. // - + KeSetEvent( &ScanContext->ScanCompleteNotification, 0, FALSE ); return; } NTSTATUS -AvSendAbortToUser ( +AvSendAbortToUser ( _In_ ULONG ScanThreadId, _In_ LONGLONG ScanId ) @@ -1656,7 +1655,7 @@ AvSendAbortToUser ( Routine Description: This routine sends an abortion message to the user scan thread. - The cancel callback is asynchronous and thus we send which + The cancel callback is asynchronous and thus we send which scan id to abort; otherwise the worker thread in the user may abort the 'next' scan task. @@ -1676,19 +1675,19 @@ Return Value: ULONG replyLength = 0; LARGE_INTEGER timeout = {0}; AV_SCANNER_NOTIFICATION notification = {0}; - + PAGED_CODE(); - + notification.Message = AvMsgAbortScanning; notification.ScanThreadId = ScanThreadId; notification.ScanId = ScanId; - + timeout.QuadPart = -((LONGLONG)10) * (LONGLONG)1000 * (LONGLONG)1000; // 1s - + // // Tell the user-scanner to abort the scan. // - + status = FltSendMessage( Globals.Filter, &Globals.AbortClientPort, ¬ification, @@ -1697,11 +1696,11 @@ Return Value: &replyLength, &timeout ); - - if (!NT_SUCCESS( status ) || + + if (!NT_SUCCESS( status ) || (status == STATUS_TIMEOUT)) { - - if ((status != STATUS_PORT_DISCONNECTED) && + + if ((status != STATUS_PORT_DISCONNECTED) && (status != STATUS_TIMEOUT)) { AV_DBG_PRINT( AVDBG_TRACE_ERROR, @@ -1714,7 +1713,7 @@ Return Value: } NTSTATUS -AvSendUnloadingToUser ( +AvSendUnloadingToUser ( VOID ) /*++ @@ -1737,19 +1736,19 @@ Return Value: NTSTATUS status = STATUS_SUCCESS; ULONG replyLength = sizeof(ULONG); AV_SCANNER_NOTIFICATION notification = {0}; - + PAGED_CODE(); - + notification.Message = AvMsgFilterUnloading; - + // // Tell the user-scanner that we are unloading the filter. // and waits for its reply. // - + AV_DBG_PRINT( AVDBG_TRACE_DEBUG, ("[Av]: AvSendUnloadingToUser: BEFORE...\n") ); - + status = FltSendMessage( Globals.Filter, &Globals.AbortClientPort, ¬ification, @@ -1757,17 +1756,17 @@ Return Value: &abortThreadId, &replyLength, NULL ); - + if (!NT_SUCCESS( status )) { - + AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[Av]: AvSendUnloadingToUser: Failed to FltSendMessage.\n, 0x%08x\n", status) ); } - + AV_DBG_PRINT( AVDBG_TRACE_DEBUG, ("[Av]: AvSendUnloadingToUser: After...\n") ); - + return status; } @@ -1785,8 +1784,8 @@ AvPreOperationCallback ( Routine Description: - This routine is the registered callback routine for filtering - the "write" operation, i.e. the operations that have potentials + This routine is the registered callback routine for filtering + the "write" operation, i.e. the operations that have potentials to modify the file. This is non-pageable because it could be called on the paging path @@ -1799,7 +1798,7 @@ Arguments: opaque handles to this filter, instance, its associated volume and file object. - CompletionContext - If this callback routine returns FLT_PREOP_SUCCESS_WITH_CALLBACK or + CompletionContext - If this callback routine returns FLT_PREOP_SUCCESS_WITH_CALLBACK or FLT_PREOP_SYNCHRONIZE, this parameter is an optional context pointer to be passed to the corresponding post-operation callback routine. Otherwise, it must be NULL. @@ -1813,21 +1812,21 @@ Return Value: PAV_STREAM_CONTEXT streamContext = NULL; PAV_STREAMHANDLE_CONTEXT streamHandleContext = NULL; ULONG flags; - + UNREFERENCED_PARAMETER( CompletionContext ); AV_DBG_PRINT( AVDBG_TRACE_ROUTINES, ("[AV] AvPreOperationCallback: Entered\n") ); if (!AvOperationsModifyingFile(Data)) { - + return FLT_PREOP_SUCCESS_NO_CALLBACK; } // // Skip prefetcher handles to avoid deadlocks // - + status = FltGetStreamHandleContext( FltObjects->Instance, FltObjects->FileObject, &streamHandleContext ); @@ -1836,20 +1835,20 @@ Return Value: flags = streamHandleContext->Flags; FltReleaseContext( streamHandleContext ); - + if (FlagOn( flags, AV_FLAG_PREFETCH )) { return FLT_PREOP_SUCCESS_NO_CALLBACK; - } + } } status = FltGetStreamContext( FltObjects->Instance, FltObjects->FileObject, &streamContext ); - + if (!NT_SUCCESS( status )) { - + AV_DBG_PRINT( AVDBG_TRACE_ROUTINES, - ("[AV] AvPreOperationCallback: get stream context failed. rq: %d\n", + ("[AV] AvPreOperationCallback: get stream context failed. rq: %d\n", Data->Iopb->MajorFunction) ); return FLT_PREOP_SUCCESS_NO_CALLBACK; @@ -1858,10 +1857,10 @@ Return Value: // // If this operation is performed in a transacted writer view. // - + if ((streamContext->TxContext != NULL) && (FltObjects->Transaction != NULL)) { - + #if DBG PAV_TRANSACTION_CONTEXT transactionContext = NULL; @@ -1870,32 +1869,32 @@ Return Value: &transactionContext ); FLT_ASSERTMSG( "Transaction context should not fail, because it is supposed to be created at post create.\n", NT_SUCCESS( statusTx )); - FLT_ASSERTMSG( "The file's TxCtx should be identical with the target TxCtx.\n", + FLT_ASSERTMSG( "The file's TxCtx should be identical with the target TxCtx.\n", streamContext->TxContext == transactionContext); if (NT_SUCCESS( statusTx )) { FltReleaseContext( transactionContext ); } - + #endif // DBG - + // - // Instead of updating State, we update TxState here, + // Instead of updating State, we update TxState here, // because the file is part of a transaction writer // - + SET_FILE_TX_MODIFIED( streamContext ); - + } else { - + // // Consider an optimization for the case where another thread // is already scanning the file as it is being modified here. // - + SET_FILE_MODIFIED( streamContext ); } - + FltReleaseContext( streamContext ); return FLT_PREOP_SUCCESS_NO_CALLBACK; @@ -1922,7 +1921,7 @@ Arguments: opaque handles to this filter, instance, its associated volume and file object. - CompletionContext - If this callback routine returns FLT_PREOP_SUCCESS_WITH_CALLBACK or + CompletionContext - If this callback routine returns FLT_PREOP_SUCCESS_WITH_CALLBACK or FLT_PREOP_SYNCHRONIZE, this parameter is an optional context pointer to be passed to the corresponding post-operation callback routine. Otherwise, it must be NULL. @@ -1934,15 +1933,15 @@ Return Value: { PAGED_CODE(); - + if (Data->Iopb->Parameters.FileSystemControl.Common.FsControlCode == FSCTL_TXFS_SAVEPOINT_INFORMATION ) { - - // + + // // We explicitly fail the request of save point here since we // are deprecating savepoint support for the OS version targeted - // for this filter. + // for this filter. // - + Data->IoStatus.Status = STATUS_NOT_SUPPORTED; return FLT_PREOP_COMPLETE; } @@ -1960,7 +1959,7 @@ AvPreCreate ( Routine Description: This routine is the pre-create completion routine. - + Arguments: @@ -1970,7 +1969,7 @@ Arguments: opaque handles to this filter, instance, its associated volume and file object. - CompletionContext - If this callback routine returns FLT_PREOP_SUCCESS_WITH_CALLBACK or + CompletionContext - If this callback routine returns FLT_PREOP_SUCCESS_WITH_CALLBACK or FLT_PREOP_SYNCHRONIZE, this parameter is an optional context pointer to be passed to the corresponding post-operation callback routine. Otherwise, it must be NULL. @@ -1985,33 +1984,33 @@ Return Value: ULONG_PTR stackHigh; PFILE_OBJECT FileObject = Data->Iopb->TargetFileObject; AV_STREAMHANDLE_CONTEXT streamHandleContext; - - + + PAGED_CODE(); AV_DBG_PRINT( AVDBG_TRACE_ROUTINES, ("[AV] AvPreCreate: Entered\n") ); streamHandleContext.Flags = 0; - + // // Stack file objects are never scanned. // IoGetStackLimits( &stackLow, &stackHigh ); - if (((ULONG_PTR)FileObject > stackLow) && + if (((ULONG_PTR)FileObject > stackLow) && ((ULONG_PTR)FileObject < stackHigh)) { return FLT_PREOP_SUCCESS_NO_CALLBACK; } - + // // Directory opens don't need to be scanned. // if (FlagOn( Data->Iopb->Parameters.Create.Options, FILE_DIRECTORY_FILE )) { - + return FLT_PREOP_SUCCESS_NO_CALLBACK; } @@ -2020,27 +2019,27 @@ Return Value: // if ( FlagOn( Data->Iopb->OperationFlags, SL_OPEN_TARGET_DIRECTORY )) { - + return FLT_PREOP_SUCCESS_NO_CALLBACK; } - + // // Skip paging files. // if (FlagOn( Data->Iopb->OperationFlags, SL_OPEN_PAGING_FILE )) { - + return FLT_PREOP_SUCCESS_NO_CALLBACK; } // - // Skip scanning DASD opens + // Skip scanning DASD opens // - + if (FlagOn( FltObjects->FileObject->Flags, FO_VOLUME_OPEN )) { - return FLT_PREOP_SUCCESS_NO_CALLBACK; - } + return FLT_PREOP_SUCCESS_NO_CALLBACK; + } // // Skip scanning any files being opened by CSVFS for its downlevel @@ -2049,10 +2048,10 @@ Return Value: // if (AvIsCsvDlEcpPresent( FltObjects->Filter, Data ) ) { - return FLT_PREOP_SUCCESS_NO_CALLBACK; + return FLT_PREOP_SUCCESS_NO_CALLBACK; } - + // // Flag prefetch handles so they can be skipped. Performing IO // using a prefetch fileobject could lead to a deadlock. @@ -2060,7 +2059,7 @@ Return Value: if (AvIsPrefetchEcpPresent( FltObjects->Filter, Data )) { - SetFlag( streamHandleContext.Flags, AV_FLAG_PREFETCH ); + SetFlag( streamHandleContext.Flags, AV_FLAG_PREFETCH ); } *CompletionContext = (PVOID)streamHandleContext.Flags; @@ -2069,17 +2068,17 @@ Return Value: // Perform any CSVFS pre create processing // AvPreCreateCsvfs( Data, FltObjects ); - + // // return status can be safely ignored // - + // - // Return FLT_PREOP_SYNCHRONIZE at PreCreate to ensure PostCreate - // is in the same thread at passive level. + // Return FLT_PREOP_SYNCHRONIZE at PreCreate to ensure PostCreate + // is in the same thread at passive level. // EResource can't be acquired at DPC. // - + return FLT_PREOP_SYNCHRONIZE; } @@ -2093,8 +2092,8 @@ AvProcessPreviousTransaction ( Routine Description: - This routine is transaction related implementation, and is expected to be - invoked at post-create. Note that this function will enlist the newly + This routine is transaction related implementation, and is expected to be + invoked at post-create. Note that this function will enlist the newly allocated transaction context via FltEnlistInTransaction if it needs to. Arguments: @@ -2114,45 +2113,45 @@ Return Value: NTSTATUS status = STATUS_SUCCESS; PAV_TRANSACTION_CONTEXT oldTxCtx = NULL; PAV_TRANSACTION_CONTEXT transactionContext = NULL; - + PAGED_CODE(); - if (FltObjects->Transaction != NULL ) { - + if (FltObjects->Transaction != NULL ) { + // // Get transaction context // status = AvFindOrCreateTransactionContext( FltObjects, &transactionContext ); - + if (!NT_SUCCESS( status )) { - + AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[AV] AvProcessPreviousTransaction: AvFindOrCreateTransactionContext FAILED\n") ); transactionContext = NULL; goto Cleanup; } - + // // Enlist it if haven't. // - + if (! FlagOn(transactionContext->Flags, AV_TXCTX_ENLISTED) ) { // - // You can also consider to register TRANSACTION_NOTIFY_PREPARE, + // You can also consider to register TRANSACTION_NOTIFY_PREPARE, // and scan the file at TRANSACTION_NOTIFY_PREPARE callback if it was modified. // - + status = FltEnlistInTransaction( FltObjects->Instance, FltObjects->Transaction, transactionContext, TRANSACTION_NOTIFY_COMMIT_FINALIZE | TRANSACTION_NOTIFY_ROLLBACK ); - + if (!NT_SUCCESS( status ) && (status != STATUS_FLT_ALREADY_ENLISTED)) { - + AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[AV] AvProcessPreviousTransaction: FltEnlistInTransaction FAILED!!!!\n") ); goto Cleanup; @@ -2181,113 +2180,113 @@ Return Value: // oldTxCtx : NULL // transCtx : NULL // - + // // Synchronize the replacement of StreamContext->TxContext with KTM callback. // - + oldTxCtx = InterlockedExchangePointer( &StreamContext->TxContext, transactionContext ); - + if (oldTxCtx != transactionContext) { // case 1,2,3 - + // - // txOutcome is by default set as committed because we are conservative about - // propagating the file state if AvQueryTransactionOutcome failed, it may cause + // txOutcome is by default set as committed because we are conservative about + // propagating the file state if AvQueryTransactionOutcome failed, it may cause // redundant scan but will not overlook infected file anyway. // - + ULONG txOutcome = TransactionOutcomeCommitted; if ( oldTxCtx == NULL ) { // case 1 - + // This file was not linked in a transaction context yet, and is about to. // // Increment TxContext's reference count because stream context has a reference to it. // - + FltReferenceContext ( transactionContext ); - + // // Before insertion into the FcList in transaction context, we increment stream context's ref count // - + AvAcquireResourceExclusive( transactionContext->Resource ); - + if (!FlagOn(transactionContext->Flags, AV_TXCTX_LISTDRAINED)) { - + FltReferenceContext ( StreamContext ); // Q InsertTailList( &transactionContext->ScListHead, &StreamContext->ListInTransaction ); } - + AvReleaseResource( transactionContext->Resource ); - + goto Cleanup; } // case 2,3 - + // - // We have to query transaction outcome in order to know how we + // We have to query transaction outcome in order to know how we // can process the previously outstanding transaction context. // - + status = AvQueryTransactionOutcome( oldTxCtx->Transaction, &txOutcome ); - + if (!NT_SUCCESS( status )) { - + AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[AV] AvProcessPreviousTransaction: AvQueryTransactionOutcome FAILED!!!!\n") ); - + // - // We have exchanged the pointer anyway, if we cannot query its outcome, + // We have exchanged the pointer anyway, if we cannot query its outcome, // we have to go through. // } - + AvAcquireResourceExclusive( oldTxCtx->Resource ); RemoveEntryList ( &StreamContext->ListInTransaction ); AvReleaseResource( oldTxCtx->Resource ); - + AvPropagateFileState ( StreamContext, txOutcome ); - + if ( transactionContext ) { // case 3 - + FltReferenceContext( transactionContext ); - + AvAcquireResourceExclusive( transactionContext->Resource ); if (!FlagOn(transactionContext->Flags, AV_TXCTX_LISTDRAINED)) { - + InsertTailList( &transactionContext->ScListHead, &StreamContext->ListInTransaction ); } else { - + FltReleaseContext( StreamContext ); } - + AvReleaseResource( transactionContext->Resource ); - + } else { // case 2 - + FltReleaseContext ( StreamContext ); // Release reference count at Q } - + // case 2,3 - + FltReleaseContext( oldTxCtx ); // Release reference count in stream context originally. - + } - + // // We don't care about case 4, 5. // - + Cleanup: if (transactionContext) { - + FltReleaseContext( transactionContext ); // Release the ref count grabbed at AvFindOrCreateTransactionContext(...) } @@ -2307,8 +2306,8 @@ Routine Description: This routine is the post-create completion routine. In this routine, stream context and/or transaction context shall be created if not exits. - - Note that we only allocate and set the stream context to filter manager + + Note that we only allocate and set the stream context to filter manager at post create. Arguments: @@ -2332,7 +2331,7 @@ Return Value: NTSTATUS status = Data->IoStatus.Status; BOOLEAN isDir = FALSE; BOOLEAN isTxWriter = FALSE; - + PAV_STREAM_CONTEXT streamContext = NULL; PAV_STREAM_CONTEXT oldStreamContext = NULL; PAV_STREAMHANDLE_CONTEXT streamHandleContext = NULL; @@ -2340,15 +2339,15 @@ Return Value: BOOLEAN updateRevisionNumbers; LONGLONG VolumeRevision, CacheRevision, FileRevision; - + UNREFERENCED_PARAMETER( CompletionContext ); UNREFERENCED_PARAMETER( Flags ); - + PAGED_CODE(); - + if (!NT_SUCCESS( status ) || (status == STATUS_REPARSE)) { - + // // File Creation may fail. // @@ -2358,7 +2357,7 @@ Return Value: return FLT_POSTOP_FINISHED_PROCESSING; } - + // // After creation, skip it if it is directory. // @@ -2366,29 +2365,29 @@ Return Value: status = FltIsDirectory( FltObjects->FileObject, FltObjects->Instance, &isDir ); - + // // If FltIsDirectory failed, we do not know if it is a directoy, // we let it go through because if it is a directory, it will fail // at section creation anyway. // - + if ( NT_SUCCESS( status ) && isDir ) { - + return FLT_POSTOP_FINISHED_PROCESSING; } // // We skip the encrypted file open without FILE_WRITE_DATA and FILE_READ_DATA - // This is because if application calls OpenEncryptedFileRaw(...) for backup, - // it won't have to decrypt the file. In such case, if we scan it, we will hit + // This is because if application calls OpenEncryptedFileRaw(...) for backup, + // it won't have to decrypt the file. In such case, if we scan it, we will hit // an assertion error in NTFS because it does not have the encryption context. // Thus, we have to skip the encrypted file not open for read/write. // - - if (!(FlagOn(desiredAccess, FILE_WRITE_DATA)) && + + if (!(FlagOn(desiredAccess, FILE_WRITE_DATA)) && !(FlagOn(desiredAccess, FILE_READ_DATA)) ) { - + BOOLEAN encrypted = FALSE; status = AvGetFileEncrypted( FltObjects->Instance, FltObjects->FileObject, @@ -2399,18 +2398,18 @@ Return Value: ("[AV] AvPostCreate: AvGetFileEncrypted FAILED!! \n0x%x\n", status) ); } if (encrypted) { - + return FLT_POSTOP_FINISHED_PROCESSING; } } - + // - // In this sample, we skip the alternate data stream. However, you may decide + // In this sample, we skip the alternate data stream. However, you may decide // to scan it and modify accordingly. // - + if (AvIsStreamAlternate( Data )) { - + return FLT_POSTOP_FINISHED_PROCESSING; } @@ -2422,20 +2421,20 @@ Return Value: if (FlagOn((ULONG_PTR)CompletionContext, AV_FLAG_PREFETCH)) { if (!FltSupportsStreamHandleContexts( FltObjects->FileObject )) { - + return FLT_POSTOP_FINISHED_PROCESSING; } - status = AvCreateStreamHandleContext( FltObjects->Filter, + status = AvCreateStreamHandleContext( FltObjects->Filter, &streamHandleContext ); if (!NT_SUCCESS(status)) { - - return FLT_POSTOP_FINISHED_PROCESSING; + + return FLT_POSTOP_FINISHED_PROCESSING; } SetFlag( streamHandleContext->Flags, AV_FLAG_PREFETCH ); - + status = FltSetStreamHandleContext( FltObjects->Instance, FltObjects->FileObject, FLT_SET_CONTEXT_KEEP_IF_EXISTS, @@ -2445,84 +2444,84 @@ Return Value: FltReleaseContext( streamHandleContext ); if (!NT_SUCCESS(status)) { - + // // Shouldn't find the handle already set // - + ASSERT( status != STATUS_FLT_CONTEXT_ALREADY_DEFINED ); } - return FLT_POSTOP_FINISHED_PROCESSING; + return FLT_POSTOP_FINISHED_PROCESSING; } - + // // Find or create a stream context // status = FltGetStreamContext( FltObjects->Instance, FltObjects->FileObject, - &streamContext ); + &streamContext ); if (status == STATUS_NOT_FOUND) { - + // // Create a stream context // - + status = AvCreateStreamContext( FltObjects->Filter, &streamContext ); - + if (!NT_SUCCESS( status )) { - + AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[Av]: Failed to create stream context with status 0x%x. (FileObject = %p, Instance = %p)\n", status, FltObjects->FileObject, FltObjects->Instance) ); - + return FLT_POSTOP_FINISHED_PROCESSING; } - + // // Attempt to get the stream infected state from our cache - // - + // + status = AvGetFileId( FltObjects->Instance, FltObjects->FileObject, &streamContext->FileId ); - + if (!NT_SUCCESS( status )) { - + AV_DBG_PRINT( AVDBG_TRACE_ROUTINES, ("[Av]: Failed to get file id with status 0x%x. (FileObject = %p, Instance = %p)\n", status, FltObjects->FileObject, FltObjects->Instance) ); - + // // File id is optional and therefore should not affect the scan logic. // - + AV_SET_INVALID_FILE_REFERENCE( streamContext->FileId ) - + } else { // - // This function will load the file infected state from the + // This function will load the file infected state from the // cache if the fileID is valid. Even if this function fails, // we still have to move on because the cache is optional. // - AvLoadFileStateFromCache( FltObjects->Instance, + AvLoadFileStateFromCache( FltObjects->Instance, &streamContext->FileId, &streamContext->State, &streamContext->VolumeRevision, &streamContext->CacheRevision, - &streamContext->FileRevision ); + &streamContext->FileRevision ); } - + // // Set the new context we just allocated on the file object // - + status = FltSetStreamContext( FltObjects->Instance, FltObjects->FileObject, FLT_SET_CONTEXT_KEEP_IF_EXISTS, @@ -2537,7 +2536,7 @@ Return Value: // Race condition. Someone has set a context after we queried it. // Use the already set context instead // - + AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[Av]: Race: Stream context already defined. Retaining old stream context %p (FileObject = %p, Instance = %p)\n", oldStreamContext, @@ -2558,50 +2557,50 @@ Return Value: goto Cleanup; } } - + } else if (!NT_SUCCESS(status)) { // // We will get here if stream contexts are not supported // - + AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[Av]: Failed to get stream context with status 0x%x. (FileObject = %p, Instance = %p)\n", status, FltObjects->FileObject, FltObjects->Instance) ); - + return FLT_POSTOP_FINISHED_PROCESSING; } - + // // If successfully opened a file with the desired access matching - // the "exclusive write" from a TxF point of view, we can guarantee that - // if previous transaction context exists, it must have been comitted + // the "exclusive write" from a TxF point of view, we can guarantee that + // if previous transaction context exists, it must have been comitted // or rollbacked. // - + if (FlagOn( Data->Iopb->Parameters.Create.SecurityContext->DesiredAccess, FILE_WRITE_DATA | FILE_APPEND_DATA | DELETE | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | WRITE_DAC | WRITE_OWNER | ACCESS_SYSTEM_SECURITY ) ) { - + // // Either this file is opened in a transaction context or not, // we need to process the previous transaction if it exists. // AvProcessPreviousTransaction(...) handles these cases. // - + status = AvProcessPreviousTransaction ( FltObjects, streamContext ); if (!NT_SUCCESS( status )) { - + AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[AV] AvPostCreate: AvProcessTransaction FAILED!! \n") ); goto Cleanup; } - + isTxWriter = (FltObjects->Transaction != NULL); } @@ -2620,9 +2619,9 @@ Return Value: // - + if (IS_FILE_NEED_SCAN( streamContext )) { - + status = AvScan( Data, FltObjects, AvUserMode, @@ -2631,7 +2630,7 @@ Return Value: streamContext ); if (!NT_SUCCESS( status ) || (STATUS_TIMEOUT == status)) { - + AV_DBG_PRINT( AVDBG_TRACE_ROUTINES, ("[AV] AvPostCreate: AvScan FAILED!! \n") ); @@ -2648,7 +2647,7 @@ Return Value: streamContext->VolumeRevision = VolumeRevision; streamContext->CacheRevision = CacheRevision; streamContext->FileRevision = FileRevision; - + AV_DBG_PRINT( AVDBG_TRACE_DEBUG, ("[Av]: AvPostCreate: RevisionNumbers updated to %I64x:%I64x:%I64x\n", VolumeRevision, @@ -2656,30 +2655,30 @@ Return Value: FileRevision) ); } - + if (IS_FILE_INFECTED( streamContext )) { - + // // If the file is infected, deny the access. // AvCancelFileOpen(Data, FltObjects, STATUS_VIRUS_INFECTED); // - // If the scan timed-out or scan was failed, we let the create succeed, + // If the scan timed-out or scan was failed, we let the create succeed, // and it may cause security hole; // // Alternatively, you can add a state called AvFileScanFailure or equivalent, - // add a condition here and fail the create. This option will have better - // protection from viruses, but the apps will see the failures due to a + // add a condition here and fail the create. This option will have better + // protection from viruses, but the apps will see the failures due to a // lengthy scan or scan failure. It's a trade-off. // goto Cleanup; } - + Cleanup: - + FltReleaseContext( streamContext ); - + return FLT_POSTOP_FINISHED_PROCESSING; } @@ -2694,7 +2693,7 @@ AvPreCleanup ( Routine Description: Pre-cleanup callback. Make the stream context persistent in the volatile cache. - If the file is transacted, it will be synced at KTM notification callback + If the file is transacted, it will be synced at KTM notification callback if committed. Arguments: @@ -2705,7 +2704,7 @@ Arguments: opaque handles to this filter, instance, its associated volume and file object. - CompletionContext - If this callback routine returns FLT_PREOP_SUCCESS_WITH_CALLBACK or + CompletionContext - If this callback routine returns FLT_PREOP_SUCCESS_WITH_CALLBACK or FLT_PREOP_SYNCHRONIZE, this parameter is an optional context pointer to be passed to the corresponding post-operation callback routine. Otherwise, it must be NULL. @@ -2714,7 +2713,7 @@ Return Value: The return value is the status of the operation. --*/ -{ +{ NTSTATUS status; BOOLEAN encrypted = FALSE; PAV_STREAM_CONTEXT streamContext = NULL; @@ -2724,15 +2723,15 @@ Return Value: BOOLEAN updateRevisionNumbers; LONGLONG VolumeRevision, CacheRevision, FileRevision; - + UNREFERENCED_PARAMETER( CompletionContext ); - + PAGED_CODE(); // // Skip scan on prefetcher handles to avoid deadlocks // - + status = FltGetStreamHandleContext( FltObjects->Instance, FltObjects->FileObject, &streamHandleContext ); @@ -2743,8 +2742,8 @@ Return Value: // // Because the Memory Manager can cache the file object // and use it for other applications performing mapped I/O, - // whenever a Cleanup operation is seen on a prefetcher - // file object, that file object should no longer be + // whenever a Cleanup operation is seen on a prefetcher + // file object, that file object should no longer be // considered prefetcher-opened. // @@ -2756,7 +2755,7 @@ Return Value: NULL ); FltReleaseContext( streamHandleContext ); - + return FLT_PREOP_SUCCESS_NO_CALLBACK; } @@ -2769,7 +2768,7 @@ Return Value: IoGetStackLimits( &stackLow, &stackHigh ); - if (((ULONG_PTR)FltObjects->FileObject > stackLow) && + if (((ULONG_PTR)FltObjects->FileObject > stackLow) && ((ULONG_PTR)FltObjects->FileObject < stackHigh)) { return FLT_PREOP_SUCCESS_NO_CALLBACK; @@ -2797,7 +2796,7 @@ Return Value: FltObjects->FileObject, &encrypted ); if (!NT_SUCCESS( status )) { - + AV_DBG_PRINT( AVDBG_TRACE_ERROR, ("[AV] AvPreCleanup: AvGetFileEncrypted FAILED!! \n") ); @@ -2805,7 +2804,7 @@ Return Value: } if (encrypted) { - + goto Cleanup; } @@ -2819,16 +2818,16 @@ Return Value: // // For applications, the typical calling sequence is, close the file handle - // and commit/rollback the changes. We skip the scan here for - // transacted writer because we do not know if the change will be - // rollbacked or not. If it eventually commits, it will be scanned - // at next create anyway. However, if it rollbacks, the scan here will + // and commit/rollback the changes. We skip the scan here for + // transacted writer because we do not know if the change will be + // rollbacked or not. If it eventually commits, it will be scanned + // at next create anyway. However, if it rollbacks, the scan here will // be redundant. // - if ((streamContext->TxContext == NULL) && + if ((streamContext->TxContext == NULL) && IS_FILE_MODIFIED( streamContext )) { - + status = AvScan( Data, FltObjects, AvUserMode, @@ -2837,7 +2836,7 @@ Return Value: streamContext ); if (!NT_SUCCESS( status ) || STATUS_TIMEOUT == status) { - + AV_DBG_PRINT( AVDBG_TRACE_ROUTINES, ("[AV] AvPreCleanup: AvScan FAILED!! \n") ); @@ -2870,7 +2869,7 @@ Cleanup: // We only insert the entry when the file is clean or infected. // - if (!IS_FILE_MODIFIED( streamContext ) || + if (!IS_FILE_MODIFIED( streamContext ) || IS_FILE_INFECTED( streamContext )) { if (!NT_SUCCESS ( AvSyncCache( FltObjects->Instance, streamContext ))) { @@ -2897,7 +2896,7 @@ Routine Description: The registered routine of type PFLT_TRANSACTION_NOTIFICATION_CALLBACK in FLT_REGISTRATION structure. - + Arguments: FltObjects - Pointer to the FLT_RELATED_OBJECTS data structure containing @@ -2906,17 +2905,17 @@ Arguments: TransactionContext - Pointer to the minifilter driver's transaction context set at PostCreate. - - TransactionNotification - Specifies the type of notifications that the + + TransactionNotification - Specifies the type of notifications that the filter manager is sending to the minifilter driver. Return Value: - STATUS_SUCCESS - Returning this status value indicates that the minifilter + STATUS_SUCCESS - Returning this status value indicates that the minifilter driver is finished with the transaction. This is a success code. - - STATUS_PENDING - Returning this status value indicates that the minifilter - driver is not yet finished with the transaction. This is a success code. + + STATUS_PENDING - Returning this status value indicates that the minifilter + driver is not yet finished with the transaction. This is a success code. --*/ { @@ -2925,20 +2924,20 @@ Return Value: PAGED_CODE(); UNREFERENCED_PARAMETER( FltObjects ); - + FLT_ASSERTMSG("[AV] AvKtmNotificationCallback: The expected type of notifications registered at FltEnlistInTransaction(...).\n", FlagOn( TransactionNotification, (TRANSACTION_NOTIFY_COMMIT_FINALIZE | TRANSACTION_NOTIFY_ROLLBACK) ) ); AV_DBG_PRINT( AVDBG_TRACE_ROUTINES, ("[AV] AvKtmNotificationCallback: Entered\n") ); - + if (NULL != transactionContext) { if ( FlagOn( TransactionNotification, TRANSACTION_NOTIFY_COMMIT_FINALIZE ) ) { - + return AvProcessTransactionOutcome( TransactionContext, TransactionOutcomeCommitted ); - + } else { return AvProcessTransactionOutcome( TransactionContext, TransactionOutcomeAborted ); @@ -2959,8 +2958,8 @@ AvScanAbortCallbackAsync ( Routine Description: This routine is the registered cancel callback function in FLT_REGISTRATION. - It would be invoked by the file system if it decides to abort the scan. - As its name suggests, this function is asynchrounous, so the caller is not + It would be invoked by the file system if it decides to abort the scan. + As its name suggests, this function is asynchrounous, so the caller is not blocked. Note: This routine may be called before FltCreateSectionForDataScan returns. @@ -2971,9 +2970,9 @@ Routine Description: Arguments: Instance - Opaque filter pointer for the caller. This parameter is required and cannot be NULL. - + Context - The section context. - + Data - Pointer to the filter callbackData that is passed to us. Return Value: @@ -3003,34 +3002,35 @@ Return Value: sectionCtx->CancelableOnConflictingIo) ); // - // Send abort signal only when the scanning + // Send abort signal only when the scanning // happens in cancelable context (such as pre-cleanup). // if (sectionCtx->CancelableOnConflictingIo) { // - // The only reason of scan context being NULL is that + // The only reason of scan context being NULL is that // the section context is about to close anyway. // Please see AvCloseSectionForDataScan(...) // scanCtx = InterlockedExchangePointer( §ionCtx->ScanContext, NULL ); if (scanCtx == NULL) { - + return STATUS_SUCCESS; } - + sectionCtx->Aborted = TRUE; AvSendAbortToUser( scanCtx->ScanThreadId, scanCtx->ScanId ); - + } return STATUS_SUCCESS; } -NTSTATUS -AvSetConfiguration ( +NTSTATUS +AvSetConfiguration ( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ) /*++ @@ -3041,6 +3041,9 @@ Routine Descrition: Arguments: + DriverObject - Pointer to driver object created by the system to + represent this driver. + RegistryPath - The path key passed to the driver during DriverEntry. Return Value: @@ -3051,33 +3054,71 @@ Return Value: --*/ { NTSTATUS status; + OSVERSIONINFOW versionInfo; OBJECT_ATTRIBUTES attributes; - HANDLE driverRegKey = NULL; + HANDLE settingsKey = NULL; UNICODE_STRING valueName; UCHAR buffer[sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(ULONG)]; PKEY_VALUE_PARTIAL_INFORMATION value = (PKEY_VALUE_PARTIAL_INFORMATION)buffer; ULONG valueLength = sizeof(buffer); ULONG resultLength; + RtlZeroMemory( &versionInfo, sizeof( versionInfo ) ); + // - // Open the SimRep registry key. + // Determine the OS version being run. // - InitializeObjectAttributes( &attributes, - RegistryPath, - OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, - NULL, - NULL ); + versionInfo.dwOSVersionInfoSize = sizeof( versionInfo ); - status = ZwOpenKey( &driverRegKey, - KEY_READ, - &attributes ); + status = RtlGetVersion( &versionInfo ); if (!NT_SUCCESS( status )) { goto Cleanup; } + // + // Open corresponding registry root. + // NOTE: Build number should match the INF file. + // + + if (versionInfo.dwBuildNumber >= 25900) { + // + // Open the Parameters key for the service. + // + + status = IoOpenDriverRegistryKey( DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &settingsKey ); + + if (!NT_SUCCESS( status )) { + + goto Cleanup; + } + + } else { + // + // Open the legacy settings registry key. + // + + InitializeObjectAttributes( &attributes, + RegistryPath, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, + NULL ); + + status = ZwOpenKey( &settingsKey, + KEY_READ, + &attributes ); + + if (!NT_SUCCESS( status )) { + + goto Cleanup; + } + } #if DBG @@ -3086,8 +3127,8 @@ Return Value: // RtlInitUnicodeString( &valueName, L"DebugLevel" ); - - status = ZwQueryValueKey( driverRegKey, + + status = ZwQueryValueKey( settingsKey, &valueName, KeyValuePartialInformation, value, @@ -3107,16 +3148,16 @@ Return Value: RtlInitUnicodeString( &valueName, L"LocalScanTimeout" ); - status = ZwQueryValueKey( driverRegKey, + status = ZwQueryValueKey( settingsKey, &valueName, KeyValuePartialInformation, value, - valueLength, + valueLength, &resultLength ); if (NT_SUCCESS( status )) { - Globals.LocalScanTimeout = (LONGLONG)(*(PULONG)value->Data); + Globals.LocalScanTimeout = (LONGLONG)(*(PULONG)value->Data); } // @@ -3125,25 +3166,25 @@ Return Value: RtlInitUnicodeString( &valueName, L"NetworkScanTimeout" ); - status = ZwQueryValueKey( driverRegKey, + status = ZwQueryValueKey( settingsKey, &valueName, KeyValuePartialInformation, value, - valueLength, + valueLength, &resultLength ); if (NT_SUCCESS( status )) { - Globals.NetworkScanTimeout = (LONGLONG)(*(PULONG)value->Data); + Globals.NetworkScanTimeout = (LONGLONG)(*(PULONG)value->Data); } status = STATUS_SUCCESS; Cleanup: - if (driverRegKey != NULL) { + if (settingsKey != NULL) { - ZwClose( driverRegKey ); + ZwClose( settingsKey ); } return status; diff --git a/filesys/miniFilter/avscan/filter/avscan.vcxproj b/filesys/miniFilter/avscan/filter/avscan.vcxproj index 5552329c..2ce8ce29 100644 --- a/filesys/miniFilter/avscan/filter/avscan.vcxproj +++ b/filesys/miniFilter/avscan/filter/avscan.vcxproj @@ -188,6 +188,7 @@ + diff --git a/filesys/miniFilter/avscan/filter/avscan.vcxproj.Filters b/filesys/miniFilter/avscan/filter/avscan.vcxproj.Filters index 6254a245..f7f506ae 100644 --- a/filesys/miniFilter/avscan/filter/avscan.vcxproj.Filters +++ b/filesys/miniFilter/avscan/filter/avscan.vcxproj.Filters @@ -43,4 +43,26 @@ Resource Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Driver Files + + \ No newline at end of file diff --git a/filesys/miniFilter/cancelSafe/cancelSafe.c b/filesys/miniFilter/cancelSafe/cancelSafe.c index 4c9e7633..0e18247d 100644 --- a/filesys/miniFilter/cancelSafe/cancelSafe.c +++ b/filesys/miniFilter/cancelSafe/cancelSafe.c @@ -187,6 +187,7 @@ InstanceTeardownComplete ( NTSTATUS SetConfiguration ( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ); @@ -394,7 +395,7 @@ Return Value: // Modify the configuration based on values in the registry // - Status = SetConfiguration( RegistryPath ); + Status = SetConfiguration( DriverObject, RegistryPath ); if (!NT_SUCCESS( Status )) { @@ -459,6 +460,7 @@ DriverEntryCleanup: NTSTATUS SetConfiguration ( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ) /*++ @@ -470,6 +472,9 @@ Routine Description: Arguments: + DriverObject - Pointer to driver object created by the system to + represent this driver. + RegistryPath - The path key passed to the driver during DriverEntry. Return Value: @@ -480,6 +485,7 @@ Return Value: --*/ { NTSTATUS Status; + OSVERSIONINFOW versionInfo; OBJECT_ATTRIBUTES Attributes; HANDLE DriverRegKey = NULL; UNICODE_STRING ValueName; @@ -490,25 +496,62 @@ Return Value: ULONG ResultLength; ULONG Length; + RtlZeroMemory( &versionInfo, sizeof( versionInfo ) ); + // - // Open the driver registry key. + // Determine the OS version being run. // - InitializeObjectAttributes( &Attributes, - RegistryPath, - OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, - NULL, - NULL ); + versionInfo.dwOSVersionInfoSize = sizeof( versionInfo ); - Status = ZwOpenKey( &DriverRegKey, - KEY_READ, - &Attributes ); + Status = RtlGetVersion( &versionInfo ); if (!NT_SUCCESS( Status )) { goto SetConfigurationCleanup; } + // + // Open corresponding registry root. + // NOTE: Build number should match the INF file. + // + + if (versionInfo.dwBuildNumber >= 25900) { + // + // Open the Parameters key for the service. + // + + Status = IoOpenDriverRegistryKey( DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &DriverRegKey ); + + if (!NT_SUCCESS( Status )) { + + goto SetConfigurationCleanup; + } + } else { + // + // Open the legacy driver registry key. + // + + InitializeObjectAttributes( &Attributes, + RegistryPath, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, + NULL ); + + Status = ZwOpenKey( &DriverRegKey, + KEY_READ, + &Attributes ); + + if (!NT_SUCCESS( Status )) { + + goto SetConfigurationCleanup; + } + } + CloseHandle = TRUE; // @@ -534,7 +577,6 @@ Return Value: // Query the queue time delay // - RtlInitUnicodeString( &ValueName, CSQ_KEY_NAME_DELAY ); Status = ZwQueryValueKey( DriverRegKey, diff --git a/filesys/miniFilter/cancelSafe/cancelSafe.inf b/filesys/miniFilter/cancelSafe/cancelSafe.inf index d526b3dc..688fb3f5 100644 Binary files a/filesys/miniFilter/cancelSafe/cancelSafe.inf and b/filesys/miniFilter/cancelSafe/cancelSafe.inf differ diff --git a/filesys/miniFilter/cdo/CdoInit.c b/filesys/miniFilter/cdo/CdoInit.c index fa6e37aa..cef73e32 100644 --- a/filesys/miniFilter/cdo/CdoInit.c +++ b/filesys/miniFilter/cdo/CdoInit.c @@ -50,6 +50,7 @@ CdoInstanceSetup ( VOID CdoInitializeDebugLevel ( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ); @@ -90,12 +91,12 @@ DriverEntry( ) { NTSTATUS status; - - + + // // This defines what we want to filter with FltMgr // - + CONST FLT_REGISTRATION filterRegistration = { sizeof( FLT_REGISTRATION ), // Size FLT_REGISTRATION_VERSION, // Version @@ -109,22 +110,22 @@ DriverEntry( NULL, // InstanceTeardownComplete NULL,NULL // NameProvider callbacks }; - + RtlZeroMemory( &Globals, sizeof( Globals ) ); #if DBG - + // // Initialize global debug level // - CdoInitializeDebugLevel( RegistryPath ); + CdoInitializeDebugLevel( DriverObject, RegistryPath ); #else UNREFERENCED_PARAMETER( RegistryPath ); - + #endif DebugTrace( DEBUG_TRACE_LOAD_UNLOAD, @@ -132,14 +133,14 @@ DriverEntry( // // Initialize the resource - // + // ExInitializeResourceLite( &Globals.Resource ); // // Record the driver object // - + Globals.FilterDriverObject = DriverObject; // @@ -167,7 +168,7 @@ DriverEntry( FltUnregisterFilter( Globals.Filter ); ExDeleteResourceLite( &Globals.Resource ); return status; - } + } // // Start filtering i/o @@ -190,20 +191,24 @@ DriverEntry( VOID CdoInitializeDebugLevel ( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ) /*++ Routine Description: - This routine tries to read the filter DebugLevel parameter from + This routine tries to read the filter DebugLevel parameter from the registry. This value will be found in the registry location indicated by the RegistryPath passed in. Arguments: + DriverObject - Pointer to driver object created by the system to + represent this driver. + RegistryPath - The path key passed to the driver during DriverEntry. - + Return Value: None. @@ -211,7 +216,8 @@ Return Value: --*/ { OBJECT_ATTRIBUTES attributes; - HANDLE driverRegKey; + OSVERSIONINFOW versionInfo; + HANDLE driverRegKey = NULL; NTSTATUS status; ULONG resultLength; UNICODE_STRING valueName; @@ -219,46 +225,84 @@ Return Value: Globals.DebugLevel = DEBUG_TRACE_ERROR; + RtlZeroMemory( &versionInfo, sizeof( versionInfo ) ); + // - // Open the desired registry key + // Determine the OS version being run. // - InitializeObjectAttributes( &attributes, - RegistryPath, - OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, - NULL, - NULL ); + versionInfo.dwOSVersionInfoSize = sizeof( versionInfo ); - status = ZwOpenKey( &driverRegKey, - KEY_READ, - &attributes ); + status = RtlGetVersion( &versionInfo ); - if (NT_SUCCESS( status )) { + if (!NT_SUCCESS( status )) { + goto cleanup; + } + + // + // Open the desired registry key + // + + if (versionInfo.dwBuildNumber >= 25900) { // - // Read the DebugFlags value from the registry. + // Open the Parameters key for the service. // - RtlInitUnicodeString( &valueName, L"DebugLevel" ); - - status = ZwQueryValueKey( driverRegKey, - &valueName, - KeyValuePartialInformation, - buffer, - sizeof(buffer), - &resultLength ); + status = IoOpenDriverRegistryKey( DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &driverRegKey ); + + if (!NT_SUCCESS( status )) { + + goto cleanup; + } + } else { + InitializeObjectAttributes( &attributes, + RegistryPath, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, + NULL ); + + status = ZwOpenKey( &driverRegKey, + KEY_READ, + &attributes ); - if (NT_SUCCESS( status )) { + if (!NT_SUCCESS( status )) { - Globals.DebugLevel = *((PULONG) &(((PKEY_VALUE_PARTIAL_INFORMATION) buffer)->Data)); + goto cleanup; } } + // + // Read the DebugFlags value from the registry. + // + + RtlInitUnicodeString( &valueName, L"DebugLevel" ); + + status = ZwQueryValueKey( driverRegKey, + &valueName, + KeyValuePartialInformation, + buffer, + sizeof(buffer), + &resultLength ); + + if (NT_SUCCESS( status )) { + + Globals.DebugLevel = *((PULONG) &(((PKEY_VALUE_PARTIAL_INFORMATION) buffer)->Data)); + } + +cleanup: + // // Close the registry entry // - ZwClose( driverRegKey ); + if (driverRegKey != NULL) { + ZwClose( driverRegKey ); + } } #endif @@ -274,7 +318,7 @@ Routine Description: This is the unload routine for this filter driver. This is called when the minifilter is about to be unloaded. We can fail this unload - request if this is not a mandatory unloaded indicated by the Flags + request if this is not a mandatory unloaded indicated by the Flags parameter. Arguments: @@ -299,7 +343,7 @@ Return Value: // If the CDO is still referenced and the unload is not mandatry // then fail the unload // - + CdoAcquireResourceShared( &Globals.Resource ); if (FlagOn( Globals.Flags, GLOBAL_DATA_F_CDO_OPEN_REF) && @@ -356,7 +400,7 @@ Arguments: Return Value: - STATUS_FLT_DO_NOT_ATTACH - do not attach because we do not want to + STATUS_FLT_DO_NOT_ATTACH - do not attach because we do not want to attach to any volume --*/ diff --git a/filesys/miniFilter/cdo/cdo.inf b/filesys/miniFilter/cdo/cdo.inf index c51cae2c..51e3f32e 100644 Binary files a/filesys/miniFilter/cdo/cdo.inf and b/filesys/miniFilter/cdo/cdo.inf differ diff --git a/filesys/miniFilter/change/change.inf b/filesys/miniFilter/change/change.inf index 86a7b868..96b52bdc 100644 Binary files a/filesys/miniFilter/change/change.inf and b/filesys/miniFilter/change/change.inf differ diff --git a/filesys/miniFilter/ctx/CtxInit.c b/filesys/miniFilter/ctx/CtxInit.c index 2654b9f9..fbb2d99c 100644 --- a/filesys/miniFilter/ctx/CtxInit.c +++ b/filesys/miniFilter/ctx/CtxInit.c @@ -80,6 +80,7 @@ CtxInstanceTeardownComplete ( VOID CtxInitializeDebugLevel ( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ); @@ -217,7 +218,7 @@ Return Value: // // Default to NonPagedPoolNx for non paged pool allocations where supported. // - + ExInitializeDriverRuntime( DrvRtPoolNxOptIn ); RtlZeroMemory( &Globals, sizeof( Globals ) ); @@ -228,7 +229,7 @@ Return Value: // Initialize global debug level // - CtxInitializeDebugLevel( RegistryPath ); + CtxInitializeDebugLevel( DriverObject, RegistryPath ); #else @@ -276,6 +277,7 @@ Return Value: VOID CtxInitializeDebugLevel ( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ) /*++ @@ -288,6 +290,9 @@ Routine Description: Arguments: + DriverObject - Pointer to driver object created by the system to + represent this driver. + RegistryPath - The path key passed to the driver during DriverEntry. Return Value: @@ -297,7 +302,8 @@ Return Value: --*/ { OBJECT_ATTRIBUTES attributes; - HANDLE driverRegKey; + OSVERSIONINFOW versionInfo; + HANDLE driverRegKey = NULL; NTSTATUS status; ULONG resultLength; UNICODE_STRING valueName; @@ -305,48 +311,88 @@ Return Value: Globals.DebugLevel = DEBUG_TRACE_ERROR; + RtlZeroMemory( &versionInfo, sizeof( versionInfo ) ); + + // + // Determine the OS version being run. + // + + versionInfo.dwOSVersionInfoSize = sizeof( versionInfo ); + + status = RtlGetVersion( &versionInfo ); + + if (!NT_SUCCESS( status )) { + + goto cleanup; + } + // // Open the desired registry key // - InitializeObjectAttributes( &attributes, - RegistryPath, - OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, - NULL, - NULL ); + if (versionInfo.dwBuildNumber >= 25900) { + // + // Open the Parameters key for the service. + // - status = ZwOpenKey( &driverRegKey, - KEY_READ, - &attributes ); + status = IoOpenDriverRegistryKey( DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &driverRegKey ); - if (NT_SUCCESS( status )) { + if (!NT_SUCCESS( status )) { + goto cleanup; + } + } else { // - // Read the DebugFlags value from the registry. + // Open legacy registry key. // - RtlInitUnicodeString( &valueName, L"DebugLevel" ); + InitializeObjectAttributes( &attributes, + RegistryPath, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, + NULL ); - status = ZwQueryValueKey( driverRegKey, - &valueName, - KeyValuePartialInformation, - buffer, - sizeof(buffer), - &resultLength ); + status = ZwOpenKey( &driverRegKey, + KEY_READ, + &attributes ); - if (NT_SUCCESS( status )) { + if (!NT_SUCCESS( status )) { - Globals.DebugLevel = *((PULONG) &(((PKEY_VALUE_PARTIAL_INFORMATION) buffer)->Data)); + goto cleanup; } + } - // - // Close the registry entry - // + // + // Read the DebugFlags value from the registry. + // - ZwClose( driverRegKey ); + RtlInitUnicodeString( &valueName, L"DebugLevel" ); + status = ZwQueryValueKey( driverRegKey, + &valueName, + KeyValuePartialInformation, + buffer, + sizeof(buffer), + &resultLength ); + + if (NT_SUCCESS( status )) { + + Globals.DebugLevel = *((PULONG) &(((PKEY_VALUE_PARTIAL_INFORMATION) buffer)->Data)); } +cleanup: + + // + // Close the registry entry + // + + if (driverRegKey != NULL) { + ZwClose( driverRegKey ); + } } #endif diff --git a/filesys/miniFilter/ctx/ctx.inf b/filesys/miniFilter/ctx/ctx.inf index 39e935af..1f3a833e 100644 Binary files a/filesys/miniFilter/ctx/ctx.inf and b/filesys/miniFilter/ctx/ctx.inf differ diff --git a/filesys/miniFilter/delete/delete.inf b/filesys/miniFilter/delete/delete.inf index b9a572fe..55553269 100644 Binary files a/filesys/miniFilter/delete/delete.inf and b/filesys/miniFilter/delete/delete.inf differ diff --git a/filesys/miniFilter/minispy/filter/minispy.vcxproj b/filesys/miniFilter/minispy/filter/minispy.vcxproj index 04cec7fe..ce4cb737 100644 --- a/filesys/miniFilter/minispy/filter/minispy.vcxproj +++ b/filesys/miniFilter/minispy/filter/minispy.vcxproj @@ -196,6 +196,7 @@ + diff --git a/filesys/miniFilter/minispy/filter/minispy.vcxproj.Filters b/filesys/miniFilter/minispy/filter/minispy.vcxproj.Filters index e0184750..aaaa7c14 100644 --- a/filesys/miniFilter/minispy/filter/minispy.vcxproj.Filters +++ b/filesys/miniFilter/minispy/filter/minispy.vcxproj.Filters @@ -34,4 +34,14 @@ Resource Files + + + Header Files + + + + + Driver Files + + \ No newline at end of file diff --git a/filesys/miniFilter/minispy/minispy.inf b/filesys/miniFilter/minispy/minispy.inf index c210097c..ff9fe039 100644 Binary files a/filesys/miniFilter/minispy/minispy.inf and b/filesys/miniFilter/minispy/minispy.inf differ diff --git a/filesys/miniFilter/nullFilter/nullFilter.inf b/filesys/miniFilter/nullFilter/nullFilter.inf index 0e710e2d..394d9d8f 100644 Binary files a/filesys/miniFilter/nullFilter/nullFilter.inf and b/filesys/miniFilter/nullFilter/nullFilter.inf differ diff --git a/filesys/miniFilter/passThrough/passThrough.inf b/filesys/miniFilter/passThrough/passThrough.inf index 6db4d0d0..2ff9ffee 100644 Binary files a/filesys/miniFilter/passThrough/passThrough.inf and b/filesys/miniFilter/passThrough/passThrough.inf differ diff --git a/filesys/miniFilter/scanner/filter/scanner.c b/filesys/miniFilter/scanner/filter/scanner.c index 318941d1..7602b6a1 100644 --- a/filesys/miniFilter/scanner/filter/scanner.c +++ b/filesys/miniFilter/scanner/filter/scanner.c @@ -56,6 +56,7 @@ UNICODE_STRING ScannedExtensionDefault = RTL_CONSTANT_STRING( L"doc" ); NTSTATUS ScannerInitializeScannedExtensions( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ); @@ -242,7 +243,7 @@ Return Value: // Obtain the extensions to scan from the registry // - status = ScannerInitializeScannedExtensions( RegistryPath ); + status = ScannerInitializeScannedExtensions( DriverObject, RegistryPath ); if (!NT_SUCCESS( status )) { @@ -314,6 +315,7 @@ Return Value: NTSTATUS ScannerInitializeScannedExtensions( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ) /*++ @@ -325,6 +327,9 @@ Routine Descrition: Arguments: + DriverObject - Pointer to driver object created by the system to + represent this driver. + RegistryPath - The path key passed to the driver during DriverEntry. Return Value: @@ -336,6 +341,7 @@ Return Value: { NTSTATUS status; OBJECT_ATTRIBUTES attributes; + OSVERSIONINFOW versionInfo; HANDLE driverRegKey = NULL; UNICODE_STRING valueName; PKEY_VALUE_PARTIAL_INFORMATION valueBuffer = NULL; @@ -351,25 +357,61 @@ Return Value: ScannedExtensions = NULL; ScannedExtensionCount = 0; + RtlZeroMemory( &versionInfo, sizeof( versionInfo ) ); + // - // Open the driver registry key. + // Determine the OS version being run. // - InitializeObjectAttributes( &attributes, - RegistryPath, - OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, - NULL, - NULL ); + versionInfo.dwOSVersionInfoSize = sizeof( versionInfo ); - status = ZwOpenKey( &driverRegKey, - KEY_READ, - &attributes ); + status = RtlGetVersion( &versionInfo ); if (!NT_SUCCESS( status )) { goto ScannerInitializeScannedExtensionsCleanup; } + // + // Open the desired registry key + // + + if (versionInfo.dwBuildNumber >= 25900) { + // + // Open the Parameters key for the service. + // + + status = IoOpenDriverRegistryKey( DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &driverRegKey ); + + if (!NT_SUCCESS( status )) { + + goto ScannerInitializeScannedExtensionsCleanup; + } + } else { + // + // Open legacy registry key. + // + + InitializeObjectAttributes( &attributes, + RegistryPath, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, + NULL ); + + status = ZwOpenKey( &driverRegKey, + KEY_READ, + &attributes ); + + if (!NT_SUCCESS( status )) { + + goto ScannerInitializeScannedExtensionsCleanup; + } + } + closeHandle = TRUE; // @@ -675,7 +717,7 @@ Return Value return STATUS_SUCCESS; } - + VOID ScannerPortDisconnect( _In_opt_ PVOID ConnectionCookie @@ -717,7 +759,7 @@ Return value ScannerData.UserProcess = NULL; } - + NTSTATUS ScannerUnload ( _In_ FLT_FILTER_UNLOAD_FLAGS Flags diff --git a/filesys/miniFilter/scanner/filter/scanner.vcxproj b/filesys/miniFilter/scanner/filter/scanner.vcxproj index a3eeebcb..04644758 100644 --- a/filesys/miniFilter/scanner/filter/scanner.vcxproj +++ b/filesys/miniFilter/scanner/filter/scanner.vcxproj @@ -190,6 +190,7 @@ + diff --git a/filesys/miniFilter/scanner/filter/scanner.vcxproj.Filters b/filesys/miniFilter/scanner/filter/scanner.vcxproj.Filters index 043528f2..fbf265f0 100644 --- a/filesys/miniFilter/scanner/filter/scanner.vcxproj.Filters +++ b/filesys/miniFilter/scanner/filter/scanner.vcxproj.Filters @@ -28,4 +28,14 @@ Resource Files + + + Header Files + + + + + Driver Files + + \ No newline at end of file diff --git a/filesys/miniFilter/scanner/scanner.inf b/filesys/miniFilter/scanner/scanner.inf index 762f5eec..94775cfc 100644 Binary files a/filesys/miniFilter/scanner/scanner.inf and b/filesys/miniFilter/scanner/scanner.inf differ diff --git a/filesys/miniFilter/simrep/simrep.c b/filesys/miniFilter/simrep/simrep.c index 4d377ecb..26bd1645 100644 --- a/filesys/miniFilter/simrep/simrep.c +++ b/filesys/miniFilter/simrep/simrep.c @@ -245,6 +245,7 @@ DriverEntry ( NTSTATUS SimRepSetConfiguration( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ); @@ -609,7 +610,7 @@ Return Value: // Set the filter configuration based on registry keys // - status = SimRepSetConfiguration( RegistryPath ); + status = SimRepSetConfiguration( DriverObject, RegistryPath ); DebugTrace( DEBUG_TRACE_LOAD_UNLOAD, ("[SimRep]: Driver being loaded\n") ); @@ -666,6 +667,7 @@ DriverEntryCleanup: NTSTATUS SimRepSetConfiguration( + _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ) /*++ @@ -676,6 +678,9 @@ Routine Descrition: Arguments: + DriverObject - Pointer to driver object created by the system to + represent this driver. + RegistryPath - The path key passed to the driver during DriverEntry. Return Value: @@ -687,6 +692,7 @@ Return Value: { NTSTATUS status; OBJECT_ATTRIBUTES attributes; + OSVERSIONINFOW versionInfo; HANDLE driverRegKey = NULL; UNICODE_STRING valueName; UCHAR buffer[sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(ULONG)]; @@ -700,25 +706,61 @@ Return Value: PAGED_CODE(); + RtlZeroMemory( &versionInfo, sizeof( versionInfo ) ); + // - // Open the SimRep registry key. + // Determine the OS version being run. // - InitializeObjectAttributes( &attributes, - RegistryPath, - OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, - NULL, - NULL ); + versionInfo.dwOSVersionInfoSize = sizeof( versionInfo ); - status = ZwOpenKey( &driverRegKey, - KEY_READ, - &attributes ); + status = RtlGetVersion( &versionInfo ); if (!NT_SUCCESS( status )) { goto SimRepSetConfigurationCleanup; } + // + // Open the desired registry key + // + + if (versionInfo.dwBuildNumber >= 25900) { + // + // Open the Parameters key for the service. + // + + status = IoOpenDriverRegistryKey( DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &driverRegKey ); + + if (!NT_SUCCESS( status )) { + + goto SimRepSetConfigurationCleanup; + } + } else { + // + // Open legacy registry key. + // + + InitializeObjectAttributes( &attributes, + RegistryPath, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, + NULL ); + + status = ZwOpenKey( &driverRegKey, + KEY_READ, + &attributes ); + + if (!NT_SUCCESS( status )) { + + goto SimRepSetConfigurationCleanup; + } + } + #if DBG diff --git a/filesys/miniFilter/simrep/simrep.inf b/filesys/miniFilter/simrep/simrep.inf index 93632e33..16d08029 100644 Binary files a/filesys/miniFilter/simrep/simrep.inf and b/filesys/miniFilter/simrep/simrep.inf differ diff --git a/filesys/miniFilter/swapBuffers/swapBuffers.inf b/filesys/miniFilter/swapBuffers/swapBuffers.inf index ad88200e..664be4f3 100644 Binary files a/filesys/miniFilter/swapBuffers/swapBuffers.inf and b/filesys/miniFilter/swapBuffers/swapBuffers.inf differ -- cgit v1.3.1 From 6ea518dd65b6c2c3b298bb8e7ed5e9124b8a4981 Mon Sep 17 00:00:00 2001 From: AlbertGuan9527 <87043564+AlbertGuan9527@users.noreply.github.com> Date: Tue, 1 Aug 2023 12:57:17 -0700 Subject: Update simsensor driver on temperature check (#1012) The current implementation of simsensor doesn't match to the description of MSDN page. This change made the update to make them consistent. --- thermal/simsensor/simsensor.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/thermal/simsensor/simsensor.c b/thermal/simsensor/simsensor.c index a30ef067..3add8e47 100644 --- a/thermal/simsensor/simsensor.c +++ b/thermal/simsensor/simsensor.c @@ -625,7 +625,7 @@ Return Value: PAGED_CODE(); - if (Temperature <= LowerBound || Temperature >= UpperBound) { + if (Temperature < LowerBound || Temperature > UpperBound) { return TRUE; } @@ -1420,8 +1420,8 @@ Return Value: // need to be fired. // - if ((DevExt->Sensor.Temperature <= DevExt->Sensor.LowerBound) || - (DevExt->Sensor.Temperature >= DevExt->Sensor.UpperBound)) { + if ((DevExt->Sensor.Temperature < DevExt->Sensor.LowerBound) || + (DevExt->Sensor.Temperature > DevExt->Sensor.UpperBound)) { Interrupt = TRUE; @@ -1485,8 +1485,8 @@ Return Value: DevExt->Sensor.LowerBound = LowerBound; DevExt->Sensor.UpperBound = UpperBound; - if ((DevExt->Sensor.Temperature <= DevExt->Sensor.LowerBound) || - (DevExt->Sensor.Temperature >= DevExt->Sensor.UpperBound)) { + if ((DevExt->Sensor.Temperature < DevExt->Sensor.LowerBound) || + (DevExt->Sensor.Temperature > DevExt->Sensor.UpperBound)) { Interrupt = TRUE; -- cgit v1.3.1 From cbbd53eda55fbdf65f22b5f57c7dbc4b1ea594fd Mon Sep 17 00:00:00 2001 From: alexke-dev <65682333+alexke-dev@users.noreply.github.com> Date: Thu, 10 Aug 2023 16:28:02 -0700 Subject: Remove Print Driver Samples (#1017) * Remove print driver samples. Add README.md to redirect consumers to Print Support App (PSA) development guide. * Remove en-us from URL. --- .../C++/CUSTOMDRV.HLP | Bin 5955 -> 0 bytes .../C++/PSUIRep/Features.cpp | 2858 ------------------- .../C++/PSUIRep/Features.h | 236 -- .../C++/PSUIRep/Helper.cpp | 457 ---- .../C++/PSUIRep/Helper.h | 214 -- .../C++/PSUIRep/OEMUI.rc | 260 -- .../C++/PSUIRep/PSUIREP.vcxproj | 1066 -------- .../C++/PSUIRep/PSUIREP.vcxproj.Filters | 397 --- .../C++/PSUIRep/StringUtils.cpp | 315 --- .../C++/PSUIRep/StringUtils.h | 23 - .../C++/PSUIRep/debug.cpp | 405 --- .../C++/PSUIRep/debug.h | 166 -- .../C++/PSUIRep/devmode.cpp | 193 -- .../C++/PSUIRep/devmode.h | 56 - .../C++/PSUIRep/dllentry.cpp | 49 - .../C++/PSUIRep/globals.cpp | 24 - .../C++/PSUIRep/globals.h | 31 - .../C++/PSUIRep/intrface.cpp | 709 ----- .../C++/PSUIRep/intrface.h | 220 -- .../C++/PSUIRep/oemui.cpp | 1042 ------- .../C++/PSUIRep/oemui.h | 33 - .../C++/PSUIRep/precomp.h | 55 - .../C++/PSUIRep/precompsrc.cpp | 1 - .../C++/PSUIRep/psuirep.def | 3 - .../C++/PSUIRep/resource.h | 92 - .../C++/PTPCPlPr/install/ptpcplpr.gpd | 763 ------ .../C++/PTPCPlPr/install/ptpcplpr.inf | Bin 4590 -> 0 bytes .../C++/PTPCPlPr/install/ptpcplpr.ini | 3 - .../C++/PTPCPlPr/src/PTPCPLPR.vcxproj | 904 ------ .../C++/PTPCPlPr/src/PTPCPLPR.vcxproj.Filters | 272 -- .../C++/PTPCPlPr/src/debug.hxx | 82 - .../C++/PTPCPlPr/src/dllentry.cxx | 48 - .../C++/PTPCPlPr/src/globals.cxx | 21 - .../C++/PTPCPlPr/src/globals.hxx | 25 - .../C++/PTPCPlPr/src/intrface.cxx | 493 ---- .../C++/PTPCPlPr/src/intrface.hxx | 178 -- .../C++/PTPCPlPr/src/oem.hxx | 26 - .../C++/PTPCPlPr/src/oemptprovider.cxx | 1145 -------- .../C++/PTPCPlPr/src/oemptprovider.hxx | 143 - .../C++/PTPCPlPr/src/precomp.hxx | 49 - .../C++/PTPCPlPr/src/precompsrc.cpp | 1 - .../C++/PTPCPlPr/src/printschema.cxx | 64 - .../C++/PTPCPlPr/src/printschema.hxx | 74 - .../C++/PTPCPlPr/src/ptpcplpr.def | 3 - .../C++/PTPCPlPr/src/ptpcplpr.rc | 24 - .../C++/PTPCPlPr/src/xmlhandler.cxx | 1612 ----------- .../C++/PTPCPlPr/src/xmlhandler.hxx | 162 -- .../C++/SyncSet/SYNCSET.vcxproj | 1066 -------- .../C++/SyncSet/SYNCSET.vcxproj.Filters | 272 -- .../C++/SyncSet/SyncSet.def | 3 - .../C++/SyncSet/debug.cpp | 405 --- .../C++/SyncSet/debug.h | 166 -- .../C++/SyncSet/devmode.cpp | 214 -- .../C++/SyncSet/devmode.h | 57 - .../C++/SyncSet/dllentry.cpp | 49 - .../C++/SyncSet/globals.cpp | 26 - .../C++/SyncSet/globals.h | 22 - .../C++/SyncSet/intrface.cpp | 612 ----- .../C++/SyncSet/intrface.h | 192 -- .../C++/SyncSet/oem.h | 24 - .../C++/SyncSet/oemui.cpp | 1099 -------- .../C++/SyncSet/oemui.h | 74 - .../C++/SyncSet/oemui.rc | 175 -- .../C++/SyncSet/precomp.h | 53 - .../C++/SyncSet/precompsrc.cpp | 1 - .../C++/SyncSet/resource.h | 28 - .../C++/ThemeUI/OEMUI.rc | 169 -- .../C++/ThemeUI/ThemeUI.Manifest | 22 - .../C++/ThemeUI/ThemeUISmpl.vcxproj | 1120 -------- .../C++/ThemeUI/ThemeUISmpl.vcxproj.Filters | 327 --- .../C++/ThemeUI/debug.h | 82 - .../C++/ThemeUI/devmode.cpp | 187 -- .../C++/ThemeUI/devmode.h | 55 - .../C++/ThemeUI/dllentry.cpp | 66 - .../C++/ThemeUI/fusutils.cpp | 118 - .../C++/ThemeUI/fusutils.h | 18 - .../C++/ThemeUI/globals.cpp | 29 - .../C++/ThemeUI/globals.h | 21 - .../C++/ThemeUI/intrface.cpp | 575 ---- .../C++/ThemeUI/intrface.h | 179 -- .../C++/ThemeUI/oem.h | 22 - .../C++/ThemeUI/oemui.cpp | 756 ----- .../C++/ThemeUI/oemui.h | 45 - .../C++/ThemeUI/precomp.h | 61 - .../C++/ThemeUI/precompsrc.cpp | 1 - .../C++/ThemeUI/resource.h | 24 - .../C++/ThemeUI/themeuismpl.def | 3 - .../C++/WMarkPS.ini | 4 - .../C++/WMarkUni.ini | 5 - .../C++/bitmap.gpd | 509 ---- .../C++/bitmap.inf | Bin 4860 -> 0 bytes .../C++/bitmap.ini | 5 - .../C++/bitmap/bitmap.def | 4 - .../C++/bitmap/bitmap.h | 81 - .../C++/bitmap/bitmap.rc | 110 - .../C++/bitmap/bitmap.vcxproj | 1090 -------- .../C++/bitmap/bitmap.vcxproj.Filters | 174 -- .../C++/bitmap/ddihook.cpp | 114 - .../C++/bitmap/debug.h | 82 - .../C++/bitmap/devmode.cpp | 132 - .../C++/bitmap/devmode.h | 37 - .../C++/bitmap/dllentry.cpp | 50 - .../C++/bitmap/intrface.cpp | 2048 -------------- .../C++/bitmap/intrface.h | 287 -- .../C++/bitmap/precomp.h | 40 - .../C++/bitmap/precompsrc.cpp | 1 - .../C++/bitmap/resource.h | 17 - .../C++/custhlp.gpd | 563 ---- .../C++/custhlp.ini | 3 - .../C++/custhlp/CUSTHLP.def | 3 - .../C++/custhlp/CUSTHLP.vcxproj | 1060 ------- .../C++/custhlp/CUSTHLP.vcxproj.Filters | 220 -- .../C++/custhlp/customhelp/customdrv.cnt | 3 - .../C++/custhlp/customhelp/customdrv.h | 11 - .../C++/custhlp/customhelp/customdrv.hpj | 17 - .../C++/custhlp/customhelp/customdrv.rtf | 22 - .../C++/custhlp/debug.h | 82 - .../C++/custhlp/devmode.cpp | 182 -- .../C++/custhlp/devmode.h | 46 - .../C++/custhlp/dllentry.cpp | 49 - .../C++/custhlp/globals.cpp | 25 - .../C++/custhlp/globals.h | 22 - .../C++/custhlp/intrface.cpp | 562 ---- .../C++/custhlp/intrface.h | 182 -- .../C++/custhlp/oemui.cpp | 960 ------- .../C++/custhlp/oemui.h | 47 - .../C++/custhlp/oemui.rc | 170 -- .../C++/custhlp/precomp.h | 54 - .../C++/custhlp/precompsrc.cpp | 1 - .../C++/custhlp/resource.h | 23 - .../C++/gdl/res/gdlsmpl.gpd | 520 ---- .../C++/gdl/res/gdlsmpl.inf | Bin 3622 -> 0 bytes .../C++/gdl/res/gdlsmpl.ini | 3 - .../C++/gdl/src/GDLSMPL.vcxproj | 1084 -------- .../C++/gdl/src/GDLSMPL.vcxproj.Filters | 134 - .../C++/gdl/src/debug.h | 82 - .../C++/gdl/src/devmode.cpp | 251 -- .../C++/gdl/src/devmode.h | 52 - .../C++/gdl/src/gdlsmpl.cpp | 856 ------ .../C++/gdl/src/gdlsmpl.def | 18 - .../C++/gdl/src/gdlsmpl.h | 79 - .../C++/gdl/src/gdlsmpl.rc | 106 - .../C++/gdl/src/intrface.cpp | 559 ---- .../C++/gdl/src/intrface.h | 212 -- .../C++/gdl/src/precomp.h | 62 - .../C++/gdl/src/precompsrc.cpp | 1 - .../C++/oem.gpd | 704 ----- .../C++/oem.ppd | 431 --- .../C++/oemdll.inf | Bin 10570 -> 0 bytes .../C++/oemdll.sln | 809 ------ .../C++/oemprean.gpd | 706 ----- .../C++/oemprean.htm | 514 ---- .../C++/oemprean.inf | Bin 5058 -> 0 bytes .../C++/oemprean.ini | 4 - .../C++/oemprean/ddihook.cpp | 2069 -------------- .../C++/oemprean/debug.cpp | 1503 ---------- .../C++/oemprean/debug.h | 215 -- .../C++/oemprean/devmode.cpp | 229 -- .../C++/oemprean/devmode.h | 43 - .../C++/oemprean/dllentry.cpp | 58 - .../C++/oemprean/intrface.cpp | 1819 ------------ .../C++/oemprean/intrface.h | 288 -- .../C++/oemprean/oemprean.def | 3 - .../C++/oemprean/oemprean.h | 259 -- .../C++/oemprean/oemprean.rc | 110 - .../C++/oemprean/oemprean.vcxproj | 1096 -------- .../C++/oemprean/oemprean.vcxproj.Filters | 177 -- .../C++/oemprean/precomp.h | 49 - .../C++/oemprean/precompsrc.cpp | 1 - .../C++/oemprean/resource.h | 17 - .../C++/oemps.ini | 3 - .../C++/oemps/OEMPS.rc | 109 - .../C++/oemps/OEMPS.vcxproj | 1096 -------- .../C++/oemps/OEMPS.vcxproj.Filters | 220 -- .../C++/oemps/command.cpp | 278 -- .../C++/oemps/command.h | 24 - .../C++/oemps/ddihook.cpp | 1049 ------- .../C++/oemps/debug.h | 82 - .../C++/oemps/devmode.cpp | 151 - .../C++/oemps/devmode.h | 44 - .../C++/oemps/dllentry.cpp | 50 - .../C++/oemps/intrface.cpp | 632 ----- .../C++/oemps/intrface.h | 119 - .../C++/oemps/oemps.def | 3 - .../C++/oemps/oemps.h | 76 - .../C++/oemps/precomp.h | 47 - .../C++/oemps/precompsrc.cpp | 1 - .../C++/oemps/resource.h | 15 - .../C++/oemui.ini | 3 - .../C++/oemui/OEMUI.def | 3 - .../C++/oemui/OEMUI.rc | 169 -- .../C++/oemui/OEMUI.vcxproj | 1042 ------- .../C++/oemui/OEMUI.vcxproj.Filters | 220 -- .../C++/oemui/debug.h | 82 - .../C++/oemui/devmode.cpp | 182 -- .../C++/oemui/devmode.h | 52 - .../C++/oemui/dllentry.cpp | 49 - .../C++/oemui/globals.cpp | 22 - .../C++/oemui/globals.h | 17 - .../C++/oemui/intrface.cpp | 567 ---- .../C++/oemui/intrface.h | 178 -- .../C++/oemui/oemui.cpp | 737 ----- .../C++/oemui/oemui.h | 37 - .../C++/oemui/precomp.h | 52 - .../C++/oemui/precompsrc.cpp | 1 - .../C++/oemui/resource.h | 24 - .../C++/oemuni.ini | 3 - .../C++/oemuni/OEMUNI.def | 3 - .../C++/oemuni/OEMUNI.h | 234 -- .../C++/oemuni/OEMUNI.rc | 110 - .../C++/oemuni/OEMUNI.vcxproj | 1090 -------- .../C++/oemuni/OEMUNI.vcxproj.Filters | 174 -- .../C++/oemuni/ddihook.cpp | 1670 ----------- .../C++/oemuni/debug.h | 82 - .../C++/oemuni/devmode.cpp | 222 -- .../C++/oemuni/devmode.h | 43 - .../C++/oemuni/dllentry.cpp | 55 - .../C++/oemuni/intrface.cpp | 1797 ------------ .../C++/oemuni/intrface.h | 283 -- .../C++/oemuni/precomp.h | 36 - .../C++/oemuni/precompsrc.cpp | 1 - .../C++/oemuni/resource.h | 17 - .../C++/psuirep.ini | 3 - .../C++/syncset.gpd | 654 ----- .../C++/syncset.ini | 3 - .../C++/themeui.ini | 3 - .../C++/uisamples.inf | Bin 5820 -> 0 bytes .../C++/uniuirep/res/uniuirep.gpd | 559 ---- .../C++/uniuirep/res/uniuirep.inf | Bin 3710 -> 0 bytes .../C++/uniuirep/res/uniuirep.ini | 3 - .../C++/uniuirep/src/Features.cpp | 1991 -------------- .../C++/uniuirep/src/Features.h | 388 --- .../C++/uniuirep/src/UNIUIREP.vcxproj | 1066 -------- .../C++/uniuirep/src/UNIUIREP.vcxproj.Filters | 223 -- .../C++/uniuirep/src/debug.cpp | 405 --- .../C++/uniuirep/src/debug.h | 166 -- .../C++/uniuirep/src/devmode.cpp | 255 -- .../C++/uniuirep/src/devmode.h | 48 - .../C++/uniuirep/src/dllentry.cpp | 82 - .../C++/uniuirep/src/intrface.cpp | 1151 -------- .../C++/uniuirep/src/intrface.h | 222 -- .../C++/uniuirep/src/precomp.h | 68 - .../C++/uniuirep/src/precompsrc.cpp | 1 - .../C++/uniuirep/src/resource.h | 57 - .../C++/uniuirep/src/uniuirep.cpp | 492 ---- .../C++/uniuirep/src/uniuirep.def | 18 - .../C++/uniuirep/src/uniuirep.h | 55 - .../C++/uniuirep/src/uniuirep.rc | 192 -- .../C++/watermark/common/debug.h | 82 - .../C++/watermark/common/devmode.cpp | 229 -- .../C++/watermark/common/devmode.h | 56 - .../C++/watermark/common/oem.h | 24 - .../C++/watermark/wmarkps/WMARKPS.vcxproj | 1090 -------- .../C++/watermark/wmarkps/WMARKPS.vcxproj.Filters | 137 - .../C++/watermark/wmarkps/WMarkPS.def | 3 - .../C++/watermark/wmarkps/WMarkPS.rc | 130 - .../C++/watermark/wmarkps/command.cpp | 410 --- .../C++/watermark/wmarkps/command.h | 22 - .../C++/watermark/wmarkps/dllentry.cpp | 54 - .../C++/watermark/wmarkps/drawmark.ps | Bin 37 -> 0 bytes .../C++/watermark/wmarkps/fdevmode.cpp | 20 - .../C++/watermark/wmarkps/intrface.cpp | 491 ---- .../C++/watermark/wmarkps/intrface.h | 116 - .../C++/watermark/wmarkps/precomp.h | 51 - .../C++/watermark/wmarkps/precompsrc.cpp | 1 - .../C++/watermark/wmarkps/resource.h | 18 - .../C++/watermark/wmarkps/wmark.ps | 33 - .../C++/watermark/wmarkps/wmarkps.h | 25 - .../C++/watermark/wmarkui/WMARKUI.vcxproj | 1096 -------- .../C++/watermark/wmarkui/WMARKUI.vcxproj.Filters | 140 - .../C++/watermark/wmarkui/dllentry.cpp | 52 - .../C++/watermark/wmarkui/fdevmode.cpp | 21 - .../C++/watermark/wmarkui/globals.cpp | 27 - .../C++/watermark/wmarkui/globals.h | 22 - .../C++/watermark/wmarkui/intrface.cpp | 522 ---- .../C++/watermark/wmarkui/intrface.h | 177 -- .../C++/watermark/wmarkui/precomp.h | 50 - .../C++/watermark/wmarkui/precompsrc.cpp | 1 - .../C++/watermark/wmarkui/resource.h | 24 - .../C++/watermark/wmarkui/wmarkui.cpp | 590 ---- .../C++/watermark/wmarkui/wmarkui.def | 3 - .../C++/watermark/wmarkui/wmarkui.h | 35 - .../C++/watermark/wmarkui/wmarkui.rc | 128 - .../C++/watermarkuni/common/debug.h | 82 - .../C++/watermarkuni/common/devmode.cpp | 216 -- .../C++/watermarkuni/common/devmode.h | 52 - .../C++/watermarkuni/common/oem.h | 23 - .../C++/watermarkuni/wmarkui/WMARKUNIUI.vcxproj | 1150 -------- .../wmarkui/WMARKUNIUI.vcxproj.Filters | 140 - .../C++/watermarkuni/wmarkui/dllentry.cpp | 52 - .../C++/watermarkuni/wmarkui/fdevmode.cpp | 21 - .../C++/watermarkuni/wmarkui/globals.cpp | 26 - .../C++/watermarkuni/wmarkui/globals.h | 21 - .../C++/watermarkuni/wmarkui/intrface.cpp | 525 ---- .../C++/watermarkuni/wmarkui/intrface.h | 178 -- .../C++/watermarkuni/wmarkui/precomp.h | 54 - .../C++/watermarkuni/wmarkui/precompsrc.cpp | 1 - .../C++/watermarkuni/wmarkui/resource.h | 26 - .../C++/watermarkuni/wmarkui/wmarkui.cpp | 594 ---- .../C++/watermarkuni/wmarkui/wmarkui.h | 37 - .../C++/watermarkuni/wmarkui/wmarkui.rc | 124 - .../C++/watermarkuni/wmarkui/wmarkuniui.def | 3 - .../C++/watermarkuni/wmarkuni/WMARKUNI.vcxproj | 1090 -------- .../watermarkuni/wmarkuni/WMARKUNI.vcxproj.Filters | 137 - .../C++/watermarkuni/wmarkuni/ddihook.cpp | 1226 --------- .../C++/watermarkuni/wmarkuni/dllentry.cpp | 51 - .../C++/watermarkuni/wmarkuni/fdevmode.cpp | 22 - .../C++/watermarkuni/wmarkuni/intrface.cpp | 950 ------- .../C++/watermarkuni/wmarkuni/intrface.h | 254 -- .../C++/watermarkuni/wmarkuni/name.h | 34 - .../C++/watermarkuni/wmarkuni/precomp.h | 53 - .../C++/watermarkuni/wmarkuni/precompsrc.cpp | 1 - .../C++/watermarkuni/wmarkuni/resource.h | 17 - .../C++/watermarkuni/wmarkuni/wmarkuni.def | 3 - .../C++/watermarkuni/wmarkuni/wmarkuni.h | 82 - .../C++/watermarkuni/wmarkuni/wmarkuni.rc | 104 - .../C++/winxp.inf | Bin 7046 -> 0 bytes .../README.md | 146 - .../license.rtf | 25 - print/README.md | 5 + .../BlankProjSrc/BlankProject.vcxproj | 194 -- .../BlankProjSrc/BlankProject.vcxproj.Filters | 17 - .../MarkupCompatibility/M1.1a.oxps | Bin 110463 -> 0 bytes .../MarkupCompatibility/M1.2a.oxps | Bin 110704 -> 0 bytes .../MarkupCompatibility/M2.14a.oxps | Bin 113173 -> 0 bytes .../MarkupCompatibility/M2.17a.oxps | Bin 114090 -> 0 bytes .../MarkupCompatibility/M2.20a.oxps | Bin 110933 -> 0 bytes .../MarkupCompatibility/M2.24a.oxps | Bin 114270 -> 0 bytes .../MarkupCompatibility/M2.27a.oxps | Bin 113251 -> 0 bytes .../MarkupCompatibility/M2.27b.oxps | Bin 114316 -> 0 bytes .../MarkupCompatibility/M2.30a.oxps | Bin 109949 -> 0 bytes .../MarkupCompatibility/M2.31a.oxps | Bin 109239 -> 0 bytes .../MarkupCompatibility/M2.32a.oxps | Bin 108094 -> 0 bytes .../MarkupCompatibility/M2.33a.oxps | Bin 106754 -> 0 bytes .../MarkupCompatibility/M2.35a.oxps | Bin 110403 -> 0 bytes .../MarkupCompatibility/M2.36a.oxps | Bin 117918 -> 0 bytes .../MarkupCompatibility/M2.36b.oxps | Bin 114139 -> 0 bytes .../MarkupCompatibility/M2.41a.oxps | Bin 109093 -> 0 bytes .../MarkupCompatibility/M2.41b.oxps | Bin 108518 -> 0 bytes .../MarkupCompatibility/M2.42a.oxps | Bin 110434 -> 0 bytes .../MarkupCompatibility/M2.42b.oxps | Bin 109580 -> 0 bytes .../MarkupCompatibility/M2.43a.oxps | Bin 109032 -> 0 bytes .../MarkupCompatibility/M2.43b.oxps | Bin 108300 -> 0 bytes .../MarkupCompatibility/M2.44a.oxps | Bin 107717 -> 0 bytes .../MarkupCompatibility/M2.48a.oxps | Bin 112803 -> 0 bytes .../MarkupCompatibility/M2.49a.oxps | Bin 111223 -> 0 bytes .../MarkupCompatibility/M2.49b.oxps | Bin 110444 -> 0 bytes .../MarkupCompatibility/M2.50a.oxps | Bin 113588 -> 0 bytes .../MarkupCompatibility/M2.52a.oxps | Bin 110381 -> 0 bytes .../MarkupCompatibility/M2.55a.oxps | Bin 109084 -> 0 bytes .../MarkupCompatibility/M2.56a.oxps | Bin 109737 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M1.2a.oxps | Bin 726 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M10.23a.oxps | Bin 103254 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M10.6a.oxps | Bin 102575 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M10.6b.oxps | Bin 102650 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M12.2a.oxps | Bin 104751 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M12.3a.oxps | Bin 104685 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M12.3b.oxps | Bin 110319 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M12.5a.oxps | Bin 107624 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M12.5b.oxps | Bin 107283 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M12.5c.oxps | Bin 107632 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M12.7a.oxps | Bin 104362 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.10a.oxps | Bin 106123 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.10b.oxps | Bin 106268 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.13a.oxps | Bin 101636 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.13b.oxps | Bin 101686 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.14a.oxps | Bin 102956 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.14b.oxps | Bin 102633 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.17a.oxps | Bin 177448 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.18a.oxps | Bin 64522 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.25a.oxps | Bin 120979 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.2a.oxps | Bin 100662 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.2b.oxps | Bin 101217 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.2c.oxps | Bin 101321 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.35a.oxps | Bin 107168 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.36a.oxps | Bin 102480 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.37a.oxps | Bin 1422218 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.39a.oxps | Bin 145780 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.39b.oxps | Bin 145568 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.39c.oxps | Bin 477300 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.3a.oxps | Bin 102696 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.3b.oxps | Bin 102754 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.3c.oxps | Bin 102373 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.4a.oxps | Bin 101906 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.4b.oxps | Bin 102381 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.54a.oxps | Bin 102759 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.59a.oxps | Bin 111139 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.59b.oxps | Bin 110266 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.59c.oxps | Bin 110253 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.5a.oxps | Bin 100836 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.5b.oxps | Bin 102393 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.6a.oxps | Bin 52761 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.6b.oxps | Bin 103567 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.6c.oxps | Bin 103670 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.70a.oxps | Bin 106392 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.71a.oxps | Bin 103343 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.71b.oxps | Bin 104231 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.71c.oxps | Bin 103611 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.72a.oxps | Bin 106618 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.72b.oxps | Bin 108011 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.72c.oxps | Bin 108008 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.73a.oxps | Bin 106480 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.73b.oxps | Bin 106625 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.74a.oxps | Bin 104771 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.74b.oxps | Bin 105454 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.74c.oxps | Bin 105675 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.75a.oxps | Bin 146656 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.75b.oxps | Bin 146976 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.75c.oxps | Bin 146399 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.75d.oxps | Bin 145829 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.76a.oxps | Bin 108053 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.77a.oxps | Bin 106368 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.77b.oxps | Bin 107928 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.7a.oxps | Bin 60527 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.7b.oxps | Bin 102923 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.7c.oxps | Bin 102929 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.80.oxps | Bin 477645 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.81.oxps | Bin 477491 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.82.oxps | Bin 469824 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.8a.oxps | Bin 103512 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.8b.oxps | Bin 104190 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M2.8c.oxps | Bin 104205 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.11a.oxps | Bin 104939 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.11b.oxps | Bin 105129 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.12a.oxps | Bin 104209 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.12b.oxps | Bin 105077 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.13a.oxps | Bin 105068 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.14a.oxps | Bin 104964 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.20a.oxps | Bin 106622 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.20b.oxps | Bin 106582 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.2a.oxps | Bin 105997 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.2b.oxps | Bin 106469 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.3a.oxps | Bin 105076 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.5a.oxps | Bin 105282 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.5b.oxps | Bin 105795 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.6a.oxps | Bin 107755 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M3.6b.oxps | Bin 113676 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M4.1a.oxps | Bin 104661 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M4.1b.oxps | Bin 105685 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M4.1c.oxps | Bin 104661 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M4.2a.oxps | Bin 106211 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M4.2b.oxps | Bin 106722 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M4.3a.oxps | Bin 105684 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M5.15a.oxps | Bin 106255 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M5.2a.oxps | Bin 104472 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M5.2b.oxps | Bin 104678 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M5.2c.oxps | Bin 104708 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M5.3a.oxps | Bin 105241 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M5.3b.oxps | Bin 105232 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M5.3c.oxps | Bin 105241 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M5.4a.oxps | Bin 109836 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M5.4b.oxps | Bin 110089 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M5.7a.oxps | Bin 107491 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M6.1a.oxps | Bin 106380 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M6.1b.oxps | Bin 105638 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M6.2a.oxps | Bin 106352 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M6.2b.oxps | Bin 105670 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M6.3a.oxps | Bin 106922 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M6.3b.oxps | Bin 107336 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M6.4a.oxps | Bin 106409 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M6.4b.oxps | Bin 106030 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M6.5a.oxps | Bin 106729 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M6.5b.oxps | Bin 106425 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M6.6a.oxps | Bin 106359 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M6.6b.oxps | Bin 106363 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M7.11a.oxps | Bin 143685 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M7.11b.oxps | Bin 142905 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M7.2a.oxps | Bin 103509 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M7.2b.oxps | Bin 104065 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M7.3a.oxps | Bin 145744 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M7.5a.oxps | Bin 103137 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M7.6a.oxps | Bin 143109 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M8.14a.oxps | Bin 524425 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M9.10a.oxps | Bin 141326 -> 0 bytes .../ConformanceViolations_oxps/OXPS/M9.10b.oxps | Bin 141476 -> 0 bytes .../OpenPackagingConventions/M1.10a.oxps | Bin 146594 -> 0 bytes .../OpenPackagingConventions/M1.10b.oxps | Bin 101375 -> 0 bytes .../OpenPackagingConventions/M1.11a.oxps | Bin 90001 -> 0 bytes .../OpenPackagingConventions/M1.12a.oxps | Bin 125552 -> 0 bytes .../OpenPackagingConventions/M1.13a.oxps | Bin 120137 -> 0 bytes .../OpenPackagingConventions/M1.13b.oxps | Bin 120018 -> 0 bytes .../OpenPackagingConventions/M1.14a.oxps | Bin 120617 -> 0 bytes .../OpenPackagingConventions/M1.14b.oxps | Bin 120571 -> 0 bytes .../OpenPackagingConventions/M1.14c.oxps | Bin 120515 -> 0 bytes .../OpenPackagingConventions/M1.15a.oxps | Bin 116371 -> 0 bytes .../OpenPackagingConventions/M1.17a.oxps | Bin 87089 -> 0 bytes .../OpenPackagingConventions/M1.17b.oxps | Bin 86179 -> 0 bytes .../OpenPackagingConventions/M1.18a.oxps | Bin 83532 -> 0 bytes .../OpenPackagingConventions/M1.18b.oxps | Bin 82355 -> 0 bytes .../OpenPackagingConventions/M1.1a.oxps | Bin 120451 -> 0 bytes .../OpenPackagingConventions/M1.20a.oxps | Bin 122057 -> 0 bytes .../OpenPackagingConventions/M1.20b.oxps | Bin 122193 -> 0 bytes .../OpenPackagingConventions/M1.21a.oxps | Bin 119692 -> 0 bytes .../OpenPackagingConventions/M1.21b.oxps | Bin 120277 -> 0 bytes .../OpenPackagingConventions/M1.22a.oxps | Bin 82619 -> 0 bytes .../OpenPackagingConventions/M1.25a.oxps | Bin 115110 -> 0 bytes .../OpenPackagingConventions/M1.26a.oxps | Bin 87726 -> 0 bytes .../OpenPackagingConventions/M1.26b.oxps | Bin 88950 -> 0 bytes .../OpenPackagingConventions/M1.27a.oxps | Bin 80693 -> 0 bytes .../OpenPackagingConventions/M1.27b.oxps | Bin 82653 -> 0 bytes .../OpenPackagingConventions/M1.28a.oxps | Bin 80925 -> 0 bytes .../OpenPackagingConventions/M1.28b.oxps | Bin 82088 -> 0 bytes .../OpenPackagingConventions/M1.2a.oxps | Bin 137277 -> 0 bytes .../OpenPackagingConventions/M1.2b.oxps | Bin 136477 -> 0 bytes .../OpenPackagingConventions/M1.2c.oxps | Bin 137609 -> 0 bytes .../OpenPackagingConventions/M1.30a.oxps | Bin 83363 -> 0 bytes .../OpenPackagingConventions/M1.30b.oxps | Bin 82894 -> 0 bytes .../OpenPackagingConventions/M1.3a.oxps | Bin 102125 -> 0 bytes .../OpenPackagingConventions/M1.5a.oxps | Bin 123720 -> 0 bytes .../OpenPackagingConventions/M1.6a.oxps | Bin 107037 -> 0 bytes .../OpenPackagingConventions/M1.6b.oxps | Bin 107452 -> 0 bytes .../OpenPackagingConventions/M1.6c.oxps | Bin 106664 -> 0 bytes .../OpenPackagingConventions/M1.6d.oxps | Bin 106686 -> 0 bytes .../OpenPackagingConventions/M1.7a.oxps | Bin 106737 -> 0 bytes .../OpenPackagingConventions/M1.7b.oxps | Bin 107048 -> 0 bytes .../OpenPackagingConventions/M1.8a.oxps | Bin 106099 -> 0 bytes .../OpenPackagingConventions/M1.8b.oxps | Bin 105504 -> 0 bytes .../OpenPackagingConventions/M1.8c.oxps | Bin 105505 -> 0 bytes .../OpenPackagingConventions/M1.9a.oxps | Bin 125830 -> 0 bytes .../OpenPackagingConventions/M2.10a.oxps | Bin 79045 -> 0 bytes .../OpenPackagingConventions/M2.18a.oxps | Bin 127465 -> 0 bytes .../OpenPackagingConventions/M2.4a.oxps | Bin 85086 -> 0 bytes .../OpenPackagingConventions/M2.5a.oxps | Bin 82164 -> 0 bytes .../OpenPackagingConventions/M2.5b.oxps | Bin 82171 -> 0 bytes .../OpenPackagingConventions/M2.6a.oxps | Bin 81169 -> 0 bytes .../OpenPackagingConventions/M2.6b.oxps | Bin 81792 -> 0 bytes .../OpenPackagingConventions/M2.7a.oxps | Bin 81348 -> 0 bytes .../OpenPackagingConventions/M2.7b.oxps | Bin 81608 -> 0 bytes .../OpenPackagingConventions/M3.10a.oxps | Bin 84347 -> 0 bytes .../OpenPackagingConventions/M3.14a.oxps | Bin 133028 -> 0 bytes .../OpenPackagingConventions/M3.9a.oxps | Bin 106930 -> 0 bytes .../OpenXPSTestFiles_EndUserLicenseAgreement.txt | 7 - .../QualityLogicMinBar_oxps/mb01.oxps | Bin 813337 -> 0 bytes .../QualityLogicMinBar_oxps/mb02.oxps | Bin 2243951 -> 0 bytes .../QualityLogicMinBar_oxps/mb03.oxps | Bin 14423522 -> 0 bytes .../QualityLogicMinBar_oxps/mb04.oxps | Bin 2116093 -> 0 bytes .../QualityLogicMinBar_oxps/mb05.oxps | Bin 4577317 -> 0 bytes .../QualityLogicMinBar_oxps/mb06.oxps | Bin 233280 -> 0 bytes .../QualityLogicMinBar_oxps/mb07.oxps | Bin 477710 -> 0 bytes .../QualityLogicMinBar_oxps/mb08.oxps | Bin 160252 -> 0 bytes .../QualityLogicMinBar_oxps/mb09.oxps | Bin 241162 -> 0 bytes print/SampleOpenXPS/README.md | 15 - print/SampleOpenXPS/SampleOpenXPS.sln | 34 - print/SampleXPS/BlankProjSrc/BlankProject.vcxproj | 194 -- .../BlankProjSrc/BlankProject.vcxproj.Filters | 17 - .../MarkupCompatibility/M1.1a.xps | Bin 281044 -> 0 bytes .../MarkupCompatibility/M1.2a.xps | Bin 281046 -> 0 bytes .../MarkupCompatibility/M2.13a.xps | Bin 281089 -> 0 bytes .../MarkupCompatibility/M2.14a.xps | Bin 281079 -> 0 bytes .../MarkupCompatibility/M2.17a.xps | Bin 281082 -> 0 bytes .../MarkupCompatibility/M2.20a.xps | Bin 281104 -> 0 bytes .../MarkupCompatibility/M2.24a.xps | Bin 281107 -> 0 bytes .../MarkupCompatibility/M2.27a.xps | Bin 281063 -> 0 bytes .../MarkupCompatibility/M2.27b.xps | Bin 281053 -> 0 bytes .../MarkupCompatibility/M2.30a.xps | Bin 281063 -> 0 bytes .../MarkupCompatibility/M2.31a.xps | Bin 281196 -> 0 bytes .../MarkupCompatibility/M2.32a.xps | Bin 281189 -> 0 bytes .../MarkupCompatibility/M2.33a.xps | Bin 281201 -> 0 bytes .../MarkupCompatibility/M2.35a.xps | Bin 281212 -> 0 bytes .../MarkupCompatibility/M2.35b.xps | Bin 281206 -> 0 bytes .../MarkupCompatibility/M2.36a.xps | Bin 281203 -> 0 bytes .../MarkupCompatibility/M2.41a.xps | Bin 281231 -> 0 bytes .../MarkupCompatibility/M2.42a.xps | Bin 281232 -> 0 bytes .../MarkupCompatibility/M2.43a.xps | Bin 281257 -> 0 bytes .../MarkupCompatibility/M2.44a.xps | Bin 281178 -> 0 bytes .../MarkupCompatibility/M2.48a.xps | Bin 281260 -> 0 bytes .../MarkupCompatibility/M2.49a.xps | Bin 281256 -> 0 bytes .../MarkupCompatibility/M2.50a.xps | Bin 281252 -> 0 bytes .../MarkupCompatibility/M2.52a.xps | Bin 281252 -> 0 bytes .../MarkupCompatibility/M2.55a.xps | Bin 281260 -> 0 bytes .../MarkupCompatibility/M2.56a.xps | Bin 281256 -> 0 bytes .../OpenPackagingConventions/M1.10a.xps | Bin 51959 -> 0 bytes .../OpenPackagingConventions/M1.11a.xps | Bin 52024 -> 0 bytes .../OpenPackagingConventions/M1.17a.xps | Bin 51970 -> 0 bytes .../OpenPackagingConventions/M1.18a.xps | Bin 51972 -> 0 bytes .../OpenPackagingConventions/M1.18b.xps | Bin 51972 -> 0 bytes .../OpenPackagingConventions/M1.1a.xps | Bin 51921 -> 0 bytes .../OpenPackagingConventions/M1.1b.xps | Bin 51927 -> 0 bytes .../OpenPackagingConventions/M1.20a.xps | Bin 51975 -> 0 bytes .../OpenPackagingConventions/M1.26a.xps | Bin 51968 -> 0 bytes .../OpenPackagingConventions/M1.26b.xps | Bin 51971 -> 0 bytes .../OpenPackagingConventions/M1.26c.xps | Bin 51969 -> 0 bytes .../OpenPackagingConventions/M1.27a.xps | Bin 51958 -> 0 bytes .../OpenPackagingConventions/M1.28a.xps | Bin 51962 -> 0 bytes .../OpenPackagingConventions/M1.2a.xps | Bin 51961 -> 0 bytes .../OpenPackagingConventions/M1.2b.xps | Bin 51957 -> 0 bytes .../OpenPackagingConventions/M1.34a.xps | Bin 51979 -> 0 bytes .../OpenPackagingConventions/M1.3a.xps | Bin 51932 -> 0 bytes .../OpenPackagingConventions/M1.5a.xps | Bin 51933 -> 0 bytes .../OpenPackagingConventions/M1.6a.xps | Bin 51934 -> 0 bytes .../OpenPackagingConventions/M1.6b.xps | Bin 51936 -> 0 bytes .../OpenPackagingConventions/M1.7a.xps | Bin 51980 -> 0 bytes .../OpenPackagingConventions/M1.7c.xps | Bin 51968 -> 0 bytes .../OpenPackagingConventions/M1.8a.xps | Bin 51971 -> 0 bytes .../OpenPackagingConventions/M2.18a.xps | Bin 52359 -> 0 bytes .../OpenPackagingConventions/M2.24a.xps | Bin 51924 -> 0 bytes .../OpenPackagingConventions/M2.5a.xps | Bin 51975 -> 0 bytes .../OpenPackagingConventions/M2.5b.xps | Bin 51974 -> 0 bytes .../OpenPackagingConventions/M2.6a.xps | Bin 51967 -> 0 bytes .../OpenPackagingConventions/M2.6b.xps | Bin 51965 -> 0 bytes .../OpenPackagingConventions/M2.7a.xps | Bin 51956 -> 0 bytes .../OpenPackagingConventions/M2.7b.xps | Bin 51950 -> 0 bytes .../OpenPackagingConventions/M3.10a.xps | Bin 57170 -> 0 bytes .../OpenPackagingConventions/M3.10b.xps | Bin 57171 -> 0 bytes .../OpenPackagingConventions/M3.10c.xps | Bin 57170 -> 0 bytes .../OpenPackagingConventions/M3.11a.xps | Bin 57167 -> 0 bytes .../OpenPackagingConventions/M3.11b.xps | Bin 57164 -> 0 bytes .../OpenPackagingConventions/M3.12a.xps | Bin 57167 -> 0 bytes .../OpenPackagingConventions/M3.12b.xps | Bin 57164 -> 0 bytes .../OpenPackagingConventions/M3.13a.xps | Bin 57169 -> 0 bytes .../OpenPackagingConventions/M3.14a.xps | Bin 57163 -> 0 bytes .../OpenPackagingConventions/M3.15a.xps | Bin 57089 -> 0 bytes .../OpenPackagingConventions/M3.16a.xps | Bin 56390 -> 0 bytes .../OpenPackagingConventions/M3.17a.xps | Bin 57117 -> 0 bytes .../OpenPackagingConventions/M3.17b.xps | Bin 57167 -> 0 bytes .../OpenPackagingConventions/M3.18a.xps | Bin 57168 -> 0 bytes .../OpenPackagingConventions/M3.1a.xps | Bin 51964 -> 0 bytes .../OpenPackagingConventions/M3.1b.xps | Bin 52382 -> 0 bytes .../OpenPackagingConventions/M3.20a.xps | Bin 57169 -> 0 bytes .../OpenPackagingConventions/M3.21a.xps | Bin 57166 -> 0 bytes .../OpenPackagingConventions/M3.21b.xps | Bin 57161 -> 0 bytes .../OpenPackagingConventions/M3.25a.xps | Bin 57164 -> 0 bytes .../OpenPackagingConventions/M3.26a.xps | Bin 57165 -> 0 bytes .../OpenPackagingConventions/M3.28a.xps | Bin 57167 -> 0 bytes .../OpenPackagingConventions/M3.29a.xps | Bin 57166 -> 0 bytes .../OpenPackagingConventions/M3.2a.xps | Bin 52018 -> 0 bytes .../OpenPackagingConventions/M3.31a.xps | Bin 57165 -> 0 bytes .../OpenPackagingConventions/M3.31b.xps | Bin 57166 -> 0 bytes .../OpenPackagingConventions/M3.32a.xps | Bin 57166 -> 0 bytes .../OpenPackagingConventions/M3.32b.xps | Bin 57165 -> 0 bytes .../OpenPackagingConventions/M3.4a.xps | Bin 57304 -> 0 bytes .../OpenPackagingConventions/M3.4b.xps | Bin 57069 -> 0 bytes .../OpenPackagingConventions/M3.5a.xps | Bin 57016 -> 0 bytes .../OpenPackagingConventions/M3.6a.xps | Bin 57023 -> 0 bytes .../OpenPackagingConventions/M3.7a.xps | Bin 57167 -> 0 bytes .../OpenPackagingConventions/M3.8a.xps | Bin 57224 -> 0 bytes .../OpenPackagingConventions/M3.9a.xps | Bin 57175 -> 0 bytes .../OpenPackagingConventions/M3.9b.xps | Bin 57181 -> 0 bytes .../OpenPackagingConventions/M3.9c.xps | Bin 57169 -> 0 bytes .../OpenPackagingConventions/M4.1a.xps | Bin 51970 -> 0 bytes .../OpenPackagingConventions/M4.2a.xps | Bin 51971 -> 0 bytes .../OpenPackagingConventions/M4.3a.xps | Bin 51975 -> 0 bytes .../OpenPackagingConventions/M6.1a.xps | Bin 55529 -> 0 bytes .../OpenPackagingConventions/M6.2a.xps | Bin 55529 -> 0 bytes .../OpenPackagingConventions/M6.4a.xps | Bin 55529 -> 0 bytes .../OpenPackagingConventions/M6.6a.xps | Bin 55529 -> 0 bytes .../OpenPackagingConventions/M6.7a.xps | Bin 55529 -> 0 bytes .../OpenPackagingConventions/M6.8a.xps | Bin 55529 -> 0 bytes .../OpenPackagingConventions/M7.2a.xps | Bin 51976 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M1.2a.xps | Bin 306 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M12.2a.xps | Bin 79569 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M12.3b.xps | Bin 157979 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M12.5a.xps | Bin 7172 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M12.7a.xps | Bin 79569 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.10a.xps | Bin 52433 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.13a.xps | Bin 52452 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.13b.xps | Bin 55919 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.14a.xps | Bin 52502 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.18a.xps | Bin 1621196 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.25a.xps | Bin 9501586 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.36a.xps | Bin 81864 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.37a.xps | Bin 84470 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.3a.xps | Bin 52234 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.3b.xps | Bin 52452 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.3c.xps | Bin 55919 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.4a.xps | Bin 52180 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.4b.xps | Bin 52419 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.59a.xps | Bin 5266 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.5a.xps | Bin 51800 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.5b.xps | Bin 52373 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.6a.xps | Bin 5839 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.6b.xps | Bin 52382 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.71a.xps | Bin 79658 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.71b.xps | Bin 79650 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.71c.xps | Bin 79761 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.73a.xps | Bin 79606 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.73b.xps | Bin 79624 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.74a.xps | Bin 13699 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.75a.xps | Bin 79578 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.75b.xps | Bin 79583 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M2.76a.xps | Bin 79563 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M3.2a.xps | Bin 52499 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M3.3a.xps | Bin 52464 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M3.5a.xps | Bin 52457 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M3.6a.xps | Bin 55591 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M3.6b.xps | Bin 52463 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M4.3a.xps | Bin 2396 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M5.15a.xps | Bin 37130 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M5.2a.xps | Bin 26289 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M5.2b.xps | Bin 26292 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M5.4a.xps | Bin 26348 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M5.4b.xps | Bin 26340 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M5.7a.xps | Bin 13158 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M6.2a.xps | Bin 79597 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M6.3a.xps | Bin 13735 -> 0 bytes .../SampleXPS/ConformanceViolations/XPS/M7.5a.xps | Bin 19114 -> 0 bytes print/SampleXPS/QualityLogicMinBar/mb01.xps | Bin 813339 -> 0 bytes print/SampleXPS/QualityLogicMinBar/mb02.xps | Bin 2243925 -> 0 bytes print/SampleXPS/QualityLogicMinBar/mb03.xps | Bin 14423371 -> 0 bytes print/SampleXPS/QualityLogicMinBar/mb04.xps | Bin 2115955 -> 0 bytes print/SampleXPS/QualityLogicMinBar/mb05.xps | Bin 4577346 -> 0 bytes print/SampleXPS/QualityLogicMinBar/mb06.xps | Bin 231855 -> 0 bytes print/SampleXPS/QualityLogicMinBar/mb07.xps | Bin 468479 -> 0 bytes print/SampleXPS/QualityLogicMinBar/mb08.xps | Bin 160268 -> 0 bytes print/SampleXPS/QualityLogicMinBar/mb09.xps | Bin 236946 -> 0 bytes print/SampleXPS/README.md | 15 - print/SampleXPS/SampleXPS.sln | 34 - .../XPSTestFiles_EndUserLicenseAgreement.txt | 7 - print/SimplePipelineFilter/FilterSample.def | 8 - print/SimplePipelineFilter/FilterSample.rc | 10 - print/SimplePipelineFilter/README.md | 19 - .../SimplePipelineFilter/SimplePipelineFilter.sln | 34 - print/SimplePipelineFilter/StreamFilter.cxx | 263 -- print/SimplePipelineFilter/StreamFilter.hxx | 99 - .../SimplePipelineFilter/WdkPipelineFilter.vcxproj | 407 --- .../WdkPipelineFilter.vcxproj.Filters | 91 - print/SimplePipelineFilter/XpsFilter.cxx | 785 ------ print/SimplePipelineFilter/XpsFilter.hxx | 126 - print/SimplePipelineFilter/main.cxx | 172 -- print/SimplePipelineFilter/main.hxx | 51 - print/SimplePipelineFilter/precomp.hxx | 26 - print/SimplePipelineFilter/precompsrc.cpp | 1 - print/SimplePipelineFilter/smartptr.hxx | 233 -- print/SimplePipelineFilter/trace.hxx | 51 - print/XPSDrvSmpl/Package/package.VcxProj | 161 -- print/XPSDrvSmpl/Package/package.VcxProj.Filters | 21 - print/XPSDrvSmpl/README.md | 292 -- print/XPSDrvSmpl/XPSDrvSmpl.sln | 268 -- print/XPSDrvSmpl/install/xdCMYKPrinter.icc | Bin 849080 -> 0 bytes print/XPSDrvSmpl/install/xdbook.gpd | 87 - print/XPSDrvSmpl/install/xdcolman.gpd | 106 - print/XPSDrvSmpl/install/xdnames.gpd | 151 - print/XPSDrvSmpl/install/xdnup.gpd | 207 -- print/XPSDrvSmpl/install/xdpgscl.gpd | 117 - print/XPSDrvSmpl/install/xdsmpl-PipelineConfig.xml | 55 - print/XPSDrvSmpl/install/xdsmpl.gpd | 467 ---- print/XPSDrvSmpl/install/xdsmpl.inf | Bin 7036 -> 0 bytes print/XPSDrvSmpl/install/xdsmpl.ini | 22 - print/XPSDrvSmpl/install/xdwmark.gpd | 67 - print/XPSDrvSmpl/install/xdwscRGB.icc | Bin 124856 -> 0 bytes print/XPSDrvSmpl/src/common/bkdata.h | 46 - print/XPSDrvSmpl/src/common/bkpchndlr.cpp | 201 -- print/XPSDrvSmpl/src/common/bkpchndlr.h | 41 - print/XPSDrvSmpl/src/common/bkpthndlr.cpp | 318 --- print/XPSDrvSmpl/src/common/bkpthndlr.h | 55 - print/XPSDrvSmpl/src/common/bkschema.cpp | 51 - print/XPSDrvSmpl/src/common/bkschema.h | 77 - print/XPSDrvSmpl/src/common/cmdata.h | 42 - print/XPSDrvSmpl/src/common/cmintentsdata.h | 42 - print/XPSDrvSmpl/src/common/cmintentsschema.cpp | 34 - print/XPSDrvSmpl/src/common/cmintentsschema.h | 55 - print/XPSDrvSmpl/src/common/cmintpthndlr.cpp | 156 -- print/XPSDrvSmpl/src/common/cmintpthndlr.h | 43 - print/XPSDrvSmpl/src/common/cmprofiledata.h | 44 - print/XPSDrvSmpl/src/common/cmprofileschema.cpp | 49 - print/XPSDrvSmpl/src/common/cmprofileschema.h | 60 - print/XPSDrvSmpl/src/common/cmprofpchndlr.cpp | 179 -- print/XPSDrvSmpl/src/common/cmprofpchndlr.h | 42 - print/XPSDrvSmpl/src/common/cmprofpthndlr.cpp | 206 -- print/XPSDrvSmpl/src/common/cmprofpthndlr.h | 51 - print/XPSDrvSmpl/src/common/cmpthndlr.cpp | 154 -- print/XPSDrvSmpl/src/common/cmpthndlr.h | 46 - print/XPSDrvSmpl/src/common/cmschema.cpp | 34 - print/XPSDrvSmpl/src/common/cmschema.h | 55 - print/XPSDrvSmpl/src/common/globals.cpp | 237 -- print/XPSDrvSmpl/src/common/globals.h | 102 - print/XPSDrvSmpl/src/common/nupchndlr.cpp | 196 -- print/XPSDrvSmpl/src/common/nupchndlr.h | 41 - print/XPSDrvSmpl/src/common/nupdata.h | 46 - print/XPSDrvSmpl/src/common/nupschema.cpp | 46 - print/XPSDrvSmpl/src/common/nupschema.h | 77 - print/XPSDrvSmpl/src/common/nupthndlr.cpp | 309 --- print/XPSDrvSmpl/src/common/nupthndlr.h | 53 - print/XPSDrvSmpl/src/common/pchndlr.cpp | 640 ----- print/XPSDrvSmpl/src/common/pchndlr.h | 91 - print/XPSDrvSmpl/src/common/pgscdata.h | 52 - print/XPSDrvSmpl/src/common/pgscpchndlr.cpp | 349 --- print/XPSDrvSmpl/src/common/pgscpchndlr.h | 41 - print/XPSDrvSmpl/src/common/pgscpthndlr.cpp | 479 ---- print/XPSDrvSmpl/src/common/pgscpthndlr.h | 55 - print/XPSDrvSmpl/src/common/pgscschema.cpp | 64 - print/XPSDrvSmpl/src/common/pgscschema.h | 112 - print/XPSDrvSmpl/src/common/pimagedata.h | 52 - print/XPSDrvSmpl/src/common/pimagepthndlr.cpp | 171 -- print/XPSDrvSmpl/src/common/pimagepthndlr.h | 42 - print/XPSDrvSmpl/src/common/pimageschema.cpp | 40 - print/XPSDrvSmpl/src/common/pimageschema.h | 62 - print/XPSDrvSmpl/src/common/porientdata.h | 42 - print/XPSDrvSmpl/src/common/porientpthndlr.cpp | 150 - print/XPSDrvSmpl/src/common/porientpthndlr.h | 45 - print/XPSDrvSmpl/src/common/porientschema.cpp | 34 - print/XPSDrvSmpl/src/common/porientschema.h | 55 - print/XPSDrvSmpl/src/common/precomp.h | 102 - print/XPSDrvSmpl/src/common/precompsrc.cpp | 1 - print/XPSDrvSmpl/src/common/privatedefs.h | 300 -- print/XPSDrvSmpl/src/common/pshndlr.cpp | 1836 ------------- print/XPSDrvSmpl/src/common/pshndlr.h | 218 -- print/XPSDrvSmpl/src/common/psizedata.h | 44 - print/XPSDrvSmpl/src/common/psizepthndlr.cpp | 136 - print/XPSDrvSmpl/src/common/psizepthndlr.h | 45 - print/XPSDrvSmpl/src/common/psizeschema.cpp | 32 - print/XPSDrvSmpl/src/common/psizeschema.h | 55 - print/XPSDrvSmpl/src/common/pthndlr.cpp | 1385 ---------- print/XPSDrvSmpl/src/common/pthndlr.h | 178 -- print/XPSDrvSmpl/src/common/ptquerybld.cpp | 516 ---- print/XPSDrvSmpl/src/common/ptquerybld.h | 84 - print/XPSDrvSmpl/src/common/schema.cpp | 70 - print/XPSDrvSmpl/src/common/schema.h | 94 - print/XPSDrvSmpl/src/common/wmdata.h | 71 - print/XPSDrvSmpl/src/common/wmpchndlr.cpp | 555 ---- print/XPSDrvSmpl/src/common/wmpchndlr.h | 41 - print/XPSDrvSmpl/src/common/wmpthndlr.cpp | 1167 -------- print/XPSDrvSmpl/src/common/wmpthndlr.h | 116 - print/XPSDrvSmpl/src/common/wmschema.cpp | 60 - print/XPSDrvSmpl/src/common/wmschema.h | 114 - print/XPSDrvSmpl/src/common/workbuff.cpp | 233 -- print/XPSDrvSmpl/src/common/workbuff.h | 51 - print/XPSDrvSmpl/src/common/xdsmplcmn.vcxproj | 593 ---- .../src/common/xdsmplcmn.vcxproj.Filters | 2230 --------------- print/XPSDrvSmpl/src/debug/debug.cpp | 189 -- print/XPSDrvSmpl/src/debug/debug.h | 186 -- print/XPSDrvSmpl/src/debug/precomp.h | 67 - print/XPSDrvSmpl/src/debug/precompsrc.cpp | 1 - print/XPSDrvSmpl/src/debug/xdsdbg.vcxproj | 343 --- print/XPSDrvSmpl/src/debug/xdsdbg.vcxproj.Filters | 33 - print/XPSDrvSmpl/src/filters/booklet/bkflt.cpp | 591 ---- print/XPSDrvSmpl/src/filters/booklet/bkflt.h | 80 - print/XPSDrvSmpl/src/filters/booklet/bkflt.rc | 43 - print/XPSDrvSmpl/src/filters/booklet/bkprps.cpp | 124 - print/XPSDrvSmpl/src/filters/booklet/bkprps.h | 52 - print/XPSDrvSmpl/src/filters/booklet/bksax.cpp | 285 -- print/XPSDrvSmpl/src/filters/booklet/bksax.h | 59 - print/XPSDrvSmpl/src/filters/booklet/dllentry.cpp | 143 - .../XPSDrvSmpl/src/filters/booklet/precompsrc.cpp | 1 - print/XPSDrvSmpl/src/filters/booklet/xdbook.def | 26 - .../XPSDrvSmpl/src/filters/booklet/xdbook.vcxproj | 540 ---- .../src/filters/booklet/xdbook.vcxproj.Filters | 65 - print/XPSDrvSmpl/src/filters/color/XDColMan.def | 26 - .../XPSDrvSmpl/src/filters/color/XDColMan.vcxproj | 614 ----- .../src/filters/color/XDColMan.vcxproj.Filters | 329 --- print/XPSDrvSmpl/src/filters/color/bmpconv.cpp | 1187 -------- print/XPSDrvSmpl/src/filters/color/bmpconv.h | 168 -- print/XPSDrvSmpl/src/filters/color/bmpdata.cpp | 253 -- print/XPSDrvSmpl/src/filters/color/bmpdata.h | 768 ------ print/XPSDrvSmpl/src/filters/color/cmflt.cpp | 264 -- print/XPSDrvSmpl/src/filters/color/cmflt.h | 51 - print/XPSDrvSmpl/src/filters/color/cmflt.rc | 43 - print/XPSDrvSmpl/src/filters/color/cmimg.cpp | 856 ------ print/XPSDrvSmpl/src/filters/color/cmimg.h | 87 - print/XPSDrvSmpl/src/filters/color/cmsax.cpp | 440 --- print/XPSDrvSmpl/src/filters/color/cmsax.h | 80 - print/XPSDrvSmpl/src/filters/color/colchan.cpp | 1883 ------------- print/XPSDrvSmpl/src/filters/color/colchan.h | 289 -- print/XPSDrvSmpl/src/filters/color/colconv.cpp | 1138 -------- print/XPSDrvSmpl/src/filters/color/colconv.h | 167 -- print/XPSDrvSmpl/src/filters/color/dictionary.cpp | 289 -- print/XPSDrvSmpl/src/filters/color/dictionary.h | 65 - print/XPSDrvSmpl/src/filters/color/dllentry.cpp | 145 - print/XPSDrvSmpl/src/filters/color/precompsrc.cpp | 1 - print/XPSDrvSmpl/src/filters/color/profile.cpp | 709 ----- print/XPSDrvSmpl/src/filters/color/profile.h | 124 - print/XPSDrvSmpl/src/filters/color/profman.cpp | 818 ------ print/XPSDrvSmpl/src/filters/color/profman.h | 126 - print/XPSDrvSmpl/src/filters/color/scaniter.cpp | 604 ---- print/XPSDrvSmpl/src/filters/color/scaniter.h | 218 -- print/XPSDrvSmpl/src/filters/color/transform.cpp | 666 ----- print/XPSDrvSmpl/src/filters/color/transform.h | 83 - print/XPSDrvSmpl/src/filters/color/wcsapiconv.cpp | 813 ------ print/XPSDrvSmpl/src/filters/color/wcsapiconv.h | 280 -- print/XPSDrvSmpl/src/filters/color/wictobmscn.cpp | 751 ----- print/XPSDrvSmpl/src/filters/color/wictobmscn.h | 88 - print/XPSDrvSmpl/src/filters/common/clasfact.h | 202 -- print/XPSDrvSmpl/src/filters/common/precompsrc.cpp | 1 - print/XPSDrvSmpl/src/filters/common/ptmanage.cpp | 1216 -------- print/XPSDrvSmpl/src/filters/common/ptmanage.h | 153 -- print/XPSDrvSmpl/src/filters/common/rescache.cpp | 309 --- print/XPSDrvSmpl/src/filters/common/rescache.h | 132 - print/XPSDrvSmpl/src/filters/common/rescpy.cpp | 132 - print/XPSDrvSmpl/src/filters/common/rescpy.h | 40 - print/XPSDrvSmpl/src/filters/common/saxhndlr.cpp | 586 ---- print/XPSDrvSmpl/src/filters/common/saxhndlr.h | 129 - print/XPSDrvSmpl/src/filters/common/widetoutf8.cpp | 199 -- print/XPSDrvSmpl/src/filters/common/widetoutf8.h | 48 - .../XPSDrvSmpl/src/filters/common/xdfltcmn.vcxproj | 561 ---- .../src/filters/common/xdfltcmn.vcxproj.Filters | 163 -- print/XPSDrvSmpl/src/filters/common/xdrchflt.cpp | 508 ---- print/XPSDrvSmpl/src/filters/common/xdrchflt.h | 86 - print/XPSDrvSmpl/src/filters/common/xdsmplflt.cpp | 319 --- print/XPSDrvSmpl/src/filters/common/xdsmplflt.h | 77 - print/XPSDrvSmpl/src/filters/common/xdstrmflt.cpp | 351 --- print/XPSDrvSmpl/src/filters/common/xdstrmflt.h | 63 - print/XPSDrvSmpl/src/filters/nup/dllentry.cpp | 144 - print/XPSDrvSmpl/src/filters/nup/nupflt.cpp | 476 ---- print/XPSDrvSmpl/src/filters/nup/nupflt.h | 88 - print/XPSDrvSmpl/src/filters/nup/nupflt.rc | 43 - print/XPSDrvSmpl/src/filters/nup/nuppage.cpp | 581 ---- print/XPSDrvSmpl/src/filters/nup/nuppage.h | 107 - print/XPSDrvSmpl/src/filters/nup/nupsax.cpp | 522 ---- print/XPSDrvSmpl/src/filters/nup/nupsax.h | 76 - print/XPSDrvSmpl/src/filters/nup/nuptprps.cpp | 449 --- print/XPSDrvSmpl/src/filters/nup/nuptprps.h | 97 - print/XPSDrvSmpl/src/filters/nup/nupxform.cpp | 623 ----- print/XPSDrvSmpl/src/filters/nup/nupxform.h | 101 - print/XPSDrvSmpl/src/filters/nup/precompsrc.cpp | 1 - print/XPSDrvSmpl/src/filters/nup/xdnup.def | 26 - print/XPSDrvSmpl/src/filters/nup/xdnup.vcxproj | 552 ---- .../src/filters/nup/xdnup.vcxproj.Filters | 95 - print/XPSDrvSmpl/src/filters/precomp.h | 110 - print/XPSDrvSmpl/src/filters/scaling/dllentry.cpp | 144 - print/XPSDrvSmpl/src/filters/scaling/pagescale.cpp | 761 ------ print/XPSDrvSmpl/src/filters/scaling/pagescale.h | 107 - .../XPSDrvSmpl/src/filters/scaling/pgscptprop.cpp | 478 ---- print/XPSDrvSmpl/src/filters/scaling/pgscptprop.h | 91 - .../XPSDrvSmpl/src/filters/scaling/precompsrc.cpp | 1 - print/XPSDrvSmpl/src/filters/scaling/scaleflt.cpp | 253 -- print/XPSDrvSmpl/src/filters/scaling/scaleflt.h | 56 - print/XPSDrvSmpl/src/filters/scaling/scaleflt.rc | 43 - print/XPSDrvSmpl/src/filters/scaling/scalesax.cpp | 591 ---- print/XPSDrvSmpl/src/filters/scaling/scalesax.h | 75 - print/XPSDrvSmpl/src/filters/scaling/xdscale.def | 26 - .../XPSDrvSmpl/src/filters/scaling/xdscale.vcxproj | 578 ---- .../src/filters/scaling/xdscale.vcxproj.Filters | 79 - print/XPSDrvSmpl/src/filters/watermark/Raster1.png | Bin 67501 -> 0 bytes print/XPSDrvSmpl/src/filters/watermark/Vector1.xps | Bin 1724 -> 0 bytes .../XPSDrvSmpl/src/filters/watermark/dllentry.cpp | 143 - .../src/filters/watermark/precompsrc.cpp | 1 - print/XPSDrvSmpl/src/filters/watermark/wmbase.cpp | 416 --- print/XPSDrvSmpl/src/filters/watermark/wmbase.h | 95 - print/XPSDrvSmpl/src/filters/watermark/wmflt.cpp | 340 --- print/XPSDrvSmpl/src/filters/watermark/wmflt.h | 54 - print/XPSDrvSmpl/src/filters/watermark/wmflt.rc | 54 - print/XPSDrvSmpl/src/filters/watermark/wmfont.cpp | 413 --- print/XPSDrvSmpl/src/filters/watermark/wmfont.h | 82 - print/XPSDrvSmpl/src/filters/watermark/wmimg.cpp | 503 ---- print/XPSDrvSmpl/src/filters/watermark/wmimg.h | 90 - .../XPSDrvSmpl/src/filters/watermark/wmptprop.cpp | 683 ----- print/XPSDrvSmpl/src/filters/watermark/wmptprop.h | 103 - print/XPSDrvSmpl/src/filters/watermark/wmrast.cpp | 271 -- print/XPSDrvSmpl/src/filters/watermark/wmrast.h | 58 - print/XPSDrvSmpl/src/filters/watermark/wmres.h | 27 - print/XPSDrvSmpl/src/filters/watermark/wmsax.cpp | 427 --- print/XPSDrvSmpl/src/filters/watermark/wmsax.h | 74 - print/XPSDrvSmpl/src/filters/watermark/wmtext.cpp | 250 -- print/XPSDrvSmpl/src/filters/watermark/wmtext.h | 57 - print/XPSDrvSmpl/src/filters/watermark/wmvect.cpp | 279 -- print/XPSDrvSmpl/src/filters/watermark/wmvect.h | 62 - print/XPSDrvSmpl/src/filters/watermark/wmxps.cpp | 291 -- print/XPSDrvSmpl/src/filters/watermark/wmxps.h | 60 - print/XPSDrvSmpl/src/filters/watermark/xdwmark.def | 26 - .../src/filters/watermark/xdwmark.vcxproj | 582 ---- .../src/filters/watermark/xdwmark.vcxproj.Filters | 233 -- print/XPSDrvSmpl/src/filters/xdcont/precompsrc.cpp | 1 - print/XPSDrvSmpl/src/filters/xdcont/xdcont.vcxproj | 473 ---- .../src/filters/xdcont/xdcont.vcxproj.Filters | 163 -- print/XPSDrvSmpl/src/filters/xdcont/xps.h | 83 - print/XPSDrvSmpl/src/filters/xdcont/xpsarch.cpp | 639 ----- print/XPSDrvSmpl/src/filters/xdcont/xpsarch.h | 91 - print/XPSDrvSmpl/src/filters/xdcont/xpsfd.cpp | 285 -- print/XPSDrvSmpl/src/filters/xdcont/xpsfd.h | 60 - print/XPSDrvSmpl/src/filters/xdcont/xpsfds.cpp | 285 -- print/XPSDrvSmpl/src/filters/xdcont/xpsfds.h | 61 - print/XPSDrvSmpl/src/filters/xdcont/xpsfiler.cpp | 679 ----- print/XPSDrvSmpl/src/filters/xdcont/xpsfiler.h | 119 - print/XPSDrvSmpl/src/filters/xdcont/xpsfilew.cpp | 291 -- print/XPSDrvSmpl/src/filters/xdcont/xpsfilew.h | 76 - print/XPSDrvSmpl/src/filters/xdcont/xpsproc.cpp | 916 ------- print/XPSDrvSmpl/src/filters/xdcont/xpsproc.h | 137 - print/XPSDrvSmpl/src/filters/xdcont/xpsrels.cpp | 419 --- print/XPSDrvSmpl/src/filters/xdcont/xpsrels.h | 70 - print/XPSDrvSmpl/src/filters/xdcont/xpstype.cpp | 417 --- print/XPSDrvSmpl/src/filters/xdcont/xpstype.h | 63 - print/XPSDrvSmpl/src/inc/cunknown.h | 212 -- print/XPSDrvSmpl/src/inc/gdip.h | 121 - print/XPSDrvSmpl/src/inc/ipkarch.h | 230 -- print/XPSDrvSmpl/src/inc/ipkfile.h | 128 - print/XPSDrvSmpl/src/inc/streamcnv.h | 593 ---- print/XPSDrvSmpl/src/inc/xdexcept.h | 104 - print/XPSDrvSmpl/src/inc/xdstring.h | 2889 -------------------- print/XPSDrvSmpl/src/ui/bkdmptcnv.cpp | 433 --- print/XPSDrvSmpl/src/ui/bkdmptcnv.h | 84 - print/XPSDrvSmpl/src/ui/colctrls.cpp | 371 --- print/XPSDrvSmpl/src/ui/colctrls.h | 83 - print/XPSDrvSmpl/src/ui/coldmptcnv.cpp | 395 --- print/XPSDrvSmpl/src/ui/coldmptcnv.h | 76 - print/XPSDrvSmpl/src/ui/colppg.cpp | 160 -- print/XPSDrvSmpl/src/ui/colppg.h | 42 - print/XPSDrvSmpl/src/ui/devmode.h | 82 - print/XPSDrvSmpl/src/ui/dllentry.cpp | 175 -- print/XPSDrvSmpl/src/ui/docppg.cpp | 1314 --------- print/XPSDrvSmpl/src/ui/docppg.h | 186 -- print/XPSDrvSmpl/src/ui/ftrctrls.cpp | 1667 ----------- print/XPSDrvSmpl/src/ui/ftrctrls.h | 288 -- print/XPSDrvSmpl/src/ui/ftrdmptcnv.h | 631 ----- print/XPSDrvSmpl/src/ui/ftrppg.cpp | 270 -- print/XPSDrvSmpl/src/ui/ftrppg.h | 42 - print/XPSDrvSmpl/src/ui/nupptcnv.cpp | 477 ---- print/XPSDrvSmpl/src/ui/nupptcnv.h | 86 - print/XPSDrvSmpl/src/ui/pgscdmptcnv.cpp | 468 ---- print/XPSDrvSmpl/src/ui/pgscdmptcnv.h | 76 - print/XPSDrvSmpl/src/ui/precomp.h | 103 - print/XPSDrvSmpl/src/ui/precompsrc.cpp | 1 - print/XPSDrvSmpl/src/ui/resource.h | 232 -- print/XPSDrvSmpl/src/ui/uictrl.cpp | 2117 -------------- print/XPSDrvSmpl/src/ui/uictrl.h | 405 --- print/XPSDrvSmpl/src/ui/uiproperties.cpp | 783 ------ print/XPSDrvSmpl/src/ui/uiproperties.h | 111 - print/XPSDrvSmpl/src/ui/wmctrls.cpp | 1381 ---------- print/XPSDrvSmpl/src/ui/wmctrls.h | 259 -- print/XPSDrvSmpl/src/ui/wmdmptcnv.cpp | 591 ---- print/XPSDrvSmpl/src/ui/wmdmptcnv.h | 75 - print/XPSDrvSmpl/src/ui/wmppg.cpp | 268 -- print/XPSDrvSmpl/src/ui/wmppg.h | 42 - print/XPSDrvSmpl/src/ui/xdsmplcf.cpp | 192 -- print/XPSDrvSmpl/src/ui/xdsmplcf.h | 56 - print/XPSDrvSmpl/src/ui/xdsmpldlg.rc | 326 --- print/XPSDrvSmpl/src/ui/xdsmplptprov.cpp | 891 ------ print/XPSDrvSmpl/src/ui/xdsmplptprov.h | 124 - print/XPSDrvSmpl/src/ui/xdsmplui.cpp | 1018 ------- print/XPSDrvSmpl/src/ui/xdsmplui.def | 23 - print/XPSDrvSmpl/src/ui/xdsmplui.h | 161 -- print/XPSDrvSmpl/src/ui/xdsmplui.vcxproj | 582 ---- print/XPSDrvSmpl/src/ui/xdsmplui.vcxproj.Filters | 611 ----- print/XpsRasFilter/README.md | 43 - print/XpsRasFilter/XpsRasFilter.sln | 34 - .../install/xpsrassmpl-PipelineConfig.xml | 32 - print/XpsRasFilter/install/xpsrassmpl.gpd | 342 --- print/XpsRasFilter/install/xpsrassmpl.inf | Bin 4440 -> 0 bytes print/XpsRasFilter/src/BitmapHandler.cpp | 361 --- print/XpsRasFilter/src/BitmapHandler.h | 64 - print/XpsRasFilter/src/Exception.cpp | 43 - print/XpsRasFilter/src/Exception.h | 86 - print/XpsRasFilter/src/OMConvertor.cpp | 774 ------ print/XpsRasFilter/src/OMConvertor.h | 90 - print/XpsRasFilter/src/PThandler.cpp | 781 ------ print/XpsRasFilter/src/PThandler.h | 112 - print/XpsRasFilter/src/UnknownBase.h | 158 -- print/XpsRasFilter/src/WppTrace.cpp | 41 - print/XpsRasFilter/src/WppTrace.h | 58 - print/XpsRasFilter/src/dllentry.cpp | 326 --- print/XpsRasFilter/src/filtertypes.h | 497 ---- print/XpsRasFilter/src/precomp.h | 87 - print/XpsRasFilter/src/precompsrc.cpp | 1 - print/XpsRasFilter/src/rasinterface.cpp | 412 --- print/XpsRasFilter/src/rasinterface.h | 107 - print/XpsRasFilter/src/xpsrasfilter.cpp | 396 --- print/XpsRasFilter/src/xpsrasfilter.def | 22 - print/XpsRasFilter/src/xpsrasfilter.h | 141 - print/XpsRasFilter/src/xpsrasfilter.rc | 28 - print/XpsRasFilter/src/xpsrasfilter.vcxproj | 454 --- .../XpsRasFilter/src/xpsrasfilter.vcxproj.Filters | 178 -- print/autoconfig/ACnfgPS.gdl | 100 - print/autoconfig/ACnfgUni.GDL | 111 - print/autoconfig/AutoCnfg.GPD | 733 ----- print/autoconfig/AutoCnfg.PPD | 479 ---- print/autoconfig/AutoCnfg.inf | Bin 6140 -> 0 bytes print/autoconfig/AutoConfig.htm | 367 --- print/autoconfig/AutoConfig.sln | 61 - print/autoconfig/AutoConfig.vcxproj | 219 -- print/autoconfig/AutoConfig.vcxproj.Filters | 33 - print/autoconfig/Package/package.VcxProj | 118 - print/autoconfig/Package/package.VcxProj.Filters | 21 - print/autoconfig/README.md | 46 - print/cpsuisam/CPSUIDAT.C | 1331 --------- print/cpsuisam/CPSUIDAT.H | 73 - print/cpsuisam/CPSUISAM.DEF | 6 - print/cpsuisam/CPSUISAM.DLG | 35 - print/cpsuisam/CPSUISAM.H | 37 - print/cpsuisam/DEBUG.C | 114 - print/cpsuisam/DEBUG.H | 66 - print/cpsuisam/PRECOMP.H | 17 - print/cpsuisam/README.md | 21 - print/cpsuisam/cpsuisam.c | 665 ----- print/cpsuisam/cpsuisam.sln | 34 - print/cpsuisam/cpsuisam.vcxproj | 352 --- print/cpsuisam/cpsuisam.vcxproj.Filters | 70 - print/cpsuisam/icons/apple.ico | Bin 1078 -> 0 bytes print/cpsuisam/icons/cpsuisam.ico | Bin 1078 -> 0 bytes print/cpsuisam/precompsrc.c | 1 - print/cpsuisam/res.rc | 51 - .../ExtensionSample/App.xaml | 7 - .../ExtensionSample/App.xaml.cs | 146 - .../ExtensionSample/BidiHelper.cs | 154 -- .../ExtensionSample/Fabrikam_Logo.png | Bin 2589 -> 0 bytes .../ExtensionSample/PrintPreferenceWindow.xaml | 147 - .../ExtensionSample/PrintPreferenceWindow.xaml.cs | 467 ---- .../ExtensionSample/PrintSchemaHelper.cs | 190 -- .../ExtensionSample/PrinterExtensionSample.csproj | 285 -- .../ExtensionSample/Properties/AssemblyInfo.cs | 62 - .../Properties/Resources.Designer.cs | 63 - .../ExtensionSample/Properties/Resources.resx | 117 - .../Properties/Settings.Designer.cs | 26 - .../ExtensionSample/Properties/Settings.settings | 7 - .../ExtensionSample/Strings.Designer.cs | 82 - .../ExtensionSample/Strings.resx | 129 - .../ExtensionSample/ValidationModalDialog.xaml | 19 - .../ExtensionSample/ValidationModalDialog.xaml.cs | 108 - .../ExtensionSample/WindowHelper.cs | 83 - .../ExtensionSample/app.config | 9 - .../ExtensionSample/bidi_Ink_mock.xml | 74 - .../PrinterExtensionAdapters.cs | 2051 -------------- .../PrinterExtensionLibrary.csproj | 101 - .../PrinterExtensionManager.cs | 121 - .../PrinterExtensionTypes.cs | 921 ------- .../Properties/AssemblyInfo.cs | 33 - .../PrinterExtensionSample.sln | 149 - .../PrinterExtensionSample/README.md | 22 - .../ConstraintScript.js | 679 ----- .../ConstraintScript.sln | 34 - .../ConstraintScript.vcxproj | 209 -- .../ConstraintScript.vcxproj.Filters | 21 - .../v4PrintDriver-ConstraintScript/README.md | 32 - .../v4PrintDriver-Intellisense-Windows8.1.js | 126 - .../v4PrintDriver-Intellisense.js | 513 ---- .../HostBasedSampleDriver.sln | 53 - .../HostBasedSampleDriver.vcxproj | 221 -- .../HostBasedSampleDriver.vcxproj.Filters | 41 - .../Package/package.VcxProj | 128 - .../Package/package.VcxProj.Filters | 21 - .../v4PrintDriver-HostBasedSampleDriver/README.md | 67 - .../usb_host_based_sample-manifest.ini | 13 - .../usb_host_based_sample-pipelineconfig.xml | 1 - .../usb_host_based_sample.gpd | 138 - .../usb_host_based_sample.inf | Bin 5802 -> 0 bytes .../usb_host_based_sample.js | Bin 35004 -> 0 bytes .../usb_host_based_sample_events.xml | 11 - .../usb_host_based_sample_extension.xml | 8 - .../v4PrintDriver-Intellisense-Windows8.1.js | 126 - .../v4PrintDriver-Intellisense.js | 513 ---- .../v4PrintDriver-USBMon-Bidi-Extension/README.md | 48 - .../USBMon-Bidi-Extension.js | Bin 34662 -> 0 bytes .../USBMon-Bidi-Extension.sln | 34 - .../USBMon-Bidi-Extension.vcxproj | 210 -- .../USBMon-Bidi-Extension.vcxproj.Filters | 26 - .../USBMon-Bidi-Extension.xml | 24 - .../v4PrintDriver-Intellisense-Windows8.1.js | 126 - .../v4PrintDriver-Intellisense.js | 513 ---- .../v4PrintDriver-WSDMon-Bidi-Extension/README.md | 55 - .../WSDMon-Bidi-Extension.sln | 34 - .../WSDMon-Bidi-Extension.vcxproj | 203 -- .../WSDMon-Bidi-Extension.vcxproj.Filters | 26 - .../WSDMon-Bidi-Extension.xml | 79 - 1141 files changed, 5 insertions(+), 187090 deletions(-) delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/CUSTOMDRV.HLP delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Features.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Features.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Helper.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Helper.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/OEMUI.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/PSUIREP.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/PSUIREP.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/StringUtils.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/StringUtils.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/debug.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/debug.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/devmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/devmode.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/dllentry.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/globals.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/globals.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/oemui.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/oemui.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/psuirep.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/resource.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.gpd delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.ini delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/PTPCPLPR.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/PTPCPLPR.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/debug.hxx delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/dllentry.cxx delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/globals.cxx delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/globals.hxx delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/intrface.cxx delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/intrface.hxx delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/oem.hxx delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/oemptprovider.cxx delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/oemptprovider.hxx delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/precomp.hxx delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/printschema.cxx delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/printschema.hxx delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/ptpcplpr.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/ptpcplpr.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/xmlhandler.cxx delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/xmlhandler.hxx delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/SYNCSET.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/SYNCSET.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/SyncSet.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/debug.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/debug.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/devmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/devmode.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/dllentry.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/globals.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/globals.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oem.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oemui.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oemui.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oemui.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/SyncSet/resource.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/OEMUI.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/ThemeUI.Manifest delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/ThemeUISmpl.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/ThemeUISmpl.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/debug.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/devmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/devmode.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/dllentry.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/fusutils.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/fusutils.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/globals.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/globals.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/oem.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/oemui.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/oemui.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/resource.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/themeuismpl.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/WMarkPS.ini delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/WMarkUni.ini delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap.gpd delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap.ini delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/ddihook.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/debug.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/devmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/devmode.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/dllentry.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/bitmap/resource.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp.gpd delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp.ini delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/CUSTHLP.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/CUSTHLP.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/CUSTHLP.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.cnt delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.hpj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.rtf delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/debug.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/devmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/devmode.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/dllentry.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/globals.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/globals.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/oemui.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/oemui.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/oemui.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/custhlp/resource.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.gpd delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.ini delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/src/GDLSMPL.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/src/GDLSMPL.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/src/debug.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/src/devmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/src/devmode.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/src/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/src/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/src/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/gdl/src/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oem.gpd delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oem.ppd delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemdll.sln delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean.gpd delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean.htm delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean.ini delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/ddihook.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/debug.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/debug.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/devmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/devmode.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/dllentry.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemprean/resource.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps.ini delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/OEMPS.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/OEMPS.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/OEMPS.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/command.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/command.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/ddihook.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/debug.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/devmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/devmode.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/dllentry.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/oemps.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/oemps.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemps/resource.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui.ini delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/debug.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/devmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/devmode.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/dllentry.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/globals.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/globals.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/oemui.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/oemui.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemui/resource.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni.ini delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/ddihook.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/debug.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/devmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/devmode.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/dllentry.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/oemuni/resource.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/psuirep.ini delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/syncset.gpd delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/syncset.ini delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/themeui.ini delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.gpd delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.ini delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/Features.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/Features.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/UNIUIREP.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/UNIUIREP.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/debug.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/debug.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/devmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/devmode.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/dllentry.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/resource.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/common/debug.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/common/devmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/common/devmode.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/common/oem.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMARKPS.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMARKPS.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMarkPS.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMarkPS.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/command.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/command.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/dllentry.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/drawmark.ps delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/fdevmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/resource.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/wmark.ps delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/wmarkps.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/WMARKUI.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/WMARKUI.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/dllentry.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/fdevmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/globals.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/globals.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/resource.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/debug.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/devmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/devmode.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/oem.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/WMARKUNIUI.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/WMARKUNIUI.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/dllentry.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/fdevmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/globals.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/globals.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/resource.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkui.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkui.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkui.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkuniui.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/WMARKUNI.vcxproj delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/WMARKUNI.vcxproj.Filters delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/ddihook.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/dllentry.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/fdevmode.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/intrface.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/intrface.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/name.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/precomp.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/precompsrc.cpp delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/resource.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/wmarkuni.def delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/wmarkuni.h delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/wmarkuni.rc delete mode 100644 print/OEM Printer Customization Plug-in Samples/C++/winxp.inf delete mode 100644 print/OEM Printer Customization Plug-in Samples/README.md delete mode 100644 print/OEM Printer Customization Plug-in Samples/license.rtf create mode 100644 print/README.md delete mode 100644 print/SampleOpenXPS/BlankProjSrc/BlankProject.vcxproj delete mode 100644 print/SampleOpenXPS/BlankProjSrc/BlankProject.vcxproj.Filters delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M1.1a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M1.2a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.14a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.17a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.20a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.24a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.27a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.27b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.30a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.31a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.32a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.33a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.35a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.36a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.36b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.41a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.41b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.42a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.42b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.43a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.43b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.44a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.48a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.49a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.49b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.50a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.52a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.55a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.56a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M1.2a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.23a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.6a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.6b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.2a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.3a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.3b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.7a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.10a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.10b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.13a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.13b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.14a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.14b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.17a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.18a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.25a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.35a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.36a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.37a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.4a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.4b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.54a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.5a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.5b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.70a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.73a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.73b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75d.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.76a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.77a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.77b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.80.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.81.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.82.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.11a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.11b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.12a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.12b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.13a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.14a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.20a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.20b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.2a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.2b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.3a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.5a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.5b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.6a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.6b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.2a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.2b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.3a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.15a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.4a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.4b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.7a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.1a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.1b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.2a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.2b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.3a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.3b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.4a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.4b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.5a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.5b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.6a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.6b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.11a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.11b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.2a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.2b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.3a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.5a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.6a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M8.14a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M9.10a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M9.10b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.10a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.10b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.11a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.12a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.13a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.13b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.15a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.17a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.17b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.18a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.18b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.1a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.20a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.20b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.21a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.21b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.22a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.25a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.26a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.26b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.27a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.27b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.28a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.28b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.30a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.30b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.3a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.5a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6d.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.7a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.7b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8c.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.9a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.10a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.18a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.4a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.5a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.5b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.6a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.6b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.7a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.7b.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.10a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.14a.oxps delete mode 100644 print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.9a.oxps delete mode 100644 print/SampleOpenXPS/OpenXPSTestFiles_EndUserLicenseAgreement.txt delete mode 100644 print/SampleOpenXPS/QualityLogicMinBar_oxps/mb01.oxps delete mode 100644 print/SampleOpenXPS/QualityLogicMinBar_oxps/mb02.oxps delete mode 100644 print/SampleOpenXPS/QualityLogicMinBar_oxps/mb03.oxps delete mode 100644 print/SampleOpenXPS/QualityLogicMinBar_oxps/mb04.oxps delete mode 100644 print/SampleOpenXPS/QualityLogicMinBar_oxps/mb05.oxps delete mode 100644 print/SampleOpenXPS/QualityLogicMinBar_oxps/mb06.oxps delete mode 100644 print/SampleOpenXPS/QualityLogicMinBar_oxps/mb07.oxps delete mode 100644 print/SampleOpenXPS/QualityLogicMinBar_oxps/mb08.oxps delete mode 100644 print/SampleOpenXPS/QualityLogicMinBar_oxps/mb09.oxps delete mode 100644 print/SampleOpenXPS/README.md delete mode 100644 print/SampleOpenXPS/SampleOpenXPS.sln delete mode 100644 print/SampleXPS/BlankProjSrc/BlankProject.vcxproj delete mode 100644 print/SampleXPS/BlankProjSrc/BlankProject.vcxproj.Filters delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M1.1a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M1.2a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.13a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.14a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.17a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.20a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.24a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.27a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.27b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.30a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.31a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.32a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.33a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.35a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.35b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.36a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.41a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.42a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.43a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.44a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.48a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.49a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.50a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.52a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.55a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.56a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.10a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.11a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.17a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.18a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.18b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.1a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.1b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.20a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26c.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.27a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.28a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.2a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.2b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.34a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.3a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.5a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.6a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.6b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.7a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.7c.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.8a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.18a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.24a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.5a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.5b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.6a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.6b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.7a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.7b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10c.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.11a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.11b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.12a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.12b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.13a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.14a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.15a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.16a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.17a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.17b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.18a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.1a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.1b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.20a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.21a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.21b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.25a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.26a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.28a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.29a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.2a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.31a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.31b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.32a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.32b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.4a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.4b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.5a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.6a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.7a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.8a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9c.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.1a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.2a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.3a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.1a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.2a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.4a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.6a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.7a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.8a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M7.2a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M1.2a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M12.2a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M12.3b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M12.5a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M12.7a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.10a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.13a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.13b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.14a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.18a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.25a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.36a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.37a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.3a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.3b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.3c.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.4a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.4b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.59a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.5a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.5b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.6a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.6b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.71a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.71b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.71c.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.73a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.73b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.74a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.75a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.75b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M2.76a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M3.2a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M3.3a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M3.5a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M3.6a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M3.6b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M4.3a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M5.15a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M5.2a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M5.2b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M5.4a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M5.4b.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M5.7a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M6.2a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M6.3a.xps delete mode 100644 print/SampleXPS/ConformanceViolations/XPS/M7.5a.xps delete mode 100644 print/SampleXPS/QualityLogicMinBar/mb01.xps delete mode 100644 print/SampleXPS/QualityLogicMinBar/mb02.xps delete mode 100644 print/SampleXPS/QualityLogicMinBar/mb03.xps delete mode 100644 print/SampleXPS/QualityLogicMinBar/mb04.xps delete mode 100644 print/SampleXPS/QualityLogicMinBar/mb05.xps delete mode 100644 print/SampleXPS/QualityLogicMinBar/mb06.xps delete mode 100644 print/SampleXPS/QualityLogicMinBar/mb07.xps delete mode 100644 print/SampleXPS/QualityLogicMinBar/mb08.xps delete mode 100644 print/SampleXPS/QualityLogicMinBar/mb09.xps delete mode 100644 print/SampleXPS/README.md delete mode 100644 print/SampleXPS/SampleXPS.sln delete mode 100644 print/SampleXPS/XPSTestFiles_EndUserLicenseAgreement.txt delete mode 100644 print/SimplePipelineFilter/FilterSample.def delete mode 100644 print/SimplePipelineFilter/FilterSample.rc delete mode 100644 print/SimplePipelineFilter/README.md delete mode 100644 print/SimplePipelineFilter/SimplePipelineFilter.sln delete mode 100644 print/SimplePipelineFilter/StreamFilter.cxx delete mode 100644 print/SimplePipelineFilter/StreamFilter.hxx delete mode 100644 print/SimplePipelineFilter/WdkPipelineFilter.vcxproj delete mode 100644 print/SimplePipelineFilter/WdkPipelineFilter.vcxproj.Filters delete mode 100644 print/SimplePipelineFilter/XpsFilter.cxx delete mode 100644 print/SimplePipelineFilter/XpsFilter.hxx delete mode 100644 print/SimplePipelineFilter/main.cxx delete mode 100644 print/SimplePipelineFilter/main.hxx delete mode 100644 print/SimplePipelineFilter/precomp.hxx delete mode 100644 print/SimplePipelineFilter/precompsrc.cpp delete mode 100644 print/SimplePipelineFilter/smartptr.hxx delete mode 100644 print/SimplePipelineFilter/trace.hxx delete mode 100644 print/XPSDrvSmpl/Package/package.VcxProj delete mode 100644 print/XPSDrvSmpl/Package/package.VcxProj.Filters delete mode 100644 print/XPSDrvSmpl/README.md delete mode 100644 print/XPSDrvSmpl/XPSDrvSmpl.sln delete mode 100644 print/XPSDrvSmpl/install/xdCMYKPrinter.icc delete mode 100644 print/XPSDrvSmpl/install/xdbook.gpd delete mode 100644 print/XPSDrvSmpl/install/xdcolman.gpd delete mode 100644 print/XPSDrvSmpl/install/xdnames.gpd delete mode 100644 print/XPSDrvSmpl/install/xdnup.gpd delete mode 100644 print/XPSDrvSmpl/install/xdpgscl.gpd delete mode 100644 print/XPSDrvSmpl/install/xdsmpl-PipelineConfig.xml delete mode 100644 print/XPSDrvSmpl/install/xdsmpl.gpd delete mode 100644 print/XPSDrvSmpl/install/xdsmpl.inf delete mode 100644 print/XPSDrvSmpl/install/xdsmpl.ini delete mode 100644 print/XPSDrvSmpl/install/xdwmark.gpd delete mode 100644 print/XPSDrvSmpl/install/xdwscRGB.icc delete mode 100644 print/XPSDrvSmpl/src/common/bkdata.h delete mode 100644 print/XPSDrvSmpl/src/common/bkpchndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/bkpchndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/bkpthndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/bkpthndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/bkschema.cpp delete mode 100644 print/XPSDrvSmpl/src/common/bkschema.h delete mode 100644 print/XPSDrvSmpl/src/common/cmdata.h delete mode 100644 print/XPSDrvSmpl/src/common/cmintentsdata.h delete mode 100644 print/XPSDrvSmpl/src/common/cmintentsschema.cpp delete mode 100644 print/XPSDrvSmpl/src/common/cmintentsschema.h delete mode 100644 print/XPSDrvSmpl/src/common/cmintpthndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/cmintpthndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/cmprofiledata.h delete mode 100644 print/XPSDrvSmpl/src/common/cmprofileschema.cpp delete mode 100644 print/XPSDrvSmpl/src/common/cmprofileschema.h delete mode 100644 print/XPSDrvSmpl/src/common/cmprofpchndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/cmprofpchndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/cmprofpthndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/cmprofpthndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/cmpthndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/cmpthndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/cmschema.cpp delete mode 100644 print/XPSDrvSmpl/src/common/cmschema.h delete mode 100644 print/XPSDrvSmpl/src/common/globals.cpp delete mode 100644 print/XPSDrvSmpl/src/common/globals.h delete mode 100644 print/XPSDrvSmpl/src/common/nupchndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/nupchndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/nupdata.h delete mode 100644 print/XPSDrvSmpl/src/common/nupschema.cpp delete mode 100644 print/XPSDrvSmpl/src/common/nupschema.h delete mode 100644 print/XPSDrvSmpl/src/common/nupthndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/nupthndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/pchndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/pchndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/pgscdata.h delete mode 100644 print/XPSDrvSmpl/src/common/pgscpchndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/pgscpchndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/pgscpthndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/pgscpthndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/pgscschema.cpp delete mode 100644 print/XPSDrvSmpl/src/common/pgscschema.h delete mode 100644 print/XPSDrvSmpl/src/common/pimagedata.h delete mode 100644 print/XPSDrvSmpl/src/common/pimagepthndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/pimagepthndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/pimageschema.cpp delete mode 100644 print/XPSDrvSmpl/src/common/pimageschema.h delete mode 100644 print/XPSDrvSmpl/src/common/porientdata.h delete mode 100644 print/XPSDrvSmpl/src/common/porientpthndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/porientpthndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/porientschema.cpp delete mode 100644 print/XPSDrvSmpl/src/common/porientschema.h delete mode 100644 print/XPSDrvSmpl/src/common/precomp.h delete mode 100644 print/XPSDrvSmpl/src/common/precompsrc.cpp delete mode 100644 print/XPSDrvSmpl/src/common/privatedefs.h delete mode 100644 print/XPSDrvSmpl/src/common/pshndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/pshndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/psizedata.h delete mode 100644 print/XPSDrvSmpl/src/common/psizepthndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/psizepthndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/psizeschema.cpp delete mode 100644 print/XPSDrvSmpl/src/common/psizeschema.h delete mode 100644 print/XPSDrvSmpl/src/common/pthndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/pthndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/ptquerybld.cpp delete mode 100644 print/XPSDrvSmpl/src/common/ptquerybld.h delete mode 100644 print/XPSDrvSmpl/src/common/schema.cpp delete mode 100644 print/XPSDrvSmpl/src/common/schema.h delete mode 100644 print/XPSDrvSmpl/src/common/wmdata.h delete mode 100644 print/XPSDrvSmpl/src/common/wmpchndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/wmpchndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/wmpthndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/common/wmpthndlr.h delete mode 100644 print/XPSDrvSmpl/src/common/wmschema.cpp delete mode 100644 print/XPSDrvSmpl/src/common/wmschema.h delete mode 100644 print/XPSDrvSmpl/src/common/workbuff.cpp delete mode 100644 print/XPSDrvSmpl/src/common/workbuff.h delete mode 100644 print/XPSDrvSmpl/src/common/xdsmplcmn.vcxproj delete mode 100644 print/XPSDrvSmpl/src/common/xdsmplcmn.vcxproj.Filters delete mode 100644 print/XPSDrvSmpl/src/debug/debug.cpp delete mode 100644 print/XPSDrvSmpl/src/debug/debug.h delete mode 100644 print/XPSDrvSmpl/src/debug/precomp.h delete mode 100644 print/XPSDrvSmpl/src/debug/precompsrc.cpp delete mode 100644 print/XPSDrvSmpl/src/debug/xdsdbg.vcxproj delete mode 100644 print/XPSDrvSmpl/src/debug/xdsdbg.vcxproj.Filters delete mode 100644 print/XPSDrvSmpl/src/filters/booklet/bkflt.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/booklet/bkflt.h delete mode 100644 print/XPSDrvSmpl/src/filters/booklet/bkflt.rc delete mode 100644 print/XPSDrvSmpl/src/filters/booklet/bkprps.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/booklet/bkprps.h delete mode 100644 print/XPSDrvSmpl/src/filters/booklet/bksax.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/booklet/bksax.h delete mode 100644 print/XPSDrvSmpl/src/filters/booklet/dllentry.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/booklet/precompsrc.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/booklet/xdbook.def delete mode 100644 print/XPSDrvSmpl/src/filters/booklet/xdbook.vcxproj delete mode 100644 print/XPSDrvSmpl/src/filters/booklet/xdbook.vcxproj.Filters delete mode 100644 print/XPSDrvSmpl/src/filters/color/XDColMan.def delete mode 100644 print/XPSDrvSmpl/src/filters/color/XDColMan.vcxproj delete mode 100644 print/XPSDrvSmpl/src/filters/color/XDColMan.vcxproj.Filters delete mode 100644 print/XPSDrvSmpl/src/filters/color/bmpconv.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/bmpconv.h delete mode 100644 print/XPSDrvSmpl/src/filters/color/bmpdata.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/bmpdata.h delete mode 100644 print/XPSDrvSmpl/src/filters/color/cmflt.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/cmflt.h delete mode 100644 print/XPSDrvSmpl/src/filters/color/cmflt.rc delete mode 100644 print/XPSDrvSmpl/src/filters/color/cmimg.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/cmimg.h delete mode 100644 print/XPSDrvSmpl/src/filters/color/cmsax.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/cmsax.h delete mode 100644 print/XPSDrvSmpl/src/filters/color/colchan.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/colchan.h delete mode 100644 print/XPSDrvSmpl/src/filters/color/colconv.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/colconv.h delete mode 100644 print/XPSDrvSmpl/src/filters/color/dictionary.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/dictionary.h delete mode 100644 print/XPSDrvSmpl/src/filters/color/dllentry.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/precompsrc.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/profile.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/profile.h delete mode 100644 print/XPSDrvSmpl/src/filters/color/profman.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/profman.h delete mode 100644 print/XPSDrvSmpl/src/filters/color/scaniter.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/scaniter.h delete mode 100644 print/XPSDrvSmpl/src/filters/color/transform.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/transform.h delete mode 100644 print/XPSDrvSmpl/src/filters/color/wcsapiconv.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/wcsapiconv.h delete mode 100644 print/XPSDrvSmpl/src/filters/color/wictobmscn.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/color/wictobmscn.h delete mode 100644 print/XPSDrvSmpl/src/filters/common/clasfact.h delete mode 100644 print/XPSDrvSmpl/src/filters/common/precompsrc.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/common/ptmanage.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/common/ptmanage.h delete mode 100644 print/XPSDrvSmpl/src/filters/common/rescache.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/common/rescache.h delete mode 100644 print/XPSDrvSmpl/src/filters/common/rescpy.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/common/rescpy.h delete mode 100644 print/XPSDrvSmpl/src/filters/common/saxhndlr.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/common/saxhndlr.h delete mode 100644 print/XPSDrvSmpl/src/filters/common/widetoutf8.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/common/widetoutf8.h delete mode 100644 print/XPSDrvSmpl/src/filters/common/xdfltcmn.vcxproj delete mode 100644 print/XPSDrvSmpl/src/filters/common/xdfltcmn.vcxproj.Filters delete mode 100644 print/XPSDrvSmpl/src/filters/common/xdrchflt.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/common/xdrchflt.h delete mode 100644 print/XPSDrvSmpl/src/filters/common/xdsmplflt.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/common/xdsmplflt.h delete mode 100644 print/XPSDrvSmpl/src/filters/common/xdstrmflt.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/common/xdstrmflt.h delete mode 100644 print/XPSDrvSmpl/src/filters/nup/dllentry.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/nup/nupflt.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/nup/nupflt.h delete mode 100644 print/XPSDrvSmpl/src/filters/nup/nupflt.rc delete mode 100644 print/XPSDrvSmpl/src/filters/nup/nuppage.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/nup/nuppage.h delete mode 100644 print/XPSDrvSmpl/src/filters/nup/nupsax.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/nup/nupsax.h delete mode 100644 print/XPSDrvSmpl/src/filters/nup/nuptprps.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/nup/nuptprps.h delete mode 100644 print/XPSDrvSmpl/src/filters/nup/nupxform.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/nup/nupxform.h delete mode 100644 print/XPSDrvSmpl/src/filters/nup/precompsrc.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/nup/xdnup.def delete mode 100644 print/XPSDrvSmpl/src/filters/nup/xdnup.vcxproj delete mode 100644 print/XPSDrvSmpl/src/filters/nup/xdnup.vcxproj.Filters delete mode 100644 print/XPSDrvSmpl/src/filters/precomp.h delete mode 100644 print/XPSDrvSmpl/src/filters/scaling/dllentry.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/scaling/pagescale.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/scaling/pagescale.h delete mode 100644 print/XPSDrvSmpl/src/filters/scaling/pgscptprop.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/scaling/pgscptprop.h delete mode 100644 print/XPSDrvSmpl/src/filters/scaling/precompsrc.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/scaling/scaleflt.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/scaling/scaleflt.h delete mode 100644 print/XPSDrvSmpl/src/filters/scaling/scaleflt.rc delete mode 100644 print/XPSDrvSmpl/src/filters/scaling/scalesax.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/scaling/scalesax.h delete mode 100644 print/XPSDrvSmpl/src/filters/scaling/xdscale.def delete mode 100644 print/XPSDrvSmpl/src/filters/scaling/xdscale.vcxproj delete mode 100644 print/XPSDrvSmpl/src/filters/scaling/xdscale.vcxproj.Filters delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/Raster1.png delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/Vector1.xps delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/dllentry.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/precompsrc.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmbase.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmbase.h delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmflt.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmflt.h delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmflt.rc delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmfont.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmfont.h delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmimg.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmimg.h delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmptprop.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmptprop.h delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmrast.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmrast.h delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmres.h delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmsax.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmsax.h delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmtext.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmtext.h delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmvect.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmvect.h delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmxps.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/wmxps.h delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/xdwmark.def delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/xdwmark.vcxproj delete mode 100644 print/XPSDrvSmpl/src/filters/watermark/xdwmark.vcxproj.Filters delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/precompsrc.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xdcont.vcxproj delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xdcont.vcxproj.Filters delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xps.h delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpsarch.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpsarch.h delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpsfd.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpsfd.h delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpsfds.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpsfds.h delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpsfiler.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpsfiler.h delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpsfilew.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpsfilew.h delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpsproc.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpsproc.h delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpsrels.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpsrels.h delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpstype.cpp delete mode 100644 print/XPSDrvSmpl/src/filters/xdcont/xpstype.h delete mode 100644 print/XPSDrvSmpl/src/inc/cunknown.h delete mode 100644 print/XPSDrvSmpl/src/inc/gdip.h delete mode 100644 print/XPSDrvSmpl/src/inc/ipkarch.h delete mode 100644 print/XPSDrvSmpl/src/inc/ipkfile.h delete mode 100644 print/XPSDrvSmpl/src/inc/streamcnv.h delete mode 100644 print/XPSDrvSmpl/src/inc/xdexcept.h delete mode 100644 print/XPSDrvSmpl/src/inc/xdstring.h delete mode 100644 print/XPSDrvSmpl/src/ui/bkdmptcnv.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/bkdmptcnv.h delete mode 100644 print/XPSDrvSmpl/src/ui/colctrls.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/colctrls.h delete mode 100644 print/XPSDrvSmpl/src/ui/coldmptcnv.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/coldmptcnv.h delete mode 100644 print/XPSDrvSmpl/src/ui/colppg.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/colppg.h delete mode 100644 print/XPSDrvSmpl/src/ui/devmode.h delete mode 100644 print/XPSDrvSmpl/src/ui/dllentry.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/docppg.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/docppg.h delete mode 100644 print/XPSDrvSmpl/src/ui/ftrctrls.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/ftrctrls.h delete mode 100644 print/XPSDrvSmpl/src/ui/ftrdmptcnv.h delete mode 100644 print/XPSDrvSmpl/src/ui/ftrppg.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/ftrppg.h delete mode 100644 print/XPSDrvSmpl/src/ui/nupptcnv.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/nupptcnv.h delete mode 100644 print/XPSDrvSmpl/src/ui/pgscdmptcnv.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/pgscdmptcnv.h delete mode 100644 print/XPSDrvSmpl/src/ui/precomp.h delete mode 100644 print/XPSDrvSmpl/src/ui/precompsrc.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/resource.h delete mode 100644 print/XPSDrvSmpl/src/ui/uictrl.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/uictrl.h delete mode 100644 print/XPSDrvSmpl/src/ui/uiproperties.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/uiproperties.h delete mode 100644 print/XPSDrvSmpl/src/ui/wmctrls.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/wmctrls.h delete mode 100644 print/XPSDrvSmpl/src/ui/wmdmptcnv.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/wmdmptcnv.h delete mode 100644 print/XPSDrvSmpl/src/ui/wmppg.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/wmppg.h delete mode 100644 print/XPSDrvSmpl/src/ui/xdsmplcf.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/xdsmplcf.h delete mode 100644 print/XPSDrvSmpl/src/ui/xdsmpldlg.rc delete mode 100644 print/XPSDrvSmpl/src/ui/xdsmplptprov.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/xdsmplptprov.h delete mode 100644 print/XPSDrvSmpl/src/ui/xdsmplui.cpp delete mode 100644 print/XPSDrvSmpl/src/ui/xdsmplui.def delete mode 100644 print/XPSDrvSmpl/src/ui/xdsmplui.h delete mode 100644 print/XPSDrvSmpl/src/ui/xdsmplui.vcxproj delete mode 100644 print/XPSDrvSmpl/src/ui/xdsmplui.vcxproj.Filters delete mode 100644 print/XpsRasFilter/README.md delete mode 100644 print/XpsRasFilter/XpsRasFilter.sln delete mode 100644 print/XpsRasFilter/install/xpsrassmpl-PipelineConfig.xml delete mode 100644 print/XpsRasFilter/install/xpsrassmpl.gpd delete mode 100644 print/XpsRasFilter/install/xpsrassmpl.inf delete mode 100644 print/XpsRasFilter/src/BitmapHandler.cpp delete mode 100644 print/XpsRasFilter/src/BitmapHandler.h delete mode 100644 print/XpsRasFilter/src/Exception.cpp delete mode 100644 print/XpsRasFilter/src/Exception.h delete mode 100644 print/XpsRasFilter/src/OMConvertor.cpp delete mode 100644 print/XpsRasFilter/src/OMConvertor.h delete mode 100644 print/XpsRasFilter/src/PThandler.cpp delete mode 100644 print/XpsRasFilter/src/PThandler.h delete mode 100644 print/XpsRasFilter/src/UnknownBase.h delete mode 100644 print/XpsRasFilter/src/WppTrace.cpp delete mode 100644 print/XpsRasFilter/src/WppTrace.h delete mode 100644 print/XpsRasFilter/src/dllentry.cpp delete mode 100644 print/XpsRasFilter/src/filtertypes.h delete mode 100644 print/XpsRasFilter/src/precomp.h delete mode 100644 print/XpsRasFilter/src/precompsrc.cpp delete mode 100644 print/XpsRasFilter/src/rasinterface.cpp delete mode 100644 print/XpsRasFilter/src/rasinterface.h delete mode 100644 print/XpsRasFilter/src/xpsrasfilter.cpp delete mode 100644 print/XpsRasFilter/src/xpsrasfilter.def delete mode 100644 print/XpsRasFilter/src/xpsrasfilter.h delete mode 100644 print/XpsRasFilter/src/xpsrasfilter.rc delete mode 100644 print/XpsRasFilter/src/xpsrasfilter.vcxproj delete mode 100644 print/XpsRasFilter/src/xpsrasfilter.vcxproj.Filters delete mode 100644 print/autoconfig/ACnfgPS.gdl delete mode 100644 print/autoconfig/ACnfgUni.GDL delete mode 100644 print/autoconfig/AutoCnfg.GPD delete mode 100644 print/autoconfig/AutoCnfg.PPD delete mode 100644 print/autoconfig/AutoCnfg.inf delete mode 100644 print/autoconfig/AutoConfig.htm delete mode 100644 print/autoconfig/AutoConfig.sln delete mode 100644 print/autoconfig/AutoConfig.vcxproj delete mode 100644 print/autoconfig/AutoConfig.vcxproj.Filters delete mode 100644 print/autoconfig/Package/package.VcxProj delete mode 100644 print/autoconfig/Package/package.VcxProj.Filters delete mode 100644 print/autoconfig/README.md delete mode 100644 print/cpsuisam/CPSUIDAT.C delete mode 100644 print/cpsuisam/CPSUIDAT.H delete mode 100644 print/cpsuisam/CPSUISAM.DEF delete mode 100644 print/cpsuisam/CPSUISAM.DLG delete mode 100644 print/cpsuisam/CPSUISAM.H delete mode 100644 print/cpsuisam/DEBUG.C delete mode 100644 print/cpsuisam/DEBUG.H delete mode 100644 print/cpsuisam/PRECOMP.H delete mode 100644 print/cpsuisam/README.md delete mode 100644 print/cpsuisam/cpsuisam.c delete mode 100644 print/cpsuisam/cpsuisam.sln delete mode 100644 print/cpsuisam/cpsuisam.vcxproj delete mode 100644 print/cpsuisam/cpsuisam.vcxproj.Filters delete mode 100644 print/cpsuisam/icons/apple.ico delete mode 100644 print/cpsuisam/icons/cpsuisam.ico delete mode 100644 print/cpsuisam/precompsrc.c delete mode 100644 print/cpsuisam/res.rc delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml.cs delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/BidiHelper.cs delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Fabrikam_Logo.png delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml.cs delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintSchemaHelper.cs delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrinterExtensionSample.csproj delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/AssemblyInfo.cs delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Resources.Designer.cs delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Resources.resx delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Settings.Designer.cs delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Settings.settings delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Strings.Designer.cs delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Strings.resx delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/ValidationModalDialog.xaml delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/ValidationModalDialog.xaml.cs delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/WindowHelper.cs delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/app.config delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/bidi_Ink_mock.xml delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionAdapters.cs delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionLibrary.csproj delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionManager.cs delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionTypes.cs delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/Properties/AssemblyInfo.cs delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionSample.sln delete mode 100644 print/v4PrintDriverSamples/PrinterExtensionSample/README.md delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.js delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.sln delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj.Filters delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/README.md delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense-Windows8.1.js delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense.js delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/HostBasedSampleDriver.sln delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/HostBasedSampleDriver.vcxproj delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/HostBasedSampleDriver.vcxproj.Filters delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/Package/package.VcxProj delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/Package/package.VcxProj.Filters delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/README.md delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample-manifest.ini delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample-pipelineconfig.xml delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.gpd delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.inf delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.js delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample_events.xml delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample_extension.xml delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/v4PrintDriver-Intellisense-Windows8.1.js delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/v4PrintDriver-Intellisense.js delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/README.md delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.js delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.sln delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.vcxproj delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.vcxproj.Filters delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.xml delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/v4PrintDriver-Intellisense-Windows8.1.js delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/v4PrintDriver-Intellisense.js delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/README.md delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.sln delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.vcxproj delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.vcxproj.Filters delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.xml diff --git a/print/OEM Printer Customization Plug-in Samples/C++/CUSTOMDRV.HLP b/print/OEM Printer Customization Plug-in Samples/C++/CUSTOMDRV.HLP deleted file mode 100644 index 8ba599b2..00000000 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/CUSTOMDRV.HLP and /dev/null differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Features.cpp b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Features.cpp deleted file mode 100644 index acee806b..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Features.cpp +++ /dev/null @@ -1,2858 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 2001 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Features.cpp -// -// PURPOSE: Implementation wrapper class for PScript Driver Features and Options. -// - -#include "precomp.h" -#include "resource.h" -#include "debug.h" -#include "globals.h" -#include "devmode.h" -#include "stringutils.h" -#include "helper.h" -#include "features.h" -#include "oemui.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -//////////////////////////////////////////////////////// -// Internal Defines and Macros -//////////////////////////////////////////////////////// - -#define INITIAL_ENUM_FEATURES_SIZE 1024 -#define INITIAL_ENUM_OPTIONS_SIZE 64 -#define INITIAL_FEATURE_DISPLAY_NAME_SIZE 64 -#define INITIAL_OPTION_DISPLAY_NAME_SIZE 32 -#define INITIAL_GET_OPTION_SIZE 64 -#define INITIAL_GET_REASON_SIZE 1024 - -#define DRIVER_FEATURE_PREFIX '%' -#define IS_DRIVER_FEATURE(f) (DRIVER_FEATURE_PREFIX == (f)[0]) - -// Flags that the uDisplayNameID should be returned as -// MAKEINTRESOURCE() instead of loading the string resource. -#define RETURN_INT_RESOURCE 1 - -// Macros to test for conditions of KEYWORDMAP entry. -#define IS_MAPPING_INT_RESOURCE(p) ((p)->dwFlags & RETURN_INT_RESOURCE) - -// TAG the identifies feature OPTITEM data stuct. -#define FEATURE_OPTITEM_TAG 'FETR' - - -//////////////////////////////////////////////////////// -// Type Definitions -//////////////////////////////////////////////////////// - -// Struct used to identify OPTITEM as -// feature OPTITEM and to map back from -// an OPTITEM to the feature. -typedef struct _tagFeatureOptitemData -{ - DWORD dwSize; - DWORD dwTag; - PCSTR pszFeatureKeyword; - COptions *pOptions; - -} FEATUREOPTITEMDATA, *PFEATUREOPTITEMDATA; - - - -//////////////////////////////////////////////////////// -// Internal Constants -//////////////////////////////////////////////////////// - -static KEYWORDMAP gkmFeatureMap[] = -{ - "%AddEuro", NULL, IDS_ADD_EURO, OEMCUIP_PRNPROP, 0, - "%CtrlDAfter", NULL, IDS_CTRLD_AFTER, OEMCUIP_PRNPROP, 0, - "%CtrlDBefore", NULL, IDS_CTRLD_BEFORE, OEMCUIP_PRNPROP, 0, - //"%CustomPageSize", NULL, IDS_PSCRIPT_CUSTOMSIZE, OEMCUIP_DOCPROP, 0, - "%GraphicsTrueGray", NULL, IDS_TRUE_GRAY_GRAPH, OEMCUIP_PRNPROP, 0, - "%JobTimeout", NULL, IDS_JOBTIMEOUT, OEMCUIP_PRNPROP, 0, - "%MaxFontSizeAsBitmap", NULL, IDS_PSMAXBITMAP, OEMCUIP_PRNPROP, 0, - "%MetafileSpooling", NULL, IDS_METAFILE_SPOOLING, OEMCUIP_DOCPROP, 0, - "%MinFontSizeAsOutline", NULL, IDS_PSMINOUTLINE, OEMCUIP_PRNPROP, 0, - "%Mirroring", NULL, IDS_MIRROR, OEMCUIP_DOCPROP, 0, - "%Negative", NULL, IDS_NEGATIVE_PRINT, OEMCUIP_DOCPROP, 0, - "%Orientation", TEXT("COMPSTUI.DLL"), IDS_CPSUI_ORIENTATION, OEMCUIP_DOCPROP, RETURN_INT_RESOURCE, - "%OutputFormat", NULL, IDS_PSOUTPUT_OPTION, OEMCUIP_DOCPROP, 0, - "%OutputProtocol", NULL, IDS_PSPROTOCOL, OEMCUIP_PRNPROP, 0, - "%OutputPSLevel", NULL, IDS_PSLEVEL, OEMCUIP_DOCPROP, 0, - "%PageOrder", TEXT("COMPSTUI.DLL"), IDS_CPSUI_PAGEORDER, OEMCUIP_DOCPROP, RETURN_INT_RESOURCE, - "%PagePerSheet", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP, OEMCUIP_DOCPROP, RETURN_INT_RESOURCE, - "%PSErrorHandler", NULL, IDS_PSERROR_HANDLER, OEMCUIP_DOCPROP, 0, - "%PSMemory", NULL, IDS_POSTSCRIPT_VM, OEMCUIP_PRNPROP, 0, - "%TextTrueGray", NULL, IDS_TRUE_GRAY_TEXT, OEMCUIP_PRNPROP, 0, - "%TTDownloadFormat", NULL, IDS_PSTT_DLFORMAT, OEMCUIP_DOCPROP, 0, - "%WaitTimeout", NULL, IDS_WAITTIMEOUT, OEMCUIP_PRNPROP, 0, -}; -static const NUM_FEATURE_MAP = (sizeof(gkmFeatureMap)/sizeof(gkmFeatureMap[0])); - - -static KEYWORDMAP gkmOptionMap[] = -{ - "True", TEXT("COMPSTUI.DLL"), IDS_CPSUI_TRUE, 0, RETURN_INT_RESOURCE, - "False", TEXT("COMPSTUI.DLL"), IDS_CPSUI_FALSE, 0, RETURN_INT_RESOURCE, - "Portrait", TEXT("COMPSTUI.DLL"), IDS_CPSUI_PORTRAIT, 0, RETURN_INT_RESOURCE, - "Landscape", TEXT("COMPSTUI.DLL"), IDS_CPSUI_LANDSCAPE, 0, RETURN_INT_RESOURCE, - "RotatedLandscape", TEXT("COMPSTUI.DLL"), IDS_CPSUI_ROT_LAND, 0, RETURN_INT_RESOURCE, - "Speed", NULL, IDS_PSOPT_SPEED, 0, RETURN_INT_RESOURCE, - "Portability", NULL, IDS_PSOPT_PORTABILITY, 0, 0, - "EPS", NULL, IDS_PSOPT_EPS, 0, 0, - "Archive", NULL, IDS_PSOPT_ARCHIVE, 0, 0, - "ASCII", NULL, IDS_PSPROTOCOL_ASCII, 0, 0, - "BCP", NULL, IDS_PSPROTOCOL_BCP, 0, 0, - "TBCP", NULL, IDS_PSPROTOCOL_TBCP, 0, 0, - "Binary", NULL, IDS_PSPROTOCOL_BINARY, 0, 0, - "FrontToBack", TEXT("COMPSTUI.DLL"), IDS_CPSUI_FRONTTOBACK, 0, RETURN_INT_RESOURCE, - "BackToFront", TEXT("COMPSTUI.DLL"), IDS_CPSUI_BACKTOFRONT, 0, RETURN_INT_RESOURCE, - "1", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP_NORMAL, 0, RETURN_INT_RESOURCE, - "2", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP_TWOUP, 0, RETURN_INT_RESOURCE, - "4", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP_FOURUP, 0, RETURN_INT_RESOURCE, - "6", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP_SIXUP, 0, RETURN_INT_RESOURCE, - "9", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP_NINEUP, 0, RETURN_INT_RESOURCE, - "16", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP_SIXTEENUP, 0, RETURN_INT_RESOURCE, - "Booklet", TEXT("COMPSTUI.DLL"), IDS_CPSUI_BOOKLET, 0, RETURN_INT_RESOURCE, - "Automatic", NULL, IDS_TTDL_DEFAULT, 0, 0, - "Outline", NULL, IDS_TTDL_TYPE1, 0, 0, - "Bitmap", NULL, IDS_TTDL_TYPE3, 0, 0, - "NativeTrueType", NULL, IDS_TTDL_TYPE42, 0, 0, -}; -static const NUM_OPTION_MAP = (sizeof(gkmOptionMap)/sizeof(gkmOptionMap[0])); - - - - -//////////////////////////////////////////// -// -// COptions Methods -// - -// -// Private Methods -// - -// Initializes class data members. -void COptions::Init() -{ - m_wOptions = 0; - m_cType = TVOT_COMBOBOX; - m_pmszRaw = NULL; - m_pszFeature = NULL; - m_ppszOptions = NULL; - m_ptRange.x = 0; - m_ptRange.y = 0; - m_dwSize = 0; - m_pszUnits = NULL; - m_hHeap = NULL; - m_pInfo = NULL; -} - -void COptions::Clear() -{ - // Free memory associated with data members. - if(NULL != m_pmszRaw) HeapFree(m_hHeap, 0, m_pmszRaw); - if(NULL != m_ppszOptions) HeapFree(m_hHeap, 0, m_ppszOptions); - if( (NULL != m_pszUnits) && !IS_INTRESOURCE(m_pszUnits)) HeapFree(m_hHeap, 0, m_pszUnits); - - // Free option info. - FreeOptionInfo(); - - // Initialize data members. - Init(); -} - -// Frees memory associated with Option Info array. -void COptions::FreeOptionInfo() -{ - // Validate parameters. - if( (NULL == m_hHeap) - || - (NULL == m_pInfo) - ) - { - return; - } - - // Free strings in the array. - for(WORD wIndex = 0; wIndex < m_wOptions; ++wIndex) - { - PWSTR pszDisplay = m_pInfo[wIndex].pszDisplayName; - - if( (NULL != pszDisplay) - && - !(IS_INTRESOURCE(pszDisplay)) - ) - { - HeapFree(m_hHeap, 0, pszDisplay); - } - } - - // Free the array. - HeapFree(m_hHeap, 0, m_pInfo); - m_pInfo = NULL; -} - -// Will do init for features that need special handling. -HRESULT COptions::GetOptionsForSpecialFeatures(CUIHelper &Helper, POEMUIOBJ poemuiobj) -{ - HRESULT hrResult = E_NOTIMPL; - - - // See if this is a special feature. - // If it is, then call the special option init for the - // feature. - if(!lstrcmpA(m_pszFeature, "%CustomPageSize")) - { - // There is no option init for CustomPageSize. - // The item itself must be handled specially. - hrResult = S_OK; - } - else if( !lstrcmpA(m_pszFeature, "%JobTimeout") - || - !lstrcmpA(m_pszFeature, "%WaitTimeout") - ) - { - // JobTimeout and WaitTimeout feature options are string representations - // of an integer that represents number of seconds in the range 0 through - // 2,147,483,647 (i.e. LONG_MAX). However, COMPSTUI limits us to - // WORD size, which has range of 0 to 32,767 (i.e. SHRT_MAX). - m_cType = TVOT_UDARROW; - m_ptRange.x = 0; - m_ptRange.y = SHRT_MAX; - hrResult = GetOptionSelectionShort(Helper, poemuiobj); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("COptions::GetOptionsForSpecialFeatures() failed to get current selection for feature %hs. (hrResult = 0x%x)\r\n"), - m_pszFeature, - hrResult); - - goto Exit; - } - } - else if( !lstrcmpA(m_pszFeature, "%MaxFontSizeAsBitmap") - || - !lstrcmpA(m_pszFeature, "%MinFontSizeAsOutline") - ) - { - // MaxFontSizeAsBitmap, and MinFontSizeAsOutline feature options - // are string representations of an integer that represents number - // of pixels in the range 0 through 32,767 (i.e. SHRT_MAX). - m_cType = TVOT_UDARROW; - m_ptRange.x = 0; - m_ptRange.y = SHRT_MAX; - hrResult = GetOptionSelectionShort(Helper, poemuiobj); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("COptions::GetOptionsForSpecialFeatures() failed to get current selection for feature %hs. (hrResult = 0x%x)\r\n"), - m_pszFeature, - hrResult); - - goto Exit; - } - } - else if( !lstrcmpA(m_pszFeature, "%PSMemory") ) - { - DWORD dwType; - DWORD dwLevel; - DWORD dwNeeded; - - - // PSMemory option is string representation of an integer - // that represents number of seconds in the range 0 - // through 32,767 (i.e. SHRT_MAX). - // However, the minimum is 172 KB for Level 1 and 249 KB for level 2 - m_cType = TVOT_UDARROW; - m_ptRange.y = SHRT_MAX; - hrResult = GetOptionSelectionShort(Helper, poemuiobj); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("COptions::GetOptionsForSpecialFeatures() failed to get current selection for feature %hs. (hrResult = 0x%x)\r\n"), - m_pszFeature, - hrResult); - - goto Exit; - } - - // Get the global attribute for max language level. - hrResult = Helper.GetGlobalAttribute(poemuiobj, - 0, - "LanguageLevel", - &dwType, - (PBYTE) &dwLevel, - sizeof(dwLevel), - &dwNeeded); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("COptions::GetOptionsForSpecialFeatures() failed to get global attribute \"LanguageLevel\". (hrResult = 0x%x)\r\n"), - hrResult); - - goto Exit; - } - - // Set minimum range based on PS Max Language level. - switch(dwLevel) - { - case 1: - m_ptRange.x = 172; - break; - - default: - case 2: - case 3: - m_ptRange.x = 249; - break; - } - - // Get Units string. - //GetStringResource(m_pszUnits - } - else if(!lstrcmpA(m_pszFeature, "%OutputPSLevel")) - { - hrResult = GetOptionsForOutputPSLevel(Helper, poemuiobj); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("COptions::GetOptionsForSpecialFeatures() failed to get current selection for feature %hs. (hrResult = 0x%x)\r\n"), - m_pszFeature, - hrResult); - - goto Exit; - } - } - - -Exit: - - return hrResult; -} - -// Do init for PS Level options. -HRESULT COptions::GetOptionsForOutputPSLevel(CUIHelper &Helper, POEMUIOBJ poemuiobj) -{ - WORD wCount = 0; - DWORD dwLevel = 0; - DWORD dwType = 0; - DWORD dwNeeded = 0; - HRESULT hrResult = E_NOTIMPL; - - - // PS Level is integers from 1 to "LanguageLevel" - // global atribute. - m_cType = TVOT_COMBOBOX; - - // Get the global attribute for max language level. - hrResult = Helper.GetGlobalAttribute(poemuiobj, - 0, - "LanguageLevel", - &dwType, - (PBYTE) &dwLevel, - sizeof(dwLevel), - &dwNeeded); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("COptions::GetOptionsForOutputPSLevel() failed to get global attribute \"LanguageLevel\". (hrResult = 0x%x)\r\n"), - hrResult); - - goto Exit; - } - - // - // Create Options for PS Level - // - - // Set the number of options to the PS Level supported. - m_wOptions = (WORD) dwLevel; - - // Allocate keyword list. - // Allocate memory for pointer to keyword and the keyword itself, so that - // the memory for the keyword strings will get de-allocated with the keyword list - // on object destruction, just like regular features for which EnumOptions works. - // User the size of a pointer (4 bytes on x86, and 8 on IA64) so that - // it begining of the keyword strings will be DWORD or QUADWORD aligned - // for x86 and IA64 respectively. Keyword strings aren't required to - // be DWORD or QUADWORD aligned, but it is more optimal. Also, this gives - // some additional space for the case of %OutputPSLevel keywords, which are - // in the range of 1 through the max PostScript level supported, and only - // require 2 CHARs (1 for the digit and one for the NULL terminator). - m_ppszOptions = (PCSTR *) HeapAlloc(m_hHeap, HEAP_ZERO_MEMORY, m_wOptions * ( sizeof(PSTR) + sizeof(PCSTR *) ) ); - if(NULL == m_ppszOptions) - { - ERR(ERRORTEXT("COptions::GetOptionsForOutputPSLevel() failed to allocate option keyword array for PS Level.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - - // Allocate option info array. - m_pInfo = (POPTION_INFO) HeapAlloc(m_hHeap, HEAP_ZERO_MEMORY, m_wOptions * sizeof(OPTION_INFO)); - if(NULL == m_pInfo) - { - ERR(ERRORTEXT("COptions::GetOptionsForOutputPSLevel() failed to allocate info array for PS Level.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Init the option info. - for(wCount = 0; wCount < m_wOptions; ++wCount) - { - // Init keyword. - // The memory for both the keyword list and the keyword strings was allocated above. - m_ppszOptions[wCount] = (PSTR)(m_ppszOptions + m_wOptions) + (sizeof(PSTR) * wCount); - hrResult = StringCbPrintfA(const_cast(m_ppszOptions[wCount]), sizeof(PSTR), "%d", wCount + 1); - if(FAILED(hrResult)) - { - ERR(ERRORTEXT("COptions::GetOptionsForOutputPSLevel() failed to string representation of item %d.\r\n"), - wCount + 1); - - goto Exit; - } - - // Init option display name. - m_pInfo[wCount].pszDisplayName = (PWSTR) HeapAlloc(m_hHeap, HEAP_ZERO_MEMORY, 2 * sizeof(WCHAR)); - if(NULL == m_pInfo[wCount].pszDisplayName) - { - ERR(ERRORTEXT("COptions::GetOptionsForOutputPSLevel() failed to allocate display string for Level %d.\r\n"), - wCount); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Init option display name. - hrResult = StringCchPrintfW(m_pInfo[wCount].pszDisplayName, 2, TEXT("%d"), wCount + 1); - if(FAILED(hrResult)) - { - ERR(ERRORTEXT("COptions::GetOptionsForOutputPSLevel() failed to create display name for item %d.\r\n"), - wCount + 1); - - goto Exit; - } - } - - // - // Get Current Selection - // - - hrResult = GetOptionSelectionIndex(Helper, poemuiobj); - - -Exit: - - // Don't need to clean up memory allocation on error, since - // all memory allocated are assigned to data members, which - // will be cleaned up in the object destructor. - - return hrResult; -} - -HRESULT COptions::GetOptionSelectionString(CUIHelper &Helper, POEMUIOBJ poemuiobj, _Outptr_result_maybenull_ PSTR *ppszSel) -{ - PSTR pmszFeature = NULL; - PSTR pmszBuf = NULL; - WORD wCount = 0; - PCSTR *ppszList = NULL; - DWORD dwFeatureSize = 0; - DWORD dwNeeded = 0; - DWORD dwSize = INITIAL_GET_OPTION_SIZE; - HRESULT hrResult = S_OK; - - *ppszSel = NULL; - - - // - // Make single feature multi-sz. - // - - // Allocate single feature multi-sz buffer that's the size of the Feature name, plus two bytes for multi-sz termination - if (FAILED(hrResult = SizeTToDWord(strlen(m_pszFeature) + 2, &dwFeatureSize))) - { - goto Exit; - } - - pmszFeature = (PSTR) HeapAlloc(m_hHeap, HEAP_ZERO_MEMORY, dwFeatureSize); - if(NULL == pmszFeature) - { - ERR(ERRORTEXT("COptions::GetOptionSelectionString() failed to allocate buffer for single feature multi-sz for feature %hs.\r\n"), - m_pszFeature); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Just need to do a regular string copy, since the buffer is already zero filled. - hrResult = StringCbCopyA(pmszFeature, dwFeatureSize, m_pszFeature); - if(FAILED(hrResult)) - { - ERR(ERRORTEXT("COptions::GetOptionSelectionString() failed to copy feature string %hs.\r\n"), m_pszFeature); - } - - // Allocated initial buffer of reasonible size. - pmszBuf = (PSTR) HeapAlloc(m_hHeap, HEAP_ZERO_MEMORY, dwSize); - if(NULL == pmszBuf) - { - ERR(ERRORTEXT("COptions::GetOptionSelectionString() failed to allocate buffer to get current setting for feature %hs.\r\n"), - m_pszFeature); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Get current option selection. - hrResult = Helper.GetOptions(poemuiobj, - 0, - pmszFeature, - dwFeatureSize, - pmszBuf, - dwSize, - &dwNeeded); - if( (E_OUTOFMEMORY == hrResult) && (dwSize < dwNeeded) ) - { - PSTR pTemp = NULL; - - - // INVARIANT: initial buffer not large enough. - - // Re-alloc buffer and try again. - pTemp = (PSTR) HeapReAlloc(m_hHeap, HEAP_ZERO_MEMORY, pmszBuf, dwNeeded); - if(NULL == pTemp) - { - ERR(ERRORTEXT("COptions::GetOptionSelectionString() failed to re-allocate buffer to get current setting for feature %hs.\r\n"), - m_pszFeature); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - pmszBuf = pTemp; - - - // Try to get current option selection again. - hrResult = Helper.GetOptions(poemuiobj, - 0, - pmszFeature, - dwFeatureSize, - pmszBuf, - dwNeeded, - &dwNeeded); - } - - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("COptions::GetOptionSelectionString() failed to get current setting for feature %hs. (hrResult = 0x%x)\r\n"), - m_pszFeature, - hrResult); - - goto Exit; - } - - // NOTE: The return string from GetOptions() may return - // contain no strings and not return a HRESULT error - // when the feature isn't supported in the current document or - // printer sticky mode. - if('\0' == pmszBuf[0]) - { - // Feature not supported for this sticky mode. - goto Exit; - } - - // Parse the results buffer to see what the current setting is. - hrResult = MakeStrPtrList(m_hHeap, pmszBuf, &ppszList, &wCount); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("COptions::GetOptionSelectionString() failed to make string list for GetOptions() return for feature %hs. (hrResult = 0x%x)\r\n"), - m_pszFeature, - hrResult); - - goto Exit; - } - - // Check that we got 2 strings back. - if(2 != wCount) - { - WARNING(DLLTEXT("COptions::GetOptionSelectionString() the GetOption() return string list for \r\n\tfeature %hs is not of size 2.\r\n\tNumber of string is %d\r\n"), - m_pszFeature, - wCount); - - // Bail if we don't have at least 2 strings. - if(2 > wCount) - { - goto Exit; - } - } - - // Return copy of just the GetOption() result. - *ppszSel = MakeStringCopy(m_hHeap, ppszList[1]); - if(NULL == *ppszSel) - { - ERR(ERRORTEXT("COptions::GetOptionSelectionString() failed to duplicate string GetOptions() return for feature %hs. (hrResult = 0x%x)\r\n"), - m_pszFeature, - hrResult); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - -Exit: - - // Free local buffers. - if(NULL != pmszFeature) HeapFree(m_hHeap, 0, pmszFeature); - if(NULL != pmszBuf) HeapFree(m_hHeap, 0, pmszBuf); - if(NULL != ppszList) HeapFree(m_hHeap, 0, ppszList); - - return hrResult; -} - -// Gets current Options selection for LONG value. -HRESULT COptions::GetOptionSelectionLong(CUIHelper &Helper, POEMUIOBJ poemuiobj) -{ - PSTR pszSel = NULL; - HRESULT hrResult = S_OK; - - - // Get option selection string. - hrResult = GetOptionSelectionString(Helper, poemuiobj, &pszSel); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("COptions::GetOptionSelectionLong() failed to get string for GetOptions() return for feature %hs. (hrResult = 0x%x)\r\n"), - m_pszFeature, - hrResult); - - goto Exit; - } - - // Convert string option to LONG and uses that as the selection. - if(NULL != pszSel) m_Sel = atol(pszSel); - - -Exit: - - // Free local buffers. - if(NULL != pszSel) HeapFree(m_hHeap, 0, pszSel); - - return hrResult; -} - -// Gets current Options selection for SHORT value. -HRESULT COptions::GetOptionSelectionShort(CUIHelper &Helper, POEMUIOBJ poemuiobj) -{ - PSTR pszSel = NULL; - HRESULT hrResult = S_OK; - - - // Get option selection string. - hrResult = GetOptionSelectionString(Helper, poemuiobj, &pszSel); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("COptions::GetOptionSelectionLong() failed to get string for GetOptions() return for feature %hs. (hrResult = 0x%x)\r\n"), - m_pszFeature, - hrResult); - - goto Exit; - } - - // Convert string option to LONG and uses that as the selection. - if(NULL != pszSel) m_Sel = atoi(pszSel) & 0x00ffff; - - -Exit: - - // Free local buffers. - if(NULL != pszSel) HeapFree(m_hHeap, 0, pszSel); - - return hrResult; -} - -// Gets current option selection for feature. -HRESULT COptions::GetOptionSelectionIndex(CUIHelper &Helper, POEMUIOBJ poemuiobj) -{ - PSTR pszSel = NULL; - HRESULT hrResult = S_OK; - - - // Get option selection string. - hrResult = GetOptionSelectionString(Helper, poemuiobj, &pszSel); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("COptions::GetOptionSelectionIndex() failed to get string for GetOptions() return for feature %hs. (hrResult = 0x%x)\r\n"), - m_pszFeature, - hrResult); - - goto Exit; - } - - // Find the matching option for the string returned from GetOption. - m_Sel = FindOption(pszSel, m_wOptions - 1); - - -Exit: - - // Free local buffers. - if(NULL != pszSel) HeapFree(m_hHeap, 0, pszSel); - - return hrResult; -} - - - -// -// Public Methods -// - -// Default constructor -COptions::COptions() -{ - Init(); -} - -// Destructor -COptions::~COptions() -{ - Clear(); -} - -// Get the option list for a feature -HRESULT COptions::Acquire(_In_ HANDLE hHeap, - CUIHelper &Helper, - _In_ POEMUIOBJ poemuiobj, - _In_ PCSTR pszFeature) -{ - DWORD dwNeeded = 0; - HRESULT hrResult = S_OK; - - - VERBOSE(DLLTEXT("COptions::Acquire(0x%p, Helper, 0x%p, %hs) entered.\r\n"), - hHeap, - poemuiobj, - pszFeature ? pszFeature : "NULL"); - - // Don't retreive the Options again if we already got them. - if( (0 < m_wOptions) - && - (NULL != m_pszFeature) - && - !lstrcmpA(m_pszFeature, pszFeature) - ) - { - VERBOSE(DLLTEXT("COptions::Acquire() already have options for feature %hs.\r\n"), m_pszFeature); - VERBOSE(DLLTEXT("COptions::Acquire() returning with HRESULT of S_OK\r\n")); - - return S_OK; - } - - // Save the heap handle for use later, such as freeing memory at destruction. - m_hHeap = hHeap; - - // Store Keyword string. - m_pszFeature = pszFeature; - - - // - // Enumerate Options. - // - - - // Some features require special handling for initializing their options. - // EnumOpionts isn't implemented for these features. - // Return of E_NOTIMPL indicates it isn't the feature doesn't - // need special handling. - hrResult = GetOptionsForSpecialFeatures(Helper, poemuiobj); - if( SUCCEEDED(hrResult) - || - (!SUCCEEDED(hrResult) && (E_NOTIMPL != hrResult) ) - ) - { - // We either dealt with the special feature or incounter an error - // trying to deal with the special feature. - - goto Exit; - } - - // To try to cut down on having to call EnumOptions more than once, - // pre-allocate a buffer of reasonable size. - m_dwSize = INITIAL_ENUM_OPTIONS_SIZE; - m_pmszRaw = (PSTR) HeapAlloc(m_hHeap, HEAP_ZERO_MEMORY, m_dwSize); - if(NULL == m_pmszRaw) - { - ERR(ERRORTEXT("COptions::Acquire() alloc for options for feature %hs failed.\r\n"), m_pszFeature); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - - // Try to get options list with initial buffer. - hrResult = Helper.EnumOptions(poemuiobj, 0, m_pszFeature, m_pmszRaw, m_dwSize, &dwNeeded); - if( (E_OUTOFMEMORY == hrResult) && (m_dwSize < dwNeeded)) - { - PSTR pTemp; - - - // INVARIANT: options list multi-sz wasn't large enough. - - // Re-allocate the buffer and try again. - pTemp = (PSTR) HeapReAlloc(m_hHeap, HEAP_ZERO_MEMORY, m_pmszRaw, dwNeeded); - if(NULL == pTemp) - { - ERR(ERRORTEXT("COptions::Acquire() re-alloc for options list for feature %hs failed.\r\n"), m_pszFeature); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - m_pmszRaw = pTemp; - m_dwSize = dwNeeded; - - // Try again to get the options list. - hrResult = Helper.EnumOptions(poemuiobj, 0, m_pszFeature, m_pmszRaw, m_dwSize, &dwNeeded); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("COptions::Acquire() failed to EnumOptions() for feature %hs after re-allocating buffer.\r\n"), m_pszFeature); - - goto Exit; - } - } - - // Make sure we got the option list. - // Can't do anything more with out it. - if(!SUCCEEDED(hrResult)) - { - if(E_NOTIMPL != hrResult) ERR(ERRORTEXT("COptions::Acquire() failed to enumerate options for feature %hs. (hrResult = 0x%x)\r\n"), m_pszFeature, hrResult); - - goto Exit; - } - - // INVARIANT: successfully got option keyword list. - - // Create array of string pointers to the Option names - // in the multi-sz we got from EnumOptions(). - hrResult = MakeStrPtrList(m_hHeap, m_pmszRaw, &m_ppszOptions, &m_wOptions); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("COptions::Acquire() failed to create pointer list to options. (hrResult = 0x%x)\r\n"), hrResult); - - goto Exit; - } - - // - // Build Option Information - // - - // Allocate array to hold feature info - m_pInfo = (POPTION_INFO) HeapAlloc(m_hHeap, HEAP_ZERO_MEMORY, m_wOptions * sizeof(OPTION_INFO)); - if(NULL == m_pInfo) - { - ERR(ERRORTEXT("COptions::Acquire() failed to alloc feature info array.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // For each option, build or get useful information, such as display name. - for(WORD wIndex = 0; wIndex < m_wOptions; ++wIndex) - { - POPTION_INFO pCurrent = m_pInfo + wIndex; - - - // Get or build a keyword mapping entry - // that maps from keyword to usefully where to get info, such as - // display name, icon, option type, for keywords that may not be - // able to get info for from Helper. - pCurrent->pMapping = FindKeywordMapping(gkmOptionMap, NUM_OPTION_MAP, m_ppszOptions[wIndex]); - - // Get display names for each of the Options. - // The function implements a heuristic for detemining the display name, - // since can't get the display name from the UI Helper for all Options. - hrResult = DetermineOptionDisplayName(m_hHeap, - Helper, - poemuiobj, - m_pszFeature, - m_ppszOptions[wIndex], - pCurrent->pMapping, - &pCurrent->pszDisplayName); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("COptions::Acquire() failed to get display name for %hs of feature %hs. (hrResult = 0x%x)\r\n"), - m_ppszOptions[wIndex], - m_pszFeature, - hrResult); - - goto Exit; - } - } - - // - // Get current option selection. - // - - hrResult = GetOptionSelectionIndex(Helper, poemuiobj); - - -Exit: - - // Clean up if weren't successful. - if(!SUCCEEDED(hrResult)) - { - Clear(); - } - - VERBOSE(DLLTEXT("COptions::Acquire() returning with HRESULT of 0x%x\r\n"), hrResult); - - return hrResult; -} - -// Return nth options keyword. -PCSTR COptions::GetKeyword(WORD wIndex) const -{ - // Validate parameters. - if( (wIndex >= m_wOptions) - || - (NULL == m_ppszOptions) - ) - { - return NULL; - } - - return m_ppszOptions[wIndex]; -} - -// Return nth options display name. -PCWSTR COptions::GetName(WORD wIndex) const -{ - // Validate parameters. - if( (wIndex >= m_wOptions) - || - (NULL == m_pInfo) - ) - { - ERR(ERRORTEXT("COptions::GetName() invalid parameters.\r\n")); - - return NULL; - } - - if(NULL == m_pInfo[wIndex].pszDisplayName) ERR(ERRORTEXT("COptions::GetName() returning NULL option display name.\r\n")); - - return m_pInfo[wIndex].pszDisplayName; -} - -// Find option with matching keyword string. -WORD COptions::FindOption(_In_opt_ PCSTR pszOption, WORD wDefault) const -{ - BOOL bFound = FALSE; - WORD wMatch = wDefault; - - - // Validate parameters. - if( (NULL == pszOption) - || - (NULL == m_ppszOptions) - ) - { - return wDefault; - } - - // Walk the option keyword looking for a match. - for(WORD wIndex = 0; !bFound && (wIndex < m_wOptions); ++wIndex) - { - bFound = !lstrcmpA(pszOption, m_ppszOptions[wIndex]); - if(bFound) - { - wMatch = wIndex; - } - } - - return wMatch; -} - -// Initializes OptItem with options for a feature. -HRESULT COptions::InitOptItem(_In_ HANDLE hHeap, POPTITEM pOptItem) -{ - WORD wParams = 0; - WORD wOptions = 0; - HRESULT hrResult = S_OK; - - - // Set option selection. - pOptItem->pSel = m_pSel; - - // Get count of number of options. - // NOTE: Some feature options have no counts. - wOptions = GetCount(); - - // Different OPTTYPE types require different number of OPTPARAMs. - switch(m_cType) - { - // For up down arrow control, the OPTPARAMs need is 2. - case TVOT_UDARROW: - wParams = 2; - break; - - // For combobox, the OPTPARAMs needed is on per options. - case TVOT_COMBOBOX: - wParams = wOptions; - break; - - // The default is the option count. - default: - WARNING(DLLTEXT("COptions::InitOptItem() OPTTYPE type %d num of OPTPARAMs not handled. Default to option count of %d.\r\n"), - m_cType, - wOptions); - wParams = wOptions; - break; - } - - // Only do OPTTYPEs if we have non-Zero number of OPTPARAMs. - // Every OPTTYPE has at leas one OPTPARAM. - if(0 < wParams) - { - // Allocate memory for feature options. - pOptItem->pOptType = CreateOptType(hHeap, wParams); - if(NULL == pOptItem->pOptType) - { - ERR(ERRORTEXT("COptions::InitOptItem() failed to allocate OPTTYPEs for OPTITEM %hs.\r\n"), - m_pszFeature); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Set OPTTYPE. - pOptItem->pOptType->Type = m_cType; - - // Different OPTTYPE types require different initialization. - switch(m_cType) - { - // For up down arrow control, OPTPARAM[0] is used by the contrl. - // pOptParam[0]->pData is the Units description string. - // pOptParam[1].IconID is the min limit. - // pOptParam[1].lParam is the max limit. - case TVOT_UDARROW: - assert(2 == wParams); - pOptItem->pOptType->pOptParam[0].pData = m_pszUnits; - pOptItem->pOptType->pOptParam[1].IconID = m_ptRange.x; - pOptItem->pOptType->pOptParam[1].lParam = m_ptRange.y; - break; - - // For combobox, the pOptParam[n].pData is the display name of the option. - case TVOT_COMBOBOX: - for(WORD wIndex = 0; wIndex < wParams; ++wIndex) - { - pOptItem->pOptType->pOptParam[wIndex].pData = const_cast(GetName(wIndex)); - } - break; - - default: - ERR(ERRORTEXT("COptions::InitOptItem() OPTTYPE type %d OPTTYPE init not handled.\r\n"), - m_cType); - break; - } - } - - -Exit: - - return hrResult; -} - -// Refresh option selection. -HRESULT COptions::RefreshSelection(CUIHelper &Helper, POEMUIOBJ poemuiobj) -{ - HRESULT hrResult = S_OK; - - - // Method for getting option selection is based - // on OPTTYPE type. - switch(m_cType) - { - - case TVOT_UDARROW: - hrResult = GetOptionSelectionShort(Helper, poemuiobj); - break; - - case TVOT_COMBOBOX: - hrResult = GetOptionSelectionIndex(Helper, poemuiobj); - break; - - default: - ERR(ERRORTEXT("COptions::RefreshSelection() not handled for type %d OPTTYPE.\r\n"), - m_cType); - break; - } - - return hrResult; -} - - - -//////////////////////////////////////////// -// -// CFeatures Methods -// - -// -// Private Methods -// - -// Initializes class -void CFeatures::Init() -{ - // Initialize data members. - m_wFeatures = 0; - m_wDocFeatures = 0; - m_wPrintFeatures = 0; - m_pmszRaw = NULL; - m_ppszKeywords = NULL; - m_dwSize = 0; - m_hHeap = NULL; - m_pInfo = NULL; -} - -// Cleans up class and re-initialize it. -void CFeatures::Clear() -{ - // Free memory associated with data members. - if(NULL != m_pmszRaw) HeapFree(m_hHeap, 0, m_pmszRaw); - if(NULL != m_ppszKeywords) HeapFree(m_hHeap, 0, m_ppszKeywords); - - // Free feature info - FreeFeatureInfo(); - - // Re-initialize - Init(); -} - -// Free feature info -void CFeatures::FreeFeatureInfo() -{ - // Validate parameters. - if( (NULL == m_hHeap) - || - (NULL == m_pInfo) - ) - { - return; - } - - // Free memory associated with feature info. - for(WORD wIndex = 0; wIndex < m_wFeatures; ++wIndex) - { - PWSTR pszDisplay = m_pInfo[wIndex].pszDisplayName; - - - // Free display name. - if( (NULL != pszDisplay) - && - !IS_INTRESOURCE(pszDisplay) - ) - { - HeapFree(m_hHeap, 0, pszDisplay); - } - } - - // Free feature info array. - // Feature Info array allocated with new so - // that each of the constructors for COptions - // in fhte Feature Info array will be called. - delete[] m_pInfo; -} - -// Turns index for mode to modeless index, which -// is the real index to the feature. -WORD CFeatures::GetModelessIndex(WORD wIndex, DWORD dwMode) const -{ - WORD wCount = 0; - - - switch(dwMode) - { - // Number of features, all modes - case 0: - wCount = wIndex; - break; - - // Find the nth feature that matches the mode - case OEMCUIP_DOCPROP: - case OEMCUIP_PRNPROP: - // Walk the feature list looking for nth feature - // with matching mode. - for(wCount = 0; wCount < m_wFeatures; ++wCount) - { - // Count down to the feature we want. - // Only count down for matching modes. - if(dwMode == m_pInfo[wCount].dwMode) - { - if(0 == wIndex) - { - break; - } - else - { - --wIndex; - } - } - } - break; - } - - return wCount; -} - - -// -// Public Methods -// - -// Default constructor -CFeatures::CFeatures() -{ - Init(); -} - -// Destructor -CFeatures::~CFeatures() -{ - // Clean up class. - Clear(); -} - -// Gets Core Driver Features, if not already retrieved. -HRESULT CFeatures::Acquire(_In_ HANDLE hHeap, - CUIHelper &Helper, - _In_ POEMUIOBJ poemuiobj - ) -{ - WORD wIndex = 0; - DWORD dwNeeded = 0; - HRESULT hrResult = S_OK; - - - VERBOSE(DLLTEXT("CFeatures::Acquire(0x%p, Helper, 0x%p) entered.\r\n"), - hHeap, - poemuiobj); - - // Don't retreive the Features again if we already got them. - if(0 < m_wFeatures) - { - VERBOSE(DLLTEXT("CFeatures::Acquire() features already enumerated.\r\n")); - VERBOSE(DLLTEXT("CFeatures::Acquire() returning S_OK.\r\n")); - - return S_OK; - } - - // Save the heap handle for use later, such as freeing memory at destruction. - m_hHeap = hHeap; - - // - // Enumerate features. - // - - // To try to cut down on having to call EnumFeatures more than once, - // pre-allocate a buffer of reasonable size. - m_dwSize = INITIAL_ENUM_FEATURES_SIZE; - m_pmszRaw = (PSTR) HeapAlloc(m_hHeap, HEAP_ZERO_MEMORY, m_dwSize); - if(NULL == m_pmszRaw) - { - ERR(ERRORTEXT("CFeatures::Acquire() alloc for feature list failed.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - - // Try to get feature list with initial buffer. - hrResult = Helper.EnumFeatures(poemuiobj, 0, m_pmszRaw, m_dwSize, &dwNeeded); - if( (E_OUTOFMEMORY == hrResult) && (m_dwSize < dwNeeded)) - { - PSTR pTemp; - - - // INVARIANT: feature list multi-sz wasn't large enough. - - - // Re-allocate the buffer and try again. - pTemp = (PSTR) HeapReAlloc(m_hHeap, HEAP_ZERO_MEMORY, m_pmszRaw, dwNeeded); - if(NULL == pTemp) - { - ERR(ERRORTEXT("CFeatures::Acquire() re-alloc for feature list failed.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - m_pmszRaw = pTemp; - m_dwSize = dwNeeded; - - // Try again to get the feature list. - hrResult = Helper.EnumFeatures(poemuiobj, 0, m_pmszRaw, m_dwSize, &dwNeeded); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("CFeatures::Acquire() failed to EnumFeatures() after re-allocating buffer.\r\n")); - - goto Exit; - } - } - - // Make sure we got the feature list. - // Can't do anything more with out it. - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("CFeatures::Acquire() failed to enumerate features. (hrResult = 0x%x)\r\n"), hrResult); - - goto Exit; - } - - // INVARIANT: successfully got feature keyword list. - - // Create array of string pointers to the feature keywords - // in the multi-sz we got from EnumFreatures(). - hrResult = MakeStrPtrList(m_hHeap, m_pmszRaw, &m_ppszKeywords, &m_wFeatures); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("CFeatures::Acquire() failed to create pointer list to keywords. (hrResult = 0x%x)\r\n"), hrResult); - - goto Exit; - } - - - // - // Build Feature Information - // - - - // Allocate array to hold feature info - // Use new for allocation so class - // constructors/destructors get called. - m_pInfo = new FEATURE_INFO[m_wFeatures]; - if(NULL == m_pInfo) - { - ERR(ERRORTEXT("CFeatures::Acquire() failed to alloc feature info array.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // For each feature, build/get feature info.... - for(wIndex = 0; wIndex < m_wFeatures; ++wIndex) - { - PFEATURE_INFO pCurrent = m_pInfo + wIndex; - - - // Get or build a keyword mapping entry - // that maps from keyword to usefully where to get info, such as - // display name, icon, option type, for keywords that may not be - // able to get info for from Helper. - pCurrent->pMapping = FindKeywordMapping(gkmFeatureMap, NUM_FEATURE_MAP, m_ppszKeywords[wIndex]); - - // Get display names for each of the featurs. - // The function implements a heuristic for detemining the display name, - // since can't get the display name from the UI Helper for all features. - hrResult = DetermineFeatureDisplayName(m_hHeap, - Helper, - poemuiobj, - m_ppszKeywords[wIndex], - pCurrent->pMapping, - &pCurrent->pszDisplayName); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("CFeatures::Acquire() failed to get display name for feature %hs. (hrResult = 0x%x)\r\n"), - m_ppszKeywords[wIndex], - hrResult); - - goto Exit; - } - - // Get options for each feature. - // NOTE: some features don't have options; the HRESULT will be E_NOTIMPL for these. - hrResult = pCurrent->Options.Acquire(hHeap, - Helper, - poemuiobj, - m_ppszKeywords[wIndex]); - if(!SUCCEEDED(hrResult) && (E_NOTIMPL != hrResult)) - { - ERR(ERRORTEXT("CFeatures::Acquire() failed to get options for feature %hs. (hrResult = 0x%x)\r\n"), - m_ppszKeywords[wIndex], - hrResult); - - goto Exit; - } - - // Determine if feature is Printer or Document sticky. - hrResult = DetermineStickiness(Helper, - poemuiobj, - m_ppszKeywords[wIndex], - pCurrent->pMapping, - &pCurrent->dwMode); - // Don't propagate error if failure from unhandled driver feature. - if( !SUCCEEDED(hrResult) - && - !IS_DRIVER_FEATURE(m_ppszKeywords[wIndex]) - ) - { - ERR(ERRORTEXT("CFeatures::Acquire() failed to determine stickiness for feature %hs. (hrResult = 0x%x)\r\n"), - m_ppszKeywords[wIndex], - hrResult); - - goto Exit; - } - - // Keep track of mode counts. - switch(pCurrent->dwMode) - { - case OEMCUIP_DOCPROP: - ++m_wDocFeatures; - break; - - case OEMCUIP_PRNPROP: - ++m_wPrintFeatures; - break; - - default: - ERR(ERRORTEXT("CFeatures::Acquire() unknown stickiness for feature %hs.\r\n"), - m_ppszKeywords[wIndex]); - break; - } - - } - - // INVARIANT: successfully build feature list. - - // Make sure that we always return success if we reach this point. - hrResult = S_OK; - - -Exit: - - // Clean up if weren't successful. - if(!SUCCEEDED(hrResult)) - { - Clear(); - } - - - VERBOSE(DLLTEXT("CFeatures::Acquire() returning HRESULT of 0x%x.\r\n"), hrResult); - - return hrResult; -} - -// Returns number of features contained in class instance. -WORD CFeatures::GetCount(DWORD dwMode) const -{ - WORD wCount = 0; - - - switch(dwMode) - { - // Number of features, all modes - case 0: - wCount = m_wFeatures; - break; - - case OEMCUIP_DOCPROP: - wCount = m_wDocFeatures; - break; - - case OEMCUIP_PRNPROP: - wCount = m_wPrintFeatures; - break; - - } - - VERBOSE(DLLTEXT("CFeatures::GetCount() returning %d\r\n"), wCount); - - return wCount; -} - -// Returns nth feature's keyword -PCSTR CFeatures::GetKeyword(WORD wIndex, DWORD dwMode) const -{ - // Validate parameters. - if( (wIndex >= GetCount(dwMode)) - || - (NULL == m_ppszKeywords) - ) - { - return NULL; - } - - // Get internal index. - wIndex = GetModelessIndex(wIndex, dwMode); - - // Return keyword - return m_ppszKeywords[wIndex]; -} - -// Return nth feature's Display Name. -PCWSTR CFeatures::GetName(WORD wIndex, DWORD dwMode) const -{ - // Validate parameters. - if( (wIndex >= GetCount(dwMode)) - || - (NULL == m_pInfo) - ) - { - return NULL; - } - - // Get internal index. - wIndex = GetModelessIndex(wIndex, dwMode); - - // Return display name. - return m_pInfo[wIndex].pszDisplayName; -} - -// Returns pointer to option class for nth feature. -COptions* CFeatures::GetOptions(WORD wIndex, DWORD dwMode) const -{ - // Validate parameters. - if( (wIndex >= GetCount(dwMode)) - || - (NULL == m_pInfo) - ) - { - return NULL; - } - - // Get internal index. - wIndex = GetModelessIndex(wIndex, dwMode); - - // Return options pointer. - return &m_pInfo[wIndex].Options; -} - -// Formats OPTITEM for specied feature. -HRESULT CFeatures::InitOptItem(_In_ HANDLE hHeap, POPTITEM pOptItem, WORD wIndex, DWORD dwMode) -{ - COptions *pOptions = NULL; - HRESULT hrResult = S_OK; - PFEATUREOPTITEMDATA pData = NULL; - - - // Validate parameters. - if( (wIndex >= GetCount(dwMode)) - || - (NULL == m_pInfo) - || - (NULL == pOptItem) - ) - { - return E_INVALIDARG; - } - - // Map mode index to internal index. - wIndex = GetModelessIndex(wIndex, dwMode); - - // Get name of feature. - pOptItem->pName = const_cast(GetName(wIndex)); - - // Add feature OPTITEM data to OPTITEM to facilitate saving - // selection changes. - pData = (PFEATUREOPTITEMDATA) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(FEATUREOPTITEMDATA)); - if(NULL == pData) - { - ERR(ERRORTEXT("CFeatures::InitOptItem() failed to allocated memory for feature OPTITEM data.")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - pData->dwSize = sizeof(FEATUREOPTITEMDATA); - pData->dwTag = FEATURE_OPTITEM_TAG; - pData->pszFeatureKeyword = GetKeyword(wIndex); - pData->pOptions = GetOptions(wIndex); - pOptItem->UserData = (ULONG_PTR) pData; - - - // Get pointer to options for this feature. - // NOTE: some features do not have option list for various reasons. - pOptions = GetOptions(wIndex); - if(NULL != pOptions) - { - // Initialize COption parts of the OPTITEM - hrResult = pOptions->InitOptItem(hHeap, pOptItem); - } - -Exit: - - Dump(pOptItem); - - return hrResult; -} - -////////////////////////////////////////////////// -// -// Regular functions not part of class -// -////////////////////////////////////////////////// - - -// Maps feature keywords to display names for the features. -HRESULT DetermineFeatureDisplayName(_In_ HANDLE hHeap, - CUIHelper &Helper, - POEMUIOBJ poemuiobj, - _In_ PCSTR pszKeyword, - const PKEYWORDMAP pMapping, - _Outptr_result_maybenull_ PWSTR *ppszDisplayName) -{ - DWORD dwDataType = 0; - DWORD dwSize = INITIAL_FEATURE_DISPLAY_NAME_SIZE; - DWORD dwNeeded = 0; - HRESULT hrResult = S_OK; - - - // Validate parameters. - if( (NULL == hHeap) - || - (NULL == pszKeyword) - || - (NULL == ppszDisplayName) - ) - { - ERR(ERRORTEXT("DetermineFeatureDisplayName() invalid arguement.\r\n")); - - hrResult = E_INVALIDARG; - goto Exit; - } - - // - // Call the Helper function. - // - - // Helper will return Display Names for PPD Features, but - // not for Driver Synthisized features (i.e. features prefixed with %). - // Do it for Driver Synthisized features, just in case the helper - // interface changes to support it. - - // Pre-allocate a buffer of reasonable size to try - // to one have to call GetFeatureAttribute() once. - *ppszDisplayName = (PWSTR) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, dwSize); - if(NULL == *ppszDisplayName) - { - ERR(ERRORTEXT("DetermineFeatureDisplayName() alloc for feature display name failed.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Try to get diplay name for feature from Helper. - hrResult = Helper.GetFeatureAttribute(poemuiobj, - 0, - pszKeyword, - "DisplayName", - &dwDataType, - (PBYTE) *ppszDisplayName, - dwSize, - &dwNeeded); - if( (E_OUTOFMEMORY == hrResult) && (dwSize < dwNeeded)) - { - PWSTR pTemp; - - - // INVARIANT: initial buffer wasn't large enough. - - // Re-alloc buffer and try again. - pTemp = (PWSTR) HeapReAlloc(hHeap, HEAP_ZERO_MEMORY, *ppszDisplayName, dwNeeded); - if(NULL == pTemp) - { - ERR(ERRORTEXT("DetermineFeatureDisplayName() re-alloc for feature display name failed.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - *ppszDisplayName = pTemp; - - // Try to get the display name from Helper, again. - hrResult = Helper.GetFeatureAttribute(poemuiobj, - 0, - pszKeyword, - "DisplayName", - &dwDataType, - (PBYTE) *ppszDisplayName, - dwNeeded, - &dwNeeded); - } - - if(SUCCEEDED(hrResult)) - { - // INVARIANT: Successfully got display name from Helper for feature. - // Don't need to do anything more. - - // Check the data type, it should be kADT_UNICODE. - if(kADT_UNICODE != dwDataType) WARNING(DLLTEXT("DetermineFeatureDisplayName() feature attribute type not kADT_UNICODE. (dwDataType = %d)\r\n"), dwDataType); - - goto Exit; - } - - // INVARIANT: Did not get the display name from the Helper. - - // Free memory allocated for call to Helper. - if(NULL != *ppszDisplayName) - { - HeapFree(hHeap, 0, *ppszDisplayName); - *ppszDisplayName = NULL; - } - - // Try alternative methods for getting the display name other - // than from the Helper function. - // If we have a mapping entry, then try to get resource string - // for the display name. - // Otherwise, covert the keyword to UNICODE and use that. - if(NULL != pMapping) - { - // - // Try mapping the keyword to resource string. - // - - hrResult = GetDisplayNameFromMapping(hHeap, pMapping, ppszDisplayName); - } - else - { - // - // Convert the keyword to UNICODE and use that. - // - - // Convert ANSI keyword to Unicode string for display name. - // Need to remove the % for Driver Synthisized features. - // For debug version, add marker that shows that the display name was faked. - PCSTR pConvert = IS_DRIVER_FEATURE(pszKeyword) ? pszKeyword + 1 : pszKeyword; - #if DBG - CHAR szTemp[256]; - if(FAILED(StringCbPrintfA(szTemp, sizeof(szTemp), "%s (Keyword)", pConvert))) - { - ERR(ERRORTEXT("DetermineFeatureDisplayName() StringCbPrintfA() called failed.\r\n")); - } - pConvert = szTemp; - #endif - *ppszDisplayName = MakeUnicodeString(hHeap, pConvert); - if(NULL == *ppszDisplayName) - { - ERR(ERRORTEXT("DetermineFeatureDisplayName() alloc for feature display name failed.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Return success even though we faked a display name. - hrResult = S_OK; - } - - -Exit: - - // If failed, then return no string. - if(!SUCCEEDED(hrResult)) - { - if(ppszDisplayName && NULL != *ppszDisplayName) - { - HeapFree(hHeap, 0, *ppszDisplayName); - *ppszDisplayName = NULL; - } - } - - return hrResult; -} - -// Maps option keywords to display names for the option. -HRESULT DetermineOptionDisplayName(_In_ HANDLE hHeap, - CUIHelper &Helper, - POEMUIOBJ poemuiobj, - _In_ PCSTR pszFeature, - _In_ PCSTR pszOption, - const PKEYWORDMAP pMapping, - _Outptr_result_maybenull_ PWSTR *ppszDisplayName) -{ - DWORD dwDataType = 0; - DWORD dwSize = INITIAL_OPTION_DISPLAY_NAME_SIZE; - DWORD dwNeeded = 0; - HRESULT hrResult = S_OK; - - - // Validate parameters. - if( (NULL == hHeap) - || - (NULL == pszFeature) - || - (NULL == pszOption) - || - (NULL == ppszDisplayName) - ) - { - ERR(ERRORTEXT("DetermineOptionDisplayName() invalid arguement.\r\n")); - - hrResult = E_INVALIDARG; - goto Exit; - } - - // - // Call the Helper function. - // - - // Helper will return Display Names for PPD Feature Options, but - // not for Driver Synthisized features options (i.e. features prefixed with %). - // Do it for all options, just in case the helper interface changes to support it. - - // Pre-allocate a buffer of reasonable size to try - // to one have to call GetOptionAttribute() once. - *ppszDisplayName = (PWSTR) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, dwSize); - if(NULL == *ppszDisplayName) - { - ERR(ERRORTEXT("DetermineOptionDisplayName() alloc for feature display name failed.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Try to get diplay name for feature from Helper. - hrResult = Helper.GetOptionAttribute(poemuiobj, - 0, - pszFeature, - pszOption, - "DisplayName", - &dwDataType, - (PBYTE) *ppszDisplayName, - dwSize, - &dwNeeded); - if( (E_OUTOFMEMORY == hrResult) && (dwSize < dwNeeded)) - { - PWSTR pTemp; - - - // INVARIANT: initial buffer wasn't large enough. - - // Re-alloc buffer and try again. - pTemp = (PWSTR) HeapReAlloc(hHeap, HEAP_ZERO_MEMORY, *ppszDisplayName, dwNeeded); - if(NULL == pTemp) - { - ERR(ERRORTEXT("GetOptionAttribute() re-alloc for feature display name failed.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - *ppszDisplayName = pTemp; - - // Try to get the display name from Helper, again. - hrResult = Helper.GetOptionAttribute(poemuiobj, - 0, - pszFeature, - pszOption, - "DisplayName", - &dwDataType, - (PBYTE) *ppszDisplayName, - dwNeeded, - &dwNeeded); - } - - if(SUCCEEDED(hrResult)) - { - // INVARIANT: Successfully got display name from Helper for feature. - // Don't need to do anything more. - - // Check the data type, it should be kADT_UNICODE. - if(kADT_UNICODE != dwDataType) WARNING(DLLTEXT("DetermineOptionDisplayName() feature attribute type not kADT_UNICODE. (dwDataType = %d)\r\n"), dwDataType); - - goto Exit; - } - - // INVARIANT: Did not get the display name from the Helper. - - // Free memory allocated for call to Helper. - if(NULL != *ppszDisplayName) - { - HeapFree(hHeap, 0, *ppszDisplayName); - *ppszDisplayName = NULL; - } - - // Try alternative methods for getting the display name other - // than from the Helper function. - // If we have a mapping entry, then try to get resource string - // for the display name. - // Otherwise, covert the keyword to UNICODE and use that. - if(NULL != pMapping) - { - // - // Try mapping the keyword to resource string. - // - - hrResult = GetDisplayNameFromMapping(hHeap, pMapping, ppszDisplayName); - } - else - { - // - // Convert the keyword to UNICODE and use that. - // - - // Convert ANSI keyword to Unicode string for display name. - // For debug version, add marker that shows that the display name was faked. - PCSTR pConvert = pszOption; - #if DBG - CHAR szTemp[256]; - if(FAILED(StringCbPrintfA(szTemp, sizeof(szTemp), "%s (Keyword)", pConvert))) - { - ERR(ERRORTEXT("DetermineOptionDisplayName() StringCbPrintfA() called failed.\r\n")); - } - pConvert = szTemp; - #endif - *ppszDisplayName = MakeUnicodeString(hHeap, pConvert); - if(NULL == *ppszDisplayName) - { - ERR(ERRORTEXT("DetermineOptionDisplayName() alloc for feature display name failed.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Return success even though we faked a display name. - hrResult = S_OK; - } - - -Exit: - - // If failed, then return no string. - if(!SUCCEEDED(hrResult)) - { - if(ppszDisplayName && NULL != *ppszDisplayName) - { - HeapFree(hHeap, 0, *ppszDisplayName); - *ppszDisplayName = NULL; - } - } - - return hrResult; -} - -// Determines sticky mode for the feature. -HRESULT DetermineStickiness(CUIHelper &Helper, - POEMUIOBJ poemuiobj, - PCSTR pszKeyword, - const PKEYWORDMAP pMapping, - PDWORD pdwMode) -{ - CHAR szGroupType[32] = {0}; - DWORD dwType = 0; - DWORD dwNeeded = 0; - HRESULT hrResult = S_OK; - - - // Use mapping to see what stickiness of the feature is. - if(NULL != pMapping) - { - *pdwMode = pMapping->dwMode; - goto Exit; - } - - // By default make feature Document sticky, if we don't have mapping. - *pdwMode = OEMCUIP_DOCPROP; - - // Try to use Helper to determine stickiness. - hrResult = Helper.GetFeatureAttribute(poemuiobj, - 0, - pszKeyword, - "OpenGroupType", - &dwType, - (PBYTE) szGroupType, - sizeof(szGroupType), - &dwNeeded); - if(SUCCEEDED(hrResult)) - { - // INVARIANT: found out if feature is an installable option. - // Installable options are the only PPD features - // that are Printer sticky. - - if(!lstrcmpA(szGroupType, "InstallableOptions")) - { - *pdwMode = OEMCUIP_PRNPROP; - } - goto Exit; - } - - -Exit: - - return hrResult; -} - -// Find the mapping entry from the keyword. -PKEYWORDMAP FindKeywordMapping(PKEYWORDMAP pKeywordMap, WORD wMapSize, PCSTR pszKeyword) -{ - BOOL bFound = FALSE; - PKEYWORDMAP pMapping = NULL; - - - // Walk mapping array for matching keyword. - for(WORD wIndex = 0; !bFound && (wIndex < wMapSize); ++wIndex) - { - bFound = !lstrcmpA(pszKeyword, pKeywordMap[wIndex].pszKeyword); - if(bFound) - { - pMapping = pKeywordMap + wIndex; - } - } - - return pMapping; -} - -// Get display name from mapping entry. -HRESULT GetDisplayNameFromMapping(_In_ HANDLE hHeap, PKEYWORDMAP pMapping, _Outptr_result_maybenull_ PWSTR *ppszDisplayName) -{ - HMODULE hModule = NULL; - HRESULT hrResult = S_OK; - - - // Validate parameters. - if( (NULL == hHeap) - || - (NULL == pMapping) - || - (NULL == ppszDisplayName) - ) - { - hrResult = E_INVALIDARG; - goto Exit; - } - - // Check for simple case of returning INT resource. - if( (NULL == pMapping->pwszModule) - || - IS_MAPPING_INT_RESOURCE(pMapping) - ) - { - // Just need to do MAKEINTRESOURCE on the resource ID and return. - *ppszDisplayName = MAKEINTRESOURCE(pMapping->uDisplayNameID); - goto Exit; - } - - // We only need to get the module if we aren't loading the resource from - // this module (i.e. if module name isn't NULL). - // Also, as an optimization, we assume that the module has already been loaded, - // since the only cases currently are this module, driver ui, and Compstui.dll. - hModule = GetModuleHandle(pMapping->pwszModule); - if(NULL == hModule) - { - DWORD dwError = GetLastError(); - - - ERR(ERRORTEXT("GetDisplayNameFromMapping() for failed to load module %s. (Error %d)\r\n"), - pMapping->pwszModule, - dwError); - - hrResult = HRESULT_FROM_WIN32(dwError); - goto Exit; - } - - // INVARIANT: have handle to module to load resource from or the - // resource is being loaded from this module. - - // Get the string resouce. - hrResult = GetStringResource(hHeap, hModule, pMapping->uDisplayNameID, ppszDisplayName); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("GetDisplayNameFromMapping() failed to load string. (hrResult = 0x%x)\r\n"), - hrResult); - goto Exit; - } - - -Exit: - - return hrResult; -} - -// Test if an OPTITEM is an OPTITEM for a feature. -// Macro for testing if OPTITEM is feature OPTITEM -BOOL IsFeatureOptitem(POPTITEM pOptItem) -{ - BOOL bRet = FALSE; - PFEATUREOPTITEMDATA pData = NULL; - - - // Make sure pointers are NULL. - if( (NULL == pOptItem) - || - (NULL == pOptItem->UserData) - ) - { - // INVARIANT: can't be feature OPTITEM, since one of - // the necessary pointer are NULL. - - return FALSE; - } - - // For convienience, assign to pointer to feature OPTITEM data. - pData = (PFEATUREOPTITEMDATA)(pOptItem->UserData); - - // Check size and tag. - bRet = (sizeof(FEATUREOPTITEMDATA) == pData->dwSize) - && - (FEATURE_OPTITEM_TAG == pData->dwTag); - - return bRet; -} - - - -// Walks array of OPTITEMs saving each feature OPTITEM -// that has changed. -HRESULT SaveFeatureOptItems(_In_ HANDLE hHeap, - CUIHelper *pHelper, - POEMUIOBJ poemuiobj, - HWND hWnd, - POPTITEM pOptItem, - WORD wItems) -{ - PSTR pmszPairs = NULL; - WORD wPairs = 0; - WORD wReasons = 0; - DWORD dwSize = 0; - DWORD dwResult = 0; - PCSTR *ppszReasons = NULL; - PWSTR pszConfilictFeature = NULL; - PWSTR pszConfilictOption = NULL; - PWSTR pszCaption = NULL; - PWSTR pszFormat = NULL; - PWSTR pszMessage = NULL; - HRESULT hrResult = S_OK; - - - // Validate parameters - if( (NULL == hHeap) - || - (NULL == pHelper) - || - (NULL == pOptItem) - ) - { - ERR(ERRORTEXT("SaveFeatureOptItems() called with invalid parameters.\r\n")); - - hrResult = E_INVALIDARG; - goto Exit; - } - - // Get feature option pairs to save. - hrResult = GetChangedFeatureOptions(hHeap, pOptItem, wItems, &pmszPairs, &wPairs, &dwSize); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("SaveFeatureOptItems() failed to get changed feature option pairs. (hrResult = 0x%x)\r\n"), - hrResult); - - goto Exit; - } - - // Don't need to do anything more if no feature options changed. - if(0 == wPairs || !pmszPairs) - { - VERBOSE(DLLTEXT("SaveFeatureOptItems() no feature options that need to be set.\r\n")); - - goto Exit; - } - - // Set the change feature options. - // For the first SetOptions() call, don't have the - // core driver UI resolve conflicts, so we can - // prompt user for automatic resolution or let - // them do the conflict resolving. - hrResult = pHelper->SetOptions(poemuiobj, - SETOPTIONS_FLAG_KEEP_CONFLICT, - pmszPairs, - dwSize, - &dwResult); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("SaveFeatureOptItems() call to SetOptions() failed. (hrResult = 0x%x, dwResult = %d\r\n"), - hrResult, - dwResult); - - goto Exit; - } - - // Check to see if we were able to save changed feature options, - // or if there is a conflict that needs resolution. - if(SETOPTIONS_RESULT_CONFLICT_REMAINED == dwResult) - { - int nRet; - DWORD dwRet; - CONFLICT Conflict; - PKEYWORDMAP pMapping = NULL; - - - // INVARIANT: constraint conflict, options weren't saved. - - // Get list of all features that have conflict. - hrResult = GetFirstConflictingFeature(hHeap, - pHelper, - poemuiobj, - pOptItem, - wItems, - &Conflict); - if(!SUCCEEDED(hrResult)) - { - goto Exit; - } - - // Create string pointer list in to multi-sz of first conflict. - hrResult = MakeStrPtrList(hHeap, Conflict.pmszReasons, &ppszReasons, &wReasons); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("SaveFeatureOptItems() failed to make string list for conflict reasons. (hrResult = 0x%x)\r\n"), - hrResult); - - goto Exit; - } - - // Ensure that we have at least 2 reasons. Later code assumes that we do. - if (wReasons < 2) - { - hrResult = E_UNEXPECTED; - - goto Exit; - } - - // - // Get display versions of feature/option conflict reason. - // - - // Get or build a keyword mapping entry - // that maps from keyword to usefully where to get info, such as - // display name, icon, option type, for keywords that may not be - // able to get info for from Helper. - pMapping = FindKeywordMapping(gkmFeatureMap, NUM_FEATURE_MAP, ppszReasons[0]); - - // Get display names for each of the featurs. - // The function implements a heuristic for detemining the display name, - // since can't get the display name from the UI Helper for all features. - hrResult = DetermineFeatureDisplayName(hHeap, - *pHelper, - poemuiobj, - ppszReasons[0], - pMapping, - &pszConfilictFeature); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("SaveFeatureOptItems failed to get display name for feature %hs. (hrResult = 0x%x)\r\n"), - ppszReasons[0], - hrResult); - - goto Exit; - } - - // Get or build a keyword mapping entry - // that maps from keyword to usefully where to get info, such as - // display name, icon, option type, for keywords that may not be - // able to get info for from Helper. - pMapping = FindKeywordMapping(gkmOptionMap, NUM_OPTION_MAP, ppszReasons[1]); - - // Get option display name. - hrResult = DetermineOptionDisplayName(hHeap, - *pHelper, - poemuiobj, - ppszReasons[0], - ppszReasons[1], - pMapping, - &pszConfilictOption); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("SaveFeatureOptItems() failed to get display name for %hs of feature %hs. (hrResult = 0x%x)\r\n"), - ppszReasons[1], - ppszReasons[0], - hrResult); - - goto Exit; - } - - // - // Prompt user about how to resolve conflict. - // - - // Get caption name. - hrResult = GetStringResource(hHeap, ghInstance, IDS_NAME, &pszCaption); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("SaveFeatureOptItems() failed to get caption name. (hrResult = 0x%x)\r\n"), - hrResult); - goto Exit; - } - - // Get message body format string. - hrResult = GetStringResource(hHeap, ghInstance, IDS_CONSTRAINT_CONFLICT, &pszFormat); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("SaveFeatureOptItems() failed to get constraint conflict format. (hrResult = 0x%x)\r\n"), - hrResult); - goto Exit; - } - - - // Get messsage body. - PVOID paArgs[4] = {pszConfilictFeature, - pszConfilictOption, - const_cast(Conflict.pszFeature), - Conflict.pszOption - }; - dwRet = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, - pszFormat, - 0, - 0, - (PWSTR) &pszMessage, - 0, - (va_list *) paArgs); - if(0 == dwRet) - { - DWORD dwError = GetLastError(); - - ERR(ERRORTEXT("SaveFeatureOptItems() failed to FormatMessage() for constraint conflict of feature %hs option %hs. (Last Error %d)\r\n"), - Conflict.pszFeatureKeyword, - Conflict.pszOptionKeyword, - dwError); - - hrResult = HRESULT_FROM_WIN32(dwError); - goto Exit; - } - - // Display simple message box with prompt. - nRet = MessageBox(hWnd, pszMessage, pszCaption, MB_YESNO | MB_ICONWARNING); - - // Check to see how user wants to resolve conflict. - if(IDYES == nRet) - { - // Let core driver resolve conflict resolution. - hrResult = pHelper->SetOptions(poemuiobj, - SETOPTIONS_FLAG_RESOLVE_CONFLICT, - pmszPairs, - dwSize, - &dwResult); - - // Conflict resolution requires refreshing current option - // selection for each feature, since selection may have - // changed because of conflict resolution. - RefreshOptItemSelection(pHelper, poemuiobj, pOptItem, wItems); - } - - // Return failure if there are still conflictts. - if(SETOPTIONS_RESULT_CONFLICT_REMAINED == dwResult) - { - hrResult = E_FAIL; - } - } - - -Exit: - - // Clean up... - - // cleanup heap allocs. - if(NULL != pmszPairs) HeapFree(hHeap, 0, pmszPairs); - if(NULL != ppszReasons) HeapFree(hHeap, 0, ppszReasons); - if(NULL != pszConfilictFeature) HeapFree(hHeap, 0, pszConfilictFeature); - if(NULL != pszConfilictOption) HeapFree(hHeap, 0, pszConfilictOption); - if(NULL != pszCaption) HeapFree(hHeap, 0, pszCaption); - if(NULL != pszFormat) HeapFree(hHeap, 0, pszFormat); - if(NULL != pszMessage) LocalFree(pszMessage); - - return hrResult; -} - -// Allocates buffer, if needed, and calls IPrintCoreUI2::WhyConsrained -// to get reason for constraint. -HRESULT GetWhyConstrained(_In_ HANDLE hHeap, - CUIHelper *pHelper, - POEMUIOBJ poemuiobj, - _In_ PCSTR pszFeature, - _In_ PCSTR pszOption, - _Inout_ PSTR *ppmszReason, - _Inout_ PDWORD pdwSize) -{ - PSTR pmszReasonList = *ppmszReason; - DWORD dwNeeded = 0; - HRESULT hrResult = S_OK; - - - // If buffer wasn't passed in, then allocate one. - if( (NULL == pmszReasonList) || (0 == *pdwSize) ) - { - // If no size or size is smaller than default, then change to default - // size. We want to try to only allocate and call once. - if(*pdwSize < INITIAL_GET_REASON_SIZE) - { - *pdwSize = INITIAL_GET_REASON_SIZE; - } - - // Alloc initial buffer for reason constrained. - pmszReasonList = (PSTR) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, *pdwSize); - if(NULL == pmszReasonList) - { - ERR(ERRORTEXT("GetWhyConstrained() failed to alloc buffer for constraint reasons for feature %hs and option %hs.\r\n"), - pszFeature, - pszOption); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - } - - // Get reason for constraint. - hrResult = pHelper->WhyConstrained(poemuiobj, - 0, - pszFeature, - pszOption, - pmszReasonList, - *pdwSize, - &dwNeeded); - if( (E_OUTOFMEMORY == hrResult) - && - (*pdwSize < dwNeeded) - ) - { - PSTR pTemp; - - - // INVARIANT: initial buffer not large enough. - - // Re-alloc buffer to needed size. - pTemp = (PSTR) HeapReAlloc(hHeap, HEAP_ZERO_MEMORY, pmszReasonList, dwNeeded); - if(NULL == pTemp) - { - ERR(ERRORTEXT("GetWhyConstrained() failed to re-allocate buffer for constraint reason for feature %hs and option %hs.\r\n"), - pszFeature, - pszOption); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - pmszReasonList = pTemp; - *pdwSize = dwNeeded; - - // Retry getting constaint reason. - hrResult = pHelper->WhyConstrained(poemuiobj, - 0, - pszFeature, - pszOption, - pmszReasonList, - *pdwSize, - &dwNeeded); - } - - -Exit: - - // On error, do clean up. - if(!SUCCEEDED(hrResult)) - { - // Free reason buffer. - if(NULL != pmszReasonList) HeapFree(hHeap, 0, pmszReasonList); - - // Return NULL and zero size. - *ppmszReason = NULL; - *pdwSize = 0; - } - else - { - *ppmszReason = pmszReasonList; - } - - return hrResult; -} - -// Creates multi-sz list of feature option pairs that have changed. -HRESULT GetChangedFeatureOptions(_In_ HANDLE hHeap, - POPTITEM pOptItem, - WORD wItems, - _Outptr_result_maybenull_ PSTR *ppmszPairs, - _Out_ PWORD pwPairs, - _Out_ PDWORD pdwSize) -{ - WORD wCount = 0; - WORD wChanged = 0; - WORD wPairs = 0; - PSTR pmszPairs = NULL; - DWORD dwNeeded = 2; - DWORD dwOffset = 0; - HRESULT hrResult = S_OK; - PFEATUREOPTITEMDATA pData = NULL; - - - // Walk OPTITEM array looking or changed options, - // and calculating size needed for multi-sz buffer. - for(wCount = 0; wCount < wItems; ++wCount) - { - PSTR pszOption = NULL; - - - // Just go to next item if this OPTITEM hasn't - // changed or isn't a feature OPTITEM. - if( !(OPTIF_CHANGEONCE & pOptItem[wCount].Flags) - || - !IsFeatureOptitem(pOptItem + wCount) - ) - { - continue; - } - - // For convienience, assign to pointer to feature OPTITEM data. - pData = (PFEATUREOPTITEMDATA)(pOptItem[wCount].UserData); - - // Increment options changed and size needed. - pszOption = GetOptionKeywordFromOptItem(hHeap, pOptItem + wCount); - if(NULL != pszOption) - { - ++wChanged; - - DWORD dwTmp = 0; - - if (FAILED(hrResult = SizeTToDWord(strlen(pData->pszFeatureKeyword) + strlen(pszOption) + 2, &dwTmp))) - { - goto Exit; - } - - dwNeeded += dwTmp; - - // Need to free option keyword string copy - // allocated in GetOptionKeywordFromOptItem(). - HeapFree(hHeap, 0, pszOption); - pszOption = NULL; - } - } - - // Don't need to do anything more if no feature options changed. - if(0 == wChanged) - { - goto Exit; - } - - // Allocate multi-sz buffer. - pmszPairs = (PSTR) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, dwNeeded); - if(NULL == pmszPairs) - { - ERR(ERRORTEXT("GetChangedFeatureOptions() failed to allocate multi-sz.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Build mult-sz list of feature option pairs - // that changed. - for(wCount = 0, wPairs = 0; (wCount < wItems) && (wPairs < wChanged); ++wCount) - { - PSTR pszOption = NULL; - - - // Just go to next item if this OPTITEM hasn't - // changed or isn't a feature OPTITEM. - if( !(OPTIF_CHANGEONCE & pOptItem[wCount].Flags) - || - !IsFeatureOptitem(pOptItem + wCount) - ) - { - continue; - } - - // For convienience, assign to pointer to feature OPTITEM data. - pData = (PFEATUREOPTITEMDATA)(pOptItem[wCount].UserData); - - // Add feature option pair. - pszOption = GetOptionKeywordFromOptItem(hHeap, pOptItem + wCount); - if(NULL != pszOption) - { - if (FAILED(hrResult = StringCbCopyA(pmszPairs + dwOffset, dwNeeded - dwOffset, pData->pszFeatureKeyword))) - { - goto Exit; - } - - DWORD dwTmp = 0; - - if (FAILED(hrResult = SizeTToDWord(strlen(pData->pszFeatureKeyword) + 1, &dwTmp))) - { - goto Exit; - } - - dwOffset += dwTmp; - - if (FAILED(hrResult = StringCbCopyA(pmszPairs + dwOffset, dwNeeded - dwOffset, pszOption))) - { - goto Exit; - } - - if (FAILED(hrResult = SizeTToDWord(strlen(pszOption) + 1, &dwTmp))) - { - goto Exit; - } - - dwOffset += dwTmp; - - // Keep track of number of pairs added, so - // we are able to exit loop as soon as - // we added all changed feature options. - ++wPairs; - - // Need to free option keyword string copy - // allocated in GetOptionKeywordFromOptItem(). - HeapFree(hHeap, 0, pszOption); - pszOption = NULL; - } - } - - -Exit: - - if(SUCCEEDED(hrResult)) - { - // INVARIANT: either successfully build mutli-sz of changed - // feature option pairs, or there are no feature - // that options changed. - - // Return pairs and number of pairs. - *pwPairs = wPairs; - *pdwSize = dwNeeded; - *ppmszPairs = pmszPairs; - } - else - { - // INVARINAT: error. - - // Clean up. - if(NULL == pmszPairs) HeapFree(hHeap, 0, pmszPairs); - - // Return NULL and zero count. - *pwPairs = 0; - *pdwSize = 0; - *ppmszPairs = NULL; - } - - return hrResult; -} - -// Returns pointer to option keyword for a feature OPTITEM. -PSTR GetOptionKeywordFromOptItem(_In_ HANDLE hHeap, POPTITEM pOptItem) -{ - char szNumber[16] = {0}; - PSTR pszOption = NULL; - PFEATUREOPTITEMDATA pData = NULL; - - - // Validate parameter. - if(!IsFeatureOptitem(pOptItem)) - { - ERR(ERRORTEXT("GetOptionKeywordFromOptItem() invalid parameter.\r\n")); - - goto Exit; - } - - // For convienience, assign to pointer to feature OPTITEM data. - pData = (PFEATUREOPTITEMDATA)(pOptItem->UserData); - - // Option selection is based on type of OPTTYPE. - switch(pOptItem->pOptType->Type) - { - // For up down arrow control, selection is just pOptItem->Sel - // converted to string. - case TVOT_UDARROW: - if(FAILED(StringCbPrintfA(szNumber, sizeof(szNumber)/sizeof(szNumber[0]), "%u", pOptItem->Sel))) - { - ERR(ERRORTEXT("GetOptionKeywordFromOptItem() failed to convert number to string.\r\n")); - } - szNumber[sizeof(szNumber)/sizeof(szNumber[0]) - 1] = '\0'; - pszOption = MakeStringCopy(hHeap, szNumber); - break; - - // For combobox, pOptItem->Sel is the index in to the - // option array. - case TVOT_COMBOBOX: - pszOption = MakeStringCopy(hHeap, pData->pOptions->GetKeyword((WORD)pOptItem->Sel)); - break; - - // The default is the option count. - default: - ERR(ERRORTEXT("GetOptionKeywordFromOptItem() OPTTYPE type %d num of OPTPARAMs not handled.\r\n"), - pOptItem->pOptType->Type); - - goto Exit; - break; - } - - -Exit: - - return pszOption; -} - -// Returns pointer to option display name for a feature OPTITEM. -PWSTR GetOptionDisplayNameFromOptItem(_In_ HANDLE hHeap, POPTITEM pOptItem) -{ - WCHAR szNumber[16] = {0}; - PWSTR pszOption = NULL; - PFEATUREOPTITEMDATA pData = NULL; - - - // Validate parameter. - if(!IsFeatureOptitem(pOptItem)) - { - ERR(ERRORTEXT("GetOptionDisplayNameFromOptItem() invalid parameter.\r\n")); - - goto Exit; - } - - // For convienience, assign to pointer to feature OPTITEM data. - pData = (PFEATUREOPTITEMDATA)(pOptItem->UserData); - - // Option selection is based on type of OPTTYPE. - switch(pOptItem->pOptType->Type) - { - // For up down arrow control, selection is just pOptItem->Sel - // converted to string. - case TVOT_UDARROW: - if(FAILED(StringCbPrintfW(szNumber, sizeof(szNumber)/sizeof(szNumber[0]), L"%u", pOptItem->Sel))) - { - ERR(ERRORTEXT("GetOptionDisplayNameFromOptItem() failed to convert number to string.\r\n")); - } - szNumber[sizeof(szNumber)/sizeof(szNumber[0]) - 1] = L'\0'; - pszOption = MakeStringCopy(hHeap, szNumber); - break; - - // For combobox, pOptItem->Sel is the index in to the - // option array. - case TVOT_COMBOBOX: - pszOption = MakeStringCopy(hHeap, pOptItem->pOptType->pOptParam[pOptItem->Sel].pData); - break; - - // The default is the option count. - default: - ERR(ERRORTEXT("GetOptionDisplayNameFromOptItem() OPTTYPE type %d num of OPTPARAMs not handled.\r\n"), - pOptItem->pOptType->Type); - - goto Exit; - break; - } - - -Exit: - - return pszOption; -} - -// Refreshes option selection for each feature OPTITEM -HRESULT RefreshOptItemSelection(CUIHelper *pHelper, - POEMUIOBJ poemuiobj, - POPTITEM pOptItems, - WORD wItems) -{ - HRESULT hrResult = S_OK; - PFEATUREOPTITEMDATA pData = NULL; - - - // Walk OPTITEM array refreshing feature OPTITEMs. - for(WORD wCount = 0; wCount < wItems; ++wCount) - { - // Just go to next item if this OPTITEM isn't a feature OPTITEM. - if(!IsFeatureOptitem(pOptItems + wCount)) - { - continue; - } - - // For convienience, assign to pointer to feature OPTITEM data. - pData = (PFEATUREOPTITEMDATA)(pOptItems[wCount].UserData); - - // Refresh COption selection. - pData->pOptions->RefreshSelection(*pHelper, poemuiobj); - - // Assign COption selection to OPTITEM selection. - pOptItems[wCount].pSel = pData->pOptions->GetSelection(); - - } - - return hrResult; -} - -// Creates array of conflict features. -HRESULT GetFirstConflictingFeature(_In_ HANDLE hHeap, - CUIHelper *pHelper, - POEMUIOBJ poemuiobj, - POPTITEM pOptItem, - WORD wItems, - PCONFLICT pConflict) -{ - WORD wCount = 0; - HRESULT hrResult = S_OK; - PFEATUREOPTITEMDATA pData = NULL; - - - // Walk OPTITEM array looking or changed options that are in conflict. - for(wCount = 0; wCount < wItems; ++wCount) - { - // Just go to next item if this OPTITEM hasn't - // changed or isn't a feature OPTITEM. - if( !(OPTIF_CHANGEONCE & pOptItem[wCount].Flags) - || - !IsFeatureOptitem(pOptItem + wCount) - ) - { - continue; - } - - // For convienience, assign to pointer to feature OPTITEM data. - pData = (PFEATUREOPTITEMDATA)(pOptItem[wCount].UserData); - - // Init conflict record if this feature is in conflict. - pConflict->pszOptionKeyword = GetOptionKeywordFromOptItem(hHeap, pOptItem + wCount); - if(NULL != pConflict->pszOptionKeyword) - { - // Get reason for conflict - // If the feature isn't in conflict, - // then the pmszReasonList will start - // with NULL terminator. - hrResult = GetWhyConstrained(hHeap, - pHelper, - poemuiobj, - pData->pszFeatureKeyword, - pConflict->pszOptionKeyword, - &pConflict->pmszReasons, - &pConflict->dwReasonsSize); - if(!SUCCEEDED(hrResult)) - { - // NOTE: driver features aren't supported by WhyConstrained. - if((E_INVALIDARG == hrResult) && IS_DRIVER_FEATURE(pData->pszFeatureKeyword)) - { - // Need to reset the result in case it is the last - // feature OPTITEM. - hrResult = S_OK; - continue; - } - - ERR(ERRORTEXT("GetConflictingFeatures() failed to get reason for feature %hs option %hs constraint. (hrResult = 0x%x)\r\n"), - pData->pszFeatureKeyword, - pConflict->pszOptionKeyword, - hrResult); - - goto Exit; - } - - // Record conflict if feature is in conflict. - if( (NULL != pConflict->pmszReasons) - && - (pConflict->pmszReasons[0] != '\0') - ) - { - // Save pointer to feature keyword. - pConflict->pszFeatureKeyword = pData->pszFeatureKeyword; - pConflict->pszFeature = pOptItem[wCount].pName; - pConflict->pszOption = GetOptionDisplayNameFromOptItem(hHeap, pOptItem + wCount); - - // Found first conflict. - break; - } - } - } - - -Exit: - - return hrResult; -} - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Features.h b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Features.h deleted file mode 100644 index 84fee27e..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Features.h +++ /dev/null @@ -1,236 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 2001 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Features.h -// - -#pragma once - -//////////////////////////////////////////////////////// -// Defines and Macros -//////////////////////////////////////////////////////// - - - -//////////////////////////////////////////////////////// -// Type Definitions -//////////////////////////////////////////////////////// - -// Struct used to map keyword to information -// such as display name and stickiness. -typedef struct _tagKeywordMap -{ - PCSTR pszKeyword; - PCWSTR pwszModule; - UINT uDisplayNameID; - DWORD dwMode; - DWORD dwFlags; - -} KEYWORDMAP, *PKEYWORDMAP; - - -// Struct container for info about -// feature that is in conflict. -typedef struct _tagConflict -{ - PCSTR pszFeatureKeyword; - PCWSTR pszFeature; - PSTR pszOptionKeyword; - PWSTR pszOption; - PSTR pmszReasons; - DWORD dwReasonsSize; - -} CONFLICT, *PCONFLICT; - - - -//////////////////////////////////////////////////////// -// Class Definitions -//////////////////////////////////////////////////////// - -// Class wrapper and container for Core Driver Feature Options. -class COptions -{ - private: - - // Option Infomation - class OPTION_INFO - { - public: - PKEYWORDMAP pMapping; - PWSTR pszDisplayName; - - public: - OPTION_INFO() - { - pMapping = NULL; - pszDisplayName = NULL; - } - - virtual ~OPTION_INFO(){} - }; - typedef class OPTION_INFO *POPTION_INFO; - - // Data Members - WORD m_wOptions; // Count of the number of options contained for an instance of the class. - BYTE m_cType; // CPSUI Option Type (i.e. what to set pOptItem->pOptType->Type to). - PSTR m_pmszRaw; // The RAW multi NULL terminated string buffer used for IPrintCoreUI2::EnumOptions(). - PCSTR m_pszFeature; // Pointer to the feature for which the enumerate options belong. - PCSTR *m_ppszOptions; // String list pointer that points to begining of each of the strings in multi-SZ pointed to by m_pmszRaw. - POINT m_ptRange; // Option range for features, such as %JobTimeout, that have a range of possible vaules not a small selection list. - DWORD m_dwSize; // Size of m_pmszRaw buffer. - PWSTR m_pszUnits; // String that contains the unit specifier for options, such as %JobTimeout, which need Units (i.e. seconds). - HANDLE m_hHeap; // Heap to do allocations from. - POPTION_INFO m_pInfo; // Array of Info about each option for a feature. - - union { // Current selected option for a feature. - LONG m_Sel; // This is what pOptItem->m_pSel or pOptItem->m_Sel - LPTSTR m_pSel; // will be set to. - }; - - public: - COptions(); - virtual ~COptions(); - - // Populate Options list for specified keyword. - HRESULT COptions::Acquire(_In_ HANDLE hHeap, - CUIHelper &Helper, - _In_ POEMUIOBJ poemuiobj, - _In_ PCSTR pszFeature); - - // Returns number of feature options contained in class instance. - inline WORD GetCount() const {return m_wOptions;} - - // Returns selection. - inline LPTSTR GetSelection() const {return m_pSel;} - - // Return nth options keyword. - PCSTR GetKeyword(WORD wIndex) const; - - // Return nth option Display Name. - PCWSTR GetName(WORD wIndex) const; - - // Find option with matching keyword string. - WORD FindOption(_In_opt_ PCSTR pszOption, WORD wDefault) const; - - // Initializes options portion of OPTITEM. - HRESULT InitOptItem(_In_ HANDLE hHeap, POPTITEM pOptItem); - - // Refresh option selection. - HRESULT RefreshSelection(CUIHelper &Helper, POEMUIOBJ poemuiobj); - - private: - void Init(); - void Clear(); - void FreeOptionInfo(); - HRESULT GetOptionsForSpecialFeatures(CUIHelper &Helper, POEMUIOBJ poemuiobj); - HRESULT GetOptionsForOutputPSLevel(CUIHelper &Helper, POEMUIOBJ poemuiobj); - HRESULT GetOptionSelectionString(CUIHelper &Helper, POEMUIOBJ poemuiobj, _Outptr_result_maybenull_ PSTR *ppszSel); - HRESULT GetOptionSelectionLong(CUIHelper &Helper, POEMUIOBJ poemuiobj); - HRESULT GetOptionSelectionShort(CUIHelper &Helper, POEMUIOBJ poemuiobj); - HRESULT GetOptionSelectionIndex(CUIHelper &Helper, POEMUIOBJ poemuiobj); -}; - - -// Class wrapper and container for Cor Driver Features. -class CFeatures -{ - private: - - // Feature Infomation - class FEATURE_INFO - { - public: - PKEYWORDMAP pMapping; - PWSTR pszDisplayName; - COptions Options; - DWORD dwMode; - - public: - FEATURE_INFO() - { - pMapping = NULL; - pszDisplayName = NULL; - dwMode = 0; - } - - virtual ~FEATURE_INFO() {} - }; - typedef class FEATURE_INFO *PFEATURE_INFO; - - WORD m_wFeatures; // Count of the number of features. - WORD m_wDocFeatures; // Count of the number of Document sticky features. - WORD m_wPrintFeatures; // Count of the number of Printer sticky features. - PSTR m_pmszRaw; // Buffer for multi-SZ for call to IPrintCoreUI2::EnumFeatures. - PCSTR *m_ppszKeywords; // String list that points to each of the strings in m_pmszRaw. - DWORD m_dwSize; // Size of m_pmszRaw. - HANDLE m_hHeap; // Heap to do allocations from. - PFEATURE_INFO m_pInfo; // Array of feature information about each of the enumerate features. - - public: - CFeatures(); - virtual ~CFeatures(); - - // Populates the Feature list - HRESULT Acquire(_In_ HANDLE hHeap, CUIHelper &Helper, _In_ POEMUIOBJ poemuiobj); - - // Returns number of features contained in class instance. - WORD GetCount(DWORD dwMode = 0) const; - - // Returns feature keyword. - PCSTR GetKeyword(WORD wIndex, DWORD dwMode = 0) const; - - // Return feature Display Name. - PCWSTR GetName(WORD wIndex, DWORD dwMode = 0) const; - - // Returns pointer to option class for nth feature. - COptions* GetOptions(WORD wIndex, DWORD dwMode = 0) const; - - // Initializes OPTITEM for the feature. - HRESULT InitOptItem(_In_ HANDLE hHeap, POPTITEM pOptItem, WORD wIndex, DWORD dwMode); - - private: - void Init(); - void Clear(); - void FreeFeatureInfo(); - WORD GetModelessIndex(WORD wIndex, DWORD dwMode) const; -}; - - - -//////////////////////////////////////////////////////// -// Prototypes -//////////////////////////////////////////////////////// - -HRESULT DetermineFeatureDisplayName(_In_ HANDLE hHeap, CUIHelper &Helper, POEMUIOBJ poemuiobj, - _In_ PCSTR pszKeyword, const PKEYWORDMAP pMapping, - _Outptr_result_maybenull_ PWSTR *ppszDisplayName); -HRESULT DetermineOptionDisplayName(_In_ HANDLE hHeap, CUIHelper &Helper, POEMUIOBJ poemuiobj, - _In_ PCSTR pszFeature, _In_ PCSTR pszOption, - const PKEYWORDMAP pMapping, _Outptr_result_maybenull_ PWSTR *ppszDisplayName); -HRESULT DetermineStickiness(CUIHelper &Helper, POEMUIOBJ poemuiobj, PCSTR pszKeyword, - const PKEYWORDMAP pMapping,PDWORD pdwMode); - -PKEYWORDMAP FindKeywordMapping(PKEYWORDMAP pKeywordMap, WORD wMapSize, PCSTR pszKeyword); -HRESULT GetDisplayNameFromMapping(_In_ HANDLE hHeap, PKEYWORDMAP pMapping, _Outptr_result_maybenull_ PWSTR *ppszDisplayName); - -BOOL IsFeatureOptitem(POPTITEM pOptItem); -HRESULT SaveFeatureOptItems(_In_ HANDLE hHeap, CUIHelper *pHelper, POEMUIOBJ poemuiobj, - HWND hWnd, POPTITEM pOptItem, WORD wItems); -HRESULT GetWhyConstrained(_In_ HANDLE hHeap, CUIHelper *pHelper, POEMUIOBJ poemuiobj, - _In_ PCSTR pszFeature, _In_ PCSTR pszOption, _Inout_ PSTR *ppmszReason, - _Inout_ PDWORD pdwSize); -HRESULT GetChangedFeatureOptions(_In_ HANDLE hHeap, POPTITEM pOptItem, WORD wItems, - _Outptr_result_maybenull_ PSTR *ppmszPairs, _Out_ PWORD pdwPairs, _Out_ PDWORD pdwSize); -PSTR GetOptionKeywordFromOptItem(_In_ HANDLE hHeap, POPTITEM pOptItem); -PWSTR GetOptionDisplayNameFromOptItem(_In_ HANDLE hHeap, POPTITEM pOptItem); -HRESULT RefreshOptItemSelection(CUIHelper *pHelper, POEMUIOBJ poemuiobj, POPTITEM pOptItems, - WORD wItems); -HRESULT GetFirstConflictingFeature(_In_ HANDLE hHeap, CUIHelper *pHelper, POEMUIOBJ poemuiobj, - POPTITEM pOptItem, WORD wItems, PCONFLICT pConflict); - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Helper.cpp b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Helper.cpp deleted file mode 100644 index 3e1a2da5..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Helper.cpp +++ /dev/null @@ -1,457 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 2001 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Helper.cpp -// -// -// PURPOSE: Implementation of wrapper class for Driver UI Helper interface. -// - -#include "precomp.h" -#include "Helper.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// Internal Macros -//////////////////////////////////////////////////////// - - -// Macros for simplifying calling the Driver UI Helper interfaces correctly. - -#define CALL_HELPER(MethodName, args) \ - if (IsEqualGUID(&m_iidUIHelper, &IID_IPrintOemDriverUI)) \ - { \ - return static_cast(m_pUIHelper)->MethodName args; \ - } \ - else if (IsEqualGUID(&m_iidUIHelper, &IID_IPrintCoreUI2)) \ - { \ - return static_cast(m_pUIHelper)->MethodName args; \ - } \ - return E_NOINTERFACE; - -#define CALL_HELPER2(MethodName, args) \ - if (IsEqualGUID(&m_iidUIHelper, &IID_IPrintCoreUI2)) \ - { \ - return static_cast(m_pUIHelper)->MethodName args; \ - } \ - return E_NOINTERFACE; - - -///////////////////////////////////////////////////////////// -// -// CUIHelper Class Methods -// - -// -// Private Methods -// - -// Clears or initializes data members. -void CUIHelper::Clear() -{ - // Clear stored interface - m_pUIHelper = NULL; - m_iidUIHelper = GUID_NULL; -} - - -// -// Public Methods -// - -// Default contructor. -CUIHelper::CUIHelper() -{ - // Initialize the data members. - Clear(); -} - -// Constructor with assignment. -CUIHelper::CUIHelper(const IID &HelperIID, PVOID pHelper) -{ - // Assign the interface. - Assign(HelperIID, pHelper); -} - -// Destructor -CUIHelper::~CUIHelper() -{ - // Release the interface reference. - Release(); -} - -// Stores helper interface in helper entry structure. -void CUIHelper::Assign(const IID &HelperIID, PVOID pHelper) -{ - // If we already have a helper interface, release it. - if(IsValid()) - { - Release(); - } - - // Store helper interface and IID for it. - m_pUIHelper = static_cast(pHelper); - m_iidUIHelper = HelperIID; -} - -// Releases the helper interface and -// our removes the references to it. -ULONG CUIHelper::Release() -{ - ULONG ulRef = 0; - - - if(IsValid()) - { - // Release the interface. - // Since IPrintCoreUI2 inherits from IPrintOemDriverUI, - // it is safe to cast both types of helper interfaces - // to IPrintOemDriverUI for purposes of calling a - // method implemented in IPrintOemDriverUI. - // NOTE: can't cast to IUnknown since it just has pure virtual - // calls for AddRef and Release. - ulRef = static_cast(m_pUIHelper)->Release(); - - // Clear the data members. - Clear(); - } - - return ulRef; -} - - -// -// IPrintOemDriverUI methods -// - -// -// Helper function to get driver settings. This function is only supported -// for UI plugins that do not fully replace core driver's standard UI. -// - -HRESULT __stdcall CUIHelper::DrvGetDriverSetting( - PVOID pci, - PCSTR Feature, - PVOID pOutput, - DWORD cbSize, - PDWORD pcbNeeded, - PDWORD pdwOptionsReturned - ) -{ - CALL_HELPER(DrvGetDriverSetting, - (pci, - Feature, - pOutput, - cbSize, - pcbNeeded, - pdwOptionsReturned - ) - ); -} - -// -// Helper function to allow OEM plugins upgrade private registry -// settings. This function is supported for any UI plugins and should be -// called only by OEM's UpgradePrinter. -// - -HRESULT __stdcall CUIHelper::DrvUpgradeRegistrySetting( - HANDLE hPrinter, - PCSTR pFeature, - PCSTR pOption - ) -{ - CALL_HELPER(DrvUpgradeRegistrySetting, - (hPrinter, - pFeature, - pOption - ) - ); -} - -// -// Helper function to allow OEM plugins to update the driver UI settings. -// This function is only supported for UI plugins that do not fully replace -// core driver's standard UI. It should be called only when the UI is present. -// - -HRESULT __stdcall CUIHelper::DrvUpdateUISetting( - PVOID pci, - PVOID pOptItem, - DWORD dwPreviousSelection, - DWORD dwMode - ) -{ - CALL_HELPER(DrvUpdateUISetting, - (pci, - pOptItem, - dwPreviousSelection, - dwMode - ) - ); -} - -// -// IPrintCoreUI2 new methods -// - -// -// Following four helper functions are only supported for UI plugins that fully -// replace core driver's standard UI. They should only be called by the UI plugin's -// DocumentPropertySheets, DevicePropertySheets and their property sheet callback -// functions. -// -// Helper function to retrieve driver's current setting as a list of -// feature/option keyword pairs. -// -_Use_decl_annotations_ -HRESULT __stdcall CUIHelper::GetOptions( - POEMUIOBJ poemuiobj, - DWORD dwFlags, - PCSTR pmszFeaturesRequested, - DWORD cbIn, - PSTR pmszFeatureOptionBuf, - DWORD cbSize, - PDWORD pcbNeeded) -{ - CALL_HELPER2(GetOptions, - (poemuiobj, - dwFlags, - pmszFeaturesRequested, - cbIn, - pmszFeatureOptionBuf, - cbSize, - pcbNeeded - ) - ); -} - -// -// Helper function to change driver's setting using a list of feature/option -// keyword pairs. -// -_Use_decl_annotations_ -HRESULT __stdcall CUIHelper::SetOptions( - POEMUIOBJ poemuiobj, - DWORD dwFlags, - PCSTR pmszFeatureOptionBuf, - DWORD cbIn, - PDWORD pdwResult) -{ - CALL_HELPER2(SetOptions, - (poemuiobj, - dwFlags, - pmszFeatureOptionBuf, - cbIn, - pdwResult - ) - ); -} - -// -// Helper function to retrieve the option(s) of a given feature that are -// constrained in driver's current setting. -// -_Use_decl_annotations_ -HRESULT __stdcall CUIHelper::EnumConstrainedOptions( - POEMUIOBJ poemuiobj, - DWORD dwFlags, - PCSTR pszFeatureKeyword, - PSTR pmszConstrainedOptionList, - DWORD cbSize, - PDWORD pcbNeeded) -{ - CALL_HELPER2(EnumConstrainedOptions, - (poemuiobj, - dwFlags, - pszFeatureKeyword, - pmszConstrainedOptionList, - cbSize, - pcbNeeded - ) - ); -} - -// -// Helper function to retrieve a list of feature/option keyword pairs from -// driver's current setting that conflict with the given feature/option pair. -// -_Use_decl_annotations_ -HRESULT __stdcall CUIHelper::WhyConstrained( - POEMUIOBJ poemuiobj, - DWORD dwFlags, - PCSTR pszFeatureKeyword, - PCSTR pszOptionKeyword, - PSTR pmszReasonList, - DWORD cbSize, - PDWORD pcbNeeded) -{ - CALL_HELPER2(WhyConstrained, - (poemuiobj, - dwFlags, - pszFeatureKeyword, - pszOptionKeyword, - pmszReasonList, - cbSize, - pcbNeeded - ) - ); -} - -// -// Following five helper functions are supported for any UI plugins. -// -// Helper function to retrieve global attribute. -// -_Use_decl_annotations_ -HRESULT __stdcall CUIHelper::GetGlobalAttribute( - POEMUIOBJ poemuiobj, - DWORD dwFlags, - PCSTR pszAttribute, - PDWORD pdwDataType, - PBYTE pbData, - DWORD cbSize, - PDWORD pcbNeeded) -{ - CALL_HELPER2(GetGlobalAttribute, - (poemuiobj, - dwFlags, - pszAttribute, - pdwDataType, - pbData, - cbSize, - pcbNeeded - ) - ); -} - - -// -// Helper function to retrieve attribute of a given feature. -// -_Use_decl_annotations_ -HRESULT __stdcall CUIHelper::GetFeatureAttribute( - POEMUIOBJ poemuiobj, - DWORD dwFlags, - PCSTR pszFeatureKeyword, - PCSTR pszAttribute, - PDWORD pdwDataType, - PBYTE pbData, - DWORD cbSize, - PDWORD pcbNeeded) -{ - CALL_HELPER2(GetFeatureAttribute, - (poemuiobj, - dwFlags, - pszFeatureKeyword, - pszAttribute, - pdwDataType, - pbData, - cbSize, - pcbNeeded - ) - ); -} - -// -// Helper function to retrieve attribute of a given feature/option selection. -// -_Use_decl_annotations_ -HRESULT __stdcall CUIHelper::GetOptionAttribute( - POEMUIOBJ poemuiobj, - DWORD dwFlags, - PCSTR pszFeatureKeyword, - PCSTR pszOptionKeyword, - PCSTR pszAttribute, - PDWORD pdwDataType, - PBYTE pbData, - DWORD cbSize, - PDWORD pcbNeeded) -{ - CALL_HELPER2(GetOptionAttribute, - (poemuiobj, - dwFlags, - pszFeatureKeyword, - pszOptionKeyword, - pszAttribute, - pdwDataType, - pbData, - cbSize, - pcbNeeded - ) - ); -} - -// -// Helper function to retrieve the list of feature keyword. -// -_Use_decl_annotations_ -HRESULT __stdcall CUIHelper::EnumFeatures( - POEMUIOBJ poemuiobj, - DWORD dwFlags, - PSTR pmszFeatureList, - DWORD cbSize, - PDWORD pcbNeeded) -{ - CALL_HELPER2(EnumFeatures, - (poemuiobj, - dwFlags, - pmszFeatureList, - cbSize, - pcbNeeded - ) - ); -} - -// -// Helper function to retrieve the list of options keyword of a given feature. -// -_Use_decl_annotations_ -HRESULT __stdcall CUIHelper::EnumOptions( - POEMUIOBJ poemuiobj, - DWORD dwFlags, - PCSTR pszFeatureKeyword, - PSTR pmszOptionList, - DWORD cbSize, - PDWORD pcbNeeded) -{ - CALL_HELPER2(EnumOptions, - (poemuiobj, - dwFlags, - pszFeatureKeyword, - pmszOptionList, - cbSize, - pcbNeeded - ) - ); -} - -// -// Helper function to query system simulation support -// -_Use_decl_annotations_ -HRESULT __stdcall CUIHelper::QuerySimulationSupport( - HANDLE hPrinter, - DWORD dwLevel, - PBYTE pCaps, - DWORD cbSize, - PDWORD pcbNeeded) -{ - CALL_HELPER2(QuerySimulationSupport, - (hPrinter, - dwLevel, - pCaps, - cbSize, - pcbNeeded - ) - ); -} - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Helper.h b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Helper.h deleted file mode 100644 index 31819dcc..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/Helper.h +++ /dev/null @@ -1,214 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 2001 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Helper.h -// -#pragma once - -class CUIHelper -{ - private: - IUnknown *m_pUIHelper; // pointer to Driver UI's Helper interface - IID m_iidUIHelper; // Driver UI's Helper interface IID - - public: - CUIHelper(); - CUIHelper(const IID &HelperIID, PVOID pHelper); - virtual ~CUIHelper(); - - inline BOOL IsValid() {return NULL != m_pUIHelper;} - - void Assign(const IID &HelperIID, PVOID pHelper); - ULONG Release(); - - // - // IPrintOemDriverUI methods - // - - // - // Helper function to get driver settings. This function is only supported - // for UI plugins that do not fully replace core driver's standard UI. - // - - STDMETHOD(DrvGetDriverSetting) (THIS_ - PVOID pci, - PCSTR Feature, - PVOID pOutput, - DWORD cbSize, - PDWORD pcbNeeded, - PDWORD pdwOptionsReturned - ); - - // - // Helper function to allow OEM plugins upgrade private registry - // settings. This function is supported for any UI plugins and should be - // called only by OEM's UpgradePrinter. - // - - STDMETHOD(DrvUpgradeRegistrySetting) (THIS_ - HANDLE hPrinter, - PCSTR pFeature, - PCSTR pOption - ); - - // - // Helper function to allow OEM plugins to update the driver UI settings. - // This function is only supported for UI plugins that do not fully replace - // core driver's standard UI. It should be called only when the UI is present. - // - - STDMETHOD(DrvUpdateUISetting) (THIS_ - PVOID pci, - PVOID pOptItem, - DWORD dwPreviousSelection, - DWORD dwMode - ); - - // - // IPrintCoreUI2 new methods - // - - // - // Following four helper functions are only supported for UI plugins that fully - // replace core driver's standard UI. They should only be called by the UI plugin's - // DocumentPropertySheets, DevicePropertySheets and their property sheet callback - // functions. - // - // Helper function to retrieve driver's current setting as a list of - // feature/option keyword pairs. - // - - STDMETHOD(GetOptions) (THIS_ - POEMUIOBJ poemuiobj, - _Reserved_ DWORD dwFlags, - _In_reads_bytes_opt_(cbIn) PCSTR pmszFeaturesRequested, - DWORD cbIn, - _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PSTR pmszFeatureOptionBuf, - DWORD cbSize, - _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded); - - // - // Helper function to change driver's setting using a list of feature/option - // keyword pairs. - // - - STDMETHOD(SetOptions) (THIS_ - POEMUIOBJ poemuiobj, - DWORD dwFlags, - _In_reads_bytes_(cbIn) PCSTR pmszFeatureOptionBuf, - DWORD cbIn, - _Out_ PDWORD pdwResult); - - // - // Helper function to retrieve the option(s) of a given feature that are - // constrained in driver's current setting. - // - - STDMETHOD(EnumConstrainedOptions) (THIS_ - _In_ POEMUIOBJ poemuiobj, - _Reserved_ DWORD dwFlags, - _In_ PCSTR pszFeatureKeyword, - _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PSTR pmszConstrainedOptionList, - DWORD cbSize, - _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded); - - - // - // Helper function to retrieve a list of feature/option keyword pairs from - // driver's current setting that conflict with the given feature/option pair. - // - - STDMETHOD(WhyConstrained) (THIS_ - POEMUIOBJ poemuiobj, - _Reserved_ DWORD dwFlags, - _In_ PCSTR pszFeatureKeyword, - _In_ PCSTR pszOptionKeyword, - _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PSTR pmszReasonList, - DWORD cbSize, - _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded); - - // - // Following five helper functions are supported for any UI plugins. - // - // Helper function to retrieve global attribute. - // - - STDMETHOD(GetGlobalAttribute) (THIS_ - POEMUIOBJ poemuiobj, - _Reserved_ DWORD dwFlags, - _In_opt_ PCSTR pszAttribute, - _Out_ PDWORD pdwDataType, - _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PBYTE pbData, - DWORD cbSize, - _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded); - - // - // Helper function to retrieve attribute of a given feature. - // - - STDMETHOD(GetFeatureAttribute) (THIS_ - POEMUIOBJ poemuiobj, - _Reserved_ DWORD dwFlags, - _In_ PCSTR pszFeatureKeyword, - _In_opt_ PCSTR pszAttribute, - _Out_ PDWORD pdwDataType, - _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PBYTE pbData, - DWORD cbSize, - _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded); - - // - // Helper function to retrieve attribute of a given feature/option selection. - // - - STDMETHOD(GetOptionAttribute) (THIS_ - POEMUIOBJ poemuiobj, - _Reserved_ DWORD dwFlags, - _In_ PCSTR pszFeatureKeyword, - _In_ PCSTR pszOptionKeyword, - _In_opt_ PCSTR pszAttribute, - _Out_ PDWORD pdwDataType, - _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PBYTE pbData, - DWORD cbSize, - _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded); - - // - // Helper function to retrieve the list of feature keyword. - // - - STDMETHOD(EnumFeatures) (THIS_ - POEMUIOBJ poemuiobj, - _Reserved_ DWORD dwFlags, - _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PSTR pmszFeatureList, - DWORD cbSize, - _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded); - - // - // Helper function to retrieve the list of options keyword of a given feature. - // - - STDMETHOD(EnumOptions) (THIS_ - POEMUIOBJ poemuiobj, - _Reserved_ DWORD dwFlags, - _In_ PCSTR pszFeatureKeyword, - _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PSTR pmszOptionList, - DWORD cbSize, - _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded); - - // - // Helper function to query system simulation support - // - - STDMETHOD(QuerySimulationSupport) (THIS_ - HANDLE hPrinter, - DWORD dwLevel, - _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PBYTE pCaps, - DWORD cbSize, - _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded); - - private: - void Clear(); -}; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/OEMUI.rc b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/OEMUI.rc deleted file mode 100644 index d68603e1..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/OEMUI.rc +++ /dev/null @@ -1,260 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Written by Windows Printing & Imaging Team" - VALUE "CompanyName", "Microsoft Corp." - VALUE "FileDescription", "PS UI Replacement Sample" - VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "PSUIREP" - VALUE "LegalCopyright", "Copyright 1998 - 2003 Microsoft Corp." - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation" - VALUE "OriginalFilename", "PSUIREP.dll" - VALUE "ProductName", "Microsoft PS UI Replacement Sample" - VALUE "ProductVersion", "1.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_DEVICE_PROPPAGE DIALOG 0, 0, 179, 113 -STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Device Property Page" -FONT 8, "MS Shell Dialog" -BEGIN - LTEXT "OEM UI Added Page",IDC_STATIC,55,14,68,11 - PUSHBUTTON "Calibrate",IDC_CALIBRATE,61,34,50,14 -END - -IDD_DOC_PROPPAGE DIALOG 0, 0, 210, 154 -STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Document Property Page" -FONT 8, "MS Shell Dialog" -BEGIN - LTEXT "OEM UI Document Property Page",IDC_STATIC,60,73,108,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_DEVICE_PROPPAGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 172 - TOPMARGIN, 8 - BOTTOMMARGIN, 106 - END - - IDD_DOC_PROPPAGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 147 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_SECTION "OEM UI Added Item" - IDS_CALIBRATED "Printer has been calibrated." - IDS_NAME "OEM UI Customization DLL" - IDS_DEVICE_SETTINGS_NAME "Device Settings" - IDS_CONSTRAINT_CONFLICT "Ther are one or more conflicting settings.\r\nOne of the conflicting is:\r\n\t%1: %2\r\n\t%3: %4\r\n\r\nDo you want driver to automatically resolve conflict?" - IDS_DEV_SECTION "Device Settings OEM UI Added Item" - IDS_ADV_SECTION "Advanced OEM UI Added Item" -END - -STRINGTABLE -BEGIN - IDS_POSTSCRIPT_VM "Available PostScript Memory" - IDS_KBYTES "KB" - IDS_SECONDS "seconds" - IDS_PSTIMEOUTS "PostScript Timeout Values" - IDS_JOBTIMEOUT "Job Timeout" - IDS_WAITTIMEOUT "Wait Timeout" - IDS_PRINTER_DEFAULT "Use Current Setting in the Printer" - IDS_INSTALLABLE_OPTIONS "Installable Options" - IDS_DOWNLOAD_AS_SOFTFONT "" - IDS_USE_DEVFONTS "Use Device Fonts?" - IDS_FONTSUB_OPTION "Font Substitution" - IDS_FONTSUB_DEFAULT "Normal" - IDS_FONTSUB_SLOW "Slow but more accurate" - IDS_FONTSUB_TABLE "Font Substitution Table" - IDS_DEFAULT_TRAY " / Default tray" - IDS_DRAW_ONLY_FROM_SELECTED "Draw selected form only from this tray" -END - -STRINGTABLE -BEGIN - IDS_RESTORE_DEFAULTS "&Restore Defaults" - IDS_PRINTER_FEATURES "Printer Features" - IDS_METAFILE_SPOOLING "Advanced Printing Features" - IDS_ENABLED "&Enabled" - IDS_DISABLED "&Disabled" - IDS_PSOPTIONS "PostScript Options" - IDS_MIRROR "Mirrored Output" - IDS_NEGATIVE_PRINT "Negative Output" - IDS_PAGEINDEP "Page Independence" - IDS_COMPRESSBMP "Compress bitmaps" - IDS_CTRLD_BEFORE "Send CTRL-D Before Each Job" - IDS_CTRLD_AFTER "Send CTRL-D After Each Job" - IDS_JOB_CONTROL "Generate Job Control Code" - IDS_TEXT_ASGRX "Print Optimizations" -END - -STRINGTABLE -BEGIN - IDS_TRUE_GRAY_TEXT "Convert Gray Text to PostScript Gray" - IDS_TRUE_GRAY_GRAPH "Convert Gray Graphics to PostScript Gray" - IDS_ADD_EURO "Add Euro Currency Symbol to PostScript Fonts" -END - -STRINGTABLE -BEGIN - IDS_PAGE_PROTECTION "Page Protection" - IDS_CANCEL_CONFLICT "Restore my previous settings" - IDS_IGNORE_CONFLICT "Keep this setting, and I will change it later" - IDS_RESOLVE_CONFLICT "Resolve this conflict for me automatically" - IDS_DRIVERUI_COLORMODE "Color Mode Option" - IDS_ENVELOPE "Envelope" - IDS_ENV_PREFIX "Env" - IDS_PSPROTOCOL "Output Protocol" - IDS_PSPROTOCOL_ASCII "ASCII" - IDS_PSPROTOCOL_BCP "BCP" - IDS_PSPROTOCOL_TBCP "TBCP" - IDS_PSPROTOCOL_BINARY "Binary" - IDS_TRAY_FORMSOURCE "Automatically Select" - IDS_OEMERR_DLGTITLE "OEM Customization Module Failed" - IDS_OEMERR_OPTITEM "Couldn't add custom items from OEM customization module '%s'.\n\nPlease contact its vendor for support." -END - -STRINGTABLE -BEGIN - IDS_OEMERR_PROPSHEET "Couldn't add custom property sheet pages from OEM customization module '%s'.\n\nPlease contact its vendor for support." - IDS_CANCEL_CONFLICT_FINAL "I will resolve the conflict for myself" - IDS_PSERROR_HANDLER "Send PostScript Error Handler" - IDS_PSMINOUTLINE "Minimum Font Size to Download as Outline" - IDS_PSMAXBITMAP "Maximum Font Size to Download as Bitmap" - IDS_PIXELS "pixel(s)" - IDS_PSOUTPUT_OPTION "PostScript Output Option" - IDS_PSOPT_SPEED "Optimize for Speed" - IDS_PSOPT_PORTABILITY "Optimize for Portability" - IDS_PSOPT_EPS "Encapsulated PostScript (EPS)" - IDS_PSOPT_ARCHIVE "Archive Format" - IDS_PSTT_DLFORMAT "TrueType Font Download Option" - IDS_TTDL_DEFAULT "Automatic" - IDS_TTDL_TYPE1 "Outline" - IDS_TTDL_TYPE3 "Bitmap" - IDS_TTDL_TYPE42 "Native TrueType" -END - -STRINGTABLE -BEGIN - IDS_PSLEVEL "PostScript Language Level" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/PSUIREP.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/PSUIREP.vcxproj deleted file mode 100644 index a8816083..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/PSUIREP.vcxproj +++ /dev/null @@ -1,1066 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {5D63CD51-110C-41B7-B8B0-6AB27398690B} - $(MSBuildProjectName) - Win10 Debug - Win32 - {50E3486C-DFB5-4447-A055-55B51DE6A08C} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - PSUIREP - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - PSUIREP.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/PSUIREP.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/PSUIREP.vcxproj.Filters deleted file mode 100644 index a7adcd57..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/PSUIREP.vcxproj.Filters +++ /dev/null @@ -1,397 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {34758E7D-B1F9-45D1-BF4C-84952A011FD8} - - - h;hpp;hxx;hm;inl;inc;xsd - {5FBB97F9-5E07-46FA-9D57-352EF01D247C} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {B3D9DA9C-3DC0-474A-8E98-121243DA58B3} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/StringUtils.cpp b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/StringUtils.cpp deleted file mode 100644 index 01690f07..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/StringUtils.cpp +++ /dev/null @@ -1,315 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 2001 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: StringUtils.cpp -// -// PURPOSE: Implementation wrapper class for WinXP PS Driver Features and Options. -// - - -#include "precomp.h" -#include "debug.h" -#include "devmode.h" -#include "globals.h" -#include "helper.h" -#include "features.h" -#include "oemui.h" -#include "stringutils.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -// Create a list of pointers to the strings -// in a multi-sz. -_Use_decl_annotations_ -HRESULT MakeStrPtrList(HANDLE hHeap, PCSTR pmszMultiSz, PCSTR **pppszList, PWORD pwCount) -{ - PCSTR *ppszList = NULL; - HRESULT hrResult = S_OK; - - - // Validate parameters - if( (NULL == hHeap) - || - (NULL == pmszMultiSz) - || - (NULL == pppszList) - || - (NULL == pwCount) - ) - { - return E_INVALIDARG; - } - - // Get the count of strings in the multi-sz. - *pwCount = mstrcount(pmszMultiSz); - if(0 == *pwCount) - { - WARNING(DLLTEXT("MakeStrPtrList() pmszMultiSz contains no strings.\r\n")); - - *pppszList = NULL; - - goto Exit; - } - - // Allocate pointer list. - *pppszList = (PCSTR *) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, (*pwCount) * sizeof(PCSTR)); - if(NULL == *pppszList) - { - ERR(ERRORTEXT("MakeStrPtrList() failed to allote array of PCSTR.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - ppszList = *pppszList; - - // Walk multi-sz mapping string pointers. - for(WORD wIndex = 0; wIndex < *pwCount; ++wIndex) - { - ppszList[wIndex] = pmszMultiSz; - pmszMultiSz += strlen(pmszMultiSz) + 1; - } - - -Exit: - - return hrResult; -} - - -// Determine how many strings are in the multi-sz. -WORD mstrcount(PCSTR pmszMultiSz) -{ - WORD wCount = 0; - - - // NULL string pointers have no strings. - if(NULL == pmszMultiSz) - { - return 0; - } - - // Walk list of strings counting them. - while(pmszMultiSz[0] != '\0') - { - ++wCount; - pmszMultiSz += strlen(pmszMultiSz) + 1; - } - - return wCount; -} - -// Allocates and converts ANSI string to Unicode. -PWSTR MakeUnicodeString(HANDLE hHeap, PCSTR pszAnsi) -{ - int nSize = 0; - PWSTR pszUnicode = NULL; - - - // Validate parameters - if( (NULL == hHeap) - || - (NULL == pszAnsi) - ) - { - return NULL; - } - - // Get the size needed for UNICODE string. - nSize = MultiByteToWideChar(CP_ACP, 0, pszAnsi, -1, NULL, 0); - if(0 != nSize) - { - // Allocate unicode string. - pszUnicode = (PWSTR) HeapAlloc(hHeap, 0, nSize * sizeof(WCHAR)); - if(NULL != pszUnicode) - { - // Convert ANSI to Unicode - nSize = MultiByteToWideChar(CP_ACP, 0, pszAnsi, -1, pszUnicode, nSize); - if(0 == nSize) - { - // INVARIANT: failed to convert. - - // free buffer and return NULL. - HeapFree(hHeap, 0, pszUnicode); - pszUnicode = NULL; - } - } - } - - return pszUnicode; -} - -// Allocates and copies source string. -PWSTR MakeStringCopy(HANDLE hHeap, PCWSTR pszSource) -{ - PWSTR pszCopy = NULL; - DWORD dwSize; - - - // Validate parameters - if( (NULL == hHeap) - || - (NULL == pszSource) - ) - { - return NULL; - } - - // Allocate memory for string duplication, and duplicate the string. - dwSize = (DWORD)(wcslen(pszSource) + 1) * sizeof(WCHAR); - pszCopy = (PWSTR) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, dwSize); - if(NULL != pszCopy) - { - HRESULT hResult; - - - hResult = StringCbCopyW(pszCopy, dwSize, pszSource); - if(FAILED(hResult)) - { - HeapFree(hHeap, 0, pszCopy); - pszCopy = NULL; - SetLastError(hResult); - } - } - - return pszCopy; -} - -// Allocates and copies source string. -PSTR MakeStringCopy(HANDLE hHeap, PCSTR pszSource) -{ - PSTR pszCopy = NULL; - size_t dwSize; - - - // Validate parameters - if( (NULL == hHeap) - || - (NULL == pszSource) - ) - { - return NULL; - } - - // Allocate memory for string duplication, and duplicate the string. - dwSize = (strlen(pszSource) + 1) * sizeof(CHAR); - pszCopy = (PSTR) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, dwSize); - if(NULL != pszCopy) - { - HRESULT hResult; - - hResult = StringCbCopyA(pszCopy, dwSize, pszSource); - if(FAILED(hResult)) - { - HeapFree(hHeap, 0, pszCopy); - pszCopy = NULL; - SetLastError(hResult); - } - } - - return pszCopy; -} - -// Frees list of strings. -// NOTE: don't use this for string list made with MakeStrPtrList(), since -// the strings pointed to be list made with MakeStrPtrList() will -// be freed when the multi-sz is freed. -void FreeStringList(HANDLE hHeap, _In_reads_(wCount) PWSTR *ppszList, WORD wCount) -{ - // Validate parameters. - if( (NULL == hHeap) - || - (NULL == ppszList) - ) - { - return; - } - - // Free each of the strings in the list. - for(WORD wIndex = 0; wIndex < wCount; ++wIndex) - { - if(NULL != ppszList[wIndex]) HeapFree(hHeap, 0, ppszList[wIndex]); - } - - // Free list. - HeapFree(hHeap, 0, ppszList); -} - - -// Retrieves pointer to a String resource. -HRESULT GetStringResource(HANDLE hHeap, HMODULE hModule, UINT uResource, _Outptr_result_maybenull_ PWSTR *ppszString) -{ - int nResult; - DWORD dwSize = MAX_PATH; - PWSTR pszString = NULL; - HRESULT hrResult = S_OK; - - - VERBOSE(DLLTEXT("GetStringResource(%#x, %#x, %d) entered.\r\n"), hHeap, hModule, uResource); - - // Validate parameters. - if( (NULL == hHeap) - || - (NULL == ppszString) - ) - { - return E_INVALIDARG; - } - - // Allocate buffer for string resource from heap; let the driver clean it up. - pszString = (PWSTR) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, dwSize * sizeof(WCHAR)); - if(NULL == pszString) - { - ERR(ERRORTEXT("GetStringResource() failed to allocate string buffer!\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Load string resource; resize after loading so as not to waste memory. - nResult = LoadString(hModule, uResource, pszString, dwSize); - if(nResult > 0) - { - PWSTR pszTemp; - - - VERBOSE(DLLTEXT("LoadString() returned %d!\r\n"), nResult); - VERBOSE(DLLTEXT("String load was \"%s\".\r\n"), pszString); - - pszTemp = (PWSTR) HeapReAlloc(hHeap, HEAP_ZERO_MEMORY, pszString, (nResult + 1) * sizeof(WCHAR)); - if(NULL != pszTemp) - { - pszString = pszTemp; - } - else - { - WARNING(DLLTEXT("GetStringResource() HeapReAlloc() of string retrieved failed! (Last Error was %d)\r\n"), GetLastError()); - } - } - else - { - DWORD dwError = GetLastError(); - - - ERR(ERRORTEXT("LoadString() returned %d! (Last Error was %d)\r\n"), nResult, GetLastError()); - ERR(ERRORTEXT("GetStringResource() failed to load string resource %d!\r\n"), uResource); - - HeapFree(hHeap, 0, pszString); - pszString = NULL; - hrResult = HRESULT_FROM_WIN32(dwError); - } - - -Exit: - - // Save string pointer to caller. - // NOTE: string pointer will be NULL on failure. - *ppszString = pszString; - - return hrResult; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/StringUtils.h b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/StringUtils.h deleted file mode 100644 index 35de69f2..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/StringUtils.h +++ /dev/null @@ -1,23 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 2001 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: StringUtils.h -// -// PURPOSE: Header file for string utility routines. -// -#pragma once - -//////////////////////////////////////////////////////// -// Prototypes -//////////////////////////////////////////////////////// -_Success_(return >= 0 && *pwCount > 0) HRESULT MakeStrPtrList(HANDLE hHeap, PCSTR pmszMultiSz, _Outptr_result_buffer_(*pwCount) PCSTR **pppszList, _Out_ PWORD pwCount); -WORD mstrcount(PCSTR pmszMultiSz); -PWSTR MakeUnicodeString(HANDLE hHeap, PCSTR pszAnsi); -PWSTR MakeStringCopy(HANDLE hHeap, PCWSTR pszSource); -PSTR MakeStringCopy(HANDLE hHeap, PCSTR pszSource); -void FreeStringList(HANDLE hHeap, _In_reads_(wCount) PWSTR *ppszList, WORD wCount); -HRESULT GetStringResource(HANDLE hHeap, HMODULE hModule, UINT uResource, _Outptr_result_maybenull_ PWSTR *ppszString); diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/debug.cpp b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/debug.cpp deleted file mode 100644 index f7a3d842..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/debug.cpp +++ /dev/null @@ -1,405 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.cpp -// -// PURPOSE: Debug functions. -// -// - -#include "precomp.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// INTERNAL DEFINES -//////////////////////////////////////////////////////// - -#define DEBUG_BUFFER_SIZE 1024 -#define PATH_SEPARATOR '\\' -#define MAX_LOOP 10 - -// Determine what level of debugging messages to eject. -#ifdef VERBOSE_MSG - #define DEBUG_LEVEL DBG_VERBOSE -#elif TERSE_MSG - #define DEBUG_LEVEL DBG_TERSE -#elif WARNING_MSG - #define DEBUG_LEVEL DBG_WARNING -#elif ERROR_MSG - #define DEBUG_LEVEL DBG_ERROR -#elif RIP_MSG - #define DEBUG_LEVEL DBG_RIP -#elif NO_DBG_MSG - #define DEBUG_LEVEL DBG_NONE -#else - #define DEBUG_LEVEL DBG_WARNING -#endif - - - -//////////////////////////////////////////////////////// -// EXTERNAL GLOBALS -//////////////////////////////////////////////////////// - -INT giDebugLevel = DEBUG_LEVEL; - - - - -//////////////////////////////////////////////////////// -// INTERNAL PROTOTYPES -//////////////////////////////////////////////////////// - -static BOOL DebugMessageV(LPCSTR lpszMessage, va_list arglist); -static BOOL DebugMessageV(DWORD dwSize, LPCWSTR lpszMessage, va_list arglist); - - - - -////////////////////////////////////////////////////////////////////////// -// Function: DebugMessageV -// -// Description: Outputs variable argument debug string. -// -// -// Parameters: -// -// dwSize Size of temp buffer to hold formated string. -// -// lpszMessage Format string. -// -// arglist Variable argument list.. -// -// -// Returns: -// -// -// Comments: -// -// -////////////////////////////////////////////////////////////////////////// - -static BOOL DebugMessageV(LPCSTR lpszMessage, va_list arglist) -{ - DWORD dwSize = DEBUG_BUFFER_SIZE; - DWORD dwLoop = 0; - LPSTR lpszMsgBuf = NULL; - HRESULT hr; - - - // Parameter checking. - if( (NULL == lpszMessage) - || - (0 == dwSize) - ) - { - return FALSE; - } - - do - { - // Allocate memory for message buffer. - if(NULL != lpszMsgBuf) - { - delete[] lpszMsgBuf; - dwSize *= 2; - } - lpszMsgBuf = new CHAR[dwSize + 1]; - if(NULL == lpszMsgBuf) - { - return FALSE; - } - - hr = StringCbVPrintfA(lpszMsgBuf, (dwSize + 1) * sizeof(CHAR), lpszMessage, arglist); - - // Pass the variable parameters to wvsprintf to be formated. - } while (FAILED(hr) && (STRSAFE_E_INSUFFICIENT_BUFFER == hr) && (++dwLoop < MAX_LOOP) ); - - // Dump string to Debug output. - OutputDebugStringA(lpszMsgBuf); - - // Cleanup. - delete[] lpszMsgBuf; - - return SUCCEEDED(hr); -} - - -////////////////////////////////////////////////////////////////////////// -// Function: DebugMessageV -// -// Description: Outputs variable argument debug string. -// -// -// Parameters: -// -// dwSize Size of temp buffer to hold formated string. -// -// lpszMessage Format string. -// -// arglist Variable argument list.. -// -// -// Returns: -// -// -// Comments: -// -// -////////////////////////////////////////////////////////////////////////// - -static BOOL DebugMessageV(DWORD dwSize, LPCWSTR lpszMessage, va_list arglist) -{ - LPWSTR lpszMsgBuf; - HRESULT hResult; - - - // Parameter checking. - if( (NULL == lpszMessage) - || - (0 == dwSize) - ) - { - return FALSE; - } - - // Allocate memory for message buffer. - lpszMsgBuf = new WCHAR[dwSize + 1]; - if(NULL == lpszMsgBuf) - return FALSE; - - // Pass the variable parameters to wvsprintf to be formated. - hResult = StringCbVPrintfW(lpszMsgBuf, (dwSize + 1) * sizeof(WCHAR), lpszMessage, arglist); - - // Dump string to debug output. - OutputDebugStringW(lpszMsgBuf); - - // Clean up. - delete[] lpszMsgBuf; - - return SUCCEEDED(hResult); -} - - -////////////////////////////////////////////////////////////////////////// -// Function: DebugMessage -// -// Description: Outputs variable argument debug string. -// -// -// Parameters: -// -// lpszMessage Format string. -// -// -// Returns: -// -// -// Comments: -// -// -////////////////////////////////////////////////////////////////////////// - -BOOL DebugMessage(LPCSTR lpszMessage, ...) -{ - BOOL bResult; - va_list VAList; - - - // Pass the variable parameters to DebugMessageV for processing. - va_start(VAList, lpszMessage); - bResult = DebugMessageV(lpszMessage, VAList); - va_end(VAList); - - return bResult; -} - - -////////////////////////////////////////////////////////////////////////// -// Function: DebugMessage -// -// Description: Outputs variable argument debug string. -// -// -// Parameters: -// -// lpszMessage Format string. -// -// -// Returns: -// -// -// Comments: -// -// -////////////////////////////////////////////////////////////////////////// - -BOOL DebugMessage(LPCWSTR lpszMessage, ...) -{ - BOOL bResult; - va_list VAList; - - - // Pass the variable parameters to DebugMessageV to be processed. - va_start(VAList, lpszMessage); - bResult = DebugMessageV(MAX_PATH, lpszMessage, VAList); - va_end(VAList); - - return bResult; -} - -void Dump(PPUBLISHERINFO pPublisherInfo) -{ - VERBOSE(TEXT("pPublisherInfo:\r\n")); - if(NULL == pPublisherInfo) - { - VERBOSE(TEXT("\tpPublisherInfo is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\tdwMode = %#x\r\n"), pPublisherInfo->dwMode); - VERBOSE(TEXT("\twMinoutlinePPEM = %d\r\n"), pPublisherInfo->wMinoutlinePPEM); - VERBOSE(TEXT("\twMaxbitmapPPEM = %d\r\n"), pPublisherInfo->wMaxbitmapPPEM); -} - -void Dump(POEMDMPARAM pOemDMParam) -{ - VERBOSE(TEXT("pOemDMParam:\r\n")); - if(NULL == pOemDMParam) - { - VERBOSE(TEXT("\tpOemDMParam is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\tcbSize = %d\r\n"), pOemDMParam->cbSize); - VERBOSE(TEXT("\tpdriverobj = %#x\r\n"), pOemDMParam->pdriverobj); - VERBOSE(TEXT("\thPrinter = %#x\r\n"), pOemDMParam->hPrinter); - VERBOSE(TEXT("\thModule = %#x\r\n"), pOemDMParam->hModule); - VERBOSE(TEXT("\tpPublicDMIn = %#x\r\n"), pOemDMParam->pPublicDMIn); - VERBOSE(TEXT("\tpPublicDMOut = %#x\r\n"), pOemDMParam->pPublicDMOut); - VERBOSE(TEXT("\tpOEMDMIn = %#x\r\n"), pOemDMParam->pOEMDMIn); - VERBOSE(TEXT("\tpOEMDMOut = %#x\r\n"), pOemDMParam->pOEMDMOut); - VERBOSE(TEXT("\tcbBufSize = %d\r\n"), pOemDMParam->cbBufSize); -} - -void Dump(PPROPSHEETUI_INFO pPSUIInfo) -{ - VERBOSE(TEXT("pPSUIInfo:\r\n")); - if(NULL == pPSUIInfo) - { - VERBOSE(TEXT("\tpPSUIInfo is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\tcbSize = %d\r\n"), pPSUIInfo->cbSize); - VERBOSE(TEXT("\tVersion = %#x\r\n"), pPSUIInfo->Version); - VERBOSE(TEXT("\tFlags = %#x\r\n"), pPSUIInfo->Flags); - VERBOSE(TEXT("\tReason = %d\r\n"), pPSUIInfo->Reason); - VERBOSE(TEXT("\thComPropSheet = %#x\r\n"), pPSUIInfo->hComPropSheet); - VERBOSE(TEXT("\tpfnComPropSheet = %#x\r\n"), pPSUIInfo->pfnComPropSheet); - VERBOSE(TEXT("\tlParamInit = %#x\r\n"), pPSUIInfo->lParamInit); - VERBOSE(TEXT("\tUserData = %#x\r\n"), pPSUIInfo->UserData); - VERBOSE(TEXT("\tResult = %#x\r\n"), pPSUIInfo->Result); -} - -void Dump(POPTITEM pOptItem) -{ - VERBOSE(TEXT("pOptItem:\r\n")); - if(NULL == pOptItem) - { - VERBOSE(TEXT("\tpOptItem is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\tcbSize = %d\r\n"), pOptItem->cbSize); - VERBOSE(TEXT("\tLevel = %d\r\n"), pOptItem->Level); - VERBOSE(TEXT("\tDlgPageIdx = %d\r\n"), pOptItem->DlgPageIdx); - VERBOSE(TEXT("\tFlags = 0x%x\r\n"), pOptItem->Flags); - VERBOSE(TEXT("\tUserData = 0x%p\r\n"), pOptItem->UserData); - VERBOSE(TEXT("\tpName = %s\r\n"), pOptItem->pName ? pOptItem->pName : TEXT("")); - VERBOSE(TEXT("\tpSel = 0x%p\r\n"), pOptItem->pSel); - VERBOSE(TEXT("\tpExtChkBox = 0x%p\r\n"), pOptItem->pExtChkBox); - VERBOSE(TEXT("\tpExtChkBox = 0x%p\r\n"), pOptItem->pExtChkBox); - VERBOSE(TEXT("\tHelpIndex = 0x%x\r\n"), pOptItem->HelpIndex); - VERBOSE(TEXT("\tDMPubID = 0x%x\r\n"), pOptItem->DMPubID); - VERBOSE(TEXT("\tUserItemID = 0x%x\r\n"), pOptItem->UserItemID); - VERBOSE(TEXT("\twReserved = 0x%x\r\n"), pOptItem->wReserved); - VERBOSE(TEXT("\tpOIExt = 0x%p\r\n"), pOptItem->pOIExt); - - Dump(pOptItem->pOptType); -} - -void Dump(POPTTYPE pOptType) -{ - VERBOSE(TEXT("\tpOptType:\r\n")); - if(NULL == pOptType) - { - VERBOSE(TEXT("\t\tpOptType is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\t\tcbSize = %d\r\n"), pOptType->cbSize); - VERBOSE(TEXT("\t\tType = 0x%x\r\n"), pOptType->Type); - VERBOSE(TEXT("\t\tFlags = 0x%x\r\n"), pOptType->Flags); - VERBOSE(TEXT("\t\tCount = %d\r\n"), pOptType->Count); - VERBOSE(TEXT("\t\tCount = 0x%x\r\n"), pOptType->BegCtrlID); - VERBOSE(TEXT("\t\tStyle = 0x%x\r\n"), pOptType->Style); - - Dump(pOptType->pOptParam, pOptType->Count); -} - -void Dump(POPTPARAM pOptParam, WORD wCount) -{ - if(NULL == pOptParam) - { - VERBOSE(TEXT("\t\tpOptParam is NULL!\r\n")); - return; - } - - for(WORD wIndex = 0; wIndex < wCount; ++wIndex) - { - VERBOSE(TEXT("\t\tpOptParam[wIndex]:\r\n")); - VERBOSE(TEXT("\t\t\tcbSize = %d\r\n"), pOptParam[wIndex].cbSize); - VERBOSE(TEXT("\t\t\tFlags = 0x%x\r\n"), pOptParam[wIndex].Flags); - VERBOSE(TEXT("\t\t\tStyle = 0x%x\r\n"), pOptParam[wIndex].Style); - VERBOSE(TEXT("\t\t\tpData = 0x%p\r\n"), pOptParam[wIndex].pData); - VERBOSE(TEXT("\t\t\tIconID = 0x%p\r\n"), pOptParam[wIndex].IconID); - VERBOSE(TEXT("\t\t\tlParam = 0x%p\r\n"), pOptParam[wIndex].lParam); - } -} - - -PCSTR -StripDirPrefixA( - IN PCSTR pstrFilename - ) - -/*++ - -Routine Description: - - Strip the directory prefix off a filename (ANSI version) - -Arguments: - - pstrFilename - Pointer to filename string - -Return Value: - - Pointer to the last component of a filename (without directory prefix) - ---*/ - -{ - PCSTR pstr; - - pstr = strrchr(pstrFilename, PATH_SEPARATOR); - if (pstr) - return pstr + 1; - - return pstrFilename; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/debug.h b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/debug.h deleted file mode 100644 index b4d57b0b..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/debug.h +++ /dev/null @@ -1,166 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.H -// -// -// PURPOSE: Define common data types, and external function prototypes -// for debugging functions. -// -// - -#pragma once - -// VC and Build use different debug defines. -// The following makes it so either will -// cause the inclusion of debugging code. -#if !defined(_DEBUG) && defined(DBG) - #define _DEBUG DBG -#elif defined(_DEBUG) && !defined(DBG) - #define DBG _DEBUG -#endif - - - -///////////////////////////////////////////////////////// -// Macros -///////////////////////////////////////////////////////// - -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// VERBOSE(msg) -// Display a message if the current debug level is <= DBG_VERBOSE. -// -// TERSE(msg) -// Display a message if the current debug level is <= DBG_TERSE. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// ASSERTMSG(cond, msg) -// Verify a condition is true. If not, display a message and -// force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// These macros require extra parantheses for the msg argument -// example, ASSERTMSG(x > 0, ("x is less than 0\n")); -// WARNING(("App passed NULL pointer, ignoring...\n")); -// - -#define DBG_VERBOSE 1 -#define DBG_TERSE 2 -#define DBG_WARNING 3 -#define DBG_ERROR 4 -#define DBG_RIP 5 -#define DBG_NONE 6 - -#if DBG - - #define DebugMsg DebugMessage - - // - // Strip the directory prefix from a filename (ANSI version) - // - - PCSTR - StripDirPrefixA( - IN PCSTR pstrFilename - ); - - extern INT giDebugLevel; - - - #define DBGMSG(level, prefix, msg) { \ - if (giDebugLevel <= (level)) { \ - DebugMsg("%s %s (%d): ", prefix, StripDirPrefixA(__FILE__), __LINE__); \ - DebugMsg(msg); \ - } \ - } - - #define DBGPRINT(level, msg) { \ - if (giDebugLevel <= (level)) { \ - DebugMsg(msg); \ - } \ - } - - #define VERBOSE if(giDebugLevel <= DBG_VERBOSE) DebugMsg - #define TERSE if(giDebugLevel <= DBG_TERSE) DebugMsg - #define WARNING if(giDebugLevel <= DBG_WARNING) DebugMsg - #define ERR if(giDebugLevel <= DBG_ERROR) DebugMsg - - #define ASSERT(cond) { \ - if (! (cond)) { \ - RIP(("\n")); \ - } \ - } - - #define ASSERTMSG(cond, msg) { \ - if (! (cond)) { \ - RIP(msg); \ - } \ - } - - #define RIP(msg) { \ - DBGMSG(DBG_RIP, "RIP", msg); \ - DebugBreak(); \ - } - - -#else // !DBG - - #define DebugMsg NOP_FUNCTION - - #define VERBOSE NOP_FUNCTION - #define TERSE NOP_FUNCTION - #define WARNING NOP_FUNCTION - #define ERR NOP_FUNCTION - - #define ASSERT(cond) - - #define ASSERTMSG(cond, msg) - #define RIP(msg) - #define DBGMSG(level, prefix, msg) - #define DBGPRINT(level, msg) - -#endif - - - - -///////////////////////////////////////////////////////// -// ProtoTypes -///////////////////////////////////////////////////////// - -BOOL DebugMessage(LPCSTR, ...); -BOOL DebugMessage(LPCWSTR, ...); -void Dump(PPUBLISHERINFO pPublisherInfo); -void Dump(POEMDMPARAM pOemDMParam); -void Dump(PPROPSHEETUI_INFO pPSUIInfo); -void Dump(POPTITEM pOptItem); -void Dump(POPTTYPE pOptType); -void Dump(POPTPARAM pOptParam, WORD wCount); - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/devmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/devmode.cpp deleted file mode 100644 index 43da0361..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/devmode.cpp +++ /dev/null @@ -1,193 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.cpp -// -// PURPOSE: Implementation of Devmode functions shared with OEM UI and OEM rendering modules. -// - -#include "precomp.h" - -#include "debug.h" -#include "globals.h" -#include "devmode.h" -#include "helper.h" -#include "features.h" -#include "oemui.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam) -{ - POEMDEV pOEMDevIn; - POEMDEV pOEMDevOut; - - - // Verify parameters. - if( (NULL == pOemDMParam) - || - ( (OEMDM_SIZE != dwMode) - && - (OEMDM_DEFAULT != dwMode) - && - (OEMDM_CONVERT != dwMode) - && - (OEMDM_MERGE != dwMode) - ) - ) - { - ERR(ERRORTEXT("DevMode() ERROR_INVALID_PARAMETER.\r\n")); - VERBOSE(DLLTEXT("\tdwMode = %d, pOemDMParam = %#lx.\r\n"), dwMode, pOemDMParam); - - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Cast generic (i.e. PVOID) to OEM private devomode pointer type. - pOEMDevIn = (POEMDEV) pOemDMParam->pOEMDMIn; - pOEMDevOut = (POEMDEV) pOemDMParam->pOEMDMOut; - - switch(dwMode) - { - case OEMDM_SIZE: - pOemDMParam->cbBufSize = sizeof(OEMDEV); - break; - - case OEMDM_DEFAULT: - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - VERBOSE(DLLTEXT("pOEMDevOut after setting default values:\r\n")); - Dump(pOEMDevOut); - break; - - case OEMDM_CONVERT: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut, pOemDMParam->cbBufSize); - break; - - case OEMDM_MERGE: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut, pOemDMParam->cbBufSize); - MakeOEMDevmodeValid(pOEMDevOut); - break; - } - Dump(pOemDMParam); - - return S_OK; -} - - -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut, DWORD dwSize) -{ - if( (NULL == pOEMDevIn) - || - (NULL == pOEMDevOut) - || - (dwSize < sizeof(OEMDEV)) - ) - { - ERR(ERRORTEXT("ConvertOEMDevmode() invalid parameters.\r\n")); - return FALSE; - } - - // Check OEM Signature, if it doesn't match ours, - // then just assume DMIn is bad and use defaults. - if(pOEMDevIn->dmOEMExtra.dwSignature == pOEMDevOut->dmOEMExtra.dwSignature) - { - VERBOSE(DLLTEXT("Converting private OEM Devmode.\r\n")); - VERBOSE(DLLTEXT("pOEMDevIn:\r\n")); - Dump(pOEMDevIn); - - // Set the devmode defaults so that anything the isn't copied over will - // be set to the default value. - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - - // Copy the old structure in to the new using which ever size is the smaller. - // Devmode maybe from newer Devmode (not likely since there is only one), or - // Devmode maybe a newer Devmode, in which case it maybe larger, - // but the first part of the structure should be the same. - - // DESIGN ASSUMPTION: the private DEVMODE structure only gets added to; - // the fields that are in the DEVMODE never change only new fields get added to the end. - - memcpy(pOEMDevOut, pOEMDevIn, __min(dwSize, __min(pOEMDevOut->dmOEMExtra.dwSize, pOEMDevIn->dmOEMExtra.dwSize))); - - // Re-fill in the size and version fields to indicated - // that the DEVMODE is the current private DEVMODE version. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - } - else - { - WARNING(DLLTEXT("Unknown DEVMODE signature, pOEMDMIn ignored.\r\n")); - - // Don't know what the input DEVMODE is, so just use defaults. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - } - - return TRUE; -} - - -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode) -{ - if(NULL == pOEMDevmode) - { - return FALSE; - } - - // ASSUMPTION: pOEMDevmode is large enough to contain OEMDEV structure. - - // Make sure that dmOEMExtra indicates the current OEMDEV structure. - pOEMDevmode->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevmode->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevmode->dmOEMExtra.dwVersion = OEM_VERSION; - - // Set driver data, if not valid. - if(pOEMDevmode->dwDriverData > 100) - { - pOEMDevmode->dwDriverData = 0; - } - - // Set Advanced driver data, if not valid. - if(pOEMDevmode->dwAdvancedData > 100) - { - pOEMDevmode->dwAdvancedData = 0; - } - - return TRUE; -} - - -void Dump(PCOEMDEV pOEMDevmode) -{ - if( (NULL != pOEMDevmode) - && - (pOEMDevmode->dmOEMExtra.dwSize >= sizeof(OEMDEV)) - && - (OEM_SIGNATURE == pOEMDevmode->dmOEMExtra.dwSignature) - ) - { - VERBOSE(TEXT("\tdmOEMExtra.dwSize = %d\r\n"), pOEMDevmode->dmOEMExtra.dwSize); - VERBOSE(TEXT("\tdmOEMExtra.dwSignature = %#x\r\n"), pOEMDevmode->dmOEMExtra.dwSignature); - VERBOSE(TEXT("\tdmOEMExtra.dwVersion = %#x\r\n"), pOEMDevmode->dmOEMExtra.dwVersion); - VERBOSE(TEXT("\tdwDriverData = %#x\r\n"), pOEMDevmode->dwDriverData); - VERBOSE(TEXT("\tdwAdvancedData = %#x\r\n"), pOEMDevmode->dwAdvancedData); - } - else - { - ERR(ERRORTEXT("Dump(POEMDEV) unknown private OEM DEVMODE.\r\n")); - } -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/devmode.h b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/devmode.h deleted file mode 100644 index 83202d6a..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/devmode.h +++ /dev/null @@ -1,56 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.h -// -// -// PURPOSE: Define common data types, and external function prototypes -// for devmode functions. -// -#pragma once - -//////////////////////////////////////////////////////// -// OEM Devmode Defines -//////////////////////////////////////////////////////// - - - - -//////////////////////////////////////////////////////// -// OEM Devmode Type Definitions -//////////////////////////////////////////////////////// - -// -//Can add info to the private devmode bellow here. -//Note : -// This structure must be prefixed by OEM_DMEXTRAHEADER -// Your plug-in must implement the IPrintOemUI::DevMode method -// -typedef struct tagOEMDEV -{ - OEM_DMEXTRAHEADER dmOEMExtra; - DWORD dwDriverData; - DWORD dwAdvancedData; - - // - //Private DevMode Members - // - -} OEMDEV, *POEMDEV; - -typedef const OEMDEV *PCOEMDEV; - - - -///////////////////////////////////////////////////////// -// ProtoTypes -///////////////////////////////////////////////////////// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam); -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut, DWORD dwSize); -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode); -void Dump(PCOEMDEV pOEMDevIn); diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/dllentry.cpp b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/dllentry.cpp deleted file mode 100644 index da0a1885..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/dllentry.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cpp -// -// PURPOSE: Source module for DLL entry function(s). -// - -#include "precomp.h" -#include "debug.h" -#include "globals.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////////////////////////// -// -// DLL entry point -// -BOOL WINAPI DllMain(HINSTANCE hInst, WORD wReason, LPVOID lpReserved) -{ - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - VERBOSE(DLLTEXT("Process attach.\r\n")); - ghInstance = hInst; - break; - - case DLL_THREAD_ATTACH: - VERBOSE(DLLTEXT("Thread attach.\r\n")); - break; - - case DLL_PROCESS_DETACH: - VERBOSE(DLLTEXT("Process detach.\r\n")); - break; - - case DLL_THREAD_DETACH: - VERBOSE(DLLTEXT("Thread detach.\r\n")); - break; - } - - return TRUE; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/globals.cpp b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/globals.cpp deleted file mode 100644 index 785330cb..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/globals.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Globals.cpp -// -// PURPOSE: File that contains all the globals. -// - -#include "precomp.h" -#include "globals.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -// Module's Instance handle from DLLEntry of process. -HINSTANCE ghInstance = NULL; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/globals.h b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/globals.h deleted file mode 100644 index 70d17f1c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/globals.h +++ /dev/null @@ -1,31 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Globals.h -// -// PURPOSE: Lists of globals declared in Globals.cpp. -// -#pragma once - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - - -#define OEM_SIGNATURE 'MSFT' -#define OEM_VERSION 0x00000001L - -// OEM Signature and version. -#define PROP_TITLE L"OEM PS UI Replacement Page" -#define DLLTEXT(s) TEXT("PSUIREP: ") TEXT(s) - -// OEM UI Misc defines. -#define ERRORTEXT(s) TEXT("ERROR ") DLLTEXT(s) - -// Module's Instance handle from DLLEntry of process. -extern HINSTANCE ghInstance; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/intrface.cpp deleted file mode 100644 index 5ab1bffe..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/intrface.cpp +++ /dev/null @@ -1,709 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.cpp -// -// PLATFORMS: Windows 2000, Windows XP, Windows Server 2003 -// - -#include "precomp.h" - - -#include "precomp.h" -#include "resource.h" -#include "debug.h" -#include "globals.h" -#include "devmode.h" -#include "stringutils.h" -#include "helper.h" -#include "features.h" -#include "oemui.h" -#include "intrface.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -//////////////////////////////////////////////////////// -// Internal Constants -//////////////////////////////////////////////////////// - -// -// List all of the supported Driver UI Helper interface IIDs from the -// latest to the oldest, that's the order we will query for the -// the Driver UI Helper interface to use. -// - -const IID *Helper_IIDs[] = -{ - &IID_IPrintCoreUI2, - &IID_IPrintOemDriverUI, -}; -const NUM_HELPER_IIDs = (sizeof(Helper_IIDs)/sizeof(Helper_IIDs[0])); - - -//////////////////////////////////////////////////////// -// Internal Globals -//////////////////////////////////////////////////////// - -static long g_cComponents = 0 ; // Count of active components -static long g_cServerLocks = 0 ; // Count of locks - - -//////////////////////////////////////////////////////////////////////////////// -// -// IOemUI2 body -// -IOemUI2::IOemUI2() -{ - VERBOSE(DLLTEXT("IOemUI2:IOemUI2() default constructor called.\r\n\r\n")); - - // Init ref count to 1 on creation, since AddRef() is implied. - m_cRef = 1; - - // The default for UI Hiding is FALSE, since HideStandardUI method - // will only be called by Driver UIs that support it. - // Older Driver UIs don't know about this method and won't call us. - m_bHidingStandardUI = FALSE; - - // Increment component count. - InterlockedIncrement(&g_cComponents); -} - -IOemUI2::~IOemUI2() -{ - VERBOSE(DLLTEXT("IOemUI2:~IOemUI2() destructor called.\r\n\r\n")); - - // If this instance of the object is being deleted, then the reference - // count should be zero. - assert(0 == m_cRef); - - // Decrement component count. - InterlockedDecrement(&g_cComponents); -} - -HRESULT __stdcall IOemUI2::QueryInterface(const IID& iid, void** ppv) -{ - VERBOSE(DLLTEXT("IOemUI2:QueryInterface entry.\r\n\r\n")); - -#if DBG - TCHAR szIID[80] = {0}; - StringFromGUID2(iid, szIID, _countof(szIID)); // can not fail! -#endif - - // Determine what object to return, if any. - if(iid == IID_IUnknown) - { - *ppv = static_cast(this); - } - else if(iid == IID_IPrintOemUI2) - { - *ppv = static_cast(this); - } - else if(iid == IID_IPrintOemUI) - { - *ppv = static_cast(this); - } - else - { - // Interface not supported. -#if DBG - VERBOSE(DLLTEXT("IOemUI2::QueryInterface %s not supported.\r\n"), szIID); -#endif - - *ppv = NULL ; - return E_NOINTERFACE ; - } - -#if DBG - VERBOSE(DLLTEXT("IOemUI2::QueryInterface returning pointer to %s.\r\n"), szIID); -#endif - - reinterpret_cast(*ppv)->AddRef(); - return S_OK ; -} - -ULONG __stdcall IOemUI2::AddRef() -{ - VERBOSE(DLLTEXT("IOemUI2:AddRef entry.\r\n")); - return InterlockedIncrement(&m_cRef) ; -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemUI2::Release() -{ - VERBOSE(DLLTEXT("IOemUI2:Release entry.\r\n")); - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -HRESULT __stdcall IOemUI2::PublishDriverInterface( - IUnknown *pIUnknown) -{ - HRESULT hResult = S_OK; - - - VERBOSE(DLLTEXT("IOemUI2:PublishDriverInterface entry.\r\n")); - - // Core Driver UI shouldn't call us more than once if we were successful. - // Thus, if m_Helper is already valid, we shouldn't be getting called. - ASSERT(!m_Helper.IsValid()); - - // Need to store pointer to Driver Helper functions, if we already haven't. - if (!m_Helper.IsValid()) - { - PVOID pHelper = NULL; - - - // Try to get the newest version fo the Helper function - // that Driver UI supports. - hResult = E_FAIL; - for(DWORD dwIndex = 0; !SUCCEEDED(hResult) && (dwIndex < NUM_HELPER_IIDs); ++dwIndex) - { - // Query Driver UI for Helper interface. - hResult = pIUnknown->QueryInterface(*Helper_IIDs[dwIndex], &pHelper); - if(SUCCEEDED(hResult)) - { - // INVARIANT: we got a Helper interface. - - - // Store Helper interface. - m_Helper.Assign(*Helper_IIDs[dwIndex], pHelper); - } - } - } - - return hResult; -} - -HRESULT __stdcall IOemUI2::GetInfo( - DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded) -{ - VERBOSE(DLLTEXT("IOemUI2::GetInfo(%d) entry.\r\r\n"), dwMode); - - // Validate parameters. - if( (NULL == pcbNeeded) - || - ( (OEMGI_GETSIGNATURE != dwMode) - && - (OEMGI_GETVERSION != dwMode) - && - (OEMGI_GETPUBLISHERINFO != dwMode) - ) - ) - { - WARNING(DLLTEXT("IOemUI2::GetInfo() exit pcbNeeded is NULL! ERROR_INVALID_PARAMETER\r\r\n")); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Set expected buffer size and number of bytes written. - *pcbNeeded = sizeof(DWORD); - - // Check buffer size is sufficient. - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - WARNING(DLLTEXT("IOemUI2::GetInfo() exit insufficient buffer!\r\r\n")); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return E_FAIL; - } - - switch(dwMode) - { - // OEM DLL Signature - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // OEM DLL version - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // dwMode not supported. - default: - // Set written bytes to zero since nothing was written. - WARNING(DLLTEXT("IOemUI2::GetInfo() exit mode not supported.\r\r\n")); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - return E_FAIL; - } - - VERBOSE(DLLTEXT("IOemUI2::GetInfo() exit S_OK, (*pBuffer is %#x).\r\r\n"), *(PDWORD)pBuffer); - return S_OK; -} - -HRESULT __stdcall IOemUI2::DevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam) -{ - VERBOSE(DLLTEXT("IOemUI2:DevMode(%d, %#x) entry.\r\n"), dwMode, pOemDMParam); - - return hrOEMDevMode(dwMode, pOemDMParam); -} - -HRESULT __stdcall IOemUI2::CommonUIProp( - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam) -{ - VERBOSE(DLLTEXT("IOemUI2:CommonUIProp entry.\r\n")); - - return hrOEMPropertyPage(dwMode, pOemCUIPParam); -} - - -HRESULT __stdcall IOemUI2::DocumentPropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI2:DocumentPropertySheets entry.\r\n")); - - return hrOEMDocumentPropertySheets(pPSUIInfo, - lParam, - m_Helper, - &m_Features, - m_bHidingStandardUI); -} - -HRESULT __stdcall IOemUI2::DevicePropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI2:DevicePropertySheets entry.\r\n")); - - return hrOEMDevicePropertySheets(pPSUIInfo, - lParam, - m_Helper, - &m_Features, - m_bHidingStandardUI); -} - -HRESULT __stdcall IOemUI2::DeviceCapabilities( - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult) -{ - VERBOSE(DLLTEXT("IOemUI2:DeviceCapabilities entry.\r\n")); - - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(pDeviceName); - UNREFERENCED_PARAMETER(wCapability); - UNREFERENCED_PARAMETER(pOutput); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - UNREFERENCED_PARAMETER(dwOld); - UNREFERENCED_PARAMETER(dwResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI2::DevQueryPrintEx( - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM) -{ - VERBOSE(DLLTEXT("IOemUI2:DevQueryPrintEx entry.\r\n")); - - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pDQPInfo); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI2::UpgradePrinter( - DWORD dwLevel, - PBYTE pDriverUpgradeInfo) -{ - VERBOSE(DLLTEXT("IOemUI2:UpgradePrinter entry.\r\n")); - - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverUpgradeInfo); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI2::PrinterEvent( - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI2:PrinterEvent entry.\r\n")); - - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(iDriverEvent); - UNREFERENCED_PARAMETER(dwFlags); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI2::DriverEvent( - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI2:DriverEvent entry.\r\n")); - - UNREFERENCED_PARAMETER(dwDriverEvent); - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - - -HRESULT __stdcall IOemUI2::QueryColorProfile( - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulQueryMode, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData) -{ - VERBOSE(DLLTEXT("IOemUI2:QueryColorProfile entry.\r\n")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - UNREFERENCED_PARAMETER(ulQueryMode); - UNREFERENCED_PARAMETER(pvProfileData); - UNREFERENCED_PARAMETER(pcbProfileData); - UNREFERENCED_PARAMETER(pflProfileData); - - return E_NOTIMPL; -}; - -HRESULT __stdcall IOemUI2::FontInstallerDlgProc( - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI2:FontInstallerDlgProc entry.\r\n")); - - UNREFERENCED_PARAMETER(hWnd); - UNREFERENCED_PARAMETER(usMsg); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - -HRESULT __stdcall IOemUI2::UpdateExternalFonts( - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges) -{ - VERBOSE(DLLTEXT("IOemUI2:UpdateExternalFonts entry.\r\n")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(hHeap); - UNREFERENCED_PARAMETER(pwstrCartridges); - - return E_NOTIMPL; -} - -// *********** IPrintOEMUI2 FUNCTIONS **************** - -// -// QueryJobAttribtues -// - -HRESULT __stdcall IOemUI2::QueryJobAttributes( - HANDLE hPrinter, - PDEVMODE pDevmode, - DWORD dwLevel, - LPBYTE lpAttributeInfo) -{ - TERSE(DLLTEXT("IOemUI2:QueryJobAttributes entry.\r\n")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(pDevmode); - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(lpAttributeInfo); - - return E_NOTIMPL; -} - -// -// Hide Standard UI -// - -HRESULT __stdcall IOemUI2::HideStandardUI( - DWORD dwMode) -{ - HRESULT hrReturn = E_NOTIMPL; - - - TERSE(DLLTEXT("IOemUI2:HideStandardUI entry.\r\n")); - - switch(dwMode) - { - // By returning S_OK for both OEMCUIP_DOCPROP and OEMCUIP_PRNPROP, - // we will hide the Standard UI for both Document Properties, - // and Device Properties. - // To not hide one or both, return E_NOTIMPL instead of S_OK, - case OEMCUIP_DOCPROP: - case OEMCUIP_PRNPROP: - // Flag that we are hiding the Standard UI. - // This is so we can tell easily between Driver UI - // that supports HideStandardUI (such as WinXP PS UI), - // or ones that don't (such as Win2K PS or Unidrv UI). - m_bHidingStandardUI = TRUE; - - hrReturn = S_OK; - break; - } - - return hrReturn; -} - -// -// DocumentEvent -// - -HRESULT __stdcall IOemUI2::DocumentEvent( - HANDLE hPrinter, - HDC hdc, - INT iEsc, - ULONG cbIn, - PVOID pbIn, - ULONG cbOut, - PVOID pbOut, - PINT piResult) -{ - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(hdc); - UNREFERENCED_PARAMETER(iEsc); - UNREFERENCED_PARAMETER(cbIn); - UNREFERENCED_PARAMETER(pbIn); - UNREFERENCED_PARAMETER(cbOut); - UNREFERENCED_PARAMETER(pbOut); - UNREFERENCED_PARAMETER(piResult); - - return E_NOTIMPL; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// oem class factory -// -class IOemCF : public IClassFactory -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // *** IClassFactory methods *** - STDMETHOD(CreateInstance) (THIS_ - LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID FAR* ppvObject); - STDMETHOD(LockServer) (THIS_ BOOL bLock); - - - // Constructor - IOemCF(): m_cRef(1) { }; - ~IOemCF() { }; - -protected: - LONG m_cRef; - -}; - -/////////////////////////////////////////////////////////// -// -// Class factory body -// -HRESULT __stdcall IOemCF::QueryInterface(const IID& iid, void** ppv) -{ - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this) ; - } - else - { -#if DBG - TCHAR szOutput[80] = {0}; - StringFromGUID2(iid, szOutput, _countof(szOutput)); // can not fail! - WARNING(DLLTEXT("IOemCF::QueryInterface %s not supported.\r\n"), szOutput); -#endif - - *ppv = NULL ; - return E_NOINTERFACE ; - } - reinterpret_cast(*ppv)->AddRef() ; - return S_OK ; -} - -ULONG __stdcall IOemCF::AddRef() -{ - return InterlockedIncrement(&m_cRef) ; -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemCF::Release() -{ - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -// IClassFactory implementation -HRESULT __stdcall IOemCF::CreateInstance(IUnknown* pUnknownOuter, - const IID& iid, - void** ppv) -{ - //DbgPrint(DLLTEXT("Class factory:\t\tCreate component.")) ; - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Cannot aggregate. - if (pUnknownOuter != NULL) - { - return CLASS_E_NOAGGREGATION ; - } - - // Create component. - IOemUI2* pOemCB = new IOemUI2 ; - if (pOemCB == NULL) - { - return E_OUTOFMEMORY ; - } - // Get the requested interface. - HRESULT hr = pOemCB->QueryInterface(iid, ppv) ; - - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - pOemCB->Release() ; - return hr ; -} - -// LockServer -HRESULT __stdcall IOemCF::LockServer(BOOL bLock) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks) ; - } - else - { - InterlockedDecrement(&g_cServerLocks) ; - } - return S_OK ; -} - -/////////////////////////////////////////////////////////// -// -// Exported functions -// - - -// Can DLL unload now? -// -STDAPI DllCanUnloadNow() -{ - // - // To avoid leaving OEM DLL still in memory when Unidrv or Pscript drivers - // are unloaded, Unidrv and Pscript driver ignore the return value of - // DllCanUnloadNow of the OEM DLL, and always call FreeLibrary on the OEMDLL. - // - // If OEM DLL spins off a working thread that also uses the OEM DLL, the - // thread needs to call LoadLibrary and FreeLibraryAndExitThread, otherwise - // it may crash after Unidrv or Pscript calls FreeLibrary. - // - - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK ; - } - else - { - return S_FALSE; - } -} - -// -// Get class factory -// -STDAPI DllGetClassObject( - _In_ REFCLSID clsid, - _In_ REFIID iid, - _Outptr_ LPVOID* ppv) -{ - VERBOSE(DLLTEXT("DllGetClassObject:Create class factory.\r\n")); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Can we create this component? - if (clsid != CLSID_OEMUI) - { - return CLASS_E_CLASSNOTAVAILABLE ; - } - - // Create class factory. - IOemCF* pFontCF = new IOemCF ; // Reference count set to 1 - // in constructor - if (pFontCF == NULL) - { - return E_OUTOFMEMORY ; - } - - // Get requested interface. - HRESULT hr = pFontCF->QueryInterface(iid, ppv) ; - pFontCF->Release() ; - - return hr ; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/intrface.h deleted file mode 100644 index d723cbb7..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/intrface.h +++ /dev/null @@ -1,220 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.h -// -// PURPOSE: Header of interface for PScript5UI replacement plug-in. -// -#pragma once - -//////////////////////////////////////////////////////////////////////////////// -// -// IOemUI2 -// -class IOemUI2: public IPrintOemUI2 -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // - // Get OEM dll related information - // - - STDMETHOD(GetInfo) (THIS_ DWORD dwMode, PVOID pBuffer, DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDevMode - // - - STDMETHOD(DevMode) (THIS_ DWORD dwMode, POEMDMPARAM pOemDMParam) ; - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // OEMCommonUIProp - // - - STDMETHOD(CommonUIProp) (THIS_ - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam - ); - - // - // OEMDocumentPropertySheets - // - - STDMETHOD(DocumentPropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - // - // OEMDevicePropertySheets - // - - STDMETHOD(DevicePropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - - // - // OEMDevQueryPrintEx - // - - STDMETHOD(DevQueryPrintEx) (THIS_ - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM - ); - - // - // OEMDeviceCapabilities - // - - STDMETHOD(DeviceCapabilities) (THIS_ - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult - ); - - // - // OEMUpgradePrinter - // - - STDMETHOD(UpgradePrinter) (THIS_ - DWORD dwLevel, - PBYTE pDriverUpgradeInfo - ); - - // - // OEMPrinterEvent - // - - STDMETHOD(PrinterEvent) (THIS_ - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam - ); - - // - // OEMDriverEvent - // - - STDMETHOD(DriverEvent)(THIS_ - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam - ); - - // - // OEMQueryColorProfile - // - - STDMETHOD(QueryColorProfile) (THIS_ - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulReserved, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData); - - // - // OEMFontInstallerDlgProc - // - - STDMETHOD(FontInstallerDlgProc) (THIS_ - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam - ); - // - // UpdateExternalFonts - // - - STDMETHOD(UpdateExternalFonts) (THIS_ - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges - ); - - // - // IPrintOemUI2 methods - // - - // - // QueryJobAttributes - // - - STDMETHOD(QueryJobAttributes) (THIS_ - HANDLE hPrinter, - PDEVMODE pDevmode, - DWORD dwLevel, - LPBYTE lpAttributeInfo - ); - - // - // Hide Standard UI - // - - STDMETHOD(HideStandardUI) (THIS_ - DWORD dwMode - ); - - // - // DocumentEvent - // - - STDMETHOD(DocumentEvent) (THIS_ - HANDLE hPrinter, - HDC hdc, - INT iEsc, - ULONG cbIn, - PVOID pbIn, - ULONG cbOut, - PVOID pbOut, - PINT piResult - ); - - - IOemUI2(); - virtual ~IOemUI2(); - -protected: - LONG m_cRef; // Reference count - BOOL m_bHidingStandardUI; // Flag indicating if we are hiding the Standard UI. - // NOTE: Not all Driver UI versions support hinding - // the Standard Driver UI. - CUIHelper m_Helper; // Container for Driver UI Helper interface. - CFeatures m_Features; // Core Driver features and feature options. -}; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/oemui.cpp b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/oemui.cpp deleted file mode 100644 index 331be437..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/oemui.cpp +++ /dev/null @@ -1,1042 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: OEMUI.cpp -// -// -// PURPOSE: Main file for OEM UI test module. -// - -#include "precomp.h" -#include "resource.h" -#include "debug.h" -#include "globals.h" -#include "devmode.h" -#include "stringutils.h" -#include "helper.h" -#include "features.h" -#include "oemui.h" - - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// INTERNAL MACROS and DEFINES -//////////////////////////////////////////////////////// - -typedef struct _tagCBUserData -{ - HANDLE hComPropSheet; - HANDLE hPropPage; - POEMUIPSPARAM pOEMUIParam; - PFNCOMPROPSHEET pfnComPropSheet; - CUIHelper *pHelper; - POEMUIOBJ poemuiobj; - BOOL bPermission; - BOOL bHidingStandardUI; - -} CBUSERDATA, *PCBUSERDATA; - - - -//////////////////////////////////////////////////////// -// INTERNAL PROTOTYPES -//////////////////////////////////////////////////////// - -static HRESULT hrDocumentPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -static HRESULT hrPrinterPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -LONG APIENTRY OEMPrinterUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam); -LONG APIENTRY OEMDocUIItemCallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam); -LONG APIENTRY OEMDocUICallBack(PCPSUICBPARAM pCallbackParam); -LONG APIENTRY OEMDevUICallBack(PCPSUICBPARAM pCallbackParam); -INT_PTR CALLBACK DevicePropPageProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam); -static void InitOptItems(POPTITEM pOptItems, DWORD dwOptItems); - - - - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM device or document property UI. -// -HRESULT hrOEMPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - HRESULT hResult = S_OK; - - - VERBOSE(DLLTEXT("hrOEMPropertyPage(%d) entry.\r\n"), dwMode); - - // Validate parameters. - if( (OEMCUIP_DOCPROP != dwMode) - && - (OEMCUIP_PRNPROP != dwMode) - ) - { - ERR(ERRORTEXT("hrOEMPropertyPage() ERROR_INVALID_PARAMETER.\r\n")); - VERBOSE(DLLTEXT("\tdwMode = %d, pOEMUIParam = %#lx.\r\n"), dwMode, pOEMUIParam); - - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - switch(dwMode) - { - case OEMCUIP_DOCPROP: - hResult = hrDocumentPropertyPage(dwMode, pOEMUIParam); - break; - - case OEMCUIP_PRNPROP: - hResult = hrPrinterPropertyPage(dwMode, pOEMUIParam); - break; - - default: - // Should never reach this! - ERR(ERRORTEXT("hrOEMPropertyPage() Invalid dwMode, %d"), dwMode); - SetLastError(ERROR_INVALID_PARAMETER); - hResult = E_FAIL; - break; - } - - return hResult; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM document property UI. -// -static HRESULT hrDocumentPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - HRESULT hrResult = S_OK; - - UNREFERENCED_PARAMETER(dwMode); - - if(NULL == pOEMUIParam->pOEMOptItems) - { - // Fill in the number of OptItems to create for OEM document property UI. - pOEMUIParam->cOEMOptItems = 1; - - VERBOSE(DLLTEXT("hrDocumentPropertyPage() requesting %d number of items.\r\n"), pOEMUIParam->cOEMOptItems); - } - else - { - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - - - VERBOSE(DLLTEXT("hrDocumentPropertyPage() fill out %d items.\r\n"), pOEMUIParam->cOEMOptItems); - - // Init UI Callback reference. - pOEMUIParam->OEMCUIPCallback = OEMDocUIItemCallBack; - - // Init OEMOptItmes. - InitOptItems(pOEMUIParam->pOEMOptItems, pOEMUIParam->cOEMOptItems); - - // Fill out tree view items. - - // New section. - pOEMUIParam->pOEMOptItems[0].Level = 1; - pOEMUIParam->pOEMOptItems[0].Flags = OPTIF_COLLAPSE; - pOEMUIParam->pOEMOptItems[0].Sel = pOEMDev->dwAdvancedData; - - hrResult = GetStringResource(pOEMUIParam->hOEMHeap, - (HMODULE) pOEMUIParam->hModule, - IDS_ADV_SECTION, - &pOEMUIParam->pOEMOptItems[0].pName); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrDocumentPropertyPage() failed to get section name. (hrResult = 0x%x)\r\n"), - hrResult); - goto Exit; - } - - pOEMUIParam->pOEMOptItems[0].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 2); - - pOEMUIParam->pOEMOptItems[0].pOptType->Type = TVOT_UDARROW; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].IconID = 0; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].lParam = 100; - } - - -Exit: - - return hrResult; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM printer property UI. -// -static HRESULT hrPrinterPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - HRESULT hrResult = S_OK; - - UNREFERENCED_PARAMETER(dwMode); - - if(NULL == pOEMUIParam->pOEMOptItems) - { - // Fill in the number of OptItems to create for OEM printer property UI. - pOEMUIParam->cOEMOptItems = 1; - - VERBOSE(DLLTEXT("hrPrinterPropertyPage() requesting %d number of items.\r\n"), pOEMUIParam->cOEMOptItems); - } - else - { - DWORD dwError; - DWORD dwDeviceValue; - DWORD dwType; - DWORD dwNeeded; - - - VERBOSE(DLLTEXT("hrPrinterPropertyPage() fill out %d items.\r\n"), pOEMUIParam->cOEMOptItems); - - // Get device settings value from printer. - dwError = GetPrinterData(pOEMUIParam->hPrinter, OEMUI_VALUE, &dwType, (PBYTE) &dwDeviceValue, - sizeof(dwDeviceValue), &dwNeeded); - if( (ERROR_SUCCESS != dwError) - || - (dwDeviceValue > 100) - ) - { - // Failed to get the device value or value is invalid, just use the default. - dwDeviceValue = 0; - } - - // Init UI Callback reference. - pOEMUIParam->OEMCUIPCallback = OEMPrinterUICallBack; - - // Init OEMOptItmes. - InitOptItems(pOEMUIParam->pOEMOptItems, pOEMUIParam->cOEMOptItems); - - // Fill out tree view items. - - // New section. - pOEMUIParam->pOEMOptItems[0].Level = 1; - pOEMUIParam->pOEMOptItems[0].Flags = OPTIF_COLLAPSE; - hrResult = GetStringResource(pOEMUIParam->hOEMHeap, - (HMODULE) pOEMUIParam->hModule, - IDS_DEV_SECTION, - &pOEMUIParam->pOEMOptItems[0].pName); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrPrinterPropertyPage() failed to get section name. (hrResult = 0x%x)\r\n"), - hrResult); - goto Exit; - } - - pOEMUIParam->pOEMOptItems[0].Sel = dwDeviceValue; - - pOEMUIParam->pOEMOptItems[0].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 2); - - pOEMUIParam->pOEMOptItems[0].pOptType->Type = TVOT_UDARROW; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].IconID = 0; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].lParam = 100; - } - -Exit: - - return hrResult; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Adds property page to Document property sheet. -// -HRESULT hrOEMDocumentPropertySheets(PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam, - CUIHelper &Helper, - CFeatures *pFeatures, - BOOL bHidingStandardUI) -{ - LONG_PTR lResult = 0; - HRESULT hrResult = S_OK; - - VERBOSE(DLLTEXT("OEMDocumentPropertySheets() entry.\r\n")); - - // Validate parameters. - if( (NULL == pPSUIInfo) - || - (PROPSHEETUI_INFO_VERSION != pPSUIInfo->Version) - ) - { - ERR(ERRORTEXT("OEMDocumentPropertySheets() ERROR_INVALID_PARAMETER.\r\n")); - - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Do action. - switch(pPSUIInfo->Reason) - { - case PROPSHEETUI_REASON_INIT: - { - WORD wFeatures = 0; - WORD wIndex = 0; - DWORD dwSheets = 0; - PCBUSERDATA pUserData = NULL; - POEMUIPSPARAM pOEMUIParam = (POEMUIPSPARAM) pPSUIInfo->lParamInit; - BOOL bPermission = ((pOEMUIParam->dwFlags & DM_NOPERMISSION) == 0); - HANDLE hHeap = pOEMUIParam->hOEMHeap; - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - COMPROPSHEETUI Sheet; - - - // Make sure that we have the Core Driver Features. - // Only get features if we are hiding the standard - // document property sheets. - if(bHidingStandardUI) - { - pFeatures->Acquire(hHeap, Helper, pOEMUIParam->poemuiobj); - wFeatures = pFeatures->GetCount(OEMCUIP_DOCPROP); - } - - // Init property page. - memset(&Sheet, 0, sizeof(COMPROPSHEETUI)); - Sheet.cbSize = sizeof(COMPROPSHEETUI); - Sheet.Flags = bPermission ? CPSUIF_UPDATE_PERMISSION : 0; - Sheet.hInstCaller = ghInstance; - Sheet.pHelpFile = NULL; - Sheet.pfnCallBack = OEMDocUICallBack; - Sheet.pDlgPage = CPSUI_PDLGPAGE_TREEVIEWONLY; - Sheet.cOptItem = wFeatures + 1; - Sheet.IconID = IDI_CPSUI_PRINTER; - Sheet.CallerVersion = 0x100; - Sheet.OptItemVersion = 0x100; - - // Get Caller's name. - hrResult = GetStringResource(hHeap, ghInstance, IDS_NAME, &Sheet.pCallerName); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrOEMDocumentPropertySheets() failed to get caller name. (hrResult = 0x%x)\r\n"), - hrResult); - goto Exit; - } - - // Get section name. - hrResult = GetStringResource(hHeap, ghInstance, IDS_SECTION, &Sheet.pOptItemName); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrOEMDocumentPropertySheets() failed to get section name. (hrResult = 0x%x)\r\n"), - hrResult); - goto Exit; - } - - // Init user data. - pUserData = (PCBUSERDATA) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(CBUSERDATA)); - if(NULL == pUserData) - { - ERR(ERRORTEXT("hrOEMDocumentPropertySheets() failed to allocate user data.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - pUserData->hComPropSheet = pPSUIInfo->hComPropSheet; - pUserData->pfnComPropSheet = pPSUIInfo->pfnComPropSheet; - pUserData->pOEMUIParam = pOEMUIParam; - pUserData->pHelper = &Helper; - pUserData->poemuiobj = pOEMUIParam->poemuiobj; - pUserData->bPermission = bPermission; - pUserData->bHidingStandardUI = bHidingStandardUI; - Sheet.UserData = (ULONG_PTR) pUserData; - - // Create OptItems for page. - Sheet.pOptItem = CreateOptItems(hHeap, Sheet.cOptItem); - if(NULL == Sheet.pOptItem) - { - ERR(ERRORTEXT("hrOEMDocumentPropertySheets() failed to allocate OPTITEMs.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Add Core Driver features. - for(wIndex = 0; wIndex < wFeatures; ++wIndex) - { - // Initialize level and basic state for feature. - Sheet.pOptItem[wIndex].Level = 1; - Sheet.pOptItem[wIndex].Flags = OPTIF_COLLAPSE; - - // Get the OPTITEM for this feature. - hrResult = pFeatures->InitOptItem(hHeap, - Sheet.pOptItem + wIndex, - wIndex, - OEMCUIP_DOCPROP); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrOEMDocumentPropertySheets() failed to get OPTITEM for feature %hs.\r\n"), - pFeatures->GetKeyword(wIndex, OEMCUIP_DOCPROP)); - - goto Exit; - } - } - - // Initialize Plug-in OptItems - Sheet.pOptItem[wIndex].Level = 1; - Sheet.pOptItem[wIndex].Flags = OPTIF_COLLAPSE; - Sheet.pOptItem[wIndex].Sel = pOEMDev->dwDriverData; - - // get optitem name. - hrResult = GetStringResource(hHeap, ghInstance, IDS_SECTION, &Sheet.pOptItem[wIndex].pName); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrOEMDocumentPropertySheets() failed to get OptItem %d name. (hrResult = 0x%x)\r\n"), - wIndex, - hrResult); - goto Exit; - } - - Sheet.pOptItem[wIndex].pOptType = CreateOptType(hHeap, 2); - - Sheet.pOptItem[wIndex].pOptType->Type = TVOT_UDARROW; - Sheet.pOptItem[wIndex].pOptType->pOptParam[1].IconID = 0; - Sheet.pOptItem[wIndex].pOptType->pOptParam[1].lParam = 100; - - - // Add property sheets. - lResult = pPSUIInfo->pfnComPropSheet(pPSUIInfo->hComPropSheet, CPSFUNC_ADD_PCOMPROPSHEETUI, - (LPARAM)&Sheet, (LPARAM)&dwSheets); - } - break; - - case PROPSHEETUI_REASON_GET_INFO_HEADER: - { - PPROPSHEETUI_INFO_HEADER pHeader = (PPROPSHEETUI_INFO_HEADER) lParam; - - pHeader->pTitle = (LPTSTR)PROP_TITLE; - lResult = TRUE; - } - break; - - case PROPSHEETUI_REASON_GET_ICON: - // No icon - lResult = 0; - break; - - case PROPSHEETUI_REASON_SET_RESULT: - { - PSETRESULT_INFO pInfo = (PSETRESULT_INFO) lParam; - - lResult = pInfo->Result; - } - break; - - case PROPSHEETUI_REASON_DESTROY: - lResult = TRUE; - break; - } - - -Exit: - - pPSUIInfo->Result = lResult; - return hrResult; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Adds property page to printer property sheet. -// -HRESULT hrOEMDevicePropertySheets(PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam, - CUIHelper &Helper, - CFeatures *pFeatures, - BOOL bHidingStandardUI) -{ - LONG_PTR lResult = 0; - HRESULT hrResult = S_OK; - - - VERBOSE(DLLTEXT("hrOEMDevicePropertySheets(%#x, %#x) entry\r\n"), pPSUIInfo, lParam); - - // Validate parameters. - if( (NULL == pPSUIInfo) - || - (PROPSHEETUI_INFO_VERSION != pPSUIInfo->Version) - ) - { - ERR(ERRORTEXT("hrOEMDevicePropertySheets() ERROR_INVALID_PARAMETER.\r\n")); - - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - Dump(pPSUIInfo); - - // Do action. - switch(pPSUIInfo->Reason) - { - case PROPSHEETUI_REASON_INIT: - { - PROPSHEETPAGE Page; - - // If hiding standard UI, then - // need to add Device Settings page, too. - if(bHidingStandardUI) - { - POEMUIPSPARAM pOEMUIParam = (POEMUIPSPARAM) pPSUIInfo->lParamInit; - BOOL bPermission = ((pOEMUIParam->dwFlags & DPS_NOPERMISSION) == 0); - HANDLE hHeap = pOEMUIParam->hOEMHeap; - WORD wFeatures = 0; - WORD wIndex = 0; - DWORD dwSheets = 0; - DLGPAGE DlgPage; - PCBUSERDATA pUserData = NULL; - COMPROPSHEETUI Sheet; - - - // Make sure that we have the Core Driver Features. - pFeatures->Acquire(hHeap, Helper, pOEMUIParam->poemuiobj); - wFeatures = pFeatures->GetCount(OEMCUIP_PRNPROP); - - // Init DlgPage struct for Device Settings replacement page. - memset(&DlgPage, 0, sizeof(DLGPAGE)); - DlgPage.cbSize = sizeof(DLGPAGE); - DlgPage.DlgTemplateID = DP_STD_TREEVIEWPAGE; - - // Get Device Settings display name. - hrResult = GetStringResource(hHeap, ghInstance, IDS_DEVICE_SETTINGS_NAME, &DlgPage.pTabName); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrOEMDevicePropertySheets() failed to get Device Settings display name. (hrResult = 0x%x)\r\n"), - hrResult); - goto Exit; - } - - // Init Device Settings replacement page. - memset(&Sheet, 0, sizeof(COMPROPSHEETUI)); - Sheet.cbSize = sizeof(COMPROPSHEETUI); - Sheet.Flags = bPermission ? CPSUIF_UPDATE_PERMISSION : 0; - Sheet.hInstCaller = ghInstance; - Sheet.pHelpFile = NULL; - Sheet.pfnCallBack = OEMDevUICallBack; - Sheet.pDlgPage = &DlgPage; //CPSUI_PDLGPAGE_TREEVIEWONLY; - Sheet.cOptItem = wFeatures; - Sheet.cDlgPage = 1; - Sheet.IconID = IDI_CPSUI_PRINTER; - Sheet.CallerVersion = 0x100; - Sheet.OptItemVersion = 0x100; - - // Get Caller's name. - hrResult = GetStringResource(hHeap, ghInstance, IDS_NAME, &Sheet.pCallerName); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrOEMDevicePropertySheets() failed to get caller name. (hrResult = 0x%x)\r\n"), - hrResult); - goto Exit; - } - - // Get section name. - hrResult = GetStringResource(hHeap, ghInstance, IDS_SECTION, &Sheet.pOptItemName); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrOEMDevicePropertySheets() failed to get section name. (hrResult = 0x%x)\r\n"), - hrResult); - goto Exit; - } - - // Allocate and init User data used in our callback for this page. - pUserData = (PCBUSERDATA) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(CBUSERDATA)); - if(NULL == pUserData) - { - ERR(ERRORTEXT("hrOEMDevicePropertySheets() failed to allocate user data.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - pUserData->hComPropSheet = pPSUIInfo->hComPropSheet; - pUserData->pfnComPropSheet = pPSUIInfo->pfnComPropSheet; - pUserData->pOEMUIParam = pOEMUIParam; - pUserData->pHelper = &Helper; - pUserData->poemuiobj = pOEMUIParam->poemuiobj; - pUserData->bPermission = bPermission; - pUserData->bHidingStandardUI = bHidingStandardUI; - Sheet.UserData = (ULONG_PTR) pUserData; - - // Create OptItems for page. - Sheet.pOptItem = CreateOptItems(hHeap, Sheet.cOptItem); - if(NULL == Sheet.pOptItem) - { - ERR(ERRORTEXT("hrOEMDevicePropertySheets() failed to allocate OPTITEMs.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Add Core Driver features. - for(wIndex = 0; wIndex < wFeatures; ++wIndex) - { - // Initialize level and basic state for feature. - Sheet.pOptItem[wIndex].Level = 1; - Sheet.pOptItem[wIndex].Flags = OPTIF_COLLAPSE; - - // Get the OPTITEM for this feature. - hrResult = pFeatures->InitOptItem(hHeap, - Sheet.pOptItem + wIndex, - wIndex, - OEMCUIP_PRNPROP); - if(!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrOEMDevicePropertySheets() failed to get OPTITEM for feature %hs.\r\n"), - pFeatures->GetKeyword(wIndex, OEMCUIP_PRNPROP)); - - goto Exit; - } - } - - // Add property sheets. - lResult = pPSUIInfo->pfnComPropSheet(pPSUIInfo->hComPropSheet, CPSFUNC_ADD_PCOMPROPSHEETUI, - (LPARAM)&Sheet, (LPARAM)&dwSheets); - if(!SUCCEEDED(lResult)) - { - ERR(ERRORTEXT("hrOEMDevicePropertySheets() failed to add Device Settings replacement page. (lResult = 0x%x)\r\n"), - lResult); - goto Exit; - } - } - - // Init our property page. - memset(&Page, 0, sizeof(PROPSHEETPAGE)); - Page.dwSize = sizeof(PROPSHEETPAGE); - Page.dwFlags = PSP_DEFAULT; - Page.hInstance = ghInstance; - Page.pszTemplate = MAKEINTRESOURCE(IDD_DEVICE_PROPPAGE); - Page.pfnDlgProc = DevicePropPageProc; - - // Add property sheets. - lResult = pPSUIInfo->pfnComPropSheet(pPSUIInfo->hComPropSheet, CPSFUNC_ADD_PROPSHEETPAGE, (LPARAM)&Page, 0); - if(!SUCCEEDED(lResult)) - { - ERR(ERRORTEXT("hrOEMDevicePropertySheets() failed to add our Device Property page. (lResult = 0x%x)\r\n"), - lResult); - goto Exit; - } - - VERBOSE(DLLTEXT("hrOEMDevicePropertySheets() pfnComPropSheet returned %d.\r\n"), lResult); - } - break; - - case PROPSHEETUI_REASON_GET_INFO_HEADER: - { - PPROPSHEETUI_INFO_HEADER pHeader = (PPROPSHEETUI_INFO_HEADER) lParam; - - pHeader->pTitle = (LPTSTR)PROP_TITLE; - lResult = TRUE; - } - break; - - case PROPSHEETUI_REASON_GET_ICON: - // No icon - lResult = 0; - break; - - case PROPSHEETUI_REASON_SET_RESULT: - { - PSETRESULT_INFO pInfo = (PSETRESULT_INFO) lParam; - - lResult = pInfo->Result; - } - break; - - case PROPSHEETUI_REASON_DESTROY: - lResult = TRUE; - break; - } - - -Exit: - - pPSUIInfo->Result = lResult; - return hrResult; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// OptItems call back for OEM printer property UI. -// -LONG APIENTRY OEMPrinterUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - - VERBOSE(DLLTEXT("OEMPrinterUICallBack() entry, Reason is %d.\r\n"), pCallbackParam->Reason); - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - { - DWORD dwDriverValue = pOEMUIParam->pOEMOptItems[0].Sel; - - // Store OptItems state in printer data. - SetPrinterData(pOEMUIParam->hPrinter, OEMUI_VALUE, REG_DWORD, (PBYTE) &dwDriverValue, sizeof(DWORD)); - } - break; - - default: - break; - } - - return lReturn; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Call back for OEM device property UI. -// -#pragma warning(push) -// 2 MAX_PATH strings just slightly exceed the default threshold for the prefast stack usage warning -#pragma warning( disable : 6262 ) -INT_PTR CALLBACK DevicePropPageProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) -{ - switch (uiMsg) - { - case WM_COMMAND: - switch(HIWORD(wParam)) - { - case BN_CLICKED: - switch(LOWORD(wParam)) - { - case IDC_CALIBRATE: - // Just display a message that the printer is calibrated, - // since we don't acutally calibrate anything. - { - TCHAR szName[MAX_PATH]; - TCHAR szCalibrated[MAX_PATH]; - - - LoadString(ghInstance, IDS_NAME, szName, sizeof(szName)/sizeof(szName[0])); - LoadString(ghInstance, IDS_CALIBRATED, szCalibrated, sizeof(szCalibrated)/sizeof(szCalibrated[0])); - MessageBox(hDlg, szCalibrated, szName, MB_OK); - } - break; - } - break; - - default: - return FALSE; - } - return TRUE; - - case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->code) // type of notification message - { - case PSN_SETACTIVE: - break; - - case PSN_KILLACTIVE: - break; - - case PSN_APPLY: - break; - - case PSN_RESET: - break; - } - } - break; - } - - return FALSE; -} -#pragma warning(pop) - -//////////////////////////////////////////////////////////////////////////////// -// -// OptItems call back for OEM document property UI. -// -LONG APIENTRY OEMDocUIItemCallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - - - VERBOSE(DLLTEXT("OEMDocUIItemCallBack() entry, Reason is %d.\r\n"), pCallbackParam->Reason); - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - // Store OptItems state in DEVMODE. - pOEMDev->dwAdvancedData = pOEMUIParam->pOEMOptItems[0].Sel; - break; - - case CPSUICB_REASON_KILLACTIVE: - pOEMDev->dwAdvancedData = pOEMUIParam->pOEMOptItems[0].Sel; - break; - - case CPSUICB_REASON_SETACTIVE: - if((DWORD)(pOEMUIParam->pOEMOptItems[0].Sel) != pOEMDev->dwAdvancedData) - { - pOEMUIParam->pOEMOptItems[0].Sel = pOEMDev->dwAdvancedData; - pOEMUIParam->pOEMOptItems[0].Flags |= OPTIF_CHANGED; - lReturn = CPSUICB_ACTION_OPTIF_CHANGED; - } - break; - - default: - break; - } - - return lReturn; -} - - -LONG APIENTRY OEMDocUICallBack(PCPSUICBPARAM pCallbackParam) -{ - WORD wItems = pCallbackParam->cOptItem; - LONG lReturn = CPSUICB_ACTION_NONE; - POPTITEM pOptItem = pCallbackParam->pOptItem; - PCBUSERDATA pUserData = (PCBUSERDATA) pCallbackParam->UserData; - HANDLE hHeap = pUserData->pOEMUIParam->hOEMHeap; - POEMDEV pOEMDev = (POEMDEV) pUserData->pOEMUIParam->pOEMDM; - - - VERBOSE(DLLTEXT("OEMDocUICallBack() entry, Reason is %d.\r\n"), pCallbackParam->Reason); - - // - // If user has no permission to change anything, then - // simply return without taking any action. - // - - if (!pUserData->bPermission && (pCallbackParam->Reason != CPSUICB_REASON_ABOUT)) - return CPSUICB_ACTION_NONE; - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - if(wItems > 0) - { - // Save feature options if hidig standard UI. - if(pUserData->bHidingStandardUI) - { - HRESULT hrResult; - - - // Save feature OPTITEMs. - hrResult = SaveFeatureOptItems(hHeap, - pUserData->pHelper, - pUserData->poemuiobj, - pCallbackParam->hDlg, - pOptItem, - wItems); - if(!SUCCEEDED(hrResult)) - { - // Return that we didn't save changes. - // NOTE: it is up to SaveFeatureOptItems() to display - // any UI for failure. - return CPSUICB_ACTION_NO_APPLY_EXIT; - } - } - - // Save OPTITEM that we explicitly added. - pOEMDev->dwDriverData = pOptItem[wItems - 1].Sel; - pUserData->pfnComPropSheet(pUserData->hComPropSheet, CPSFUNC_SET_RESULT, - (LPARAM)pUserData->hPropPage, - (LPARAM)CPSUI_OK); - - } - break; - - case CPSUICB_REASON_KILLACTIVE: - if(wItems > 0) - { - // Update OPTITEM that we explicitly added. - pOEMDev->dwDriverData = pOptItem[wItems - 1].Sel; - } - break; - - case CPSUICB_REASON_SETACTIVE: - if(wItems > 0) - { - if((DWORD)(pOptItem[wItems - 1].Sel) != pOEMDev->dwDriverData) - { - // Update OPTITEM that we explicitly added. - pOptItem[wItems - 1].Sel = pOEMDev->dwDriverData; - pOptItem[wItems - 1].Flags |= OPTIF_CHANGED; - } - } - lReturn = CPSUICB_ACTION_OPTIF_CHANGED; - break; - - default: - break; - } - - return lReturn; -} - -LONG APIENTRY OEMDevUICallBack(PCPSUICBPARAM pCallbackParam) -{ - WORD wItems = pCallbackParam->cOptItem; - LONG lReturn = CPSUICB_ACTION_NONE; - POPTITEM pOptItem = pCallbackParam->pOptItem; - PCBUSERDATA pUserData = (PCBUSERDATA) pCallbackParam->UserData; - HANDLE hHeap = pUserData->pOEMUIParam->hOEMHeap; - - - VERBOSE(DLLTEXT("OEMDevUICallBack() entry, Reason is %d.\r\n"), pCallbackParam->Reason); - - // - // If user has no permission to change anything, then - // simply return without taking any action. - // - - if (!pUserData->bPermission && (pCallbackParam->Reason != CPSUICB_REASON_ABOUT)) - return CPSUICB_ACTION_NONE; - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - if(wItems > 0) - { - // Save feature options if hidig standard UI. - if(pUserData->bHidingStandardUI) - { - HRESULT hrResult; - - - // Save feature OPTITEMs. - hrResult = SaveFeatureOptItems(hHeap, - pUserData->pHelper, - pUserData->poemuiobj, - pCallbackParam->hDlg, - pOptItem, - wItems); - if(!SUCCEEDED(hrResult)) - { - // Return that we didn't save changes. - // NOTE: it is up to SaveFeatureOptItems() to display - // any UI for failure. - return CPSUICB_ACTION_NO_APPLY_EXIT; - } - } - - - pUserData->pfnComPropSheet(pUserData->hComPropSheet, CPSFUNC_SET_RESULT, - (LPARAM)pUserData->hPropPage, - (LPARAM)CPSUI_OK); - } - break; - - case CPSUICB_REASON_KILLACTIVE: - break; - - case CPSUICB_REASON_SETACTIVE: - break; - - default: - break; - } - - return lReturn; -} - - - -//////////////////////////////////////////////////////////////////////////////// -// -// Creates and Initializes OptItems. -// -POPTITEM CreateOptItems(HANDLE hHeap, DWORD dwOptItems) -{ - POPTITEM pOptItems = NULL; - SIZE_T sizeOfOptItems = 0; - - // Compute the size of memory needed for the OptItems: - if (SUCCEEDED(SIZETMult(sizeof(OPTITEM), (SIZE_T)dwOptItems, &sizeOfOptItems))) - { - // Allocate memory for OptItems; - pOptItems = (POPTITEM) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeOfOptItems); - if(NULL != pOptItems) - { - InitOptItems(pOptItems, dwOptItems); - } - else - { - ERR(ERRORTEXT("CreateOptItems() failed to allocate memory for OPTITEMs!\r\n")); - } - } - else - { - ERR(ERRORTEXT("CreateOptItems() failed to compute necessary memory size for OPTITEMs!\r\n")); - } - - return pOptItems; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems. -// -static void InitOptItems(POPTITEM pOptItems, DWORD dwOptItems) -{ - VERBOSE(DLLTEXT("InitOptItems() entry.\r\n")); - - // Zero out memory. - memset(pOptItems, 0, sizeof(OPTITEM) * dwOptItems); - - // Set each OptItem's size, and Public DM ID. - for(DWORD dwCount = 0; dwCount < dwOptItems; dwCount++) - { - pOptItems[dwCount].cbSize = sizeof(OPTITEM); - pOptItems[dwCount].DMPubID = DMPUB_NONE; - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Allocates and initializes OptType for OptItem. -// -POPTTYPE CreateOptType(HANDLE hHeap, WORD wOptParams) -{ - POPTTYPE pOptType = NULL; - - - VERBOSE(DLLTEXT("CreateOptType() entry.\r\n")); - - // Allocate memory from the heap for the OPTTYPE; the driver will take care of clean up. - pOptType = (POPTTYPE) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(OPTTYPE)); - if(NULL != pOptType) - { - // Initialize OPTTYPE. - pOptType->cbSize = sizeof(OPTTYPE); - pOptType->Count = wOptParams; - - // Allocate memory from the heap for the OPTPARAMs for the OPTTYPE. - pOptType->pOptParam = (POPTPARAM) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, wOptParams * sizeof(OPTPARAM)); - if(NULL != pOptType->pOptParam) - { - // Initialize the OPTPARAMs. - for(WORD wCount = 0; wCount < wOptParams; wCount++) - { - pOptType->pOptParam[wCount].cbSize = sizeof(OPTPARAM); - } - } - else - { - ERR(ERRORTEXT("CreateOptType() failed to allocated memory for OPTPARAMs!\r\n")); - - // Free allocated memory and return NULL. - HeapFree(hHeap, 0, pOptType); - pOptType = NULL; - } - } - else - { - ERR(ERRORTEXT("CreateOptType() failed to allocated memory for OPTTYPE!\r\n")); - } - - return pOptType; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/oemui.h b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/oemui.h deleted file mode 100644 index c00b87ef..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/oemui.h +++ /dev/null @@ -1,33 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: OEMUI.H -// -#pragma once - - -//////////////////////////////////////////////////////// -// OEM UI Defines -//////////////////////////////////////////////////////// - -// Printer registry keys where OEM data is stored. -#define OEMUI_VALUE TEXT("OEMUI_VALUE") -#define OEMUI_DEVICE_VALUE TEXT("OEMUI_DEVICE_VALUE") - - -//////////////////////////////////////////////////////// -// Prototypes -//////////////////////////////////////////////////////// - -HRESULT hrOEMPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -HRESULT hrOEMDocumentPropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam, CUIHelper &Helper, CFeatures *pFeatures, - BOOL bHidingStandardUI); -HRESULT hrOEMDevicePropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam, CUIHelper &Helper, CFeatures *pFeatures, - BOOL bHidingStandardUI); - -POPTITEM CreateOptItems(HANDLE hHeap, DWORD dwOptItems); -POPTTYPE CreateOptType(HANDLE hHeap, WORD wOptParams); diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/precomp.h deleted file mode 100644 index 1374db76..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/precomp.h +++ /dev/null @@ -1,55 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// PURPOSE: Header files that should be in the precompiled header. -// -#pragma once - -// Necessary for compiling under VC. -#if(!defined(WINVER) || (WINVER < 0x0500)) - #undef WINVER - #define WINVER 0x0500 -#endif -#if(!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)) - #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0500 -#endif - - - -// Required header files that shouldn't change often. - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Safe integer functions to detect integer overflow/underflow conditions: -#include - -// StrSafe.h needs to be included last -// to disallow unsafe string functions. -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/psuirep.def b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/psuirep.def deleted file mode 100644 index eacb15a5..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/psuirep.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY PSUIREP -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/resource.h b/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/resource.h deleted file mode 100644 index 958598da..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PSUIRep/resource.h +++ /dev/null @@ -1,92 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by OEMUI.rc -// -#define IDS_SECTION 1 -#define IDS_CALIBRATED 2 -#define IDS_NAME 3 -#define IDS_DEVICE_SETTINGS_NAME 4 -#define IDS_CONSTRAINT_CONFLICT 5 -#define IDS_DEV_SECTION 6 -#define IDS_ADV_SECTION 10 -#define IDD_DEVICE_PROPPAGE 106 -#define IDD_DOC_PROPPAGE 107 -#define IDS_POSTSCRIPT_VM 400 -#define IDS_KBYTES 401 -#define IDS_SECONDS 402 -#define IDS_PSTIMEOUTS 403 -#define IDS_JOBTIMEOUT 404 -#define IDS_WAITTIMEOUT 405 -#define IDS_PRINTER_DEFAULT 406 -#define IDS_INSTALLABLE_OPTIONS 407 -#define IDS_DOWNLOAD_AS_SOFTFONT 408 -#define IDS_USE_DEVFONTS 409 -#define IDS_FONTSUB_OPTION 410 -#define IDS_FONTSUB_DEFAULT 411 -#define IDS_FONTSUB_SLOW 412 -#define IDS_FONTSUB_TABLE 413 -#define IDS_DEFAULT_TRAY 414 -#define IDS_DRAW_ONLY_FROM_SELECTED 415 -#define IDS_RESTORE_DEFAULTS 417 -#define IDS_PRINTER_FEATURES 418 -#define IDS_METAFILE_SPOOLING 419 -#define IDS_ENABLED 420 -#define IDS_DISABLED 421 -#define IDS_PSOPTIONS 422 -#define IDS_MIRROR 423 -#define IDS_NEGATIVE_PRINT 424 -#define IDS_PAGEINDEP 425 -#define IDS_COMPRESSBMP 426 -#define IDS_CTRLD_BEFORE 427 -#define IDS_CTRLD_AFTER 428 -#define IDS_JOB_CONTROL 429 -#define IDS_TEXT_ASGRX 431 -#define IDS_PAGE_PROTECTION 432 -#define IDS_CANCEL_CONFLICT 433 -#define IDS_IGNORE_CONFLICT 434 -#define IDS_RESOLVE_CONFLICT 435 -#define IDS_GETDATA_FAILED 436 -#define IDS_DRIVERUI_COLORMODE 437 -#define IDS_ENVELOPE 438 -#define IDS_ENV_PREFIX 439 -#define IDS_PSPROTOCOL 440 -#define IDS_PSPROTOCOL_ASCII 441 -#define IDS_PSPROTOCOL_BCP 442 -#define IDS_PSPROTOCOL_TBCP 443 -#define IDS_PSPROTOCOL_BINARY 444 -#define IDS_TRAY_FORMSOURCE 445 -#define IDS_OEMERR_DLGTITLE 446 -#define IDS_OEMERR_OPTITEM 447 -#define IDS_OEMERR_PROPSHEET 448 -#define IDS_CANCEL_CONFLICT_FINAL 449 -#define IDS_PSERROR_HANDLER 450 -#define IDS_PSMINOUTLINE 451 -#define IDS_PSMAXBITMAP 452 -#define IDS_PIXELS 453 -#define IDS_PSOUTPUT_OPTION 454 -#define IDS_PSOPT_SPEED 455 -#define IDS_PSOPT_PORTABILITY 456 -#define IDS_PSOPT_EPS 457 -#define IDS_PSOPT_ARCHIVE 458 -#define IDS_PSTT_DLFORMAT 459 -#define IDS_TTDL_DEFAULT 460 -#define IDS_TTDL_TYPE1 461 -#define IDS_TTDL_TYPE3 462 -#define IDS_TTDL_TYPE42 463 -#define IDS_PSLEVEL 471 -#define IDS_TRUE_GRAY_TEXT 507 -#define IDS_TRUE_GRAY_GRAPH 508 -#define IDS_ADD_EURO 509 -#define IDS_PSCRIPT_CUSTOMSIZE 600 -#define IDC_CALIBRATE 1001 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1002 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.gpd b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.gpd deleted file mode 100644 index fa3e7864..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.gpd +++ /dev/null @@ -1,763 +0,0 @@ -*GPDFileName: "ptpcplpr.gpd" -*GPDFileVersion: "1.0" -*GPDSpecVersion: "1.0" -*Include: "StdNames.gpd" -*Include: "ttfsub.gpd" -*ModelName: "UniDrv PT/PC Plugin Provider" -*MasterUnits: PAIR(1200, 1200) -*ResourceDLL: "unires.dll" -*PrinterType: PAGE -*MaxCopies: 99 -*PrintRate: 16 -*PrintRateUnit: PPM -*PrintRatePPM: 16 - -*%****************************************************************************************** -*% Orientation -*%****************************************************************************************** -*Feature: Orientation -{ - *rcNameID: =ORIENTATION_DISPLAY - *DefaultOption: PORTRAIT - *Option: PORTRAIT - { - *rcNameID: =PORTRAIT_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.6 - *Cmd: "<1B>&l0O" - } - } - *Option: LANDSCAPE_CC90 - { - *rcNameID: =LANDSCAPE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.8 - *Cmd: "<1B>&l1O" - } - } -} - -*%****************************************************************************************** -*% Input Bin -*%****************************************************************************************** -*Feature: InputBin -{ - *rcNameID: =PAPER_SOURCE_DISPLAY - *DefaultOption: AUTO - *Option: AUTO - { - *rcNameID: =AUTO_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l0H" - } - } - *Option: UPPER - { - *rcNameID: =UPPER_TRAY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l1H" - } - } -} - -*%****************************************************************************************** -*% Resolution -*%****************************************************************************************** -*Feature: Resolution -{ - *rcNameID: =RESOLUTION_DISPLAY - *DefaultOption: Option2 - *Option: Option1 - { - *Name: "600 x 600" =DOTS_PER_INCH - *DPI: PAIR(600, 600) - *TextDPI: PAIR(600, 600) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED,TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "@PJL SET RESOLUTION=600<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t600R" - } - } - *Option: Option2 - { - *Name: "300 x 300" =DOTS_PER_INCH - *DPI: PAIR(300, 300) - *TextDPI: PAIR(300, 300) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED, TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "@PJL SET RESOLUTION=300<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t300R" - } - } - *Option: Option3 - { - *Name: "150 x 150" =DOTS_PER_INCH - *DPI: PAIR(150, 150) - *TextDPI: PAIR(150, 150) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED, TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "@PJL SET RESOLUTION=150<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t150R" - } - } -} - -*%****************************************************************************************** -*% HP-GL/2 Graphics Support -*%****************************************************************************************** -*Ifdef: WINNT_51 -*Personality: =PERSONALITY_HPGL2 -*Feature: GraphicsMode -{ - *rcNameID: =GRAPHICSMODE_DISPLAY - *DefaultOption: RASTERMODE - *Option: HPGL2MODE - { - *rcNameID: =GRAPHICSMODE_HPGL2_DISPLAY - } - *Option: RASTERMODE - { - *rcNameID: =GRAPHICSMODE_RASTER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.6 - *Cmd: "@PJL SET LIMAGEENHANCE=OFF<0A>" - } - } -} -*Endif: - -*%****************************************************************************************** -*% Paper Size -*%****************************************************************************************** -*Feature: PaperSize -{ - *rcNameID: =PAPER_SIZE_DISPLAY - *DefaultOption: LETTER - *Option: LETTER - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1028 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9500, 12500) - *PrintableOrigin: PAIR(400, 400) - *CursorOrigin: PAIR(300, 300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t5260x7704Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9500, 12200) - *PrintableOrigin: PAIR(450, 300) - *CursorOrigin: PAIR(200, 12900) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t7332x5880Y" - } - } - } - } - *Option: LEGAL - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1692 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 600) - *CursorOrigin: PAIR(180, 300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t5880x8900Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 900) - *CursorOrigin: PAIR(180, 16500) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t8900x5880Y" - } - } - } - } - *Option: EXECUTIVE - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4109 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(8100, 11500) - *PrintableOrigin: PAIR(300, 300) - *CursorOrigin: PAIR(300, 200) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t4860x7344Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(8300, 11500) - *PrintableOrigin: PAIR(200, 300) - *CursorOrigin: PAIR(200, 12300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t7272x4980Y" - } - } - } - } - *Option: A4 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4249 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9100, 13200) - *PrintableOrigin: PAIR(400, 300) - *CursorOrigin: PAIR(288, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t5594x8201Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9100, 13200) - *PrintableOrigin: PAIR(400, 300) - *CursorOrigin: PAIR(204, 13824) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t8129x5714Y" - } - } - } - } - *Option: B5 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 3198 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(7900, 11140) - *PrintableOrigin: PAIR(352, 300) - *CursorOrigin: PAIR(300, 100) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l12a8c1E<1B>*p0x0Y<1B>*c0t4970x7040Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(7760, 11140) - *PrintableOrigin: PAIR(300, 400) - *CursorOrigin: PAIR(100, 11940) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l12a8c1E<1B>*p0x0Y<1B>*c0t6780x4970Y" - } - } - } - } -} - -*%****************************************************************************************** -*% Media Type -*%****************************************************************************************** -*Feature: MediaType -{ - *rcNameID: =MEDIA_TYPE_DISPLAY - *DefaultOption: STANDARD - *Option: STANDARD - { - *rcNameID: =PLAIN_PAPER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.15 - *Cmd: "<1B>&n6WdPlain" - } - } - *Option: CustomPhotographicPaper - { - *Name: "Photographic" - *PrintSchemaKeywordMap: "Photographic" - *Command: CmdSelect - { - *Order: DOC_SETUP.15 - *Cmd: "<1B>&n13WdPhotographic" - } - } -} - -*%****************************************************************************************** -*% Color Mode -*%****************************************************************************************** -*Feature: ColorMode -{ - *rcNameID: =COLOR_PRINTING_MODE_DISPLAY - *DefaultOption: 24bpp - *Option: Mono - { - *rcNameID: =MONO_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 1 - *Color?: FALSE - } - *Option: Color - { - *rcNameID: =COLOR_DISPLAY - *DevNumOfPlanes: 3 - *DevBPP: 1 - *DrvBPP: 4 - EXTERN_GLOBAL: *RasterSendAllData?: TRUE - *ColorPlaneOrder: LIST(CYAN, MAGENTA, YELLOW) - *Command: CmdSendCyanData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"V" } - *Command: CmdSendMagentaData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"V" } - *Command: CmdSendYellowData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelectBlackColor { *Cmd : "<1B>*v7S" } - *Command: CmdSelectRedColor { *Cmd : "<1B>*v6S" } - *Command: CmdSelectGreenColor { *Cmd : "<1B>*v5S" } - *Command: CmdSelectYellowColor { *Cmd : "<1B>*v4S" } - *Command: CmdSelectBlueColor { *Cmd : "<1B>*v3S" } - *Command: CmdSelectMagentaColor { *Cmd : "<1B>*v2S" } - *Command: CmdSelectCyanColor { *Cmd : "<1B>*v1S" } - *Command: CmdSelectWhiteColor { *Cmd : "<1B>*v0S" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "<1B>*r-3U" - } - } - *Option: 8bpp - { - *rcNameID: =8BPP_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 8 - *DrvBPP: 8 - *PaletteSize: 256 - *PaletteProgrammable? : TRUE - *Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" -+ %d{PaletteIndexToProgram} "I" } - *Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "<1B>*v1N<1B>*v1O<1B>*t0I<1B>*l184O<1B>*v6W<000108080808>" - } - } - *Option: 24bpp - { - *rcNameID: =24BPP_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 24 - *DrvBPP: 24 - *Command: CmdEnableDRC { *Cmd : "<1B>*b3M" } - *PaletteSize: 256 - *PaletteProgrammable? : TRUE - *Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" -+ %d{PaletteIndexToProgram} "I" } - *Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } - *Command: CmdSetSrcBmpWidth { *Cmd : "<1B>*r" %d{RasterDataWidthInBytes / 3}"S" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "<1B>*v1N<1B>*v1O<1B>*l184O<1B>*v6W<0003080808081B>*v0a0b0c7i255a255b255c0I<1B>*" -+ "o3W<060400>" - } - } -} - -*%****************************************************************************************** -*% HalfTone -*%****************************************************************************************** -*Feature: Halftone -{ - *rcNameID: =HALFTONING_DISPLAY - *DefaultOption: HT_PATSIZE_AUTO - *Option: HT_PATSIZE_AUTO - { - *rcNameID: =HT_AUTO_SELECT_DISPLAY - } - *Option: HT_PATSIZE_SUPERCELL_M - { - *rcNameID: =HT_SUPERCELL_DISPLAY - } - *Option: HT_PATSIZE_6x6_M - { - *rcNameID: =HT_DITHER6X6_DISPLAY - } - *Option: HT_PATSIZE_8x8_M - { - *rcNameID: =HT_DITHER8X8_DISPLAY - } -} - -*%****************************************************************************************** -*% Memory -*% -*% Note: Unidrv uses the font memory information to estimate when it needs to stop -*% downloading fonts for a page, and thus driver writers should err on the conservative -*% side. Otherwise, printers will generate "out of memory" device errors for pages with -*% a large number of fonts / unique glyphs. -*%****************************************************************************************** -*Feature: Memory -{ - *rcNameID: =PRINTER_MEMORY_DISPLAY - *DefaultOption: 32768KB - *Option: 4096KB - { - *Name: "4MB" - *MemoryConfigKB: PAIR(4096, 6750) - } - *Option: 8192KB - { - *Name: "8MB" - *MemoryConfigKB: PAIR(8192, 10350) - } - *Option: 16384KB - { - *Name: "16MB" - *MemoryConfigKB: PAIR(16384, 13950) - } - *Option: 24576KB - { - *Name: "24MB" - *MemoryConfigKB: PAIR(24576, 21150) - } - *Option: 32768KB - { - *Name: "32MB" - *MemoryConfigKB: PAIR(32768, 28350) - } - *Option: 49152KB - { - *Name: "48MB" - *MemoryConfigKB: PAIR(49152, 43050) - } - *Option: 65536KB - { - *Name: "64MB" - *MemoryConfigKB: PAIR(65536, 57150) - } - *Option: 98304KB - { - *Name: "96MB" - *MemoryConfigKB: PAIR(98304, 85950) - } - *Option: 102400KB - { - *Name: "100MB" - *MemoryConfigKB: PAIR(102400, 89700) - } - *Option: 114688KB - { - *Name: "112MB" - *MemoryConfigKB: PAIR(114688, 100550) - } - *Option: 131072KB - { - *Name: "128MB" - *MemoryConfigKB: PAIR(131072, 116250) - } -} - -*%****************************************************************************************** -*% Duplex Unit -*%****************************************************************************************** -*Feature: DuplexUnit -{ - *rcNameID: 429 - *FeatureType: PRINTER_PROPERTY - *DefaultOption: FALSE - *Option: FALSE - { - *rcNameID: 444 - *DisabledFeatures: LIST(Duplex.VERTICAL, Duplex.HORIZONTAL) - } - *Option: TRUE - { - *rcNameID: 443 - } -} - -*%****************************************************************************************** -*% Duplex Type -*%****************************************************************************************** -*Feature: Duplex -{ - *rcNameID: =TWO_SIDED_PRINTING_DISPLAY - *DefaultOption: NONE - *Option: NONE - { - *rcNameID: =NONE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l0S" - } - } - *Option: VERTICAL - { - *rcNameID: =FLIP_ON_LONG_EDGE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l1S" - } - } - *Option: HORIZONTAL - { - *rcNameID: =FLIP_ON_SHORT_EDGE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l2S" - } - } -} - -*%****************************************************************************************** -*% Page Photo Printing Intent -*%****************************************************************************************** -*Feature: PhotoPrintingIntent -{ - *Name: "Photo Printing Intent" - *PrintSchemaKeywordMap: "PagePhotoPrintingIntent" - *DefaultOption: None - *Option: None - { - *Name: "None" - *PrintSchemaKeywordMap: "None" - } - *Option: Draft - { - *Name: "Draft" - *PrintSchemaKeywordMap: "PhotoDraft" - } - *Option: Standard - { - *Name: "Standard" - *PrintSchemaKeywordMap: "PhotoStandard" - } - *Option: Best - { - *Name: "Best" - *PrintSchemaKeywordMap: "PhotoBest" - } -} - - -*Feature: OutputQuality -{ - *Name: "Page Output Quality" - *PrintSchemaKeywordMap: "PageOutputQuality" - *DefaultOption: None - *Option: None - { - *Name: "None" - *PrintSchemaKeywordMap: "None" - } - *Option: Draft - { - *Name: "Draft" - *PrintSchemaKeywordMap: "Draft" - } - *Option: High - { - *Name: "High" - *PrintSchemaKeywordMap: "High" - } - *Option: Photographic - { - *Name: "Photographic" - *PrintSchemaKeywordMap: "Photographic" - } -} - -*%****************************************************************************************** -*% Page Protect -*%****************************************************************************************** -*Feature: PageProtect -{ - *rcNameID: =PAGE_PROTECTION_DISPLAY - *DefaultOption: OFF - *Option: ON - { - *rcNameID: =ON_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.1 - *Cmd: "<1B>%%-12345X@PJL SET PAGEPROTECT=LETTER<0A>" - } - } - *Option: OFF - { - *rcNameID: =OFF_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.1 - *Cmd: "<1B>%%-12345X@PJL SET PAGEPROTECT=OFF<0A>" - } - } -} - -*%****************************************************************************************** -*% Doc setup commands -*%****************************************************************************************** -*Command: CmdStartDoc -{ - *Order: DOC_SETUP.7 - *Cmd: "<1B>&u1200D<1B>*r0F" -} -*Command: CmdStartPage -{ - *Order: PAGE_SETUP.1 - *Cmd: "<1B>*b0M<0D>" -} -*Command: CmdEndJob -{ - *Order: JOB_FINISH.1 - *Cmd: "<1B>E<1B>%%-12345X@PJL<20>LPORTROTATE<0A><1B>%%-12345X" -} -*Command: CmdCopies -{ - *Order: DOC_SETUP.13 - *Cmd: "<1B>&l" %d{NumOfCopies}"X" -} - -*%****************************************************************************************** -*% Cursor, Page and Color Commands -*%****************************************************************************************** -*RotateCoordinate?: TRUE -*RotateRaster?: TRUE -*RotateFont?: TRUE -*TextCaps: LIST(TC_CR_90,TC_UA_ABLE) -*MemoryUsage: LIST(FONT, RASTER, VECTOR) -*CursorXAfterCR: AT_PRINTABLE_X_ORIGIN -*BadCursorMoveInGrxMode: LIST(X_PORTRAIT,Y_LANDSCAPE) -*XMoveThreshold: 0 -*YMoveThreshold: 0 -*XMoveUnit: 300 -*YMoveUnit: 300 -*Command: CmdXMoveAbsolute { *Cmd : "<1B>*p" %d{(DestX) }"X" } -*Command: CmdXMoveRelRight { *Cmd : "<1B>*p+" %d[0,9600]{max_repeat((DestXRel) )}"X" } -*Command: CmdXMoveRelLeft { *Cmd : "<1B>*p-" %d[0,9600]{max_repeat((DestXRel) )}"X" } -*Command: CmdYMoveAbsolute { *Cmd : "<1B>*p" %d{(DestY) }"Y" } -*Command: CmdYMoveRelDown { *Cmd : "<1B>*p+" %d{(DestYRel) }"Y" } -*Command: CmdYMoveRelUp { *Cmd : "<1B>*p-" %d{(DestYRel) }"Y" } -*Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" -+ %d{PaletteIndexToProgram} "I" } -*Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } -*Command: CmdCR { *Cmd : "<0D>" } -*Command: CmdLF { *Cmd : "<0A>" } -*Command: CmdFF { *Cmd : "<0C>" } -*Command: CmdBackSpace { *Cmd : "<08>" } -*Command: CmdUniDirectionOn { *Cmd : "<00>" } -*Command: CmdUniDirectionOff { *Cmd : "<00>" } -*Command: CmdPushCursor { *Cmd : "<1B>&f0S" } -*Command: CmdPopCursor { *Cmd : "<1B>&f1S" } -*Command: CmdSetSimpleRotation { *Cmd : "<1B>&a" %d{PrintDirInCCDegrees}"P" } -*EjectPageWithFF?: TRUE -*Command: CmdEnableTIFF4 { *Cmd : "<1B>*b2M" } -*Command: CmdDisableCompression { *Cmd : "<1B>*b0M" } -*OutputDataFormat: H_BYTE -*OptimizeLeftBound?: TRUE -*CursorXAfterSendBlockData: AT_GRXDATA_ORIGIN -*CursorYAfterSendBlockData: AUTO_INCREMENT - -*%****************************************************************************************** -*% Font Descriptions and Commands -*%****************************************************************************************** -*TTFSEnabled?: TRUE -*DefaultFont: 136 -*DefaultCTT: 0 -*CharPosition: BASELINE -*DeviceFonts: LIST(136,138,146,147,148,149,150,151,152,153,154,155,156,157, -+ 163,164,165,166,196,197,198,199,200,201,202,203,209,210, -+ 211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226, -+ 227,228,229,230) -*MinFontID: 16534 -*MaxFontID: 32768 -*switch: Resolution -{ - *case: Option1 - { - *FontFormat: HPPCL_OUTLINE - } - *case: Option2 - { - *FontFormat: HPPCL_OUTLINE - } - *case: Option3 - { - *FontFormat: HPPCL_RES - } -} -*Command: CmdSetFontID { *Cmd : "<1B>*c" %d{NextFontID}"D" } -*Command: CmdSelectFontID { *Cmd : "<1B>(" %d{CurrentFontID}"X" } -*Command: CmdSetCharCode { *Cmd : "<1B>*c" %d{NextGlyph}"E" } -*Command: CmdUnderlineOn { *Cmd : "<1B>&dD" } -*Command: CmdUnderlineOff { *Cmd : "<1B>&d@" } -*Command: CmdWhiteTextOn { *Cmd : "<1B>*v1o1T" } -*Command: CmdWhiteTextOff { *Cmd : "<1B>*v0o0T" } - - -*%******************************************************************************************** -*%* Vector Commands. -*%******************************************************************************************** -*MinGrayFill: 1 -*MaxGrayFill: 100 -*Command: CmdSetRectWidth { *Cmd : "<1B>*c" %d{(RectXSize) }"A" } -*Command: CmdSetRectHeight { *Cmd : "<1B>*c" %d{(RectYSize) }"B" } -*Command: CmdRectGrayFill { *Cmd : "<1B>*c" %d{GrayPercentage }"g2P" } -*Command: CmdRectWhiteFill { *Cmd : "<1B>*c1P" } -*Command: CmdRectBlackFill { *Cmd : "<1B>*c0P" } diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf deleted file mode 100644 index 067896bd..00000000 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.inf and /dev/null differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.ini b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.ini deleted file mode 100644 index 5535181a..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/install/ptpcplpr.ini +++ /dev/null @@ -1,3 +0,0 @@ -[OEMFiles] -OEMConfigFile1=PTPCPLPR.DLL - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/PTPCPLPR.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/PTPCPLPR.vcxproj deleted file mode 100644 index 33380c3f..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/PTPCPLPR.vcxproj +++ /dev/null @@ -1,904 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {CED613CF-6666-43FC-9414-02AFBDA83A34} - $(MSBuildProjectName) - Win10 Debug - Win32 - {77D353B7-7DE8-4AB3-A89C-86F5EB1FC56C} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - PTPCPLPR - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - MultiThreaded - MultiThreadedDebug - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;PLUGIN_PRINTTICKET - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib - PTPCPLPR.def - - - - - ;%(AdditionalIncludeDirectories) - precomp.hxx - Use - $(IntDir)\precomp.hxx.pch - - - ;%(AdditionalIncludeDirectories) - precomp.hxx - Use - $(IntDir)\precomp.hxx.pch - - - ;%(AdditionalIncludeDirectories) - precomp.hxx - Use - $(IntDir)\precomp.hxx.pch - - - ;%(AdditionalIncludeDirectories) - precomp.hxx - Use - $(IntDir)\precomp.hxx.pch - - - ;%(AdditionalIncludeDirectories) - precomp.hxx - Create - $(IntDir)\precomp.hxx.pch - - - ;%(AdditionalIncludeDirectories) - precomp.hxx - Use - $(IntDir)\precomp.hxx.pch - - - ;%(AdditionalIncludeDirectories) - precomp.hxx - Use - $(IntDir)\precomp.hxx.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/PTPCPLPR.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/PTPCPLPR.vcxproj.Filters deleted file mode 100644 index abd9c1c0..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/PTPCPLPR.vcxproj.Filters +++ /dev/null @@ -1,272 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {968C24E3-F5FE-4473-9D02-E46A409462B6} - - - h;hpp;hxx;hm;inl;inc;xsd - {D7302931-5FEA-4B5A-B5B1-7B1938023A9E} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {1475CB34-56B8-45D0-9740-D86566D868E6} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/debug.hxx b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/debug.hxx deleted file mode 100644 index 877fd6e3..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/debug.hxx +++ /dev/null @@ -1,82 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.hxx -// -// PURPOSE: Define common data types, and external function prototypes -// for debugging functions. Also defines the various debug macros. -// -// - -#pragma once - -///////////////////////////////////////////////////////// -// Macros -///////////////////////////////////////////////////////// -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// WARNING("App passed NULL pointer, ignoring...\n"); -// - -#define DBG_VERBOSE 0 -#define DBG_WARNING 1 -#define DBG_ERROR 2 -#define DBG_NONE 3 - -// VC and Build use different debug defines. -#if defined (DBG) || defined (_DEBUG) - - // __declspec(selectany) ensures that even if this is defined in multiple compilation - // modules, they will all resolve to the same symbol in the linked DLL - __declspec(selectany) INT giDebugLevel = 2; - - #define STRINGIZE(x) #x - #define QUOTE(x) STRINGIZE(x) - #define FILE_AND_LINE __FILE__ "@" QUOTE(__LINE__) - - #define VERBOSE(msg) { if(giDebugLevel <= DBG_VERBOSE) OutputDebugStringA( FILE_AND_LINE ": " msg); } - #define WARNING(msg) { if(giDebugLevel <= DBG_WARNING) OutputDebugStringA( FILE_AND_LINE ": Warning: " msg); } - #define ERR(msg) { if(giDebugLevel <= DBG_ERROR) OutputDebugStringA(FILE_AND_LINE ": Error:" msg); } - #define ASSERT(cond) { if (!(cond)) RIP("\n"); } - #define RIP(msg) { OutputDebugStringA(FILE_AND_LINE ": Error (not recoverable): " msg); DebugBreak(); } - -#else // !DBG - - #define VERBOSE(msg) - #define WARNING(msg) - #define ERR(msg) - #define ASSERT(cond) - #define RIP(msg) - -#endif - - - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/dllentry.cxx b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/dllentry.cxx deleted file mode 100644 index 4934dfc2..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/dllentry.cxx +++ /dev/null @@ -1,48 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cxx -// -// PURPOSE: Source module for DLL entry function(s). -// - -#include "precomp.hxx" -#include "oem.hxx" -#include "debug.hxx" -#include "globals.hxx" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////////////////////////// -// -// DLL entry point -// -BOOL WINAPI DllMain(HINSTANCE hInst, WORD wReason, LPVOID ) -{ - switch(wReason) - { - case DLL_PROCESS_ATTACH: - VERBOSE(DLLTEXT("Process attach.\r\n")); - ghInstance = hInst; - break; - - case DLL_THREAD_ATTACH: - VERBOSE(DLLTEXT("Thread attach.\r\n")); - break; - - case DLL_PROCESS_DETACH: - VERBOSE(DLLTEXT("Process detach.\r\n")); - break; - - case DLL_THREAD_DETACH: - VERBOSE(DLLTEXT("Thread detach.\r\n")); - break; - } - - return TRUE; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/globals.cxx b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/globals.cxx deleted file mode 100644 index 75abea62..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/globals.cxx +++ /dev/null @@ -1,21 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: globals.cxx -// - -#include "precomp.hxx" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -// Module's Instance handle from DLLEntry of process. -HINSTANCE ghInstance = NULL; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/globals.hxx b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/globals.hxx deleted file mode 100644 index 72f3aa11..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/globals.hxx +++ /dev/null @@ -1,25 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: globals.hxx -// - -#pragma once - -// -// Maximum string length limit for STRSAFE string length function StringCchLength -// Must be less than or equal to maximum upper bound on string length defined by STRSAFE -// library ie STRSAFE_MAX_CCH -// -#define STR_MAX_CCH 10000 - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -// Module's Instance handle from DLLEntry of process. -extern HINSTANCE ghInstance; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/intrface.cxx b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/intrface.cxx deleted file mode 100644 index 3d6f3b90..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/intrface.cxx +++ /dev/null @@ -1,493 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: intrface.cxx -// -// -// PURPOSE: Implementation of interface for PScript4, PScript5, Unidrv4, -// Unidrv5 UI plug-ins. -// -// - - -#include "precomp.hxx" -#include "debug.hxx" -#include "intrface.hxx" -#include "oem.hxx" -#include "oemptprovider.hxx" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -//////////////////////////////////////////////////////// -// Private Globals -//////////////////////////////////////////////////////// - -static long g_cComponents = 0 ; // Count of active components -static long g_cServerLocks = 0 ; // Count of locks - -//////////////////////////////////////////////////////////////////////////////// -// -// IOemUI body -// - -IOemUI::~IOemUI() -{ - // If this instance of the object is being deleted, then the reference - // count should be zero. - assert(0 == m_cRef); -} - -HRESULT __stdcall IOemUI::QueryInterface(const IID& iid, void** ppv) -{ - VERBOSE(DLLTEXT("IOemUI:QueryInterface entry.\r\n\r\n")); - if (IID_IUnknown == iid) - { - *ppv = static_cast(this); - VERBOSE(DLLTEXT("IOemUI:Return pointer to IUnknown.\r\n\r\n")); - } - else if (IID_IPrintOemUI == iid) - { - *ppv = static_cast(this) ; - VERBOSE(DLLTEXT("IOemUI:Return pointer to IPrintOemUI.\r\n")); - } - else - { - VERBOSE(DLLTEXT("IOemUI::QueryInterface not supported.\r\n")); - *ppv = NULL ; - return E_NOINTERFACE ; - } - reinterpret_cast(*ppv)->AddRef() ; - return S_OK ; -} - -ULONG __stdcall IOemUI::AddRef() -{ - VERBOSE(DLLTEXT("IOemUI:AddRef entry.\r\n")); - return InterlockedIncrement(&m_cRef) ; -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemUI::Release() -{ - VERBOSE(DLLTEXT("IOemUI:Release entry.\r\n")); - ASSERT (0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - } - return cRef; -} - -HRESULT __stdcall IOemUI::PublishDriverInterface( - IUnknown *) -{ - VERBOSE(DLLTEXT("IOemUI:PublishDriverInterface entry.\r\n")); - - return S_OK; -} - -HRESULT __stdcall IOemUI::GetInfo( - DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded) -{ - VERBOSE(DLLTEXT("IOemUI::GetInfo entry.\r\r\n")); - - // Validate parameters. - if( (NULL == pcbNeeded) - || - ( (OEMGI_GETSIGNATURE != dwMode) - && - (OEMGI_GETVERSION != dwMode) - && - (OEMGI_GETPUBLISHERINFO != dwMode) - ) - ) - { - WARNING(DLLTEXT("IOemUI::GetInfo() exit pcbNeeded is NULL! ERROR_INVALID_PARAMETER\r\r\n")); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Set expected buffer size and number of bytes written. - *pcbNeeded = sizeof(DWORD); - - // Check buffer size is sufficient. - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - WARNING(DLLTEXT("IOemUI::GetInfo() exit insufficient buffer!\r\r\n")); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return E_FAIL; - } - - switch(dwMode) - { - // OEM DLL Signature - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // OEM DLL version - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // dwMode not supported. - default: - // Set written bytes to zero since nothing was written. - WARNING(DLLTEXT("IOemUI::GetInfo() exit mode not supported.\r\r\n")); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - return E_FAIL; - } - - VERBOSE(DLLTEXT("IOemUI::GetInfo() exit S_OK.\r\r\n")); - return S_OK; -} - -HRESULT __stdcall IOemUI::DevMode( - DWORD , - POEMDMPARAM ) -{ - VERBOSE(DLLTEXT("IOemUI:DevMode entry.\r\n")); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::CommonUIProp( - DWORD , - POEMCUIPPARAM) -{ - VERBOSE(DLLTEXT("IOemUI:CommonUIProp entry.\r\n")); - - return E_NOTIMPL; -} - - -HRESULT __stdcall IOemUI::DocumentPropertySheets( - PPROPSHEETUI_INFO , - LPARAM ) -{ - VERBOSE(DLLTEXT("IOemUI:DocumentPropertySheets entry.\r\n")); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::DevicePropertySheets( - PPROPSHEETUI_INFO , - LPARAM ) -{ - VERBOSE(DLLTEXT("IOemUI:DevicePropertySheets entry.\r\n")); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::DeviceCapabilities( - POEMUIOBJ , - HANDLE , -_In_ PWSTR , - WORD , - PVOID , - PDEVMODE , - PVOID , - DWORD , - DWORD * ) -{ - VERBOSE(DLLTEXT("IOemUI:DeviceCapabilities entry.\r\n")); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::DevQueryPrintEx( - POEMUIOBJ , - PDEVQUERYPRINT_INFO , - PDEVMODE , - PVOID ) -{ - VERBOSE(DLLTEXT("IOemUI:DevQueryPrintEx entry.\r\n")); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::UpgradePrinter( - DWORD , - PBYTE ) -{ - VERBOSE(DLLTEXT("IOemUI:UpgradePrinter entry.\r\n")); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::PrinterEvent( -_In_ PWSTR , - INT , - DWORD , - LPARAM ) -{ - VERBOSE(DLLTEXT("IOemUI:PrinterEvent entry.\r\n")); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::DriverEvent( - DWORD , - DWORD , - LPBYTE , - LPARAM ) -{ - VERBOSE(DLLTEXT("IOemUI:DriverEvent entry.\r\n")); - - return E_NOTIMPL; -}; - - -#define PROFILE_NAME L"OEMPROFILE.icm\0" - -HRESULT __stdcall IOemUI::QueryColorProfile( - HANDLE , - POEMUIOBJ , - PDEVMODE , - PVOID , - ULONG , - VOID *, - ULONG *, - FLONG *) -{ - - VERBOSE(DLLTEXT("IOemUI:QueryColorProfile entry.\r\n")); - - return E_NOTIMPL; -}; - -HRESULT __stdcall IOemUI::FontInstallerDlgProc( - HWND , - UINT , - WPARAM , - LPARAM ) -{ - VERBOSE(DLLTEXT("IOemUI:FontInstallerDlgProc entry.\r\n")); - - return E_NOTIMPL; -}; - -HRESULT __stdcall IOemUI::UpdateExternalFonts( - HANDLE , - HANDLE , -_In_ PWSTR ) -{ - VERBOSE(DLLTEXT("IOemUI:UpdateExternalFonts entry.\r\n")); - - return E_NOTIMPL; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// oem class factory -// -class IOemCF : public IClassFactory -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // *** IClassFactory methods *** - STDMETHOD(CreateInstance) (THIS_ - LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID FAR* ppvObject); - STDMETHOD(LockServer) (THIS_ BOOL bLock); - - - // Constructor - IOemCF(): m_cRef(1) {}; - ~IOemCF() {}; - -protected: - LONG m_cRef; - -}; - -/////////////////////////////////////////////////////////// -// -// Class factory body -// -HRESULT __stdcall IOemCF::QueryInterface(const IID& iid, void** ppv) -{ - if ((IID_IUnknown == iid) || (IID_IClassFactory == iid)) - { - *ppv = static_cast(this) ; - } - else - { - VERBOSE(DLLTEXT("IOemCF::QueryInterface not supported.\r\n")); - *ppv = NULL ; - return E_NOINTERFACE ; - } - reinterpret_cast(*ppv)->AddRef() ; - return S_OK ; -} - -ULONG __stdcall IOemCF::AddRef() -{ - return InterlockedIncrement(&m_cRef) ; -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemCF::Release() -{ - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - } - return cRef; -} - -// IClassFactory implementation -HRESULT __stdcall IOemCF::CreateInstance(IUnknown* pUnknownOuter, - const IID& iid, - void** ppv) -{ - HRESULT hr = S_OK; - - //DbgPrint(DLLTEXT("Class factory:\t\tCreate component.")) ; - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Cannot aggregate. - if (NULL != pUnknownOuter) - { - return CLASS_E_NOAGGREGATION ; - } - - // Create component. - IOemUI* pOemCB = new IOemUI ; - if (NULL == pOemCB) - { - return E_OUTOFMEMORY ; - } - // Get the requested interface. - hr = pOemCB->QueryInterface(iid, ppv) ; - - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - pOemCB->Release() ; - - if (FAILED(hr)) - { - IOEMPTProvider * pOemPT = new IOEMPTProvider(); - - if(NULL == pOemPT) - { - return E_OUTOFMEMORY; - } - - hr = pOemPT->QueryInterface(iid, ppv) ; - - pOemPT->Release(); - } - - return hr ; -} - -// LockServer -HRESULT __stdcall IOemCF::LockServer(BOOL bLock) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks) ; - } - else - { - InterlockedDecrement(&g_cServerLocks) ; - } - return S_OK ; -} - -/////////////////////////////////////////////////////////// -// -// Exported functions -// - - -// Can DLL unload now? -// -STDAPI DllCanUnloadNow() -{ - // - // To avoid leaving OEM DLL still in memory when Unidrv or Pscript drivers - // are unloaded, Unidrv and Pscript driver ignore the return value of - // DllCanUnloadNow of the OEM DLL, and always call FreeLibrary on the OEMDLL. - // - // If OEM DLL spins off a working thread that also uses the OEM DLL, the - // thread needs to call LoadLibrary and FreeLibraryAndExitThread, otherwise - // it may crash after Unidrv or Pscript calls FreeLibrary. - // - - if ((0 == g_cComponents) && (0 == g_cServerLocks)) - { - return S_OK ; - } - else - { - return S_FALSE; - } -} - -// -// Get class factory -// -STDAPI DllGetClassObject( - _In_ REFCLSID clsid, - _In_ REFIID iid, - _Outptr_ LPVOID* ppv) -{ - VERBOSE(DLLTEXT("DllGetClassObject:Create class factory.\r\n")); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Can we create this component? - if (CLSID_OEMUI != clsid && CLSID_OEMPTPROVIDER != clsid) - { - return CLASS_E_CLASSNOTAVAILABLE ; - } - - // Create class factory. - IOemCF* pFontCF = new IOemCF ; // Reference count set to 1 - // in constructor - if (NULL == pFontCF) - { - return E_OUTOFMEMORY ; - } - - // Get requested interface. - HRESULT hr = pFontCF->QueryInterface(iid, ppv) ; - pFontCF->Release() ; - - return hr ; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/intrface.hxx b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/intrface.hxx deleted file mode 100644 index 99b950d3..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/intrface.hxx +++ /dev/null @@ -1,178 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: intrface.cxx -// -// PURPOSE: Header of interface for PScript4, PScript5, Unidrv4, -// Unidrv5 UI plug-ins. -// -// - -#pragma once - -//////////////////////////////////////////////////////////////////////////////// -// -// IOemUI -// -class IOemUI: public IPrintOemUI -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Get OEM dll related information - // - - STDMETHOD(GetInfo) (THIS_ DWORD dwMode, PVOID pBuffer, DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDevMode - // - - STDMETHOD(DevMode) (THIS_ DWORD dwMode, POEMDMPARAM pOemDMParam) ; - - // - // OEMCommonUIProp - // - - STDMETHOD(CommonUIProp) (THIS_ - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam - ); - - // - // OEMDocumentPropertySheets - // - - STDMETHOD(DocumentPropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - // - // OEMDevicePropertySheets - // - - STDMETHOD(DevicePropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - - // - // OEMDevQueryPrintEx - // - - STDMETHOD(DevQueryPrintEx) (THIS_ - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM - ); - - // - // OEMDeviceCapabilities - // - - STDMETHOD(DeviceCapabilities) (THIS_ - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult - ); - - // - // OEMUpgradePrinter - // - - STDMETHOD(UpgradePrinter) (THIS_ - DWORD dwLevel, - PBYTE pDriverUpgradeInfo - ); - - // - // OEMPrinterEvent - // - - STDMETHOD(PrinterEvent) (THIS_ - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam - ); - - // - // OEMDriverEvent - // - - STDMETHOD(DriverEvent)(THIS_ - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam - ); - - // - // OEMQueryColorProfile - // - - STDMETHOD(QueryColorProfile) (THIS_ - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulReserved, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData); - - // - // OEMFontInstallerDlgProc - // - - STDMETHOD(FontInstallerDlgProc) (THIS_ - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam - ); - // - // UpdateExternalFonts - // - - STDMETHOD(UpdateExternalFonts) (THIS_ - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges - ); - - IOemUI() : m_cRef(1) {}; - ~IOemUI(); - -protected: - LONG m_cRef; -}; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/oem.hxx b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/oem.hxx deleted file mode 100644 index a8c7b03c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/oem.hxx +++ /dev/null @@ -1,26 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: oem.hxx -// - -#pragma once - -//////////////////////////////////////////////////////// -// OEM Defines -//////////////////////////////////////////////////////// - -#define OEM_SIGNATURE 'MSFT' -#define OEM_VERSION 0x00000001L - -//////////////////////////////////////////////////////// -// OEM UI Defines -//////////////////////////////////////////////////////// - -// OEM UI Misc defines. -#define DLLTEXT(s) "PTPC Plugin: " s - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/oemptprovider.cxx b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/oemptprovider.cxx deleted file mode 100644 index e0e94632..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/oemptprovider.cxx +++ /dev/null @@ -1,1145 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED -// TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: oemptprovider.cxx -// -// -// PURPOSE: Implementation of IOEMPTProvider Class. -// The Provider class implements the -// IPrintOemPrintTicketProvider interface functions that -// provide the plug-in access to Print Ticket and allow the -// plug-in to understand the Unidrv private setting in -// the Print Ticket and expose its private settings to -// Unidrv by putting them publicly in the Print Ticket. The -// various provider methods make use of the -// IPrintCoreHelper Interface methods to -// create instances of XML objects and to communicate -// information with Unidrv. -// -// Functions: -// IPrintOemPrintTicketProvider Interface Functions. -// Private Functions of class IOEMPTProvider. -// - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -#include "precomp.hxx" -#include "globals.hxx" -#include "debug.hxx" -#include "oem.hxx" -#include "xmlhandler.hxx" -#include "oemptprovider.hxx" -#include "printschema.hxx" - -/*++ - -Routine Name: - - IOEMPTProvider constructor - -Routine Description: - - Constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -IOEMPTProvider::IOEMPTProvider() - : m_pCoreHelper(NULL), - m_cRef(1) -{ -} - -/*++ - -Routine Name: - - IOEMPTProvider destructor - -Routine Description: - - Destructor - -Arguments: - - None - -Return Value: - - None - ---*/ - -IOEMPTProvider::~IOEMPTProvider() -{ - - // - // Make sure that helper interface is released. - // - if (m_pCoreHelper) - { - m_pCoreHelper->Release(); - m_pCoreHelper = NULL; - } - - // - // If this instance of the object is being deleted, then the reference - // count should be zero. - // - ASSERT(0 == m_cRef); - -} - -/*++ - -Routine Name: - - IOEMPTProvider QueryInterface - -Routine Description: - - Returns a pointer to a specified interface on an object to which a client currently holds an - interface pointer. - This function must call IUnknown::AddRef on the pointer it returns. - -Arguments: - - riid - Identifier of requested Interface. - ppObj - Output variable that receives the pointer to requested Interface on success - -Return Value: - - HRESULT - S_OK - If the Interface requested is supported - E_NOINTERFACE otherwise - ---*/ - -STDMETHODIMP IOEMPTProvider::QueryInterface( - REFIID riid, - void **ppObj - ) -{ - if ((IID_IUnknown == riid) || (IID_IPrintOemPrintTicketProvider == riid)) - { - *ppObj = static_cast(this); - } - else - { - *ppObj = NULL ; - return E_NOINTERFACE ; - } - reinterpret_cast(*ppObj)->AddRef(); - return S_OK ; -} - -/*++ - -Routine Name: - - AddRef - -Routine Description: - - The AddRef method increments the reference count for an an interface - on an object. It should be called for every new copy of a pointer to - an interface on a given object. - -Arguments: - - None - -Return Value: - - Returns the value of the new reference count. - ---*/ - -STDMETHODIMP_(ULONG) IOEMPTProvider::AddRef( - VOID - ) -{ - return InterlockedIncrement(&m_cRef); -} - -/*++ - -Routine Name: - - Release - -Routine Description: - - The Release method decrements the reference count for the calling - interface on a object. If the reference count on the object falls - to 0, the object is freed from memory. - -Arguments: - - None - -Return Value: - - Returns the resulting value of the reference count. - ---*/ -_At_(this, __drv_freesMem(object)) -STDMETHODIMP_(ULONG) IOEMPTProvider::Release( - THIS - ) -{ - ULONG cRef = InterlockedDecrement(&m_cRef); - - if (0 == cRef) - { - delete this; - } - return cRef; -} - -/*++ - -Routine Name: - - GetSupportedVersions - -Routine Description: - - The routine returns major versions of Printschema schema supported by the plug-in Provider. - - -Arguments: - hPrinter - Printer Handle - ppVersions - OUT pointer to array of version numbers to be filled in by the plug-in - cVersions - OUT pointer to count of Number of versions supported by plug-in - -Return Value: - HRESULT - S_OK - On Success - E_* - On failure - ---*/ -STDMETHODIMP IOEMPTProvider::GetSupportedVersions -( - _In_ HANDLE , - _Outptr_result_buffer_maybenull_(*cVersions) INT *ppVersions[], - _Out_ INT *cVersions - ) -{ - VERBOSE(DLLTEXT("IOEMPTProvider::GetSupportedVersions: entry.\r\n")); - - HRESULT hr = S_OK; - - // - // check if input parameters are valid - // - if (!ppVersions || !cVersions) - { - return E_INVALIDARG; - } - - // - // The Plug-in Provider need to allocate memory for the input version array and - // then fill it with version information - // - *ppVersions = (INT *)CoTaskMemAlloc(sizeof(INT)); - - if (!*ppVersions) - { - *cVersions = 0; - return E_OUTOFMEMORY; - } - else - { - // - // version number 1 is the only version supported currently - // - - *cVersions = 1; - (*ppVersions)[0] = PRINTSCHEMA_VERSION_NUMBER; - } - - return hr; -} - -/*++ - -Routine Name: - - BindPrinter - -Routine Description: - - Bind Printer is the part of the Unidrv's activity to bind to a device. It allows the plug-in to cache - certain information that can be used later on. - -Arguments: - - hPrinter - Printer Handle supplied by Unidrv - version - version of Printschema - pOptions - Flags passed out to set configurable options supported by caller - cNamespaces - Count of private namespaces of plug-in - ppNamespaces - OUT pointer to the array of Namespace URIs filled in by plug-in - -Return Value: - - HRESULT - S_OK - On Success - E_VERSION_NOT_SUPPORTED - if printer version specified is not supported by plug-in - E_* - On any other failure - ---*/ - -STDMETHODIMP IOEMPTProvider::BindPrinter -( - _In_ HANDLE hPrinter, - INT version, - _Out_ POEMPTOPTS pOptions, - _Out_ INT *cNamespaces, - _Outptr_result_buffer_maybenull_(*cNamespaces) BSTR **ppNamespaces - ) -{ - VERBOSE(DLLTEXT("IOEMPTProvider::BindPrinter: entry.\r\n")); - - HRESULT hr = S_OK; - - // - // check if input parameters are NULL - // Printer Handle should be provided by Unidrv in this call, which is cached by plug-in provider and - // is later on used while making calls to Plug-in Helper Interface methods. - // - if (!pOptions || !cNamespaces || !ppNamespaces || !hPrinter) - { - return E_INVALIDARG; - } - - - *ppNamespaces = NULL; - - *cNamespaces = 0; - - // - // Agree on the Printschema version with Unidrv - // Version 1 is the only version currently supported - // - if (PRINTSCHEMA_VERSION_NUMBER != version) - { - return E_VERSION_NOT_SUPPORTED; - } - - // - // Bind to the Physical Printer device - // cache the printer handle for further use - // - m_hPrinterCached = hPrinter; - - // - // Flags to set configurable options, - // OEMPT_DEFAULT defined in prcomoem.h - // - *pOptions = OEMPT_DEFAULT; - - return hr; - -} - -/*++ - -Routine Name: - - PublishPrintTicketHelperInterface - -Routine Description: - - For a number of operations, the plug-in needs to use the Helper Interface utilities provided by - Unidrv. Unidrv uses this method to publish the Print Ticket Helper Interface, IPrintCoreHelper. - Plug-in should return SUCCESS after successfully incrementing the reference count of the interface. - -Arguments: - - pHelper - IPrintCoreHelper interface pointer - -Return Value: - - HRESULT - S_OK - On Success - E_* - On failure - ---*/ -STDMETHODIMP IOEMPTProvider::PublishPrintTicketHelperInterface -( - _In_ IUnknown *pHelper - ) -{ - VERBOSE(DLLTEXT("IOEMPTProvider::PublishPrintTicketHelperInterface: entry.\r\n")); - - if (!pHelper) - { - return E_INVALIDARG; - } - - HRESULT hr = S_OK; - - // - // Need to store pointer to Driver Helper functions, if we already haven't. - // - if (NULL == m_pCoreHelper) - { - hr = pHelper->QueryInterface(IID_IPrintCoreHelperUni, (VOID**)&m_pCoreHelper); - } - - // - // It's possible that this routine will publish other interfaces in the - // future. If the object published did not support the desired interface, - // this routine should still succeed. - // - // If the helper interface is needed, but for some reason was not - // published (this would be an error on the OS's part), you should - // detect this and fail during the call-back where you intended to - // use the helper interface. - // - - if (E_NOINTERFACE == hr) - { - hr = S_OK; - } - - return hr; -} - -/*++ - -Routine Name: - - QueryDeviceDefaultNamespace - -Routine Description: - - Plug-in should specify the name of Private namespace URI that Unidrv - should be using to handle any features defined in the GPD that Unidrv - does not recognize plug-in may specify a set of namespaces as a result - of the call to BindPrinter method, and Unidrv needs to know which of - them is to be used as default namespace so that, for all the features - that Unidrv does not recognize, it will put them under this namespace - in Print Ticket. - - This method is optional. A plug-in can return E_NOTIMPL from this - method if there are multiple plug-ins and another plug-in is providing - the default, or if the plug-in does not want to change the default - namespace that unidrv provides. - - Note: It is Unidrv's responsibility to add the private namespace URI - that plug-in has specified through this call in the root node of the - DOM document, and also define a prefix for it so that plug-in should - use the prefix defined by Unidrv when it wishes to add any new node to - the Print Ticket under its private namespace. Plug-in should not define - its own prefix for this default private namespace URI. - -Arguments: - - pbstrNamespaceUri - OUT Pointer to namespace URI to be filled in and returned by plug-in - -Return Value: - - HRESULT - S_OK - On success - E_* - On failure - ---*/ - -STDMETHODIMP IOEMPTProvider::QueryDeviceDefaultNamespace -( - _Out_ BSTR * - ) -{ - VERBOSE(DLLTEXT("IOEMPTProvider::QueryDeviceDefaultNamespace: entry.\r\n")); - - return E_NOTIMPL; -} - -/*++ - -Routine Name: - - ConvertPrintTicketToDevMode - -Routine Description: - - Unidrv will call this routine before it performs its part of PT->DM - conversion. The plug-in is passed with an input Print Ticket that is - fully populated, and Devmode which has default settings in it. For - this conversion, the plug-in needs to undo whatever changes it made to - the Print Ticket during Devmode->PT conversion. - -Arguments: - - pPrintTicket - pointer to input Print Ticket - cbDevmode - size in bytes of input full devmode - pDevmode - pointer to input full devmode buffer - cbDrvPrivateSize - buffer size in bytes of plug-in private devmode - pPrivateDevmode - pointer to plug-in private devmode buffer - - -Return Value: - - HRESULT - S_OK - On Success - E_* - On failure - ---*/ - -STDMETHODIMP IOEMPTProvider::ConvertPrintTicketToDevMode -( - _In_ IXMLDOMDocument2 *pPrintTicket, - ULONG cbDevmode, - _Inout_updates_bytes_(cbDevmode) - PDEVMODE pDevmode, - ULONG , // cbDrvPrivateSize - _Inout_ PVOID // pPrivateDevmode - ) -{ - VERBOSE(DLLTEXT("IOEMPTProvider::ConvertPrintTicketToDevMode: entry.\r\n")); - - // - // cbDrvPrivateSize will be 0 because this plug-in doesn't - // support a private DEVMODE. - // - if (!cbDevmode || !pDevmode || !pPrintTicket) - { - return E_INVALIDARG; - } - - return S_OK; -} - -/*++ - -Routine Name: - - ConvertDevModeToPrintTicket - -Routine Description: - - Unidrv will call the routine with an Input Print - Ticket that is populated with public and Unidrv private features. For - those features in the GPD that Unidrv does not understand, it puts - them in the PT under the private namespace (either specified by the - plug-in through QueryDeviceDefaultNamespace or created by itself). It - is the plug-in's responsibility to read the corresponding features - from the input PT and put them in public printschema namespace, so - that any higher level application making use of a print ticket can - read and interpret these settings. - - -Arguments: - - cbDevmode - size in bytes of input full devmode - pDevmode - pointer to input full devmode buffer - cbDrvPrivateSize - buffer size in bytes of plug-in private devmode - pPrivateDevmode - pointer to plug-in private devmode buffer - pPrintTicket - pointer to input Print Ticket - -Return Value: - - HRESULT - S_OK - On Success - E_* - On failure - ---*/ -STDMETHODIMP IOEMPTProvider::ConvertDevModeToPrintTicket -( - ULONG cbDevmode, - _Inout_updates_bytes_(cbDevmode) - PDEVMODE pDevmode, - ULONG , // cbDrvPrivateSize - _Inout_ PVOID , // pPrivateDevmode, - _Inout_ IXMLDOMDocument2 *pPrintTicket - ) -{ - VERBOSE(DLLTEXT("IOEMPTProvider::ConvertDevModeToPrintTicket: entry.\r\n")); - - // - // cbDrvPrivateSize will be 0 because this plug-in doesn't - // support a private DEVMODE. - // - if (!cbDevmode || !pDevmode || !pPrintTicket) - { - return E_INVALIDARG; - } - - HRESULT hr = S_OK; - - OEMPTXMLHandler opxh; - EIntentValue eIntentValue = printschema::photoprintingintent::None; - - // - // Initialize PrintTicketHandler - // - - hr = opxh.SetRoot(pPrintTicket, m_pCoreHelper); - - if (SUCCEEDED(hr)) - { - hr = ReadAndDeletePhotoPrintingIntent(opxh, eIntentValue); - } - - if (S_FALSE == hr) - { - hr = S_OK; - } - - return hr; -} - - -/*++ - -Routine Name: - - CompletePrintCapabilities - -Routine Description: - - Unidrv calls this routine with an input Device Capabilities Document - that is partially populated with Device capabilities information - filled in by Unidrv for features that it understands. The plug-in - needs to read any private features in the input Print Ticket, delete - them and add them back under Printschema namespace so that higher - level applications can understand them and make use of them. - -Arguments: - - pPrintTicket - pointer to input Print Ticket - pCapabilities - pointer to Device Capabilities Document. - -Return Value: - - HRESULT - S_OK - On Success - E_* - On failure - ---*/ -STDMETHODIMP IOEMPTProvider::CompletePrintCapabilities -( - _In_opt_ IXMLDOMDocument2 *, - _Inout_ IXMLDOMDocument2 *pCapabilities - ) -{ - VERBOSE(DLLTEXT("IOEMPTProvider::CompletePrintCapabilities: entry.\r\n")); - - if (!pCapabilities) - { - return E_INVALIDARG; - } - - return S_OK; -} - -/*++ - -Routine Name: - - ExpandIntentOptions - -Routine Description: - - As part of its Merge and Validate Procedure, the - Unidrv/Postscript driver will call this routine to give the plug-in a - chance to expand options which represent intent into their individual - settings in other features in the print ticket. This has two - important effects: the client sees the results of the intent - expansion, and unidrv resolves constraints against the individual - features which are affected by the intent. - - If the plug-in does not support any intent features, then the plug-in - should simply return S_OK. - -Arguments: - - pPrintTicket - Pointer to input Print Ticket. - -Return Value: - - HRESULT - S_OK - On Success - E_* - On failure - ---*/ - -STDMETHODIMP IOEMPTProvider::ExpandIntentOptions( - _Inout_ IXMLDOMDocument2 *pPrintTicket - ) -{ - VERBOSE(DLLTEXT("IOEMPTProvider::ExpandIntentOptions: entry.\r\n")); - - if (!pPrintTicket) - { - return E_INVALIDARG; - } - - HRESULT hr = S_OK; - OEMPTXMLHandler opxh; - - // - // Initialize PrintTicketHandler - // - - hr = opxh.SetRoot(pPrintTicket, m_pCoreHelper); - - // - // Read in the photo printing intent value, if it exists. If it - // doesn't, the default value of None is assumed instead. - // - - EIntentValue eIntentValue = printschema::photoprintingintent::None; - - if (SUCCEEDED(hr)) - { - hr = ReadAndDeletePhotoPrintingIntent(opxh, eIntentValue); - } - - if (S_FALSE == hr) - { - hr = S_OK; - } - - if (printschema::photoprintingintent::None != eIntentValue) - { - IOEMPTProvider::IntentConversionEntry entry = IOEMPTProvider::intentConversionTable[eIntentValue]; - - // - // Set appropriate values for PageMediaType and - // PageOutputQuality. Override any existing values of the - // options (by deleting before adding). - // - - if (SUCCEEDED(hr)) - { - hr = AddOrOverridePageMediaType(opxh, entry.pageMediaType); - } - - if (SUCCEEDED(hr)) - { - hr = AddOrOverridePageOutputQuality(opxh, entry.pageOutputQuality); - } - } - - return hr; -} - -/*++ - -Routine Name: - - ValidatePrintTicket - -Routine Description: - - The plug-in might need to delete any feature under private namespace - from input PT that are also in the public namespace because of Merge - and Validate. - - The Validate method should also perform any conflict resolution if - necessary looking at the settings made in public and unidrv private - part of Print Ticket, to make sure that the resultant Print Ticket is a - valid one, and has all constraints resolved. - -Arguments: - - pBaseTicket - Pointer to input Print Ticket. - -Return Value: - - HRESULT - S_NO_CONFLICT/S_CONFLICT_RESOLVED - On Success - E_* - On failure - ---*/ - -STDMETHODIMP IOEMPTProvider::ValidatePrintTicket( - _Inout_ IXMLDOMDocument2 *pPrintTicket - ) -{ - VERBOSE(DLLTEXT("IOEMPTProvider::ValidatePrintTicket: entry.\r\n")); - - if (!pPrintTicket) - { - return E_INVALIDARG; - } - - // - // If the plug-in performs validation successfully, it needs to - // send either S_NO_CONFLICT or S_CONFLICT_RESOLVED as the result - // code, sending hr = S_OK will not work since Unidrv expects one - // of the above two success codes to interpret successful - // completion of plug-in validate method. - // - - return S_NO_CONFLICT; -} - -// -// Private stuff -// - -IOEMPTProvider::IntentConversionEntry IOEMPTProvider::intentConversionTable[] = -{ - { NULL, NULL, }, - { printschema::pagemediatype::PLAIN, printschema::pageoutputquality::DRAFT, }, - { printschema::pagemediatype::PHOTOGRAPHIC, printschema::pageoutputquality::HIGH, }, - { printschema::pagemediatype::PHOTOGRAPHIC, printschema::pageoutputquality::PHOTOGRAPHIC, }, -}; - -/*++ - -Routine Name: - - ReadAndDeletePhotoPrintingIntent - -Routine Description: - - This function gets the value of the Photo Printing Intent from a Print - Ticket and returns it in eIntentValue. It also deletes the entire - feature from the Ticket. - -Arguments: - - opxh - reference to input XMLHandler - eIntentValue - reference to output intent value - -Return Value: - - HRESULT - S_OK - On success, if intent was found - S_FALSE - On Success, if intent was not found - E_* - On failure - ---*/ - -HRESULT IOEMPTProvider::ReadAndDeletePhotoPrintingIntent( - OEMPTXMLHandler &opxh, - EIntentValue &eIntentValue - ) -{ - VERBOSE(DLLTEXT("IOEMPTProvider::ReadAndDeletePhotoPrintingIntent: entry.\r\n")); - - HRESULT hr = S_OK; - - IXMLDOMElement *pPhotoPrintingIntentFeature = NULL; - IXMLDOMElement *pPhotoPrintingIntentOption = NULL; - - hr = opxh.GetFeatureNode(NULL, // meaning root is parent - printschema::KEYWORDS_URI, - printschema::photoprintingintent::FEATURE, - &pPhotoPrintingIntentFeature); - - // - // Check for S_OK == hr and not SUCCEEDED(hr) because - // GetFeatureNode returns S_FALSE if feature is not found - // - - if (S_OK == hr && pPhotoPrintingIntentFeature) - { - hr = opxh.GetOptionNode(pPhotoPrintingIntentFeature, - &pPhotoPrintingIntentOption); - } - - BSTR bstrIntentNamespace = NULL; - BSTR bstrIntentValue = NULL; - - if (S_OK == hr && pPhotoPrintingIntentOption) - { - hr = opxh.GetXMLAttribute(pPhotoPrintingIntentOption, &bstrIntentNamespace, &bstrIntentValue); - } - - if (S_OK == hr && NULL != bstrIntentNamespace) - { - if (0 != wcscmp(bstrIntentNamespace, printschema::KEYWORDS_URI)) - { - // - // We do not delete the node if it specifies a different - // namespace - // - hr = S_FALSE; - } - } - - // - // Search for intent, looping across all possible (valid) values, and store it in eIntentValue - // - - if (S_OK == hr && NULL != bstrIntentValue) - { - EIntentValue e = EIntentValue(0); - - for (; e < printschema::photoprintingintent::EIntentValueMax; ++e) - { - if (0 == wcscmp(bstrIntentValue, printschema::photoprintingintent::OPTIONS[e])) - { - eIntentValue = e; - break; - } - } - - if (printschema::photoprintingintent::EIntentValueMax == e) - { - // - // We do not delete the node if the attribute name - // in the Print Ticket is not one of the valid ones - // - hr = S_FALSE; - } - } - - // - // If found, delete intent - // - - if (S_OK == hr) - { - hr = opxh.DeleteFeatureNode(NULL, pPhotoPrintingIntentFeature); - } - - // - // Make sure all BSTRs are freed, ... - // - - if (bstrIntentNamespace) - { - SysFreeString(bstrIntentNamespace); - bstrIntentNamespace = NULL; - } - - if (bstrIntentValue) - { - SysFreeString(bstrIntentValue); - bstrIntentValue = NULL; - } - - // - // ... and interface pointers released - // - - if (pPhotoPrintingIntentFeature) - { - pPhotoPrintingIntentFeature->Release(); - } - - if (pPhotoPrintingIntentOption) - { - pPhotoPrintingIntentOption->Release(); - } - - return hr; -} - -/*++ - -Routine Name: - - AddOrOverridePageMediaType - -Routine Description: - - This routine takes in the value of the PageMediaType to be set, - depending on the intent that was present. It then deletes any existing - PageMediaType value in the ticket, and then adds the new PageMediaType - value. - -Arguments: - - opxh - reference to input XMLHandler - lpcwstrPageMediaType - input PageMediaType string - -Return Value: - - HRESULT - S_OK - On success - E_* - On failure - ---*/ - -HRESULT IOEMPTProvider::AddOrOverridePageMediaType( - OEMPTXMLHandler &opxh, - LPCWSTR lpcwstrPageMediaType - ) -{ - VERBOSE(DLLTEXT("IOEMPTProvider::AddOrOverridePageMediaType: entry.\r\n")); - - HRESULT hr = S_OK; - - if (NULL == lpcwstrPageMediaType) - { - return S_OK; - } - - IXMLDOMElement *pPageMediaTypeOld = NULL; - IXMLDOMElement *pPageMediaTypeNew = NULL; - - // - // Search for, and delete any old PageMediaType option, since we're - // going to override it - // - - hr = opxh.GetFeatureNode(NULL, - printschema::KEYWORDS_URI, - printschema::pagemediatype::FEATURE, - &pPageMediaTypeOld); - - if (S_OK == hr) - { - hr = opxh.DeleteFeatureNode(NULL, pPageMediaTypeOld); - } - - // - // GetFeatureNode might have returned S_FALSE if it couldn't find - // such a node, so from now on, we check for SUCCEEDED - // - - // - // Create PageMediaType feature node - // - - if (SUCCEEDED(hr)) - { - hr = opxh.CreateFeatureNode(NULL, - printschema::KEYWORDS_URI, - printschema::pagemediatype::FEATURE, - &pPageMediaTypeNew); - } - - // - // Create option node under the feature node above - // - - if (SUCCEEDED(hr)) - { - hr = opxh.CreateOptionNode(pPageMediaTypeNew, - printschema::KEYWORDS_URI, - lpcwstrPageMediaType, - NULL); - } - - if (pPageMediaTypeOld) - { - pPageMediaTypeOld->Release(); - } - - if (pPageMediaTypeNew) - { - pPageMediaTypeNew->Release(); - } - - return hr; -} - -/*++ - -Routine Name: - - AddOrOverridePageOutputQuality - -Routine Description: - - This routine, similar to AddOrOverridePageMediaType, takes in the - value of the PageOutputQuality to be set, depending on the intent that - was present. It then deletes any existing PageOutputQuality value in - the ticket, and then adds the new PageOutputQuality value. - -Arguments: - - opxh - reference to input XMLHandler - lpcwstrPageOutputQuality - input PageOutputQuality string - -Return Value: - - HRESULT - S_OK - On success - E_* - On failure - ---*/ - -HRESULT IOEMPTProvider::AddOrOverridePageOutputQuality( - OEMPTXMLHandler &opxh, - LPCWSTR lpcwstrPageOutputQuality - ) -{ - VERBOSE(DLLTEXT("IOEMPTProvider::AddOrOverridePageOutputQuality: entry.\r\n")); - - HRESULT hr = S_OK; - - if (NULL == lpcwstrPageOutputQuality) - { - return S_OK; - } - - IXMLDOMElement *pPageOutputQualityOld = NULL; - IXMLDOMElement *pPageOutputQualityNew = NULL; - - // - // Search for, and delete any old PageOutputQuality option, since we're - // going to override it - // - - hr = opxh.GetFeatureNode(NULL, - printschema::KEYWORDS_URI, - printschema::pageoutputquality::FEATURE, - &pPageOutputQualityOld); - - if (S_OK == hr) - { - hr = opxh.DeleteFeatureNode(NULL, pPageOutputQualityOld); - } - - // - // GetFeatureNode might have returned S_FALSE if it couldn't find - // such a node, so from now on, we check for SUCCEEDED - // - - // - // Create PageOutputQuality feature node - // - - if (SUCCEEDED(hr)) - { - hr = opxh.CreateFeatureNode(NULL, - printschema::KEYWORDS_URI, - printschema::pageoutputquality::FEATURE, - &pPageOutputQualityNew); - } - - // - // Create option node under the feature node above - // - - if (SUCCEEDED(hr)) - { - hr = opxh.CreateOptionNode(pPageOutputQualityNew, - printschema::KEYWORDS_URI, - lpcwstrPageOutputQuality, - NULL); - } - - if (pPageOutputQualityOld) - { - pPageOutputQualityOld->Release(); - } - - if (pPageOutputQualityNew) - { - pPageOutputQualityNew->Release(); - } - - return hr; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/oemptprovider.hxx b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/oemptprovider.hxx deleted file mode 100644 index 77b54be1..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/oemptprovider.hxx +++ /dev/null @@ -1,143 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: oemptprovider.hxx -// -// -// PURPOSE: Definition of IOEMPTProvider Class. -// -// - -#pragma once - -#include "xmlhandler.hxx" -#include "printschema.hxx" - -using printschema::photoprintingintent::EIntentValue; - -// -// The Provider class to Implement IPrintOemPrintTicketProvider Interface -// - -class IOEMPTProvider : public IPrintOemPrintTicketProvider -{ -public: - - // - // Public Methods go here - // - IOEMPTProvider(); - virtual ~IOEMPTProvider(); - - // - // Basic COM Methods - // - STDMETHODIMP QueryInterface(THIS_ REFIID riid, void **ppvObj); - - STDMETHODIMP_(ULONG) AddRef(THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHODIMP_(ULONG) Release(THIS); - - - // - // IPrintOemPrintTicketProvider methods - // - - STDMETHOD(GetSupportedVersions)(THIS_ - _In_ HANDLE hPrinter, - _Outptr_result_buffer_maybenull_(*cVersions) INT *ppVersions[], - _Out_ INT *cVersions - ); - - STDMETHOD(BindPrinter)(THIS_ - _In_ HANDLE hPrinter, - INT version, - _Out_ POEMPTOPTS pOptions, - _Out_ INT *cNamespaces, - _Outptr_result_buffer_maybenull_(*cNamespaces) BSTR **ppNamespaces - ); - - STDMETHOD(PublishPrintTicketHelperInterface)(THIS_ - _In_ IUnknown *pHelper - ); - - STDMETHOD(QueryDeviceDefaultNamespace)(THIS_ - _Out_ BSTR *pbstrNamespaceUri - ); - - STDMETHOD(ConvertPrintTicketToDevMode)(THIS_ - _In_ IXMLDOMDocument2 *pPrintTicket, - ULONG cbDevmode, - _Inout_updates_bytes_(cbDevmode) - PDEVMODE pDevmode, - ULONG cbDrvPrivateSize, - _Inout_ PVOID pPrivateDevmode - ); - - STDMETHOD(ConvertDevModeToPrintTicket)(THIS_ - ULONG cbDevmode, - _Inout_updates_bytes_(cbDevmode) - PDEVMODE pDevmode, - ULONG cbDrvPrivateSize, - _Inout_ PVOID pPrivateDevmode, - _Inout_ IXMLDOMDocument2 *pPrintTicket - ); - - STDMETHOD(CompletePrintCapabilities)(THIS_ - _In_opt_ IXMLDOMDocument2 *pPrintTicket, - _Inout_ IXMLDOMDocument2 *pCapabilities - ); - - STDMETHOD(ExpandIntentOptions)(THIS_ - _Inout_ IXMLDOMDocument2 *pPrintTicket - ); - - STDMETHOD(ValidatePrintTicket)(THIS_ - _Inout_ IXMLDOMDocument2 *pPrintTicket - ); - -private: - - // - // Data members go here - // - LONG m_cRef; // COM reference count - HANDLE m_hPrinterCached; // cached printer handle - IPrintCoreHelperUni *m_pCoreHelper; // cached pointer to plug-in helper interface - - struct IntentConversionEntry - { - LPCWSTR pageMediaType; - LPCWSTR pageOutputQuality; - }; - - static IntentConversionEntry intentConversionTable[printschema::photoprintingintent::EIntentValueMax]; - - // - // Private Methods - // - - HRESULT ReadAndDeletePhotoPrintingIntent( - OEMPTXMLHandler &opxh, - EIntentValue &eIntentValue - ); - - HRESULT AddOrOverridePageMediaType( - OEMPTXMLHandler &opxh, - LPCWSTR lpcwstrPageMediaType - ); - - HRESULT AddOrOverridePageOutputQuality( - OEMPTXMLHandler &opxh, - LPCWSTR lpcwstrPageOutputQuality - ); - -}; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/precomp.hxx b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/precomp.hxx deleted file mode 100644 index fc8cb4be..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/precomp.hxx +++ /dev/null @@ -1,49 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: precomp.hxx -// -// PURPOSE: Header files that should be in the precompiled header. -// - -#pragma once - -// Required header files that shouldn't change often. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// StrSafe.h needs to be included last -// to disallow unsafe string functions. -#include -#include - -#include "common.ver" - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/precompsrc.cpp deleted file mode 100644 index 5d84a122..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.hxx" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/printschema.cxx b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/printschema.cxx deleted file mode 100644 index d22ffc10..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/printschema.cxx +++ /dev/null @@ -1,64 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: printschema.cxx -// -// PURPOSE: Constant definitions for print schema names. -// -// - -#include "precomp.hxx" -#include "printschema.hxx" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -LPCWSTR printschema::FRAMEWORK_URI = - L"http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework"; - -LPCWSTR printschema::KEYWORDS_URI = - L"http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords"; - -// -// Element types defined in Printschema framework -// - -LPCWSTR printschema::FEATURE_ELEMENT_NAME = L"Feature"; -LPCWSTR printschema::OPTION_ELEMENT_NAME = L"Option"; -LPCWSTR printschema::NAME_ATTRIBUTE_NAME = L"name"; - -// -// Elements described as Printschema keywords -// - -LPCWSTR printschema::photoprintingintent::FEATURE = L"PagePhotoPrintingIntent"; -LPCWSTR printschema::photoprintingintent::OPTIONS[] = { L"None", L"PhotoDraft", L"PhotoStandard", L"PhotoBest", }; - -namespace printschema -{ - namespace photoprintingintent - { - // - // operator prefix increment - // - const EIntentValue & operator++(EIntentValue &e) - - { - e = (EIntentValue)(e + 1); - return e; - } - } -} - -LPCWSTR printschema::pagemediatype::FEATURE = L"PageMediaType"; -LPCWSTR printschema::pagemediatype::PLAIN = L"Plain"; -LPCWSTR printschema::pagemediatype::PHOTOGRAPHIC = L"Photographic"; - -LPCWSTR printschema::pageoutputquality::FEATURE = L"PageOutputQuality"; -LPCWSTR printschema::pageoutputquality::DRAFT = L"Draft"; -LPCWSTR printschema::pageoutputquality::HIGH = L"High"; -LPCWSTR printschema::pageoutputquality::PHOTOGRAPHIC = L"Photographic"; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/printschema.hxx b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/printschema.hxx deleted file mode 100644 index e6bd73b4..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/printschema.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: printschema.hxx -// -// PURPOSE: Constant declarations for print schema names. -// - -#pragma once - -typedef -enum tagPrintschemaVersion -{ - PRINTSCHEMA_VERSION_NUMBER = 1 -} EPrintschemaVersion; - - -namespace printschema -{ - - extern LPCWSTR FRAMEWORK_URI; - - extern LPCWSTR KEYWORDS_URI; - - // - // Element types defined in Printschema framework - // - - extern LPCWSTR FEATURE_ELEMENT_NAME; - extern LPCWSTR OPTION_ELEMENT_NAME; - extern LPCWSTR NAME_ATTRIBUTE_NAME; - - // - // Elements described as Printschema keywords - // - - namespace photoprintingintent - { - extern LPCWSTR FEATURE; - - enum EIntentValue - { - None = 0, - Draft, - Standard, - Best, - EIntentValueMax, // size of enum list - }; - - extern LPCWSTR OPTIONS[EIntentValueMax]; - - const EIntentValue & operator++(EIntentValue &e); - } - - namespace pagemediatype - { - extern LPCWSTR FEATURE; - extern LPCWSTR PLAIN; - extern LPCWSTR PHOTOGRAPHIC; - } - - namespace pageoutputquality - { - extern LPCWSTR FEATURE; - extern LPCWSTR DRAFT; - extern LPCWSTR HIGH; - extern LPCWSTR PHOTOGRAPHIC; - } - -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/ptpcplpr.def b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/ptpcplpr.def deleted file mode 100644 index 20165c2d..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/ptpcplpr.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY PTPCPLPR -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/ptpcplpr.rc b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/ptpcplpr.rc deleted file mode 100644 index c40881de..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/ptpcplpr.rc +++ /dev/null @@ -1,24 +0,0 @@ -#include "winres.h" -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT2_UNKNOWN -#define VER_FILEDESCRIPTION_STR "PT/PC Plugin Provider Module" -#define VER_INTERNALNAME_STR "PTPCPlPr" -#define VER_ORIGINALFILENAME_STR "PTPCPlPr.dll" - -///////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - -#include "common.ver" diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/xmlhandler.cxx b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/xmlhandler.cxx deleted file mode 100644 index 4bbee2e8..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/xmlhandler.cxx +++ /dev/null @@ -1,1612 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: xmlhandler.cxx -// -// -// PURPOSE: Helper Class that handles all functionality related to -// processing of input PrintTicket/PrintCapabilities XML documents. -// -// -// Functions: Public and Private functions of class OEMPTXMLHandler. -// - -#include "precomp.hxx" - -#include "globals.hxx" -#include "printschema.hxx" -#include "xmlhandler.hxx" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -//Disable the warnings generated by PFEFAST for conversion between wchar_t * and BSTR -//because MSXML defines all its interfaces parameters as BSTR but officially declares itself -//to be wchar_t safe. - -#pragma prefast(disable:__WARNING_WCHAR_TO_BSTR) - -// -// MSXML makes the guarantee that we can call it's methods with LPTSTRs instead -// of BSTRs, so we need to do a const cast whenever we pass our strings to MSXML. -// -#define MSXMLSTR(lptstr_value) (const_cast(lptstr_value)) - -/*++ -Routine Name: - OEMPTXMLHandler -Routine Description: - Print Ticket Handler Constructor - - -Arguments: - None - -Return Value: - None - ---*/ - -OEMPTXMLHandler::OEMPTXMLHandler() : - m_pRootDocument(NULL), - m_pRootElement(NULL), - m_pNSManager(NULL), - m_dwNextIndex(0) -{ -} - -/*++ -Routine Name: - ~OEMPTXMLHandler( -Routine Description: - Print Ticket Handler Destructor - -Arguments: - None - -Return Value: - None - ---*/ - -OEMPTXMLHandler::~OEMPTXMLHandler() -{ - if (m_pRootDocument) - { - m_pRootDocument->Release(); - m_pRootDocument = NULL; - } - if (m_pRootElement) - { - m_pRootElement->Release(); - m_pRootElement = NULL; - } - if (m_pNSManager) - { - m_pNSManager->Release(); - m_pNSManager = NULL; - } -} - -/*++ -Routine Name: - SetRoot - -Routine Description: - - Initialization routine. Sets root of the DOM tree. Alos creates an instance of xml namespace manager - using plug-in helper interface method. - - Note: This routine MUST BE called before any other xml handling routines are called. - Note also that it is not necessary to call CoInitializeEx because Unidrv has already - made that call while creating the DOM tree with appropriate arguments passed on to it - and when Unidrv makes a call to one of plug-in interface routines, since plug-in is - running in the same thread, it does not need to make that call again - In fact the plug-in SHOULD NOT make that call to CoInitializeEx , because Unidrv must have made - that call with some particular concurrency model settings which plug-in cannot find out, - so the plug-in might end up changing the concurrency setting made by Unidrv. - -Arguments: - pRoot - Root of the input DOM tree. - - -Return Value: - HRESULT Completion status code - ---*/ -HRESULT -OEMPTXMLHandler::SetRoot( - _In_ IXMLDOMDocument2 *pRoot, - _In_ IPrintCoreHelper *pHelper - ) -{ - HRESULT hr = S_OK; - - // - // check if input paramters are not NULL - // - if (!pRoot || !pHelper) - { - return E_INVALIDARG; - } - - m_pRootDocument = pRoot; - - m_pRootDocument->AddRef(); - - - // - // Make use of Plug-in Helper Interface method provided by Unidrv to create an Instance of MSXML Namespace Manager. - // The plug-in must make use of Helper Interface provided by Unidrv while creating instance of namespacemanager - // of MSXML DOM document, the plug-in should not load MSXML6.DLL by itself but should rely on Unidrv for - // doing that - // - if (SUCCEEDED(hr)) - { - // - // Note: Current versions of Unidrv support MSXML6 hence plug-in should also support that and write its - // code in compliance with MSXML6 - // - hr = pHelper->CreateInstanceOfMSXMLObject(CLSID_MXNamespaceManager60, NULL, NULL, IID_IMXNamespaceManager, (void**)&m_pNSManager); - } - - // - // Get the Root Element of the document and store it in pRootElement. - // - if (SUCCEEDED(hr)) - { - hr = m_pRootDocument->get_documentElement(&m_pRootElement); - } - - if (FAILED(hr)) - { - if (m_pRootDocument) - { - m_pRootDocument->Release(); - m_pRootDocument = NULL; - } - - if (m_pRootElement) - { - m_pRootElement->Release(); - m_pRootElement = NULL; - } - - if (m_pNSManager) - { - m_pNSManager->Release(); - m_pNSManager = NULL; - } - } - - return hr; -} - -/*++ -Routine Name: - CreateFeatureNode - -Routine Description: - - Creates a new Feature Node - -Arguments: - pParent - parent node of the new feature node, if NULL, root is considered as parent - pszNamespaceURI - namesapce URI to which new node belongs - pszFeatureName - local name of the new feature node - ppFeatureNode - out pointer to newly created node - -Return Value: - HRESULT Completion status code - S_OK on success - E_* on failure - ---*/ - -HRESULT OEMPTXMLHandler::CreateFeatureNode( - _In_opt_ IXMLDOMElement *pParent, - _In_ PCWSTR pszNamespaceURI, - _In_ PCWSTR pszFeatureName, - _Out_opt_ IXMLDOMElement **ppFeatureNode - ) -{ - HRESULT hr = S_OK; - IXMLDOMElement *pNewElement = NULL; - BSTR qName = NULL; - - if (!pszFeatureName) - { - return E_INVALIDARG; - } - - if (!pParent) - { - pParent = m_pRootElement; - } - - - hr = CreateXMLElement(pParent, printschema::FEATURE_ELEMENT_NAME, printschema::FRAMEWORK_URI, &pNewElement); - - if (SUCCEEDED(hr)) - { - hr = CreateQName(pNewElement, pszNamespaceURI, pszFeatureName, &qName); - } - - if (SUCCEEDED(hr)) - { - - // The 'name' attibute node is not namespace qualified; it - // belongs to the namespace of its parent (feature/option) - // node. - - hr = CreateXMLAttribute(pNewElement, printschema::NAME_ATTRIBUTE_NAME, L"", qName); - } - - if (qName) - { - SysFreeString(qName); - qName = NULL; - } - - if (SUCCEEDED(hr) && ppFeatureNode) - { - *ppFeatureNode = pNewElement; - } - else if (pNewElement) - { - pNewElement->Release(); - } - - return hr; - -} - -/*++ -Routine Name: - CreateOptionNode - -Routine Description: - - Creates a new Option Node - -Arguments: - pParent - parent node of the new Option node - pszNamespaceURI - namesapce URI to which new node belongs - pszFeatureName - local name of the new Option node - ppOptionElement - out pointer to newly created node - -Return Value: - HRESULT Completion status code - S_OK on success - E_* on failure - ---*/ - -HRESULT OEMPTXMLHandler::CreateOptionNode( - _In_ IXMLDOMElement *pParent, - _In_ PCWSTR pszNamespaceURI, //print schema URI that corresponds to prefix "prn:" - _In_ PCWSTR pszOptionName, //"TopLeft" etc - _Out_opt_ IXMLDOMElement **ppOptionElement - ) -{ - HRESULT hr = S_OK; - IXMLDOMElement *pNewElement = NULL; - BSTR qName = NULL; - - if (!pParent) - { - return E_INVALIDARG; - } - - hr = CreateXMLElement(pParent, printschema::OPTION_ELEMENT_NAME, printschema::FRAMEWORK_URI, &pNewElement); - - if (SUCCEEDED(hr)) - { - hr = CreateQName(pNewElement, pszNamespaceURI, pszOptionName, &qName); - } - - if (SUCCEEDED(hr)) - { - // The 'name' attibute node is not namespace qualified; it - // belongs to the namespace of its parent (feature/option) - // node. - - hr = CreateXMLAttribute(pNewElement, printschema::NAME_ATTRIBUTE_NAME, L"", qName); - } - - if (qName) - { - SysFreeString(qName); - qName = NULL; - } - - if (SUCCEEDED(hr) && ppOptionElement) - { - *ppOptionElement = pNewElement; - } - else if (pNewElement) - { - pNewElement->Release(); - } - - return hr; -} - -/*++ -Routine Name: - CreateXMLElement - -Routine Description: - Generic method to create new XML element node - -Arguments: - - pParent - pointer to the parent node of the new nod eto be created, if NULL root of DOM tree is considered as parent - pszElementName - local name of the newly created element - pszNamespaceURI - namespace URI that the new element belongs to, the caller can only specify the namespace URI - and not the prefix - ppCreatedElement - double pointer to the newly created element returned by the procedure - -Return Value: - HRESULT Completion status code - S_OK - If the new element node is created successfully - E_* - on failure - ---*/ - -HRESULT OEMPTXMLHandler::CreateXMLElement( - _In_ IXMLDOMElement *pParent, - _In_ PCWSTR pszElementName, - _In_ PCWSTR pszNamespaceURI, - _Out_ IXMLDOMElement **ppCreatedElement - ) -{ - HRESULT hr = S_OK; - IXMLDOMNode *pNewNode = NULL; - BSTR bstrQName = NULL; - - if (!pParent || !pszElementName || !pszNamespaceURI || !ppCreatedElement) - { - return E_INVALIDARG; - } - - // - // create XML Qname - // - hr = CreateQName(pParent, pszNamespaceURI, pszElementName, &bstrQName); - - if (SUCCEEDED(hr)) - { - VARIANT nodeType; - VariantInit(&nodeType); - V_VT(&nodeType) = VT_I4; - V_I4(&nodeType) = NODE_ELEMENT; - hr = m_pRootDocument->createNode(nodeType, bstrQName, MSXMLSTR(pszNamespaceURI), &pNewNode); - if (SUCCEEDED(hr)) - VariantClear(&nodeType); - } - - if (SUCCEEDED(hr)) - hr = pParent->appendChild(pNewNode, NULL); - - - if (SUCCEEDED(hr)) - { - // - // we need to return Interface ptr to IXMLDOMElement. - // - hr = pNewNode->QueryInterface(IID_IXMLDOMElement, (void **)ppCreatedElement); - - // - // if interface is not supported, E_* will be returned in hr, - // we simply return that to the caller. - // - } - - if (pNewNode) - { - // - // release reference to local node Created since it is no longer being used - // - pNewNode->Release(); - } - - if (bstrQName) - { - SysFreeString(bstrQName); - bstrQName = NULL; - } - - return hr; - -} - -/*++ -Routine Name: - CreateQName - -Routine Description: - - Creates XML qname for given local name and namespace URI - Note: It is assumed that a prefix for given URI is already defined in root of DOM document - either by Unidrv or by plug-in itself. - Routine fails if it doesnot find a predefined prefix for given URI. - -Arguments: - pElement - context node - pszUri - Uri - pszLocalName - local name - pQName - a pointer to resultant qname string defined by the routine - -Return Value: - HRESULT Completion status code - - S_OK - On success - E_FAIL - on failure to create Qname - ---*/ -HRESULT OEMPTXMLHandler::CreateQName( - _In_ IXMLDOMElement *pElement, - _In_ PCWSTR pszUri, - _In_ PCWSTR pszLocalName, - _Out_ BSTR *pQName - ) -{ - HRESULT hr = S_OK; - BSTR bstrPrefixString = NULL; - size_t prefixLen = 0; - // Is it the default namespace? If so, don't stick a semicolon in the string - size_t localNameLen = 0; - - if (!pszUri || !pszLocalName || !pQName) - { - return E_INVALIDARG; - } - - *pQName = NULL; - - // - // See if a prefix is already defined for the given URI - // - - hr = getPrefix(pElement, pszUri, &bstrPrefixString); - - // - // It is possible that during validation the prefix might not - // already be defined if we're converting public features to GPD - // features. In that case, we need to add a definition for the - // feature namespace. - // - - if (S_FALSE == hr) - { - hr = declarePrefix(pElement, pszUri, NULL, &bstrPrefixString); - } - - if (SUCCEEDED(hr)) - { - // - // StrSafe function StringCchLength checks if the length of string is less than - // maximum length specified, and returns S_OK if the input string is non NULL and - // length is less that maximum length specified. - // It returns length of string EXCLUDING null terminator - // - hr = StringCchLength(pszLocalName, STR_MAX_CCH, &localNameLen); - } - - if (SUCCEEDED(hr)) - { - if (bstrPrefixString) - { - hr = StringCchLength(bstrPrefixString, STR_MAX_CCH, &prefixLen); - } - } - - if (SUCCEEDED(hr)) - { - if (prefixLen > 0) - { - // non-default namespace - - UINT cchLength = 0; - - if (SUCCEEDED(hr = SizeTAdd(prefixLen, localNameLen, &localNameLen)) && - SUCCEEDED(hr = SizeTAdd(localNameLen, 2, &localNameLen)) && - SUCCEEDED(hr = SizeTToUInt(localNameLen, &cchLength))) - { - - *pQName = SysAllocStringLen(NULL, cchLength); - - if (*pQName) - { - // we got a terminator character as part of SysAllocString. - hr = StringCchPrintf(*pQName, cchLength, L"%s:%s", bstrPrefixString, pszLocalName); - } - else - { - hr = E_OUTOFMEMORY; - } - } - } - else - { - // Default namespace ... - - UINT cchLength = 0; - - if (SUCCEEDED(hr = SizeTAdd(localNameLen, 1, &localNameLen)) && - SUCCEEDED(hr = SizeTToUInt(localNameLen, &cchLength))) - { - *pQName = SysAllocStringLen(NULL, cchLength); - - if (*pQName) - { - // we got a terminator character as part of SysAllocString. - hr = StringCchPrintf(*pQName, cchLength, L"%s", pszLocalName); - } - else - { - hr = E_OUTOFMEMORY; - } - } - } - } - - if (bstrPrefixString) - { - SysFreeString(bstrPrefixString); - bstrPrefixString = NULL; - } - - if (FAILED(hr)) - { - if (*pQName) - { - SysFreeString(*pQName); - *pQName = NULL; - } - } - - return hr; -} - -/*++ -Routine Name: - CreateXMLAttribute - -Routine Description: - Creates an attribute for the given XML element. - -Arguments: - - pElement - pointer to the element node to which an attribute is to be added - pszAttributeName - local name of the attribute - pszNamespaceURI - namespace URI to which the attribute belongs - pszAttributeValue - value of the attribute - -Return Value: - HRESULT Completion status code - S_OK - on success - E_* - on failure - ---*/ - -HRESULT OEMPTXMLHandler::CreateXMLAttribute( - _In_ IXMLDOMElement *pElement, - _In_ PCWSTR pszAttributeName, //"name=" - _In_ PCWSTR pszNamespaceURI, //"pt:" - _In_ PCWSTR pszAttributeValue //"prn:" - ) -{ - HRESULT hr = S_OK; - IXMLDOMAttribute *pNewAttribute = NULL ; - IXMLDOMNode *pNewNode = NULL ; - - if (!pElement || !pszAttributeName || ! pszNamespaceURI || !pszAttributeValue) - { - return E_INVALIDARG; - } - - VARIANT nodeType; - VariantInit(&nodeType); - V_VT(&nodeType) = VT_I4; - V_I4(&nodeType) = NODE_ATTRIBUTE; - hr = m_pRootDocument->createNode(nodeType, MSXMLSTR(pszAttributeName), MSXMLSTR(pszNamespaceURI), &pNewNode); - if (SUCCEEDED(hr)) - VariantClear(&nodeType); - - if (SUCCEEDED(hr)) - { - hr = pNewNode->QueryInterface(IID_IXMLDOMAttribute, (void **)&pNewAttribute); - } - - if (SUCCEEDED(hr)) - { - VARIANT attrType; - VariantInit(&attrType); - V_VT(&attrType) = VT_BSTR; - V_BSTR(&attrType) = SysAllocString(pszAttributeValue); - hr = pNewAttribute->put_value(attrType); - if (SUCCEEDED(hr)) - VariantClear(&attrType); - } - - if (SUCCEEDED(hr)) - { - hr = pElement->setAttributeNode(pNewAttribute, NULL); - } - - if (SUCCEEDED(hr)) - { - if (pNewAttribute) - { - pNewAttribute->Release(); - } - - } - else if (pNewAttribute) - pNewAttribute->Release(); - - if (pNewNode) - pNewNode->Release(); - - return hr; -} - -/*++ -Routine Name: - GetXMLElement -Routine Description: - Returns an XML element with given namespace URI and given attribute - -Arguments: - - pParent - Parent of node to be found - pszElementNamespaceURI - Namespace URI to which the element belongs - pszElementName - Local Name of the element - pszAttrNamespaceURI - Namespace URI to which the attribute of the element belongs - pszAttrName - local name of the element attribute - ppElement - out pointer to xml element so retrieved - -Return Value: - HRESULT Completion status code - S_OK - On Successfully locating XML node specified - S_FALSE - If the specified XML node is not found - E_* - On Failure - - Note: Since the module returns S_FALSE if the specified node is not found, the caller must be - careful to check hr status to be S_OK before proceeding, just checking for SUCCEEDED(hr) might - give wrong results - ---*/ -HRESULT OEMPTXMLHandler::GetXMLElement( - _In_ IXMLDOMElement *pParent, - _In_ PCWSTR pszElementNamespaceURI, - _In_ PCWSTR pszElementName, - _In_ PCWSTR pszAttrNamespaceURI, - _In_ PCWSTR pszAttrName, - _Outptr_result_maybenull_ IXMLDOMElement **ppElement - ) const -{ - HRESULT hr = S_OK; - LONG cChildren = 0; - IXMLDOMNodeList *pChildren = NULL; - - - if (!pParent || !pszElementNamespaceURI || !pszElementName || !pszAttrNamespaceURI || !pszAttrName) - { - return E_INVALIDARG; - } - - *ppElement = NULL; - - // - // Get a list of child nodes for the current DOM node - // - hr = pParent->get_childNodes(&pChildren); - - // - // Get number of child nodes - // - if (SUCCEEDED(hr)) - { - hr = pChildren->get_length(&cChildren); - } - - if (SUCCEEDED(hr)) - { - LONG i = 0; - BOOL bFound = FALSE; - - for(i = 0;i < cChildren && !bFound;i++) - { - IXMLDOMNode *pCurNode; - IXMLDOMElement *pCurElement = NULL; - - hr = pChildren->get_item(i, &pCurNode); - - if (SUCCEEDED(hr)) - { - hr = pCurNode->QueryInterface(IID_IXMLDOMElement, (void **)&pCurElement); - } - if (S_OK == hr) - { - BSTR bstrElementName = NULL; - BSTR bstrElementNamespaceURI = NULL; - - // - // retrieve element name and namespace URI - // - hr = pCurElement->get_baseName(&bstrElementName); - - if (SUCCEEDED(hr)) - { - hr = pCurElement->get_namespaceURI(&bstrElementNamespaceURI); - } - - if (SUCCEEDED(hr) && bstrElementNamespaceURI && bstrElementName) - { - - if (0 == wcscmp(bstrElementName, pszElementName) && 0 == wcscmp(bstrElementNamespaceURI, pszElementNamespaceURI)) - { - // - //check if element name matches - // - BSTR bstrAttrName = NULL; - BSTR bstrAttrNamespaceURI = NULL; - hr = GetXMLAttribute(pCurElement,&bstrAttrNamespaceURI,&bstrAttrName); - if (SUCCEEDED(hr) && bstrAttrName && bstrAttrNamespaceURI) - { - if (0 == wcscmp(bstrAttrName, pszAttrName) && 0 == wcscmp(pszAttrNamespaceURI, bstrAttrNamespaceURI)) - { - bFound = TRUE; - *ppElement = pCurElement; - (*ppElement)->AddRef(); - } - else - { - hr = S_FALSE; - } - } - - SysFreeString(bstrAttrName); - bstrAttrName = NULL; - - SysFreeString(bstrAttrNamespaceURI); - bstrAttrNamespaceURI = NULL; - } - } - - SysFreeString(bstrElementName); - bstrElementName = NULL; - - SysFreeString(bstrElementNamespaceURI); - bstrElementNamespaceURI = NULL; - - if (pCurElement) - { - pCurElement->Release(); - } - } - - if (pCurNode) - { - pCurNode->Release(); - } - } - } - - if (pChildren) - pChildren->Release(); - - if (SUCCEEDED(hr) && (*ppElement)) - { - hr = S_OK; - } - else - { - hr = S_FALSE; - } - - return hr; - -} - -/*++ -Routine Name: - GetXMLElementWithoutAttribute - -Routine Description: - Returns an XML element with given namespace URI. - -Arguments: - - pParent - Parent of node to be found - pszElementNamespaceURI - Namespace URI to which the element belongs - pszElementName - Local Name of the element - ppChildElement - out pointer to xml element so retrieved - -Return Value: - HRESULT Completion status code - S_OK - On Successfully locating XML node specified - S_FALSE - If the specified XML node is not found - E_* - On Failure - - Note: Since the module returns S_FALSE if the specified node is not found, the caller must be - careful to check hr status before proceeding, just checking for SUCCEEDED(hr) might - give wrong results - ---*/ -HRESULT OEMPTXMLHandler::GetXMLElementWithoutAttribute( - _In_ IXMLDOMElement *pContext, - _In_ PCWSTR pszElementNamespace, - _In_ PCWSTR pszElementName, - _Outptr_result_maybenull_ IXMLDOMElement **ppChildElement - ) const -{ - if (!pContext || !pszElementName || !pszElementNamespace || !ppChildElement) - { - return E_INVALIDARG; - } - - HRESULT hr = S_OK; - LONG cChildren = 0; - IXMLDOMNodeList *pContextChildren; - *ppChildElement = NULL; - - // - // Get the list of child nodes - // - hr = pContext->get_childNodes(&pContextChildren); - - if (SUCCEEDED(hr)) - hr = pContextChildren->get_length(&cChildren); - - if (SUCCEEDED(hr)) - { - for(LONG i = 0;i < cChildren && !(*ppChildElement);i++) - { - - IXMLDOMNode *pCurrentNode; - IXMLDOMElement *pCurrentElement; - hr = pContextChildren->get_item(i, &pCurrentNode); - - // - // See if its a DOM Element. Don't set hr here because we - // fully expect that not everything in the context is an element. - // - if (SUCCEEDED(hr) && S_OK == pCurrentNode->QueryInterface(IID_IXMLDOMElement, (void**)&pCurrentElement)) - { - BSTR pbstrBaseName = NULL; - BSTR pbstrNamespaceURI = NULL; - - hr = pCurrentElement->get_baseName(&pbstrBaseName); - - if (SUCCEEDED(hr)) - { - hr = pCurrentElement->get_namespaceURI(&pbstrNamespaceURI); - } - if (SUCCEEDED(hr) && - pbstrNamespaceURI && - pbstrBaseName && - 0 == wcscmp(pbstrNamespaceURI, pszElementNamespace) && - 0 == wcscmp(pbstrBaseName, pszElementName)) - { - *ppChildElement = pCurrentElement; - (*ppChildElement)->AddRef(); - } - - pCurrentElement->Release(); - - SysFreeString(pbstrBaseName); - pbstrBaseName = NULL; - - SysFreeString(pbstrNamespaceURI); - pbstrNamespaceURI = NULL; - } - - if (pCurrentNode) - { - pCurrentNode->Release(); - } - } - } - - if (pContextChildren) - { - pContextChildren->Release(); - } - - if (SUCCEEDED(hr)) - { - if (*ppChildElement) - { - hr = S_OK; - } - else - { - hr = S_FALSE; - } - } - - return hr; -} - -/*++ -Routine Name: - GetXMLAttribute - -Routine Description: - Returns an XML Attribute node with given namespace URI. - -Arguments: - - pParent - Parent of node to be found - pszAttrNamespaceURI - Namespace URI to which the attribute belongs - pszAttrName - Local Name of the attribute - ppChildElement - out pointer to xml node so retrieved - -Return Value: - HRESULT Completion status code - S_OK - On Success - E_* - On Failure - ---*/ -HRESULT OEMPTXMLHandler::GetXMLAttribute( - _In_ IXMLDOMElement *pElement, - _Outptr_result_maybenull_ BSTR *ppAttrNamespaceURI, - _Outptr_result_maybenull_ BSTR *ppAttrName - ) const -{ - HRESULT hr = S_OK; - IXMLDOMNamedNodeMap *pAttrMap = NULL; - IXMLDOMNode *pAttrNode = NULL; - - if (!pElement || !ppAttrNamespaceURI || !ppAttrName) - { - return E_INVALIDARG; - } - - *ppAttrNamespaceURI = NULL; - *ppAttrName = NULL; - - hr = pElement->get_attributes(&pAttrMap); - - if (SUCCEEDED(hr)) - { - hr = pAttrMap->getNamedItem(MSXMLSTR(printschema::NAME_ATTRIBUTE_NAME),&pAttrNode); - } - - if (S_OK == hr) - { - BSTR bstrAttrQName = NULL; - IXMLDOMAttribute *pAttribute = NULL; - - hr = pAttrNode->QueryInterface(IID_IXMLDOMAttribute, (void **)&pAttribute); - - if (SUCCEEDED(hr)) - hr = pAttribute->get_text(&bstrAttrQName); - - if (S_OK == hr && bstrAttrQName) - hr = getUri(pElement, bstrAttrQName, ppAttrNamespaceURI); - - if (S_OK == hr && bstrAttrQName) - hr = getLocalName(bstrAttrQName, ppAttrName); - - if (pAttribute) - pAttribute->Release(); - - if (bstrAttrQName) - { - SysFreeString(bstrAttrQName); - bstrAttrQName = NULL; - } - } - - if (pAttrMap) - pAttrMap->Release(); - if (pAttrNode) - pAttrNode->Release(); - - if (FAILED(hr)) - { - if (*ppAttrNamespaceURI) - { - SysFreeString(*ppAttrNamespaceURI); - *ppAttrNamespaceURI = NULL; - } - if (*ppAttrName) - { - SysFreeString(*ppAttrName); - *ppAttrName = NULL; - } - } - return hr; -} - -/*++ -Routine Name: - GetFeatureNode - -Routine Description: - - Returns the feature node with specified attribute under printschema namespace - -Arguments: - pParent - parent node of the feature node to be located - pszAttrNamespaceURI - namespace URI for the attribute node of given feature node - pszAttrName - attribute name for given feature node - ppElement - OUT pointer to feature node to be returned - -Return Value: - HRESULT Completion status code - S_OK - On Successfully locating Feature node - S_FALSE - If Feature node is not found - E_* - On Failure - - ---*/ -HRESULT OEMPTXMLHandler::GetFeatureNode( - _In_opt_ IXMLDOMElement *pParent, - _In_ PCWSTR pszAttrNamespaceURI, - _In_ PCWSTR pszAttrName, - _Out_ _When_(return == S_FALSE, _At_(*ppElement, _Post_maybenull_)) - _When_(return != S_FALSE, _At_(*ppElement, _Post_valid_)) - IXMLDOMElement **ppElement - ) const -{ - HRESULT hr = S_OK; - - // - // If no parent is specified, set root of DOM tree as parent - // - if (!pParent) - { - pParent = m_pRootElement; - } - - hr = GetXMLElement(pParent, printschema::FRAMEWORK_URI, printschema::FEATURE_ELEMENT_NAME, pszAttrNamespaceURI, pszAttrName, ppElement); - - return hr; -} - -/*++ -Routine Name: - GetOptionNode - -Routine Description: - - Returns the option node under printschema namespace - -Arguments: - pParent - parent node of the option node to be located - ppElement - OUT pointer to option node to be returned - -Return Value: - HRESULT Completion status code - S_OK - On Successfully locating Option node - S_FALSE - If Option node is not found - E_* - On Failure - ---*/ -HRESULT -OEMPTXMLHandler::GetOptionNode( - _In_ IXMLDOMElement *pParent, - _Outptr_result_maybenull_ IXMLDOMElement **ppElement - ) const -{ - return GetXMLElementWithoutAttribute(pParent, printschema::FRAMEWORK_URI, printschema::OPTION_ELEMENT_NAME, ppElement); -} - -/*++ - -Routine Name: - getLocalName -Routine Description: - Returns Local name for input XML Qname. - -Arguments: - pszQName - Qname for which local name is to be found out - ppbstrLocalName - OUT pointer to local name - -Return Value: - HRESULT Completion status code - S_OK - On Success - E_* - On Failure - ---*/ -HRESULT -OEMPTXMLHandler::getLocalName( - _In_ PCWSTR pszQName, - _Out_ BSTR *ppbstrLocalName - ) const -{ - HRESULT hr = S_OK; - - if (!pszQName || !ppbstrLocalName) - { - return E_INVALIDARG; - } - - *ppbstrLocalName = NULL; - - PCWSTR pszStartPos = wcschr(pszQName,L':'); - - if (pszStartPos) - { - pszStartPos++; - } - else - { - pszStartPos = pszQName; - } - - *ppbstrLocalName = SysAllocString(pszStartPos); - - if (!(*ppbstrLocalName)) - { - hr = E_OUTOFMEMORY; - } - - return hr; -} - - -/*++ -Routine Name: - getUri -Routine Description: - Returns namespace URI for given input Qname and in context of given XML DOM node. -Arguments: - pContext - Input XML DOM node for current context - pszQName - input qname - pbstrURI - OUT pointer to URI to be returned -Return Value: - - S_OK if found - S_FALSE if not found - E_OUTOFMEMORY if the string could not be allocated - E_INVALIDARG if a non-optional param is null. - -Notes: - - This routine assumes that the string has already been - validated, which should have happened in the managed code base. - The string should either be of the form "prefix:localname", - or "localname" - ---*/ -HRESULT -OEMPTXMLHandler::getUri( - IXMLDOMElement *pContext, - _In_ PCWSTR pszQName, - _Out_ BSTR *pbstrURI - ) const - -{ - HRESULT hr = S_OK; - BOOL bNodePushed = FALSE; - - if (!(pContext && pbstrURI && pszQName)) - { - return E_INVALIDARG; - } - - PWSTR pszSplitPos = (_TCHAR*) wcschr(pszQName, L':'); - INT cchUri = 0; - *pbstrURI = NULL; - - // - // if splitpos is null, then there is no namespace - // prefix, which means return the default namespace. - // - wchar_t wchSwapChar = L'\0'; - if (pszSplitPos) - { - wchSwapChar = *pszSplitPos; - *pszSplitPos = (wchar_t)0; - } - else - { - pszQName = L""; - } - - hr = m_pNSManager->pushNodeContext(pContext, TRUE); - - if (SUCCEEDED(hr)) - { - bNodePushed = TRUE; - // get the length first, then alloc the string -#pragma prefast(suppress:__WARNING_INVALID_PARAM_VALUE_1, "According to MSDN, it is acceptable to pass a NULL buffer to getURI.") - hr = m_pNSManager->getURI(pszQName, NULL, NULL, &cchUri); - } - - if (S_OK == hr) - { - if (SUCCEEDED(hr)) - { - // account for null terminator - cchUri += 1; - - *pbstrURI = SysAllocStringLen(NULL, cchUri); - if (!(*pbstrURI)) - { - hr = E_OUTOFMEMORY; - } - } - - if (SUCCEEDED(hr)) - { - hr = m_pNSManager->getURI(pszQName, NULL, *pbstrURI, &cchUri); - } - - if (pszSplitPos) - { - *pszSplitPos = wchSwapChar; - } - - if (FAILED(hr) && (*pbstrURI)) - { - SysFreeString(*pbstrURI); - *pbstrURI = NULL; - } - } - - if (bNodePushed) - { - hr = m_pNSManager->popContext(); - } - - return hr; -} - -/*++ - -Routine Name: - getPrefix -Routine Description: - - Returns predefined Prefix for the input namespace URI if one already exists - -Arguments: - pContext - Current context node - pszUri - namespace URI for which prefix is to be obtained - pbstrPrefix - prefix string to be returned, if NULL routine just checks for - existence of prefix - -Return Value: - HRESULT Completion status code - S_OK - on success - S_FALSE - on failure - ---*/ -HRESULT -OEMPTXMLHandler::getPrefix( - _In_ IXMLDOMElement *pContext, - _In_ PCWSTR pszUri, - _Outptr_opt_result_maybenull_ BSTR *pbstrPrefix - ) const -{ - HRESULT hr = S_OK; - BOOL bNodePushed = FALSE; - INT cchPrefix = 0; - - if (!pContext || !pszUri) - return E_INVALIDARG; - - if (pbstrPrefix) - { - *pbstrPrefix = NULL; - } - - //Push context "Deep" to get info abt all URI prefix mappings defined so far in the current DOM document - hr = m_pNSManager->pushNodeContext(pContext, TRUE); - - if (SUCCEEDED(hr)) - { - bNodePushed = TRUE; - - // get the length first, then alloc the string - - hr = m_pNSManager->getPrefix(pszUri, 0, NULL, &cchPrefix); - } - - - if (S_OK == hr && pbstrPrefix) - { - - *pbstrPrefix = NULL; - cchPrefix++; - - if (SUCCEEDED(hr)) - { - *pbstrPrefix = SysAllocStringLen(NULL, cchPrefix); - - if (!(*pbstrPrefix)) - hr = E_OUTOFMEMORY; - } - - if (SUCCEEDED(hr)) - { - hr = m_pNSManager->getPrefix(pszUri, 0, *pbstrPrefix, &cchPrefix); - - } - - if (FAILED(hr) && (*pbstrPrefix)) - { - SysFreeString(*pbstrPrefix); - *pbstrPrefix = NULL; - } - } - - // Note: MSXML NSManager returns S_FALSE for an undeclared URI, and E_FAIL for an undeclared - // prefix, hence it is safe to check for both here. - - if (E_FAIL == hr || S_FALSE == hr) - { - // NS manager didn't find the prefix. Tweak the result to S_FALSE - hr = S_FALSE; - } - - if (bNodePushed) - { - m_pNSManager->popContext(); - } - - return hr; -} - -/*++ - -Routine Name: - declarePrefix - -Routine Description: - - This declares a new prefix for a given URI. This routine will always generate a new - prefix definition, regardless of whether the URI is already defined. Use getPrefix - to prevent duplicate definitions of namespace URI prefixes. If the preferred prefix is - already in use or no preferred prefix is supplied the namespace will be declared using - a generated namespace name. - -Arguments: - pContext - The context in which you want to ensure that the prefix is properly declared - in. This is where we check to see if the prefix is already in use. However, if not - in use, the prefix will always be declared in the root of the document. This gaurantees - 2 things: The prefix is declared in the entire document (though it may be overridden - locally in other places), and the prefix has the expected meaning at the passed in pContext. - pszUri - The URI to associate with the prefix. - pszPreferredPrefix - prefix to use if not already defined, can be a BSTR or PCWSTR, either - is acceptable - pbstrNewPrefix - The actual prefix that was declared, which may be different from the - preferred prefix - -Return Value: - HRESULT Completion status code - S_OK - on success - S_FALSE - on failure - ---*/ -HRESULT -OEMPTXMLHandler::declarePrefix( - _In_ IXMLDOMElement *pContext, - _In_ PCWSTR pszUri, - _In_opt_ PCWSTR pszPreferredPrefix, - _Out_ BSTR *pbstrNewPrefix - ) -{ - HRESULT hr = S_OK; - - // These two strings are tied ... the second string is used to print the number over top of a - // copy of the first string, so chances are, if you change one, you need to change the other. - PCWSTR szPrefixChars = L"ns0000"; - PCWSTR szPrefixPrintfPattern = L"ns%.4X"; - - if (!(pContext && pszUri && pbstrNewPrefix)) - { - return E_INVALIDARG; - } - - *pbstrNewPrefix = NULL; - - // Check if the preferred prefix exists... - // - // If we got S_OK, the prefix exists, if we got E_*, bail out - // anyway. Only declare the prefix if we successfully decided - // it doesn't exist. - - if (pszPreferredPrefix) - { - INT unused = 0; - - if (SUCCEEDED(hr)) - { - hr = m_pNSManager->pushNodeContext(pContext, TRUE); - } - - if (SUCCEEDED(hr)) - { -#pragma prefast(suppress:__WARNING_INVALID_PARAM_VALUE_1, "According to MSDN, it is acceptable to pass a NULL buffer to getURI.") - hr = m_pNSManager->getURI(pszPreferredPrefix, NULL, NULL, &unused); - - // If the prefix is already defined, MSXML will return S_FALSE. In that - // case, we don't want to declare another namespace with the same prefix - if (S_FALSE != hr) - { - pszPreferredPrefix = NULL; - } - - hr = m_pNSManager->popContext(); - } - - if (SUCCEEDED(hr) && pszPreferredPrefix) - { - *pbstrNewPrefix = SysAllocStringLen(pszPreferredPrefix, (UINT) wcslen(pszPreferredPrefix)); - } - } - - // If we don't have a workable prefix, try to generate a namespace - // Namespaces are in the form of NSxxxx where the x's are hex digits, - // and there are sizeof(m_nextPrefix)*2 of them - if (SUCCEEDED(hr) && !(*pbstrNewPrefix)) - { - BOOL bFound = TRUE; - UINT cchLength = (UINT) wcslen(szPrefixChars); - *pbstrNewPrefix = SysAllocStringLen(NULL, cchLength); - if (!(*pbstrNewPrefix)) - { - hr = E_OUTOFMEMORY; - } - if (SUCCEEDED(hr)) - { - do - { - INT unused = 0; - - // We're really unlikely to hit this. If we do we probably - // have bigger problems. but put a reasonable cap on the - // generated namespaces anyway. - if (((UINT)m_dwNextIndex) >= (UINT)0xFFFF) - { - // We could reset the counter here, but it's very unlikely to - // help matters, and could end up costing tons of CPU time if - // caller ignored the error or retried. - hr = E_FAIL; - } - - if (SUCCEEDED(hr)) - { - // now fill in the real value. - hr = StringCchPrintf(*pbstrNewPrefix, cchLength+1, szPrefixPrintfPattern, (INT)m_dwNextIndex); - } - - if (SUCCEEDED(hr)) - { - // look up the URI associated with the prefix. -#pragma prefast(suppress:__WARNING_INVALID_PARAM_VALUE_1, "According to MSDN, it is acceptable to pass a NULL buffer to getURI.") - bFound = (S_OK == m_pNSManager->getURI(*pbstrNewPrefix, pContext, NULL, &unused)); - } - - m_dwNextIndex++; - - } while(SUCCEEDED(hr) && bFound); - - if (bFound) - { - SysFreeString(*pbstrNewPrefix); - *pbstrNewPrefix = NULL; - } - } - } - - if (SUCCEEDED(hr) && *pbstrNewPrefix) - { - // We'll always put declarations at the root - if (SUCCEEDED(hr)) - { - // Create the namespace declaration string - UINT cchDeclLength = (UINT)(wcslen(L"xmlns:") + wcslen(*pbstrNewPrefix)); - - BSTR bstrDecl = SysAllocStringLen(NULL, cchDeclLength); - if (!bstrDecl) - { - hr = E_OUTOFMEMORY; - } - - // Add the new declaration to the root of the document. This is important because - // we really don't want to re-declare the namespace at every element. Just starts - // to look really messy, and adds a lot of bloat. - if (SUCCEEDED(hr)) - { - hr = StringCchPrintf(bstrDecl, cchDeclLength+1, L"xmlns:%s", *pbstrNewPrefix); - } - - if (SUCCEEDED(hr)) - { - hr = CreateXMLAttribute(m_pRootElement, bstrDecl, L"", pszUri); - } - - SysFreeString(bstrDecl); - bstrDecl = NULL; - - // Explicitly let the namespace manager know about our prefix - - if (SUCCEEDED(hr)) - { - hr = m_pNSManager->declarePrefix(*pbstrNewPrefix, pszUri); - } - } - } - - if (FAILED(hr)) - { - SysFreeString(*pbstrNewPrefix); - *pbstrNewPrefix = NULL; - } - - return hr; -} - -/*++ -Routine Name: - DeleteFeatureNode -Routine Description: - - Deletes given input Feature node and all its children from DOM tree - -Arguments: - - pParent - Parent node of the XML DOM node to be deleted - pElement - XML DOM node to be deleted - -Return Value: - HRESULT Completion status code - S_OK - On Success - E_* - On failure ---*/ -HRESULT -OEMPTXMLHandler::DeleteFeatureNode( - _In_opt_ IXMLDOMNode *pParent, - _In_ IXMLDOMNode *pElement - ) -{ - HRESULT hr = S_OK; - - IXMLDOMNode *pRemovedElement = NULL; - - if (!pElement) - { - return E_INVALIDARG; - } - - // - // if no parent node specified assume root of DOM tree as parent - // - - if (!pParent) - { - pParent = m_pRootElement; - } - - // - // MSXML function removeChild removes the given child of the XML - // element and all its children, even the Attribute nodes defined - // for given element node if any are removed. Hence we do not need - // to worry about recursively removing all the children of the - // given node before removing it - // - - hr = pParent->removeChild(pElement, &pRemovedElement); - - if (pRemovedElement) - { - pRemovedElement->Release(); - } - - return hr ; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/xmlhandler.hxx b/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/xmlhandler.hxx deleted file mode 100644 index 2767c282..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/PTPCPlPr/src/xmlhandler.hxx +++ /dev/null @@ -1,162 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: xmlhandler.hxx -// -// -// PURPOSE: Helper Class that handles all functionality related to -// processing of input PrintTicket/PrintCapabilities XML document -// -// - -#pragma once - -// -// Print ticket handler class that performs all XML handling for the -// sample code -// - -class OEMPTXMLHandler -{ - -public: - - OEMPTXMLHandler(); - virtual ~OEMPTXMLHandler(); - - HRESULT SetRoot( - _In_ IXMLDOMDocument2 *pRoot, - _In_ IPrintCoreHelper *pHelper - ); - - // - // Node creation methods - // - - HRESULT CreateFeatureNode( - _In_opt_ IXMLDOMElement *pParent, - _In_ PCWSTR pszNamespaceURI, - _In_ PCWSTR pszFeatureName, - _Out_opt_ IXMLDOMElement **ppFeatureNode - ); - - HRESULT CreateOptionNode( - _In_ IXMLDOMElement *pParent, - _In_ PCWSTR pszNamespaceURI, - _In_ PCWSTR pszOptionName, - _Out_opt_ IXMLDOMElement **ppOptionElement - ); - - // - // Get methods - // - - HRESULT GetXMLAttribute( - _In_ IXMLDOMElement *pElement, - _Outptr_result_maybenull_ BSTR *pszAttrNamespaceURI, - _Outptr_result_maybenull_ BSTR *pszAttrName - ) const; - - HRESULT GetFeatureNode( - _In_opt_ IXMLDOMElement *pParent, - _In_ PCWSTR pszAttrNamespaceURI, - _In_ PCWSTR pszAttrName, - _Out_ _When_(return == S_FALSE, _At_(*ppElement, _Post_maybenull_)) - _When_(return != S_FALSE, _At_(*ppElement, _Post_valid_)) - IXMLDOMElement **ppElement - ) const; - - HRESULT GetOptionNode( - _In_ IXMLDOMElement *pParent, - _Outptr_result_maybenull_ IXMLDOMElement **ppElement - ) const; - - HRESULT DeleteFeatureNode( - _In_opt_ IXMLDOMNode *pParent, - _In_ IXMLDOMNode *pElement - ); - -private: - - IXMLDOMDocument2 *m_pRootDocument; - IXMLDOMElement *m_pRootElement; - IMXNamespaceManager *m_pNSManager; - DWORD m_dwNextIndex; - - HRESULT GetXMLElement( - _In_ IXMLDOMElement *pParent, - _In_ PCWSTR pszElementNamespaceURI, - _In_ PCWSTR pszElementName, - _In_ PCWSTR pszAttrNamespaceURI, - _In_ PCWSTR pszAttrName, - _Outptr_result_maybenull_ IXMLDOMElement **ppElement - ) const; - - HRESULT GetXMLElementWithoutAttribute( - _In_ IXMLDOMElement *pContext, - _In_ PCWSTR pszElementNamespaceURI, - _In_ PCWSTR pszElementName, - _Outptr_result_maybenull_ IXMLDOMElement **ppChildElement - ) const; - - HRESULT getPrefix( - _In_ IXMLDOMElement *pContext, - _In_ PCWSTR pszUri, - _Outptr_opt_result_maybenull_ BSTR *pbstrPrefix - ) const; - - HRESULT declarePrefix( - _In_ IXMLDOMElement *pContext, - _In_ LPCWSTR pszUri, - _In_opt_ LPCWSTR pszPreferredPrefix, - _Out_ BSTR *newPrefix - ); - - HRESULT CreateQName( - _In_ IXMLDOMElement *pElement, - _In_ PCWSTR pszUri, - _In_ PCWSTR pszLocalName, - _Out_ BSTR *pQName - ); - - // - // Adds attributes to existing XML element - // - - HRESULT CreateXMLAttribute( - _In_ IXMLDOMElement *pElement, - _In_ PCWSTR pszAttributeName, - _In_ PCWSTR pszNamespaceURI, - _In_ PCWSTR pszAttributeValue - ); - - // - // Creates new XML element node - // - HRESULT CreateXMLElement( - _In_ IXMLDOMElement *pParent, - _In_ PCWSTR pszElementName, - _In_ PCWSTR pszNamespaceURI, - _Out_ IXMLDOMElement **ppCreatedElement - ); - - // - // Helpers - // - HRESULT getLocalName( - _In_ PCWSTR pszQName, - _Out_ BSTR *ppbstrLocalName - ) const; - - HRESULT getUri( - IXMLDOMElement *pContext, - _In_ PCWSTR pszQName, - _Out_ BSTR *pbstrURI - ) const; - -}; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/SYNCSET.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/SYNCSET.vcxproj deleted file mode 100644 index cf56c5f6..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/SYNCSET.vcxproj +++ /dev/null @@ -1,1066 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8} - $(MSBuildProjectName) - Win10 Debug - Win32 - {A7A17685-16BD-4A90-9E09-A46B09CF3A1F} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - SYNCSET - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;_DEBUG - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - SYNCSET.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/SYNCSET.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/SYNCSET.vcxproj.Filters deleted file mode 100644 index 9737750a..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/SYNCSET.vcxproj.Filters +++ /dev/null @@ -1,272 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {72226DBB-2FE2-4E91-99A5-A18952A112EB} - - - h;hpp;hxx;hm;inl;inc;xsd - {C3708A9B-9215-44CC-96A2-0C0B656486BF} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {D44A3AF2-69E5-4F32-BC8A-7636FB947722} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - Header Files - - - - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/SyncSet.def b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/SyncSet.def deleted file mode 100644 index 68bdffc0..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/SyncSet.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY OEMUI -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/debug.cpp b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/debug.cpp deleted file mode 100644 index f7a3d842..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/debug.cpp +++ /dev/null @@ -1,405 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.cpp -// -// PURPOSE: Debug functions. -// -// - -#include "precomp.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// INTERNAL DEFINES -//////////////////////////////////////////////////////// - -#define DEBUG_BUFFER_SIZE 1024 -#define PATH_SEPARATOR '\\' -#define MAX_LOOP 10 - -// Determine what level of debugging messages to eject. -#ifdef VERBOSE_MSG - #define DEBUG_LEVEL DBG_VERBOSE -#elif TERSE_MSG - #define DEBUG_LEVEL DBG_TERSE -#elif WARNING_MSG - #define DEBUG_LEVEL DBG_WARNING -#elif ERROR_MSG - #define DEBUG_LEVEL DBG_ERROR -#elif RIP_MSG - #define DEBUG_LEVEL DBG_RIP -#elif NO_DBG_MSG - #define DEBUG_LEVEL DBG_NONE -#else - #define DEBUG_LEVEL DBG_WARNING -#endif - - - -//////////////////////////////////////////////////////// -// EXTERNAL GLOBALS -//////////////////////////////////////////////////////// - -INT giDebugLevel = DEBUG_LEVEL; - - - - -//////////////////////////////////////////////////////// -// INTERNAL PROTOTYPES -//////////////////////////////////////////////////////// - -static BOOL DebugMessageV(LPCSTR lpszMessage, va_list arglist); -static BOOL DebugMessageV(DWORD dwSize, LPCWSTR lpszMessage, va_list arglist); - - - - -////////////////////////////////////////////////////////////////////////// -// Function: DebugMessageV -// -// Description: Outputs variable argument debug string. -// -// -// Parameters: -// -// dwSize Size of temp buffer to hold formated string. -// -// lpszMessage Format string. -// -// arglist Variable argument list.. -// -// -// Returns: -// -// -// Comments: -// -// -////////////////////////////////////////////////////////////////////////// - -static BOOL DebugMessageV(LPCSTR lpszMessage, va_list arglist) -{ - DWORD dwSize = DEBUG_BUFFER_SIZE; - DWORD dwLoop = 0; - LPSTR lpszMsgBuf = NULL; - HRESULT hr; - - - // Parameter checking. - if( (NULL == lpszMessage) - || - (0 == dwSize) - ) - { - return FALSE; - } - - do - { - // Allocate memory for message buffer. - if(NULL != lpszMsgBuf) - { - delete[] lpszMsgBuf; - dwSize *= 2; - } - lpszMsgBuf = new CHAR[dwSize + 1]; - if(NULL == lpszMsgBuf) - { - return FALSE; - } - - hr = StringCbVPrintfA(lpszMsgBuf, (dwSize + 1) * sizeof(CHAR), lpszMessage, arglist); - - // Pass the variable parameters to wvsprintf to be formated. - } while (FAILED(hr) && (STRSAFE_E_INSUFFICIENT_BUFFER == hr) && (++dwLoop < MAX_LOOP) ); - - // Dump string to Debug output. - OutputDebugStringA(lpszMsgBuf); - - // Cleanup. - delete[] lpszMsgBuf; - - return SUCCEEDED(hr); -} - - -////////////////////////////////////////////////////////////////////////// -// Function: DebugMessageV -// -// Description: Outputs variable argument debug string. -// -// -// Parameters: -// -// dwSize Size of temp buffer to hold formated string. -// -// lpszMessage Format string. -// -// arglist Variable argument list.. -// -// -// Returns: -// -// -// Comments: -// -// -////////////////////////////////////////////////////////////////////////// - -static BOOL DebugMessageV(DWORD dwSize, LPCWSTR lpszMessage, va_list arglist) -{ - LPWSTR lpszMsgBuf; - HRESULT hResult; - - - // Parameter checking. - if( (NULL == lpszMessage) - || - (0 == dwSize) - ) - { - return FALSE; - } - - // Allocate memory for message buffer. - lpszMsgBuf = new WCHAR[dwSize + 1]; - if(NULL == lpszMsgBuf) - return FALSE; - - // Pass the variable parameters to wvsprintf to be formated. - hResult = StringCbVPrintfW(lpszMsgBuf, (dwSize + 1) * sizeof(WCHAR), lpszMessage, arglist); - - // Dump string to debug output. - OutputDebugStringW(lpszMsgBuf); - - // Clean up. - delete[] lpszMsgBuf; - - return SUCCEEDED(hResult); -} - - -////////////////////////////////////////////////////////////////////////// -// Function: DebugMessage -// -// Description: Outputs variable argument debug string. -// -// -// Parameters: -// -// lpszMessage Format string. -// -// -// Returns: -// -// -// Comments: -// -// -////////////////////////////////////////////////////////////////////////// - -BOOL DebugMessage(LPCSTR lpszMessage, ...) -{ - BOOL bResult; - va_list VAList; - - - // Pass the variable parameters to DebugMessageV for processing. - va_start(VAList, lpszMessage); - bResult = DebugMessageV(lpszMessage, VAList); - va_end(VAList); - - return bResult; -} - - -////////////////////////////////////////////////////////////////////////// -// Function: DebugMessage -// -// Description: Outputs variable argument debug string. -// -// -// Parameters: -// -// lpszMessage Format string. -// -// -// Returns: -// -// -// Comments: -// -// -////////////////////////////////////////////////////////////////////////// - -BOOL DebugMessage(LPCWSTR lpszMessage, ...) -{ - BOOL bResult; - va_list VAList; - - - // Pass the variable parameters to DebugMessageV to be processed. - va_start(VAList, lpszMessage); - bResult = DebugMessageV(MAX_PATH, lpszMessage, VAList); - va_end(VAList); - - return bResult; -} - -void Dump(PPUBLISHERINFO pPublisherInfo) -{ - VERBOSE(TEXT("pPublisherInfo:\r\n")); - if(NULL == pPublisherInfo) - { - VERBOSE(TEXT("\tpPublisherInfo is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\tdwMode = %#x\r\n"), pPublisherInfo->dwMode); - VERBOSE(TEXT("\twMinoutlinePPEM = %d\r\n"), pPublisherInfo->wMinoutlinePPEM); - VERBOSE(TEXT("\twMaxbitmapPPEM = %d\r\n"), pPublisherInfo->wMaxbitmapPPEM); -} - -void Dump(POEMDMPARAM pOemDMParam) -{ - VERBOSE(TEXT("pOemDMParam:\r\n")); - if(NULL == pOemDMParam) - { - VERBOSE(TEXT("\tpOemDMParam is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\tcbSize = %d\r\n"), pOemDMParam->cbSize); - VERBOSE(TEXT("\tpdriverobj = %#x\r\n"), pOemDMParam->pdriverobj); - VERBOSE(TEXT("\thPrinter = %#x\r\n"), pOemDMParam->hPrinter); - VERBOSE(TEXT("\thModule = %#x\r\n"), pOemDMParam->hModule); - VERBOSE(TEXT("\tpPublicDMIn = %#x\r\n"), pOemDMParam->pPublicDMIn); - VERBOSE(TEXT("\tpPublicDMOut = %#x\r\n"), pOemDMParam->pPublicDMOut); - VERBOSE(TEXT("\tpOEMDMIn = %#x\r\n"), pOemDMParam->pOEMDMIn); - VERBOSE(TEXT("\tpOEMDMOut = %#x\r\n"), pOemDMParam->pOEMDMOut); - VERBOSE(TEXT("\tcbBufSize = %d\r\n"), pOemDMParam->cbBufSize); -} - -void Dump(PPROPSHEETUI_INFO pPSUIInfo) -{ - VERBOSE(TEXT("pPSUIInfo:\r\n")); - if(NULL == pPSUIInfo) - { - VERBOSE(TEXT("\tpPSUIInfo is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\tcbSize = %d\r\n"), pPSUIInfo->cbSize); - VERBOSE(TEXT("\tVersion = %#x\r\n"), pPSUIInfo->Version); - VERBOSE(TEXT("\tFlags = %#x\r\n"), pPSUIInfo->Flags); - VERBOSE(TEXT("\tReason = %d\r\n"), pPSUIInfo->Reason); - VERBOSE(TEXT("\thComPropSheet = %#x\r\n"), pPSUIInfo->hComPropSheet); - VERBOSE(TEXT("\tpfnComPropSheet = %#x\r\n"), pPSUIInfo->pfnComPropSheet); - VERBOSE(TEXT("\tlParamInit = %#x\r\n"), pPSUIInfo->lParamInit); - VERBOSE(TEXT("\tUserData = %#x\r\n"), pPSUIInfo->UserData); - VERBOSE(TEXT("\tResult = %#x\r\n"), pPSUIInfo->Result); -} - -void Dump(POPTITEM pOptItem) -{ - VERBOSE(TEXT("pOptItem:\r\n")); - if(NULL == pOptItem) - { - VERBOSE(TEXT("\tpOptItem is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\tcbSize = %d\r\n"), pOptItem->cbSize); - VERBOSE(TEXT("\tLevel = %d\r\n"), pOptItem->Level); - VERBOSE(TEXT("\tDlgPageIdx = %d\r\n"), pOptItem->DlgPageIdx); - VERBOSE(TEXT("\tFlags = 0x%x\r\n"), pOptItem->Flags); - VERBOSE(TEXT("\tUserData = 0x%p\r\n"), pOptItem->UserData); - VERBOSE(TEXT("\tpName = %s\r\n"), pOptItem->pName ? pOptItem->pName : TEXT("")); - VERBOSE(TEXT("\tpSel = 0x%p\r\n"), pOptItem->pSel); - VERBOSE(TEXT("\tpExtChkBox = 0x%p\r\n"), pOptItem->pExtChkBox); - VERBOSE(TEXT("\tpExtChkBox = 0x%p\r\n"), pOptItem->pExtChkBox); - VERBOSE(TEXT("\tHelpIndex = 0x%x\r\n"), pOptItem->HelpIndex); - VERBOSE(TEXT("\tDMPubID = 0x%x\r\n"), pOptItem->DMPubID); - VERBOSE(TEXT("\tUserItemID = 0x%x\r\n"), pOptItem->UserItemID); - VERBOSE(TEXT("\twReserved = 0x%x\r\n"), pOptItem->wReserved); - VERBOSE(TEXT("\tpOIExt = 0x%p\r\n"), pOptItem->pOIExt); - - Dump(pOptItem->pOptType); -} - -void Dump(POPTTYPE pOptType) -{ - VERBOSE(TEXT("\tpOptType:\r\n")); - if(NULL == pOptType) - { - VERBOSE(TEXT("\t\tpOptType is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\t\tcbSize = %d\r\n"), pOptType->cbSize); - VERBOSE(TEXT("\t\tType = 0x%x\r\n"), pOptType->Type); - VERBOSE(TEXT("\t\tFlags = 0x%x\r\n"), pOptType->Flags); - VERBOSE(TEXT("\t\tCount = %d\r\n"), pOptType->Count); - VERBOSE(TEXT("\t\tCount = 0x%x\r\n"), pOptType->BegCtrlID); - VERBOSE(TEXT("\t\tStyle = 0x%x\r\n"), pOptType->Style); - - Dump(pOptType->pOptParam, pOptType->Count); -} - -void Dump(POPTPARAM pOptParam, WORD wCount) -{ - if(NULL == pOptParam) - { - VERBOSE(TEXT("\t\tpOptParam is NULL!\r\n")); - return; - } - - for(WORD wIndex = 0; wIndex < wCount; ++wIndex) - { - VERBOSE(TEXT("\t\tpOptParam[wIndex]:\r\n")); - VERBOSE(TEXT("\t\t\tcbSize = %d\r\n"), pOptParam[wIndex].cbSize); - VERBOSE(TEXT("\t\t\tFlags = 0x%x\r\n"), pOptParam[wIndex].Flags); - VERBOSE(TEXT("\t\t\tStyle = 0x%x\r\n"), pOptParam[wIndex].Style); - VERBOSE(TEXT("\t\t\tpData = 0x%p\r\n"), pOptParam[wIndex].pData); - VERBOSE(TEXT("\t\t\tIconID = 0x%p\r\n"), pOptParam[wIndex].IconID); - VERBOSE(TEXT("\t\t\tlParam = 0x%p\r\n"), pOptParam[wIndex].lParam); - } -} - - -PCSTR -StripDirPrefixA( - IN PCSTR pstrFilename - ) - -/*++ - -Routine Description: - - Strip the directory prefix off a filename (ANSI version) - -Arguments: - - pstrFilename - Pointer to filename string - -Return Value: - - Pointer to the last component of a filename (without directory prefix) - ---*/ - -{ - PCSTR pstr; - - pstr = strrchr(pstrFilename, PATH_SEPARATOR); - if (pstr) - return pstr + 1; - - return pstrFilename; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/debug.h b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/debug.h deleted file mode 100644 index b4d57b0b..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/debug.h +++ /dev/null @@ -1,166 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.H -// -// -// PURPOSE: Define common data types, and external function prototypes -// for debugging functions. -// -// - -#pragma once - -// VC and Build use different debug defines. -// The following makes it so either will -// cause the inclusion of debugging code. -#if !defined(_DEBUG) && defined(DBG) - #define _DEBUG DBG -#elif defined(_DEBUG) && !defined(DBG) - #define DBG _DEBUG -#endif - - - -///////////////////////////////////////////////////////// -// Macros -///////////////////////////////////////////////////////// - -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// VERBOSE(msg) -// Display a message if the current debug level is <= DBG_VERBOSE. -// -// TERSE(msg) -// Display a message if the current debug level is <= DBG_TERSE. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// ASSERTMSG(cond, msg) -// Verify a condition is true. If not, display a message and -// force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// These macros require extra parantheses for the msg argument -// example, ASSERTMSG(x > 0, ("x is less than 0\n")); -// WARNING(("App passed NULL pointer, ignoring...\n")); -// - -#define DBG_VERBOSE 1 -#define DBG_TERSE 2 -#define DBG_WARNING 3 -#define DBG_ERROR 4 -#define DBG_RIP 5 -#define DBG_NONE 6 - -#if DBG - - #define DebugMsg DebugMessage - - // - // Strip the directory prefix from a filename (ANSI version) - // - - PCSTR - StripDirPrefixA( - IN PCSTR pstrFilename - ); - - extern INT giDebugLevel; - - - #define DBGMSG(level, prefix, msg) { \ - if (giDebugLevel <= (level)) { \ - DebugMsg("%s %s (%d): ", prefix, StripDirPrefixA(__FILE__), __LINE__); \ - DebugMsg(msg); \ - } \ - } - - #define DBGPRINT(level, msg) { \ - if (giDebugLevel <= (level)) { \ - DebugMsg(msg); \ - } \ - } - - #define VERBOSE if(giDebugLevel <= DBG_VERBOSE) DebugMsg - #define TERSE if(giDebugLevel <= DBG_TERSE) DebugMsg - #define WARNING if(giDebugLevel <= DBG_WARNING) DebugMsg - #define ERR if(giDebugLevel <= DBG_ERROR) DebugMsg - - #define ASSERT(cond) { \ - if (! (cond)) { \ - RIP(("\n")); \ - } \ - } - - #define ASSERTMSG(cond, msg) { \ - if (! (cond)) { \ - RIP(msg); \ - } \ - } - - #define RIP(msg) { \ - DBGMSG(DBG_RIP, "RIP", msg); \ - DebugBreak(); \ - } - - -#else // !DBG - - #define DebugMsg NOP_FUNCTION - - #define VERBOSE NOP_FUNCTION - #define TERSE NOP_FUNCTION - #define WARNING NOP_FUNCTION - #define ERR NOP_FUNCTION - - #define ASSERT(cond) - - #define ASSERTMSG(cond, msg) - #define RIP(msg) - #define DBGMSG(level, prefix, msg) - #define DBGPRINT(level, msg) - -#endif - - - - -///////////////////////////////////////////////////////// -// ProtoTypes -///////////////////////////////////////////////////////// - -BOOL DebugMessage(LPCSTR, ...); -BOOL DebugMessage(LPCWSTR, ...); -void Dump(PPUBLISHERINFO pPublisherInfo); -void Dump(POEMDMPARAM pOemDMParam); -void Dump(PPROPSHEETUI_INFO pPSUIInfo); -void Dump(POPTITEM pOptItem); -void Dump(POPTTYPE pOptType); -void Dump(POPTPARAM pOptParam, WORD wCount); - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/devmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/devmode.cpp deleted file mode 100644 index 2a19310c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/devmode.cpp +++ /dev/null @@ -1,214 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.cpp -// -// -// PURPOSE: Implementation of Devmode functions shared with OEM UI and OEM rendering modules. -// - -#include "precomp.h" -#include "oemui.h" -#include "debug.h" -#include "devmode.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -// -//Performs operation on UI Plugins Private DevMode Members. -//Called via IOemUI::DevMode -// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam) -{ - POEMDEV pOEMDevIn; - POEMDEV pOEMDevOut; - - - // Verify parameters. - if( (NULL == pOemDMParam) - || - ( (OEMDM_SIZE != dwMode) - && - (OEMDM_DEFAULT != dwMode) - && - (OEMDM_CONVERT != dwMode) - && - (OEMDM_MERGE != dwMode) - ) - ) - { - ERR(ERRORTEXT("DevMode() ERROR_INVALID_PARAMETER.\r\n")); - VERBOSE(DLLTEXT("\tdwMode = %d, pOemDMParam = %#lx.\r\n"), dwMode, pOemDMParam); - - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Cast generic (i.e. PVOID) to OEM private devomode pointer type. - pOEMDevIn = (POEMDEV) pOemDMParam->pOEMDMIn; - pOEMDevOut = (POEMDEV) pOemDMParam->pOEMDMOut; - - switch(dwMode) - { - // - //The Method should return the size of the memory allocation needed to store the UI plugin Private DEVMODE. - // - case OEMDM_SIZE: - pOemDMParam->cbBufSize = sizeof(OEMDEV); - break; - - // - //Should fill the Private DEVMODE with the default values. - // - case OEMDM_DEFAULT: - // - //OEM_DMEXTRAHEADER Members - // - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - - // - //Private members - // - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - - VERBOSE(DLLTEXT("pOEMDevOut after setting default values:\r\n")); - Dump(pOEMDevOut); - break; - - // - //The method should convert private DEVMODE members to the current version, if necessary. - // - case OEMDM_CONVERT: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - break; - - // - //The method should validate the information contained in private DEVMODE members and merge validated values into a private DEVMODE structure containing default values - // - case OEMDM_MERGE: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - MakeOEMDevmodeValid(pOEMDevOut); - break; - } - Dump(pOemDMParam); - - return S_OK; -} - - -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut) -{ - if( (NULL == pOEMDevIn) - || - (NULL == pOEMDevOut) - ) - { - ERR(ERRORTEXT("ConvertOEMDevmode() invalid parameters.\r\n")); - return FALSE; - } - - // Check OEM Signature, if it doesn't match ours, - // then just assume DMIn is bad and use defaults. - if(pOEMDevIn->dmOEMExtra.dwSignature == pOEMDevOut->dmOEMExtra.dwSignature) - { - VERBOSE(DLLTEXT("Converting private OEM Devmode.\r\n")); - VERBOSE(DLLTEXT("pOEMDevIn:\r\n")); - Dump(pOEMDevIn); - - // Set the devmode defaults so that anything the isn't copied over will - // be set to the default value. - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - - // Copy the old structure in to the new using which ever size is the smaller. - // Devmode maybe from newer Devmode (not likely since there is only one), or - // Devmode maybe a newer Devmode, in which case it maybe larger, - // but the first part of the structure should be the same. - - // DESIGN ASSUMPTION: the private DEVMODE structure only gets added to; - // the fields that are in the DEVMODE never change only new fields get added to the end. - - memcpy(pOEMDevOut, pOEMDevIn, __min(pOEMDevOut->dmOEMExtra.dwSize, pOEMDevIn->dmOEMExtra.dwSize)); - - // Re-fill in the size and version fields to indicated - // that the DEVMODE is the current private DEVMODE version. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - } - else - { - WARNING(DLLTEXT("Unknown DEVMODE signature, pOEMDMIn ignored.\r\n")); - - // Don't know what the input DEVMODE is, so just use defaults. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - } - - return TRUE; -} - - -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode) -{ - if(NULL == pOEMDevmode) - { - return FALSE; - } - - // ASSUMPTION: pOEMDevmode is large enough to contain OEMDEV structure. - - // Make sure that dmOEMExtra indicates the current OEMDEV structure. - pOEMDevmode->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevmode->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevmode->dmOEMExtra.dwVersion = OEM_VERSION; - - // Set driver data, if not valid. - if(pOEMDevmode->dwDriverData > 100) - { - pOEMDevmode->dwDriverData = 0; - } - - // Set Advanced driver data, if not valid. - if(pOEMDevmode->dwAdvancedData > 100) - { - pOEMDevmode->dwAdvancedData = 0; - } - - return TRUE; -} - - -void Dump(PCOEMDEV pOEMDevmode) -{ - if( (NULL != pOEMDevmode) - && - (pOEMDevmode->dmOEMExtra.dwSize >= sizeof(OEMDEV)) - && - (OEM_SIGNATURE == pOEMDevmode->dmOEMExtra.dwSignature) - ) - { - VERBOSE(TEXT("\tdmOEMExtra.dwSize = %d\r\n"), pOEMDevmode->dmOEMExtra.dwSize); - VERBOSE(TEXT("\tdmOEMExtra.dwSignature = %#x\r\n"), pOEMDevmode->dmOEMExtra.dwSignature); - VERBOSE(TEXT("\tdmOEMExtra.dwVersion = %#x\r\n"), pOEMDevmode->dmOEMExtra.dwVersion); - VERBOSE(TEXT("\tdwDriverData = %#x\r\n"), pOEMDevmode->dwDriverData); - VERBOSE(TEXT("\tdwAdvancedData = %#x\r\n"), pOEMDevmode->dwAdvancedData); - } - else - { - ERR(ERRORTEXT("Dump(POEMDEV) unknown private OEM DEVMODE.\r\n")); - } -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/devmode.h b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/devmode.h deleted file mode 100644 index e2f9c6b7..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/devmode.h +++ /dev/null @@ -1,57 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.h -// -// PURPOSE: Define common data types, and external function prototypes -// for devmode functions. -// -#pragma once - -//////////////////////////////////////////////////////// -// OEM Devmode Defines -//////////////////////////////////////////////////////// - - - - -//////////////////////////////////////////////////////// -// OEM Devmode Type Definitions -//////////////////////////////////////////////////////// - -// -//Can add info to the private devmode bellow here. -//Note : -// This structure must be prefixed by OEM_DMEXTRAHEADER -// Your plug-in must implement the IPrintOemUI::DevMode method -// -typedef struct tagOEMDEV -{ - OEM_DMEXTRAHEADER dmOEMExtra; - DWORD dwDriverData; - DWORD dwAdvancedData; - - // - //Private DevMode Members - // - -} OEMDEV, *POEMDEV; - -typedef const OEMDEV *PCOEMDEV; - - - -///////////////////////////////////////////////////////// -// ProtoTypes -///////////////////////////////////////////////////////// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam); -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut); -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode); -void Dump(PCOEMDEV pOEMDevIn); - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/dllentry.cpp b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/dllentry.cpp deleted file mode 100644 index dcac51ef..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/dllentry.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cpp -// -// PURPOSE: Source module for DLL entry function(s). -// - -#include "precomp.h" -#include "oemui.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////////////////////////// -// -// DLL entry point -// -BOOL WINAPI DllMain(HINSTANCE hInst, WORD wReason, LPVOID lpReserved) -{ - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - VERBOSE(DLLTEXT("Process attach.\r\n")); - ghInstance = hInst; - break; - - case DLL_THREAD_ATTACH: - VERBOSE(DLLTEXT("Thread attach.\r\n")); - break; - - case DLL_PROCESS_DETACH: - VERBOSE(DLLTEXT("Process detach.\r\n")); - break; - - case DLL_THREAD_DETACH: - VERBOSE(DLLTEXT("Thread detach.\r\n")); - break; - } - - return TRUE; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/globals.cpp b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/globals.cpp deleted file mode 100644 index 9e77a228..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/globals.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Globals.cpp -// -// -// PURPOSE: File that contains all the globals. -// -// -#include "precomp.h" - -#include "oemui.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -// Module's Instance handle from DLLEntry of process. -HINSTANCE ghInstance = NULL; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/globals.h b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/globals.h deleted file mode 100644 index b6c7d0ee..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/globals.h +++ /dev/null @@ -1,22 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Globals.h -// -// -// PURPOSE: Lists of globals declared in Globals.cpp. -// -// -#pragma once - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -// Module's Instance handle from DLLEntry of process. -extern HINSTANCE ghInstance; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/intrface.cpp deleted file mode 100644 index 493d36f7..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/intrface.cpp +++ /dev/null @@ -1,612 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: intrface.cpp -// -// PURPOSE: UI plug-in implementation. -// -// - -#include "precomp.h" - -#include "oemui.h" -#include "debug.h" -#include "intrface.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// Internal Globals -//////////////////////////////////////////////////////// - -static long g_cComponents = 0 ; // Count of active components -static long g_cServerLocks = 0 ; // Count of locks - - - -//////////////////////////////////////////////////////////////////////////////// -// -// IOemUI body -// -IOemUI::~IOemUI() -{ - // Make sure that helper interface is released. - if(NULL != m_pOEMHelp) - { - m_pOEMHelp->Release(); - m_pOEMHelp = NULL; - } - - // If this instance of the object is being deleted, then the reference - // count should be zero. - assert(0 == m_cRef); -} - -HRESULT __stdcall IOemUI::QueryInterface(const IID& iid, void** ppv) -{ - VERBOSE(DLLTEXT("IOemUI:QueryInterface entry.\r\n\r\n")); - if (iid == IID_IUnknown) - { - *ppv = static_cast(this); - VERBOSE(DLLTEXT("IOemUI:Return pointer to IUnknown.\r\n\r\n")); - } - else if (iid == IID_IPrintOemUI) - { - *ppv = static_cast(this) ; - VERBOSE(DLLTEXT("IOemUI:Return pointer to IPrintOemUI.\r\n")); - } - else - { - *ppv = NULL ; - VERBOSE(DLLTEXT("IOemUI:No Interface. Return NULL.\r\n")); - return E_NOINTERFACE ; - } - reinterpret_cast(*ppv)->AddRef() ; - return S_OK ; -} - -ULONG __stdcall IOemUI::AddRef() -{ - VERBOSE(DLLTEXT("IOemUI:AddRef entry.\r\n")); - return InterlockedIncrement(&m_cRef) ; -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemUI::Release() -{ - VERBOSE(DLLTEXT("IOemUI:Release entry.\r\n")); - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -// -//(Implamentation is required) Supplies a pointer to UNIDRIVE /PScript IPrintOemDriverUI -// -HRESULT __stdcall IOemUI::PublishDriverInterface( - IUnknown *pIUnknown) -{ - VERBOSE(DLLTEXT("IOemUI:PublishDriverInterface entry.\r\n")); - - // Need to store pointer to Driver Helper functions, if we already haven't. - if (m_pOEMHelp == NULL) - { - HRESULT hResult; - - - // Get Interface to Helper Functions. - hResult = pIUnknown->QueryInterface(IID_IPrintOemDriverUI, (void** ) &(m_pOEMHelp)); - - if(!SUCCEEDED(hResult)) - { - // Make sure that interface pointer reflects interface query failure. - m_pOEMHelp = NULL; - - return E_FAIL; - } - } - - return S_OK; -} - -// -//(Implamentation is required) Returns the UI Plugin's identification information -// -HRESULT __stdcall IOemUI::GetInfo( - DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded) -{ - VERBOSE(DLLTEXT("IOemUI::GetInfo(%d) entry.\r\r\n"), dwMode); - - // Validate parameters. - if( (NULL == pcbNeeded) - || - ( (OEMGI_GETSIGNATURE != dwMode) - && - (OEMGI_GETVERSION != dwMode) - && - (OEMGI_GETPUBLISHERINFO != dwMode) - ) - ) - { - WARNING(DLLTEXT("IOemUI::GetInfo() exit pcbNeeded is NULL! ERROR_INVALID_PARAMETER\r\r\n")); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Set expected buffer size and number of bytes written. - *pcbNeeded = sizeof(DWORD); - - // Check buffer size is sufficient. - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - WARNING(DLLTEXT("IOemUI::GetInfo() exit insufficient buffer!\r\r\n")); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return E_FAIL; - } - - switch(dwMode) - { - // OEM DLL Signature - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // OEM DLL version - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // dwMode not supported. - default: - // Set written bytes to zero since nothing was written. - WARNING(DLLTEXT("IOemUI::GetInfo() exit mode not supported.\r\r\n")); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - return E_FAIL; - } - - VERBOSE(DLLTEXT("IOemUI::GetInfo() exit S_OK, (*pBuffer is %#x).\r\r\n"), *(PDWORD)pBuffer); - return S_OK; -} - - -// -//Performs operation on UI Plugins Private DevMode Members. -// -HRESULT __stdcall IOemUI::DevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam) -{ - VERBOSE(DLLTEXT("IOemUI:DevMode(%d, %#x) entry.\r\n"), dwMode, pOemDMParam); - - return hrOEMDevMode(dwMode, pOemDMParam); -} - - -// -//Allows UI Plugin to Modifiy Existing printer porp sheet and document property sheet page.. -// -HRESULT __stdcall IOemUI::CommonUIProp( - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam) -{ - VERBOSE(DLLTEXT("IOemUI:CommonUIProp entry.\r\n")); - - // - //We want to keep this pointer so the we can modifie the data and OPTITEMS from the OEM plugin page. - // - m_OemSheetData.pOEMCUIParam = pOemCUIPParam; - return hrOEMPropertyPage(dwMode, pOemCUIPParam); -} - - -// -//Adds a New page to the device Documment property sheet. -// - -HRESULT __stdcall IOemUI::DocumentPropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI:DocumentPropertySheets entry.\r\n")); - - return hrOEMDocumentPropertySheets(pPSUIInfo, lParam, m_pOEMHelp); -} - -// -//Adds a New page to the device printer property page. -// -HRESULT __stdcall IOemUI::DevicePropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI:DevicePropertySheets entry.\r\n")); - - // - //Store the This pointer in the OEMSHEETDATA - // - m_OemSheetData.pOEMHelp = m_pOEMHelp; - return hrOEMDevicePropertySheets(pPSUIInfo, lParam, &(m_OemSheetData)); -} - - -// -//Allows the UI plugin to spec Customized device capabilaties (TODO) -// -HRESULT __stdcall IOemUI::DeviceCapabilities( - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult) -{ - VERBOSE(DLLTEXT("IOemUI:DeviceCapabilities entry.\r\n")); - - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(pDeviceName); - UNREFERENCED_PARAMETER(wCapability); - UNREFERENCED_PARAMETER(pOutput); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - UNREFERENCED_PARAMETER(dwOld); - UNREFERENCED_PARAMETER(dwResult); - - return E_NOTIMPL; -} - - -// -//Allows the UI plugin to help determine if a print Job is printable. -// -HRESULT __stdcall IOemUI::DevQueryPrintEx( - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM) -{ - VERBOSE(DLLTEXT("IOemUI:DevQueryPrintEx entry.\r\n")); - - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pDQPInfo); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - - return E_NOTIMPL; -} - - -// -//Allows the UI Plugin to upgrade its dev options stored in the registry. -// -HRESULT __stdcall IOemUI::UpgradePrinter( - DWORD dwLevel, - PBYTE pDriverUpgradeInfo) -{ - VERBOSE(DLLTEXT("IOemUI:UpgradePrinter entry.\r\n")); - - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverUpgradeInfo); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::PrinterEvent( - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI:PrinterEvent entry.\r\n")); - - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(iDriverEvent); - UNREFERENCED_PARAMETER(dwFlags); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::DriverEvent( - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI:DriverEvent entry.\r\n")); - - UNREFERENCED_PARAMETER(dwDriverEvent); - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - - -#define PROFILE_NAME L"OEMPROFILE.icm\0" - -HRESULT __stdcall IOemUI::QueryColorProfile( - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulQueryMode, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData) -{ - HRESULT Result = E_FAIL; - - VERBOSE(DLLTEXT("IOemUI:QueryColorProfile entry.\r\n")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - - if(QCP_DEVICEPROFILE == ulQueryMode) - { - if(NULL == pvProfileData) - { - *pcbProfileData = sizeof(PROFILE_NAME); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - } - else - { - if(*pcbProfileData < sizeof(PROFILE_NAME)) - { - *pcbProfileData = sizeof(PROFILE_NAME); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - } - else - { - Result = StringCbCopy((LPWSTR)pvProfileData, *pcbProfileData, PROFILE_NAME); - *pcbProfileData = sizeof(PROFILE_NAME); - *pflProfileData = QCP_PROFILEDISK; - - if(FAILED(Result)) - { - SetLastError(Result); - } - } - } - } - - return Result; -}; - -HRESULT __stdcall IOemUI::FontInstallerDlgProc( - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI:FontInstallerDlgProc entry.\r\n")); - - UNREFERENCED_PARAMETER(hWnd); - UNREFERENCED_PARAMETER(usMsg); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - -HRESULT __stdcall IOemUI::UpdateExternalFonts( - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges) -{ - VERBOSE(DLLTEXT("IOemUI:UpdateExternalFonts entry.\r\n")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(hHeap); - UNREFERENCED_PARAMETER(pwstrCartridges); - - return E_NOTIMPL; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// oem class factory -// -class IOemCF : public IClassFactory -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // *** IClassFactory methods *** - STDMETHOD(CreateInstance) (THIS_ - LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID FAR* ppvObject); - STDMETHOD(LockServer) (THIS_ BOOL bLock); - - - // Constructor - IOemCF(): m_cRef(1) { }; - ~IOemCF() { }; - -protected: - LONG m_cRef; - -}; - -/////////////////////////////////////////////////////////// -// -// Class factory body -// -HRESULT __stdcall IOemCF::QueryInterface(const IID& iid, void** ppv) -{ - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this) ; - } - else - { - *ppv = NULL ; - return E_NOINTERFACE ; - } - reinterpret_cast(*ppv)->AddRef() ; - return S_OK ; -} - -ULONG __stdcall IOemCF::AddRef() -{ - return InterlockedIncrement(&m_cRef) ; -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemCF::Release() -{ - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -// IClassFactory implementation -HRESULT __stdcall IOemCF::CreateInstance(IUnknown* pUnknownOuter, - const IID& iid, - void** ppv) -{ - //DbgPrint(DLLTEXT("Class factory:\t\tCreate component.")) ; - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Cannot aggregate. - if (pUnknownOuter != NULL) - { - return CLASS_E_NOAGGREGATION ; - } - - // Create component. - IOemUI* pOemCB = new IOemUI ; - if (pOemCB == NULL) - { - return E_OUTOFMEMORY ; - } - // Get the requested interface. - HRESULT hr = pOemCB->QueryInterface(iid, ppv) ; - - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - pOemCB->Release() ; - return hr ; -} - -// LockServer -HRESULT __stdcall IOemCF::LockServer(BOOL bLock) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks) ; - } - else - { - InterlockedDecrement(&g_cServerLocks) ; - } - return S_OK ; -} - -/////////////////////////////////////////////////////////// -// -// Exported functions -// - - -// Can DLL unload now? -// -STDAPI DllCanUnloadNow() -{ - // - // To avoid leaving OEM DLL still in memory when Unidrv or Pscript drivers - // are unloaded, Unidrv and Pscript driver ignore the return value of - // DllCanUnloadNow of the OEM DLL, and always call FreeLibrary on the OEMDLL. - // - // If OEM DLL spins off a working thread that also uses the OEM DLL, the - // thread needs to call LoadLibrary and FreeLibraryAndExitThread, otherwise - // it may crash after Unidrv or Pscript calls FreeLibrary. - // - - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK ; - } - else - { - return S_FALSE; - } -} - -// -// Get class factory -// -STDAPI DllGetClassObject( - _In_ REFCLSID clsid, - _In_ REFIID iid, - _Outptr_ LPVOID* ppv) -{ - VERBOSE(DLLTEXT("DllGetClassObject:Create class factory.\r\n")); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Can we create this component? - if (clsid != CLSID_OEMUI) - { - return CLASS_E_CLASSNOTAVAILABLE ; - } - - // Create class factory. - IOemCF* pFontCF = new IOemCF ; // Reference count set to 1 - // in constructor - if (pFontCF == NULL) - { - return E_OUTOFMEMORY ; - } - - // Get requested interface. - HRESULT hr = pFontCF->QueryInterface(iid, ppv) ; - pFontCF->Release() ; - - return hr ; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/intrface.h deleted file mode 100644 index 6ec38f73..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/intrface.h +++ /dev/null @@ -1,192 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: intrface.h -// -// PURPOSE: UI plug-in definition. -// -// -#pragma once - -//////////////////////////////////////////////////////////////////////////////// -// -// IOemUI -// -class IOemUI: public IPrintOemUI -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Get OEM dll related information - // - - STDMETHOD(GetInfo) (THIS_ DWORD dwMode, PVOID pBuffer, DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDevMode - // - - STDMETHOD(DevMode) (THIS_ DWORD dwMode, POEMDMPARAM pOemDMParam) ; - - // - // OEMCommonUIProp - // - - STDMETHOD(CommonUIProp) (THIS_ - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam - ); - - // - // OEMDocumentPropertySheets - // - - STDMETHOD(DocumentPropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - // - // OEMDevicePropertySheets - // - - STDMETHOD(DevicePropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - - // - // OEMDevQueryPrintEx - // - - STDMETHOD(DevQueryPrintEx) (THIS_ - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM - ); - - // - // OEMDeviceCapabilities - // - - STDMETHOD(DeviceCapabilities) (THIS_ - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult - ); - - // - // OEMUpgradePrinter - // - - STDMETHOD(UpgradePrinter) (THIS_ - DWORD dwLevel, - PBYTE pDriverUpgradeInfo - ); - - // - // OEMPrinterEvent - // - - STDMETHOD(PrinterEvent) (THIS_ - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam - ); - - // - // OEMDriverEvent - // - - STDMETHOD(DriverEvent)(THIS_ - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam - ); - - // - // OEMQueryColorProfile - // - - STDMETHOD(QueryColorProfile) (THIS_ - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulReserved, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData); - - // - // OEMFontInstallerDlgProc - // - - STDMETHOD(FontInstallerDlgProc) (THIS_ - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam - ); - // - // UpdateExternalFonts - // - - STDMETHOD(UpdateExternalFonts) (THIS_ - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges - ); - - IOemUI() - { - m_cRef = 1; - m_pOEMHelp = NULL; - m_OemSheetData.pfnComPropSheet = NULL; - m_OemSheetData.pOEMCUIParam=NULL; - m_OemSheetData.hComPropSheet=INVALID_HANDLE_VALUE; - m_OemSheetData.hmyPlugin=INVALID_HANDLE_VALUE; - }; - - ~IOemUI(); - -protected: - LONG m_cRef; - IPrintOemDriverUI* m_pOEMHelp; - - // - //Used to link common ui in device settings tab and the OEM plugin tab. - // - OEMSHEETDATA m_OemSheetData; -}; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oem.h b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oem.h deleted file mode 100644 index daad3e27..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oem.h +++ /dev/null @@ -1,24 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: oem.h -// -// -// PURPOSE: Define common data types, and external function prototypes -// for debug.cpp. -// - -#pragma once - -//////////////////////////////////////////////////////// -// OEM Defines -//////////////////////////////////////////////////////// - -#define OEM_SIGNATURE 'MSFT' -#define OEM_VERSION 0x00000001L - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oemui.cpp b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oemui.cpp deleted file mode 100644 index 5802a776..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oemui.cpp +++ /dev/null @@ -1,1099 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: OEMUI.cpp -// -// PURPOSE: Main file for OEM UI test module. -// - -#include "precomp.h" -#include "resource.h" -#include "debug.h" -#include "oemui.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -//////////////////////////////////////////////////////// -// INTERNAL MACROS and DEFINES -//////////////////////////////////////////////////////// - -typedef struct _tagCBUserData -{ - HANDLE hComPropSheet; - HANDLE hPropPage; - POEMUIPSPARAM pOEMUIParam; - PFNCOMPROPSHEET pfnComPropSheet; - -} CBUSERDATA, *PCBUSERDATA; - - -//////////////////////////////////////////////////////// -// INTERNAL PROTOTYPES -//////////////////////////////////////////////////////// - -static HRESULT hrDocumentPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -static HRESULT hrPrinterPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); - -LONG APIENTRY OEMPrinterUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam); -LONG APIENTRY OEMDocUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam); -LONG APIENTRY OEMDocUICallBack2(PCPSUICBPARAM pCallbackParam); -INT_PTR CALLBACK DevicePropPageProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam); - -void SetOEMUiState (HWND hDlg, POEMSHEETDATA pOEMSheetData); -void SetOEMCommonDataIntoOptItem (POEMSHEETDATA pOEMSheetData, _In_ PSTR PName, LONG Sel); -void ChangeOpItem (IPrintOemDriverUI *pIPrintOEMDrvUI, POEMUIOBJ pOEMObj, POPTITEM pOptItem, int iSel); -POPTITEM FindDrvOptItem (POPTITEM pDrvOptItems, DWORD dwItemCount, _In_ PSTR pKeyWordName, BYTE dmPubID = DMPUB_NONE); - -static POPTITEM CreateOptItems(HANDLE hHeap, DWORD dwOptItems); -static void InitOptItems(POPTITEM pOptItems, DWORD dwOptItems); -static POPTTYPE CreateOptType(HANDLE hHeap, WORD wOptParams); -static PTSTR GetStringResource(HANDLE hHeap, HANDLE hModule, UINT uResource); - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM device or document property UI. -// Called via IOemUI::CommonUIProp -// -HRESULT hrOEMPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - HRESULT hResult = S_OK; - - - VERBOSE(DLLTEXT("hrOEMPropertyPage(%d) entry.\r\n"), dwMode); - - // Validate parameters. - if( (OEMCUIP_DOCPROP != dwMode) - && - (OEMCUIP_PRNPROP != dwMode) - ) - { - ERR(ERRORTEXT("hrOEMPropertyPage() ERROR_INVALID_PARAMETER.\r\n")); - VERBOSE(DLLTEXT("\tdwMode = %d, pOEMUIParam = %#lx.\r\n"), dwMode, pOEMUIParam); - - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - switch(dwMode) - { - case OEMCUIP_DOCPROP: - hResult = hrDocumentPropertyPage(dwMode, pOEMUIParam); - break; - - case OEMCUIP_PRNPROP: - hResult = hrPrinterPropertyPage(dwMode, pOEMUIParam); - break; - - default: - // Should never reach this! - ERR(ERRORTEXT("hrOEMPropertyPage() Invalid dwMode, %d"), dwMode); - SetLastError(ERROR_INVALID_PARAMETER); - hResult = E_FAIL; - break; - } - - return hResult; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM document property UI. -// -static HRESULT hrDocumentPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - UNREFERENCED_PARAMETER(dwMode); - - if(NULL == pOEMUIParam->pOEMOptItems) - { - // Fill in the number of OptItems to create for OEM document property UI. - pOEMUIParam->cOEMOptItems = 1; - VERBOSE(DLLTEXT("hrDocumentPropertyPage() requesting %d number of items.\r\n"), pOEMUIParam->cOEMOptItems); - } - else - { - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - - - VERBOSE(DLLTEXT("hrDocumentPropertyPage() fill out %d items.\r\n"), pOEMUIParam->cOEMOptItems); - - // Init UI Callback reference. - pOEMUIParam->OEMCUIPCallback = OEMDocUICallBack; - - // Init OEMOptItmes. - InitOptItems(pOEMUIParam->pOEMOptItems, pOEMUIParam->cOEMOptItems); - - // Fill out tree view items. - - // New section. - pOEMUIParam->pOEMOptItems[0].Level = 1; - pOEMUIParam->pOEMOptItems[0].Flags = OPTIF_COLLAPSE; - pOEMUIParam->pOEMOptItems[0].pName = GetStringResource(pOEMUIParam->hOEMHeap, pOEMUIParam->hModule, IDS_ADV_SECTION); - pOEMUIParam->pOEMOptItems[0].Sel = pOEMDev->dwAdvancedData; - - pOEMUIParam->pOEMOptItems[0].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 2); - - // - //Setup the Optional Item - // - pOEMUIParam->pOEMOptItems[0].pOptType->Type = TVOT_UDARROW; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].IconID = 0; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].lParam = 100; - } - - return S_OK; -} - - - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM printer property UI. -// -static HRESULT hrPrinterPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - UNREFERENCED_PARAMETER(dwMode); - - // - //This is null the first time the interface is called. - // - if(NULL == pOEMUIParam->pOEMOptItems) - { - // Fill in the number of OptItems to create for OEM printer property UI. - pOEMUIParam->cOEMOptItems = 1; - VERBOSE(DLLTEXT("hrPrinterPropertyPage() requesting %d number of items.\r\n"), pOEMUIParam->cOEMOptItems); - } - else - { - // - //This is the second time we are called Now setup the optional items. - // - DWORD dwError; - DWORD dwDeviceValue; - DWORD dwType; - DWORD dwNeeded; - - VERBOSE(DLLTEXT("hrPrinterPropertyPage() fill out %d items.\r\n"), pOEMUIParam->cOEMOptItems); - - // - //Add OEM Optitem to the Device - // - - // Get device settings value from printer. - dwError = GetPrinterData(pOEMUIParam->hPrinter, OEMUI_VALUE, &dwType, (PBYTE) &dwDeviceValue, - sizeof(dwDeviceValue), &dwNeeded); - if( (ERROR_SUCCESS != dwError) - || - (dwDeviceValue > 100) - ) - { - // Failed to get the device value or value is invalid, just use the default. - dwDeviceValue = 0; - } - - // Init UI Callback reference. - pOEMUIParam->OEMCUIPCallback = OEMPrinterUICallBack; - - - // Init OEMOptItmes. - InitOptItems(pOEMUIParam->pOEMOptItems, pOEMUIParam->cOEMOptItems); - - // Fill out tree view items. - // New section. - pOEMUIParam->pOEMOptItems[0].Level = 1; - pOEMUIParam->pOEMOptItems[0].Flags = OPTIF_COLLAPSE; - pOEMUIParam->pOEMOptItems[0].pName = GetStringResource(pOEMUIParam->hOEMHeap, pOEMUIParam->hModule, IDS_DEV_SECTION); - pOEMUIParam->pOEMOptItems[0].Sel = dwDeviceValue; - - pOEMUIParam->pOEMOptItems[0].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 2); - - // - //Setup the Optional Item - // - pOEMUIParam->pOEMOptItems[0].pOptType->Type = TVOT_UDARROW; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].IconID = 0; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].lParam = 100; - - - } - return S_OK; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Adds property page to Document property sheet. Called via IOemUI::DocumentPropertySheets -// -HRESULT hrOEMDocumentPropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam, - IPrintOemDriverUI* pOEMHelp) -{ - LONG_PTR lResult = 0; - HRESULT hrResult = S_OK; - - VERBOSE(DLLTEXT("hrOEMDocumentPropertySheets() entry.\r\n")); - - UNREFERENCED_PARAMETER(pOEMHelp); - - // Validate parameters. - if( (NULL == pPSUIInfo) - || - (PROPSHEETUI_INFO_VERSION != pPSUIInfo->Version) - ) - { - ERR(ERRORTEXT("hrOEMDocumentPropertySheets() ERROR_INVALID_PARAMETER.\r\n")); - - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Do action. - switch(pPSUIInfo->Reason) - { - case PROPSHEETUI_REASON_INIT: - { - DWORD dwSheets = 0; - PCBUSERDATA pUserData; - POEMUIPSPARAM pOEMUIParam = (POEMUIPSPARAM) pPSUIInfo->lParamInit; - HANDLE hHeap = pOEMUIParam->hOEMHeap; - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - COMPROPSHEETUI Sheet; - - - // Init property page. - memset(&Sheet, 0, sizeof(COMPROPSHEETUI)); - Sheet.cbSize = sizeof(COMPROPSHEETUI); - Sheet.Flags = CPSUIF_UPDATE_PERMISSION; - Sheet.hInstCaller = ghInstance; - Sheet.pCallerName = GetStringResource(hHeap, ghInstance, IDS_NAME); - Sheet.pHelpFile = NULL; - Sheet.pfnCallBack = OEMDocUICallBack2; - Sheet.pDlgPage = CPSUI_PDLGPAGE_TREEVIEWONLY; - Sheet.cOptItem = 1; - Sheet.IconID = IDI_CPSUI_PRINTER; - Sheet.pOptItemName = GetStringResource(hHeap, ghInstance, IDS_SECTION); - Sheet.CallerVersion = 0x100; - Sheet.OptItemVersion = 0x100; - - // Init user data. - pUserData = (PCBUSERDATA) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(CBUSERDATA)); - if (NULL == pUserData) - { - ERR(ERRORTEXT("hrOEMDocumentPropertySheets() failed to allocate user data.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - pUserData->hComPropSheet = pPSUIInfo->hComPropSheet; - pUserData->pfnComPropSheet = pPSUIInfo->pfnComPropSheet; - pUserData->pOEMUIParam = pOEMUIParam; - Sheet.UserData = (ULONG_PTR) pUserData; - - // Create OptItems for page. - Sheet.pOptItem = CreateOptItems(hHeap, Sheet.cOptItem); - if (NULL == Sheet.pOptItem) - { - ERR(ERRORTEXT("hrOEMDocumentPropertySheets() failed to allocate OPTITEMs.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Initialize OptItems - Sheet.pOptItem[0].Level = 1; - Sheet.pOptItem[0].Flags = OPTIF_COLLAPSE; - Sheet.pOptItem[0].pName = GetStringResource(hHeap, ghInstance, IDS_SECTION); - Sheet.pOptItem[0].Sel = pOEMDev->dwDriverData; - - Sheet.pOptItem[0].pOptType = CreateOptType(hHeap, 2); - if (NULL == Sheet.pOptItem[0].pOptType) - { - ERR(ERRORTEXT("hrOEMDocumentPropertySheets() failed to allocate OPTTYPE.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // - //Set the UI prop of this OPTYPE item. - // - Sheet.pOptItem[0].pOptType->Type = TVOT_UDARROW; - Sheet.pOptItem[0].pOptType->pOptParam[1].IconID = 0; - Sheet.pOptItem[0].pOptType->pOptParam[1].lParam = 100; - - // Adds the property sheets. - lResult = pPSUIInfo->pfnComPropSheet(pPSUIInfo->hComPropSheet, CPSFUNC_ADD_PCOMPROPSHEETUI, - (LPARAM)&Sheet, (LPARAM)&dwSheets); - } - break; - - case PROPSHEETUI_REASON_GET_INFO_HEADER: - { - PPROPSHEETUI_INFO_HEADER pHeader = (PPROPSHEETUI_INFO_HEADER) lParam; - - pHeader->pTitle = (LPTSTR)PROP_TITLE; - lResult = TRUE; - } - break; - - case PROPSHEETUI_REASON_GET_ICON: - // No icon - lResult = 0; - break; - - case PROPSHEETUI_REASON_SET_RESULT: - { - PSETRESULT_INFO pInfo = (PSETRESULT_INFO) lParam; - - lResult = pInfo->Result; - } - break; - - case PROPSHEETUI_REASON_DESTROY: - lResult = TRUE; - break; - } - -Exit: - - pPSUIInfo->Result = lResult; - return hrResult; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Adds property page to printer property sheet. Called via IOemUI::DevicePropertySheets -// -HRESULT hrOEMDevicePropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam, POEMSHEETDATA pOemSheetData) -{ - LONG_PTR lResult = 0; - - - VERBOSE(DLLTEXT("hrOEMDevicePropertySheets(%#x, %#x) entry\r\n"), pPSUIInfo, lParam); - - // Validate parameters. - if( (NULL == pPSUIInfo) - - || - (PROPSHEETUI_INFO_VERSION != pPSUIInfo->Version) - ) - { - ERR(ERRORTEXT("hrOEMDevicePropertySheets() ERROR_INVALID_PARAMETER.\r\n")); - - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - Dump(pPSUIInfo); - - - // Do action. - switch(pPSUIInfo->Reason) - { - - case PROPSHEETUI_REASON_INIT: - { - PROPSHEETPAGE Page; - - // Init property page. - memset(&Page, 0, sizeof(PROPSHEETPAGE)); - Page.dwSize = sizeof(PROPSHEETPAGE); - Page.dwFlags = PSP_DEFAULT; - Page.hInstance = ghInstance; - Page.pszTemplate = MAKEINTRESOURCE(IDD_DEVICE_PROPPAGE); - Page.pfnDlgProc = DevicePropPageProc; - - // - //This is the OEMPlugIN Sheets Shared Data. Use this Pointer to gain access to shared driver data - // - pOemSheetData->hComPropSheet = pPSUIInfo->hComPropSheet; - pOemSheetData->pfnComPropSheet = pPSUIInfo->pfnComPropSheet; - Page.lParam = (LPARAM)pOemSheetData; - - // Add property sheets. - pOemSheetData->hmyPlugin = (HANDLE)(pPSUIInfo->pfnComPropSheet(pPSUIInfo->hComPropSheet, CPSFUNC_ADD_PROPSHEETPAGE, (LPARAM)&Page, 0)); - - VERBOSE(DLLTEXT("hrOEMDevicePropertySheets() pfnComPropSheet returned %d.\r\n"), pOemSheetData->hmyPlugin); - } - break; - - case PROPSHEETUI_REASON_GET_INFO_HEADER: - { - PPROPSHEETUI_INFO_HEADER pHeader = (PPROPSHEETUI_INFO_HEADER) lParam; - - pHeader->pTitle = (LPTSTR)PROP_TITLE; - lResult = TRUE; - } - break; - - case PROPSHEETUI_REASON_GET_ICON: - // No icon - lResult = 0; - break; - - case PROPSHEETUI_REASON_SET_RESULT: - { - PSETRESULT_INFO pInfo = (PSETRESULT_INFO) lParam; - - lResult = pInfo->Result; - } - break; - - case PROPSHEETUI_REASON_DESTROY: - lResult = TRUE; - break; - } - - pPSUIInfo->Result = lResult; - return S_OK; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// OptItems call back for OEM printer property UI. -// -LONG APIENTRY OEMPrinterUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - - VERBOSE(DLLTEXT("OEMPrinterUICallBack() entry, Reason is %d.\r\n"), pCallbackParam->Reason); - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - { - DWORD dwDriverValue = pOEMUIParam->pOEMOptItems[0].Sel; - - // - // Store OptItems state in printer data. - // - SetPrinterData(pOEMUIParam->hPrinter, OEMUI_VALUE, REG_DWORD, (PBYTE) &dwDriverValue, sizeof(DWORD)); - } - break; - - // - //Because the plugin page is changing items in this CPSUI page we need to rinitalise the data on the page. - // - case CPSUICB_REASON_SETACTIVE: - return CPSUICB_ACTION_OPTIF_CHANGED; - break; - - default: - break; - } - - return lReturn; -} - - - -//////////////////////////////////////////////////////////////////////////////// -// -// Call back for OEM device property UI. -// -// This OEM plugin page is using the OPTITEMS in the Device tab to store data. (Installabale Options) -// If you hide these option in the device tab and only access them from your UI you dont have to worry about sync the views. -// If you want the Options in both tabs you need to have a CPSUICALLBACK function defined for the Device tab. (OEMPrinterUICallBack) -// OEMPrinterUICallBack will return CPSUICB_ACTION_OPTIF_CHANGED; to indicate that some of the controls have change. Resulting in CPSUI to refresh the view. -// -INT_PTR CALLBACK DevicePropPageProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) -{ - - VERBOSE(DLLTEXT("DevicePropPageProc() entry, Reason is %d.\r\n"), uiMsg); - - POEMSHEETDATA pOEMSheetData = NULL; - LONG lState = 0; - DWORD fDataValid = 0; - WORD dlgControl = 0; - PSTR pControlName = NULL; - - - if ( uiMsg != WM_INITDIALOG ) - { - // - //Retrieves Application data storded by the call to SetWindowLongPtr. - // - pOEMSheetData = (POEMSHEETDATA)GetWindowLongPtr( hDlg, DWLP_USER); - - - if (!pOEMSheetData) - { - // - //Failed to get the OEM Prop Page Data Pointer. - // - ERR(ERRORTEXT("DevicePropPageProc : GetWindowLongPtr Failed (%d)\r\n"), GetLastError()); - return FALSE; - } - } - - switch (uiMsg) - { - case WM_INITDIALOG: - // - //PROPSHEETPAGE structure is passed to the dialog box procedure with a WM_INITDIALOG message. - //The lParam member is provided to allow you to pass application-specific information to the dialog box procedure - // - SetWindowLongPtr (hDlg, DWLP_USER, (LONG_PTR)((LPPROPSHEETPAGE)lParam)->lParam); - break; - - case WM_COMMAND: - switch(HIWORD(wParam)) - { - - case BN_CLICKED: - - // - //Change the UI to activate the apply button Send the prop dailog a change message. - // - PropSheet_Changed(GetParent(hDlg), hDlg); - - switch(LOWORD(wParam)) - { - - // - //USER modified OEM Controls on the plugin page. - // - case IDC_CHECK_DUPLPEX: - dlgControl = IDC_CHECK_DUPLPEX; - fDataValid = TRUE; - pControlName = (PSTR)DUPLEXUNIT; - break; - - case IDC_CHECK_HDRIVE: - dlgControl = IDC_CHECK_HDRIVE; - fDataValid = TRUE; - pControlName = (PSTR)PRINTERHDISK; - break; - - case IDC_CHECK_ENVFEEDER: - dlgControl = IDC_CHECK_ENVFEEDER; - fDataValid = TRUE; - pControlName = (PSTR)ENVFEEDER; - break; - - default: - fDataValid = 0; - break; - - } - - // - //If the Control is valid Get the ctrl state and UPdate the OPTITEM. - // - if ( fDataValid ) - { - lState = (LONG)(SendDlgItemMessage (hDlg, dlgControl, BM_GETSTATE, 0, 0) & 0x0003); - VERBOSE(DLLTEXT("DevicePropPageProc : Clicked dlgControl (%d)\r\n"), lState); - - // - //Saves the Data to the OPTITEMS in the device settings page. - // - SetOEMCommonDataIntoOptItem (pOEMSheetData, pControlName, lState); - } - break; - - - default: - return FALSE; - } - return TRUE; - - // - //Dailog is going to paint set up the UI controls to match the relavent OPTITEMS Data. - // - case WM_CTLCOLORDLG: - { - VERBOSE(DLLTEXT("DevicePropPageProc : WM_CTLCOLORDLG \r\n")); - SetOEMUiState (hDlg, pOEMSheetData); - } - return TRUE; - - - case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->code) // type of notification message - { - case PSN_SETACTIVE: - return TRUE; - break; - - case PSN_KILLACTIVE: - return TRUE; - break; - - case PSN_APPLY: - - // - //Calls ComPropSheet - //causes the ComPropSheet function to pass a specified result value to all PFNPROPSHEETUI-typed functions associated with a specified page and its parents - // - pOEMSheetData->pfnComPropSheet(pOEMSheetData->hComPropSheet, - CPSFUNC_SET_RESULT, - (LPARAM) pOEMSheetData->hmyPlugin, - (LPARAM)CPSUI_OK); - - // - //Accept the apply if the data was invalid and you are checking for this set PSNRET_INVALID | PSNRET_INVALID_NOCHANGEPAGE - //Disables the APPLY button and saves the Data. - // - PropSheet_UnChanged(GetParent(hDlg), hDlg); - SetWindowLongPtr(hDlg,DWLP_MSGRESULT,PSNRET_NOERROR); - return TRUE; - break; - - // - // Need To undo the changes - // - case PSN_RESET: - break; - } - } - break; - } - - return FALSE; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Update the OEM page controls to match the Device settings page -// - -void SetOEMUiState (HWND hDlg, POEMSHEETDATA pOEMSheetData) -{ - LRESULT lstate = 0; - POEMCUIPPARAM pOEMCUIParam = NULL; - PUSERDATA pUserData = NULL; - POPTITEM pOptItem = NULL; - DWORD cDrvOptItems = 0; - - - if (pOEMSheetData->pOEMCUIParam) - { - pOEMCUIParam = pOEMSheetData->pOEMCUIParam; - cDrvOptItems = pOEMCUIParam->cDrvOptItems; - } - - // - //loop down the OPITEMS and retrieve the data that is needed from the control - //(all Optitesm are ref from DMPubID of the UserData->pKeyWordName) - // - for (DWORD i=0; i < cDrvOptItems; i++) - { - pOptItem = &(pOEMCUIParam->pDrvOptItems[i]); - if (pOptItem->UserData) - { - pUserData = (PUSERDATA)(pOptItem->UserData); - if ( pUserData->pKeyWordName ) - { - // - //Get the Selection of the OPITEM - // - if (pOptItem->Sel) - { - lstate = BST_CHECKED; - } - else - { - lstate = BST_UNCHECKED; - } - - // - //Update the Data in OEM Page to mactch the data in the Device Settings TAB. - //Send a message to the Cntrol to update its State. - // - - //Set the Duplex Option - if ( strcmp(pUserData->pKeyWordName, DUPLEXUNIT ) == 0 ) - { - SendDlgItemMessage (hDlg, IDC_CHECK_DUPLPEX, BM_SETCHECK, lstate, 0); - } - - //Set HardDrive Option - if ( strcmp (pUserData->pKeyWordName, PRINTERHDISK ) == 0 ) - { - SendDlgItemMessage (hDlg, IDC_CHECK_HDRIVE, BM_SETCHECK, lstate, 0); - } - - //Set the Env Feeder Option - if ( strcmp (pUserData->pKeyWordName, ENVFEEDER ) == 0 ) - { - SendDlgItemMessage (hDlg, IDC_CHECK_ENVFEEDER, BM_SETCHECK, lstate, 0); - } - } - } - } -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Save the OEM change into the correct OPTITEM. -// The UI data is been stored in the driver supplied OPTITEM -// -void SetOEMCommonDataIntoOptItem (POEMSHEETDATA pOEMSheetData, _In_ PSTR PName, LONG Sel) -{ - - VERBOSE(DLLTEXT("SetOEMCommonDataIntoOptItem (%S) \r\n"), PName); - - POEMCUIPPARAM pOEMCUIParam = pOEMSheetData->pOEMCUIParam; - POPTITEM pOptItem = NULL; - - // - //Find the OPTITEM that needs to be Updated. - // - pOptItem = FindDrvOptItem (pOEMCUIParam->pDrvOptItems, - pOEMCUIParam->cDrvOptItems, - PName, - DMPUB_NONE); - - if (pOptItem) - { - ChangeOpItem (pOEMSheetData->pOEMHelp, - pOEMCUIParam->poemuiobj, - pOptItem, - Sel); - } - else - { - ERR(ERRORTEXT("SetOEMCommonDataIntoOptItem Item Not Found OPTITEM(%S) \r\n"), PName); - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Help Change the data set in the OPTITEM -// -void ChangeOpItem (IPrintOemDriverUI *pIPrintOEMDrvUI, POEMUIOBJ pOEMUIObj, POPTITEM pOptItem, int iSel) -{ - HRESULT hRestult = S_OK; - - // - //Change the Item (Change which OPTPARAM is selected fot the required OPTTYPE) - // - pOptItem->Sel = iSel; - - // - //Set the Flag indicating it is changed - // - pOptItem->Flags |= OPTIF_CHANGED; - - // - //Update the Driver UI. (this updates the UI but it does not cause CPSUI to update the its pages), - //Look at OEMPrinterUICallBack to see how CPSUI pages are updated - //The IPrintOemDriverUI::DrvUpdateUISetting method is provided by the - //Unidrv and Pscript5 minidrivers so that user interface plug-ins can - //notify the driver of a modified user interface option. - // - hRestult = pIPrintOEMDrvUI->DrvUpdateUISetting((PVOID)pOEMUIObj, (PVOID)pOptItem, 0, OEMCUIP_PRNPROP); - - if (hRestult != S_OK) - { - ERR(ERRORTEXT("ChangeOpItem DrvUpdateUISetting FAILED \r\n") ); - } - -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Help Find a OPTITEM from the array based on USERDATA->pKeyWordName or DMPubID -// -POPTITEM FindDrvOptItem (POPTITEM pDrvOptItems, DWORD dwItemCount, _In_ PSTR pKeyWordName, BYTE dmPubID ) -{ - VERBOSE(DLLTEXT("FindDrvOptItem Looking (%S) (%d) \r\n"), pKeyWordName, dmPubID); - - POPTITEM pOptItem = NULL; - PUSERDATA pUserData = NULL; - - for (DWORD i=0; i < dwItemCount; i++) - { - // - //OPTITEM has valid data compare these now (Search on DMPubID) - // - if (pKeyWordName == NULL) - { - if (dmPubID == pDrvOptItems[i].DMPubID) - { - pOptItem = &(pDrvOptItems[i]); - break; - } - } - else - { - // - //(Search a printer freature pKeyWordName) - // - //For Common Printer Features the key name is set to a common non localised string - //Note the these are only ansi strings ie PSTR - // - if (pDrvOptItems[i].UserData) - { - pUserData = (PUSERDATA)pDrvOptItems[i].UserData; - if (pUserData->pKeyWordName) - { - // - //OPTITEM has valid data compare these now - // - if ( strcmp (pUserData->pKeyWordName, pKeyWordName) == 0) - { - pOptItem = &(pDrvOptItems[i]); - break; - } - } - } - } - } - - if (!pOptItem) - { - ERR(ERRORTEXT("FindDrvOptItem OPTITEM NOT Found \r\n") ); - } - - return pOptItem; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// OptItems call back for OEM document property UI. -// -LONG APIENTRY OEMDocUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - - - VERBOSE(DLLTEXT("OEMDocUICallBack() entry, Reason is %d.\r\n"), pCallbackParam->Reason); - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - // Store OptItems state in DEVMODE. - pOEMDev->dwAdvancedData = pOEMUIParam->pOEMOptItems[0].Sel; - break; - - case CPSUICB_REASON_KILLACTIVE: - pOEMDev->dwAdvancedData = pOEMUIParam->pOEMOptItems[0].Sel; - break; - - // - //Refress the Data in the view and tell CPUSI that the data has changed by ret CPSUICB_ACTION_OPTIF_CHANGED - // - case CPSUICB_REASON_SETACTIVE: - if((DWORD)(pOEMUIParam->pOEMOptItems[0].Sel) != pOEMDev->dwAdvancedData) - { - pOEMUIParam->pOEMOptItems[0].Sel = pOEMDev->dwAdvancedData; - pOEMUIParam->pOEMOptItems[0].Flags |= OPTIF_CHANGED; - lReturn = CPSUICB_ACTION_OPTIF_CHANGED; - } - break; - - default: - break; - } - - return lReturn; -} - - -LONG APIENTRY OEMDocUICallBack2(PCPSUICBPARAM pCallbackParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - PCBUSERDATA pUserData = (PCBUSERDATA) pCallbackParam->UserData; - POEMDEV pOEMDev = (POEMDEV) pUserData->pOEMUIParam->pOEMDM; - - - VERBOSE(DLLTEXT("OEMDocUICallBack2() entry, Reason is %d.\r\n"), pCallbackParam->Reason); - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - pOEMDev->dwDriverData = pCallbackParam->pOptItem[0].Sel; - pUserData->pfnComPropSheet(pUserData->hComPropSheet, CPSFUNC_SET_RESULT, - (LPARAM)pUserData->hPropPage, - (LPARAM)CPSUI_OK); - break; - - case CPSUICB_REASON_KILLACTIVE: - pOEMDev->dwDriverData = pCallbackParam->pOptItem[0].Sel; - break; - - case CPSUICB_REASON_SETACTIVE: - if((DWORD)(pCallbackParam->pOptItem[0].Sel) != pOEMDev->dwDriverData) - { - pCallbackParam->pOptItem[0].Sel = pOEMDev->dwDriverData; - pCallbackParam->pOptItem[0].Flags |= OPTIF_CHANGED; - lReturn = CPSUICB_ACTION_OPTIF_CHANGED; - } - break; - - default: - break; - } - - return lReturn; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Creates and Initializes OptItems. -// -static POPTITEM CreateOptItems(HANDLE hHeap, DWORD dwOptItems) -{ - POPTITEM pOptItems = NULL; - SIZE_T sizeOfOptItems = 0; - - // Compute the size of memory needed for the OptItems: - if (SUCCEEDED(SIZETMult(sizeof(OPTITEM), (SIZE_T)dwOptItems, &sizeOfOptItems))) - { - // Allocate memory for OptItems; - pOptItems = (POPTITEM) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeOfOptItems); - if(NULL != pOptItems) - { - InitOptItems(pOptItems, dwOptItems); - } - else - { - ERR(ERRORTEXT("CreateOptItems() failed to allocate memory for OPTITEMs!\r\n")); - } - } - else - { - ERR(ERRORTEXT("CreateOptItems() failed to compute necessary memory size for OPTITEMs!\r\n")); - } - - return pOptItems; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems. -// -static void InitOptItems(POPTITEM pOptItems, DWORD dwOptItems) -{ - VERBOSE(DLLTEXT("InitOptItems() entry.\r\n")); - - // Zero out memory. - memset(pOptItems, 0, sizeof(OPTITEM) * dwOptItems); - - // Set each OptItem's size, and Public DM ID. - for(DWORD dwCount = 0; dwCount < dwOptItems; dwCount++) - { - pOptItems[dwCount].cbSize = sizeof(OPTITEM); - pOptItems[dwCount].DMPubID = DMPUB_NONE; - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Allocates and initializes OptType for OptItem. -// -static POPTTYPE CreateOptType(HANDLE hHeap, WORD wOptParams) -{ - POPTTYPE pOptType = NULL; - - - VERBOSE(DLLTEXT("CreateOptType() entry.\r\n")); - - // Allocate memory from the heap for the OPTTYPE; the driver will take care of clean up. - pOptType = (POPTTYPE) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(OPTTYPE)); - if(NULL != pOptType) - { - // Initialize OPTTYPE. - pOptType->cbSize = sizeof(OPTTYPE); - pOptType->Count = wOptParams; - - // Allocate memory from the heap for the OPTPARAMs for the OPTTYPE. - pOptType->pOptParam = (POPTPARAM) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, wOptParams * sizeof(OPTPARAM)); - if(NULL != pOptType->pOptParam) - { - // Initialize the OPTPARAMs. - for(WORD wCount = 0; wCount < wOptParams; wCount++) - { - pOptType->pOptParam[wCount].cbSize = sizeof(OPTPARAM); - } - } - else - { - ERR(ERRORTEXT("CreateOptType() failed to allocated memory for OPTPARAMs!\r\n")); - - // Free allocated memory and return NULL. - HeapFree(hHeap, 0, pOptType); - pOptType = NULL; - } - } - else - { - ERR(ERRORTEXT("CreateOptType() failed to allocated memory for OPTTYPE!\r\n")); - } - - return pOptType; -} - -//////////////////////////////////////////////////////////////////////////////////// -// -// Retrieves pointer to a String resource. -// -static PTSTR GetStringResource(HANDLE hHeap, HANDLE hModule, UINT uResource) -{ - int nResult; - DWORD dwSize = MAX_PATH; - PTSTR pszString = NULL; - - - VERBOSE(DLLTEXT("GetStringResource(%#x, %#x, %d) entered.\r\n"), hHeap, hModule, uResource); - - // Allocate buffer for string resource from heap; let the driver clean it up. - pszString = (PTSTR) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, dwSize * sizeof(TCHAR)); - if(NULL != pszString) - { - // Load string resource; resize after loading so as not to waste memory. - nResult = LoadString((HMODULE)hModule, uResource, pszString, dwSize); - if(nResult > 0) - { - PTSTR pszTemp; - - - VERBOSE(DLLTEXT("LoadString() returned %d!\r\n"), nResult); - VERBOSE(DLLTEXT("String load was \"%s\".\r\n"), pszString); - - pszTemp = (PTSTR) HeapReAlloc(hHeap, HEAP_ZERO_MEMORY, pszString, (nResult + 1) * sizeof(TCHAR)); - if(NULL != pszTemp) - { - pszString = pszTemp; - } - else - { - ERR(ERRORTEXT("GetStringResource() HeapReAlloc() of string retrieved failed! (Last Error was %d)\r\n"), GetLastError()); - } - } - else - { - ERR(ERRORTEXT("LoadString() returned %d! (Last Error was %d)\r\n"), nResult, GetLastError()); - ERR(ERRORTEXT("GetStringResource() failed to load string resource %d!\r\n"), uResource); - - pszString = NULL; - } - } - else - { - ERR(ERRORTEXT("GetStringResource() failed to allocate string buffer!\r\n")); - } - - return pszString; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oemui.h b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oemui.h deleted file mode 100644 index 1c07802f..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oemui.h +++ /dev/null @@ -1,74 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: OEMUI.H -// -// -// PURPOSE: Define common data types, and external function prototypes -// for OEMUI Test Module. -// -// -#pragma once - -#include "OEM.H" -#include "DEVMODE.H" -#include "globals.h" - -//////////////////////////////////////////////////////// -// OEM UI Defines -//////////////////////////////////////////////////////// - - -// OEM Signature and version. -#define PROP_TITLE L"OEM UI Page" -#define DLLTEXT(s) __TEXT("UI: ") __TEXT(s) - -// OEM UI Misc defines. -#define ERRORTEXT(s) __TEXT("ERROR ") DLLTEXT(s) - - -// Printer registry keys where OEM data is stored. -#define OEMUI_VALUE TEXT("OEMUI_VALUE") -#define OEMUI_DEVICE_VALUE TEXT("OEMUI_DEVICE_VALUE") - -// -//KeyWordNames for OPTITEMS (These are nonlocalised keywords assocaited with driver features. in the OPTITEMS) -// -const char DUPLEXUNIT[] = "DuplexUnit"; -const char ENVFEEDER[] = "EnvFeeder"; -const char PRINTERHDISK[] = "PrinterHardDisk"; - -// -//This structure is used to link the common pages and the OEM plugin page. -// -typedef struct _OEMSHEETDATA { - - // - //Any other OEM Data you may want to store. - // - - - // - //Hold Pointers you may need. - // - HANDLE hComPropSheet; //Handle to the Prop Sheet Parent Page Used when calling ComPropSheet - HANDLE hmyPlugin; //Handle to the OEM Plugin page. Page Used when calling ComPropSheet - PFNCOMPROPSHEET pfnComPropSheet; //Is the Pointer to ComPropSheet This is needed when APPLY is clicked (CPSFUNC_SET_RESULT) - - POEMCUIPPARAM pOEMCUIParam; //Holds links to the DEVMODE and OPTITEMS needed. - IPrintOemDriverUI* pOEMHelp; - -} OEMSHEETDATA, *POEMSHEETDATA; - -//////////////////////////////////////////////////////// -// Prototypes -//////////////////////////////////////////////////////// - -HRESULT hrOEMPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -HRESULT hrOEMDocumentPropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam, IPrintOemDriverUI* pOEMHelp); -HRESULT hrOEMDevicePropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam, POEMSHEETDATA pOemSheetData); - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oemui.rc b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oemui.rc deleted file mode 100644 index e87badbe..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/oemui.rc +++ /dev/null @@ -1,175 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Written by Windows Printing & Imaging Team" - VALUE "CompanyName", "Microsoft Corp." - VALUE "FileDescription", "OEM UI Test Module." - VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "OEMUI" - VALUE "LegalCopyright", "Copyright 1998 - 2003 Microsoft Corp." - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation" - VALUE "OriginalFilename", "OEMUI.dll" - VALUE "ProductName", "Microsoft OEMUI" - VALUE "ProductVersion", "1.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_DEVICE_PROPPAGE DIALOG 0, 0, 179, 113 -STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Device Property Page" -FONT 8, "MS Shell Dialog" -BEGIN - GROUPBOX "Oem Install Options",IDC_STATIC,15,29,81,59 - LTEXT "OEM UI Controls",IDC_STATIC,55,14,68,11,WS_TABSTOP - CONTROL "Duplex Unit",IDC_CHECK_DUPLPEX,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,20,42,54,10 - CONTROL "Printer Hard Drive",IDC_CHECK_HDRIVE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,20,67,75,10 - CONTROL "Envelope Feeder",IDC_CHECK_ENVFEEDER,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,20,54,71,10 -END - -IDD_DOC_PROPPAGE DIALOG 0, 0, 210, 154 -STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Document Property Page" -FONT 8, "MS Shell Dialog" -BEGIN - LTEXT "OEM UI Document Property Page",IDC_STATIC,60,73,108,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_DEVICE_PROPPAGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 170 - TOPMARGIN, 8 - BOTTOMMARGIN, 106 - END - - IDD_DOC_PROPPAGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 147 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_SECTION "OEM UI Added Item" - IDS_CALIBRATED "Printer has been calibrated." - IDS_NAME "OEM UI Customization DLL" - IDS_DEV_SECTION "Device Settings OEM UI Added Item" - IDS_ADV_SECTION "Advanced OEM UI Added Item" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/precomp.h deleted file mode 100644 index 2d502998..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/precomp.h +++ /dev/null @@ -1,53 +0,0 @@ -// -// -// PURPOSE: Header files that should be in the precompiled header. -// -// - -#pragma once - - -// Necessary for compiling under VC. -#if(!defined(WINVER) || (WINVER < 0x0500)) - #undef WINVER - #define WINVER 0x0500 -#endif -#if(!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)) - #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0500 -#endif - - -// Required header files that shouldn't change often. - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Safe integer functions to detect integer overflow/underflow conditions: -#include - -// Include this last to disallow -// unsafe string functions -#include - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/resource.h b/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/resource.h deleted file mode 100644 index aacf0218..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/SyncSet/resource.h +++ /dev/null @@ -1,28 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by oemui.rc -// -#define IDS_SECTION 1 -#define IDS_CALIBRATED 2 -#define IDS_NAME 3 -#define IDS_HELPFILE 4 -#define IDS_DEV_SECTION 5 -#define IDS_ADV_SECTION 10 -#define IDD_DEVICE_PROPPAGE 106 -#define IDD_DOC_PROPPAGE 107 -#define IDC_CALIBRATE 1001 -#define IDC_RADIO3 1004 -#define IDC_CHECK_DUPLPEX 1008 -#define IDC_CHECK_HDRIVE 1009 -#define IDC_CHECK_ENVFEEDER 1010 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1011 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/OEMUI.rc b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/OEMUI.rc deleted file mode 100644 index a6491905..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/OEMUI.rc +++ /dev/null @@ -1,169 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Written by Windows Printing & Imaging Team" - VALUE "CompanyName", "Microsoft Corp." - VALUE "FileDescription", "OEM UI Test Module." - VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "OEMUI" - VALUE "LegalCopyright", "Copyright 1998 - 2003 Microsoft Corp." - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation" - VALUE "OriginalFilename", "OEMUI.dll" - VALUE "ProductName", "Microsoft OEMUI" - VALUE "ProductVersion", "1.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_DEVICE_PROPPAGE DIALOG 0, 0, 179, 113 -STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Device Property Page" -FONT 8, "MS Shell Dialog" -BEGIN - LTEXT "OEM UI Added Page",IDC_STATIC,55,14,68,11 - PUSHBUTTON "Calibrate",IDC_CALIBRATE,61,34,50,14 -END - -IDD_DOC_PROPPAGE DIALOG 0, 0, 210, 154 -STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Document Property Page" -FONT 8, "MS Shell Dialog" -BEGIN - LTEXT "OEM UI Document Property Page",IDC_STATIC,60,73,108,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_DEVICE_PROPPAGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 172 - TOPMARGIN, 8 - BOTTOMMARGIN, 106 - END - - IDD_DOC_PROPPAGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 147 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_SECTION "OEM UI Added Item" - IDS_CALIBRATED "Printer has been calibrated." - IDS_NAME "OEM UI Customization DLL" - IDS_DEV_SECTION "Device Settings OEM UI Added Item" - IDS_ADV_SECTION "Advanced OEM UI Added Item" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/ThemeUI.Manifest b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/ThemeUI.Manifest deleted file mode 100644 index bb48af65..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/ThemeUI.Manifest +++ /dev/null @@ -1,22 +0,0 @@ - - - -Your app description here - - - - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/ThemeUISmpl.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/ThemeUISmpl.vcxproj deleted file mode 100644 index 4abfd7bb..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/ThemeUISmpl.vcxproj +++ /dev/null @@ -1,1120 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {EA206DEA-26E6-4FD4-BF68-23F222C5E211} - $(MSBuildProjectName) - Win10 Debug - Win32 - {7ABB810D-F51B-46DA-8A6C-6883AF316932} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - ThemeUISmpl - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - - %(AdditionalOptions) -ignore:4049,4217 - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE;ISOLATION_AWARE_ENABLED - %(PreprocessorDefinitions);MANIFEST_RESOURCE=2 - - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ThemeUISmpl.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/ThemeUISmpl.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/ThemeUISmpl.vcxproj.Filters deleted file mode 100644 index d8206354..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/ThemeUISmpl.vcxproj.Filters +++ /dev/null @@ -1,327 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {18CF118F-704E-4B55-9621-B0D2F73CBFBE} - - - h;hpp;hxx;hm;inl;inc;xsd - {44047F2E-3DA5-4847-BAE3-6573B04506AF} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {695ECF76-7AFF-4B2D-A4E5-2138B4CC5B5A} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/debug.h b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/debug.h deleted file mode 100644 index 0414569c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/debug.h +++ /dev/null @@ -1,82 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.H -// -// PURPOSE: Define common data types, and external function prototypes -// for debugging functions. Also defines the various debug macros. -// -// - -#pragma once - -///////////////////////////////////////////////////////// -// Macros -///////////////////////////////////////////////////////// -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// WARNING("App passed NULL pointer, ignoring...\n"); -// - -#define DBG_VERBOSE 0 -#define DBG_WARNING 1 -#define DBG_ERROR 2 -#define DBG_NONE 3 - -// VC and Build use different debug defines. -#if defined (DBG) || defined (_DEBUG) - - // __declspec(selectany) ensures that even if this is defined in multiple compilation - // modules, they will all resolve to the same symbol in the linked DLL - __declspec(selectany) INT giDebugLevel = 2; - - #define STRINGIZE(x) #x - #define QUOTE(x) STRINGIZE(x) - #define FILE_AND_LINE __FILE__ "@" QUOTE(__LINE__) - - #define VERBOSE(msg) { if(giDebugLevel <= DBG_VERBOSE) OutputDebugStringA( FILE_AND_LINE ": " msg); } - #define WARNING(msg) { if(giDebugLevel <= DBG_WARNING) OutputDebugStringA( FILE_AND_LINE ": Warning: " msg); } - #define ERR(msg) { if(giDebugLevel <= DBG_ERROR) OutputDebugStringA(FILE_AND_LINE ": Error:" msg); } - #define ASSERT(cond) { if (!(cond)) RIP("\n"); } - #define RIP(msg) { OutputDebugStringA(FILE_AND_LINE ": Error (not recoverable): " msg); DebugBreak(); } - -#else // !DBG - - #define VERBOSE(msg) - #define WARNING(msg) - #define ERR(msg) - #define ASSERT(cond) - #define RIP(msg) - -#endif - - - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/devmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/devmode.cpp deleted file mode 100644 index 15234361..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/devmode.cpp +++ /dev/null @@ -1,187 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.cpp -// -// -// PURPOSE: Implementation of Devmode functions shared with OEM UI and OEM rendering modules. -// - - -#include "precomp.h" -#include "oemui.h" -#include "debug.h" -#include "devmode.h" - - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -// -//Performs operation on UI Plugins Private DevMode Members. -//Called via IOemUI::DevMode -// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam) -{ - POEMDEV pOEMDevIn; - POEMDEV pOEMDevOut; - - - // Verify parameters. - if( (NULL == pOemDMParam) - || - ( (OEMDM_SIZE != dwMode) - && - (OEMDM_DEFAULT != dwMode) - && - (OEMDM_CONVERT != dwMode) - && - (OEMDM_MERGE != dwMode) - ) - ) - { - ERR(DLLTEXT("DevMode() ERROR_INVALID_PARAMETER.\r\n")); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Cast generic (i.e. PVOID) to OEM private devomode pointer type. - pOEMDevIn = (POEMDEV) pOemDMParam->pOEMDMIn; - pOEMDevOut = (POEMDEV) pOemDMParam->pOEMDMOut; - - switch(dwMode) - { - // - //The Method should return the size of the memory allocation needed to store the UI plugin Private DEVMODE. - // - case OEMDM_SIZE: - pOemDMParam->cbBufSize = sizeof(OEMDEV); - break; - - // - //Should fill the Private DEVMODE with the default values. - // - case OEMDM_DEFAULT: - // - //OEM_DMEXTRAHEADER Members - // - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - - // - //Private members - // - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - - VERBOSE(DLLTEXT("pOEMDevOut after setting default values:\r\n")); - break; - - // - //The method should convert private DEVMODE members to the current version, if necessary. - // - case OEMDM_CONVERT: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - break; - - // - //The method should validate the information contained in private DEVMODE members and merge validated values into a private DEVMODE structure containing default values - // - case OEMDM_MERGE: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - MakeOEMDevmodeValid(pOEMDevOut); - break; - } - - return S_OK; -} - - -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut) -{ - if( (NULL == pOEMDevIn) - || - (NULL == pOEMDevOut) - ) - { - ERR(DLLTEXT("ConvertOEMDevmode() invalid parameters.\r\n")); - return FALSE; - } - - // Check OEM Signature, if it doesn't match ours, - // then just assume DMIn is bad and use defaults. - if(pOEMDevIn->dmOEMExtra.dwSignature == pOEMDevOut->dmOEMExtra.dwSignature) - { - VERBOSE(DLLTEXT("Converting private OEM Devmode.\r\n")); - VERBOSE(DLLTEXT("pOEMDevIn:\r\n")); - - // Set the devmode defaults so that anything the isn't copied over will - // be set to the default value. - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - - // Copy the old structure in to the new using which ever size is the smaller. - // Devmode maybe from newer Devmode (not likely since there is only one), or - // Devmode maybe a newer Devmode, in which case it maybe larger, - // but the first part of the structure should be the same. - - // DESIGN ASSUMPTION: the private DEVMODE structure only gets added to; - // the fields that are in the DEVMODE never change only new fields get added to the end. - - memcpy(pOEMDevOut, pOEMDevIn, __min(pOEMDevOut->dmOEMExtra.dwSize, pOEMDevIn->dmOEMExtra.dwSize)); - - // Re-fill in the size and version fields to indicated - // that the DEVMODE is the current private DEVMODE version. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - } - else - { - WARNING(DLLTEXT("Unknown DEVMODE signature, pOEMDMIn ignored.\r\n")); - - // Don't know what the input DEVMODE is, so just use defaults. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - } - - return TRUE; -} - - -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode) -{ - if(NULL == pOEMDevmode) - { - return FALSE; - } - - // ASSUMPTION: pOEMDevmode is large enough to contain OEMDEV structure. - - // Make sure that dmOEMExtra indicates the current OEMDEV structure. - pOEMDevmode->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevmode->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevmode->dmOEMExtra.dwVersion = OEM_VERSION; - - // Set driver data, if not valid. - if(pOEMDevmode->dwDriverData > 100) - { - pOEMDevmode->dwDriverData = 0; - } - - // Set Advanced driver data, if not valid. - if(pOEMDevmode->dwAdvancedData > 100) - { - pOEMDevmode->dwAdvancedData = 0; - } - - return TRUE; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/devmode.h b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/devmode.h deleted file mode 100644 index b55fb016..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/devmode.h +++ /dev/null @@ -1,55 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.h -// -// -// PURPOSE: Define common data types, and external function prototypes -// for devmode functions. -// -#pragma once - -//////////////////////////////////////////////////////// -// OEM Devmode Defines -//////////////////////////////////////////////////////// - - - - -//////////////////////////////////////////////////////// -// OEM Devmode Type Definitions -//////////////////////////////////////////////////////// - -// -//Can add info to the private devmode bellow here. -//Note : -// This structure must be prefixed by OEM_DMEXTRAHEADER -// Your plug-in must implement the IPrintOemUI::DevMode method -// -typedef struct tagOEMDEV -{ - OEM_DMEXTRAHEADER dmOEMExtra; - DWORD dwDriverData; - DWORD dwAdvancedData; - - // - //Private DevMode Members - // - -} OEMDEV, *POEMDEV; - -typedef const OEMDEV *PCOEMDEV; - - - -///////////////////////////////////////////////////////// -// ProtoTypes -///////////////////////////////////////////////////////// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam); -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut); -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode); diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/dllentry.cpp b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/dllentry.cpp deleted file mode 100644 index a7c846b7..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/dllentry.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cpp -// -// -// PURPOSE: Source module for DLL entry function(s). -// - -#include "precomp.h" -#include "oemui.h" -#include "fusutils.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////////////////////////// -// -// DLL entry point -// -BOOL WINAPI DllMain(HINSTANCE hInst, WORD wReason, LPVOID lpReserved) -{ - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - VERBOSE(DLLTEXT("Process attach.\r\n")); - - // Store the module handle in case we need it later. - ghInstance = hInst; - - // NOTE: We don't create an Activation Context on module load, - // but on need of an Avtivation Context; the first time - // GetMyActivationContext() or CreateMyActivationContext() is called. - break; - - case DLL_THREAD_ATTACH: - VERBOSE(DLLTEXT("Thread attach.\r\n")); - break; - - case DLL_PROCESS_DETACH: - VERBOSE(DLLTEXT("Process detach.\r\n")); - - // Release the Activation Context if we created one somewhere - // by calling GetMyActivationContext() or CreateMyActivationContext(); - if(INVALID_HANDLE_VALUE != ghActCtx) - { - ReleaseActCtx(ghActCtx); - ghActCtx = INVALID_HANDLE_VALUE; - } - break; - - case DLL_THREAD_DETACH: - VERBOSE(DLLTEXT("Thread detach.\r\n")); - break; - } - - return TRUE; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/fusutils.cpp b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/fusutils.cpp deleted file mode 100644 index 0f9bf2c3..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/fusutils.cpp +++ /dev/null @@ -1,118 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: fsutils.h -// -// -// PURPOSE: Fusion utilities -// - -#include "precomp.h" -#include "globals.h" -#include "fusutils.h" - -#define MAX_LOOP 10 - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -HANDLE GetMyActivationContext() -{ - // Make sure we've created our activation context. - CreateMyActivationContext(); - - // Return the global. - return ghActCtx; -} - - -BOOL CreateMyActivationContext() -{ - if(INVALID_HANDLE_VALUE != ghActCtx) - { - return TRUE; - } - - ghActCtx = CreateActivationContextFromResource(ghInstance, MAKEINTRESOURCE(MANIFEST_RESOURCE)); - - return (INVALID_HANDLE_VALUE != ghActCtx); -} - - - -HANDLE CreateActivationContextFromResource(HMODULE hModule, LPCTSTR pszResourceName) -{ - DWORD dwSize = MAX_PATH; - DWORD dwUsed = 0; - DWORD dwLoop; - PTSTR pszModuleName = NULL; - ACTCTX act; - HANDLE hActCtx = INVALID_HANDLE_VALUE; - - - // Get the name for the module that contains the manifest resource - // to create the Activation Context from. - dwLoop = 0; - do - { - // May need to allocate or re-alloc buffer for module name. - if(NULL != pszModuleName) - { - // Need to re-alloc bigger buffer. - - // First, delete old buffer. - delete[] pszModuleName; - - // Second, increase buffer alloc size. - dwSize <<= 1; - } - pszModuleName = new TCHAR[dwSize]; - if(NULL == pszModuleName) - { - goto Exit; - } - - // Try to get the module name. - dwUsed = GetModuleFileName(hModule, pszModuleName, dwSize); - - // Check to see if it failed. - if(0 == dwUsed) - { - goto Exit; - } - - // If dwUsed is equla to dwSize or larger, - // the buffer passed in wasn't big enough. - } while ( (dwUsed >= dwSize) && (++dwLoop < MAX_LOOP) ); - - // Now let's try to create an activation context - // from manifest resource. - ::ZeroMemory(&act, sizeof(act)); - act.cbSize = sizeof(act); - act.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID; - act.lpResourceName = pszResourceName; - act.lpSource = pszModuleName; - - hActCtx = CreateActCtx(&act); - - -Exit: - - // - // Clean up. - // - - if(NULL != pszModuleName) - { - delete[] pszModuleName; - } - - return hActCtx; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/fusutils.h b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/fusutils.h deleted file mode 100644 index 2f79c522..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/fusutils.h +++ /dev/null @@ -1,18 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: fsutils.h -// -// -// PURPOSE: Fusion utilities -// -#pragma once - -HANDLE GetMyActivationContext(); -BOOL CreateMyActivationContext(); -HANDLE CreateActivationContextFromResource(HMODULE hModule, LPCTSTR pszResourceName); - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/globals.cpp b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/globals.cpp deleted file mode 100644 index d2af1b8b..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/globals.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Globals.cpp -// -// -// PURPOSE: File that contains all the globals. -// - -#include "precomp.h" -#include "globals.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - - -// Module's Instance handle from DLLEntry of process. -HINSTANCE ghInstance = NULL; - -// Module's Activation Context from DLLEntry of process. -HANDLE ghActCtx = INVALID_HANDLE_VALUE; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/globals.h b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/globals.h deleted file mode 100644 index a5a58cb8..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/globals.h +++ /dev/null @@ -1,21 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Globals.h -// -// -// PURPOSE: Lists of globals declared in Globals.cpp. -// -#pragma once - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -extern HINSTANCE ghInstance; // Module's Instance handle from DLLEntry of process. -extern HANDLE ghActCtx; // Module's Activation Context from DLLEntry of process. - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/intrface.cpp deleted file mode 100644 index 3b966a58..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/intrface.cpp +++ /dev/null @@ -1,575 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.cpp -// -// -// PURPOSE: Implementation of interface for PScript4, PScript5, Unidrv4, -// Unidrv5 UI plug-ins. -// - -#include "precomp.h" - -#include "oemui.h" -#include "debug.h" -#include "intrface.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -//////////////////////////////////////////////////////// -// Internal Globals -//////////////////////////////////////////////////////// - -static long g_cComponents = 0 ; // Count of active components -static long g_cServerLocks = 0 ; // Count of locks - - - -//////////////////////////////////////////////////////////////////////////////// -// -// IOemUI body -// -IOemUI::~IOemUI() -{ - // Make sure that helper interface is released. - if(NULL != m_pOEMHelp) - { - m_pOEMHelp->Release(); - m_pOEMHelp = NULL; - } - - // If this instance of the object is being deleted, then the reference - // count should be zero. - assert(0 == m_cRef); -} - -HRESULT __stdcall IOemUI::QueryInterface(const IID& iid, void** ppv) -{ - VERBOSE(DLLTEXT("IOemUI:QueryInterface entry.\r\n\r\n")); - if (iid == IID_IUnknown) - { - *ppv = static_cast(this); - VERBOSE(DLLTEXT("IOemUI:Return pointer to IUnknown.\r\n\r\n")); - } - else if (iid == IID_IPrintOemUI) - { - *ppv = static_cast(this) ; - VERBOSE(DLLTEXT("IOemUI:Return pointer to IPrintOemUI.\r\n")); - } - else - { - VERBOSE(DLLTEXT("IOemUI::QueryInterface interface not supported.\r\n")); - *ppv = NULL ; - return E_NOINTERFACE ; - } - reinterpret_cast(*ppv)->AddRef() ; - return S_OK ; -} - -ULONG __stdcall IOemUI::AddRef() -{ - VERBOSE(DLLTEXT("IOemUI:AddRef entry.\r\n")); - return InterlockedIncrement(&m_cRef) ; -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemUI::Release() -{ - VERBOSE(DLLTEXT("IOemUI:Release entry.\r\n")); - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -HRESULT __stdcall IOemUI::PublishDriverInterface( - IUnknown *pIUnknown) -{ - VERBOSE(DLLTEXT("IOemUI:PublishDriverInterface entry.\r\n")); - - // Need to store pointer to Driver Helper functions, if we already haven't. - if (m_pOEMHelp == NULL) - { - HRESULT hResult; - - - // Get Interface to Helper Functions. - hResult = pIUnknown->QueryInterface(IID_IPrintOemDriverUI, (void** ) &(m_pOEMHelp)); - - if(!SUCCEEDED(hResult)) - { - // Make sure that interface pointer reflects interface query failure. - m_pOEMHelp = NULL; - - return E_FAIL; - } - } - - return S_OK; -} - -HRESULT __stdcall IOemUI::GetInfo( - DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded) -{ - VERBOSE(DLLTEXT("IOemUI::GetInfo entry.\r\r\n")); - - // Validate parameters. - if( (NULL == pcbNeeded) - || - ( (OEMGI_GETSIGNATURE != dwMode) - && - (OEMGI_GETVERSION != dwMode) - && - (OEMGI_GETPUBLISHERINFO != dwMode) - ) - ) - { - WARNING(DLLTEXT("IOemUI::GetInfo() exit pcbNeeded is NULL! ERROR_INVALID_PARAMETER\r\r\n")); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Set expected buffer size and number of bytes written. - *pcbNeeded = sizeof(DWORD); - - // Check buffer size is sufficient. - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - WARNING(DLLTEXT("IOemUI::GetInfo() exit insufficient buffer!\r\r\n")); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return E_FAIL; - } - - switch(dwMode) - { - // OEM DLL Signature - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // OEM DLL version - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // dwMode not supported. - default: - // Set written bytes to zero since nothing was written. - WARNING(DLLTEXT("IOemUI::GetInfo() exit mode not supported.\r\r\n")); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - return E_FAIL; - } - - VERBOSE(DLLTEXT("IOemUI::GetInfo() exit S_OK.\r\r\n")); - return S_OK; -} - -HRESULT __stdcall IOemUI::DevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam) -{ - VERBOSE(DLLTEXT("IOemUI:DevMode entry.\r\n")); - - return hrOEMDevMode(dwMode, pOemDMParam); -} - -HRESULT __stdcall IOemUI::CommonUIProp( - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam) -{ - VERBOSE(DLLTEXT("IOemUI:CommonUIProp entry.\r\n")); - - return hrOEMPropertyPage(dwMode, pOemCUIPParam); -} - - -HRESULT __stdcall IOemUI::DocumentPropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI:DocumentPropertySheets entry.\r\n")); - - return hrOEMDocumentPropertySheets(pPSUIInfo, lParam, m_pOEMHelp); -} - -HRESULT __stdcall IOemUI::DevicePropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI:DevicePropertySheets entry.\r\n")); - - return hrOEMDevicePropertySheets(pPSUIInfo, lParam); -} - -HRESULT __stdcall IOemUI::DeviceCapabilities( - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult) -{ - VERBOSE(DLLTEXT("IOemUI:DeviceCapabilities entry.\r\n")); - - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(pDeviceName); - UNREFERENCED_PARAMETER(wCapability); - UNREFERENCED_PARAMETER(pOutput); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - UNREFERENCED_PARAMETER(dwOld); - UNREFERENCED_PARAMETER(dwResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::DevQueryPrintEx( - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM) -{ - VERBOSE(DLLTEXT("IOemUI:DevQueryPrintEx entry.\r\n")); - - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pDQPInfo); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::UpgradePrinter( - DWORD dwLevel, - PBYTE pDriverUpgradeInfo) -{ - VERBOSE(DLLTEXT("IOemUI:UpgradePrinter entry.\r\n")); - - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverUpgradeInfo); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::PrinterEvent( - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI:PrinterEvent entry.\r\n")); - - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(iDriverEvent); - UNREFERENCED_PARAMETER(dwFlags); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::DriverEvent( - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI:DriverEvent entry.\r\n")); - - UNREFERENCED_PARAMETER(dwDriverEvent); - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - - -#define PROFILE_NAME L"OEMPROFILE.icm\0" - -HRESULT __stdcall IOemUI::QueryColorProfile( - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulQueryMode, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData) -{ - HRESULT Result = E_FAIL; - - - VERBOSE(DLLTEXT("IOemUI:QueryColorProfile entry.\r\n")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - - if(QCP_DEVICEPROFILE == ulQueryMode) - { - if(NULL == pvProfileData) - { - *pcbProfileData = sizeof(PROFILE_NAME); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - } - else - { - if(*pcbProfileData < sizeof(PROFILE_NAME)) - { - *pcbProfileData = sizeof(PROFILE_NAME); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - } - else - { - Result = StringCbCopy((LPWSTR)pvProfileData, *pcbProfileData, PROFILE_NAME); - *pcbProfileData = sizeof(PROFILE_NAME); - *pflProfileData = QCP_PROFILEDISK; - - if(FAILED(Result)) - { - SetLastError(Result); - } - } - } - } - - return Result; -}; - -HRESULT __stdcall IOemUI::FontInstallerDlgProc( - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IOemUI:FontInstallerDlgProc entry.\r\n")); - - UNREFERENCED_PARAMETER(hWnd); - UNREFERENCED_PARAMETER(usMsg); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - -HRESULT __stdcall IOemUI::UpdateExternalFonts( - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges) -{ - VERBOSE(DLLTEXT("IOemUI:UpdateExternalFonts entry.\r\n")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(hHeap); - UNREFERENCED_PARAMETER(pwstrCartridges); - - return E_NOTIMPL; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// oem class factory -// -class IOemCF : public IClassFactory -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // *** IClassFactory methods *** - STDMETHOD(CreateInstance) (THIS_ - LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID FAR* ppvObject); - STDMETHOD(LockServer) (THIS_ BOOL bLock); - - - // Constructor - IOemCF(): m_cRef(1) { }; - ~IOemCF() { }; - -protected: - LONG m_cRef; - -}; - -/////////////////////////////////////////////////////////// -// -// Class factory body -// -HRESULT __stdcall IOemCF::QueryInterface(const IID& iid, void** ppv) -{ - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this) ; - } - else - { - WARNING(DLLTEXT("IOemCF::QueryInterface interface not supported.\r\n")); - *ppv = NULL ; - return E_NOINTERFACE ; - } - reinterpret_cast(*ppv)->AddRef() ; - return S_OK ; -} - -ULONG __stdcall IOemCF::AddRef() -{ - return InterlockedIncrement(&m_cRef) ; -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemCF::Release() -{ - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -// IClassFactory implementation -HRESULT __stdcall IOemCF::CreateInstance(IUnknown* pUnknownOuter, - const IID& iid, - void** ppv) -{ - //DbgPrint(DLLTEXT("Class factory:\t\tCreate component.")) ; - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Cannot aggregate. - if (pUnknownOuter != NULL) - { - return CLASS_E_NOAGGREGATION ; - } - - // Create component. - IOemUI* pOemCB = new IOemUI ; - if (pOemCB == NULL) - { - return E_OUTOFMEMORY ; - } - // Get the requested interface. - HRESULT hr = pOemCB->QueryInterface(iid, ppv) ; - - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - pOemCB->Release() ; - return hr ; -} - -// LockServer -HRESULT __stdcall IOemCF::LockServer(BOOL bLock) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks) ; - } - else - { - InterlockedDecrement(&g_cServerLocks) ; - } - return S_OK ; -} - -/////////////////////////////////////////////////////////// -// -// Exported functions -// - - -// Can DLL unload now? -// -STDAPI DllCanUnloadNow() -{ - // - // To avoid leaving OEM DLL still in memory when Unidrv or Pscript drivers - // are unloaded, Unidrv and Pscript driver ignore the return value of - // DllCanUnloadNow of the OEM DLL, and always call FreeLibrary on the OEMDLL. - // - // If OEM DLL spins off a working thread that also uses the OEM DLL, the - // thread needs to call LoadLibrary and FreeLibraryAndExitThread, otherwise - // it may crash after Unidrv or Pscript calls FreeLibrary. - // - - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK ; - } - else - { - return S_FALSE; - } -} - -// -// Get class factory -// -STDAPI DllGetClassObject( - _In_ REFCLSID clsid, - _In_ REFIID iid, - _Outptr_ LPVOID* ppv) -{ - VERBOSE(DLLTEXT("DllGetClassObject:Create class factory.\r\n")); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Can we create this component? - if (clsid != CLSID_OEMUI) - { - return CLASS_E_CLASSNOTAVAILABLE ; - } - - // Create class factory. - IOemCF* pFontCF = new IOemCF ; // Reference count set to 1 - // in constructor - if (pFontCF == NULL) - { - return E_OUTOFMEMORY ; - } - - // Get requested interface. - HRESULT hr = pFontCF->QueryInterface(iid, ppv) ; - pFontCF->Release() ; - - return hr ; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/intrface.h deleted file mode 100644 index d9bdf3a2..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/intrface.h +++ /dev/null @@ -1,179 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.h -// -// -// PURPOSE: Header of interface for PScript5 and Unidrv5 UI plug-in. -// -#pragma once - -//////////////////////////////////////////////////////////////////////////////// -// -// IOemUI -// -class IOemUI: public IPrintOemUI -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Get OEM dll related information - // - - STDMETHOD(GetInfo) (THIS_ DWORD dwMode, PVOID pBuffer, DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDevMode - // - - STDMETHOD(DevMode) (THIS_ DWORD dwMode, POEMDMPARAM pOemDMParam) ; - - // - // OEMCommonUIProp - // - - STDMETHOD(CommonUIProp) (THIS_ - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam - ); - - // - // OEMDocumentPropertySheets - // - - STDMETHOD(DocumentPropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - // - // OEMDevicePropertySheets - // - - STDMETHOD(DevicePropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - - // - // OEMDevQueryPrintEx - // - - STDMETHOD(DevQueryPrintEx) (THIS_ - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM - ); - - // - // OEMDeviceCapabilities - // - - STDMETHOD(DeviceCapabilities) (THIS_ - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult - ); - - // - // OEMUpgradePrinter - // - - STDMETHOD(UpgradePrinter) (THIS_ - DWORD dwLevel, - PBYTE pDriverUpgradeInfo - ); - - // - // OEMPrinterEvent - // - - STDMETHOD(PrinterEvent) (THIS_ - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam - ); - - // - // OEMDriverEvent - // - - STDMETHOD(DriverEvent)(THIS_ - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam - ); - - // - // OEMQueryColorProfile - // - - STDMETHOD(QueryColorProfile) (THIS_ - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulReserved, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData); - - // - // OEMFontInstallerDlgProc - // - - STDMETHOD(FontInstallerDlgProc) (THIS_ - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam - ); - // - // UpdateExternalFonts - // - - STDMETHOD(UpdateExternalFonts) (THIS_ - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges - ); - - - IOemUI() { m_cRef = 1; m_pOEMHelp = NULL; }; - ~IOemUI(); - -protected: - LONG m_cRef; - IPrintOemDriverUI* m_pOEMHelp; -}; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/oem.h b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/oem.h deleted file mode 100644 index bf3d75f9..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/oem.h +++ /dev/null @@ -1,22 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: oem.h -// -// -// PURPOSE: Define common data types, and external function prototypes -// for debug.cpp. -// -#pragma once - -//////////////////////////////////////////////////////// -// OEM Defines -//////////////////////////////////////////////////////// - -#define OEM_SIGNATURE 'MSFT' -#define OEM_VERSION 0x00000001L - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/oemui.cpp b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/oemui.cpp deleted file mode 100644 index 61f3d378..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/oemui.cpp +++ /dev/null @@ -1,756 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: OEMUI.cpp -// -// -// PURPOSE: Main file for OEM UI test module. -// -// - -#include "precomp.h" -#include "resource.h" -#include "debug.h" -#include "fusutils.h" -#include "oemui.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// INTERNAL MACROS and DEFINES -//////////////////////////////////////////////////////// - -typedef struct _tagCBUserData -{ - HANDLE hComPropSheet; - HANDLE hPropPage; - POEMUIPSPARAM pOEMUIParam; - PFNCOMPROPSHEET pfnComPropSheet; - -} CBUSERDATA, *PCBUSERDATA; - - - -//////////////////////////////////////////////////////// -// INTERNAL PROTOTYPES -//////////////////////////////////////////////////////// - -static HRESULT hrDocumentPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -static HRESULT hrPrinterPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -LONG APIENTRY OEMPrinterUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam); -LONG APIENTRY OEMDocUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam); -LONG APIENTRY OEMDocUICallBack2(PCPSUICBPARAM pCallbackParam); -INT_PTR CALLBACK DevicePropPageProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam); -static POPTITEM CreateOptItems(HANDLE hHeap, DWORD dwOptItems); -static void InitOptItems(POPTITEM pOptItems, DWORD dwOptItems); -static POPTTYPE CreateOptType(HANDLE hHeap, WORD wOptParams); -static PTSTR GetStringResource(HANDLE hHeap, HANDLE hModule, UINT uResource); - - - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM device or document property UI. -// -HRESULT hrOEMPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - HRESULT hResult = S_OK; - - - VERBOSE(DLLTEXT("hrOEMPropertyPage entry.\r\n")); - - // Validate parameters. - if( (OEMCUIP_DOCPROP != dwMode) - && - (OEMCUIP_PRNPROP != dwMode) - ) - { - ERR(DLLTEXT("hrOEMPropertyPage() ERROR_INVALID_PARAMETER.\r\n")); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - switch(dwMode) - { - case OEMCUIP_DOCPROP: - hResult = hrDocumentPropertyPage(dwMode, pOEMUIParam); - break; - - case OEMCUIP_PRNPROP: - hResult = hrPrinterPropertyPage(dwMode, pOEMUIParam); - break; - - default: - // Should never reach this! - ERR(DLLTEXT("hrOEMPropertyPage() Invalid dwMode")); - SetLastError(ERROR_INVALID_PARAMETER); - hResult = E_FAIL; - break; - } - - return hResult; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM document property UI. -// -static HRESULT hrDocumentPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - UNREFERENCED_PARAMETER(dwMode); - - if(NULL == pOEMUIParam->pOEMOptItems) - { - // Fill in the number of OptItems to create for OEM document property UI. - pOEMUIParam->cOEMOptItems = 1; - - VERBOSE(DLLTEXT("hrDocumentPropertyPage() requesting items.\r\n")); - } - else - { - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - - - VERBOSE(DLLTEXT("hrDocumentPropertyPage() fill out items.\r\n")); - - // Init UI Callback reference. - pOEMUIParam->OEMCUIPCallback = OEMDocUICallBack; - - // Init OEMOptItmes. - InitOptItems(pOEMUIParam->pOEMOptItems, pOEMUIParam->cOEMOptItems); - - // Fill out tree view items. - - // New section. - pOEMUIParam->pOEMOptItems[0].Level = 1; - pOEMUIParam->pOEMOptItems[0].Flags = OPTIF_COLLAPSE; - pOEMUIParam->pOEMOptItems[0].pName = GetStringResource(pOEMUIParam->hOEMHeap, pOEMUIParam->hModule, IDS_ADV_SECTION); - pOEMUIParam->pOEMOptItems[0].Sel = pOEMDev->dwAdvancedData; - - pOEMUIParam->pOEMOptItems[0].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 2); - - pOEMUIParam->pOEMOptItems[0].pOptType->Type = TVOT_UDARROW; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].IconID = 0; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].lParam = 100; - } - - return S_OK; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM printer property UI. -// -static HRESULT hrPrinterPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - UNREFERENCED_PARAMETER(dwMode); - - if(NULL == pOEMUIParam->pOEMOptItems) - { - // Fill in the number of OptItems to create for OEM printer property UI. - pOEMUIParam->cOEMOptItems = 1; - - VERBOSE(DLLTEXT("hrPrinterPropertyPage() requesting items.\r\n")); - } - else - { - DWORD dwError; - DWORD dwDeviceValue; - DWORD dwType; - DWORD dwNeeded; - - - VERBOSE(DLLTEXT("hrPrinterPropertyPage() fill out items.\r\n")); - - // Get device settings value from printer. - dwError = GetPrinterData(pOEMUIParam->hPrinter, OEMUI_VALUE, &dwType, (PBYTE) &dwDeviceValue, - sizeof(dwDeviceValue), &dwNeeded); - if( (ERROR_SUCCESS != dwError) - || - (dwDeviceValue > 100) - ) - { - // Failed to get the device value or value is invalid, just use the default. - dwDeviceValue = 0; - } - - // Init UI Callback reference. - pOEMUIParam->OEMCUIPCallback = OEMPrinterUICallBack; - - // Init OEMOptItmes. - InitOptItems(pOEMUIParam->pOEMOptItems, pOEMUIParam->cOEMOptItems); - - // Fill out tree view items. - - // New section. - pOEMUIParam->pOEMOptItems[0].Level = 1; - pOEMUIParam->pOEMOptItems[0].Flags = OPTIF_COLLAPSE; - pOEMUIParam->pOEMOptItems[0].pName = GetStringResource(pOEMUIParam->hOEMHeap, pOEMUIParam->hModule, IDS_DEV_SECTION); - pOEMUIParam->pOEMOptItems[0].Sel = dwDeviceValue; - - pOEMUIParam->pOEMOptItems[0].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 2); - - pOEMUIParam->pOEMOptItems[0].pOptType->Type = TVOT_UDARROW; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].IconID = 0; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].lParam = 100; - } - - return S_OK; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Adds property page to Document property sheet. -// -HRESULT hrOEMDocumentPropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam, - IPrintOemDriverUI* pOEMHelp) -{ - LONG_PTR lResult = 0; - HRESULT hrResult = S_OK; - - VERBOSE(DLLTEXT("hrOEMDocumentPropertySheets() entry.\r\n")); - - UNREFERENCED_PARAMETER(pOEMHelp); - - // Validate parameters. - if( (NULL == pPSUIInfo) - || - (PROPSHEETUI_INFO_VERSION != pPSUIInfo->Version) - ) - { - ERR(DLLTEXT("hrOEMDocumentPropertySheets() ERROR_INVALID_PARAMETER.\r\n")); - - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Do action. - switch(pPSUIInfo->Reason) - { - case PROPSHEETUI_REASON_INIT: - { - DWORD dwSheets = 0; - PCBUSERDATA pUserData; - POEMUIPSPARAM pOEMUIParam = (POEMUIPSPARAM) pPSUIInfo->lParamInit; - HANDLE hHeap = pOEMUIParam->hOEMHeap; - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - COMPROPSHEETUI Sheet; - - - // Init property page. - memset(&Sheet, 0, sizeof(COMPROPSHEETUI)); - Sheet.cbSize = sizeof(COMPROPSHEETUI); - Sheet.Flags = CPSUIF_UPDATE_PERMISSION; - Sheet.hInstCaller = ghInstance; - Sheet.pCallerName = GetStringResource(hHeap, ghInstance, IDS_NAME); - Sheet.pHelpFile = NULL; - Sheet.pfnCallBack = OEMDocUICallBack2; - Sheet.pDlgPage = CPSUI_PDLGPAGE_TREEVIEWONLY; - Sheet.cOptItem = 1; - Sheet.IconID = IDI_CPSUI_PRINTER; - Sheet.pOptItemName = GetStringResource(hHeap, ghInstance, IDS_SECTION); - Sheet.CallerVersion = 0x100; - Sheet.OptItemVersion = 0x100; - - // Init user data. - pUserData = (PCBUSERDATA) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(CBUSERDATA)); - if (NULL == pUserData) - { - ERR(DLLTEXT("hrOEMDocumentPropertySheets() failed to allocate user data.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - pUserData->hComPropSheet = pPSUIInfo->hComPropSheet; - pUserData->pfnComPropSheet = pPSUIInfo->pfnComPropSheet; - pUserData->pOEMUIParam = pOEMUIParam; - Sheet.UserData = (ULONG_PTR) pUserData; - - // Create OptItems for page. - Sheet.pOptItem = CreateOptItems(hHeap, Sheet.cOptItem); - if (NULL == Sheet.pOptItem) - { - ERR(DLLTEXT("hrOEMDocumentPropertySheets() failed to allocate OPTITEMs.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Initialize OptItems - Sheet.pOptItem[0].Level = 1; - Sheet.pOptItem[0].Flags = OPTIF_COLLAPSE; - Sheet.pOptItem[0].pName = GetStringResource(hHeap, ghInstance, IDS_SECTION); - Sheet.pOptItem[0].Sel = pOEMDev->dwDriverData; - - Sheet.pOptItem[0].pOptType = CreateOptType(hHeap, 2); - if (NULL == Sheet.pOptItem[0].pOptType) - { - ERR(DLLTEXT("hrOEMDocumentPropertySheets() failed to allocate OPTTYPE.\r\n")); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - Sheet.pOptItem[0].pOptType->Type = TVOT_UDARROW; - Sheet.pOptItem[0].pOptType->pOptParam[1].IconID = 0; - Sheet.pOptItem[0].pOptType->pOptParam[1].lParam = 100; - - // NOTE: Don't need to do anything with Activation Contexts - // to get Themed UI, since Compstui will create this - // page using it's Activation Context which specifies - // comctl v6. - - // Add property sheets. - lResult = pPSUIInfo->pfnComPropSheet(pPSUIInfo->hComPropSheet, CPSFUNC_ADD_PCOMPROPSHEETUI, - (LPARAM)&Sheet, (LPARAM)&dwSheets); - } - break; - - case PROPSHEETUI_REASON_GET_INFO_HEADER: - { - PPROPSHEETUI_INFO_HEADER pHeader = (PPROPSHEETUI_INFO_HEADER) lParam; - - pHeader->pTitle = (LPTSTR)PROP_TITLE; - lResult = TRUE; - } - break; - - case PROPSHEETUI_REASON_GET_ICON: - // No icon - lResult = 0; - break; - - case PROPSHEETUI_REASON_SET_RESULT: - { - PSETRESULT_INFO pInfo = (PSETRESULT_INFO) lParam; - - lResult = pInfo->Result; - } - break; - - case PROPSHEETUI_REASON_DESTROY: - lResult = TRUE; - break; - } - -Exit: - - pPSUIInfo->Result = lResult; - return hrResult; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Adds property page to printer property sheet. -// -HRESULT hrOEMDevicePropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam) -{ - LONG_PTR lResult = 0; - - - VERBOSE(DLLTEXT("hrOEMDevicePropertySheets entry\r\n")); - - // Validate parameters. - if( (NULL == pPSUIInfo) - || - (PROPSHEETUI_INFO_VERSION != pPSUIInfo->Version) - ) - { - ERR(DLLTEXT("hrOEMDevicePropertySheets() ERROR_INVALID_PARAMETER.\r\n")); - - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Do action. - switch(pPSUIInfo->Reason) - { - case PROPSHEETUI_REASON_INIT: - { - PROPSHEETPAGE Page; - - // Init property page. - memset(&Page, 0, sizeof(PROPSHEETPAGE)); - Page.dwSize = sizeof(PROPSHEETPAGE); - Page.dwFlags = PSP_DEFAULT; - Page.hInstance = ghInstance; - Page.pszTemplate = MAKEINTRESOURCE(IDD_DEVICE_PROPPAGE); - Page.pfnDlgProc = DevicePropPageProc; - Page.hActCtx = GetMyActivationContext(); - - // Set the flag to indicate that our PROPSHEETPAGE - // has an Activation Context. - // The Activation Context indicates with version of - // comctl for Compstui to create our PROPSHEETPAGE - // with. To get Themed UI we need to specify comctl v6. - if( (NULL != Page.hActCtx) && (INVALID_HANDLE_VALUE != Page.hActCtx)) - { - Page.dwFlags |= PSP_USEFUSIONCONTEXT; - } - - // Add property sheets. - lResult = pPSUIInfo->pfnComPropSheet(pPSUIInfo->hComPropSheet, CPSFUNC_ADD_PROPSHEETPAGE, (LPARAM)&Page, 0); - - // NOTE: The Activation Context is released when the DLL is unloaded - // during DLL_PROCESS_DETACH. - } - break; - - case PROPSHEETUI_REASON_GET_INFO_HEADER: - { - PPROPSHEETUI_INFO_HEADER pHeader = (PPROPSHEETUI_INFO_HEADER) lParam; - - pHeader->pTitle = (LPTSTR)PROP_TITLE; - lResult = TRUE; - } - break; - - case PROPSHEETUI_REASON_GET_ICON: - // No icon - lResult = 0; - break; - - case PROPSHEETUI_REASON_SET_RESULT: - { - PSETRESULT_INFO pInfo = (PSETRESULT_INFO) lParam; - - lResult = pInfo->Result; - } - break; - - case PROPSHEETUI_REASON_DESTROY: - lResult = TRUE; - break; - } - - pPSUIInfo->Result = lResult; - return S_OK; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// OptItems call back for OEM printer property UI. -// -LONG APIENTRY OEMPrinterUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - - VERBOSE(DLLTEXT("OEMPrinterUICallBack() entry.\r\n")); - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - { - DWORD dwDriverValue = pOEMUIParam->pOEMOptItems[0].Sel; - - // Store OptItems state in printer data. - SetPrinterData(pOEMUIParam->hPrinter, OEMUI_VALUE, REG_DWORD, (PBYTE) &dwDriverValue, sizeof(DWORD)); - } - break; - - default: - break; - } - - return lReturn; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Call back for OEM device property UI. -// -#pragma warning(push) -#pragma warning(disable:6262) // this method exceeds the default threshold for stack usage by a few bytes. -INT_PTR CALLBACK DevicePropPageProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) -{ - switch (uiMsg) - { - case WM_COMMAND: - switch(HIWORD(wParam)) - { - case BN_CLICKED: - switch(LOWORD(wParam)) - { - case IDC_CALIBRATE: - // Just display a message that the printer is calibrated, - // since we don't acutally calibrate anything. - { - TCHAR szName[MAX_PATH]; - TCHAR szCalibrated[MAX_PATH]; - - - LoadString(ghInstance, IDS_NAME, szName, sizeof(szName)/sizeof(szName[0])); - LoadString(ghInstance, IDS_CALIBRATED, szCalibrated, sizeof(szCalibrated)/sizeof(szCalibrated[0])); - MessageBox(hDlg, szCalibrated, szName, MB_OK); - } - break; - } - break; - - default: - return FALSE; - } - return TRUE; - - case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->code) // type of notification message - { - case PSN_SETACTIVE: - break; - - case PSN_KILLACTIVE: - break; - - case PSN_APPLY: - break; - - case PSN_RESET: - break; - } - } - break; - } - - return FALSE; -} -#pragma warning(pop) - - -//////////////////////////////////////////////////////////////////////////////// -// -// OptItems call back for OEM document property UI. -// -LONG APIENTRY OEMDocUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - - VERBOSE(DLLTEXT("OEMDocUICallBack() entry.\r\n")); - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - // Store OptItems state in DEVMODE. - pOEMDev->dwAdvancedData = pOEMUIParam->pOEMOptItems[0].Sel; - break; - - case CPSUICB_REASON_KILLACTIVE: - pOEMDev->dwAdvancedData = pOEMUIParam->pOEMOptItems[0].Sel; - break; - - case CPSUICB_REASON_SETACTIVE: - if((DWORD)(pOEMUIParam->pOEMOptItems[0].Sel) != pOEMDev->dwAdvancedData) - { - pOEMUIParam->pOEMOptItems[0].Sel = pOEMDev->dwAdvancedData; - pOEMUIParam->pOEMOptItems[0].Flags |= OPTIF_CHANGED; - lReturn = CPSUICB_ACTION_OPTIF_CHANGED; - } - break; - - default: - break; - } - - return lReturn; -} - - -LONG APIENTRY OEMDocUICallBack2(PCPSUICBPARAM pCallbackParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - PCBUSERDATA pUserData = (PCBUSERDATA) pCallbackParam->UserData; - POEMDEV pOEMDev = (POEMDEV) pUserData->pOEMUIParam->pOEMDM; - - - VERBOSE(DLLTEXT("OEMDocUICallBack2() entry.\r\n")); - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - pOEMDev->dwDriverData = pCallbackParam->pOptItem[0].Sel; - pUserData->pfnComPropSheet(pUserData->hComPropSheet, CPSFUNC_SET_RESULT, - (LPARAM)pUserData->hPropPage, - (LPARAM)CPSUI_OK); - break; - - case CPSUICB_REASON_KILLACTIVE: - pOEMDev->dwDriverData = pCallbackParam->pOptItem[0].Sel; - break; - - case CPSUICB_REASON_SETACTIVE: - if((DWORD)(pCallbackParam->pOptItem[0].Sel) != pOEMDev->dwDriverData) - { - pCallbackParam->pOptItem[0].Sel = pOEMDev->dwDriverData; - pCallbackParam->pOptItem[0].Flags |= OPTIF_CHANGED; - lReturn = CPSUICB_ACTION_OPTIF_CHANGED; - } - break; - - default: - break; - } - - return lReturn; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Creates and Initializes OptItems. -// -static POPTITEM CreateOptItems(HANDLE hHeap, DWORD dwOptItems) -{ - POPTITEM pOptItems = NULL; - SIZE_T sizeOfOptItems = 0; - - // Compute the size of memory needed for the OptItems: - if (SUCCEEDED(SIZETMult(sizeof(OPTITEM), (SIZE_T)dwOptItems, &sizeOfOptItems))) - { - // Allocate memory for OptItems; - pOptItems = (POPTITEM) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeOfOptItems); - if(NULL != pOptItems) - { - InitOptItems(pOptItems, dwOptItems); - } - else - { - ERR(DLLTEXT("CreateOptItems() failed to allocate memory for OPTITEMs!\r\n")); - } - } - else - { - ERR(DLLTEXT("CreateOptItems() failed to compute necessary memory size for OPTITEMs!\r\n")); - } - - return pOptItems; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems. -// -static void InitOptItems(POPTITEM pOptItems, DWORD dwOptItems) -{ - VERBOSE(DLLTEXT("InitOptItems() entry.\r\n")); - - // Zero out memory. - memset(pOptItems, 0, sizeof(OPTITEM) * dwOptItems); - - // Set each OptItem's size, and Public DM ID. - for(DWORD dwCount = 0; dwCount < dwOptItems; dwCount++) - { - pOptItems[dwCount].cbSize = sizeof(OPTITEM); - pOptItems[dwCount].DMPubID = DMPUB_NONE; - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Allocates and initializes OptType for OptItem. -// -static POPTTYPE CreateOptType(HANDLE hHeap, WORD wOptParams) -{ - POPTTYPE pOptType = NULL; - - - VERBOSE(DLLTEXT("CreateOptType() entry.\r\n")); - - // Allocate memory from the heap for the OPTTYPE; the driver will take care of clean up. - pOptType = (POPTTYPE) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(OPTTYPE)); - if(NULL != pOptType) - { - // Initialize OPTTYPE. - pOptType->cbSize = sizeof(OPTTYPE); - pOptType->Count = wOptParams; - - // Allocate memory from the heap for the OPTPARAMs for the OPTTYPE. - pOptType->pOptParam = (POPTPARAM) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, wOptParams * sizeof(OPTPARAM)); - if(NULL != pOptType->pOptParam) - { - // Initialize the OPTPARAMs. - for(WORD wCount = 0; wCount < wOptParams; wCount++) - { - pOptType->pOptParam[wCount].cbSize = sizeof(OPTPARAM); - } - } - else - { - ERR(DLLTEXT("CreateOptType() failed to allocated memory for OPTPARAMs!\r\n")); - - // Free allocated memory and return NULL. - HeapFree(hHeap, 0, pOptType); - pOptType = NULL; - } - } - else - { - ERR(DLLTEXT("CreateOptType() failed to allocated memory for OPTTYPE!\r\n")); - } - - return pOptType; -} - -//////////////////////////////////////////////////////////////////////////////////// -// -// Retrieves pointer to a String resource. -// -static PTSTR GetStringResource(HANDLE hHeap, HANDLE hModule, UINT uResource) -{ - int nResult; - DWORD dwSize = MAX_PATH; - PTSTR pszString = NULL; - - - VERBOSE(DLLTEXT("GetStringResource entered.\r\n")); - - // Allocate buffer for string resource from heap; let the driver clean it up. - pszString = (PTSTR) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, dwSize * sizeof(TCHAR)); - if(NULL != pszString) - { - // Load string resource; resize after loading so as not to waste memory. - nResult = LoadString((HMODULE)hModule, uResource, pszString, dwSize); - if(nResult > 0) - { - PTSTR pszTemp; - - pszTemp = (PTSTR) HeapReAlloc(hHeap, HEAP_ZERO_MEMORY, pszString, (nResult + 1) * sizeof(TCHAR)); - if(NULL != pszTemp) - { - pszString = pszTemp; - } - else - { - ERR(DLLTEXT("GetStringResource() HeapReAlloc() of string retrieved failed!\r\n")); - } - } - else - { - ERR(DLLTEXT("GetStringResource() failed to load string resource!\r\n")); - - pszString = NULL; - } - } - else - { - ERR(DLLTEXT("GetStringResource() failed to allocate string buffer!\r\n")); - } - - return pszString; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/oemui.h b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/oemui.h deleted file mode 100644 index 0f392cc5..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/oemui.h +++ /dev/null @@ -1,45 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: OEMUI.H -// -// -// PURPOSE: Define common data types, and external function prototypes -// for OEMUI Test Module. -// - -#pragma once - -#include "OEM.H" -#include "DEVMODE.H" -#include "globals.h" - - -//////////////////////////////////////////////////////// -// OEM UI Defines -//////////////////////////////////////////////////////// - - -// OEM Signature and version. -#define PROP_TITLE L"OEM UI Page" -#define DLLTEXT(s) "ThemeUI: " s - - -// Printer registry keys where OEM data is stored. -#define OEMUI_VALUE TEXT("OEMUI_VALUE") -#define OEMUI_DEVICE_VALUE TEXT("OEMUI_DEVICE_VALUE") - - - -//////////////////////////////////////////////////////// -// Prototypes -//////////////////////////////////////////////////////// - -HRESULT hrOEMPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -HRESULT hrOEMDocumentPropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam, IPrintOemDriverUI* pOEMHelp); -HRESULT hrOEMDevicePropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam); - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/precomp.h deleted file mode 100644 index 0607fe55..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/precomp.h +++ /dev/null @@ -1,61 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: precomp.H -// -// -// PURPOSE: Common headers that don't change often -// - -#pragma once - -// Necessary for compiling under VC. -#if(!defined(WINVER) || (WINVER < 0x0500)) - #undef WINVER - #define WINVER 0x0500 -#endif -#if(!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)) - #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0500 -#endif - -// Isolation define for using ComCtrl v6. -#ifndef ISOLATION_AWARE_ENABLED - #define ISOLATION_AWARE_ENABLED -#endif - - -// Required header files that shouldn't change often. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "COMPSTUI.H" -#include -#include -#include -#include -#include - -// Safe character string functions to detect buffer overrun conditions: -#include - -// Safe integer functions to detect integer overflow/underflow conditions: -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/resource.h b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/resource.h deleted file mode 100644 index 71d3d3d6..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/resource.h +++ /dev/null @@ -1,24 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by OEMUI.rc -// -#define IDS_SECTION 1 -#define IDS_CALIBRATED 2 -#define IDS_NAME 3 -#define IDS_DEV_SECTION 4 -#define IDS_DEVICE_SECTION 4 -#define IDS_ADV_SECTION 10 -#define IDD_DEVICE_PROPPAGE 106 -#define IDD_DOC_PROPPAGE 107 -#define IDC_CALIBRATE 1001 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1002 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/themeuismpl.def b/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/themeuismpl.def deleted file mode 100644 index 8e60b60d..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/ThemeUI/themeuismpl.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY ThemeUISmpl -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE diff --git a/print/OEM Printer Customization Plug-in Samples/C++/WMarkPS.ini b/print/OEM Printer Customization Plug-in Samples/C++/WMarkPS.ini deleted file mode 100644 index 11176160..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/WMarkPS.ini +++ /dev/null @@ -1,4 +0,0 @@ -[OEMFiles] -OEMConfigFile1=WMARKUI.DLL -OEMDriverFile1=WMARKPS.DLL - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/WMarkUni.ini b/print/OEM Printer Customization Plug-in Samples/C++/WMarkUni.ini deleted file mode 100644 index 4ae540c4..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/WMarkUni.ini +++ /dev/null @@ -1,5 +0,0 @@ -[OEMFiles] -OEMConfigFile1=WMARKUNIUI.DLL -OEMDriverFile1=WMARKUNI.DLL - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap.gpd b/print/OEM Printer Customization Plug-in Samples/C++/bitmap.gpd deleted file mode 100644 index 467e3e21..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap.gpd +++ /dev/null @@ -1,509 +0,0 @@ -*GPDFileName: "bitmap.gpd" -*GPDFileVersion: "1.0" -*GPDSpecVersion: "1.0" -*Include: "StdNames.gpd" -*ModelName: "Bitmap Driver" -*MasterUnits: PAIR(1200, 1200) -*ResourceDLL: "unires.dll" -*PrinterType: PAGE -*MaxCopies: 99 -*PrintRate: 16 -*PrintRateUnit: PPM -*PrintRatePPM: 16 - -*%****************************************************************************************** -*% Orientation -*%****************************************************************************************** -*Feature: Orientation -{ - *rcNameID: =ORIENTATION_DISPLAY - *DefaultOption: PORTRAIT - *Option: PORTRAIT - { - *rcNameID: =PORTRAIT_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.6 - *Cmd: "" - } - } - *Option: LANDSCAPE_CC90 - { - *rcNameID: =LANDSCAPE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.8 - *Cmd: "" - } - } -} - -*%****************************************************************************************** -*% Input Bin -*%****************************************************************************************** -*Feature: InputBin -{ - *rcNameID: =PAPER_SOURCE_DISPLAY - *DefaultOption: AUTO - *Option: AUTO - { - *rcNameID: =AUTO_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "" - } - } - *Option: UPPER - { - *rcNameID: =UPPER_TRAY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "" - } - } -} - -*%****************************************************************************************** -*% Resolution -*%****************************************************************************************** -*Feature: Resolution -{ - *rcNameID: =RESOLUTION_DISPLAY - *DefaultOption: Option2 - *Option: Option1 - { - *Name: "600 x 600" =DOTS_PER_INCH - *DPI: PAIR(600, 600) - *TextDPI: PAIR(600, 600) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED,TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "" } - *Command: CmdEndRaster { *Cmd : "" } - *Command: CmdSendBlockData { *Cmd : "" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "" - } - } - *Option: Option2 - { - *Name: "300 x 300" =DOTS_PER_INCH - *DPI: PAIR(300, 300) - *TextDPI: PAIR(300, 300) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED, TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "" } - *Command: CmdEndRaster { *Cmd : "" } - *Command: CmdSendBlockData { *Cmd : "" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "" - } - } - *Option: Option3 - { - *Name: "150 x 150" =DOTS_PER_INCH - *DPI: PAIR(150, 150) - *TextDPI: PAIR(150, 150) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED, TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "" } - *Command: CmdEndRaster { *Cmd : "" } - *Command: CmdSendBlockData { *Cmd : "" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "" - } - } -} - -*%****************************************************************************************** -*% Paper Size -*%****************************************************************************************** -*Feature: PaperSize -{ - *rcNameID: =PAPER_SIZE_DISPLAY - *DefaultOption: LETTER - *Option: LETTER - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9500, 12500) - *PrintableOrigin: PAIR(400, 400) - *CursorOrigin: PAIR(300, 300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9500, 12200) - *PrintableOrigin: PAIR(450, 300) - *CursorOrigin: PAIR(200, 12900) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "" - } - } - } - } - *Option: LEGAL - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 600) - *CursorOrigin: PAIR(180, 300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 900) - *CursorOrigin: PAIR(180, 16500) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "" - } - } - } - } - *Option: EXECUTIVE - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(8100, 11500) - *PrintableOrigin: PAIR(300, 300) - *CursorOrigin: PAIR(300, 200) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(8300, 11500) - *PrintableOrigin: PAIR(200, 300) - *CursorOrigin: PAIR(200, 12300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "" - } - } - } - } - *Option: A4 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9100, 13200) - *PrintableOrigin: PAIR(400, 300) - *CursorOrigin: PAIR(288, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9100, 13200) - *PrintableOrigin: PAIR(400, 300) - *CursorOrigin: PAIR(204, 13824) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "" - } - } - } - } - *Option: B5 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(7900, 11140) - *PrintableOrigin: PAIR(352, 300) - *CursorOrigin: PAIR(300, 100) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(7760, 11140) - *PrintableOrigin: PAIR(300, 400) - *CursorOrigin: PAIR(100, 11940) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "" - } - } - } - } -} - -*%****************************************************************************************** -*% Media Type -*%****************************************************************************************** -*Feature: MediaType -{ - *rcNameID: =MEDIA_TYPE_DISPLAY - *DefaultOption: PLAIN - *Option: PLAIN - { - *rcNameID: =PLAIN_PAPER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.15 - *Cmd: "" - } - } - *Option: TRANSPARENCY - { - *rcNameID: =TRANSPARENCY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.15 - *Cmd: "" - } - } -} - -*%****************************************************************************************** -*% Color Mode -*%****************************************************************************************** -*Feature: ColorMode -{ - *rcNameID: =COLOR_PRINTING_MODE_DISPLAY - *DefaultOption: 8bpp - *Option: Mono - { - *rcNameID: =MONO_DISPLAY - *DevNumOfPlanes: 0 - *DevBPP: 0 - *IPCallbackID: 1 - *Color?: FALSE - } - *Option: Color - { - *rcNameID: =COLOR_DISPLAY - *DevNumOfPlanes: 0 - *DevBPP: 0 - *DrvBPP: 4 - *IPCallbackID: 2 - *PaletteSize: 8 - *PaletteProgrammable?: TRUE - *Command: CmdEnableDRC { *Cmd: "" } - *Command: CmdDefinePaletteEntry { *Cmd : "" } - *Command: CmdSelectPaletteEntry { *Cmd : "" } - *Command: CmdSetSrcBmpWidth { *Cmd : "" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "" - } - } - *Option: 8bpp - { - *rcNameID: =8BPP_DISPLAY - *DevNumOfPlanes: 0 - *DevBPP: 0 - *DrvBPP: 8 - *IPCallbackID: 3 - *PaletteSize: 256 - *PaletteProgrammable? : TRUE - *Command: CmdEnableDRC { *Cmd : "" } - *Command: CmdDefinePaletteEntry { *Cmd : "" } - *Command: CmdSelectPaletteEntry { *Cmd : "" } - *Command: CmdSetSrcBmpWidth { *Cmd : "" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "" - } - } - *Option: 24bpp - { - *rcNameID: =24BPP_DISPLAY - *DevNumOfPlanes: 0 - *DevBPP: 0 - *DrvBPP: 24 - *IPCallbackID: 5 - *PaletteSize: 256 - *PaletteProgrammable? : TRUE - *Command: CmdEnableDRC { *Cmd : "" } - *Command: CmdDefinePaletteEntry { *Cmd : "" } - *Command: CmdSelectPaletteEntry { *Cmd : "" } - *Command: CmdSetSrcBmpWidth { *Cmd : "" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "" - } - } -} - -*%****************************************************************************************** -*% HalfTone -*%****************************************************************************************** -*Feature: Halftone -{ - *rcNameID: =HALFTONING_DISPLAY - *DefaultOption: HT_PATSIZE_AUTO - *Option: HT_PATSIZE_AUTO - { - *rcNameID: =HT_AUTO_SELECT_DISPLAY - } - *Option: HT_PATSIZE_SUPERCELL_M - { - *rcNameID: =HT_SUPERCELL_DISPLAY - } - *Option: HT_PATSIZE_6x6_M - { - *rcNameID: =HT_DITHER6X6_DISPLAY - } - *Option: HT_PATSIZE_8x8_M - { - *rcNameID: =HT_DITHER8X8_DISPLAY - } -} - -*%****************************************************************************************** -*% Duplex Unit -*%****************************************************************************************** -*Feature: DuplexUnit -{ - *rcNameID: 429 - *FeatureType: PRINTER_PROPERTY - *DefaultOption: FALSE - *Option: FALSE - { - *rcNameID: 444 - *DisabledFeatures: LIST(Duplex.VERTICAL, Duplex.HORIZONTAL) - } - *Option: TRUE - { - *rcNameID: 443 - } -} - -*%****************************************************************************************** -*% Duplex Type -*%****************************************************************************************** -*Feature: Duplex -{ - *rcNameID: =TWO_SIDED_PRINTING_DISPLAY - *DefaultOption: NONE - *Option: NONE - { - *rcNameID: =NONE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "" - } - } - *Option: VERTICAL - { - *rcNameID: =FLIP_ON_LONG_EDGE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "" - } - } - *Option: HORIZONTAL - { - *rcNameID: =FLIP_ON_SHORT_EDGE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "" - } - } -} - -*%****************************************************************************************** -*% Doc setup commands -*%****************************************************************************************** -*Command: CmdStartDoc -{ - *Order: DOC_SETUP.7 - *Cmd: "" -} -*Command: CmdStartPage -{ - *Order: PAGE_SETUP.1 - *Cmd: "" -} -*Command: CmdEndJob -{ - *Order: JOB_FINISH.1 - *Cmd: "" -} -*Command: CmdCopies -{ - *Order: DOC_SETUP.13 - *Cmd: "" -} - -*%****************************************************************************************** -*% Cursor and Page Commands -*%****************************************************************************************** -*RotateCoordinate?: TRUE -*RotateRaster?: TRUE -*RotateFont?: TRUE -*TextCaps: LIST(TC_CR_90,TC_UA_ABLE) -*MemoryUsage: LIST(FONT, RASTER, VECTOR) -*CursorXAfterCR: AT_PRINTABLE_X_ORIGIN -*BadCursorMoveInGrxMode: LIST(X_PORTRAIT,Y_LANDSCAPE) -*XMoveThreshold: 0 -*YMoveThreshold: 0 -*XMoveUnit: 300 -*YMoveUnit: 300 -*EjectPageWithFF?: TRUE -*OutputDataFormat: H_BYTE -*OptimizeLeftBound?: TRUE -*CursorXAfterSendBlockData: AT_GRXDATA_ORIGIN -*CursorYAfterSendBlockData: AUTO_INCREMENT - -*Command: CmdCR { *Cmd : "" } -*Command: CmdLF { *Cmd : "" } -*Command: CmdFF { *Cmd : "" } diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf b/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf deleted file mode 100644 index 5d01b260..00000000 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/bitmap.inf and /dev/null differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap.ini b/print/OEM Printer Customization Plug-in Samples/C++/bitmap.ini deleted file mode 100644 index 2388914c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap.ini +++ /dev/null @@ -1,5 +0,0 @@ -[OEMFiles] -OEMDriverFile1=BITMAP.DLL - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.def b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.def deleted file mode 100644 index 1a4df55f..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.def +++ /dev/null @@ -1,4 +0,0 @@ -LIBRARY bitmap -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.h b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.h deleted file mode 100644 index ee068c02..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.h +++ /dev/null @@ -1,81 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: BITMAP.H -// -// -// PURPOSE: Define the COemPDEV class which stores the private -// PDEV for the driver. -// - - -#pragma once - -#define OEM_SIGNATURE 'MSFT' -#define OEM_VERSION 0x00000001L - -#define RGB_BLACK RGB(0, 0, 0) -#define RGB_WHITE RGB(255, 255, 255) - -class COemPDEV -{ -public: - COemPDEV(void) : - m_pfnDrvEndDoc(NULL), - pBufStart(NULL), - dwBufSize(0), - cPalColors(0), - hpalDefault(), - prgbq(NULL), - cbHeaderOffBits(0), - bHeadersFilled(FALSE), - bColorTable(FALSE) - { - memset(&bmFileHeader, 0, sizeof(bmFileHeader)); - memset(&bmInfoHeader, 0, sizeof(bmInfoHeader)); - } - - virtual ~COemPDEV(void) - { - } - - void InitializeDDITable(DRVENABLEDATA* pded) - { - UINT iDrvFn; - UINT cDrvFn = pded->c; - PDRVFN pDrvFn = pded->pdrvfn; - - for (iDrvFn = 0; iDrvFn < cDrvFn; ++iDrvFn, ++pDrvFn) - { - if (pDrvFn->iFunc == INDEX_DrvEndDoc) - { - m_pfnDrvEndDoc = (PFN_DrvEndDoc)(pDrvFn->pfn); - } - } - } - -public: - - PFN_DrvEndDoc m_pfnDrvEndDoc; // Unidrv function to call back into from the DDI hook - PBYTE pBufStart; // Pointer to start of buffer to hold the bitmap data - DWORD dwBufSize; // Buffer size - BITMAPFILEHEADER bmFileHeader; // BitmapFileHeader for each dump - BITMAPINFOHEADER bmInfoHeader; // BitmapInfoHeader for each dump - int cPalColors; // Count of colors in palette. - HPALETTE hpalDefault; // Default palette to pass to GDI. - _Field_size_(cPalColors) RGBQUAD * prgbq; // Color table - INT cbHeaderOffBits; // Offset to bits in the file - BOOL bHeadersFilled; // Flag to indicate if the header stuff has been filled - BOOL bColorTable; // Flag to indicate if color table needs to be dumped - -}; - -typedef COemPDEV* POEMPDEV; - -BOOL bGrowBuffer(POEMPDEV, DWORD); // Function to enlarge the buffer for holding the bitmap data -VOID vFreeBuffer(POEMPDEV); // Function to free the buffer for holding the bitmap data -BOOL bFillColorTable(POEMPDEV); // Function to fill the color table for the bitmap data diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.rc b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.rc deleted file mode 100644 index 737bba96..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.rc +++ /dev/null @@ -1,110 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Written by DDK Support Team\0" - VALUE "CompanyName", "Microsoft Corp.\0" - VALUE "FileDescription", "Bitmap Driver Sample\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "BITMAP\0" - VALUE "LegalCopyright", "Copyright 1998-2003\0" - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation\0" - VALUE "OriginalFilename", "BITMAP.DLL\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Microsoft Bitmap Driver Sample\0" - VALUE "ProductVersion", "1.0\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.vcxproj deleted file mode 100644 index d530f136..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.vcxproj +++ /dev/null @@ -1,1090 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {EDCCC34A-50DF-4894-B7B9-FC156F899947} - $(MSBuildProjectName) - Win10 Debug - Win32 - {64A7662C-5E32-41A7-939B-B51114210693} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - bitmap - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;gdi32.lib;umpdddi.lib;ole32.lib - - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - bitmap.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.vcxproj.Filters deleted file mode 100644 index a78a5c8a..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/bitmap.vcxproj.Filters +++ /dev/null @@ -1,174 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {5A882741-1FD2-4D80-ACC9-DCFE8F90AD24} - - - h;hpp;hxx;hm;inl;inc;xsd - {A14D506D-8B56-426A-80B4-0CA6D7A24A0B} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {A8C3D9A5-36FC-4F1B-A9A6-605F3BD79ED7} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/ddihook.cpp b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/ddihook.cpp deleted file mode 100644 index 17984513..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/ddihook.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: DDIHook.cpp -// -// -// PURPOSE: Implementation of DDI Hook OEMEndDoc. This function -// dumps the buffered bitmap data out. -// - - -#include "precomp.h" -#include "bitmap.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -// -// Function prototype is defined in printoem.h -// -BOOL APIENTRY -OEMEndDoc( - SURFOBJ *pso, - FLONG fl - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvEndDoc. - - DrvEndDoc is called by GDI when it has finished - sending a document to the driver for rendering. - - Please refer to DDK documentation for more details. - - This particular implementation of OEMEndDoc performs - the following operations: - - Dump the bitmap file header - - Dump the bitmap info header - - Dump the color table if one exists - - Dump the buffered bitmap data - - Free the memory for the data buffers - -Arguments: - - pso - Defines the surface object - flags - A set of flag bits - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - DWORD dwWritten; - INT cScans; - - if (pOemPDEV->pBufStart) - { - // Fill BitmapFileHeader - // - DWORD dwTotalBytes = pOemPDEV->cbHeaderOffBits + pOemPDEV->bmInfoHeader.biSizeImage; // File size - - pOemPDEV->bmFileHeader.bfType = 0x4d42; // Signature = 'BM' - pOemPDEV->bmFileHeader.bfSize = dwTotalBytes; // Bytes in whole file. - pOemPDEV->bmFileHeader.bfReserved1 = 0; - pOemPDEV->bmFileHeader.bfReserved2 = 0; - pOemPDEV->bmFileHeader.bfOffBits = pOemPDEV->cbHeaderOffBits; // Offset to bits in file. - - if (pOemPDEV->bColorTable) - pOemPDEV->bmFileHeader.bfOffBits += pOemPDEV->cPalColors * sizeof(ULONG); - - // Num of scanlines - // - cScans = pOemPDEV->bmInfoHeader.biHeight; - - // Flip the biHeight member so that it denotes top-down bitmap - // - pOemPDEV->bmInfoHeader.biHeight = cScans * -1; - - // Dump headers first - // - dwWritten = pDevObj->pDrvProcs->DrvWriteSpoolBuf(pDevObj, (void*)&(pOemPDEV->bmFileHeader), sizeof(BITMAPFILEHEADER)); - dwWritten = pDevObj->pDrvProcs->DrvWriteSpoolBuf(pDevObj, (void*)&(pOemPDEV->bmInfoHeader), sizeof(BITMAPINFOHEADER)); - if (pOemPDEV->bColorTable) - { - dwWritten = pDevObj->pDrvProcs->DrvWriteSpoolBuf(pDevObj, pOemPDEV->prgbq, pOemPDEV->cPalColors * sizeof(ULONG)); - LocalFree(pOemPDEV->prgbq); - } - - // Dump the data now - // - dwWritten = pDevObj->pDrvProcs->DrvWriteSpoolBuf(pDevObj, pOemPDEV->pBufStart, pOemPDEV->bmInfoHeader.biSizeImage); - - // Free memory for the data buffers - // - vFreeBuffer(pOemPDEV); - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvEndDoc)(pso, fl); -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/debug.h b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/debug.h deleted file mode 100644 index 0414569c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/debug.h +++ /dev/null @@ -1,82 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.H -// -// PURPOSE: Define common data types, and external function prototypes -// for debugging functions. Also defines the various debug macros. -// -// - -#pragma once - -///////////////////////////////////////////////////////// -// Macros -///////////////////////////////////////////////////////// -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// WARNING("App passed NULL pointer, ignoring...\n"); -// - -#define DBG_VERBOSE 0 -#define DBG_WARNING 1 -#define DBG_ERROR 2 -#define DBG_NONE 3 - -// VC and Build use different debug defines. -#if defined (DBG) || defined (_DEBUG) - - // __declspec(selectany) ensures that even if this is defined in multiple compilation - // modules, they will all resolve to the same symbol in the linked DLL - __declspec(selectany) INT giDebugLevel = 2; - - #define STRINGIZE(x) #x - #define QUOTE(x) STRINGIZE(x) - #define FILE_AND_LINE __FILE__ "@" QUOTE(__LINE__) - - #define VERBOSE(msg) { if(giDebugLevel <= DBG_VERBOSE) OutputDebugStringA( FILE_AND_LINE ": " msg); } - #define WARNING(msg) { if(giDebugLevel <= DBG_WARNING) OutputDebugStringA( FILE_AND_LINE ": Warning: " msg); } - #define ERR(msg) { if(giDebugLevel <= DBG_ERROR) OutputDebugStringA(FILE_AND_LINE ": Error:" msg); } - #define ASSERT(cond) { if (!(cond)) RIP("\n"); } - #define RIP(msg) { OutputDebugStringA(FILE_AND_LINE ": Error (not recoverable): " msg); DebugBreak(); } - -#else // !DBG - - #define VERBOSE(msg) - #define WARNING(msg) - #define ERR(msg) - #define ASSERT(cond) - #define RIP(msg) - -#endif - - - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/devmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/devmode.cpp deleted file mode 100644 index 7845d5c1..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/devmode.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.cpp -// -// -// PURPOSE: Helper functions for manipulating the DEVMODE. These are commonly -// shared by UI & rendering modules -// - - -#include "precomp.h" -#include "bitmap.h" -#include "debug.h" -#include "devmode.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -BOOL bConvertOEMDevmode( - PCOEMDEV pOEMDevIn, - POEMDEV pOEMDevOut - ) - -/*++ - -Routine Description: - - Converts private DEVMODE members to the - current version. - -Arguments: - - pOEMDevIn - pointer to OEM private devmode - pOEMDevOut - pointer to OEM private devmode - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - if( (NULL == pOEMDevIn) - || - (NULL == pOEMDevOut) - ) - { - ERR("ConvertOEMDevmode() invalid parameters.\r\n"); - return FALSE; - } - - // Check OEM Signature, if it doesn't match ours, - // then just assume DMIn is bad and use defaults. - if(pOEMDevIn->dmOEMExtra.dwSignature == pOEMDevOut->dmOEMExtra.dwSignature) - { - // Set the devmode defaults so that anything the isn't copied over will - // be set to the default value. - pOEMDevOut->dwDriverData = 0; - - // Copy the old structure in to the new using which ever size is the smaller. - // Devmode maybe from newer Devmode (not likely since there is only one), or - // Devmode maybe a newer Devmode, in which case it maybe larger, - // but the first part of the structure should be the same. - - // DESIGN ASSUMPTION: the private DEVMODE structure only gets added to; - // the fields that are in the DEVMODE never change only new fields get added to the end. - - memcpy(pOEMDevOut, pOEMDevIn, __min(pOEMDevOut->dmOEMExtra.dwSize, pOEMDevIn->dmOEMExtra.dwSize)); - - // Re-fill in the size and version fields to indicated - // that the DEVMODE is the current private DEVMODE version. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - } - else - { - // Don't know what the input DEVMODE is, so just use defaults. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->dwDriverData = 0; - } - - return TRUE; -} - - -BOOL bMakeOEMDevmodeValid( - POEMDEV pOEMDevmode - ) - -/*++ - -Routine Description: - - Ensures that private OEM devmode members are valid. - -Arguments: - - pOEMDevmode - pointer to OEM private devmode - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - if(NULL == pOEMDevmode) - { - return FALSE; - } - - // ASSUMPTION: pOEMDevmode is large enough to contain OEMDEV structure. - - // Make sure that dmOEMExtra indicates the current OEMDEV structure. - pOEMDevmode->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevmode->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevmode->dmOEMExtra.dwVersion = OEM_VERSION; - - // Set driver data. - pOEMDevmode->dwDriverData = 0; - - return TRUE; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/devmode.h b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/devmode.h deleted file mode 100644 index 5f62454f..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/devmode.h +++ /dev/null @@ -1,37 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.h -// -// -// PURPOSE: Define common data types, and external function prototypes -// for devmode functions. -// - -#pragma once - -//////////////////////////////////////////////////////// -// OEM Private Devmode Definition -//////////////////////////////////////////////////////// - -typedef struct tagOEMDEV -{ - OEM_DMEXTRAHEADER dmOEMExtra; - BOOL dwDriverData; -} OEMDEV, *POEMDEV; - -typedef const OEMDEV *PCOEMDEV; - -///////////////////////////////////////////////////////// -// ProtoTypes -///////////////////////////////////////////////////////// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam); -BOOL bConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut); -BOOL bMakeOEMDevmodeValid(POEMDEV pOEMDevmode); - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/dllentry.cpp b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/dllentry.cpp deleted file mode 100644 index 4483a741..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/dllentry.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cpp -// -// -// PURPOSE: Source module for DLL entry function(s). -// - - -#include "precomp.h" -#include "bitmap.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -/////////////////////////////////////////////////////////// -// -// DLL entry point -// - -BOOL WINAPI DllMain(HINSTANCE hInst, WORD wReason, LPVOID lpReserved) -{ - UNREFERENCED_PARAMETER(hInst); - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - break; - - case DLL_THREAD_ATTACH: - break; - - case DLL_PROCESS_DETACH: - break; - - case DLL_THREAD_DETACH: - break; - } - - return TRUE; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/intrface.cpp deleted file mode 100644 index dcfdcd6f..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/intrface.cpp +++ /dev/null @@ -1,2048 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.cpp -// -// -// PURPOSE: Interface for User Mode COM Customization DLL. -// - - -#include "precomp.h" - -#include "debug.h" -#include "devmode.h" -#include "bitmap.h" -#include "intrface.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -// ================================================================== -// Internal Globals -// -static long g_cComponents; // Count of active components -static long g_cServerLocks; // Count of locks -// -// ================================================================== - -// ================================================================== -// The purpose of this array is to inform UNIDRV of the callbacks -// that are implemented in this driver. -// -// Note that there is *NO* order dependency in this array. New -// index values and their corresponding callbacks can be placed -// anywhere within the list as needed. -// -static const DRVFN s_aOemHookFuncs[] = -{ - {INDEX_DrvEndDoc, (PFN)OEMEndDoc} -}; - - -//////////////////////////////////////////////////////////////////////////////// -// -// COemUni2 body -// -COemUni2::COemUni2() -{ - m_cRef = 1; - - // Increment COM component count. - InterlockedIncrement(&g_cComponents); - - m_pOEMHelp = NULL; - -} - -COemUni2::~COemUni2() -{ - // Make sure that helper interface is released. - if(NULL != m_pOEMHelp) - { - m_pOEMHelp->Release(); - m_pOEMHelp = NULL; - } - - // If this instance of the object is being deleted, then the reference - // count should be zero. - assert(0 == m_cRef); -} - -HRESULT __stdcall -COemUni2:: -QueryInterface( - const IID& iid, - void** ppv - ) -{ - - if (iid == IID_IUnknown) - { - *ppv = static_cast(this); - } - else if (iid == IID_IPrintOemUni2) - { - *ppv = static_cast(this); - } - else - { - WARNING("COemUni2::QueryInterface NULL. Returning E_NOINTERFACE.\r\n"); - - *ppv = NULL; - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -ULONG __stdcall -COemUni2:: -AddRef( - VOID - ) -{ - return InterlockedIncrement(&m_cRef); -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall -COemUni2:: -Release( - VOID - ) -{ - ULONG cRef = InterlockedDecrement(&m_cRef); - - if (cRef == 0) - { - delete this; - return 0; - } - return cRef; -} - -HRESULT __stdcall -COemUni2:: -CommandCallback( - PDEVOBJ pdevobj, - DWORD dwCallbackID, - DWORD dwCount, - PDWORD pdwParams, - OUT INT *piResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::CommandCallback - - The IPrintOemUni::CommandCallback method is used - to provide dynamically generated printer commands - for Unidrv-supported printers. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - dwCallbackID - value representing the printer command's - *CallbackID attribute in the printer's generic printer - description (GPD) file. - dwCount - value representing the number of elements - in the array pointed to by pdwParams. Can be 0. - pdwParams - pointer to an array of DWORD-sized parameters - containing values specified by the printer commands - *Params attribute in the printer's GPD file. Can be NULL. - piResult - Receives a method-supplied result value. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(dwCallbackID); - UNREFERENCED_PARAMETER(dwCount); - UNREFERENCED_PARAMETER(pdwParams); - - *piResult = 0; - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -Compression( - PDEVOBJ pdevobj, - PBYTE pInBuf, - PBYTE pOutBuf, - DWORD dwInLen, - DWORD dwOutLen, - OUT INT *piResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::Compression - - The IPrintOemUni::Compression method can be used - with Unidrv-supported printers to provide a customized - bitmap compression method. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pInBuf - pointer to input scan line data. - pOutBuf - pointer to an output buffer to receive - compressed scan line data. - dwInLen - length of the input data. - dwOutLen - length of the output buffer. - piResult - Receives a method-supplied result value. If the - operation succeeds, this value should be the number - of compressed bytes, which must not be larger than - the value received for dwOutLen. If an error occurs, - or if the method cannot compress, the result value - should be -1. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pInBuf); - UNREFERENCED_PARAMETER(pOutBuf); - UNREFERENCED_PARAMETER(dwInLen); - UNREFERENCED_PARAMETER(dwOutLen); - UNREFERENCED_PARAMETER(piResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -DevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DevMode - - The IPrintOemUni::DevMode method, provided by - rendering plug-ins for Unidrv, performs operations - on private DEVMODE members. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::DevMode method. - - The IPrintOemUni::DevMode method, provided by - rendering plug-ins for Unidrv, performs operations - on private DEVMODE members. When both UI and rendering - plug-ins are present in a driver, this functionality - should be factored out to be common to both modules, and - provide the same behavior. - - Please refer to DDK documentation for more details. - -Arguments: - - dwMode - caller-supplied constant. Refer to the docs - for more information. - pOemDMParam - pointer to an OEMDMPARAM structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - POEMDEV pOEMDevIn; - POEMDEV pOEMDevOut; - - // Verify parameters. - if( (NULL == pOemDMParam) - || - ( (OEMDM_SIZE != dwMode) - && - (OEMDM_DEFAULT != dwMode) - && - (OEMDM_CONVERT != dwMode) - && - (OEMDM_MERGE != dwMode) - )) - { - ERR("DevMode() ERROR_INVALID_PARAMETER.\r\n"); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Cast generic (i.e. PVOID) to OEM private devmode pointer type. - pOEMDevIn = (POEMDEV) pOemDMParam->pOEMDMIn; - pOEMDevOut = (POEMDEV) pOemDMParam->pOEMDMOut; - - switch(dwMode) - { - case OEMDM_SIZE: - pOemDMParam->cbBufSize = sizeof(OEMDEV); - break; - - case OEMDM_DEFAULT: - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->dwDriverData = 0; - break; - - case OEMDM_CONVERT: - bConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - break; - - case OEMDM_MERGE: - bConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - bMakeOEMDevmodeValid(pOEMDevOut); - break; - } - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -DisableDriver( - VOID - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DisableDriver - - The IPrintOemUni::DisableDriver method allows - a rendering plug-in for Unidrv to free resources - that were allocated by the plug-in's - IPrintOemUni::EnableDriver method. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::DisableDriver method. - - The IPrintOemUni::DisableDriver method allows a rendering - plug-in for Unidrv to free resources that were allocated by the - plug-in's IPrintOemUni::EnableDriver method. This is the last - IPrintOemUni interface method that is called before the rendering - plug-in is unloaded. - - Please refer to DDK documentation for more details. - -Arguments: - - VOID - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - // Release reference to Printer Driver's interface. - // - if (this->m_pOEMHelp) - { - this->m_pOEMHelp->Release(); - this->m_pOEMHelp = NULL; - } - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -DisablePDEV( - PDEVOBJ pdevobj - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DisablePDEV - - The IPrintOemUni::DisablePDEV method allows a rendering - plug-in for Unidrv to delete the private PDEV structure that - was allocated by its IPrintOemUni::EnablePDEV method. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::DisablePDEV method. - - The IPrintOemUni::DisablePDEV method performs the same types of - operations as the DrvDisablePDEV function. Its purpose is to allow a - rendering plug-in to delete the private PDEV structure that is pointed - to by the DEVOBJ structure's pdevOEM member. This PDEV structure - is one that was allocated by the plug-in's IPrintOemUni::EnablePDEV method. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - // Release our COemPDEV instance created by the call to - // EnablePDEV. - // - POEMPDEV pOemPDEV = (POEMPDEV)pdevobj->pdevOEM; - delete pOemPDEV; - pOemPDEV = NULL; - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -DownloadCharGlyph( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - HGLYPH hGlyph, - PDWORD pdwWidth, - OUT DWORD *pdwResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DownloadCharGlyph - - The IPrintOemUni::DownloadCharGlyph method enables a - rendering plug-in for Unidrv to send a character glyph for - a specified soft font to the printer. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - hGlyph - glyph handle. - pdwWidth - pointer to receive the method-supplied width of the character. - pdwResult - Receives a method-supplied value representing the amount - of printer memory, in bytes, required to store the character glyph. - If the operation fails, the returned value should be zero. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(hGlyph); - UNREFERENCED_PARAMETER(pdwWidth); - UNREFERENCED_PARAMETER(pdwResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -DownloadFontHeader( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DownloadFontHeader - - The IPrintOemUni::DownloadFontHeader method allows a - rendering plug-in for Unidrv to send a font's header - information to a printer. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - pdwResult - Receives a method-supplied value representing the amount - of printer memory, in bytes, required to store the font header - information. If the operation fails, the returned value should be zero. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(pdwResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -DriverDMS( - PVOID pDevObj, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DriverDMS - - The IPrintOemUni::DriverDMS method allows a rendering - plug-in for Unidrv to indicate that it uses a device-managed - drawing surface instead of the default GDI-managed surface. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::DriverDMS method. - - Please refer to DDK documentation for more details. For general info - on device managed surfaces and how to handle them, please refer to - the section titled "Handling Device-Managed Surfaces". - -Arguments: - - pDevObj - pointer to a DEVOBJ structure. - pBuffer - pointer to a buffer to receive method-specified flags. - cbSize - size, in bytes, of the buffer pointed to by pBuffer. - pcbNeeded - pointer to a location to receive the required - minimum pBuffer size. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pDevObj); - UNREFERENCED_PARAMETER(pBuffer); - UNREFERENCED_PARAMETER(cbSize); - UNREFERENCED_PARAMETER(pcbNeeded); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -EnableDriver( - DWORD dwDriverVersion, - DWORD cbSize, - PDRVENABLEDATA pded - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::EnableDriver - - The IPrintOemUni::EnableDriver method allows a rendering - plug-in for Unidrv to hook out some graphics DDI functions. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::EnableDriver method. - - The IPrintOemUni::EnableDriver method allows a rendering - plug-in to perform the same types of operations as the - DrvEnableDriver function. Like the DrvEnableDriver function, - the IPrintOemUni::EnableDriver method is responsible for - providing addresses of internally supported graphics DDI functions, - or DDI hook functions. - - The method should fill the supplied DRVENABLEDATA structure - and allocate an array of DRVFN structures. It should fill the - array with pointers to hooking functions, along with winddi.h-defined - index values that identify the hooked out graphics DDI functions. - - Please refer to DDK documentation for more details. - -Arguments: - - DriverVersion - interface version number. This value is - defined by PRINTER_OEMINTF_VERSION, in printoem.h. - cbSize - size, in bytes, of the structure pointed to by pded. - pded - pointer to a DRVENABLEDATA structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - UNREFERENCED_PARAMETER(dwDriverVersion); - UNREFERENCED_PARAMETER(cbSize); - - // We need to return the DDI functions that have been hooked - // in pded. Here we fill out the fields in pded. - // - pded->iDriverVersion = PRINTER_OEMINTF_VERSION; - pded->c = _countof(s_aOemHookFuncs); - pded->pdrvfn = (DRVFN *) s_aOemHookFuncs; - - // Even if nothing is done, need to return S_OK so - // that DisableDriver() will be called, which releases - // the reference to the Printer Driver's interface. - // - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -EnablePDEV( - PDEVOBJ pdevobj, - _In_ PWSTR pPrinterName, - ULONG cPatterns, - HSURF *phsurfPatterns, - ULONG cjGdiInfo, - GDIINFO *pGdiInfo, - ULONG cjDevInfo, - DEVINFO *pDevInfo, - DRVENABLEDATA *pded, - OUT PDEVOEM *pDevOem - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::EnablePDEV - - The IPrintOemUni::EnablePDEV method allows a rendering - plug-in for Unidrv to create its own PDEV structure. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::EnablePDEV method. - - The IPrintOemUni::EnablePDEV method performs the same types - of operations as the DrvEnablePDEV function that is exported - by a printer graphics DLL. Its purpose is to allow a rendering - plug-in to create its own PDEV structure. For more information - about PDEV structures, see "Customized PDEV Structures" in the DDK docs. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pPrinterName - pointer to a text string representing the - logical address of the printer. - cPatterns - value representing the number of HSURF-typed - surface handles contained in the buffer pointed to by - phsurfPatterns. - phsurfPatterns - pointer to a buffer that is large enough to - contain cPatterns number of HSURF-typed surface handles. - The handles represent surface fill patterns. - cjGdiInfo - value representing the size of the structure pointed - to by pGdiInfo. - pGdiInfo - pointer to a GDIINFO structure. - cjDevInfo - value representing the size of the structure pointed - to by pDevInfo. - pDevInfo - pointer to a DEVINFO structure. - pded - pointer to a DRVENABLEDATA structure containing the - addresses of the printer driver's graphics DDI hooking functions. - pDevOem - Receives a method-supplied pointer to a private PDEV structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - If the operation fails, the method should call SetLastError to set an error code. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(cPatterns); - UNREFERENCED_PARAMETER(phsurfPatterns); - UNREFERENCED_PARAMETER(cjGdiInfo); - UNREFERENCED_PARAMETER(cjDevInfo); - - // Allocate an instance of our private PDEV. - // - POEMPDEV pOemPDEV = new COemPDEV(); - - if (NULL == pOemPDEV) - { - return E_FAIL; - } - - pOemPDEV->InitializeDDITable(pded); - - // Initializing private oempdev stuff - // - pOemPDEV->bHeadersFilled = FALSE; - pOemPDEV->bColorTable = FALSE; - pOemPDEV->cbHeaderOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER); - pOemPDEV->bmInfoHeader.biHeight = 0; - pOemPDEV->bmInfoHeader.biSizeImage = 0; - pOemPDEV->pBufStart = NULL; - pOemPDEV->dwBufSize = 0; - - // We create a BGR palette for 24bpp so that we can avoid color byte order manipulation - // - if (pGdiInfo->cBitsPixel == 24) - pDevInfo->hpalDefault = EngCreatePalette(PAL_BGR, 0, 0, 0, 0, 0); - - // Store the handle to the default palette so that we can fill the color table later - // - pOemPDEV->hpalDefault = pDevInfo->hpalDefault; - - *pDevOem = pOemPDEV; - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -FilterGraphics( - PDEVOBJ pdevobj, - PBYTE pBuf, - DWORD dwLen - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::FilterGraphics - - The IPrintOemUni::FilterGraphics method can be used with - Unidrv-supported printers to modify scan line data and send - it to the spooler. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pBuf - pointer to a buffer containing scan line data to be printed. - dwLen - value representing the length, in bytes, of the data - pointed to by pBuf. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - DWORD dwResult; - - m_pOEMHelp->DrvWriteSpoolBuf(pdevobj, pBuf, dwLen, &dwResult); - - if (dwResult == dwLen) - return S_OK; - else - return S_FALSE; -} - -HRESULT __stdcall -COemUni2:: -GetImplementedMethod( - _In_ PSTR pMethodName - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::GetImplementedMethod - - The IPrintOemUni::GetImplementedMethod method is used by - Unidrv to determine which IPrintOemUni interface methods - have been implemented by a rendering plug-in. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::GetImplemented method. - - Please refer to DDK documentation for more details. - -Arguments: - - pMethodName - pointer to a string representing the name of an - IPrintOemUni interface method, such as "ImageProcessing" - for IPrintOemUni::ImageProcessing or "FilterGraphics" for - IPrintOemUni::FilterGraphics. - -Return Value: - - S_OK The operation succeeded (the specified method is implemented). - S_FALSE The operation failed (the specified method is not implemented). - - ---*/ - -{ - HRESULT Result = S_FALSE; - - // Unidrv only calls GetImplementedMethod for optional - // methods. The required methods are assumed to be - // supported. - - // Return S_OK for supported function (i.e. implemented), - // and S_FALSE for functions that aren't supported (i.e. not implemented). - switch (*pMethodName) - { - case 'C': - if (!strcmp(NAME_CommandCallback, pMethodName)) - { - Result = S_OK; - } - break; - case 'F': - if (!strcmp(NAME_FilterGraphics, pMethodName)) - { - Result = S_OK; - } - break; - case 'I': - if (!strcmp(NAME_ImageProcessing, pMethodName)) - { - Result = S_OK; - } - break; - } - - return Result; -} - -HRESULT __stdcall -COemUni2:: -GetInfo( - DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::GetInfo - - A rendering plug-in's IPrintOemUni::GetInfo method returns - identification information. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::GetInfo method. - - Please refer to DDK documentation for more details. - -Arguments: - - dwMode - Contains one of the following caller-supplied integer constants. - OEMGI_GETSIGNATURE - The method must return a unique four-byte - identification signature. The plug-in must also place this signature - in OPTITEM structures, as described in the description of the - OEMCUIPPARAM. structure's pOEMOptItems member. - OEMGI_GETVERSION - The method must return the user interface - plug-in's version number as a DWORD. The version format is - developer-defined. - pBuffer - pointer to memory allocated to receive the information specified - by dwInfo. - cbSize - size of the buffer pointed to by pBuffer. - pcbNeeded - pointer to a location to receive the number of bytes written - into the buffer pointed to by pBuffer. - -Return Value: - - S_OK The operation succeeded (the specified method is implemented). - S_FALSE The operation failed (the specified method is not implemented). - - ---*/ - -{ - PWSTR pszTag = L"COemUni2::GetInfo entry."; - switch(dwMode) - { - case OEMGI_GETSIGNATURE: pszTag = L"COemUni2::GetInfo entry. [OEMGI_GETSIGNATURE]"; break; - case OEMGI_GETVERSION: pszTag = L"COemUni2::GetInfo entry. [OEMGI_GETVERSION]"; break; - - } - - // Validate parameters. - if( (NULL == pcbNeeded) - || - ( (OEMGI_GETSIGNATURE != dwMode) - && - (OEMGI_GETVERSION != dwMode) ) ) - { - WARNING("COemUni2::GetInfo() exit pcbNeeded is NULL! ERROR_INVALID_PARAMETER.\r\n"); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Set expected buffer size. - *pcbNeeded = sizeof(DWORD); - - // Check buffer size is sufficient. If not, return error, and also ensure that - // the required buffer size is provided to the caller. - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return E_FAIL; - } - - switch(dwMode) - { - // OEM DLL Signature - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // OEM DLL version - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // dwMode not supported. - default: - // Set written bytes to zero since nothing was written. - WARNING("COemUni2::GetInfo() exit mode not supported.\r\n"); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - return E_FAIL; - } - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -HalftonePattern( - PDEVOBJ pdevobj, - PBYTE pHTPattern, - DWORD dwHTPatternX, - DWORD dwHTPatternY, - DWORD dwHTNumPatterns, - DWORD dwCallbackID, - PBYTE pResource, - DWORD dwResourceSize - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::HalftonePattern - - The IPrintOemUni::HalftonePattern method can be used with - Unidrv-supported printers to create or modify a halftone - pattern before it is used in a halftoning operation. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pHTPattern - pointer to a buffer to receive the method-supplied - halftone pattern. Buffer size, in bytes, is: - (((dwHTPatternX * dwHTPatternY) + 3)/4) * 4 * dwHTNumPatterns. - dwHTPatternX - length, in pixels, of the halftone pattern, as specified - by the GPD file's *HTPatternSize attribute. - dwHTPatternY - height, in pixels, of the halftone pattern, as specified - by the GPD file's *HTPatternSize attribute. - dwHTNumPatterns - number of patterns, as specified by the GPD file's - *HTNumPatterns attribute. This can be 1 or 3. - dwCallbackID - value identifying the halftone method, as specified by - the GPD file's *HTCallbackID attribute. - pResource - pointer to a buffer containing a halftone pattern, as - specified by the GPD file's *rcHTPatternID attribute. This can be NULL. - dwResourceSize - size of the halftone pattern contained in the buffer - pointed to by pResource. This is zero if pResource is NULL. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pHTPattern); - UNREFERENCED_PARAMETER(dwHTPatternX); - UNREFERENCED_PARAMETER(dwHTPatternY); - UNREFERENCED_PARAMETER(dwHTNumPatterns); - UNREFERENCED_PARAMETER(dwCallbackID); - UNREFERENCED_PARAMETER(pResource); - UNREFERENCED_PARAMETER(dwResourceSize); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -ImageProcessing( - PDEVOBJ pdevobj, - PBYTE pSrcBitmap, - PBITMAPINFOHEADER pBitmapInfoHeader, - PBYTE pColorTable, - DWORD dwCallbackID, - PIPPARAMS pIPParams, - OUT PBYTE *ppbResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::ImageProcessing - - The IPrintOemUni::ImageProcessing method can be used with - Unidrv-supported printers to modify image bitmap data, in order - to perform color formatting or halftoning. The method can return - the modified bitmap to Unidrv or send it directly to the print spooler. - - Please refer to DDK documentation for more details. - - The algorithm for this particular implementation of ImageProcessing is as follows. - - If headers have not been filled as yet, fill them. - - We fill out only the info header and the color table here. The file header is filled - out in OEMEndDoc. - - The height and image size in the bitmap info header are updated every time - we enter ImageProcessing. - - Increase the size of the data buffer by the size of the current band. - - Copy over the data from the current band to the buffer. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pSrcBitmap - pointer to an input device-independent bitmap (DIB). - pBitmapInfoHeader - pointer to a BITMAPINFOHEADER structure - that describes the bitmap pointed to by pSrcBitmap. - pColorTable - pointer to a color table. Used only if the output format is - eight bits per pixel. - dwCallbackID - value assigned to the *IPCallbackID attribute of the - currently selected option for the ColorMode feature. - pIPParams - pointer to an IPPARAMS structure. - ppbResult - - If the method returns the converted DIB to Unidrv: - If the conversion succeeds, the method should return a - pointer to a buffer containing the converted DIB. - Otherwise it should return NULL. - If the method sends the converted DIB to the print spooler: - If the operation succeeds, the method should return TRUE. - Otherwise it should return FALSE. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pColorTable); - - POEMPDEV pOemPDEV = (POEMPDEV)pdevobj->pdevOEM; - - // We want to set ppbResult to NULL in case this function fails and returns E_FAIL - // - *ppbResult = NULL; - - // We want to keep track of the current offset from the start - // of the buffer before the size is increased. - // - DWORD dwBufOffset = pOemPDEV->dwBufSize; - - // We fill out the file header in OEMEndDoc. But for the info header, we take the easy route - // and copy the stuff from pBitmapInfoHeader. Only height and image size will be updated - // every time we enter ImageProcessing. - // - if (!pOemPDEV->bHeadersFilled) - { - ULONG ulMonoPalette[2] = { RGB_BLACK, RGB_WHITE, }; - - pOemPDEV->bHeadersFilled = TRUE; - pOemPDEV->bmInfoHeader.biSize = pBitmapInfoHeader->biSize; - pOemPDEV->bmInfoHeader.biPlanes = pBitmapInfoHeader->biPlanes; - pOemPDEV->bmInfoHeader.biBitCount = pBitmapInfoHeader->biBitCount; - pOemPDEV->bmInfoHeader.biCompression = pBitmapInfoHeader->biCompression; - pOemPDEV->bmInfoHeader.biXPelsPerMeter = pBitmapInfoHeader->biXPelsPerMeter; - pOemPDEV->bmInfoHeader.biYPelsPerMeter = pBitmapInfoHeader->biYPelsPerMeter; - pOemPDEV->bmInfoHeader.biClrUsed = pBitmapInfoHeader->biClrUsed; - pOemPDEV->bmInfoHeader.biClrImportant = pBitmapInfoHeader->biClrImportant; - pOemPDEV->bmInfoHeader.biWidth = pBitmapInfoHeader->biWidth; // We support only Portrait. So width is constant and needs to be updated only once. - - if (dwCallbackID != BMF_24BPP) // We need color table only if it is not 24bpp - { - DWORD cbMemAllocSize; - - pOemPDEV->bColorTable = TRUE; // Indicates that color table needs to be dumped at EndDoc time - - switch(dwCallbackID) - { - case BMF_1BPP: // 1 - pOemPDEV->cPalColors = 2; - - pOemPDEV->prgbq = NULL; - - // Call intsafe.h function to ensure there's no integer overflow or underflow - if (!SUCCEEDED(DWordMult(pOemPDEV->cPalColors, sizeof(RGBQUAD), &cbMemAllocSize)) || - (NULL == (pOemPDEV->prgbq = (RGBQUAD *)LocalAlloc(LPTR, cbMemAllocSize)))) - { - return E_FAIL; - } - - for (int i = 0; i < pOemPDEV->cPalColors; i++) - { - pOemPDEV->prgbq[i].rgbBlue = GetBValue(ulMonoPalette[i]); - pOemPDEV->prgbq[i].rgbGreen = GetGValue(ulMonoPalette[i]); - pOemPDEV->prgbq[i].rgbRed = GetRValue(ulMonoPalette[i]); - } - break; - case BMF_4BPP: // 2 - pOemPDEV->cPalColors = 16; - if (!bFillColorTable(pOemPDEV)) - return E_FAIL; - break; - case BMF_8BPP: // 3 - pOemPDEV->cPalColors = 256; - if (!bFillColorTable(pOemPDEV)) - return E_FAIL; - break; - } - } - - } - - // Keep track of the overall height and image size - // - pOemPDEV->bmInfoHeader.biHeight += pBitmapInfoHeader->biHeight; - pOemPDEV->bmInfoHeader.biSizeImage += pBitmapInfoHeader->biSizeImage; - - // Increase the buffer by the size of the current band - // - if (!bGrowBuffer(pOemPDEV, pBitmapInfoHeader->biSizeImage)) - return E_FAIL; - - if (!pIPParams->bBlankBand) // Non-blank band - { - CopyMemory((pOemPDEV->pBufStart + dwBufOffset), pSrcBitmap, pBitmapInfoHeader->biSizeImage); - } - else // For blanks bands, buffer blank scanlines - { - memset((pOemPDEV->pBufStart + dwBufOffset), 0xff, pBitmapInfoHeader->biSizeImage); - } - - // Set ppbResult to TRUE - // - *ppbResult = (LPBYTE)(INT_PTR)(TRUE); - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -MemoryUsage( - PDEVOBJ pdevobj, - POEMMEMORYUSAGE pMemoryUsage - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::MemoryUsage - - The IPrintOemUni::MemoryUsage method can be used with - Unidrv-supported printers to specify the amount of memory - required for use by a rendering plug-in's IPrintOemUni::ImageProcessing - method. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pMemoryUsage - pointer to an OEMMEMORYUSAGE structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pMemoryUsage); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -OutputCharStr( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - DWORD dwType, - DWORD dwCount, - PVOID pGlyph - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::OutputCharStr - - The IPrintOemUni::OutputCharStr method enables a rendering - plug-in to control the printing of font glyphs. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - dwType - value indicating the type of glyph specifier array - pointed to by pGlyph. Valid values are as follows: - TYPE_GLYPHHANDLE The pGlyph array elements are glyph - handles of type HGLYPH. - TYPE_GLYPHID The pGlyph array elements are glyph - identifiers of type DWORD. - dwCount - value representing the number of glyph specifiers in - the array pointed to by pGlyph. - pGlyph - pointer to an array of glyph specifiers, where the array - element type is indicated by dwType. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(dwType); - UNREFERENCED_PARAMETER(dwCount); - UNREFERENCED_PARAMETER(pGlyph); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -PublishDriverInterface( - IUnknown *pIUnknown - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::PublishDriverInterface - - The IPrintOemUni::PublishDriverInterface method allows a - rendering plug-in for Unidrv to obtain the Unidrv driver's - IPrintOemDriverUni interface. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::PublishDriverInterface method and the method - must return S_OK, or the driver will not call the plug-in's other - IPrintOemUni interface methods. - - Please refer to DDK documentation for more details. - -Arguments: - - pIUnknown - pointer to the IUnknown interface of the driver's - IPrintOemDriverUni COM interface. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - // Need to store pointer to Driver Helper functions, if we already haven't. - if (this->m_pOEMHelp == NULL) - { - HRESULT hResult; - - // Get Interface to Helper Functions. - hResult = pIUnknown->QueryInterface(IID_IPrintOemDriverUni, (void** ) &(this->m_pOEMHelp)); - - if(!SUCCEEDED(hResult)) - { - // Make sure that interface pointer reflects interface query failure. - this->m_pOEMHelp = NULL; - - return E_FAIL; - } - } - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -ResetPDEV( - PDEVOBJ pdevobjOld, - PDEVOBJ pdevobjNew - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::ResetPDEV - - The IPrintOemUni::ResetPDEV method allows a rendering - plug-in for Unidrv to reset its PDEV structure. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::ResetPDEV method. - - - A rendering plug-in's IPrintOemUni::ResetPDEV method performs - the same types of operations as the DrvResetPDEV function. During - the processing of an application's call to the Platform SDK ResetDC - function, the IPrintOemUni::ResetPDEV method is called by Unidrv's - DrvResetPDEV function. For more information about when DrvResetPDEV - is called, see its description in the DDK docs. - - The rendering plug-in's private PDEV structure's address is contained - in the pdevOEM member of the DEVOBJ structure pointed to by pdevobjOld. - The IPrintOemUni::ResetPDEV method should use relevant members of this - old structure to fill in the new structure, which is referenced through pdevobjNew. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobjOld - pointer to a DEVOBJ structure containing current PDEV information. - pdevobjNew - pointer to a DEVOBJ structure into which the method should place - new PDEV information. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pdevobjOld); - UNREFERENCED_PARAMETER(pdevobjNew); - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -SendFontCmd( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - PFINVOCATION pFInv - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::SendFontCmd - - The IPrintOemUni::SendFontCmd method enables a rendering - plug-in to modify a printer's font selection command and then - send it to the printer. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - pFInv - pointer to an FINVOCATION structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(pFInv); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -TextOutAsBitmap( - SURFOBJ *pso, - STROBJ *pstro, - FONTOBJ *pfo, - CLIPOBJ *pco, - RECTL *prclExtra, - RECTL *prclOpaque, - BRUSHOBJ *pboFore, - BRUSHOBJ *pboOpaque, - POINTL *pptlOrg, - MIX mix - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::TextOutAsBitmap - - The IPrintOemUni::TextOutAsBitmap method allows a rendering - plug-in to create a bitmap image of a text string, in case a - downloadable font is not available. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface on which to be written. - pstro - Defines the glyphs to be rendered and their positions - pfo - Specifies the font to be used - pco - Defines the clipping path - prclExtra - A NULL-terminated array of rectangles to be filled - prclOpaque - Specifies an opaque rectangle - pboFore - Defines the foreground brush - pboOpaque - Defines the opaque brush - pptlOrg - Pointer to POINT struct , defining th origin - mix - Specifies the foreground and background ROPs for pboFore - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pso); - UNREFERENCED_PARAMETER(pstro); - UNREFERENCED_PARAMETER(pfo); - UNREFERENCED_PARAMETER(pco); - UNREFERENCED_PARAMETER(prclExtra); - UNREFERENCED_PARAMETER(prclOpaque); - UNREFERENCED_PARAMETER(pboFore); - UNREFERENCED_PARAMETER(pboOpaque); - UNREFERENCED_PARAMETER(pptlOrg); - UNREFERENCED_PARAMETER(mix); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -TTDownloadMethod( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::TTDownloadMethod - - The IPrintOemUni::TTDownloadMethod method enables a rendering - plug-in to indicate the format that Unidrv should use for a specified - TrueType soft font. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - pdwResult - Receives one of the following method-supplied constant values: - TTDOWNLOAD_BITMAP Unidrv should download the specified font as bitmaps. - TTDOWNLOAD_DONTCARE Unidrv can select the font format. - TTDOWNLOAD_GRAPHICS Unidrv should print TrueType fonts as graphics, - instead of downloading the font. - TTDOWNLOAD_TTOUTLINE Unidrv should download the specified font as outlines. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(pdwResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -TTYGetInfo( - PDEVOBJ pdevobj, - DWORD dwInfoIndex, - PVOID pOutputBuf, - DWORD dwSize, - DWORD *pcbcNeeded - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::TTYGetInfo - - The IPrintOemUni::TTYGetInfo method enables a rendering plug-in - to supply Unidrv with information relevant to text-only printers. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - dwInfoIndex - constant identifying the type of information being requested. - The following constant values are defined: - OEMTTY_INFO_CODEPAGE - The pOutputBuf parameter points to a - DWORD in which the method should return the number of the - code page to be used. - OEMTTY_INFO_MARGINS - The pOutputBuf parameter points to a - RECT structure in which the method should return page margin - widths, in tenths of millimeters (for example, 20 represents 2 mm). - If the entire page is printable, all margin values must be 0. - OEMTTY_INFO_NUM_UFMS - The pOutputBuf parameter points to a - DWORD in which the method should return the number of resource - IDs of the UFMs for 10, 12, and 17 CPI fonts. To actually obtain - these resource IDs, perform a query using OEMTTY_INFO_UFM_IDS. - OEMTTY_INFO_UFM_IDS - The pOutputBuf parameter points to an array - of DWORDs of sufficient size to hold the number of resource IDs of - the UFMs for 10, 12, and 17 CPI fonts. (This number is obtained by - using OEMTTY_INFO_NUM_UFMS in a query.) The method should - return the resource IDs of the UFMs for 10,12, and 17 CPI fonts. - pOutputBuf - pointer to a buffer to receive the requested information. - dwSize - size, in bytes, of the buffer pointed to by pOutputBuf. - pcbcNeeded - pointer to a location to receive the number of bytes written into - the buffer pointed to by pOutputBuf. If the number of bytes required is - smaller than the number specified by dwSize, the method should supply - the required size and return E_FAIL. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(dwInfoIndex); - UNREFERENCED_PARAMETER(pOutputBuf); - UNREFERENCED_PARAMETER(dwSize); - UNREFERENCED_PARAMETER(pcbcNeeded); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -WritePrinter( - PDEVOBJ pdevobj, - PVOID pBuf, - DWORD cbBuffer, - PDWORD pcbWritten - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni2::WritePrinter - - The IPrintOemUni2::WritePrinter method, if supported, enables a - rendering plug-in to capture all output data generated by a Unidrv - driver. If this method is not supported, the output data would - otherwise be sent to the spooler in a call to the spooler's WritePrinter API. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pBuf - pointer to the first byte of an array of bytes that contains - the output data generated by the Unidrv driver. - cbBuffer - size, in bytes, of the array pointed to by pBuf. - pcbWritten - pointer to a DWORD value that receives the number - of bytes of data that were successfully sent to the plug-in. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pBuf); - UNREFERENCED_PARAMETER(cbBuffer); - UNREFERENCED_PARAMETER(pcbWritten); - - return E_NOTIMPL; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// oem class factory -// -class COemCF : public IClassFactory -{ -public: - // *** IUnknown methods *** - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef)(THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release)(THIS); - - // *** IClassFactory methods *** - STDMETHOD(CreateInstance)(THIS_ - LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID FAR* ppvObject); - - STDMETHOD(LockServer)(THIS_ BOOL bLock); - - - // Constructor - COemCF(): m_cRef(1) { }; - - // Destructor - ~COemCF() { }; - -protected: - LONG m_cRef; - -}; - -/////////////////////////////////////////////////////////// -// -// Class factory body -// -HRESULT __stdcall -COemCF:: -QueryInterface( - const IID& iid, - void** ppv) -{ - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this); - } - else - { - *ppv = NULL; - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -ULONG __stdcall -COemCF:: -AddRef() -{ - return InterlockedIncrement(&m_cRef); -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall -COemCF:: -Release() -{ -// ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - } - return cRef; -} - -// IClassFactory implementation -HRESULT __stdcall -COemCF:: -CreateInstance( - IUnknown* pUnknownOuter, - const IID& iid, - void** ppv) -{ - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Cannot aggregate. - if (pUnknownOuter != NULL) - { - return CLASS_E_NOAGGREGATION; - } - - // Create component. - COemUni2* pOemCP = new COemUni2; - if (pOemCP == NULL) - { - return E_OUTOFMEMORY; - } - - // Get the requested interface. - HRESULT hr = pOemCP->QueryInterface(iid, ppv); - - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - pOemCP->Release(); - return hr; -} - -// LockServer -HRESULT __stdcall -COemCF:: -LockServer( - BOOL bLock - ) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks); - } - else - { - InterlockedDecrement(&g_cServerLocks); - } - return S_OK; -} - - -// -// Registration functions -// - -// -// Can DLL unload now? -// -STDAPI DllCanUnloadNow(void) -{ - // - // To avoid leaving OEM DLL still in memory when Unidrv or Pscript drivers - // are unloaded, Unidrv and Pscript driver ignore the return value of - // DllCanUnloadNow of the OEM DLL, and always call FreeLibrary on the OEMDLL. - // - // If OEM DLL spins off a working thread that also uses the OEM DLL, the - // thread needs to call LoadLibrary and FreeLibraryAndExitThread, otherwise - // it may crash after Unidrv or Pscript calls FreeLibrary. - // - - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK; - } - else - { - return S_FALSE; - } -} - -// -// Get class factory -// -STDAPI DllGetClassObject( - _In_ REFCLSID clsid, - _In_ REFIID iid, - _Outptr_ LPVOID* ppv) -{ - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Can we create this component? - if (clsid != CLSID_OEMRENDER) - { - ERR("DllGetClassObject:\tClass not available!\r\n"); - return CLASS_E_CLASSNOTAVAILABLE; - } - - // Create class factory. - COemCF* pFontCF = new COemCF; // Reference count set to 1 in constructor - if (pFontCF == NULL) - { - ERR("DllGetClassObject:\tOut of Memory!\r\n"); - return E_OUTOFMEMORY; - } - - // Get requested interface. - HRESULT hrResult = pFontCF->QueryInterface(iid, ppv); - pFontCF->Release(); - - return hrResult; -} - -BOOL -bGrowBuffer( - POEMPDEV pOemPDEV, - DWORD dwBufInc - ) - -/*++ - -Routine Description: - - Enlarge the buffer for holding the bitmap data - -Arguments: - - pOemPDEV - Pointer to the private PDEV structure - dwBufInc - Amount to enlarge the buffer by - -Return Value: - - TRUE if successful, FALSE if memory allocation fails - ---*/ - -{ - DWORD dwOldBufferSize; - PBYTE pNewBuffer; - - // Allocate a new buffer whose size is the size of the previous buffer plus the increment - // - dwOldBufferSize = pOemPDEV->pBufStart ? pOemPDEV->dwBufSize : 0; - pOemPDEV->dwBufSize = dwOldBufferSize + dwBufInc; - - if (NULL == (pNewBuffer = (PBYTE)LocalAlloc(LPTR, pOemPDEV->dwBufSize))) - { - WARNING("LocalAlloc failed!\n"); - - vFreeBuffer(pOemPDEV); - - return FALSE; - } - - if (pOemPDEV->pBufStart) // Growing an existing buffer - { - CopyMemory(pNewBuffer, pOemPDEV->pBufStart, dwOldBufferSize); - - LocalFree(pOemPDEV->pBufStart); - pOemPDEV->pBufStart = pNewBuffer; - } - else // First time allocation - { - pOemPDEV->pBufStart = pNewBuffer; - } - - return TRUE; -} - -VOID -vFreeBuffer( - POEMPDEV pOemPDEV - ) - -/*++ - -Routine Description: - - Free the buffer for holding the bitmap data - -Arguments: - - pOemPDEV - Pointer to the private PDEV structure - -Return Value: - - None ---*/ - -{ - if (pOemPDEV->pBufStart) - { - LocalFree(pOemPDEV->pBufStart); - - pOemPDEV->pBufStart = NULL; - pOemPDEV->dwBufSize = 0; - } -} - -BOOL -bFillColorTable( - POEMPDEV pOemPDEV - ) - -/*++ - -Routine Description: - - Fill the color table for the bitmap data. This function - obtains the entries in the default palette and fills the - RGBQUAD structure that represents the color table. - -Arguments: - - pOemPDEV - Pointer to the private PDEV structure - -Return Value: - - TRUE if successful, FALSE if memory allocation for the color table fails - ---*/ - -{ - PALETTEENTRY * pPaletteEntry; - UINT uiPalEntries; - INT iLastPalIndex = pOemPDEV->cPalColors - 1; - DWORD cbMemAllocSize; - - pOemPDEV->prgbq = NULL; - - // Call intsafe.h function to ensure there's no integer overflow or underflow - if (!SUCCEEDED(DWordMult(pOemPDEV->cPalColors, sizeof(RGBQUAD), &cbMemAllocSize)) || - (NULL == (pOemPDEV->prgbq = (RGBQUAD *)LocalAlloc(LPTR, cbMemAllocSize)))) - { - return FALSE; - } - - // Call intsafe.h function to ensure there's no integer overflow or underflow - if (!SUCCEEDED(DWordMult(pOemPDEV->cPalColors, sizeof(PALETTEENTRY), &cbMemAllocSize)) || - (NULL == (pPaletteEntry = (PALETTEENTRY *)LocalAlloc(LPTR, cbMemAllocSize)))) - { - return FALSE; - } - - uiPalEntries = GetPaletteEntries(pOemPDEV->hpalDefault, 0, pOemPDEV->cPalColors, pPaletteEntry); - - if (uiPalEntries == 0) - { - LocalFree(pPaletteEntry); - return FALSE; - } - - for (int i = 0; i < pOemPDEV->cPalColors; i++) - { - pOemPDEV->prgbq[i].rgbBlue = pPaletteEntry[i].peBlue; - pOemPDEV->prgbq[i].rgbGreen = pPaletteEntry[i].peGreen; - pOemPDEV->prgbq[i].rgbRed = pPaletteEntry[i].peRed; - } - - // Set the last index in the color table to white - // - pOemPDEV->prgbq[iLastPalIndex].rgbBlue = 0xff; - pOemPDEV->prgbq[iLastPalIndex].rgbGreen = 0xff; - pOemPDEV->prgbq[iLastPalIndex].rgbRed = 0xff; - - return TRUE; - -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/intrface.h deleted file mode 100644 index 7c992055..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/intrface.h +++ /dev/null @@ -1,287 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.H -// -// -// PURPOSE: Define COM interface for User Mode Printer Customization DLL. -// - - -#pragma once - -///////////////////////////////////////////////////////// -// String Literals -///////////////////////////////////////////////////////// - - -CONST CHAR NAME_CommandCallback[] = "CommandCallback"; -CONST CHAR NAME_FilterGraphics[] = "FilterGraphics"; -CONST CHAR NAME_ImageProcessing[] = "ImageProcessing"; - - -//////////////////////////////////////////////////////////////////////////////// -// -// COemUni2 -// -// Interface for Unidrv OEM sample rendering module -// -class COemUni2 : public IPrintOemUni2 -{ -public: - // *** IUnknown methods *** - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release)(THIS); - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Method for getting the implemented methods. - // Returns S_OK if the given method is implemneted. - // Returns S_FALSE if the given method is notimplemneted. - // - - STDMETHOD(GetImplementedMethod)(THIS_ _In_ PSTR pMethodName); - - // - // Method for OEM to specify DDIs that have been hooked - // - - STDMETHOD(EnableDriver) (THIS_ DWORD DriverVersion, - DWORD cbSize, - PDRVENABLEDATA pded); - - // - // Method to notify OEM plugin that it is no longer required - // - - STDMETHOD(DisableDriver) (THIS); - - // - // Method for OEM plugin to contruct its own PDEV - // - - STDMETHOD(EnablePDEV)(THIS_ PDEVOBJ pdevobj, - _In_ PWSTR pPrinterName, - ULONG cPatterns, - HSURF *phsurfPatterns, - ULONG cjGdiInfo, - GDIINFO *pGdiInfo, - ULONG cjDevInfo, - DEVINFO *pDevInfo, - DRVENABLEDATA *pded, - OUT PDEVOEM *pDevOem); - - // - // Method for OEM to free any resource associated with its PDEV - // - - STDMETHOD(DisablePDEV)(THIS_ PDEVOBJ pdevobj); - - // - // Method for OEM to transfer from old PDEV to new PDEV - // - - STDMETHOD(ResetPDEV)(THIS_ PDEVOBJ pdevobjOld, - PDEVOBJ pdevobjNew); - - // - // Get OEM dll related information - // - - STDMETHOD(GetInfo)(THIS_ DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDriverDMS - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(DriverDMS)(THIS_ PVOID pDevObj, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDevMode - // - - STDMETHOD(DevMode)(THIS_ DWORD dwMode, - POEMDMPARAM pOemDMParam); - - // - // OEMCommandCallback - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(CommandCallback)(THIS_ PDEVOBJ pdevobj, - DWORD dwCallbackID, - DWORD dwCount, - PDWORD pdwParams, - OUT INT *piResult); - - // - // OEMImageProcessing - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(ImageProcessing)(THIS_ PDEVOBJ pdevobj, - PBYTE pSrcBitmap, - PBITMAPINFOHEADER pBitmapInfoHeader, - PBYTE pColorTable, - DWORD dwCallbackID, - PIPPARAMS pIPParams, - OUT PBYTE *ppbResult); - - // - // OEMFilterGraphics - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(FilterGraphics)(THIS_ PDEVOBJ pdevobj, - PBYTE pBuf, - DWORD dwLen); - // - // OEMCompression - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(Compression)(THIS_ PDEVOBJ pdevobj, - PBYTE pInBuf, - PBYTE pOutBuf, - DWORD dwInLen, - DWORD dwOutLen, - OUT INT *piResult); - - // - // OEMHalftone - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(HalftonePattern)(THIS_ PDEVOBJ pdevobj, - PBYTE pHTPattern, - DWORD dwHTPatternX, - DWORD dwHTPatternY, - DWORD dwHTNumPatterns, - DWORD dwCallbackID, - PBYTE pResource, - DWORD dwResourceSize); - - // - // OEMMemoryUsage - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(MemoryUsage)(THIS_ PDEVOBJ pdevobj, - POEMMEMORYUSAGE pMemoryUsage); - - // - // OEMTTYGetInfo - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(TTYGetInfo)(THIS_ PDEVOBJ pdevobj, - DWORD dwInfoIndex, - PVOID pOutputBuf, - DWORD dwSize, - DWORD *pcbcNeeded); - - // - // OEMDownloadFontheader - UNIDRV only - // - - STDMETHOD(DownloadFontHeader)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult); - - // - // OEMDownloadCharGlyph - UNIDRV only - // - - STDMETHOD(DownloadCharGlyph)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - HGLYPH hGlyph, - PDWORD pdwWidth, - OUT DWORD *pdwResult); - - // - // OEMTTDownloadMethod - UNIDRV only - // - - STDMETHOD(TTDownloadMethod)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult); - - // - // OEMOutputCharStr - UNIDRV only - // - - STDMETHOD(OutputCharStr)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - DWORD dwType, - DWORD dwCount, - PVOID pGlyph); - - // - // OEMSendFontCmd - UNIDRV only - // - - - STDMETHOD(SendFontCmd)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - PFINVOCATION pFInv); - - // - // OEMTextOutAsBitmap - UNIDRV only - // - - STDMETHOD(TextOutAsBitmap)(THIS_ SURFOBJ *pso, - STROBJ *pstro, - FONTOBJ *pfo, - CLIPOBJ *pco, - RECTL *prclExtra, - RECTL *prclOpaque, - BRUSHOBJ *pboFore, - BRUSHOBJ *pboOpaque, - POINTL *pptlOrg, - MIX mix); - - // - // IPrintOemUni2 methods - // - - // - // Method for plugin to hook out spooler's WritePrinter API so it - // can get access to output data Universal driver is generating - // - // At DrvEnablePDEV time, Universal driver will call this function with - // pdevobj = NULL, pBuf = NULL, cbBuffer = 0 to detect if the plugin - // implements this function. Plugin should return S_OK to indicate it is - // implementing this function, or return E_NOTIMPL otherwise. - // - // In pcbWritten, plugins should return the number of bytes written to the - // spooler's WritePrinter function. Zero doesn't carry a special meaning, - // errors must be reported through the returned HRESULT. - // - - STDMETHOD(WritePrinter)(THIS_ PDEVOBJ pdevobj, - PVOID pBuf, - DWORD cbBuffer, - PDWORD pcbWritten); - - - COemUni2(); - ~COemUni2(); - -protected: - LONG m_cRef; - IPrintOemDriverUni* m_pOEMHelp; -}; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/precomp.h deleted file mode 100644 index d26e300b..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/precomp.h +++ /dev/null @@ -1,40 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: precomp.H -// -// -// PURPOSE: Required header files external to the current project -// that do not need to be recompiled frequently. -// - - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// StrSafe.h needs to be included last -// to disallow unsafe string functions. -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/resource.h b/print/OEM Printer Customization Plug-in Samples/C++/bitmap/resource.h deleted file mode 100644 index 8e941820..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/bitmap/resource.h +++ /dev/null @@ -1,17 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by OEMUNI.rc -// - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp.gpd b/print/OEM Printer Customization Plug-in Samples/C++/custhlp.gpd deleted file mode 100644 index 23c72bea..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp.gpd +++ /dev/null @@ -1,563 +0,0 @@ -*GPDSpecVersion: "1.0" -*Include: "StdNames.gpd" -*ModelName: "OEM Unidrv Customization Sample" -*MasterUnits: PAIR(1200, 1200) -*ResourceDLL: "unires.dll" -*PrinterType: PAGE -*MaxCopies: 99 - -*%------------------------------------- -*%This is your OEM Custom Help file. -*%------------------------------------- -*HelpFile: "CUSTOMDRV.HLP" - -*PrintRate: 8 -*PrintRateUnit: PPM -*PrintRatePPM: 8 - -*Feature: Orientation -{ - *HelpIndex: 15001 - *rcNameID: =ORIENTATION_DISPLAY - *DefaultOption: PORTRAIT - *Option: PORTRAIT - { - *rcNameID: =PORTRAIT_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.6 - *Cmd: "<1B>&l0O" - } - } - *Option: LANDSCAPE_CC90 - { - *rcNameID: =LANDSCAPE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.6 - *Cmd: "<1B>&l1O" - } - } -} - -*%------------------------------------- -*%This Features std help is replaced with OEM help. -*%Note you need to have *HelpFile: def in the general section. -*%HelpIndex is OEM ref ID -*%------------------------------------- -*Feature: InputBin -{ - *HelpIndex: 15001 - *rcNameID: =PAPER_SOURCE_DISPLAY - *DefaultOption: UPPER - *Option: UPPER - { - *rcNameID: =UPPER_TRAY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l1H" - } - } -} -*Feature: Resolution -{ - *HelpIndex: 15001 - *rcNameID: =RESOLUTION_DISPLAY - *DefaultOption: Option1 - *Option: Option1 - { - *Name: "300 x 300 " =DOTS_PER_INCH - *DPI: PAIR(300, 300) - *TextDPI: PAIR(300, 300) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED,TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.4 - *Cmd: "<1B>%%-12345X" -+ "@PJL COMMENT HP Color LaserJet 5/5M " -+ "Version 0.56<0A>" -+ "@PJL SET RESOLUTION=300<0A>" -+ "@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t300R" - } - } - *Option: Option2 - { - *Name: "150 x 150 " =DOTS_PER_INCH - *DPI: PAIR(150, 150) - *TextDPI: PAIR(300, 300) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED,TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.4 - *Cmd: "<1B>%%-12345X" -+ "@PJL COMMENT HP Color LaserJet 5/5M " -+ "Version 0.56<0A>" -+ "@PJL SET RESOLUTION=150<0A>" -+ "@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t300R" - } - } -} - -*Feature: PaperSize -{ - *HelpIndex: 15001 - *rcNameID: =PAPER_SIZE_DISPLAY - *DefaultOption: LETTER - *Option: LETTER - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *%(9600, 12648) -*% *PrintableArea: PAIR(9600, 12648) - *PrintableArea: PAIR(9564, 12600) -*% *PrintableArea: PAIR(5000,5000) - *PrintableOrigin: PAIR(300, 300) -*% *PrintableOrigin: PAIR(300, 500) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (9600->9592) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (12648->12640) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(9592, 12640) -*% Warning: the following printable origin X is adjusted (300->304) so it is divisible by the resolution X scale. -*% Warning: the following printable origin Y is adjusted (300->304) so it is divisible by the resolution Y scale. - *PrintableOrigin: PAIR(304, 304) - } - } - *CursorOrigin: PAIR(300, 180) - *Command: CmdSelect - { - *%5760 -- 7560 - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t5760x7604Y" - } - } - *case: LANDSCAPE_CC90 - { - *%(9720, 12648) - *PrintableArea: PAIR(9760, 12688) - *PrintableOrigin: PAIR(200, 272) - *CursorOrigin: PAIR(200, 12960) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t7632x5880Y" - } - } - } - } - *Option: LEGAL - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9540, 16248) - *PrintableOrigin: PAIR(300, 300) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (9600->9592) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (16248->16240) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(9592, 16240) -*% Warning: the following printable origin X is adjusted (300->304) so it is divisible by the resolution X scale. -*% Warning: the following printable origin Y is adjusted (300->304) so it is divisible by the resolution Y scale. - *PrintableOrigin: PAIR(304, 304) - } - } - *CursorOrigin: PAIR(300, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t5760x9864Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9760, 16288) - *PrintableOrigin: PAIR(200, 272) - *CursorOrigin: PAIR(200, 16560) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t9792x5880Y" - } - } - } - } - *Option: EXECUTIVE - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(8100, 12000) - *PrintableOrigin: PAIR(300, 300) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (8100->8096) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (12000->11992) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(8096, 11992) -*% Warning: the following printable origin X is adjusted (300->304) so it is divisible by the resolution X scale. -*% Warning: the following printable origin Y is adjusted (300->304) so it is divisible by the resolution Y scale. - *PrintableOrigin: PAIR(304, 304) - } - } - *CursorOrigin: PAIR(300, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t4860x7344Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(8200, 12080) - *PrintableOrigin: PAIR(240, 280) - *CursorOrigin: PAIR(200, 12360) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t7272x4980Y" - } - } - } - } - *Option: A4 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9324, 13476) - *PrintableOrigin: PAIR(300, 300) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (9324->9320) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (13476->13472) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(9320, 13472) -*% Warning: the following printable origin X is adjusted (300->304) so it is divisible by the resolution X scale. -*% Warning: the following printable origin Y is adjusted (300->304) so it is divisible by the resolution Y scale. - *PrintableOrigin: PAIR(304, 304) - } - } - *CursorOrigin: PAIR(300, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t5594x8201Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9464, 13516) - *PrintableOrigin: PAIR(220, 272) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (9464->9456) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (13516->13512) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(9456, 13512) -*% Warning: the following printable origin X is adjusted (220->224) so it is divisible by the resolution X scale. - *PrintableOrigin: PAIR(224, 272) - } - } - *CursorOrigin: PAIR(200, 13788) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t8129x5714Y" - } - } - } - } - *Option: A3 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(13428, 19308) - *PrintableOrigin: PAIR(300, 300) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (13428->13424) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (19308->19304) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(13424, 19304) -*% Warning: the following printable origin X is adjusted (300->304) so it is divisible by the resolution X scale. -*% Warning: the following printable origin Y is adjusted (300->304) so it is divisible by the resolution Y scale. - *PrintableOrigin: PAIR(304, 304) - } - } - *CursorOrigin: PAIR(300, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l27a8c1E<1B>*p0x0Y<1B>*c0t8057x11693Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(13588, 19368) - *PrintableOrigin: PAIR(200, 240) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (13588->13584) so it is divisible by the resolution X scale. - *PrintableArea: PAIR(13584, 19368) - } - } - *CursorOrigin: PAIR(200, 19608) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l27a8c1E<1B>*p0x0Y<1B>*c0t11621x8177Y" - } - } - } - } - *Option: TABLOID - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { -*% *PrintableArea: PAIR(12600, 19800) - *PrintableArea: PAIR(12540, 19740) - *PrintableOrigin: PAIR(300, 300) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (12600->12592) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (19800->19792) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(12592, 19792) -*% Warning: the following printable origin X is adjusted (300->304) so it is divisible by the resolution X scale. -*% Warning: the following printable origin Y is adjusted (300->304) so it is divisible by the resolution Y scale. - *PrintableOrigin: PAIR(304, 304) - } - } - *CursorOrigin: PAIR(300, 200) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l6a8c1E<1B>*p0x0Y<1B>*c0t7560x12000Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(12600, 19800) - *PrintableOrigin: PAIR(300, 300) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (12600->12592) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (19800->19792) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(12592, 19792) -*% Warning: the following printable origin X is adjusted (300->304) so it is divisible by the resolution X scale. -*% Warning: the following printable origin Y is adjusted (300->304) so it is divisible by the resolution Y scale. - *PrintableOrigin: PAIR(304, 304) - } - } - *CursorOrigin: PAIR(200, 20100) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l6a8c1E<1B>*p0x0Y<1B>*c0t11880x7680Y" - } - } - } - } -} -*Feature: MediaType -{ - *HelpIndex: 15001 - *rcNameID: =MEDIA_TYPE_DISPLAY - *DefaultOption: STANDARD - *Option: STANDARD - { - *rcNameID: =PLAIN_PAPER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.14 - *Cmd: "<1B>&l0M" - } - } - *Option: TRANSPARENCY - { - *rcNameID: =TRANSPARENCY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.14 - *Cmd: "<1B>&l4M" - } - } -} -*Feature: ColorMode -{ - *rcNameID: =COLOR_PRINTING_MODE_DISPLAY - *HelpIndex: 12004 - *DefaultOption: 24bpp - *Option: 24bpp - { - *rcNameID: =24BPP_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 24 - *DrvBPP: 24 - *Command: CmdEnableDRC { *Cmd : "<1B>*b3M" } - *PaletteSize: 256 - *PaletteProgrammable? : TRUE - *Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" %d{PaletteIndexToProgram} -+ "I" } - *Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } - *Command: CmdSetSrcBmpWidth { *Cmd : "<1B>*r" %d{RasterDataWidthInBytes / 3}"S" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "<1B>*v1N<1B>*v1O<1B>*l184O<1B>*v6W<0003080808081B>*v0a0b0c7i255a255b255c0I<1B>*" -+ "o3W<060400>" - } - } -} -*Feature: Halftone -{ - *rcNameID: =HALFTONING_DISPLAY - *HelpIndex: 12005 - *DefaultOption: HT_PATSIZE_AUTO - *Option: HT_PATSIZE_AUTO - { - *rcNameID: =HT_AUTO_SELECT_DISPLAY - } - *Option: HT_PATSIZE_SUPERCELL_M - { - *rcNameID: =HT_SUPERCELL_DISPLAY - } - *Option: HT_PATSIZE_6x6_M - { - *rcNameID: =HT_DITHER6X6_DISPLAY - } - *Option: HT_PATSIZE_8x8_M - { - *rcNameID: =HT_DITHER8X8_DISPLAY - } -} -*Command: CmdStartDoc -{ - *Order: DOC_SETUP.5 - *Cmd: "<1B>&u300D<1B>*r0F" -} -*Command: CmdStartPage -{ - *Order: PAGE_SETUP.1 - *Cmd: "<1B>*b0M<0D>" -} -*Command: CmdEndJob -{ - *Order: JOB_FINISH.1 - *Cmd: "<1B>E<1B>%%-12345X" -} -*Command: CmdCopies -{ - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l" %d{NumOfCopies}"X" -} -*RotateCoordinate?: TRUE -*RotateRaster?: TRUE -*RotateFont?: TRUE -*TextCaps: LIST(TC_CR_90,TC_UA_ABLE) -*MemoryUsage: LIST(FONT) -*CursorXAfterCR: AT_PRINTABLE_X_ORIGIN -*BadCursorMoveInGrxMode: LIST(X_PORTRAIT,Y_LANDSCAPE) -*XMoveThreshold: 0 -*YMoveThreshold: 0 -*XMoveUnit: 300 -*YMoveUnit: 300 -*Command: CmdXMoveAbsolute { *Cmd : "<1B>*p" %d{(DestX / 4) }"X" } -*Command: CmdXMoveRelRight { *Cmd : "<1B>*p+" %d[0,9600]{max_repeat((DestXRel / 4) )}"X" } -*Command: CmdXMoveRelLeft { *Cmd : "<1B>*p-" %d[0,9600]{max_repeat((DestXRel / 4) )}"X" } -*Command: CmdYMoveAbsolute { *Cmd : "<1B>*p" %d{(DestY / 4) }"Y" } -*Command: CmdYMoveRelDown { *Cmd : "<1B>*p+" %d[1,12600]{max_repeat((DestYRel / 4) )}"Y" } -*Command: CmdYMoveRelUp { *Cmd : "<1B>*p-" %d[1,12600]{max_repeat((DestYRel / 4) )}"Y" } -*Command: CmdCR { *Cmd : "<0D>" } -*Command: CmdLF { *Cmd : "<0A>" } -*Command: CmdFF { *Cmd : "<0C>" } -*Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" %d{PaletteIndexToProgram} -+ "I" } -*Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } -*Command: CmdBackSpace { *Cmd : "<08>" } -*Command: CmdUniDirectionOn { *Cmd : "<00>" } -*Command: CmdUniDirectionOff { *Cmd : "<00>" } -*Command: CmdPushCursor { *Cmd : "<1B>&f0S" } -*Command: CmdPopCursor { *Cmd : "<1B>&f1S" } -*Command: CmdSetSimpleRotation { *Cmd : "<1B>&a" %d{PrintDirInCCDegrees}"P" } -*EjectPageWithFF?: TRUE -*Command: CmdEnableTIFF4 { *Cmd : "<1B>*b2M" } -*Command: CmdDisableCompression { *Cmd : "<1B>*b0M" } -*OutputDataFormat: H_BYTE -*OptimizeLeftBound?: TRUE -*CursorXAfterSendBlockData: AT_GRXDATA_ORIGIN -*CursorYAfterSendBlockData: AUTO_INCREMENT - -*DefaultFont: 136 -*DefaultCTT: 0 -*CharPosition: BASELINE -*TTFSEnabled?: TRUE -*DeviceFonts: LIST(134,135,136,137,138,139,140,146,147,148,149,150,151,152,153,154, -+ 155,156,157,164,165,166,196,197,198,199,200,201,202,203,209,210, -+ 211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226, -+ 227,228,229,230) - -*MinFontID: 16534 -*MaxFontID: 32768 -*FontFormat: HPPCL_OUTLINE -*% When the %f format is implemented we can remove the /100 part of -*% CmdSelectFontHeight and CmdSelectFontWidth -*% NOTE: MasterUnits.x is hardcoded here! -*% NOTE: THIS dividing by 200 because I want to /100 and then /2 for now. -*% The number 60000 may look strange, but it's 1200/2 * 100. -*Command: CmdSelectFontHeight { *Cmd : "<1B>(s" %d{FontHeight}"V" } -*Command: CmdSelectFontWidth { *Cmd : "<1B>(s" %f{1200 / FontWidth}"H" } -*Command: CmdSetFontID { *Cmd : "<1B>*c" %d{NextFontID}"D" } -*Command: CmdSelectFontID { *Cmd : "<1B>(" %d{CurrentFontID}"X" } -*Command: CmdSetCharCode { *Cmd : "<1B>*c" %d{NextGlyph}"E" } -*Command: CmdUnderlineOn { *Cmd : "<1B>&dD" } -*Command: CmdUnderlineOff { *Cmd : "<1B>&d@" } -*Command: CmdWhiteTextOn { *Cmd : "<1B>*v1o1T" } -*Command: CmdWhiteTextOff { *Cmd : "<1B>*v0o0T" } -*MinGrayFill: 1 -*MaxGrayFill: 100 -*Command: CmdSetRectWidth { *Cmd : "<1B>*c" %d{(RectXSize / 4) }"A" } -*Command: CmdSetRectHeight { *Cmd : "<1B>*c" %d{(RectYSize / 4) }"B" } -*Command: CmdRectGrayFill { *Cmd : "<1B>*c" %d{GrayPercentage }"g2P" } -*Command: CmdRectWhiteFill { *Cmd : "<1B>*c1P" } -*Command: CmdRectBlackFill { *Cmd : "<1B>*c0P" } diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp.ini b/print/OEM Printer Customization Plug-in Samples/C++/custhlp.ini deleted file mode 100644 index 2e014201..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp.ini +++ /dev/null @@ -1,3 +0,0 @@ -[OEMFiles] -OEMConfigFile1=CUSTHLP.DLL - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/CUSTHLP.def b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/CUSTHLP.def deleted file mode 100644 index 68bdffc0..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/CUSTHLP.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY OEMUI -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/CUSTHLP.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/CUSTHLP.vcxproj deleted file mode 100644 index 60f17f4c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/CUSTHLP.vcxproj +++ /dev/null @@ -1,1060 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {CA70C64A-75C8-48CD-9224-335C2ED689A6} - $(MSBuildProjectName) - Win10 Debug - Win32 - {67281069-E045-4DCB-82BF-17B46979B788} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - CUSTHLP - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - CUSTHLP.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/CUSTHLP.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/CUSTHLP.vcxproj.Filters deleted file mode 100644 index 4c89a16e..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/CUSTHLP.vcxproj.Filters +++ /dev/null @@ -1,220 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {C7019300-D308-4256-B5E7-2CF8880D9E37} - - - h;hpp;hxx;hm;inl;inc;xsd - {8C99BD7D-E931-4BC0-810B-E56E2CE71883} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {B8E59174-9E39-4E27-A90D-17A011B16729} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.cnt b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.cnt deleted file mode 100644 index 4713a3b5..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.cnt +++ /dev/null @@ -1,3 +0,0 @@ -:Base windows.HLP -1 Dialog Box Help -2 Information about this Help file=nocontent diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.h b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.h deleted file mode 100644 index f49cbd14..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.h +++ /dev/null @@ -1,11 +0,0 @@ -// -// -// -// -////////////////////////////////////////////////////////////////// - -#define CUSDRV_HELPTOPIC_1 = 15001 -#define CUSDRV_HELPTOPIC_2 = 15002 -#define CUSDRV_HELPTOPIC_3 = 15003 -#define CUSDRV_HELPTOPIC_4 = 15004 - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.hpj b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.hpj deleted file mode 100644 index 2ccc18db..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.hpj +++ /dev/null @@ -1,17 +0,0 @@ -; This file is maintained by HCW. Do not modify this file directly. - -[OPTIONS] -COMPRESS=12 Hall Zeck -ERRORLOG=customdrv.err -LCID=0x409 0x0 0x0 ; English (United States) -REPORT=Yes -TITLE=Windows -CNT=customdrv.cnt -COPYRIGHT=%date -HLP=customdrv.hlp - -[FILES] -customdrv.rtf - -[MAP] -#include customdrv.h diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.rtf b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.rtf deleted file mode 100644 index 5ddf4b0e..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/customhelp/customdrv.rtf +++ /dev/null @@ -1,22 +0,0 @@ -{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\f30\froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};} -{\f31\froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f33\froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\f34\froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};} -{\f35\froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f36\froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\f37\froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}}{\colortbl;\red0\green0\blue0; -\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128; -\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;} -{\*\cs10 \additive Default Paragraph Font;}{\s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext15 endnote text;}{ -\s16\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext16 footnote text;}{\*\cs17 \additive \super \sbasedon10 footnote reference;}{\*\cs18 \additive \super -\sbasedon10 endnote reference;}{\*\cs19 \additive \fs16\cf0\up6 \sbasedon10 ExternalFN;}{\s20\ql \li0\ri0\widctlpar\tqc\tx4320\tqr\tx8640\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 -\sbasedon0 \snext20 header;}{\s21\ql \li0\ri0\widctlpar\tqc\tx4320\tqr\tx8640\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext21 footer;}}{\info{\author Craig Horsfield} -{\operator Craig Horsfield}{\creatim\yr2001\mo2\dy27\hr15\min6}{\revtim\yr2001\mo4\dy2\hr15\min7}{\version5}{\edmins3}{\nofpages3}{\nofwords17}{\nofchars100}{\*\company Microsoft}{\nofcharsws0}{\vern8269}} -\widowctrl\ftnbj\aendnotes\ftnnrlc\aftnnar\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale144\viewzk2\nolnhtadjtbl \fet0\sectd -\linex0\sectdefaultcl {\header \pard\plain \s20\ql \li0\ri0\widctlpar\tqc\tx4320\tqr\tx8640\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 { -\par }}{\footer \pard\plain \s21\ql \li0\ri0\widctlpar\tqc\tx4320\tqr\tx8640\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 { -\par }}{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}} -{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8 -\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 -\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\cs19\fs16\up6 @{\footnote \pard\plain \s16\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\cs17\super @}{ - The following topics are for Custom options in the Custom Driver UI Plugin.}} #{\footnote \pard\plain \s16\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\cs17\super #}{ - CUSDRV_HELPTOPIC_1}}}{ Custom Topic 1 Help text contained in customdrv.rtf. -\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\page }{\cs19\fs16\up6 #{\footnote \pard\plain \s16\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\cs17\super #}{ - CUSDRV_HELPTOPIC_2}}}{ Custom Topic 2 Help text contained in customdrv.rtf. }{\fs20 \page }{ -\par }} \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/debug.h b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/debug.h deleted file mode 100644 index 0414569c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/debug.h +++ /dev/null @@ -1,82 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.H -// -// PURPOSE: Define common data types, and external function prototypes -// for debugging functions. Also defines the various debug macros. -// -// - -#pragma once - -///////////////////////////////////////////////////////// -// Macros -///////////////////////////////////////////////////////// -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// WARNING("App passed NULL pointer, ignoring...\n"); -// - -#define DBG_VERBOSE 0 -#define DBG_WARNING 1 -#define DBG_ERROR 2 -#define DBG_NONE 3 - -// VC and Build use different debug defines. -#if defined (DBG) || defined (_DEBUG) - - // __declspec(selectany) ensures that even if this is defined in multiple compilation - // modules, they will all resolve to the same symbol in the linked DLL - __declspec(selectany) INT giDebugLevel = 2; - - #define STRINGIZE(x) #x - #define QUOTE(x) STRINGIZE(x) - #define FILE_AND_LINE __FILE__ "@" QUOTE(__LINE__) - - #define VERBOSE(msg) { if(giDebugLevel <= DBG_VERBOSE) OutputDebugStringA( FILE_AND_LINE ": " msg); } - #define WARNING(msg) { if(giDebugLevel <= DBG_WARNING) OutputDebugStringA( FILE_AND_LINE ": Warning: " msg); } - #define ERR(msg) { if(giDebugLevel <= DBG_ERROR) OutputDebugStringA(FILE_AND_LINE ": Error:" msg); } - #define ASSERT(cond) { if (!(cond)) RIP("\n"); } - #define RIP(msg) { OutputDebugStringA(FILE_AND_LINE ": Error (not recoverable): " msg); DebugBreak(); } - -#else // !DBG - - #define VERBOSE(msg) - #define WARNING(msg) - #define ERR(msg) - #define ASSERT(cond) - #define RIP(msg) - -#endif - - - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/devmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/devmode.cpp deleted file mode 100644 index 8dae1ed3..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/devmode.cpp +++ /dev/null @@ -1,182 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.cpp -// -// PURPOSE: Implementation of Devmode functions shared with OEM UI and OEM rendering modules. -// - - -#include "precomp.h" -#include "oemui.h" -#include "debug.h" -#include "devmode.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -// -//Performs operation on UI Plugins Private DevMode Members. -//Called via IOemUI::DevMode -// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam) -{ - POEMDEV pOEMDevIn; - POEMDEV pOEMDevOut; - - - // Verify parameters. - if( (NULL == pOemDMParam) - || - ( (OEMDM_SIZE != dwMode) - && - (OEMDM_DEFAULT != dwMode) - && - (OEMDM_CONVERT != dwMode) - && - (OEMDM_MERGE != dwMode) - ) - ) - { - ERR("DevMode() ERROR_INVALID_PARAMETER.\r\n"); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Cast generic (i.e. PVOID) to OEM private devomode pointer type. - pOEMDevIn = (POEMDEV) pOemDMParam->pOEMDMIn; - pOEMDevOut = (POEMDEV) pOemDMParam->pOEMDMOut; - - switch(dwMode) - { - // - //The Method should return the size of the memory allocation needed to store the UI plugin Private DEVMODE. - // - case OEMDM_SIZE: - pOemDMParam->cbBufSize = sizeof(OEMDEV); - break; - - // - //Should fill the Private DEVMODE with the default values. - // - case OEMDM_DEFAULT: - // - //OEM_DMEXTRAHEADER Members - // - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - - // - //Private members - // - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - break; - - // - //The method should convert private DEVMODE members to the current version, if necessary. - // - case OEMDM_CONVERT: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - break; - - // - //The method should validate the information contained in private DEVMODE members and merge validated values into a private DEVMODE structure containing default values - // - case OEMDM_MERGE: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - MakeOEMDevmodeValid(pOEMDevOut); - break; - } - - return S_OK; -} - - -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut) -{ - if( (NULL == pOEMDevIn) - || - (NULL == pOEMDevOut) - ) - { - ERR("ConvertOEMDevmode() invalid parameters.\r\n"); - return FALSE; - } - - // Check OEM Signature, if it doesn't match ours, - // then just assume DMIn is bad and use defaults. - if(pOEMDevIn->dmOEMExtra.dwSignature == pOEMDevOut->dmOEMExtra.dwSignature) - { - // Set the devmode defaults so that anything the isn't copied over will - // be set to the default value. - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - - // Copy the old structure in to the new using which ever size is the smaller. - // Devmode maybe from newer Devmode (not likely since there is only one), or - // Devmode maybe a newer Devmode, in which case it maybe larger, - // but the first part of the structure should be the same. - - // DESIGN ASSUMPTION: the private DEVMODE structure only gets added to; - // the fields that are in the DEVMODE never change only new fields get added to the end. - - memcpy(pOEMDevOut, pOEMDevIn, __min(pOEMDevOut->dmOEMExtra.dwSize, pOEMDevIn->dmOEMExtra.dwSize)); - - // Re-fill in the size and version fields to indicated - // that the DEVMODE is the current private DEVMODE version. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - } - else - { - WARNING("Unknown DEVMODE signature, pOEMDMIn ignored.\r\n"); - - // Don't know what the input DEVMODE is, so just use defaults. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - } - - return TRUE; -} - - -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode) -{ - if(NULL == pOEMDevmode) - { - return FALSE; - } - - // ASSUMPTION: pOEMDevmode is large enough to contain OEMDEV structure. - - // Make sure that dmOEMExtra indicates the current OEMDEV structure. - pOEMDevmode->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevmode->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevmode->dmOEMExtra.dwVersion = OEM_VERSION; - - // Set driver data, if not valid. - if(pOEMDevmode->dwDriverData > 100) - { - pOEMDevmode->dwDriverData = 0; - } - - // Set Advanced driver data, if not valid. - if(pOEMDevmode->dwAdvancedData > 100) - { - pOEMDevmode->dwAdvancedData = 0; - } - - return TRUE; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/devmode.h b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/devmode.h deleted file mode 100644 index fe594658..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/devmode.h +++ /dev/null @@ -1,46 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.h -// -// PURPOSE: The plug-in private devmode, common data types, and -// external function prototypes for devmode functions. -// - -#pragma once - - -// -//Can add info to the private devmode bellow here. -//Note : -// This structure must be prefixed by OEM_DMEXTRAHEADER -// Your plug-in must implement the IPrintOemUI::DevMode method -// -typedef struct tagOEMDEV -{ - OEM_DMEXTRAHEADER dmOEMExtra; - DWORD dwDriverData; - DWORD dwAdvancedData; - - // - //Private DevMode Members - // - -} OEMDEV, *POEMDEV; - -typedef const OEMDEV *PCOEMDEV; - - -///////////////////////////////////////////////////////// -// ProtoTypes -///////////////////////////////////////////////////////// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam); -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut); -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode); - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/dllentry.cpp b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/dllentry.cpp deleted file mode 100644 index 287c0617..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/dllentry.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cpp -// -// -// PURPOSE: Source module for DLL entry function(s). -// - -#include "precomp.h" -#include "oemui.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -/////////////////////////////////////////////////////////// -// -// DLL entry point -// -BOOL WINAPI DllMain(HINSTANCE hInst, WORD wReason, LPVOID lpReserved) -{ - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - ghInstance = hInst; - break; - - case DLL_THREAD_ATTACH: - break; - - case DLL_PROCESS_DETACH: - break; - - case DLL_THREAD_DETACH: - break; - } - - return TRUE; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/globals.cpp b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/globals.cpp deleted file mode 100644 index c41a27e4..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/globals.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Globals.cpp -// -// -// PURPOSE: File that contains all the globals. -// - -#include "precomp.h" -#include "oemui.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -// Module's Instance handle from DLLEntry of process. -HINSTANCE ghInstance = NULL; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/globals.h b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/globals.h deleted file mode 100644 index b9d707a0..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/globals.h +++ /dev/null @@ -1,22 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Globals.h -// -// PURPOSE: Lists of globals declared in Globals.cpp. -// - - -#pragma once - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -// Module's Instance handle from DLLEntry of process. -extern HINSTANCE ghInstance; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/intrface.cpp deleted file mode 100644 index 2a1278cc..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/intrface.cpp +++ /dev/null @@ -1,562 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: intrface.cpp -// -// PURPOSE: Implementation of OEMGetInfo and OEMDevMode. Shared by all Unidrv -// OEM test dll's. -// - -#include "precomp.h" - -#include "oemui.h" -#include "debug.h" -#include "intrface.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// Internal Globals -//////////////////////////////////////////////////////// - -static long g_cComponents = 0; // Count of active components -static long g_cServerLocks = 0; // Count of locks - - -//////////////////////////////////////////////////////////////////////////////// -// -// IOemUI body -// -IOemUI::~IOemUI() -{ - // Make sure that helper interface is released. - if(NULL != m_pOEMHelp) - { - m_pOEMHelp->Release(); - m_pOEMHelp = NULL; - } - - // If this instance of the object is being deleted, then the reference - // count should be zero. - ASSERT(0 == m_cRef); -} - -HRESULT __stdcall IOemUI::QueryInterface(const IID& iid, void** ppv) -{ - if (iid == IID_IUnknown) - { - *ppv = static_cast(this); - } - else if (iid == IID_IPrintOemUI) - { - *ppv = static_cast(this); - } - else - { - *ppv = NULL; - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -ULONG __stdcall IOemUI::AddRef() -{ - return InterlockedIncrement(&m_cRef); -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemUI::Release() -{ - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -// -// (Implementation is required) Supplies a pointer to UNIDRIVE /PScript IPrintOemDriverUI -// -HRESULT __stdcall IOemUI::PublishDriverInterface( - IUnknown *pIUnknown) -{ - // Need to store pointer to Driver Helper functions, if we already haven't. - if (m_pOEMHelp == NULL) - { - HRESULT hResult; - - - // Get Interface to Helper Functions. - hResult = pIUnknown->QueryInterface(IID_IPrintOemDriverUI, (void** ) &(m_pOEMHelp)); - - if(!SUCCEEDED(hResult)) - { - // Make sure that interface pointer reflects interface query failure. - m_pOEMHelp = NULL; - - return E_FAIL; - } - } - - return S_OK; -} - -// -//(Implementation is required) Returns the UI Plugin's identification information -// -HRESULT __stdcall IOemUI::GetInfo( - DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded) -{ - // Validate parameters. - if( (NULL == pcbNeeded) - || - ( (OEMGI_GETSIGNATURE != dwMode) - && - (OEMGI_GETVERSION != dwMode) - && - (OEMGI_GETPUBLISHERINFO != dwMode) - ) - ) - { - WARNING("IOemUI::GetInfo() exit pcbNeeded is NULL! ERROR_INVALID_PARAMETER\r\r\n"); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Set expected buffer size and number of bytes written. - *pcbNeeded = sizeof(DWORD); - - // Check buffer size is sufficient. - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - WARNING("IOemUI::GetInfo() exit insufficient buffer!\r\r\n"); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return E_FAIL; - } - - switch(dwMode) - { - // OEM DLL Signature - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // OEM DLL version - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // dwMode not supported. - default: - // Set written bytes to zero since nothing was written. - WARNING("IOemUI::GetInfo() exit mode not supported.\r\r\n"); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - return E_FAIL; - } - - return S_OK; -} - - -// -//Performs operation on UI Plugins Private DevMode Members. -// -HRESULT __stdcall IOemUI::DevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam) -{ - return hrOEMDevMode(dwMode, pOemDMParam); -} - - -// -//Allows UI Plugin to Modifiy Existing printer porp sheet and document property sheet page.. -// -HRESULT __stdcall IOemUI::CommonUIProp( - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam) -{ - return hrOEMPropertyPage(dwMode, pOemCUIPParam); -} - - -// -//Adds a New page to the device Documment property sheet. -// - -HRESULT __stdcall IOemUI::DocumentPropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam) -{ - return hrOEMDocumentPropertySheets(pPSUIInfo, lParam, m_pOEMHelp); -} - -// -//Adds a New page to the device printer property page. -// -HRESULT __stdcall IOemUI::DevicePropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam) -{ - return hrOEMDevicePropertySheets(pPSUIInfo, lParam); -} - - -// -//Allows the UI plugin to spec Customized device capabilaties (TODO) -// -HRESULT __stdcall IOemUI::DeviceCapabilities( - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult) -{ - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(pDeviceName); - UNREFERENCED_PARAMETER(wCapability); - UNREFERENCED_PARAMETER(pOutput); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - UNREFERENCED_PARAMETER(dwOld); - UNREFERENCED_PARAMETER(dwResult); - - return E_NOTIMPL; -} - - -// -//Allows the UI plugin to help determine if a print Job is printable. -// -HRESULT __stdcall IOemUI::DevQueryPrintEx( - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM) -{ - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pDQPInfo); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - - return E_NOTIMPL; -} - - -// -//Allows the UI Plugin to upgrade its dev options stored in the registry. -// -HRESULT __stdcall IOemUI::UpgradePrinter( - DWORD dwLevel, - PBYTE pDriverUpgradeInfo) -{ - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverUpgradeInfo); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::PrinterEvent( - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam) -{ - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(iDriverEvent); - UNREFERENCED_PARAMETER(dwFlags); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::DriverEvent( - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam) -{ - UNREFERENCED_PARAMETER(dwDriverEvent); - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - - -HRESULT __stdcall IOemUI::QueryColorProfile( - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulQueryMode, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData) -{ - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - - HRESULT Result = E_FAIL; - static const WCHAR PROFILE_NAME[] = L"OEMPROFILE.icm\0"; - - if(QCP_DEVICEPROFILE == ulQueryMode) - { - if(NULL == pvProfileData) - { - *pcbProfileData = sizeof(PROFILE_NAME); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - } - else - { - if(*pcbProfileData < sizeof(PROFILE_NAME)) - { - *pcbProfileData = sizeof(PROFILE_NAME); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - } - else - { - Result = StringCbCopy((LPWSTR)pvProfileData, *pcbProfileData, PROFILE_NAME); - *pcbProfileData = sizeof(PROFILE_NAME); - *pflProfileData = QCP_PROFILEDISK; - - if(FAILED(Result)) - { - SetLastError(Result); - } - } - } - } - - return Result; -}; - -HRESULT __stdcall IOemUI::FontInstallerDlgProc( - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam) -{ - UNREFERENCED_PARAMETER(hWnd); - UNREFERENCED_PARAMETER(usMsg); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - -HRESULT __stdcall IOemUI::UpdateExternalFonts( - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges) -{ - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(hHeap); - UNREFERENCED_PARAMETER(pwstrCartridges); - - return E_NOTIMPL; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// oem class factory -// -class IOemCF : public IClassFactory -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // *** IClassFactory methods *** - STDMETHOD(CreateInstance) (THIS_ - LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID FAR* ppvObject); - STDMETHOD(LockServer) (THIS_ BOOL bLock); - - - // Constructor - IOemCF(): m_cRef(1) { }; - ~IOemCF() { }; - -protected: - LONG m_cRef; - -}; - -/////////////////////////////////////////////////////////// -// -// Class factory body -// -HRESULT __stdcall IOemCF::QueryInterface(const IID& iid, void** ppv) -{ - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this); - } - else - { - *ppv = NULL; - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -ULONG __stdcall IOemCF::AddRef() -{ - return InterlockedIncrement(&m_cRef); -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemCF::Release() -{ - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -// IClassFactory implementation -HRESULT __stdcall IOemCF::CreateInstance(IUnknown* pUnknownOuter, - const IID& iid, - void** ppv) -{ - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Cannot aggregate. - if (pUnknownOuter != NULL) - { - return CLASS_E_NOAGGREGATION; - } - - // Create component. - IOemUI* pOemCB = new IOemUI; - if (pOemCB == NULL) - { - return E_OUTOFMEMORY; - } - // Get the requested interface. - HRESULT hr = pOemCB->QueryInterface(iid, ppv); - - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - pOemCB->Release(); - return hr; -} - -HRESULT __stdcall IOemCF::LockServer(BOOL bLock) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks); - } - else - { - InterlockedDecrement(&g_cServerLocks); - } - return S_OK; -} - -/////////////////////////////////////////////////////////// -// -// Exported functions -// - - -// Can DLL unload now? -// -STDAPI DllCanUnloadNow() -{ - // - // To avoid leaving OEM DLL still in memory when Unidrv or Pscript drivers - // are unloaded, Unidrv and Pscript driver ignore the return value of - // DllCanUnloadNow of the OEM DLL, and always call FreeLibrary on the OEMDLL. - // - // If OEM DLL spins off a working thread that also uses the OEM DLL, the - // thread needs to call LoadLibrary and FreeLibraryAndExitThread, otherwise - // it may crash after Unidrv or Pscript calls FreeLibrary. - // - - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK; - } - else - { - return S_FALSE; - } -} - -// -// Get class factory -// -STDAPI DllGetClassObject( - _In_ REFCLSID clsid, - _In_ REFIID iid, - _Outptr_ LPVOID* ppv) -{ - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Can we create this component? - if (clsid != CLSID_OEMUI) - { - return CLASS_E_CLASSNOTAVAILABLE; - } - - // Create class factory. - IOemCF* pFontCF = new IOemCF; // Reference count set to 1 - // in constructor - if (pFontCF == NULL) - { - return E_OUTOFMEMORY; - } - - // Get requested interface. - HRESULT hr = pFontCF->QueryInterface(iid, ppv); - pFontCF->Release(); - - return hr; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/intrface.h deleted file mode 100644 index 1cc44e3a..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/intrface.h +++ /dev/null @@ -1,182 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: intrface.h -// -// PURPOSE: Declaration of class that implements the UI plug-in class -// - - -#pragma once - -//////////////////////////////////////////////////////////////////////////////// -// -// IOemUI -// -class IOemUI: public IPrintOemUI -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // *** IPrintOemUI methods *** - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Get OEM dll related information - // - - STDMETHOD(GetInfo) (THIS_ DWORD dwMode, PVOID pBuffer, DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDevMode - // - - STDMETHOD(DevMode) (THIS_ DWORD dwMode, POEMDMPARAM pOemDMParam) ; - - // - // OEMCommonUIProp - // - - STDMETHOD(CommonUIProp) (THIS_ - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam - ); - - // - // OEMDocumentPropertySheets - // - - STDMETHOD(DocumentPropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - // - // OEMDevicePropertySheets - // - - STDMETHOD(DevicePropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - - // - // OEMDevQueryPrintEx - // - - STDMETHOD(DevQueryPrintEx) (THIS_ - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM - ); - - // - // OEMDeviceCapabilities - // - - STDMETHOD(DeviceCapabilities) (THIS_ - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult - ); - - // - // OEMUpgradePrinter - // - - STDMETHOD(UpgradePrinter) (THIS_ - DWORD dwLevel, - PBYTE pDriverUpgradeInfo - ); - - // - // OEMPrinterEvent - // - - STDMETHOD(PrinterEvent) (THIS_ - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam - ); - - // - // OEMDriverEvent - // - - STDMETHOD(DriverEvent)(THIS_ - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam - ); - - // - // OEMQueryColorProfile - // - - STDMETHOD(QueryColorProfile) (THIS_ - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulReserved, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData); - - // - // OEMFontInstallerDlgProc - // - - STDMETHOD(FontInstallerDlgProc) (THIS_ - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam - ); - // - // UpdateExternalFonts - // - - STDMETHOD(UpdateExternalFonts) (THIS_ - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges - ); - - - IOemUI() { m_cRef = 1; m_pOEMHelp = NULL; }; - ~IOemUI(); - -protected: - LONG m_cRef; - IPrintOemDriverUI* m_pOEMHelp; -}; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/oemui.cpp b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/oemui.cpp deleted file mode 100644 index 2bc8cc32..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/oemui.cpp +++ /dev/null @@ -1,960 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: OEMUI.cpp -// -// -// PURPOSE: Main file for OEM UI test module. -// - -#include "precomp.h" -#include "resource.h" -#include "debug.h" -#include "oemui.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// INTERNAL MACROS and DEFINES -//////////////////////////////////////////////////////// - -typedef struct _tagCBUserData -{ - HANDLE hComPropSheet; - HANDLE hPropPage; - POEMUIPSPARAM pOEMUIParam; - PFNCOMPROPSHEET pfnComPropSheet; - -} CBUSERDATA, *PCBUSERDATA; - - -//////////////////////////////////////////////////////// -// INTERNAL PROTOTYPES -//////////////////////////////////////////////////////// - -static HRESULT hrDocumentPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -static HRESULT hrPrinterPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -LONG APIENTRY OEMPrinterUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam); -LONG APIENTRY OEMDocUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam); -LONG APIENTRY OEMDocUICallBack2(PCPSUICBPARAM pCallbackParam); -INT_PTR CALLBACK DevicePropPageProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam); -static BOOL AddCustomUIHelp (HANDLE hPrinter, HANDLE hHeap, HANDLE hModule, POPTITEM pOptItem, DWORD HelpIndex, DWORD HelpFile); -static POIEXT CreateOIExt(HANDLE hHeap); -static POPTITEM CreateOptItems(HANDLE hHeap, DWORD dwOptItems); -static void InitOptItems(POPTITEM pOptItems, DWORD dwOptItems); -static POPTTYPE CreateOptType(HANDLE hHeap, WORD wOptParams); -static PTSTR GetHelpFile (HANDLE hPrinter, HANDLE hHeap, HANDLE hModule, UINT uResource); -static PTSTR GetStringResource(HANDLE hHeap, HANDLE hModule, UINT uResource); -LPBYTE WrapGetPrinterDriver (HANDLE hHeap, HANDLE hPrinter, DWORD dwLevel); - - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM device or document property UI. -// Called via IOemUI::CommonUIProp -// -HRESULT hrOEMPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - HRESULT hResult = S_OK; - - // Validate parameters. - if( (OEMCUIP_DOCPROP != dwMode) - && - (OEMCUIP_PRNPROP != dwMode) - ) - { - ERR("hrOEMPropertyPage() ERROR_INVALID_PARAMETER.\r\n"); - - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - switch(dwMode) - { - case OEMCUIP_DOCPROP: - hResult = hrDocumentPropertyPage(dwMode, pOEMUIParam); - break; - - case OEMCUIP_PRNPROP: - hResult = hrPrinterPropertyPage(dwMode, pOEMUIParam); - break; - - default: - // Should never reach this! - ERR("hrOEMPropertyPage() Invalid dwMode"); - SetLastError(ERROR_INVALID_PARAMETER); - hResult = E_FAIL; - break; - } - - return hResult; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM document property UI. -// -static HRESULT hrDocumentPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - UNREFERENCED_PARAMETER(dwMode); - - if(NULL == pOEMUIParam->pOEMOptItems) - { - // Fill in the number of OptItems to create for OEM document property UI. - pOEMUIParam->cOEMOptItems = 1; - } - else - { - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - - // Init UI Callback reference. - pOEMUIParam->OEMCUIPCallback = OEMDocUICallBack; - - // Init OEMOptItmes. - InitOptItems(pOEMUIParam->pOEMOptItems, pOEMUIParam->cOEMOptItems); - - // Fill out tree view items. - - // New section. - pOEMUIParam->pOEMOptItems[0].Level = 1; - pOEMUIParam->pOEMOptItems[0].Flags = OPTIF_COLLAPSE; - pOEMUIParam->pOEMOptItems[0].pName = GetStringResource(pOEMUIParam->hOEMHeap, pOEMUIParam->hModule, IDS_ADV_SECTION); - pOEMUIParam->pOEMOptItems[0].Sel = pOEMDev->dwAdvancedData; - - pOEMUIParam->pOEMOptItems[0].pOptType= CreateOptType(pOEMUIParam->hOEMHeap, 2); - - // - //Setup the Optional Item - // - pOEMUIParam->pOEMOptItems[0].pOptType->Type = TVOT_UDARROW; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].IconID = 0; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].lParam = 100; - - - // - //Allows You to apply Customised help to this Control. - // - //Notes: - // You must use a fully qualified path for pHelpFile - // OPTITEM Flags member must have OPTIF_HAS_POIEXT flag set. This indicates that the data in OIEXT is valid. - // OPTITEM is allocated on the Heap see (AddCustomUIHelp, GetHelpFile, CreateOIExt) - // - AddCustomUIHelp (pOEMUIParam->hPrinter, - pOEMUIParam->hOEMHeap, - pOEMUIParam->hModule, - &(pOEMUIParam->pOEMOptItems[0]), - CUSDRV_HELPTOPIC_2, IDS_HELPFILE); - } - - return S_OK; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM printer property UI. -// -static HRESULT hrPrinterPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - UNREFERENCED_PARAMETER(dwMode); - - if(NULL == pOEMUIParam->pOEMOptItems) - { - // Fill in the number of OptItems to create for OEM printer property UI. - pOEMUIParam->cOEMOptItems = 1; - } - else - { - // - //This is the second time we are called Now setup the optional items. - // - DWORD dwError; - DWORD dwDeviceValue; - DWORD dwType; - DWORD dwNeeded; - - // Get device settings value from printer. - dwError = GetPrinterData(pOEMUIParam->hPrinter, OEMUI_VALUE, &dwType, (PBYTE) &dwDeviceValue, - sizeof(dwDeviceValue), &dwNeeded); - if( (ERROR_SUCCESS != dwError) - || - (dwDeviceValue > 100) - ) - { - // Failed to get the device value or value is invalid, just use the default. - dwDeviceValue = 0; - } - - // Init UI Callback reference. - pOEMUIParam->OEMCUIPCallback = OEMPrinterUICallBack; - - // Init OEMOptItmes. - InitOptItems(pOEMUIParam->pOEMOptItems, pOEMUIParam->cOEMOptItems); - - // Fill out tree view items. - - // New section. - pOEMUIParam->pOEMOptItems[0].Level = 1; - pOEMUIParam->pOEMOptItems[0].Flags = OPTIF_COLLAPSE; - pOEMUIParam->pOEMOptItems[0].pName = GetStringResource(pOEMUIParam->hOEMHeap, pOEMUIParam->hModule, IDS_DEV_SECTION); - pOEMUIParam->pOEMOptItems[0].Sel = dwDeviceValue; - - pOEMUIParam->pOEMOptItems[0].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 2); - - // - //Setup the Optional Item - // - pOEMUIParam->pOEMOptItems[0].pOptType->Type = TVOT_UDARROW; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].IconID = 0; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].lParam = 100; - - // - //Allows You to apply Customised help to this Control - // - AddCustomUIHelp (pOEMUIParam->hPrinter, - pOEMUIParam->hOEMHeap, - pOEMUIParam->hModule, - &(pOEMUIParam->pOEMOptItems[0]), - CUSDRV_HELPTOPIC_1, - IDS_HELPFILE); - } - return S_OK; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Adds property page to Document property sheet. Called via IOemUI::DocumentPropertySheets -// -HRESULT hrOEMDocumentPropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam, - IPrintOemDriverUI* pOEMHelp) -{ - UNREFERENCED_PARAMETER(pOEMHelp); - - LONG_PTR lResult = 0; - HRESULT hrResult = S_OK; - - // Validate parameters. - if( (NULL == pPSUIInfo) - || - (PROPSHEETUI_INFO_VERSION != pPSUIInfo->Version) - ) - { - ERR("hrOEMDocumentPropertySheets() ERROR_INVALID_PARAMETER.\r\n"); - - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Do action. - switch(pPSUIInfo->Reason) - { - case PROPSHEETUI_REASON_INIT: - { - DWORD dwSheets = 0; - PCBUSERDATA pUserData; - POEMUIPSPARAM pOEMUIParam = (POEMUIPSPARAM) pPSUIInfo->lParamInit; - HANDLE hHeap = pOEMUIParam->hOEMHeap; - HANDLE hModule = pOEMUIParam->hModule; - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - COMPROPSHEETUI Sheet; - - - // Init property page. - memset(&Sheet, 0, sizeof(COMPROPSHEETUI)); - Sheet.cbSize = sizeof(COMPROPSHEETUI); - Sheet.Flags = CPSUIF_UPDATE_PERMISSION; - Sheet.hInstCaller = ghInstance; - Sheet.pCallerName = GetStringResource(hHeap, ghInstance, IDS_NAME); - Sheet.pHelpFile = NULL; - Sheet.pfnCallBack = OEMDocUICallBack2; - Sheet.pDlgPage = CPSUI_PDLGPAGE_TREEVIEWONLY; - Sheet.cOptItem = 1; - Sheet.IconID = IDI_CPSUI_PRINTER; - Sheet.pOptItemName = GetStringResource(hHeap, ghInstance, IDS_SECTION); - Sheet.CallerVersion = 0x100; - Sheet.OptItemVersion = 0x100; - - // Init user data. - pUserData = (PCBUSERDATA) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(CBUSERDATA)); - if (NULL == pUserData) - { - ERR("hrOEMDocumentPropertySheets() failed to allocate user data.\r\n"); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - pUserData->hComPropSheet = pPSUIInfo->hComPropSheet; - pUserData->pfnComPropSheet = pPSUIInfo->pfnComPropSheet; - pUserData->pOEMUIParam = pOEMUIParam; - Sheet.UserData = (ULONG_PTR) pUserData; - - // Create OptItems for page. - Sheet.pOptItem = CreateOptItems(hHeap, Sheet.cOptItem); - if (NULL == Sheet.pOptItem) - { - ERR("hrOEMDocumentPropertySheets() failed to allocate OPTITEMs.\r\n"); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Initialize OptItems - Sheet.pOptItem[0].Level = 1; - Sheet.pOptItem[0].Flags = OPTIF_COLLAPSE; - Sheet.pOptItem[0].pName = GetStringResource(hHeap, ghInstance, IDS_SECTION); - Sheet.pOptItem[0].Sel = pOEMDev->dwDriverData; - - Sheet.pOptItem[0].pOptType = CreateOptType(hHeap, 2); - if (NULL == Sheet.pOptItem[0].pOptType) - { - ERR("hrOEMDocumentPropertySheets() failed to allocate OPTTYPE.\r\n"); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // - //Set the UI prop of this OPTYPE item. - // - Sheet.pOptItem[0].pOptType->Type = TVOT_UDARROW; - Sheet.pOptItem[0].pOptType->pOptParam[1].IconID = 0; - Sheet.pOptItem[0].pOptType->pOptParam[1].lParam = 100; - - // - //Allows You to apply Customised help to this Control. - //See Function : AddCustomUIHelp, For more details on implamentation. - // - AddCustomUIHelp (pOEMUIParam->hPrinter, - hHeap, - hModule, - &(Sheet.pOptItem[0]), - CUSDRV_HELPTOPIC_1, - IDS_HELPFILE); - - // Adds the property sheets. - lResult = pPSUIInfo->pfnComPropSheet(pPSUIInfo->hComPropSheet, CPSFUNC_ADD_PCOMPROPSHEETUI, - (LPARAM)&Sheet, (LPARAM)&dwSheets); - } - break; - - case PROPSHEETUI_REASON_GET_INFO_HEADER: - { - PPROPSHEETUI_INFO_HEADER pHeader = (PPROPSHEETUI_INFO_HEADER) lParam; - - pHeader->pTitle = (LPTSTR)PROP_TITLE; - lResult = TRUE; - } - break; - - case PROPSHEETUI_REASON_GET_ICON: - // No icon - lResult = 0; - break; - - case PROPSHEETUI_REASON_SET_RESULT: - { - PSETRESULT_INFO pInfo = (PSETRESULT_INFO) lParam; - - lResult = pInfo->Result; - } - break; - - case PROPSHEETUI_REASON_DESTROY: - lResult = TRUE; - break; - } - -Exit: - - pPSUIInfo->Result = lResult; - return hrResult; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Adds property page to printer property sheet. Called via IOemUI::DevicePropertySheets -// -HRESULT hrOEMDevicePropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam) -{ - LONG_PTR lResult = 0; - - // Validate parameters. - if( (NULL == pPSUIInfo) - || - (PROPSHEETUI_INFO_VERSION != pPSUIInfo->Version) - ) - { - ERR("hrOEMDevicePropertySheets() ERROR_INVALID_PARAMETER.\r\n"); - - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Do action. - switch(pPSUIInfo->Reason) - { - case PROPSHEETUI_REASON_INIT: - { - PROPSHEETPAGE Page; - - // Init property page. - memset(&Page, 0, sizeof(PROPSHEETPAGE)); - Page.dwSize = sizeof(PROPSHEETPAGE); - Page.dwFlags = PSP_DEFAULT; - Page.hInstance = ghInstance; - Page.pszTemplate = MAKEINTRESOURCE(IDD_DEVICE_PROPPAGE); - Page.pfnDlgProc = DevicePropPageProc; - - // Add property sheets. - lResult = pPSUIInfo->pfnComPropSheet(pPSUIInfo->hComPropSheet, CPSFUNC_ADD_PROPSHEETPAGE, (LPARAM)&Page, 0); - } - break; - - case PROPSHEETUI_REASON_GET_INFO_HEADER: - { - PPROPSHEETUI_INFO_HEADER pHeader = (PPROPSHEETUI_INFO_HEADER) lParam; - - pHeader->pTitle = (LPTSTR)PROP_TITLE; - lResult = TRUE; - } - break; - - case PROPSHEETUI_REASON_GET_ICON: - // No icon - lResult = 0; - break; - - case PROPSHEETUI_REASON_SET_RESULT: - { - PSETRESULT_INFO pInfo = (PSETRESULT_INFO) lParam; - - lResult = pInfo->Result; - } - break; - - case PROPSHEETUI_REASON_DESTROY: - lResult = TRUE; - break; - } - - pPSUIInfo->Result = lResult; - return S_OK; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// OptItems call back for OEM printer property UI. -// -LONG APIENTRY OEMPrinterUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - { - DWORD dwDriverValue = pOEMUIParam->pOEMOptItems[0].Sel; - - // Store OptItems state in printer data. - SetPrinterData(pOEMUIParam->hPrinter, OEMUI_VALUE, REG_DWORD, (PBYTE) &dwDriverValue, sizeof(DWORD)); - } - break; - - default: - break; - } - - return lReturn; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Call back for OEM device property UI. -// -#pragma warning(push) -#pragma warning( disable : 6262 ) // 2 MAX_PATH strings exceeds the stack size by a few bytes. -INT_PTR CALLBACK DevicePropPageProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) -{ - switch (uiMsg) - { - case WM_COMMAND: - switch(HIWORD(wParam)) - { - case BN_CLICKED: - switch(LOWORD(wParam)) - { - case IDC_CALIBRATE: - // Simulate printer calibration by displaying a message that the - // printer has been calibrated. - { - TCHAR szName[MAX_PATH]; - TCHAR szCalibrated[MAX_PATH]; - - LoadString(ghInstance, IDS_NAME, szName, sizeof(szName)/sizeof(szName[0])); - LoadString(ghInstance, IDS_CALIBRATED, szCalibrated, sizeof(szCalibrated)/sizeof(szCalibrated[0])); - MessageBox(hDlg, szCalibrated, szName, MB_OK); - } - break; - } - break; - - default: - return FALSE; - } - return TRUE; - - case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->code) // type of notification message - { - case PSN_SETACTIVE: - break; - - case PSN_KILLACTIVE: - break; - - case PSN_APPLY: - break; - - case PSN_RESET: - break; - } - } - break; - } - - return FALSE; -} -#pragma warning(pop) - - -//////////////////////////////////////////////////////////////////////////////// -// -// OptItems call back for OEM document property UI. -// -LONG APIENTRY OEMDocUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - // Store OptItems state in DEVMODE. - pOEMDev->dwAdvancedData = pOEMUIParam->pOEMOptItems[0].Sel; - break; - - case CPSUICB_REASON_KILLACTIVE: - pOEMDev->dwAdvancedData = pOEMUIParam->pOEMOptItems[0].Sel; - break; - - case CPSUICB_REASON_SETACTIVE: - if((DWORD)(pOEMUIParam->pOEMOptItems[0].Sel) != pOEMDev->dwAdvancedData) - { - pOEMUIParam->pOEMOptItems[0].Sel = pOEMDev->dwAdvancedData; - pOEMUIParam->pOEMOptItems[0].Flags |= OPTIF_CHANGED; - lReturn = CPSUICB_ACTION_OPTIF_CHANGED; - } - break; - - default: - break; - } - - return lReturn; -} - - -LONG APIENTRY OEMDocUICallBack2(PCPSUICBPARAM pCallbackParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - PCBUSERDATA pUserData = (PCBUSERDATA) pCallbackParam->UserData; - POEMDEV pOEMDev = (POEMDEV) pUserData->pOEMUIParam->pOEMDM; - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - pOEMDev->dwDriverData = pCallbackParam->pOptItem[0].Sel; - pUserData->pfnComPropSheet(pUserData->hComPropSheet, CPSFUNC_SET_RESULT, - (LPARAM)pUserData->hPropPage, - (LPARAM)CPSUI_OK); - break; - - case CPSUICB_REASON_KILLACTIVE: - pOEMDev->dwDriverData = pCallbackParam->pOptItem[0].Sel; - break; - - case CPSUICB_REASON_SETACTIVE: - if((DWORD)(pCallbackParam->pOptItem[0].Sel) != pOEMDev->dwDriverData) - { - pCallbackParam->pOptItem[0].Sel = pOEMDev->dwDriverData; - pCallbackParam->pOptItem[0].Flags |= OPTIF_CHANGED; - lReturn = CPSUICB_ACTION_OPTIF_CHANGED; - } - break; - - default: - break; - } - - return lReturn; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Creates and Initializes OptItems. -// -static POPTITEM CreateOptItems(HANDLE hHeap, DWORD dwOptItems) -{ - POPTITEM pOptItems = NULL; - DWORD cbMemAllocSize; - - // Allocate memory for OptItems; - - // Call intsafe.h function to ensure there's no integer overflow or underflow - if (SUCCEEDED(DWordMult(sizeof(OPTITEM), dwOptItems, &cbMemAllocSize)) && - (NULL != (pOptItems = (POPTITEM) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, cbMemAllocSize)))) - { - InitOptItems(pOptItems, dwOptItems); - } - else - { - ERR("CreateOptItems() failed to allocate memory for OPTITEMs!\r\n"); - } - - return pOptItems; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems. -// -static void InitOptItems(POPTITEM pOptItems, DWORD dwOptItems) -{ - // Zero out memory. - memset(pOptItems, 0, sizeof(OPTITEM) * dwOptItems); - - // Set each OptItem's size, and Public DM ID. - for(DWORD dwCount = 0; dwCount < dwOptItems; dwCount++) - { - pOptItems[dwCount].cbSize = sizeof(OPTITEM); - pOptItems[dwCount].DMPubID = DMPUB_NONE; - } -} - - - -//////////////////////////////////////////////////////////////////////////////// -// -// Adds Custom help top a OPTTYPE UI item. -// -// Note : -// The OPTITEM member HelpIndex must be set the the correct HELP ID number. -// HelpIndex is the index that you assigned in the hlp file to this item of help. -// The OPTITEM, pOIExt member must point to a valid OIEXT structure. -// The phelpfile is member of OIEXT must have the fully qualified path to the driver file. -// -// -// It is also possible to overide common help items in UNIDRIVE via the HelpIndex in the GPD. -// For further information on using HelpIndex in the GPD see the relavent section in the DDK -// It is not possible to custimse help however via the PPD. The OPTITEM must be modified in the OEM Plugin. -// -static BOOL AddCustomUIHelp (HANDLE hPrinter, HANDLE hHeap, HANDLE hModule, - POPTITEM pOptItem, DWORD HelpIndex, DWORD HelpFile) -{ - POIEXT pOIExt = NULL; - - // - //Allocate a new OIEXT structure on the heap - // - if (pOptItem->pOIExt == NULL) - { - pOptItem->pOIExt = CreateOIExt(hHeap); - } - - if ( pOptItem->pOIExt == NULL ) - { - ERR("AddCustomUIHelp() Error Allocation Failed.\r\n"); - return FALSE; - } - - pOIExt = pOptItem->pOIExt; - - // - //Set to the full absolute path of the driver file. - //(It should be in the Printer Driver Directrory in most cases) - //This String needs to be allocated on the heap (The Driver will clean it up). - // - pOIExt->pHelpFile = GetHelpFile (hPrinter, hHeap, hModule, HelpFile); - - // - //Set to show tha there is a valid OIEXT structure and data - // - pOptItem->Flags |= OPTIF_HAS_POIEXT; - - // - //This needs to be set if you have ansi strings in your help file. (NOTE!) - // - //pOiExt->Flags |= OIEXTF_ANSI_STRING; - - // - //Add the help this the index in the .hlp file. - // - pOptItem->HelpIndex = HelpIndex; - - return TRUE; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Allocates and initializes OIEXT for OptItem. -// -static POIEXT CreateOIExt(HANDLE hHeap) -{ - - POIEXT pOiExt = NULL; - - // Allocate memory from the heap for the OPTTYPE; the driver will take care of clean up. - pOiExt = (POIEXT) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(OIEXT)); - if(NULL != pOiExt) - { - // - // Initialize OPTTYPE. (These members are setup by AddCustomUIHelp) - // - pOiExt->cbSize = sizeof(OIEXT); - pOiExt->Flags = 0; - pOiExt->hInstCaller = NULL; - pOiExt->pHelpFile = NULL; - } - - return pOiExt; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Allocates and initializes OptType for OptItem. -// -static POPTTYPE CreateOptType(HANDLE hHeap, WORD wOptParams) -{ - POPTTYPE pOptType = NULL; - - // Allocate memory from the heap for the OPTTYPE; the driver will take care of clean up. - pOptType = (POPTTYPE) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(OPTTYPE)); - if(NULL != pOptType) - { - DWORD cbMemAllocSize; - - // Initialize OPTTYPE. - pOptType->cbSize = sizeof(OPTTYPE); - pOptType->Count = wOptParams; - - // Allocate memory from the heap for the OPTPARAMs for the OPTTYPE. - - // Call intsafe.h function to ensure there's no integer overflow or underflow - if (SUCCEEDED(DWordMult(wOptParams, sizeof(OPTPARAM), &cbMemAllocSize)) && - (NULL != (pOptType->pOptParam = (POPTPARAM) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, cbMemAllocSize)))) - { - // Initialize the OPTPARAMs. - for(WORD wCount = 0; wCount < wOptParams; wCount++) - { - pOptType->pOptParam[wCount].cbSize = sizeof(OPTPARAM); - } - } - else - { - ERR("CreateOptType() failed to allocated memory for OPTPARAMs!\r\n"); - - // Free allocated memory and return NULL. - HeapFree(hHeap, 0, pOptType); - pOptType = NULL; - } - } - else - { - ERR("CreateOptType() failed to allocated memory for OPTTYPE!\r\n"); - } - - return pOptType; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Allocates space on the heap and gets the help file name from the resource file. -// Note you need to allocate this on the heap so that it stays allocated as long as the driver UI is loaded. -// The OPTITEM->pOIExt ref this data. -// -static PTSTR GetHelpFile (HANDLE hPrinter, HANDLE hHeap, HANDLE hModule, UINT uResource) -{ - - DWORD nResult = 0; - DWORD dwSize = MAX_PATH; - PTSTR pszString = NULL; - PTSTR pszTemp = NULL; - PDRIVER_INFO_2 pDriverInfo = NULL; - - // - // Allocate buffer for string resource from heap; - // - pszTemp = (PTSTR) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, dwSize * sizeof(TCHAR)); - pDriverInfo = (PDRIVER_INFO_2)WrapGetPrinterDriver (hHeap, hPrinter, 2); - - // - //Get the Full Driver Dir from pDriverPath it must include the \version\ - // - if(NULL != pszTemp && pDriverInfo && pDriverInfo->pDriverPath) - { - HRESULT hCopy; - - hCopy = StringCchCopy(pszTemp, dwSize, pDriverInfo->pDriverPath); - if(FAILED(hCopy)) - { - ERR("StringCchCopy() failed to copy driver path to temp buffer!\r\n"); - } - pszString = _tcsrchr (pszTemp, _T('\\') ) + 1; - } - - // - //The Help file is installed with the driver in the version drictory. - // - if(NULL != pszString) - { - // - //The Buffer size is in characters for the unicode version of LoadString - // - nResult = LoadString((HMODULE)hModule, uResource, pszString, (int)(dwSize - _tcslen(pszTemp)) ); - } - else - { - ERR("GetStringResource() failed to allocate string buffer!\r\n"); - } - - if(nResult > 0) - { - // - //Reallocate this so that we don't waist space on the heap (free any non used heap in MAX_PATH) - // - pszString = (PTSTR) HeapReAlloc(hHeap, HEAP_ZERO_MEMORY, pszTemp, (_tcslen(pszTemp) + 1) * sizeof(TCHAR)); - if(NULL == pszString) - { - pszTemp = pszString; - ERR("GetStringResource() HeapReAlloc() of string retrieved failed!\r\n"); - } - } - else - { - ERR("LoadString() failed!"); - pszString = NULL; - } - - // - //Clean up the Driverinfo that was allocated. It is not needed. (Always free this it is only temp data) - // - if (pDriverInfo) - { - HeapFree(hHeap, 0, pDriverInfo); - } - - return pszString; -} - -//////////////////////////////////////////////////////////////////////////////////// -// -// Retrieves pointer to a String resource. -// -static PTSTR GetStringResource(HANDLE hHeap, HANDLE hModule, UINT uResource) -{ - int nResult; - DWORD dwSize = MAX_PATH; - PTSTR pszString = NULL; - - // Allocate buffer for string resource from heap; let the driver clean it up. - pszString = (PTSTR) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, dwSize * sizeof(TCHAR)); - if(NULL != pszString) - { - // Load string resource; resize after loading so as not to waste memory. - nResult = LoadString((HMODULE)hModule, uResource, pszString, dwSize); - if(nResult > 0) - { - PTSTR pszTemp; - - pszTemp = (PTSTR) HeapReAlloc(hHeap, HEAP_ZERO_MEMORY, pszString, (nResult + 1) * sizeof(TCHAR)); - if(NULL != pszTemp) - { - pszString = pszTemp; - } - else - { - ERR("GetStringResource() HeapReAlloc() of string retrieved failed!\r\n"); - } - } - else - { - ERR("LoadString() failed!\r\n"); - pszString = NULL; - } - } - else - { - ERR("GetStringResource() failed to allocate string buffer!\r\n"); - } - - return pszString; -} - - -//////////////////////////////////////////////////////////////////////////////////// -// -// Wrapper to help retrive the PrinterDriverInfo, -// Note the MEM is orphaned by this call on success -// - -LPBYTE WrapGetPrinterDriver (HANDLE hHeap, HANDLE hPrinter, DWORD dwLevel) -{ - // - //Get the PrinterINFO so that we know where the driver help file is. - // - BOOL bGet = TRUE; - DWORD dwNeeded = 0; - LPBYTE pBuffer = NULL; - - bGet = GetPrinterDriver(hPrinter, NULL, dwLevel, pBuffer, 0, &dwNeeded); - - if(!bGet && GetLastError() == ERROR_INSUFFICIENT_BUFFER ) - { - SetLastError(ERROR_SUCCESS); // clear the previous result to prevent noise - pBuffer = (LPBYTE)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, dwNeeded); - } - - if (pBuffer) - { - bGet = GetPrinterDriver(hPrinter, NULL, dwLevel, pBuffer, dwNeeded, &dwNeeded); - } - - if(!bGet || !pBuffer) - { - if (pBuffer) - { - HeapFree(hHeap, 0, pBuffer); - pBuffer = NULL; - } - - ERR("GetPrinterDriver() failed."); - } - - return pBuffer; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/oemui.h b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/oemui.h deleted file mode 100644 index 2fc12cba..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/oemui.h +++ /dev/null @@ -1,47 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: OEMUI.H -// -// PURPOSE: Define common data types, and external function prototypes -// for property sheet handling. -// - - -#pragma once - -#include "DEVMODE.H" -#include "globals.h" - -//////////////////////////////////////////////////////// -// Custom Help Defines -//////////////////////////////////////////////////////// - -#define CUSDRV_HELPTOPIC_1 15001 -#define CUSDRV_HELPTOPIC_2 15002 - -//////////////////////////////////////////////////////// -// OEM UI Defines -//////////////////////////////////////////////////////// - -// OEM Signature and version. -#define PROP_TITLE L"OEM UI Page" -#define OEM_SIGNATURE 'MSFT' -#define OEM_VERSION 0x00000001L - -// Printer registry keys where OEM data is stored. -#define OEMUI_VALUE TEXT("OEMUI_VALUE") -#define OEMUI_DEVICE_VALUE TEXT("OEMUI_DEVICE_VALUE") - -//////////////////////////////////////////////////////// -// Prototypes -//////////////////////////////////////////////////////// - -HRESULT hrOEMPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -HRESULT hrOEMDocumentPropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam, IPrintOemDriverUI* pOEMHelp); -HRESULT hrOEMDevicePropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam); - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/oemui.rc b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/oemui.rc deleted file mode 100644 index e4d28716..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/oemui.rc +++ /dev/null @@ -1,170 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Written by Windows Printing & Imaging Team" - VALUE "CompanyName", "Microsoft Corp." - VALUE "FileDescription", "OEM UI Test Module." - VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "OEMUI" - VALUE "LegalCopyright", "Copyright 1998 - 2003 Microsoft Corp." - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation" - VALUE "OriginalFilename", "OEMUI.dll" - VALUE "ProductName", "Microsoft OEMUI" - VALUE "ProductVersion", "1.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_DEVICE_PROPPAGE DIALOG 0, 0, 179, 113 -STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Device Property Page" -FONT 8, "MS Shell Dialog" -BEGIN - LTEXT "OEM UI Added Page",IDC_STATIC,55,14,68,11 - PUSHBUTTON "Calibrate",IDC_CALIBRATE,61,34,50,14 -END - -IDD_DOC_PROPPAGE DIALOG 0, 0, 210, 154 -STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Document Property Page" -FONT 8, "MS Shell Dialog" -BEGIN - LTEXT "OEM UI Document Property Page",IDC_STATIC,60,73,108,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_DEVICE_PROPPAGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 172 - TOPMARGIN, 8 - BOTTOMMARGIN, 106 - END - - IDD_DOC_PROPPAGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 147 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_SECTION "OEM UI Added Item" - IDS_CALIBRATED "Printer has been calibrated." - IDS_NAME "OEM UI Customization DLL" - IDS_HELPFILE "CUSTOMDRV.HLP" - IDS_DEV_SECTION "Device Settings OEM UI Added Item" - IDS_ADV_SECTION "Advanced OEM UI Added Item" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/precomp.h deleted file mode 100644 index ef4615ad..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/precomp.h +++ /dev/null @@ -1,54 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: PRECOMP.H -// -// PURPOSE: Optimize compilation of headers that do not change frequently -// - -#pragma once - -// Necessary for compiling under VC. -#if(!defined(WINVER) || (WINVER < 0x0500)) - #undef WINVER - #define WINVER 0x0500 -#endif -#if(!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)) - #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0500 -#endif - - -// Required header files that shouldn't change often. - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// StrSafe.h needs to be included last -// to disallow unsafe string functions. -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/resource.h b/print/OEM Printer Customization Plug-in Samples/C++/custhlp/resource.h deleted file mode 100644 index 9c7732fe..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/custhlp/resource.h +++ /dev/null @@ -1,23 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: resource.h -// -// PURPOSE: Defines resources IDs for localizable resources. -// - - -#define IDS_SECTION 1 -#define IDS_CALIBRATED 2 -#define IDS_NAME 3 -#define IDS_HELPFILE 4 -#define IDS_DEV_SECTION 5 -#define IDS_ADV_SECTION 10 -#define IDD_DEVICE_PROPPAGE 106 -#define IDD_DOC_PROPPAGE 107 -#define IDC_CALIBRATE 1001 - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.gpd b/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.gpd deleted file mode 100644 index 20e4d472..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.gpd +++ /dev/null @@ -1,520 +0,0 @@ -*GPDFileName: "gdlsmpl.gpd" -*GPDFileVersion: "1.0" -*GPDSpecVersion: "1.0" -*Include: "StdNames.gpd" -*ModelName: "OEM Unidrv GDL Sample" -*MasterUnits: PAIR(1200, 1200) -*ResourceDLL: "unires.dll" -*PrinterType: PAGE -*MaxCopies: 99 -*PrintRate: 16 -*PrintRateUnit: PPM -*PrintRatePPM: 16 - -*% -*% This line indicates which file the GDL parser should use to find Bidi information. -*% This is also the same file that will be parser when querying the GDL via -*% IPrintCoreHelperUni. GDL is compatible with GPD syntax, and this can be the driver's -*% GPD file, whis is what this sample does. -*% -*BidiQueryFile: "gdlsmpl.gpd" - - -*%****************************************************************************************** -*% Orientation -*%****************************************************************************************** -*Feature: Orientation -{ - *rcNameID: =ORIENTATION_DISPLAY - *DefaultOption: PORTRAIT - *Option: PORTRAIT - { - *rcNameID: =PORTRAIT_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.6 - *Cmd: "<1B>&l0O" - } - } - *Option: LANDSCAPE_CC90 - { - *rcNameID: =LANDSCAPE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.8 - *Cmd: "<1B>&l1O" - } - } -} - -*%****************************************************************************************** -*% Input Bin -*%****************************************************************************************** -*Feature: InputBin -{ - *rcNameID: =PAPER_SOURCE_DISPLAY - *DefaultOption: AUTO - *Option: AUTO - { - *rcNameID: =AUTO_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l0H" - } - } - *Option: UPPER - { - *rcNameID: =UPPER_TRAY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l1H" - } - } -} - -*%****************************************************************************************** -*% Resolution -*%****************************************************************************************** -*Feature: Resolution -{ - *rcNameID: =RESOLUTION_DISPLAY - *DefaultOption: 300dpi - *Option: 300dpi - { - *Name: "300 x 300" =DOTS_PER_INCH - *DPI: PAIR(300, 300) - *TextDPI: PAIR(300, 300) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED, TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "@PJL SET RESOLUTION=300<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t300R" - } - } -} - -*%****************************************************************************************** -*% HP-GL/2 Graphics Support -*%****************************************************************************************** -*Ifdef: WINNT_51 -*Personality: =PERSONALITY_HPGL2 -*Feature: GraphicsMode -{ - *rcNameID: =GRAPHICSMODE_DISPLAY - *DefaultOption: HPGL2MODE - *Option: HPGL2MODE - { - *rcNameID: =GRAPHICSMODE_HPGL2_DISPLAY - } - *Option: RASTERMODE - { - *rcNameID: =GRAPHICSMODE_RASTER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.5 - *Cmd: "@PJL SET LIMAGEENHANCE=OFF<0A>" - } - } -} -*Endif: - -*%****************************************************************************************** -*% Paper Size -*%****************************************************************************************** -*Feature: PaperSize -{ - *rcNameID: =PAPER_SIZE_DISPLAY - *DefaultOption: LETTER - *Option: LETTER - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1028 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9500, 12500) - *PrintableOrigin: PAIR(400, 400) - *CursorOrigin: PAIR(300, 300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t5260x7704Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9500, 12200) - *PrintableOrigin: PAIR(450, 300) - *CursorOrigin: PAIR(200, 12900) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t7332x5880Y" - } - } - } - } - *Option: LEGAL - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1692 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 600) - *CursorOrigin: PAIR(180, 300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t5880x8900Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 900) - *CursorOrigin: PAIR(180, 16500) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t8900x5880Y" - } - } - } - } - *Option: EXECUTIVE - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4109 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(8100, 11500) - *PrintableOrigin: PAIR(300, 300) - *CursorOrigin: PAIR(300, 200) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t4860x7344Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(8300, 11500) - *PrintableOrigin: PAIR(200, 300) - *CursorOrigin: PAIR(200, 12300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t7272x4980Y" - } - } - } - } - *Option: A4 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4249 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9100, 13200) - *PrintableOrigin: PAIR(400, 300) - *CursorOrigin: PAIR(288, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t5594x8201Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9100, 13200) - *PrintableOrigin: PAIR(400, 300) - *CursorOrigin: PAIR(204, 13824) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t8129x5714Y" - } - } - } - } - *Option: B5 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 3198 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(7900, 11140) - *PrintableOrigin: PAIR(352, 300) - *CursorOrigin: PAIR(300, 100) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l12a8c1E<1B>*p0x0Y<1B>*c0t4970x7040Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(7760, 11140) - *PrintableOrigin: PAIR(300, 400) - *CursorOrigin: PAIR(100, 11940) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l12a8c1E<1B>*p0x0Y<1B>*c0t6780x4970Y" - } - } - } - } -} - -*%****************************************************************************************** -*% Outputbin -*%****************************************************************************************** - - -*Feature: OutputBin -{ - *rcNameID: =OUTPUTBIN_DISPLAY - *HelpIndex: 12006 - *DefaultOption: Option1 - *Option: Option1 - { - *% Auto Select - *Name: "default" - *Command: CmdSelect - { - *Order: DOC_SETUP.4 - *Cmd: "@PJL SET OUTBIN=OPTIONALOUTBIN2<0A>@PJL SET FINISH=NONE<0A>" - } - } - *Option: Option14 - { - *% Stacker - *Name: "stacker" *% Stacker - *Command: CmdSelect - { - *Order: DOC_SETUP.4 - *Cmd: "@PJL SET OUTBIN=OPTIONALOUTBIN2<0A>@PJL SET FINISH=NONE<0A>" - } - } -} - - -*%****************************************************************************************** -*% Media Type -*%****************************************************************************************** -*Feature: MediaType -{ - *rcNameID: =MEDIA_TYPE_DISPLAY - *DefaultOption: PLAIN - *Option: PLAIN - { - *rcNameID: =PLAIN_PAPER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.15 - *Cmd: "<1B>&n6WdPlain" - } - } - *Option: TRANSPARENCY - { - *rcNameID: =TRANSPARENCY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.15 - *Cmd: "<1B>&n13WdTransparency" - } - } -} - - - -*%****************************************************************************************** -*% HalfTone -*%****************************************************************************************** -*Feature: Halftone -{ - *rcNameID: =HALFTONING_DISPLAY - *DefaultOption: HT_PATSIZE_AUTO - *Option: HT_PATSIZE_AUTO - { - *rcNameID: =HT_AUTO_SELECT_DISPLAY - } - *Option: HT_PATSIZE_SUPERCELL_M - { - *rcNameID: =HT_SUPERCELL_DISPLAY - } - *Option: HT_PATSIZE_6x6_M - { - *rcNameID: =HT_DITHER6X6_DISPLAY - } - *Option: HT_PATSIZE_8x8_M - { - *rcNameID: =HT_DITHER8X8_DISPLAY - } -} - -*%****************************************************************************************** -*% Memory -*% -*% Note: Unidrv uses the font memory information to estimate when it needs to stop -*% downloading fonts for a page, and thus driver writers should err on the conservative -*% side. Otherwise, printers will generate "out of memory" device errors for pages with -*% a large number of fonts / unique glyphs. -*%****************************************************************************************** -*Feature: Memory -{ - *rcNameID: =PRINTER_MEMORY_DISPLAY - *DefaultOption: 32768KB - *Option: 16384KB - { - *Name: "16MB" - *MemoryConfigKB: PAIR(16384, 13950) - } - *Option: 32768KB - { - *Name: "32MB" - *MemoryConfigKB: PAIR(32768, 28350) - } -} - -*%****************************************************************************************** -*% Page Protect -*%****************************************************************************************** -*Feature: PageProtect -{ - *rcNameID: =PAGE_PROTECTION_DISPLAY - *DefaultOption: OFF - *Option: ON - { - *rcNameID: =ON_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.1 - *Cmd: "<1B>%%-12345X@PJL SET PAGEPROTECT=LETTER<0A>" - } - } - *Option: OFF - { - *rcNameID: =OFF_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.1 - *Cmd: "<1B>%%-12345X@PJL SET PAGEPROTECT=OFF<0A>" - } - } -} - -*%****************************************************************************************** -*% Doc setup commands -*%****************************************************************************************** -*Command: CmdStartDoc -{ - *Order: DOC_SETUP.7 - *Cmd: "<1B>&u1200D<1B>*r0F" -} -*Command: CmdStartPage -{ - *Order: PAGE_SETUP.1 - *Cmd: "<1B>*b0M<0D>" -} -*Command: CmdEndJob -{ - *Order: JOB_FINISH.1 - *Cmd: "<1B>E<1B>%%-12345X@PJL<20>LPORTROTATE<0A><1B>%%-12345X" -} -*Command: CmdCopies -{ - *Order: DOC_SETUP.13 - *Cmd: "<1B>&l" %d{NumOfCopies}"X" -} - -*%****************************************************************************************** -*% Cursor, Page and Color Commands -*%****************************************************************************************** -*RotateCoordinate?: TRUE -*RotateRaster?: TRUE -*RotateFont?: TRUE -*TextCaps: LIST(TC_CR_90,TC_UA_ABLE) -*MemoryUsage: LIST(FONT, RASTER, VECTOR) -*CursorXAfterCR: AT_PRINTABLE_X_ORIGIN -*BadCursorMoveInGrxMode: LIST(X_PORTRAIT,Y_LANDSCAPE) -*XMoveThreshold: 0 -*YMoveThreshold: 0 -*XMoveUnit: 300 -*YMoveUnit: 300 -*Command: CmdXMoveAbsolute { *Cmd : "<1B>*p" %d{(DestX) }"X" } -*Command: CmdXMoveRelRight { *Cmd : "<1B>*p+" %d[0,9600]{max_repeat((DestXRel) )}"X" } -*Command: CmdXMoveRelLeft { *Cmd : "<1B>*p-" %d[0,9600]{max_repeat((DestXRel) )}"X" } -*Command: CmdYMoveAbsolute { *Cmd : "<1B>*p" %d{(DestY) }"Y" } -*Command: CmdYMoveRelDown { *Cmd : "<1B>*p+" %d{(DestYRel) }"Y" } -*Command: CmdYMoveRelUp { *Cmd : "<1B>*p-" %d{(DestYRel) }"Y" } -*Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" -+ %d{PaletteIndexToProgram} "I" } -*Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } -*Command: CmdCR { *Cmd : "<0D>" } -*Command: CmdLF { *Cmd : "<0A>" } -*Command: CmdFF { *Cmd : "<0C>" } -*Command: CmdBackSpace { *Cmd : "<08>" } -*Command: CmdUniDirectionOn { *Cmd : "<00>" } -*Command: CmdUniDirectionOff { *Cmd : "<00>" } -*Command: CmdPushCursor { *Cmd : "<1B>&f0S" } -*Command: CmdPopCursor { *Cmd : "<1B>&f1S" } -*Command: CmdSetSimpleRotation { *Cmd : "<1B>&a" %d{PrintDirInCCDegrees}"P" } -*EjectPageWithFF?: TRUE -*Command: CmdEnableTIFF4 { *Cmd : "<1B>*b2M" } -*Command: CmdDisableCompression { *Cmd : "<1B>*b0M" } -*OutputDataFormat: H_BYTE -*OptimizeLeftBound?: TRUE -*CursorXAfterSendBlockData: AT_GRXDATA_ORIGIN -*CursorYAfterSendBlockData: AUTO_INCREMENT - -*%****************************************************************************************** -*% Font Descriptions and Commands -*%****************************************************************************************** -*DefaultFont: 136 -*DefaultCTT: 0 -*CharPosition: BASELINE -*DeviceFonts: LIST(136,138,146,147,148,149,150,151,152,153,154,155,156,157, -+ 163,164,165,166,196,197,198,199,200,201,202,203,209,210, -+ 211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226, -+ 227,228,229,230) -*MinFontID: 16534 -*MaxFontID: 32768 -*FontFormat: HPPCL_OUTLINE -*Command: CmdSetFontID { *Cmd : "<1B>*c" %d{NextFontID}"D" } -*Command: CmdSelectFontID { *Cmd : "<1B>(" %d{CurrentFontID}"X" } -*Command: CmdSetCharCode { *Cmd : "<1B>*c" %d{NextGlyph}"E" } -*Command: CmdUnderlineOn { *Cmd : "<1B>&dD" } -*Command: CmdUnderlineOff { *Cmd : "<1B>&d@" } -*Command: CmdWhiteTextOn { *Cmd : "<1B>*v1o1T" } -*Command: CmdWhiteTextOff { *Cmd : "<1B>*v0o0T" } - - -*%******************************************************************************************** -*%* Vector Commands. -*%******************************************************************************************** -*MinGrayFill: 1 -*MaxGrayFill: 100 -*Command: CmdSetRectWidth { *Cmd : "<1B>*c" %d{(RectXSize) }"A" } -*Command: CmdSetRectHeight { *Cmd : "<1B>*c" %d{(RectYSize) }"B" } -*Command: CmdRectGrayFill { *Cmd : "<1B>*c" %d{GrayPercentage }"g2P" } -*Command: CmdRectWhiteFill { *Cmd : "<1B>*c1P" } -*Command: CmdRectBlackFill { *Cmd : "<1B>*c0P" } diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf b/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf deleted file mode 100644 index 8794fa8e..00000000 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.inf and /dev/null differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.ini b/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.ini deleted file mode 100644 index dd46570f..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/res/gdlsmpl.ini +++ /dev/null @@ -1,3 +0,0 @@ -[OEMFiles] -OEMConfigFile1=GDLSMPL.DLL - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/GDLSMPL.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/GDLSMPL.vcxproj deleted file mode 100644 index 8b4e5189..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/GDLSMPL.vcxproj +++ /dev/null @@ -1,1084 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D} - $(MSBuildProjectName) - Win10 Debug - Win32 - {54379D65-81DC-4846-87B8-91904DFAD95D} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - GDLSMPL - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - %(AdditionalIncludeDirectories) - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories) - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib;msxml6.lib - GDLSMPL.def - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/GDLSMPL.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/GDLSMPL.vcxproj.Filters deleted file mode 100644 index 6031427f..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/GDLSMPL.vcxproj.Filters +++ /dev/null @@ -1,134 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {AA9642FD-4376-4AA6-BEBD-F068AD5C8036} - - - h;hpp;hxx;hm;inl;inc;xsd - {C5C6C5CD-8656-4525-B00D-B1F5AEFAA986} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {7600E0E1-C09C-435F-9EE5-6AE7AF0E62AA} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/debug.h b/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/debug.h deleted file mode 100644 index 0414569c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/debug.h +++ /dev/null @@ -1,82 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.H -// -// PURPOSE: Define common data types, and external function prototypes -// for debugging functions. Also defines the various debug macros. -// -// - -#pragma once - -///////////////////////////////////////////////////////// -// Macros -///////////////////////////////////////////////////////// -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// WARNING("App passed NULL pointer, ignoring...\n"); -// - -#define DBG_VERBOSE 0 -#define DBG_WARNING 1 -#define DBG_ERROR 2 -#define DBG_NONE 3 - -// VC and Build use different debug defines. -#if defined (DBG) || defined (_DEBUG) - - // __declspec(selectany) ensures that even if this is defined in multiple compilation - // modules, they will all resolve to the same symbol in the linked DLL - __declspec(selectany) INT giDebugLevel = 2; - - #define STRINGIZE(x) #x - #define QUOTE(x) STRINGIZE(x) - #define FILE_AND_LINE __FILE__ "@" QUOTE(__LINE__) - - #define VERBOSE(msg) { if(giDebugLevel <= DBG_VERBOSE) OutputDebugStringA( FILE_AND_LINE ": " msg); } - #define WARNING(msg) { if(giDebugLevel <= DBG_WARNING) OutputDebugStringA( FILE_AND_LINE ": Warning: " msg); } - #define ERR(msg) { if(giDebugLevel <= DBG_ERROR) OutputDebugStringA(FILE_AND_LINE ": Error:" msg); } - #define ASSERT(cond) { if (!(cond)) RIP("\n"); } - #define RIP(msg) { OutputDebugStringA(FILE_AND_LINE ": Error (not recoverable): " msg); DebugBreak(); } - -#else // !DBG - - #define VERBOSE(msg) - #define WARNING(msg) - #define ERR(msg) - #define ASSERT(cond) - #define RIP(msg) - -#endif - - - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/devmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/devmode.cpp deleted file mode 100644 index 0654e1b5..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/devmode.cpp +++ /dev/null @@ -1,251 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2006 Microsoft Corporation. All Rights Reserved. -// -// FILE: devmode.cpp -// -// PURPOSE: Implementation of Devmode functions shared with OEM UI and OEM rendering modules. -// -//-------------------------------------------------------------------------- - -#include "precomp.h" - -#include "debug.h" -#include "devmode.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -BOOL -ConvertOEMDevmode( - _In_ PCOEMDEV pOEMDevIn, - _Inout_ POEMDEV pOEMDevOut - ); - -BOOL -MakeOEMDevmodeValid( - _Out_ POEMDEV pOEMDevmode - ); - -//+--------------------------------------------------------------------------- -// -// Member: -// ::hrOEMDevMode -// -// Synopsis: -// Performs operation on UI Plugins Private DevMode Members. -// Called via IOemUI::DevMode -// -// Returns: -// S_OK or E_FAIL. For more detailed failure info, -// check GetLastError -// -// Last error: -// ERROR_INVALID_PARAMETER -// -// -//---------------------------------------------------------------------------- -HRESULT -hrOEMDevMode( - DWORD dwMode, - // Indicates which operation should be performed - _Inout_ POEMDMPARAM pOemDMParam - // contains various data structures needed by this - // routine. The usage of this struct is determined by - // the dwMode flag. - ) -{ - HRESULT hr = S_OK; - // Return value. - - // - // Verify parameters. - // - if ((NULL == pOemDMParam) || - ((OEMDM_SIZE != dwMode) && - (OEMDM_DEFAULT != dwMode) && - (OEMDM_CONVERT != dwMode) && - (OEMDM_MERGE != dwMode))) - { - ERR("DevMode() ERROR_INVALID_PARAMETER.\r\n"); - - SetLastError(ERROR_INVALID_PARAMETER); - hr = E_FAIL; - } - else - { - POEMDEV pOEMDevIn = (POEMDEV) pOemDMParam->pOEMDMIn;; - // Pointer to the supplied OEM devmode data, if applicable - // based on dwMode. - - POEMDEV pOEMDevOut = (POEMDEV) pOemDMParam->pOEMDMOut;; - // Pointer to the DEVMODE data that this routine is - // expected to configure, if applicable based on dwMode. - - switch (dwMode) - { - // - // The Method should return the size of the memory allocation - // needed to store the UI plugin Private DEVMODE. - // - case OEMDM_SIZE: - pOemDMParam->cbBufSize = sizeof(OEMDEV); - break; - - // - //Should fill the Private DEVMODE with the default values. - // - case OEMDM_DEFAULT: - // - //OEM_DMEXTRAHEADER Members - // - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - break; - - // - // The method should convert private DEVMODE members to - // the current version, if necessary. - // - case OEMDM_CONVERT: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - break; - - // - // The method should validate the information contained in private - // DEVMODE members and merge validated values into a private - // DEVMODE structure containing default values - // - case OEMDM_MERGE: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - MakeOEMDevmodeValid(pOEMDevOut); - break; - } - } - - return hr; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::ConvertOEMDevmode -// -// Synopsis: -// confirm that the private DEVMODE being passed in is data that -// this driver recognizes, read the settings from the input -// OEM DEVMODE data, and write them to pOEMDevOut. -// -// Returns: -// True unless the routine was called with null pointers -// -// -//---------------------------------------------------------------------------- -BOOL -ConvertOEMDevmode( - _In_ PCOEMDEV pOEMDevIn, - // Caller supplied DEVMODE that we are attempting to read - _Inout_ POEMDEV pOEMDevOut - // OEM private DEVMODE configured by this routine based on the settings - // in pOEMDevIn - ) -{ - if ((NULL == pOEMDevIn) || - (NULL == pOEMDevOut)) - { - ERR("ConvertOEMDevmode() invalid parameters.\r\n"); - return FALSE; - } - - // - // Check OEM Signature, if it doesn't match ours, - // then just assume DMIn is bad and use defaults. - // - if(pOEMDevIn->dmOEMExtra.dwSignature == pOEMDevOut->dmOEMExtra.dwSignature) - { - // - // Copy the old structure in to the new using which ever size is the - // smaller. Devmode maybe from newer Devmode (not likely since there - // is only one), or Devmode maybe a newer Devmode, in which case it - // maybe larger, but the first part of the structure should be the same. - // - // DESIGN ASSUMPTION: the private DEVMODE structure only gets added to; - // the fields that are in the DEVMODE never change only new fields get - // added to the end. - // - memcpy(pOEMDevOut, - pOEMDevIn, - __min(pOEMDevOut->dmOEMExtra.dwSize, pOEMDevIn->dmOEMExtra.dwSize)); - - // - // Re-fill in the size and version fields to indicated - // that the DEVMODE is the current private DEVMODE version. - // - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - - // - // If the plug-in is capable of recognizing multiple versions of it's - // private DEVMODE data add custom handling here to support it. - // - } - else - { - WARNING("Unknown DEVMODE signature, pOEMDMIn ignored.\r\n"); - - // - // The private DEVMODE data is not something that this plug-in understands, - // so use defaults. - // - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - } - - return TRUE; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::MakeOEMDevmodeValid -// -// Synopsis: -// Force the OEM devmode settings to valid values. -// -// Returns: -// True if the OEMDEV was configured, else FALSE. Only return false if -// the parameter is NULL. -// -// -//---------------------------------------------------------------------------- -BOOL -MakeOEMDevmodeValid( - _Out_ POEMDEV pOEMDevmode - // OEM DEVMODE data to modify - ) -{ - if(NULL == pOEMDevmode) - { - return FALSE; - } - - // - // Assumption: pOEMDevmode is large enough to contain OEMDEV structure. - // - pOEMDevmode->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevmode->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevmode->dmOEMExtra.dwVersion = OEM_VERSION; - - return TRUE; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/devmode.h b/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/devmode.h deleted file mode 100644 index 791b1a20..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/devmode.h +++ /dev/null @@ -1,52 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2006 Microsoft Corporation. All Rights Reserved. -// -// FILE: devmode.h -// -// PURPOSE: Define common data types, and external function prototypes -// for devmode functions. -// -//-------------------------------------------------------------------------- - -#pragma once - -#define OEM_SIGNATURE 'GDLS' -#define OEM_VERSION 0x00000001L - -// -// OEM private DEVMODE data structure. This gets included in the DEVMODE -// used by Unidrv. -// -typedef struct tagOEMDEV -{ - OEM_DMEXTRAHEADER dmOEMExtra; - // This structure MUST be prefixed by OEM_DMEXTRAHEADER - - // - // Add private DevMode members here, after the standard header - // information. - // - -} OEMDEV, *POEMDEV; - -typedef const OEMDEV *PCOEMDEV; - - -// -// Prototypes -// - -HRESULT -hrOEMDevMode( - DWORD dwMode, - _Inout_ POEMDMPARAM pOemDMParam - ); - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.cpp b/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.cpp deleted file mode 100644 index 6d8fd195..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.cpp +++ /dev/null @@ -1,856 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2006 Microsoft Corporation. All Rights Reserved. -// -// FILE: gdlsmpl.cpp -// -// PURPOSE: Implementation of interface for Unidrv5 UI plug-ins. -// -//-------------------------------------------------------------------------- - -#include "precomp.h" - -#include "debug.h" -#include "devmode.h" -#include "intrface.h" -#include "gdlsmpl.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//-------------------------------------------------------------------------- -// Globals -//-------------------------------------------------------------------------- - -HINSTANCE ghInstance = NULL; - // Module's Instance handle from DLLEntry of process. - - -//-------------------------------------------------------------------------- -// Internal Globals -//-------------------------------------------------------------------------- - -static long g_cComponents = 0; - // Count of active components - -static long g_cServerLocks = 0; - // Count of locks - - -//-------------------------------------------------------------------------- -// Local helper functions -//-------------------------------------------------------------------------- -BOOL __stdcall -DebugPrint( - LPCWSTR pszMessage, - // Format string for the error message - ... - // args specified in the format string. - ) -{ - va_list arglist; - // varargs list for processing the '...' parameter. - - WCHAR szMsgBuf[MAX_PATH] = {0}; - // Use a stack error buffer so that we don't need to - // allocate in the failure path. - - HRESULT hResult; - // Result from formatting the string. - - if (NULL == pszMessage) - { - return FALSE; - } - - // Pass the variable parameters to wvsprintf to be formated. - va_start(arglist, pszMessage); - hResult = StringCbVPrintfW(szMsgBuf, MAX_PATH*sizeof(szMsgBuf[0]), pszMessage, arglist); - va_end(arglist); - - // Dump string to debug output. - OutputDebugStringW(szMsgBuf); - - return SUCCEEDED(hResult); -} - - -//-------------------------------------------------------------------------- -// Class factory for the Plug-In object -//-------------------------------------------------------------------------- -class COemCF : public IClassFactory -{ -public: - - // IUnknown methods - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - LPVOID FAR* ppvObj - ); - - STDMETHOD_(ULONG,AddRef) (THIS); - - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // IClassFactory methods - STDMETHOD(CreateInstance) (THIS_ - _In_opt_ LPUNKNOWN pUnkOuter, - _In_ REFIID riid, - _Outptr_ LPVOID FAR* ppvObject - ); - - STDMETHOD(LockServer) (THIS_ - BOOL bLock - ); - - // Class-specific methods. - COemCF(): m_cRef(1) { }; - - ~COemCF() { }; - -protected: - LONG m_cRef; - -}; - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::DllMain -// -// Synopsis: -// Dll's main routine, called when new -// threads or processes reference the module -// -// Returns: -// TRUE. Currently has no failure paths. Return false if the module -// cannot be properly initialized. -// -// Notes: -// the caller of this routine holds a process-wide lock preventing more -// than one module from being initialized at a time. In general, -// plug-ins should do as little as possible in this routine to avoid -// stalling other threads that may need to load modules. Also, calling -// any function that would, in-turn, cause another module to be loaded -// could result in a deadlock. -// -// -//---------------------------------------------------------------------------- -extern "C" BOOL -WINAPI DllMain( - HINSTANCE hInst, - WORD wReason, - LPVOID lpReserved - ) -{ - UNREFERENCED_PARAMETER(hInst); - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - ghInstance = hInst; - break; - - case DLL_THREAD_ATTACH: - break; - - case DLL_PROCESS_DETACH: - break; - - case DLL_THREAD_DETACH: - break; - } - - return TRUE; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// ::DllCanUnloadNow -// -// Synopsis: -// Can the DLL be unloaded from memory? Answers no if any objects are -// still allocated, or if the server has been locked. -// -// To avoid leaving OEM DLL still in memory when Unidrv or Pscript -// drivers are unloaded, Unidrv and Pscript driver ignore the return -// value of DllCanUnloadNow of the OEM DLL, and always call FreeLibrary -// on the OEMDLL. -// -// If the plug-in spins off a working thread that also uses this DLL, -// the thread needs to call LoadLibrary and FreeLibraryAndExitThread, -// otherwise it may crash after Unidrv or Pscript calls FreeLibrary. -// -// Returns: -// S_OK if the DLL can be unloaded safely, otherwise S_FALSE -// -// -//---------------------------------------------------------------------------- -STDAPI DllCanUnloadNow() -{ - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK; - } - else - { - return S_FALSE; - } -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::DllGetClassObject -// -// Synopsis: -// Retrieve the class factory object for the indicated class. -// -// Returns: -// CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, or S_OK. -// -// Notes: -// -// -//---------------------------------------------------------------------------- -STDAPI -DllGetClassObject( - _In_ CONST CLSID& clsid, - // GUID of the class object that the caller wants a class factory for - _In_ CONST IID& iid, - // Interface ID to provide in ppv - _Outptr_ VOID** ppv - // out pointer to the interface requested. - ) -{ - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // - // Can we create this component? - // - if (clsid != CLSID_OEMUI) - { - return CLASS_E_CLASSNOTAVAILABLE; - } - - // - // Create class factory. - // Reference count set to 1 in Constructor - // - COemCF* pGDLSampleClassFactory = new COemCF; - if (pGDLSampleClassFactory == NULL) - { - return E_OUTOFMEMORY; - } - - // - // Get requested interface. - // - HRESULT hr = pGDLSampleClassFactory->QueryInterface(iid, ppv); - pGDLSampleClassFactory->Release(); - - return hr; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemCF::QueryInterface -// -// Synopsis: -// Standard COM IUnknown implementation. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemCF::QueryInterface( - CONST IID& iid, - VOID** ppv - ) -{ - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this); - } - else - { - *ppv = NULL; - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemCF::AddRef -// -// Synopsis: -// Standard COM IUnknown implementation. -// -// -//---------------------------------------------------------------------------- -ULONG __stdcall -COemCF::AddRef() -{ - return InterlockedIncrement(&m_cRef); -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemCF::Release -// -// Synopsis: -// Standard COM IUnknown implementation. -// -// -//---------------------------------------------------------------------------- -_At_(this, __drv_freesMem(object)) -ULONG __stdcall -COemCF::Release() -{ - assert(0 != m_cRef); - - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - } - return cRef; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemCF::CreateInstance -// -// Synopsis: -// Attempt to create an object that implements the specified interface. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemCF::CreateInstance( - _In_opt_ IUnknown* pUnknownOuter, - _In_ CONST IID& iid, - _Outptr_ VOID** ppv - ) -{ - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // - // Cannot aggregate. - // - if (pUnknownOuter != NULL) - { - return CLASS_E_NOAGGREGATION; - } - - HRESULT hr = S_OK; - - if (iid == IID_IUnknown || - iid == IID_IPrintOemUI2) - { - // - // Create component. - // - COemUI2* pOemCB = new COemUI2; - if (pOemCB == NULL) - { - hr = E_OUTOFMEMORY; - } - else - { - // - // Get the requested interface. - // - hr = pOemCB->QueryInterface(iid, ppv); - - // - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - // - pOemCB->Release(); - } - } - else - { - hr = E_NOINTERFACE; - } - - return hr; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemCF::LockServer -// -// Synopsis: -// Locking the server holds the objects server in memory, so that new -// instances of objects can be created more quickly. -// -// Returns: -// S_OK -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemCF::LockServer( - BOOL bLock - // If true, increment the lock count, otherwise decrement the lock - // count. - ) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks); - } - else - { - InterlockedDecrement(&g_cServerLocks); - } - - return S_OK; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2 (destructor) -// -// Synopsis: -// Release the helper interface, as well as any other resources that -// the plug-in is holding onto. -// -// Returns: -// -// Notes: -// -// -//---------------------------------------------------------------------------- -COemUI2::~COemUI2() -{ - // - // Make sure that helper interface is released. - // - if(NULL != m_pCoreHelper) - { - m_pCoreHelper->Release(); - m_pCoreHelper = NULL; - } - - // - // If this instance of the object is being deleted, then the reference - // count should be zero. - // - assert(0 == m_cRef); -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::PublishDriverInterface -// -// Synopsis: -// This routine is called by the core driver to supply objects to the -// plug-in which the plug-in can use to implement various features. -// -// This implementation requires an object that IPrintCoreHelper interface -// from the core driver to implement full UI replacement. If the object -// passed in is the one desired, this routine will return S_OK, otherwise -// it will return E_FAIL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::PublishDriverInterface( - IUnknown *pIUnknown - ) -{ - HRESULT hr = S_OK; - - // - // Save a pointer to the IPrintCoreHelperUni interface. This will allow - // the plug-in to access it's GDL file (which can be it's GPD file as well) - // - if (m_pCoreHelper == NULL) - { - hr = pIUnknown->QueryInterface(IID_IPrintCoreHelperUni, (VOID**) &(m_pCoreHelper)); - - if (!SUCCEEDED(hr)) - { - m_pCoreHelper = NULL; - hr = E_FAIL; - } - } - - return hr; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::GetInfo -// -// Synopsis: -// Most of this routine is a standard implementation common to most -// plug-ins. Of particular note in this sample is that to get a handle -// the IPrintCoreHelper plug-in in the PublishDriverInterface callback, -// this routine must return OEMPUBLISH_IPRINTCOREHELPER in the out -// parameter when the mode is OEMGI_GETREQUESTEDHELPERINTERFACES. -// -// Returns: -// S_OK for supported modes, E_FAIL for everything else. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::GetInfo( - DWORD dwMode, - // The mode indicates what information is being requested by the - // core driver. - _Out_writes_bytes_(cbSize) PVOID pBuffer, - // The output buffer is the location into which the requested info - // should be written - DWORD cbSize, - // The size of the output buffer. - PDWORD pcbNeeded - // If the size of the buffer is insufficient, use this parameter - // to indicate to the core driver how much space is required. - ) -{ - HRESULT hrResult = S_OK; - - // - // Validate parameters. OEMGI_GETPUBLISHERINFO is excluded from this - // list because that GetInfo mode applies only to PScript rendering plug-ins. - // - if ((NULL == pcbNeeded) || - ((OEMGI_GETSIGNATURE != dwMode) && - (OEMGI_GETVERSION != dwMode) && - (OEMGI_GETREQUESTEDHELPERINTERFACES != dwMode))) - { - WARNING("COemUI2::GetInfo() exit pcbNeeded is NULL or mode is not supported\r\n"); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // - // Set expected buffer size and number of bytes written. - // - *pcbNeeded = sizeof(DWORD); - - // - // Check buffer size is sufficient. - // - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - WARNING("COemUI2::GetInfo() exit insufficient buffer!\r\n"); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - hrResult = E_FAIL; - } - else - { - switch(dwMode) - { - // - // OEM DLL Signature - // - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // - // OEM DLL version - // - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // - // The UI is asking whether the plug-in uses the IPrintCoreHelper based - // helper object. Indicate that the plug-in does need this object. - // - case OEMGI_GETREQUESTEDHELPERINTERFACES: - *(PDWORD)pBuffer = 0; - *(PDWORD)pBuffer |= OEMPUBLISH_IPRINTCOREHELPER; - break; - - // - // dwMode not supported. - // - default: - // - // Set written bytes to zero since nothing was written. - // - WARNING("COemUI2::GetInfo() exit mode not supported.\r\n"); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - hrResult = E_FAIL; - } - } - - return hrResult; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::DevMode -// -// Synopsis: -// This routine operates in various modes to manage the private DEVMODE. -// This sample does not provide much by way of illustration of how to -// handle OEM settings in the private DEVMODE. See the sample OEMUI for -// a more in-depth look at this routine. The function hrOEMDevMode in -// devmode.cpp also provides more information on how to handle the various -// modes. -// -// Returns: -// S_OK on success, else E_* -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::DevMode( - DWORD dwMode, - // The operation that should be performed - POEMDMPARAM pOemDMParam - // The input & output DEVMODEs, including pointers to the public & - // private DEVMODE data. - ) -{ - return hrOEMDevMode(dwMode, pOemDMParam); -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::DocumentPropertySheets -// -// Synopsis: -// Show the GPD version in the debugger whenever the -// printing preferences UI is shown. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::DocumentPropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ) -{ - UNREFERENCED_PARAMETER(pPSUIInfo); - UNREFERENCED_PARAMETER(lParam); - - this->DbgShowGPDVersion(); - - return S_OK; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::DbgShowGPDVersion -// -// Synopsis: -// Display the GPD version in the debugger using a GDL snapshot & MSXML 6 -// To make this work on versions of Windows prior to Windows Vista, change -// references to MSXML 6 with MSXML 3. -// -// -//---------------------------------------------------------------------------- -HRESULT -COemUI2::DbgShowGPDVersion() -{ - HRESULT hr; - IXMLDOMDocument2 *pDOMSnapshot = NULL; - IXMLDOMNode *pVersionNode = NULL; - - // - // Get a DOM representation of the snapshot using MSXML 3 - // - hr = LoadGDLSnapshot(&pDOMSnapshot); - - if (hr == REGDB_E_CLASSNOTREG) - { - DebugPrint(L"COemUI2::PublishHelperInterface: MSXML 6.0 not registered, GDL version lookup disabled\r\n"); - } - - // - // Find the GDL node that contains the GPDFileVersion. This should return a single XML DOM Element. - // - if (SUCCEEDED(hr)) - { - hr = pDOMSnapshot->selectSingleNode((BSTR)TEXT("//gdl:SnapshotRoot/gdl:GDL_ATTRIBUTE[@Name=\"*GPDFileVersion\"]"), &pVersionNode); - } - - // - // If the node was found, write the version information to the debugger. - // It's content is represented as CDATA in the XML, but MSXML will - // normalize that to a regular string when it parses the XML. - // - if (SUCCEEDED(hr) && pVersionNode) - { - VARIANT varVersionString; - - // - // Get DefaultOption name - // - hr = pVersionNode->get_nodeTypedValue(&varVersionString); - - if (SUCCEEDED(hr)) - { - DebugPrint(L"COemUI2::PublishHelperInterface: GDL Version: %s\r\n", varVersionString.bstrVal); - } - - VariantClear(&varVersionString); - } - - if (pDOMSnapshot) - { - pDOMSnapshot->Release(); - pDOMSnapshot = NULL; - } - - return hr; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::LoadGDLSnapshot -// -// Synopsis: -// Load the GDL snapshot from IPrintCoreHelperUni into a DOM object, -// and set appropriate properties on the DOM to prepare it for use -// with xpath queries. -// -// -//---------------------------------------------------------------------------- -HRESULT -COemUI2::LoadGDLSnapshot( - _Out_ IXMLDOMDocument2 **ppDOMSnapshot - ) -{ - HRESULT hr = S_OK; - IStream *pSnapshotStream = NULL; - VARIANT_BOOL loadResult = 0; - - if (!ppDOMSnapshot) - { - return E_INVALIDARG; - } - - (*ppDOMSnapshot) = NULL; - - hr = m_pCoreHelper->CreateDefaultGDLSnapshot(0, &pSnapshotStream); - - if (SUCCEEDED(hr)) - { - // - // Create DOM document - // - hr = m_pCoreHelper->CreateInstanceOfMSXMLObject(CLSID_DOMDocument60, - NULL, - CLSCTX_INPROC_SERVER, - IID_IXMLDOMDocument2, - (LPVOID *)ppDOMSnapshot); - } - - if (SUCCEEDED(hr)) - { - VARIANT streamVar; - - VariantInit(&streamVar); - V_VT(&streamVar) = VT_UNKNOWN; - V_UNKNOWN(&streamVar) = pSnapshotStream; - pSnapshotStream->AddRef(); - - // - // Load the snapshot into the DOM document - // - (*ppDOMSnapshot)->put_async(VARIANT_FALSE); - (*ppDOMSnapshot)->put_validateOnParse(VARIANT_FALSE); - (*ppDOMSnapshot)->put_resolveExternals(VARIANT_FALSE); - - hr = (*ppDOMSnapshot)->load(streamVar, &loadResult); - - VariantClear(&streamVar); - } - - // - // If the DOM fails to load, the HRESULT will be S_FALSE, so explicitly - // look for S_OK. - // - if (hr == S_OK) - { - // - // Set the namespaces that should be available for xpath queries later. - // - BSTR bstrDefNameSpace = SysAllocString(TEXT("xmlns:gdl=\"http://schemas.microsoft.com/2002/print/gdl/1.0\"")); - - if (!bstrDefNameSpace) - { - hr = E_OUTOFMEMORY; - } - - if (SUCCEEDED(hr)) - { - VARIANT varDefNameSpace; - - VariantInit(&varDefNameSpace); - varDefNameSpace.vt = VT_BSTR; - varDefNameSpace.bstrVal = bstrDefNameSpace; - - hr = (*ppDOMSnapshot)->setProperty((BSTR)TEXT("SelectionNamespaces"), varDefNameSpace); - SysFreeString(bstrDefNameSpace); - } - } - else - { - hr = E_FAIL; - } - - if (FAILED(hr) && *ppDOMSnapshot) - { - (*ppDOMSnapshot)->Release(); - (*ppDOMSnapshot) = NULL; - } - - if (pSnapshotStream) - { - pSnapshotStream->Release(); - pSnapshotStream = NULL; - } - - return hr; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.def b/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.def deleted file mode 100644 index d9534de1..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.def +++ /dev/null @@ -1,18 +0,0 @@ -; -; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -; ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -; PARTICULAR PURPOSE. -; -; Copyright 1997 - 2006 Microsoft Corporation. All Rights Reserved. -; -; Abstract: -; -; This file contains a listing of all of the methods to be exported -; from the DLL, as well as rules for how to name the exports. -; - -LIBRARY GDLSMPL - -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.h b/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.h deleted file mode 100644 index 77ba7647..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.h +++ /dev/null @@ -1,79 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2006 Microsoft Corporation. All Rights Reserved. -// -// FILE: gdlsmpl.h -// -// PURPOSE: COM implementation of a UI module that uses GDL. CAbstractOemUI2 -// is defined in intrface.h, and contains a default implementation of -// all optional interface methods. -// -//-------------------------------------------------------------------------- - -#pragma once - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -extern HINSTANCE ghInstance; - // Module's Instance handle from DLLEntry of process. - -class COemUI2: public CAbstractOemUI2 -{ -public: - - COemUI2() : - m_pCoreHelper(NULL) - {} - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Get OEM dll related information - // - STDMETHOD(GetInfo) (THIS_ - DWORD dwMode, - _Out_writes_bytes_(cbSize) PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDevMode - // - STDMETHOD(DevMode) (THIS_ DWORD dwMode, POEMDMPARAM pOemDMParam); - - // - // OEMDocumentPropertySheets - // - STDMETHOD(DocumentPropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - virtual ~COemUI2(); - -protected: - - HRESULT - DbgShowGPDVersion(); - - HRESULT - LoadGDLSnapshot( - _Out_ IXMLDOMDocument2 **ppDOMSnapshot - ); - - IPrintCoreHelperUni* m_pCoreHelper; - // Pointer to the helper interface introduced in Windows Vista. -}; - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.rc b/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.rc deleted file mode 100644 index 5cd078df..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/gdlsmpl.rc +++ /dev/null @@ -1,106 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2006 Microsoft Corporation. All Rights Reserved. -// -// FILE: gdlsmpl.rc -// -// PURPOSE: Resource script containing all localizable strings for this -// module -// -//-------------------------------------------------------------------------- - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Developed by Microsoft Corp." - VALUE "CompanyName", "Microsoft Corp." - VALUE "FileDescription", "GDL Sample Printer UI Module" - VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "GDLSMPL" - VALUE "LegalCopyright", "Copyright 1998 - 2006 Microsoft Corp." - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation" - VALUE "OriginalFilename", "GDLSMPL.dll" - VALUE "ProductName", "Microsoft GDL Sample Driver" - VALUE "ProductVersion", "1.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/intrface.cpp deleted file mode 100644 index d399712d..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/intrface.cpp +++ /dev/null @@ -1,559 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2006 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.cpp -// -// PURPOSE: Generic abstract base class useful for creating implementation -// of interface for Unidrv5 UI plug-ins. This base class -// implements all methods which have a standard implementation -// and / or are optional. Non-optional mathods are pure virtual -// in this base class. -// -//-------------------------------------------------------------------------- - -#include "precomp.h" - -#include "debug.h" -#include "devmode.h" -#include "intrface.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::QueryInterface -// -// Synopsis: -// Standard COM IUnknown implementation. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::QueryInterface( - CONST IID& iid, - VOID** ppv - ) -{ - if (iid == IID_IUnknown) - { - *ppv = static_cast(this); - } - else if (iid == IID_IPrintOemUI2) - { - *ppv = static_cast(this); - } - else - { - *ppv = NULL; - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::AddRef -// -// Synopsis: -// Standard COM IUnknown implementation. -// -// -//---------------------------------------------------------------------------- -ULONG __stdcall -CAbstractOemUI2::AddRef() -{ - return InterlockedIncrement(&m_cRef); -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::Release -// -// Synopsis: -// Standard COM IUnknown implementation. -// -// -//---------------------------------------------------------------------------- -_At_(this, __drv_freesMem(object)) -ULONG __stdcall -CAbstractOemUI2::Release() -{ - ASSERT(0 != m_cRef); - - ULONG cRef = InterlockedDecrement(&m_cRef); - - if (0 == cRef) - { - delete this; - return 0; - - } - - return cRef; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::HideStandardUI -// -// Synopsis: -// This routine is critical to supporting full UI replacement. This -// routine allows the plug-in to disable Unidrv's (or PScript's) standard -// UI panels. If this returns E_NOTIMPL, the panel isn't hidden. If -// this routine returns S_OK, Unidrv will not display any UI for the -// specified mode. If this returns E_NOTIMPL, Unidrv will display it's -// standard UI. -// -// Returns: -// S_OK to hide the indicated UI if desired, otherwise E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::HideStandardUI( - DWORD dwMode - // document property sheets, printer property sheets, or possibly - // something not yet defined. - ) -{ - UNREFERENCED_PARAMETER(dwMode); - - return E_NOTIMPL; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::DocumentPropertySheets -// -// Synopsis: -// A plug-in may optionally add property sheets. If the plug-in has -// chosen to hide the standard UI, then it would instead provide -// replacements for the standard property sheets. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::DocumentPropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ) -{ - UNREFERENCED_PARAMETER(pPSUIInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::DevicePropertySheets -// -// Synopsis: -// A plug-in may optionally add property sheets. If the plug-in has -// chosen to hide the standard UI, then it would instead provide -// replacements for the standard property sheets. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::DevicePropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ) -{ - UNREFERENCED_PARAMETER(pPSUIInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::CommonUIProp -// -// Synopsis: -// This routine is used to interact with the Unidrv-supplied -// property sheet pages. Since this plug-in implements full-UI -// replacement, those property sheet pages are disabled, and this -// routine does not need to do anything. -// -// Returns: -// S_OK -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::CommonUIProp( - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam - ) -{ - UNREFERENCED_PARAMETER(dwMode); - UNREFERENCED_PARAMETER(pOemCUIPParam); - - return E_NOTIMPL; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::DeviceCapabilities -// -// Synopsis: -// This routine can be used to replace the Unidrv's device capabilities -// handling. In this implementation, no custom capabilities handling is -// provided. -// -// Returns: -// E_FAIL -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::DeviceCapabilities( - _Inout_ POEMUIOBJ poemuiobj, - // OEM settings & information - _In_ HANDLE hPrinter, - // Handle to the printer that the capabilities are being requested for - _In_ PWSTR pDeviceName, - // Name of the device / driver - WORD wCapability, - // The DC_ ID indicating which capability was requested. - _Out_ PVOID pOutput, - // Buffer to write requested information to. - _In_ PDEVMODE pPublicDM, - // Pointer to the public DEVMODE representing the settings to get - // capabilities with respect to. - _In_ PVOID pOEMDM, - // OEM private DEVMODE settings. - DWORD dwOld, - // Result from previous plug-in call to this routine. - _Out_ DWORD *dwResult - // Result of this call. If there are multiple UI plug-ins, this - // result is passed to the next one as dwOld - ) -{ - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(pDeviceName); - UNREFERENCED_PARAMETER(wCapability); - UNREFERENCED_PARAMETER(pOutput); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - UNREFERENCED_PARAMETER(dwOld); - UNREFERENCED_PARAMETER(dwResult); - - // - // Do nothing. Let Unidrv handle the device capabilities processing. - // - - return E_NOTIMPL; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::DevQueryPrintEx -// -// Synopsis: -// This routine is used to determine print job compatibility with the -// current driver. The plug-in can supplement Unidrv's handling of this -// routine. If Unidrv determines that a job can be printed on the current -// printer it will call this routine to ask the plug-in whether it can -// also handle the current job. If Unidrv determines that the job cannot -// be printed, it will not call the plug-in. Additionally, XPS drivers -// built on the Unidrv and PScript UI modules may not recieve this call- -// back. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::DevQueryPrintEx( - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM - ) -{ - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pDQPInfo); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - - return E_NOTIMPL; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::UpgradePrinter -// -// Synopsis: -// Use this callback to upgrade any settings from previous versions -// that are stored in the registry by the plug-in Not applicabe to -// this sample. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::UpgradePrinter( - DWORD dwLevel, - PBYTE pDriverUpgradeInfo - ) -{ - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverUpgradeInfo); - - return E_NOTIMPL; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::PrinterEvent -// -// Synopsis: -// Perform any special processing needed when various events occur to the -// print queue. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::PrinterEvent( - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam - ) -{ - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(iDriverEvent); - UNREFERENCED_PARAMETER(dwFlags); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::DriverEvent -// -// Synopsis: -// Notifies the plug-in of changes or events relevant to the driver, -// such as installing and upgrading. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::DriverEvent( - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam - ) -{ - UNREFERENCED_PARAMETER(dwDriverEvent); - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::QueryColorProfile -// -// Synopsis: -// This routine can be implemented to provide a color profile from the -// driver. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::QueryColorProfile( - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulQueryMode, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData - ) -{ - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - UNREFERENCED_PARAMETER(ulQueryMode); - UNREFERENCED_PARAMETER(pvProfileData); - UNREFERENCED_PARAMETER(pcbProfileData); - UNREFERENCED_PARAMETER(pflProfileData); - - return E_NOTIMPL; -}; - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::FontInstallerDlgProc -// -// Synopsis: -// Plug-ins can use this method to replace Unidrv's provided soft-font -// installer dialog. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::FontInstallerDlgProc( - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam - ) -{ - UNREFERENCED_PARAMETER(hWnd); - UNREFERENCED_PARAMETER(usMsg); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::UpdateExternalFonts -// -// Synopsis: -// This routine is used to notify the UI of any changes to installed -// font cartridges, primarily for supporting soft-font UI replacement. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::UpdateExternalFonts( - _In_ HANDLE hPrinter, - _In_ HANDLE hHeap, - _In_ PWSTR pwstrCartridges - ) -{ - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(hHeap); - UNREFERENCED_PARAMETER(pwstrCartridges); - - return E_NOTIMPL; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::QueryJobAttributes -// -// Synopsis: -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::QueryJobAttributes( - HANDLE hPrinter, - PDEVMODE pDevmode, - DWORD dwLevel, - LPBYTE lpAttributeInfo - ) -{ - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(pDevmode); - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(lpAttributeInfo); - - return E_NOTIMPL; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// CAbstractOemUI2::DocumentEvent -// -// Synopsis: -// Perform any special processing needed at various points in time while -// a job is printing. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -CAbstractOemUI2::DocumentEvent( - HANDLE hPrinter, - HDC hdc, - INT iEsc, - ULONG cbIn, - PVOID pbIn, - ULONG cbOut, - PVOID pbOut, - PINT piResult - ) -{ - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(hdc); - UNREFERENCED_PARAMETER(iEsc); - UNREFERENCED_PARAMETER(cbIn); - UNREFERENCED_PARAMETER(pbIn); - UNREFERENCED_PARAMETER(cbOut); - UNREFERENCED_PARAMETER(pbOut); - UNREFERENCED_PARAMETER(piResult); - - return E_NOTIMPL; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/intrface.h deleted file mode 100644 index 07e1175c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/intrface.h +++ /dev/null @@ -1,212 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2006 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.h -// -// PURPOSE: Defines a class with default implementations of the UI -// interface plug=-in methods that are optional. -// -//-------------------------------------------------------------------------- - -#pragma once - -class CAbstractOemUI2: public IPrintOemUI2 -{ -public: - // - // *** IUnknown methods *** - // - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown) = 0; - - // - // Get OEM dll related information - // - STDMETHOD(GetInfo) (THIS_ - DWORD dwMode, - _Out_writes_bytes_(cbSize) PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded) = 0; - - // - // OEMDevMode - // - STDMETHOD(DevMode) (THIS_ DWORD dwMode, POEMDMPARAM pOemDMParam) = 0; - - // - // OEMCommonUIProp - // - STDMETHOD(CommonUIProp) (THIS_ - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam - ); - - // - // OEMDocumentPropertySheets - // - STDMETHOD(DocumentPropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - // - // OEMDevicePropertySheets - // - STDMETHOD(DevicePropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - - // - // OEMDevQueryPrintEx - // - STDMETHOD(DevQueryPrintEx) (THIS_ - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM - ); - - // - // OEMDeviceCapabilities - // - STDMETHOD(DeviceCapabilities) (THIS_ - _Inout_ POEMUIOBJ poemuiobj, - _In_ HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - _Out_ PVOID pOutput, - _In_ PDEVMODE pPublicDM, - _In_ PVOID pOEMDM, - DWORD dwOld, - _Out_ DWORD *dwResult - ); - - // - // OEMUpgradePrinter - // - STDMETHOD(UpgradePrinter) (THIS_ - DWORD dwLevel, - PBYTE pDriverUpgradeInfo - ); - - // - // OEMPrinterEvent - // - STDMETHOD(PrinterEvent) (THIS_ - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam - ); - - // - // OEMDriverEvent - // - STDMETHOD(DriverEvent)(THIS_ - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam - ); - - // - // OEMQueryColorProfile - // - STDMETHOD( QueryColorProfile) (THIS_ - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulReserved, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData); - - // - // OEMFontInstallerDlgProc - // - STDMETHOD(FontInstallerDlgProc) (THIS_ - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam - ); - // - // UpdateExternalFonts - // - STDMETHOD(UpdateExternalFonts) (THIS_ - _In_ HANDLE hPrinter, - _In_ HANDLE hHeap, - _In_ PWSTR pwstrCartridges - ); - - // - // IPrintOemUI2 methods - // - - // - // QueryJobAttributes - // - STDMETHOD(QueryJobAttributes) (THIS_ - HANDLE hPrinter, - PDEVMODE pDevmode, - DWORD dwLevel, - LPBYTE lpAttributeInfo - ); - - // - // Hide Standard UI - // - STDMETHOD(HideStandardUI) (THIS_ - DWORD dwMode - ); - - // - // DocumentEvent - // - STDMETHOD(DocumentEvent) (THIS_ - HANDLE hPrinter, - HDC hdc, - INT iEsc, - ULONG cbIn, - PVOID pbIn, - ULONG cbOut, - PVOID pbOut, - PINT piResult - ); - - CAbstractOemUI2() - { - m_cRef = 1; - }; - - virtual ~CAbstractOemUI2() {}; - -protected: - - LONG m_cRef; - // reference count of this object - -}; - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/precomp.h deleted file mode 100644 index 0533325f..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/precomp.h +++ /dev/null @@ -1,62 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2006 Microsoft Corporation. All Rights Reserved. -// -// FILE: precomp.h -// -// PURPOSE: Header files that should be in the precompiled header. -// -//-------------------------------------------------------------------------- - -#pragma once - -// Necessary for compiling under VC. -#if(!defined(WINVER) || (WINVER < 0x0500)) - #undef WINVER - #define WINVER 0x0500 -#endif -#if(!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)) - #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0500 -#endif - - -// Required header files that shouldn't change often. - - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// -// These files should always be last in your include list. -// -#include -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/gdl/src/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oem.gpd b/print/OEM Printer Customization Plug-in Samples/C++/oem.gpd deleted file mode 100644 index 2621cbb1..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oem.gpd +++ /dev/null @@ -1,704 +0,0 @@ -*GPDFileName: "oem.gpd" -*GPDFileVersion: "1.0" -*GPDSpecVersion: "1.0" -*Include: "StdNames.gpd" -*Include: "ttfsub.gpd" -*ModelName: "OEM Unidrv Customization Sample" -*MasterUnits: PAIR(1200, 1200) -*ResourceDLL: "unires.dll" -*PrinterType: PAGE -*MaxCopies: 99 -*PrintRate: 16 -*PrintRateUnit: PPM -*PrintRatePPM: 16 - -*%****************************************************************************************** -*% Orientation -*%****************************************************************************************** -*Feature: Orientation -{ - *rcNameID: =ORIENTATION_DISPLAY - *DefaultOption: PORTRAIT - *Option: PORTRAIT - { - *rcNameID: =PORTRAIT_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.6 - *Cmd: "<1B>&l0O" - } - } - *Option: LANDSCAPE_CC90 - { - *rcNameID: =LANDSCAPE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.8 - *Cmd: "<1B>&l1O" - } - } -} - -*%****************************************************************************************** -*% Input Bin -*%****************************************************************************************** -*Feature: InputBin -{ - *rcNameID: =PAPER_SOURCE_DISPLAY - *DefaultOption: AUTO - *Option: AUTO - { - *rcNameID: =AUTO_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l0H" - } - } - *Option: UPPER - { - *rcNameID: =UPPER_TRAY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l1H" - } - } -} - -*%****************************************************************************************** -*% Resolution -*%****************************************************************************************** -*Feature: Resolution -{ - *rcNameID: =RESOLUTION_DISPLAY - *DefaultOption: Option2 - *Option: Option1 - { - *Name: "600 x 600" =DOTS_PER_INCH - *DPI: PAIR(600, 600) - *TextDPI: PAIR(600, 600) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED,TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "@PJL SET RESOLUTION=600<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t600R" - } - } - *Option: Option2 - { - *Name: "300 x 300" =DOTS_PER_INCH - *DPI: PAIR(300, 300) - *TextDPI: PAIR(300, 300) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED, TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "@PJL SET RESOLUTION=300<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t300R" - } - } - *Option: Option3 - { - *Name: "150 x 150" =DOTS_PER_INCH - *DPI: PAIR(150, 150) - *TextDPI: PAIR(150, 150) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED, TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "@PJL SET RESOLUTION=150<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t150R" - } - } -} - -*%****************************************************************************************** -*% HP-GL/2 Graphics Support -*%****************************************************************************************** -*Ifdef: WINNT_51 -*Personality: =PERSONALITY_HPGL2 -*Feature: GraphicsMode -{ - *rcNameID: =GRAPHICSMODE_DISPLAY - *DefaultOption: RASTERMODE - *Option: HPGL2MODE - { - *rcNameID: =GRAPHICSMODE_HPGL2_DISPLAY - } - *Option: RASTERMODE - { - *rcNameID: =GRAPHICSMODE_RASTER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.6 - *Cmd: "@PJL SET LIMAGEENHANCE=OFF<0A>" - } - } -} -*Endif: - -*%****************************************************************************************** -*% Paper Size -*%****************************************************************************************** -*Feature: PaperSize -{ - *rcNameID: =PAPER_SIZE_DISPLAY - *DefaultOption: LETTER - *Option: LETTER - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1028 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9500, 12500) - *PrintableOrigin: PAIR(400, 400) - *CursorOrigin: PAIR(300, 300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t5260x7704Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9500, 12200) - *PrintableOrigin: PAIR(450, 300) - *CursorOrigin: PAIR(200, 12900) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t7332x5880Y" - } - } - } - } - *Option: LEGAL - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1692 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 600) - *CursorOrigin: PAIR(180, 300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t5880x8900Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 900) - *CursorOrigin: PAIR(180, 16500) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t8900x5880Y" - } - } - } - } - *Option: EXECUTIVE - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4109 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(8100, 11500) - *PrintableOrigin: PAIR(300, 300) - *CursorOrigin: PAIR(300, 200) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t4860x7344Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(8300, 11500) - *PrintableOrigin: PAIR(200, 300) - *CursorOrigin: PAIR(200, 12300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t7272x4980Y" - } - } - } - } - *Option: A4 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4249 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9100, 13200) - *PrintableOrigin: PAIR(400, 300) - *CursorOrigin: PAIR(288, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t5594x8201Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9100, 13200) - *PrintableOrigin: PAIR(400, 300) - *CursorOrigin: PAIR(204, 13824) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t8129x5714Y" - } - } - } - } - *Option: B5 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 3198 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(7900, 11140) - *PrintableOrigin: PAIR(352, 300) - *CursorOrigin: PAIR(300, 100) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l12a8c1E<1B>*p0x0Y<1B>*c0t4970x7040Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(7760, 11140) - *PrintableOrigin: PAIR(300, 400) - *CursorOrigin: PAIR(100, 11940) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l12a8c1E<1B>*p0x0Y<1B>*c0t6780x4970Y" - } - } - } - } -} - -*%****************************************************************************************** -*% Media Type -*%****************************************************************************************** -*Feature: MediaType -{ - *rcNameID: =MEDIA_TYPE_DISPLAY - *DefaultOption: PLAIN - *Option: PLAIN - { - *rcNameID: =PLAIN_PAPER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.15 - *Cmd: "<1B>&n6WdPlain" - } - } - *Option: TRANSPARENCY - { - *rcNameID: =TRANSPARENCY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.15 - *Cmd: "<1B>&n13WdTransparency" - } - } -} - -*%****************************************************************************************** -*% Color Mode -*%****************************************************************************************** -*Feature: ColorMode -{ - *rcNameID: =COLOR_PRINTING_MODE_DISPLAY - *DefaultOption: 24bpp - *Option: Mono - { - *rcNameID: =MONO_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 1 - *Color?: FALSE - } - *Option: Color - { - *rcNameID: =COLOR_DISPLAY - *DevNumOfPlanes: 3 - *DevBPP: 1 - *DrvBPP: 4 - EXTERN_GLOBAL: *RasterSendAllData?: TRUE - *ColorPlaneOrder: LIST(CYAN, MAGENTA, YELLOW) - *Command: CmdSendCyanData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"V" } - *Command: CmdSendMagentaData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"V" } - *Command: CmdSendYellowData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelectBlackColor { *Cmd : "<1B>*v7S" } - *Command: CmdSelectRedColor { *Cmd : "<1B>*v6S" } - *Command: CmdSelectGreenColor { *Cmd : "<1B>*v5S" } - *Command: CmdSelectYellowColor { *Cmd : "<1B>*v4S" } - *Command: CmdSelectBlueColor { *Cmd : "<1B>*v3S" } - *Command: CmdSelectMagentaColor { *Cmd : "<1B>*v2S" } - *Command: CmdSelectCyanColor { *Cmd : "<1B>*v1S" } - *Command: CmdSelectWhiteColor { *Cmd : "<1B>*v0S" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "<1B>*r-3U" - } - } - *Option: 8bpp - { - *rcNameID: =8BPP_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 8 - *DrvBPP: 8 - *PaletteSize: 256 - *PaletteProgrammable? : TRUE - *Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" -+ %d{PaletteIndexToProgram} "I" } - *Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "<1B>*v1N<1B>*v1O<1B>*t0I<1B>*l184O<1B>*v6W<000108080808>" - } - } - *Option: 24bpp - { - *rcNameID: =24BPP_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 24 - *DrvBPP: 24 - *Command: CmdEnableDRC { *Cmd : "<1B>*b3M" } - *PaletteSize: 256 - *PaletteProgrammable? : TRUE - *Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" -+ %d{PaletteIndexToProgram} "I" } - *Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } - *Command: CmdSetSrcBmpWidth { *Cmd : "<1B>*r" %d{RasterDataWidthInBytes / 3}"S" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "<1B>*v1N<1B>*v1O<1B>*l184O<1B>*v6W<0003080808081B>*v0a0b0c7i255a255b255c0I<1B>*" -+ "o3W<060400>" - } - } -} - -*%****************************************************************************************** -*% HalfTone -*%****************************************************************************************** -*Feature: Halftone -{ - *rcNameID: =HALFTONING_DISPLAY - *DefaultOption: HT_PATSIZE_AUTO - *Option: HT_PATSIZE_AUTO - { - *rcNameID: =HT_AUTO_SELECT_DISPLAY - } - *Option: HT_PATSIZE_SUPERCELL_M - { - *rcNameID: =HT_SUPERCELL_DISPLAY - } - *Option: HT_PATSIZE_6x6_M - { - *rcNameID: =HT_DITHER6X6_DISPLAY - } - *Option: HT_PATSIZE_8x8_M - { - *rcNameID: =HT_DITHER8X8_DISPLAY - } -} - -*%****************************************************************************************** -*% Memory -*% -*% Note: Unidrv uses the font memory information to estimate when it needs to stop -*% downloading fonts for a page, and thus driver writers should err on the conservative -*% side. Otherwise, printers will generate "out of memory" device errors for pages with -*% a large number of fonts / unique glyphs. -*%****************************************************************************************** -*Feature: Memory -{ - *rcNameID: =PRINTER_MEMORY_DISPLAY - *DefaultOption: 32768KB - *Option: 4096KB - { - *Name: "4MB" - *MemoryConfigKB: PAIR(4096, 6750) - } - *Option: 8192KB - { - *Name: "8MB" - *MemoryConfigKB: PAIR(8192, 10350) - } - *Option: 16384KB - { - *Name: "16MB" - *MemoryConfigKB: PAIR(16384, 13950) - } - *Option: 24576KB - { - *Name: "24MB" - *MemoryConfigKB: PAIR(24576, 21150) - } - *Option: 32768KB - { - *Name: "32MB" - *MemoryConfigKB: PAIR(32768, 28350) - } - *Option: 49152KB - { - *Name: "48MB" - *MemoryConfigKB: PAIR(49152, 43050) - } - *Option: 65536KB - { - *Name: "64MB" - *MemoryConfigKB: PAIR(65536, 57150) - } - *Option: 98304KB - { - *Name: "96MB" - *MemoryConfigKB: PAIR(98304, 85950) - } - *Option: 102400KB - { - *Name: "100MB" - *MemoryConfigKB: PAIR(102400, 89700) - } - *Option: 114688KB - { - *Name: "112MB" - *MemoryConfigKB: PAIR(114688, 100550) - } - *Option: 131072KB - { - *Name: "128MB" - *MemoryConfigKB: PAIR(131072, 116250) - } -} - -*%****************************************************************************************** -*% Duplex Unit -*%****************************************************************************************** -*Feature: DuplexUnit -{ - *rcNameID: 429 - *FeatureType: PRINTER_PROPERTY - *DefaultOption: FALSE - *Option: FALSE - { - *rcNameID: 444 - *DisabledFeatures: LIST(Duplex.VERTICAL, Duplex.HORIZONTAL) - } - *Option: TRUE - { - *rcNameID: 443 - } -} - -*%****************************************************************************************** -*% Duplex Type -*%****************************************************************************************** -*Feature: Duplex -{ - *rcNameID: =TWO_SIDED_PRINTING_DISPLAY - *DefaultOption: NONE - *Option: NONE - { - *rcNameID: =NONE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l0S" - } - } - *Option: VERTICAL - { - *rcNameID: =FLIP_ON_LONG_EDGE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l1S" - } - } - *Option: HORIZONTAL - { - *rcNameID: =FLIP_ON_SHORT_EDGE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l2S" - } - } -} - -*%****************************************************************************************** -*% Page Protect -*%****************************************************************************************** -*Feature: PageProtect -{ - *rcNameID: =PAGE_PROTECTION_DISPLAY - *DefaultOption: OFF - *Option: ON - { - *rcNameID: =ON_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.1 - *Cmd: "<1B>%%-12345X@PJL SET PAGEPROTECT=LETTER<0A>" - } - } - *Option: OFF - { - *rcNameID: =OFF_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.1 - *Cmd: "<1B>%%-12345X@PJL SET PAGEPROTECT=OFF<0A>" - } - } -} - -*%****************************************************************************************** -*% Doc setup commands -*%****************************************************************************************** -*Command: CmdStartDoc -{ - *Order: DOC_SETUP.7 - *Cmd: "<1B>&u1200D<1B>*r0F" -} -*Command: CmdStartPage -{ - *Order: PAGE_SETUP.1 - *Cmd: "<1B>*b0M<0D>" -} -*Command: CmdEndJob -{ - *Order: JOB_FINISH.1 - *Cmd: "<1B>E<1B>%%-12345X@PJL<20>LPORTROTATE<0A><1B>%%-12345X" -} -*Command: CmdCopies -{ - *Order: DOC_SETUP.13 - *Cmd: "<1B>&l" %d{NumOfCopies}"X" -} - -*%****************************************************************************************** -*% Cursor, Page and Color Commands -*%****************************************************************************************** -*RotateCoordinate?: TRUE -*RotateRaster?: TRUE -*RotateFont?: TRUE -*TextCaps: LIST(TC_CR_90,TC_UA_ABLE) -*MemoryUsage: LIST(FONT, RASTER, VECTOR) -*CursorXAfterCR: AT_PRINTABLE_X_ORIGIN -*BadCursorMoveInGrxMode: LIST(X_PORTRAIT,Y_LANDSCAPE) -*XMoveThreshold: 0 -*YMoveThreshold: 0 -*XMoveUnit: 300 -*YMoveUnit: 300 -*Command: CmdXMoveAbsolute { *Cmd : "<1B>*p" %d{(DestX) }"X" } -*Command: CmdXMoveRelRight { *Cmd : "<1B>*p+" %d[0,9600]{max_repeat((DestXRel) )}"X" } -*Command: CmdXMoveRelLeft { *Cmd : "<1B>*p-" %d[0,9600]{max_repeat((DestXRel) )}"X" } -*Command: CmdYMoveAbsolute { *Cmd : "<1B>*p" %d{(DestY) }"Y" } -*Command: CmdYMoveRelDown { *Cmd : "<1B>*p+" %d{(DestYRel) }"Y" } -*Command: CmdYMoveRelUp { *Cmd : "<1B>*p-" %d{(DestYRel) }"Y" } -*Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" -+ %d{PaletteIndexToProgram} "I" } -*Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } -*Command: CmdCR { *Cmd : "<0D>" } -*Command: CmdLF { *Cmd : "<0A>" } -*Command: CmdFF { *Cmd : "<0C>" } -*Command: CmdBackSpace { *Cmd : "<08>" } -*Command: CmdUniDirectionOn { *Cmd : "<00>" } -*Command: CmdUniDirectionOff { *Cmd : "<00>" } -*Command: CmdPushCursor { *Cmd : "<1B>&f0S" } -*Command: CmdPopCursor { *Cmd : "<1B>&f1S" } -*Command: CmdSetSimpleRotation { *Cmd : "<1B>&a" %d{PrintDirInCCDegrees}"P" } -*EjectPageWithFF?: TRUE -*Command: CmdEnableTIFF4 { *Cmd : "<1B>*b2M" } -*Command: CmdDisableCompression { *Cmd : "<1B>*b0M" } -*OutputDataFormat: H_BYTE -*OptimizeLeftBound?: TRUE -*CursorXAfterSendBlockData: AT_GRXDATA_ORIGIN -*CursorYAfterSendBlockData: AUTO_INCREMENT - -*%****************************************************************************************** -*% Font Descriptions and Commands -*%****************************************************************************************** -*TTFSEnabled?: TRUE -*DefaultFont: 136 -*DefaultCTT: 0 -*CharPosition: BASELINE -*DeviceFonts: LIST(136,138,146,147,148,149,150,151,152,153,154,155,156,157, -+ 163,164,165,166,196,197,198,199,200,201,202,203,209,210, -+ 211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226, -+ 227,228,229,230) -*MinFontID: 16534 -*MaxFontID: 32768 -*switch: Resolution -{ - *case: Option1 - { - *FontFormat: HPPCL_OUTLINE - } - *case: Option2 - { - *FontFormat: HPPCL_OUTLINE - } - *case: Option3 - { - *FontFormat: HPPCL_RES - } -} -*Command: CmdSetFontID { *Cmd : "<1B>*c" %d{NextFontID}"D" } -*Command: CmdSelectFontID { *Cmd : "<1B>(" %d{CurrentFontID}"X" } -*Command: CmdSetCharCode { *Cmd : "<1B>*c" %d{NextGlyph}"E" } -*Command: CmdUnderlineOn { *Cmd : "<1B>&dD" } -*Command: CmdUnderlineOff { *Cmd : "<1B>&d@" } -*Command: CmdWhiteTextOn { *Cmd : "<1B>*v1o1T" } -*Command: CmdWhiteTextOff { *Cmd : "<1B>*v0o0T" } - - -*%******************************************************************************************** -*%* Vector Commands. -*%******************************************************************************************** -*MinGrayFill: 1 -*MaxGrayFill: 100 -*Command: CmdSetRectWidth { *Cmd : "<1B>*c" %d{(RectXSize) }"A" } -*Command: CmdSetRectHeight { *Cmd : "<1B>*c" %d{(RectYSize) }"B" } -*Command: CmdRectGrayFill { *Cmd : "<1B>*c" %d{GrayPercentage }"g2P" } -*Command: CmdRectWhiteFill { *Cmd : "<1B>*c1P" } -*Command: CmdRectBlackFill { *Cmd : "<1B>*c0P" } diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oem.ppd b/print/OEM Printer Customization Plug-in Samples/C++/oem.ppd deleted file mode 100644 index bbc93432..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oem.ppd +++ /dev/null @@ -1,431 +0,0 @@ -*PPD-Adobe: "4.3" -*% Adobe Systems PostScript(R) Printer Description File -*% Copyright (c) 2003 Microsoft Corp. All rights reserved. - -*FormatVersion: "4.3" -*FileVersion: "2.0" -*LanguageEncoding: ISOLatin1 -*LanguageVersion: English -*Product: "(MS OEM Customization)" -*PSVersion: "(2015.105) 9" -*Manufacturer: "Microsoft" -*ModelName: "Microsoft PS5 OEM Customization" -*ShortNickName: "MS PS5 Oem Customization" -*NickName: "MS PS5 Oem Customization" -*PCFileName: "PS5OEM.PPD" - -*% === Installable Options =========== -*OpenGroup: InstallableOptions/Options Installed - -*OpenUI *InstalledMemory/Memory Configuration: PickOne -*DefaultInstalledMemory: 24Meg -*InstalledMemory 24Meg/Standard 24 MB RAM: "" -*InstalledMemory 28Meg/28 MB Total RAM: "" -*InstalledMemory 40Meg/40 MB Total RAM: "" -*InstalledMemory 44Meg/44 MB Total RAM: "" -*InstalledMemory 56Meg/56 MB Total RAM: "" -*InstalledMemory 72Meg/72 MB Total RAM: "" -*CloseUI: *InstalledMemory - -*CloseGroup: InstallableOptions - -*% === Constraints =================== - - -*% === Basic Device Capabilities ============ - -*LanguageLevel: "2" -*Protocols: BCP - -*FreeVM: "5500000" -*VMOption 24Meg/Standard 24 MB RAM: "5500000" -*VMOption 28Meg/28 MB Total RAM: "8000000" -*VMOption 40Meg/40 MB Total RAM: "5400000" -*VMOption 44Meg/44 MB Total RAM: "8000000" -*VMOption 56Meg/56 MB Total RAM: "17400000" -*VMOption 72Meg/72 MB Total RAM: "3800000" - -*ColorDevice: True -*DefaultColorSpace: CMYK -*AccurateScreensSupport: True -*SuggestedJobTimeout: "0" -*SuggestedWaitTimeout: "300" -*SuggestedManualFeedTimeout: "60" -*End -*TTRasterizer: Type42 -*?TTRasterizer: " - save - 42 /FontType resourcestatus - { pop pop (Type42)} {pop pop (None)} ifelse = flush - restore" -*End - -*Emulators: hpgl -*StartEmulator_hpgl: "currentfile /hpgl statusdict /emulate get exec " -*StopEmulator_hpgl: "<1B7F>0" - -*FileSystem: True -*?FileSystem: " - save false - (%disk?%) - { currentdevparams dup /Writeable known - { /Writeable get {pop true} if } {pop} ifelse - } 10 string /IODevice resourceforall - {(True)}{(False)} ifelse = flush - restore" -*End -*Throughput: "14" -*Password: "(0)" -*ExitServer: " - count 0 eq - { false } { true exch startjob } ifelse - not - { (WARNING: Cannot modify initial VM.) = - (Missing or invalid password.) = - (Please contact the author of this software.) = flush quit - } if" -*End -*Reset: " - count 0 eq - { false } { true exch startjob } ifelse - not - { (WARNING: Cannot reset printer.) = - (Missing or invalid password.) = - (Please contact the author of this software.) = flush quit - } if - systemdict /quit get exec - (WARNING : Printer Reset Failed.) = flush" -*End - -*DefaultResolution: 600x600dpi -*?Resolution: " - save currentpagedevice - /HWResolution get - aload pop exch ( ) cvs print (x) print ( ) cvs print (dpi) - = flush - restore" -*End - -*% Halftone Information ================= - -*DefaultHalftoneType: 9 -*ScreenFreq: "60.0" -*ScreenAngle: "0.0" -*DefaultScreenProc: Null -*ScreenProc Null: "{}" - -*DefaultTransfer: Null -*Transfer Null: "{ }" -*Transfer Null.Inverse: "{ 1 exch sub }" - - -*% Tray Selection ============ - -*OpenUI *InputSlot: PickOne -*OrderDependency: 10 AnySetup *InputSlot -*DefaultInputSlot: Paper -*InputSlot Upper: " - (<<) cvx exec - /MediaPosition 0 - /MediaType null - /TraySwitch false - /ManualFeed false - (>>) cvx exec setpagedevice" -*End -*InputSlot Middle: " - (<<) cvx exec - /MediaPosition 1 - /MediaType null - /TraySwitch false - /ManualFeed false - (>>) cvx exec setpagedevice" -*End -*InputSlot Lower: " - (<<) cvx exec - /MediaPosition 2 - /MediaType null - /TraySwitch false - /ManualFeed false - (>>) cvx exec setpagedevice" -*End -*InputSlot Paper: " - (<<) cvx exec - /MediaPosition null - /MediaType (Paper) - /TraySwitch true - /ManualFeed false - (>>) cvx exec setpagedevice" -*End -*InputSlot Transparency: " - (<<) cvx exec - /MediaPosition null - /MediaType (Transparency) - /TraySwitch true - /ManualFeed false - (>>) cvx exec setpagedevice" -*End -*InputSlot ManualPaper/Manual Paper: " - (<<) cvx exec - /MediaPosition null - /MediaType (Paper) - /TraySwitch false - /ManualFeed true - (>>) cvx exec setpagedevice" -*End -*InputSlot ManualTransparency/Manual Transparency: " - (<<) cvx exec - /MediaPosition null - /MediaType (Transparency) - /TraySwitch false - /ManualFeed true - (>>) cvx exec setpagedevice" -*End -*?InputSlot: " - save - currentpagedevice /MediaPosition get - dup null eq - { pop currentpagedevice /MediaType get - dup null eq - { pop (Upper) } - { dup (Paper) eq - { pop currentpagedevice /ManualFeed get - { (ManualPaper) } - { (Paper) } ifelse - } - { - (Transparency) eq - { currentpagedevice /ManualFeed get - { (ManualTransparency) } - { (Transparency) } ifelse - } - { (Unknown) } ifelse - } ifelse - } ifelse - } - { - dup 0 eq - { pop (Upper) } - { dup 1 eq - { pop (Middle) } - { 2 eq - { (Lower) } - { (Unknown) } ifelse - } ifelse - } ifelse - } ifelse - = flush restore" -*End -*CloseUI: *InputSlot - -*% Paper Handling =================== - -*% Use these entries to set paper size most of the time, unless there is -*% specific reason to use PageRegion. -*OpenUI *PageSize: PickOne -*OrderDependency: 20 AnySetup *PageSize -*DefaultPageSize: Letter -*PageSize Letter: "(<<) cvx exec /PageSize [612 792] /ImagingBBox null - (>>) cvx exec setpagedevice" -*End -*PageSize Legal: "(<<) cvx exec /PageSize [612 1008] /ImagingBBox null - (>>) cvx exec setpagedevice" -*End -*PageSize A4: "(<<) cvx exec /PageSize [595 842] /ImagingBBox null - (>>) cvx exec setpagedevice" -*End -*?PageSize: " - save currentpagedevice /PageSize get aload pop - 2 copy gt {exch} if (Unknown) - (<<) cvx exec - [612 792] (Letter) - [612 1008] (Legal) - [595 842] (A4) (>>) cvx exec - { exch aload pop 4 index sub abs 5 le exch 5 index sub abs 5 le and - { exch pop exit } { pop } ifelse - } bind forall = flush pop pop - restore" -*End -*CloseUI: *PageSize - -*% These entries will set up the frame buffer. Usually used with manual feed. -*OpenUI *PageRegion: PickOne -*OrderDependency: 30 AnySetup *PageRegion -*DefaultPageRegion: Letter -*PageRegion Letter: "(<<) cvx exec /PageSize [612 792] /ImagingBBox null - (>>) cvx exec setpagedevice" -*End -*PageRegion Legal: "(<<) cvx exec /PageSize [612 1008] /ImagingBBox null - (>>) cvx exec setpagedevice" -*End -*PageRegion A4: "(<<) cvx exec /PageSize [595 842] /ImagingBBox null - (>>) cvx exec setpagedevice" -*End -*CloseUI: *PageRegion - -*% The following entries provide information about specific paper keywords. -*DefaultImageableArea: Letter -*ImageableArea Letter: "10.32 15.9 601.68 776.22" -*ImageableArea Legal: "10.32 16.3801 601.68 991.74" -*ImageableArea A4: "13.44 14.46 581.76 828.54" -*?ImageableArea: " - save - /cvp { ( ) cvs print ( ) print } bind def - /upperright {10000 mul floor 10000 div} bind def - /lowerleft {10000 mul ceiling 10000 div} bind def - newpath clippath pathbbox - 4 -2 roll exch 2 {lowerleft cvp} repeat - exch 2 {upperright cvp} repeat flush - restore" -*End - -*% These provide the physical dimensions of the paper (by keyword) -*DefaultPaperDimension: Letter -*PaperDimension Letter: "612 792" -*PaperDimension Legal: "612 1008" -*PaperDimension A4: "595 842" - -*RequiresPageRegion All: True - -*% Print Quality Selection =================== - -*OpenUI *OutputMode/Print Quality: PickOne -*OrderDependency: 50 AnySetup *OutputMode -*DefaultOutputMode: Standard -*OutputMode Fast/Fast Color 600x600 dpi: " - (<<) cvx exec - /HWResolution [600 600] - /ProcessColorModel /DeviceCMY - (>>) cvx exec setpagedevice" -*End -*OutputMode Standard/Standard 600x600 dpi: " - (<<) cvx exec - /HWResolution [600 600] - /ProcessColorModel /DeviceCMYK - (>>) cvx exec setpagedevice" -*End -*OutputMode Enhanced/Enhanced 1200x600 dpi: " - (<<) cvx exec - /HWResolution [1200 600] - /ProcessColorModel /DeviceCMYK - (>>) cvx exec setpagedevice" -*End -*OutputMode Premium/Premium 1200x1200 dpi: " - (<<) cvx exec - /HWResolution [1200 1200] - /ProcessColorModel /DeviceCMYK - (>>) cvx exec setpagedevice" -*End -*?OutputMode: " - save - currentpagedevice /ProcessColorModel get /DeviceCMY eq - { (Fast) } - { currentpagedevice /HWResolution get - aload pop 1200 eq - { pop (Premium) } - { 1200 eq - { (Enhanced) } - { (Standard) } ifelse - } ifelse - } ifelse - = flush restore" -*End -*CloseUI: *OutputMode - -*OpenUI *OutputOrder/Output Order: PickOne -*OrderDependency: 60 AnySetup *OutputOrder -*DefaultOutputOrder: Reverse -*OutputOrder Normal/Face Down: " - (<<) cvx exec - /OutputFaceUp false - (>>) cvx exec setpagedevice" -*End -*OutputOrder Reverse/Face Up: " - (<<) cvx exec - /OutputFaceUp true - (>>) cvx exec setpagedevice" -*End -*?OutputOrder: " - save - currentpagedevice /OutputFaceUp get {(Reverse)}{(Normal)}ifelse - = flush restore" -*End -*CloseUI: *OutputOrder - -*OpenUI *Collate/Quick Collate: Boolean -*OrderDependency: 70 AnySetup *Collate -*DefaultCollate: False -*Collate False: " - (<<) cvx exec - /Collate false - (>>) cvx exec setpagedevice" -*End -*Collate True: " - (<<) cvx exec - /Collate true - (>>) cvx exec setpagedevice" -*End -*?Collate: " - save - currentpagedevice /Collate get {(True)}{(False)}ifelse - = flush restore" -*End -*CloseUI: *Collate - - -*% Font Information ===================== -*DefaultFont: Courier -*Font Courier: Standard "(002.003)" Standard ROM -*Font Courier-Bold: Standard "(002.003)" Standard ROM -*Font Courier-BoldOblique: Standard "(002.003)" Standard ROM -*Font Courier-Oblique: Standard "(002.003)" Standard ROM -*Font Helvetica: Standard "(001.006)" Standard ROM -*Font Helvetica-Bold: Standard "(001.007)" Standard ROM -*Font Helvetica-BoldOblique: Standard "(001.007)" Standard ROM -*Font Helvetica-Condensed: Standard "(001.001)" Standard ROM -*Font Helvetica-Condensed-Bold: Standard "(001.002)" Standard ROM -*Font Helvetica-Condensed-BoldObl: Standard "(001.002)" Standard ROM -*Font Helvetica-Condensed-Oblique: Standard "(001.001)" Standard ROM -*Font Helvetica-Narrow: Standard "(001.006)" Standard ROM -*Font Helvetica-Narrow-Bold: Standard "(001.007)" Standard ROM -*Font Helvetica-Narrow-BoldOblique: Standard "(001.007)" Standard ROM -*Font Helvetica-Narrow-Oblique: Standard "(001.006)" Standard ROM -*Font Helvetica-Oblique: Standard "(001.006)" Standard ROM -*Font Symbol: Special "(001.007)" Special ROM -*Font Times-Bold: Standard "(001.007)" Standard ROM -*Font Times-BoldItalic: Standard "(001.009)" Standard ROM -*Font Times-Italic: Standard "(001.007)" Standard ROM -*Font Times-Roman: Standard "(001.007)" Standard ROM -*Font ZapfChancery-MediumItalic: Standard "(001.006)" Standard ROM -*Font ZapfDingbats: Special "(001.004)" Special ROM -*?FontQuery: " - save - { count 1 gt - { exch dup 127 string cvs (/) print print (:) print - /Font resourcestatus {pop pop (Yes)} {(No)} ifelse = - } { exit } ifelse - } bind loop - (*) = flush restore" -*End - -*?FontList: " - save (*) {cvn ==} 128 string /Font resourceforall - (*) = flush restore" -*End - -*DefaultColorSep: ProcessBlack.60lpi.600x600dpi/60 lpi / 600x600 dpi - -*% For 60 lpi / 600x600dpi ================================ - -*ColorSepScreenAngle ProcessBlack.60lpi.600x600dpi/60 lpi / 600x600 dpi: "0.0" -*ColorSepScreenAngle CustomColor.60lpi.600x600dpi/60 lpi / 600x600 dpi: "0.0" -*ColorSepScreenAngle ProcessCyan.60lpi.600x600dpi/60 lpi / 600x600 dpi: "0.0" -*ColorSepScreenAngle ProcessMagenta.60lpi.600x600dpi/60 lpi / 600x600 dpi: "0.0" -*ColorSepScreenAngle ProcessYellow.60lpi.600x600dpi/60 lpi / 600x600 dpi: "0.0" - -*ColorSepScreenFreq ProcessBlack.60lpi.600x600dpi/60 lpi / 600x600 dpi: "60.0" -*ColorSepScreenFreq CustomColor.60lpi.600x600dpi/60 lpi / 600x600 dpi: "60.0" -*ColorSepScreenFreq ProcessCyan.60lpi.600x600dpi/60 lpi / 600x600 dpi: "60.0" -*ColorSepScreenFreq ProcessMagenta.60lpi.600x600dpi/60 lpi / 600x600 dpi: "60.0" -*ColorSepScreenFreq ProcessYellow.60lpi.600x600dpi/60 lpi / 600x600 dpi: "60.0" - -*% end of PPD file for MS PS5 OEM Custimization diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf b/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf deleted file mode 100644 index 5f49b577..00000000 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/oemdll.inf and /dev/null differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemdll.sln b/print/OEM Printer Customization Plug-in Samples/C++/oemdll.sln deleted file mode 100644 index 2d0d56ed..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemdll.sln +++ /dev/null @@ -1,809 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26430.16 -MinimumVisualStudioVersion = 12.0 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Bitmap", "Bitmap", "{EFB5E861-A892-49B4-BA05-38F6F5F42D48}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Custhlp", "Custhlp", "{F3DB5340-C664-40EB-986F-2A48790AEDC5}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Src", "Src", "{EC75B371-D09D-4D95-9816-3429B6D3806B}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Gdl", "Gdl", "{A6BA54B0-ADB8-4032-8C4B-770474042B09}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Oemprean", "Oemprean", "{E7B7C6C6-5396-42D3-9BDE-DFAC86D0AFE3}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Oemps", "Oemps", "{80510096-C37F-488D-A426-E3BA4B1A1600}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Oemui", "Oemui", "{35933BA0-56E6-4DD4-84E9-C8AADAA19AFA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Oemuni", "Oemuni", "{7AC217E4-4DB5-414C-A39F-B783020E43AA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PSUIRep", "PSUIRep", "{03A523F4-091A-416B-97B5-A84FA1B1D3EE}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Src", "Src", "{CCF8F861-A2C2-4C28-AB19-29CC47C6D560}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PTPCPlPr", "PTPCPlPr", "{F8AB36BA-6C96-42BA-90F5-378D3B73634C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SyncSet", "SyncSet", "{C52A574A-6122-48EB-875C-07CE190B0808}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ThemeUI", "ThemeUI", "{F3C654B9-A286-494E-8558-3A2526D52A37}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Src", "Src", "{C4BCC65A-6423-4569-A1D6-AAA82CE821A9}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Uniuirep", "Uniuirep", "{1BA35560-35CD-4E6E-8B67-AD7ED043874A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Wmarkps", "Wmarkps", "{9F8B052F-1649-4F54-ABE9-42E51AFB32AA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Watermark", "Watermark", "{575FCB22-ADB3-4025-8F23-040500F6C11A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Wmarkui", "Wmarkui", "{2A597978-AD6A-41D0-9B97-CC1B69CE054A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Wmarkui", "Wmarkui", "{D0C95EA5-D23F-44E6-91C3-2BA65CE3991E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Watermarkuni", "Watermarkuni", "{5A8A1EF7-4454-43F3-8A69-484AF81D0771}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Wmarkuni", "Wmarkuni", "{90BABB1D-0FDD-4A9A-BA18-3319FF12363B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bitmap", "bitmap\bitmap.vcxproj", "{EDCCC34A-50DF-4894-B7B9-FC156F899947}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CUSTHLP", "custhlp\CUSTHLP.vcxproj", "{CA70C64A-75C8-48CD-9224-335C2ED689A6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GDLSMPL", "gdl\src\GDLSMPL.vcxproj", "{F0118F7B-9DF5-49FC-B4FF-951C54033F3D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "oemprean", "oemprean\oemprean.vcxproj", "{D5E225D5-EEEA-45FD-AD07-E4678C542E1A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OEMPS", "oemps\OEMPS.vcxproj", "{9F374241-B8F9-45D3-B163-7E84E8E22C1F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OEMUI", "oemui\OEMUI.vcxproj", "{452209BF-AEB7-457D-956B-90CDE70CED7D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OEMUNI", "oemuni\OEMUNI.vcxproj", "{B0F13767-2056-47FC-B37B-41D7E339900B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PSUIREP", "PSUIRep\PSUIREP.vcxproj", "{5D63CD51-110C-41B7-B8B0-6AB27398690B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PTPCPLPR", "PTPCPlPr\src\PTPCPLPR.vcxproj", "{CED613CF-6666-43FC-9414-02AFBDA83A34}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SYNCSET", "SyncSet\SYNCSET.vcxproj", "{60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ThemeUISmpl", "ThemeUI\ThemeUISmpl.vcxproj", "{EA206DEA-26E6-4FD4-BF68-23F222C5E211}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UNIUIREP", "uniuirep\src\UNIUIREP.vcxproj", "{7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WMARKPS", "watermark\wmarkps\WMARKPS.vcxproj", "{4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WMARKUI", "watermark\wmarkui\WMARKUI.vcxproj", "{BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WMARKUNIUI", "watermarkuni\wmarkui\WMARKUNIUI.vcxproj", "{1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WMARKUNI", "watermarkuni\wmarkuni\WMARKUNI.vcxproj", "{866141A6-4989-41D7-9409-4A5A73B535B0}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Win10 Debug|ARM64 = Win10 Debug|ARM64 - Win10 Debug|Win32 = Win10 Debug|Win32 - Win10 Debug|x64 = Win10 Debug|x64 - Win10 Release|ARM64 = Win10 Release|ARM64 - Win10 Release|Win32 = Win10 Release|Win32 - Win10 Release|x64 = Win10 Release|x64 - Win7 Debug|ARM64 = Win7 Debug|ARM64 - Win7 Debug|Win32 = Win7 Debug|Win32 - Win7 Debug|x64 = Win7 Debug|x64 - Win7 Release|ARM64 = Win7 Release|ARM64 - Win7 Release|Win32 = Win7 Release|Win32 - Win7 Release|x64 = Win7 Release|x64 - Win8 Debug|ARM64 = Win8 Debug|ARM64 - Win8 Debug|Win32 = Win8 Debug|Win32 - Win8 Debug|x64 = Win8 Debug|x64 - Win8 Release|ARM64 = Win8 Release|ARM64 - Win8 Release|Win32 = Win8 Release|Win32 - Win8 Release|x64 = Win8 Release|x64 - Win8.1 Debug|ARM64 = Win8.1 Debug|ARM64 - Win8.1 Debug|Win32 = Win8.1 Debug|Win32 - Win8.1 Debug|x64 = Win8.1 Debug|x64 - Win8.1 Release|ARM64 = Win8.1 Release|ARM64 - Win8.1 Release|Win32 = Win8.1 Release|Win32 - Win8.1 Release|x64 = Win8.1 Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {EDCCC34A-50DF-4894-B7B9-FC156F899947}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {CA70C64A-75C8-48CD-9224-335C2ED689A6}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {9F374241-B8F9-45D3-B163-7E84E8E22C1F}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {452209BF-AEB7-457D-956B-90CDE70CED7D}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {B0F13767-2056-47FC-B37B-41D7E339900B}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {5D63CD51-110C-41B7-B8B0-6AB27398690B}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {CED613CF-6666-43FC-9414-02AFBDA83A34}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {EA206DEA-26E6-4FD4-BF68-23F222C5E211}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win10 Debug|Win32.ActiveCfg = Win10 Debug|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win10 Debug|Win32.Build.0 = Win10 Debug|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win10 Release|Win32.ActiveCfg = Win10 Release|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win10 Release|Win32.Build.0 = Win10 Release|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win7 Debug|ARM64.ActiveCfg = Win7 Debug|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win7 Release|ARM64.ActiveCfg = Win7 Release|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win7 Release|x64.Build.0 = Win7 Release|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {866141A6-4989-41D7-9409-4A5A73B535B0}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {EC75B371-D09D-4D95-9816-3429B6D3806B} = {A6BA54B0-ADB8-4032-8C4B-770474042B09} - {CCF8F861-A2C2-4C28-AB19-29CC47C6D560} = {F8AB36BA-6C96-42BA-90F5-378D3B73634C} - {C4BCC65A-6423-4569-A1D6-AAA82CE821A9} = {1BA35560-35CD-4E6E-8B67-AD7ED043874A} - {9F8B052F-1649-4F54-ABE9-42E51AFB32AA} = {575FCB22-ADB3-4025-8F23-040500F6C11A} - {2A597978-AD6A-41D0-9B97-CC1B69CE054A} = {575FCB22-ADB3-4025-8F23-040500F6C11A} - {D0C95EA5-D23F-44E6-91C3-2BA65CE3991E} = {5A8A1EF7-4454-43F3-8A69-484AF81D0771} - {90BABB1D-0FDD-4A9A-BA18-3319FF12363B} = {5A8A1EF7-4454-43F3-8A69-484AF81D0771} - {EDCCC34A-50DF-4894-B7B9-FC156F899947} = {EFB5E861-A892-49B4-BA05-38F6F5F42D48} - {CA70C64A-75C8-48CD-9224-335C2ED689A6} = {F3DB5340-C664-40EB-986F-2A48790AEDC5} - {F0118F7B-9DF5-49FC-B4FF-951C54033F3D} = {EC75B371-D09D-4D95-9816-3429B6D3806B} - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A} = {E7B7C6C6-5396-42D3-9BDE-DFAC86D0AFE3} - {9F374241-B8F9-45D3-B163-7E84E8E22C1F} = {80510096-C37F-488D-A426-E3BA4B1A1600} - {452209BF-AEB7-457D-956B-90CDE70CED7D} = {35933BA0-56E6-4DD4-84E9-C8AADAA19AFA} - {B0F13767-2056-47FC-B37B-41D7E339900B} = {7AC217E4-4DB5-414C-A39F-B783020E43AA} - {5D63CD51-110C-41B7-B8B0-6AB27398690B} = {03A523F4-091A-416B-97B5-A84FA1B1D3EE} - {CED613CF-6666-43FC-9414-02AFBDA83A34} = {CCF8F861-A2C2-4C28-AB19-29CC47C6D560} - {60E61442-4E2A-41A1-BC70-EDC0B8DC4EB8} = {C52A574A-6122-48EB-875C-07CE190B0808} - {EA206DEA-26E6-4FD4-BF68-23F222C5E211} = {F3C654B9-A286-494E-8558-3A2526D52A37} - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16} = {C4BCC65A-6423-4569-A1D6-AAA82CE821A9} - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5} = {9F8B052F-1649-4F54-ABE9-42E51AFB32AA} - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE} = {2A597978-AD6A-41D0-9B97-CC1B69CE054A} - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62} = {D0C95EA5-D23F-44E6-91C3-2BA65CE3991E} - {866141A6-4989-41D7-9409-4A5A73B535B0} = {90BABB1D-0FDD-4A9A-BA18-3319FF12363B} - EndGlobalSection -EndGlobal diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean.gpd b/print/OEM Printer Customization Plug-in Samples/C++/oemprean.gpd deleted file mode 100644 index 3328de18..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean.gpd +++ /dev/null @@ -1,706 +0,0 @@ -*GPDFileName: "oemprean.gpd" -*GPDFileVersion: "1.0" -*GPDSpecVersion: "1.0" -*Include: "StdNames.gpd" -*Include: "ttfsub.gpd" -*ModelName: "OEM Pre-Analysis sample" -*MasterUnits: PAIR(1200, 1200) -*ResourceDLL: "unires.dll" -*PrinterType: PAGE -*MaxCopies: 99 -*PrintRate: 16 -*PrintRateUnit: PPM -*PrintRatePPM: 16 - -*PreAnalysisOptions: 8 - -*%****************************************************************************************** -*% Orientation -*%****************************************************************************************** -*Feature: Orientation -{ - *rcNameID: =ORIENTATION_DISPLAY - *DefaultOption: PORTRAIT - *Option: PORTRAIT - { - *rcNameID: =PORTRAIT_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.6 - *Cmd: "<1B>&l0O" - } - } - *Option: LANDSCAPE_CC90 - { - *rcNameID: =LANDSCAPE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.8 - *Cmd: "<1B>&l1O" - } - } -} - -*%****************************************************************************************** -*% Input Bin -*%****************************************************************************************** -*Feature: InputBin -{ - *rcNameID: =PAPER_SOURCE_DISPLAY - *DefaultOption: AUTO - *Option: AUTO - { - *rcNameID: =AUTO_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l0H" - } - } - *Option: UPPER - { - *rcNameID: =UPPER_TRAY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l1H" - } - } -} - -*%****************************************************************************************** -*% Resolution -*%****************************************************************************************** -*Feature: Resolution -{ - *rcNameID: =RESOLUTION_DISPLAY - *DefaultOption: Option2 - *Option: Option1 - { - *Name: "600 x 600" =DOTS_PER_INCH - *DPI: PAIR(600, 600) - *TextDPI: PAIR(600, 600) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED,TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "@PJL SET RESOLUTION=600<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t600R" - } - } - *Option: Option2 - { - *Name: "300 x 300" =DOTS_PER_INCH - *DPI: PAIR(300, 300) - *TextDPI: PAIR(300, 300) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED, TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "@PJL SET RESOLUTION=300<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t300R" - } - } - *Option: Option3 - { - *Name: "150 x 150" =DOTS_PER_INCH - *DPI: PAIR(150, 150) - *TextDPI: PAIR(150, 150) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED, TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "@PJL SET RESOLUTION=150<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t150R" - } - } -} - -*%****************************************************************************************** -*% HP-GL/2 Graphics Support -*%****************************************************************************************** -*Ifdef: WINNT_51 -*Personality: =PERSONALITY_HPGL2 -*Feature: GraphicsMode -{ - *rcNameID: =GRAPHICSMODE_DISPLAY - *DefaultOption: RASTERMODE - *Option: HPGL2MODE - { - *rcNameID: =GRAPHICSMODE_HPGL2_DISPLAY - } - *Option: RASTERMODE - { - *rcNameID: =GRAPHICSMODE_RASTER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.6 - *Cmd: "@PJL SET LIMAGEENHANCE=OFF<0A>" - } - } -} -*Endif: - -*%****************************************************************************************** -*% Paper Size -*%****************************************************************************************** -*Feature: PaperSize -{ - *rcNameID: =PAPER_SIZE_DISPLAY - *DefaultOption: LETTER - *Option: LETTER - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1028 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9500, 12500) - *PrintableOrigin: PAIR(400, 400) - *CursorOrigin: PAIR(300, 300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t5260x7704Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9500, 12200) - *PrintableOrigin: PAIR(450, 300) - *CursorOrigin: PAIR(200, 12900) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t7332x5880Y" - } - } - } - } - *Option: LEGAL - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1692 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 600) - *CursorOrigin: PAIR(180, 300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t5880x8900Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 900) - *CursorOrigin: PAIR(180, 16500) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t8900x5880Y" - } - } - } - } - *Option: EXECUTIVE - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4109 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(8100, 11500) - *PrintableOrigin: PAIR(300, 300) - *CursorOrigin: PAIR(300, 200) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t4860x7344Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(8300, 11500) - *PrintableOrigin: PAIR(200, 300) - *CursorOrigin: PAIR(200, 12300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t7272x4980Y" - } - } - } - } - *Option: A4 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4249 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9100, 13200) - *PrintableOrigin: PAIR(400, 300) - *CursorOrigin: PAIR(288, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t5594x8201Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9100, 13200) - *PrintableOrigin: PAIR(400, 300) - *CursorOrigin: PAIR(204, 13824) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t8129x5714Y" - } - } - } - } - *Option: B5 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 3198 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(7900, 11140) - *PrintableOrigin: PAIR(352, 300) - *CursorOrigin: PAIR(300, 100) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l12a8c1E<1B>*p0x0Y<1B>*c0t4970x7040Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(7760, 11140) - *PrintableOrigin: PAIR(300, 400) - *CursorOrigin: PAIR(100, 11940) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l12a8c1E<1B>*p0x0Y<1B>*c0t6780x4970Y" - } - } - } - } -} - -*%****************************************************************************************** -*% Media Type -*%****************************************************************************************** -*Feature: MediaType -{ - *rcNameID: =MEDIA_TYPE_DISPLAY - *DefaultOption: PLAIN - *Option: PLAIN - { - *rcNameID: =PLAIN_PAPER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.15 - *Cmd: "<1B>&n6WdPlain" - } - } - *Option: TRANSPARENCY - { - *rcNameID: =TRANSPARENCY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.15 - *Cmd: "<1B>&n13WdTransparency" - } - } -} - -*%****************************************************************************************** -*% Color Mode -*%****************************************************************************************** -*Feature: ColorMode -{ - *rcNameID: =COLOR_PRINTING_MODE_DISPLAY - *DefaultOption: 24bpp - *Option: Mono - { - *rcNameID: =MONO_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 1 - *Color?: FALSE - } - *Option: Color - { - *rcNameID: =COLOR_DISPLAY - *DevNumOfPlanes: 3 - *DevBPP: 1 - *DrvBPP: 4 - EXTERN_GLOBAL: *RasterSendAllData?: TRUE - *ColorPlaneOrder: LIST(CYAN, MAGENTA, YELLOW) - *Command: CmdSendCyanData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"V" } - *Command: CmdSendMagentaData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"V" } - *Command: CmdSendYellowData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelectBlackColor { *Cmd : "<1B>*v7S" } - *Command: CmdSelectRedColor { *Cmd : "<1B>*v6S" } - *Command: CmdSelectGreenColor { *Cmd : "<1B>*v5S" } - *Command: CmdSelectYellowColor { *Cmd : "<1B>*v4S" } - *Command: CmdSelectBlueColor { *Cmd : "<1B>*v3S" } - *Command: CmdSelectMagentaColor { *Cmd : "<1B>*v2S" } - *Command: CmdSelectCyanColor { *Cmd : "<1B>*v1S" } - *Command: CmdSelectWhiteColor { *Cmd : "<1B>*v0S" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "<1B>*r-3U" - } - } - *Option: 8bpp - { - *rcNameID: =8BPP_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 8 - *DrvBPP: 8 - *PaletteSize: 256 - *PaletteProgrammable? : TRUE - *Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" -+ %d{PaletteIndexToProgram} "I" } - *Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "<1B>*v1N<1B>*v1O<1B>*t0I<1B>*l184O<1B>*v6W<000108080808>" - } - } - *Option: 24bpp - { - *rcNameID: =24BPP_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 24 - *DrvBPP: 24 - *Command: CmdEnableDRC { *Cmd : "<1B>*b3M" } - *PaletteSize: 256 - *PaletteProgrammable? : TRUE - *Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" -+ %d{PaletteIndexToProgram} "I" } - *Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } - *Command: CmdSetSrcBmpWidth { *Cmd : "<1B>*r" %d{RasterDataWidthInBytes / 3}"S" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "<1B>*v1N<1B>*v1O<1B>*l184O<1B>*v6W<0003080808081B>*v0a0b0c7i255a255b255c0I<1B>*" -+ "o3W<060400>" - } - } -} - -*%****************************************************************************************** -*% HalfTone -*%****************************************************************************************** -*Feature: Halftone -{ - *rcNameID: =HALFTONING_DISPLAY - *DefaultOption: HT_PATSIZE_AUTO - *Option: HT_PATSIZE_AUTO - { - *rcNameID: =HT_AUTO_SELECT_DISPLAY - } - *Option: HT_PATSIZE_SUPERCELL_M - { - *rcNameID: =HT_SUPERCELL_DISPLAY - } - *Option: HT_PATSIZE_6x6_M - { - *rcNameID: =HT_DITHER6X6_DISPLAY - } - *Option: HT_PATSIZE_8x8_M - { - *rcNameID: =HT_DITHER8X8_DISPLAY - } -} - -*%****************************************************************************************** -*% Memory -*% -*% Note: Unidrv uses the font memory information to estimate when it needs to stop -*% downloading fonts for a page, and thus driver writers should err on the conservative -*% side. Otherwise, printers will generate "out of memory" device errors for pages with -*% a large number of fonts / unique glyphs. -*%****************************************************************************************** -*Feature: Memory -{ - *rcNameID: =PRINTER_MEMORY_DISPLAY - *DefaultOption: 32768KB - *Option: 4096KB - { - *Name: "4MB" - *MemoryConfigKB: PAIR(4096, 6750) - } - *Option: 8192KB - { - *Name: "8MB" - *MemoryConfigKB: PAIR(8192, 10350) - } - *Option: 16384KB - { - *Name: "16MB" - *MemoryConfigKB: PAIR(16384, 13950) - } - *Option: 24576KB - { - *Name: "24MB" - *MemoryConfigKB: PAIR(24576, 21150) - } - *Option: 32768KB - { - *Name: "32MB" - *MemoryConfigKB: PAIR(32768, 28350) - } - *Option: 49152KB - { - *Name: "48MB" - *MemoryConfigKB: PAIR(49152, 43050) - } - *Option: 65536KB - { - *Name: "64MB" - *MemoryConfigKB: PAIR(65536, 57150) - } - *Option: 98304KB - { - *Name: "96MB" - *MemoryConfigKB: PAIR(98304, 85950) - } - *Option: 102400KB - { - *Name: "100MB" - *MemoryConfigKB: PAIR(102400, 89700) - } - *Option: 114688KB - { - *Name: "112MB" - *MemoryConfigKB: PAIR(114688, 100550) - } - *Option: 131072KB - { - *Name: "128MB" - *MemoryConfigKB: PAIR(131072, 116250) - } -} - -*%****************************************************************************************** -*% Duplex Unit -*%****************************************************************************************** -*Feature: DuplexUnit -{ - *rcNameID: 429 - *FeatureType: PRINTER_PROPERTY - *DefaultOption: FALSE - *Option: FALSE - { - *rcNameID: 444 - *DisabledFeatures: LIST(Duplex.VERTICAL, Duplex.HORIZONTAL) - } - *Option: TRUE - { - *rcNameID: 443 - } -} - -*%****************************************************************************************** -*% Duplex Type -*%****************************************************************************************** -*Feature: Duplex -{ - *rcNameID: =TWO_SIDED_PRINTING_DISPLAY - *DefaultOption: NONE - *Option: NONE - { - *rcNameID: =NONE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l0S" - } - } - *Option: VERTICAL - { - *rcNameID: =FLIP_ON_LONG_EDGE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l1S" - } - } - *Option: HORIZONTAL - { - *rcNameID: =FLIP_ON_SHORT_EDGE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l2S" - } - } -} - -*%****************************************************************************************** -*% Page Protect -*%****************************************************************************************** -*Feature: PageProtect -{ - *rcNameID: =PAGE_PROTECTION_DISPLAY - *DefaultOption: OFF - *Option: ON - { - *rcNameID: =ON_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.1 - *Cmd: "<1B>%%-12345X@PJL SET PAGEPROTECT=LETTER<0A>" - } - } - *Option: OFF - { - *rcNameID: =OFF_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.1 - *Cmd: "<1B>%%-12345X@PJL SET PAGEPROTECT=OFF<0A>" - } - } -} - -*%****************************************************************************************** -*% Doc setup commands -*%****************************************************************************************** -*Command: CmdStartDoc -{ - *Order: DOC_SETUP.7 - *Cmd: "<1B>&u1200D<1B>*r0F" -} -*Command: CmdStartPage -{ - *Order: PAGE_SETUP.1 - *Cmd: "<1B>*b0M<0D>" -} -*Command: CmdEndJob -{ - *Order: JOB_FINISH.1 - *Cmd: "<1B>E<1B>%%-12345X@PJL<20>LPORTROTATE<0A><1B>%%-12345X" -} -*Command: CmdCopies -{ - *Order: DOC_SETUP.13 - *Cmd: "<1B>&l" %d{NumOfCopies}"X" -} - -*%****************************************************************************************** -*% Cursor, Page and Color Commands -*%****************************************************************************************** -*RotateCoordinate?: TRUE -*RotateRaster?: TRUE -*RotateFont?: TRUE -*TextCaps: LIST(TC_CR_90,TC_UA_ABLE) -*MemoryUsage: LIST(FONT, RASTER, VECTOR) -*CursorXAfterCR: AT_PRINTABLE_X_ORIGIN -*BadCursorMoveInGrxMode: LIST(X_PORTRAIT,Y_LANDSCAPE) -*XMoveThreshold: 0 -*YMoveThreshold: 0 -*XMoveUnit: 300 -*YMoveUnit: 300 -*Command: CmdXMoveAbsolute { *Cmd : "<1B>*p" %d{(DestX) }"X" } -*Command: CmdXMoveRelRight { *Cmd : "<1B>*p+" %d[0,9600]{max_repeat((DestXRel) )}"X" } -*Command: CmdXMoveRelLeft { *Cmd : "<1B>*p-" %d[0,9600]{max_repeat((DestXRel) )}"X" } -*Command: CmdYMoveAbsolute { *Cmd : "<1B>*p" %d{(DestY) }"Y" } -*Command: CmdYMoveRelDown { *Cmd : "<1B>*p+" %d{(DestYRel) }"Y" } -*Command: CmdYMoveRelUp { *Cmd : "<1B>*p-" %d{(DestYRel) }"Y" } -*Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" -+ %d{PaletteIndexToProgram} "I" } -*Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } -*Command: CmdCR { *Cmd : "<0D>" } -*Command: CmdLF { *Cmd : "<0A>" } -*Command: CmdFF { *Cmd : "<0C>" } -*Command: CmdBackSpace { *Cmd : "<08>" } -*Command: CmdUniDirectionOn { *Cmd : "<00>" } -*Command: CmdUniDirectionOff { *Cmd : "<00>" } -*Command: CmdPushCursor { *Cmd : "<1B>&f0S" } -*Command: CmdPopCursor { *Cmd : "<1B>&f1S" } -*Command: CmdSetSimpleRotation { *Cmd : "<1B>&a" %d{PrintDirInCCDegrees}"P" } -*EjectPageWithFF?: TRUE -*Command: CmdEnableTIFF4 { *Cmd : "<1B>*b2M" } -*Command: CmdDisableCompression { *Cmd : "<1B>*b0M" } -*OutputDataFormat: H_BYTE -*OptimizeLeftBound?: TRUE -*CursorXAfterSendBlockData: AT_GRXDATA_ORIGIN -*CursorYAfterSendBlockData: AUTO_INCREMENT - -*%****************************************************************************************** -*% Font Descriptions and Commands -*%****************************************************************************************** -*TTFSEnabled?: TRUE -*DefaultFont: 136 -*DefaultCTT: 0 -*CharPosition: BASELINE -*DeviceFonts: LIST(136,138,146,147,148,149,150,151,152,153,154,155,156,157, -+ 163,164,165,166,196,197,198,199,200,201,202,203,209,210, -+ 211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226, -+ 227,228,229,230) -*MinFontID: 16534 -*MaxFontID: 32768 -*switch: Resolution -{ - *case: Option1 - { - *FontFormat: HPPCL_OUTLINE - } - *case: Option2 - { - *FontFormat: HPPCL_OUTLINE - } - *case: Option3 - { - *FontFormat: HPPCL_RES - } -} -*Command: CmdSetFontID { *Cmd : "<1B>*c" %d{NextFontID}"D" } -*Command: CmdSelectFontID { *Cmd : "<1B>(" %d{CurrentFontID}"X" } -*Command: CmdSetCharCode { *Cmd : "<1B>*c" %d{NextGlyph}"E" } -*Command: CmdUnderlineOn { *Cmd : "<1B>&dD" } -*Command: CmdUnderlineOff { *Cmd : "<1B>&d@" } -*Command: CmdWhiteTextOn { *Cmd : "<1B>*v1o1T" } -*Command: CmdWhiteTextOff { *Cmd : "<1B>*v0o0T" } - - -*%******************************************************************************************** -*%* Vector Commands. -*%******************************************************************************************** -*MinGrayFill: 1 -*MaxGrayFill: 100 -*Command: CmdSetRectWidth { *Cmd : "<1B>*c" %d{(RectXSize) }"A" } -*Command: CmdSetRectHeight { *Cmd : "<1B>*c" %d{(RectYSize) }"B" } -*Command: CmdRectGrayFill { *Cmd : "<1B>*c" %d{GrayPercentage }"g2P" } -*Command: CmdRectWhiteFill { *Cmd : "<1B>*c1P" } -*Command: CmdRectBlackFill { *Cmd : "<1B>*c0P" } diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean.htm b/print/OEM Printer Customization Plug-in Samples/C++/oemprean.htm deleted file mode 100644 index 87662eb5..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean.htm +++ /dev/null @@ -1,514 +0,0 @@ - - - - - - - - -OEMPREAN SAMPLE - - - - - - - -
- -

OEMPREAN SAMPLE

- -

 

- -

Summary

- -

This -sample illustrates how you can leverage the preanalysis feature in Unidrv. This -sample is built upon the redesigned version of the oemuni sample.

- -

 

- -

When -preanalysis is enabled in the GPD, Unidrv defines the surface as a banding -surface but causes the first playback to be of the entire page. Unidrv does -this by setting the GDI clip window to the entire page. Unidrv allows all -drawing commands to be hooked but returns before any drawing can be done. On -the following passes Unidrv resets the clip window back to the original band -size and bands normally. In order to enable this feature in the GPD, specify -the following GPD parameter: *PreAnalysisOptions: 8.

- -

 

- -

The OEM -rendering plug-in is required to hook both DrvStartBanding and DrvNextBand when -this mode is enabled in the GPD. The OEM rendering plug-in must test the pptl -parameter of the DrvStartBanding call to determine whether preanalysis has been -enabled on this page. If the pptl parameter is NULL, then preanalysis has been -enabled. The pptl parameter can be used by Unidrv since it has no meaning at -this point. This parameter has not been updated with the band position and for -preanalysis the band position is always be set to 0, 0. If the pptl parameter -is NULL, then the OEM rendering plug-in should consider all drawing calls up to -the first call to DrvNextBand to be part of preanalysis. During this phase no -drawing onto the surface is allowed. You should be aware that after -preanalysis, you might get more calls than you saw in the normal rendering, -because primitives that cross band boundaries yield two or more DDI calls after -the preanalysis pass.

- -

 

- -

The -sample uses the bPreAnalysis flag in the OEMPDEV structure to denote whether a -particular pass is the preanalysis pass or the actual rendering pass. If the -bPreAnalysis flag is set, it indicates that the current pass is the preanalysis -pass. The sample implements all of the drawing function hooks in ddihook.cpp. -The sample uses the OEMStartBanding and OEMNextBand functions, to respectively -set and reset the bPreAnalysis flag. The sample also uses the DBG_CLIPOBJ debug -macro function to dump the bounds of the clipping rectangle available for -preanalysis in each of the drawing functions during the preanalysis pass. To -view all of the debug output in the debugger, you must set the debug level to -VERBOSE. The rest of the sample is identical to the oemuni sample that -illustrates a basic OEM rendering plug-in.

- -

 

- -

Note that -the surface used during preanalysis might differ from the surface passed in -during the rendering pass. Also note that during the preanalysis pass, although -Unidrv calls the hooked drawing functions, it returns before any drawing is -done. For this reason you should not perform any drawing on the surface during -the preanalysis pass. All other preanalysis tasks should be performed during -this pass. For example, certain printers need to handle black objects that -intersect with color objects differently from black objects that appear by -themselves. Other printers might need to halftone StretchBlt objects -differently from BitBlt objects. Basically, the plug-in can analyze the objects -on the page. A final point to note is that during the preanalysis pass, drawing -functions should not call back into Unidrv. When the bPreAnalysis flag is set, -the sample returns without calling back into Unidrv.

- -

 

- -

Note that -this sample will not build with the Windows 2000 build environment. This -version of the sample implements the IPrintOemUni2 interface which is available -only on Windows XP and later. The table shown below will help identify which -operating systems this sample will build/work on.

- -

 

- -

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Operating System

-
-

Can sample be built in the OS?

-
-

Does sample work in the OS?

-
-

Can sample be used in a production environment - for the OS?

-
-

Windows - codenamed Longhorn

-
-

Yes

-
-

Yes

-
-

No

-
-

Windows - Server 2003

-
-

Yes

-
-

No

-
-

No

-
-

Windows - XP

-
-

Yes

-
-

No

-
-

No

-
-

Windows - 2000

-
-

No

-
-

No

-
-

No

-
-

Windows - Me

-
-

No

-
-

No

-
-

No

-
-

Windows - 98 SE

-
-

No

-
-

No

-
-

No

-
- -

 

- -

 

- -

Building the sample

- -

To build -the samples, run build cZ from -the directory. The resulting DLL will be placed in the appropriate platform directory -(i.e. i386 or Alpha). To create a version with verbose debug output, add _DEBUG -to the compile defines in the sources file.

- -

 

- -

Installing the sample

- -

After -building the sample, you can install it using the Add Printer Wizard and -supplying the INF that is part of the sample when you are prompted for an INF -in the wizard. The Unidrv binaries required for this driver need not be copied -to the local directory containing oemdll.inf.

- -

 

- -

Resources

- -

For the -latest release of the Windows Device Driver Development Kit, see http://www.microsoft.com/whdc/ddk/winddk.mspx.

- -

 

- -

If you -have questions on using or adapting this sample for your project, you can -either contact Microsoft Technical -Support or post your questions in the Microsoft -driver development newsgroup.

- -

 

- -

 

- -

File Manifest

- -

 

- -

Root:

- -

 

- -

Files Description

- -

readme.htm The documentation for this sample -(this file).

- -

oemprean.gpd The generic GPD file for this sample.

- -

oemprean.inf The printer INF that will install -this sample once it is built.

- -

oemprean.ini The printer ini file that specifies -the OEM customization DLLs for this sample.

- -

 

- -

 

- -

OEMPREAN directory:

- -

 

- -

Files Description

- -

ddihook.cpp Source module for DDI Hook routines -for the rendering plug-in. (OEMBitBlt, OEMStrokePath, OEMTextOut, OEMNextBand -etc.)

- -

ddihook.h Source module that defines the -constants used to control DDI hooking. (IMPL_ALPHABLEND, IMPL_BITBLT, -IMPL_NEXTBAND etc.)

- -

debug.cpp Source module that contains the -debugging functions. (COemUniDbg::vDumpSURFOBJ, COemUniDbg::vDumpSTROBJ etc.)

- -

debug.h The header file for the debug -module defined in debug.cpp. (Definition of the COemUniDbg class)

- -

devmode.cpp Source module that contains -implementation of the OEM Devmode functions. (hrOEMDevmode, bConvertOEMDevmode -etc.)

- -

devmode.h The header for devmode.cpp.

- -

dllentry.cpp Source module for DLL entry -functions. (DllMain)

- -

enable.cpp Source module that contains the -enable routines for the rendering plug-in. (OEMEnableDriver, OEMEnablePDEV, -OEMDisableDriver etc.)

- -

intrface.cpp Source module that implements the -OEM COM printer customization rendering plug-in interface. -(COemUni2::ImageProcessing, COemUni2::FilterGraphics etc.)

- -

intrface.h The header for intrface.cpp that -defines the COM interface for the rendering plug-in. (Definition of the -COemUni2 class)

- -

makefile The generic makefile for -building the code sample.

- -

oemprean.def The file that lists the exported -functions for the sample.

- -

oemprean.h The header file that defines the -PDEV class for the sample. (Definition and implementation of the COemPDEV -class)

- -

oemprean.rc The resources file for the rendering -plugins resources.

- -

precomp.h The header that includes the -headers to precompile.

- -

resource.h The header file the resources -file.

- -

sources The generic sources file for building -the code sample.

- -

 

- -
- - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf b/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf deleted file mode 100644 index e2905f70..00000000 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/oemprean.inf and /dev/null differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean.ini b/print/OEM Printer Customization Plug-in Samples/C++/oemprean.ini deleted file mode 100644 index ad5eed92..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean.ini +++ /dev/null @@ -1,4 +0,0 @@ -[OEMFiles] -OEMDriverFile1=OEMPREAN.DLL - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/ddihook.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/ddihook.cpp deleted file mode 100644 index b3843090..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/ddihook.cpp +++ /dev/null @@ -1,2069 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: DDIHook.cpp -// -// -// PURPOSE: DDI Hook routines for User Mode COM Customization DLL. -// -// This module implements the following functions defined in printoem.h: -// OEMCopyBits -// OEMBitBlt -// OEMStretchBlt -// OEMDitherColor -// OEMStretchBltROP -// OEMPlgBlt -// OEMPaint -// OEMRealizeBrush -// OEMStrokePath -// OEMFillPath -// OEMStrokeAndFillPath -// OEMLineTo -// OEMAlphaBlend -// OEMGradientFill -// OEMTransparentBlt -// OEMTextOut -// OEMQueryFont -// OEMQueryFontTree -// OEMQueryFontData -// OEMFontManagement -// OEMQueryAdvanceWidths -// OEMGetGlyphMode -// OEMStartDoc -// OEMEndDoc -// OEMStartPage -// OEMSendPage -// OEMStartBanding -// OEMNextBand -// OEMEscape -// -// History: -// 06/24/03 xxx created. -// -// - -#include "precomp.h" -#include "oemprean.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -BOOL APIENTRY -OEMCopyBits( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDst, - POINTL *pptlSrc - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvCopyBits. - - DrvCopyBits translates between device-managed - raster surfaces and GDI standard-format bitmaps. - GDI will call DrvCopyBits when it needs to copy from - one surface to another and at least one of the - surfaces is device-managed. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDst - Points to the Dstination surface - psoSrc - Points to the source surface - pxlo - XLATEOBJ provided by the engine - pco - Defines a clipping region on the Dstination surface - pxlo - Defines the translation of color indices - between the source and target surfaces - prclDst - Defines the area to be modified - pptlSrc - Defines the upper-left corner of the source rectangle - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMCopyBits entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - if (pOemPDEV->bPreAnalysis) - { - VERBOSE(TEXT("OEMCopyBits: Begin pre-analysis...\r\n")); - - // Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass. - // Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might - // differ from the surface passed in during the rendering pass. - - // Dump the bounds of the clip window available for pre-analysis. - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - - // Although unidrv calls the hooked drawing functions, it will return before any drawing is done. - // So we should not perform any drawing on the surface. But all other pre-analysis tasks should - // be performed here. For example, certain printers need to handle black objects differently if - // they intersect with any color objects versus being stand alone. Another task could be to halftone - // stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page. - - // During the pre-analysis pass, drawing functions should not call back into Unidrv. - // So we return here. - VERBOSE(TEXT("OEMCopyBits: End pre-analysis...\r\n")); - - return TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvCopyBits)(psoDst, - psoSrc, - pco, - pxlo, - prclDst, - pptlSrc); -} - -BOOL APIENTRY -OEMBitBlt( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDst, - POINTL *pptlSrc, - POINTL *pptlMask, - BRUSHOBJ *pbo, - POINTL *pptlBrush, - ROP4 rop4 - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvBitBlt. - - DrvBitBlt provides general bit-block transfer capabilities - between device-managed surfaces, between GDI-managed - standard-format bitmaps, or between a device-managed - surface and a GDI-managed standard-format bitmap. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDst - Describes the target surface - psoSrc - Describes the source surface - psoMask - Describes the mask for rop4 - pco - Limits the area to be modified - pxlo - Specifies how color indices are translated - between the source and target surfaces - prclDst - Defines the area to be modified - pptlSrc - Defines the upper left corner of the source rectangle - pptlMask - Defines which pixel in the mask corresponds to - the upper left corner of the source rectangle - pbo - Defines the pattern for bitblt - pptlBrush - Defines the origin of the brush in the Dstination surface - rop4 - ROP code that defines how the mask, pattern, source, and - Dstination pixels are combined to write to the Dstination surface - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMBitBlt entry."); - - DBG_SURFOBJ(DBG_VERBOSE, L"psoDst", psoDst); - DBG_SURFOBJ(DBG_VERBOSE, L"psoSrc", psoSrc); - DBG_SURFOBJ(DBG_VERBOSE, L"psoMask", psoMask); - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - DBG_XLATEOBJ(DBG_VERBOSE, L"pxlo", pxlo); - DBG_RECTL(DBG_VERBOSE, L"prclDst", prclDst); - DBG_POINTL(DBG_VERBOSE, L"pptlSrc", pptlSrc); - DBG_POINTL(DBG_VERBOSE, L"pptlMask", pptlMask); - DBG_BRUSHOBJ(DBG_VERBOSE, L"pbo", pbo); - DBG_POINTL(DBG_VERBOSE, L"pptlBrush", pptlBrush); - VERBOSE(TEXT("\nrop4: %#x\r\n\n"), rop4); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - if (pOemPDEV->bPreAnalysis) - { - VERBOSE(TEXT("OEMBitBlt: Begin pre-analysis...\r\n")); - - // Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass. - // Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might - // differ from the surface passed in during the rendering pass. - - // Dump the bounds of the clip window available for pre-analysis. - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - - // Although unidrv calls the hooked drawing functions, it will return before any drawing is done. - // So we should not perform any drawing on the surface. But all other pre-analysis tasks should - // be performed here. For example, certain printers need to handle black objects differently if - // they intersect with any color objects versus being stand alone. Another task could be to halftone - // stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page. - - // During the pre-analysis pass, drawing functions should not call back into Unidrv. - // So we return here. - VERBOSE(TEXT("OEMBitBlt: End pre-analysis...\r\n")); - - return TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvBitBlt)(psoDst, - psoSrc, - psoMask, - pco, - pxlo, - prclDst, - pptlSrc, - pptlMask, - pbo, - pptlBrush, - rop4); -} - -BOOL APIENTRY -OEMStretchBlt( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - COLORADJUSTMENT *pca, - POINTL *pptlHTOrg, - RECTL *prclDst, - RECTL *prclSrc, - POINTL *pptlMask, - ULONG iMode - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvStretchBlt. - - DrvStretchBlt provides stretching bit-block transfer - capabilities between any combination of device-managed - and GDI-managed surfaces. DrvStretchBlt enables the - device driver to write to GDI bitmaps, especially when the - driver can do halftoning. This function allows the same - halftoning algorithm to be applied to GDI bitmaps and - device surfaces. This function can be provided to handle - only certain forms of stretching, such as by integer multiples. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDst - Defines the surface on which to draw - psoSrc - Defines the source for blt operation - psoMask - Defines a surface that provides a mask for the source - pco - Limits the area to be modified on the Dstination - pxlo - Specifies how color dwIndexes are to be translated - between the source and target surfaces - pca - Defines color adjustment values to be applied to the source bitmap - pptlHTOrg - Specifies the origin of the halftone brush - prclDst - Defines the area to be modified on the Dstination surface - prclSrc - Defines the area to be copied from the source surface - pptlMask - Specifies which pixel in the given mask corresponds to - the upper left pixel in the source rectangle - iMode - Specifies how source pixels are combined to get output pixels - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMStretchBlt entry."); - - DBG_SURFOBJ(DBG_VERBOSE, L"psoDst", psoDst); - DBG_SURFOBJ(DBG_VERBOSE, L"psoSrc", psoSrc); - DBG_SURFOBJ(DBG_VERBOSE, L"psoMask", psoMask); - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - DBG_XLATEOBJ(DBG_VERBOSE, L"pxlo", pxlo); - DBG_COLORADJUSTMENT(DBG_VERBOSE, L"pca", pca); - DBG_POINTL(DBG_VERBOSE, L"pptlHTOrg", pptlHTOrg); - DBG_RECTL(DBG_VERBOSE, L"prclDst", prclDst); - DBG_RECTL(DBG_VERBOSE, L"prclSrc", prclSrc); - DBG_POINTL(DBG_VERBOSE, L"pptlMask", pptlMask); - VERBOSE(TEXT("\niMode: %#x\r\n\n"), iMode); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - if (pOemPDEV->bPreAnalysis) - { - VERBOSE(TEXT("OEMStretchBlt: Begin pre-analysis...\r\n")); - - // Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass. - // Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might - // differ from the surface passed in during the rendering pass. - - // Dump the bounds of the clip window available for pre-analysis. - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - - // Although unidrv calls the hooked drawing functions, it will return before any drawing is done. - // So we should not perform any drawing on the surface. But all other pre-analysis tasks should - // be performed here. For example, certain printers need to handle black objects differently if - // they intersect with any color objects versus being stand alone. Another task could be to halftone - // stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page. - - // During the pre-analysis pass, drawing functions should not call back into Unidrv. - // So we return here. - VERBOSE(TEXT("OEMStretchBlt: End pre-analysis...\r\n")); - - return TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvStretchBlt)(psoDst, - psoSrc, - psoMask, - pco, - pxlo, - pca, - pptlHTOrg, - prclDst, - prclSrc, - pptlMask, - iMode); -} - -ULONG APIENTRY -OEMDitherColor( - DHPDEV dhpdev, - ULONG iMode, - ULONG rgbColor, - ULONG *pulDither - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvDitherColor. - - DrvDitherColor requests the device to create a - brush dithered against a device palette. - - Please refer to DDK documentation for more details. - -Arguments: - - dhpdev - DHPDEV passed, it is our pDEV - iMode - Not used - rgbColor - Solid rgb color to be used - pulDither - buffer to put the halftone brush. - -Return Value: - - Returns halftone method. - - DCR_DRIVER if the dither values have been calculated by the driver. - DCR_SOLID if the engine should use the best solid color approximation of the color. - DCR_HALFTONE if the engine should create a halftone approximation for the driver. - ---*/ - -{ - VERBOSE(L"OEMDitherColor entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvDitherColor)(dhpdev, - iMode, - rgbColor, - pulDither); -} - -BOOL APIENTRY -OEMStretchBltROP( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - COLORADJUSTMENT *pca, - POINTL *pptlHTOrg, - RECTL *prclDst, - RECTL *prclSrc, - POINTL *pptlMask, - ULONG iMode, - BRUSHOBJ *pbo, - ROP4 rop4 - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvStretchBltROP. - - DrvStretchBltROP performs a stretching bit-block transfer - using a ROP. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDst - Specifies the target surface - psoSrc - Specifies the source surface - psoMask - Specifies the mask surface - pco - Limits the area to be modified - pxlo - Specifies how color indices are translated - between the source and target surfaces - pca - Defines color adjustment values to be applied to the source bitmap - pptlHTOrg - Specifies the halftone origin - prclDst - Area to be modified on the destination surface - prclSrc - Rectangle area on the source surface - pptlMask - Defines which pixel in the mask corresponds to - the upper left corner of the source rectangle - iMode - Specifies how source pixels are combined to get output pixels - pbo - Defines the pattern for bitblt - rop4 - ROP code that defines how the mask, pattern, source, and - destination pixels are combined on the destination surface - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMStretchBltROP entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - if (pOemPDEV->bPreAnalysis) - { - VERBOSE(TEXT("OEMStretchBltROP: Begin pre-analysis...\r\n")); - - // Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass. - // Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might - // differ from the surface passed in during the rendering pass. - - // Dump the bounds of the clip window available for pre-analysis. - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - - // Although unidrv calls the hooked drawing functions, it will return before any drawing is done. - // So we should not perform any drawing on the surface. But all other pre-analysis tasks should - // be performed here. For example, certain printers need to handle black objects differently if - // they intersect with any color objects versus being stand alone. Another task could be to halftone - // stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page. - - // During the pre-analysis pass, drawing functions should not call back into Unidrv. - // So we return here. - VERBOSE(TEXT("OEMStretchBltROP: End pre-analysis...\r\n")); - - return TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvStretchBltROP)(psoDst, - psoSrc, - psoMask, - pco, - pxlo, - pca, - pptlHTOrg, - prclDst, - prclSrc, - pptlMask, - iMode, - pbo, - rop4); -} - -BOOL APIENTRY -OEMPlgBlt( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - COLORADJUSTMENT *pca, - POINTL *pptlBrushOrg, - POINTFIX *pptfixDest, - RECTL *prclSrc, - POINTL *pptlMask, - ULONG iMode - ) -/*++ - -Routine Description: - - Implementation of DDI hook for DrvPlgBlt. - - DrvPlgBlt provides rotate bit-block transfer capabilities between - combinations of device-managed and GDI-managed surfaces. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDst - Defines the surface on which to draw - psoSrc - Defines the source for blt operation - psoMask - Defines a surface that provides a mask for the source - pco - Limits the area to be modified on the Dstination - pxlo - Specifies how color dwIndexes are to be translated - between the source and target surfaces - pca - Defines color adjustment values to be applied to the source bitmap - pptlBrushOrg - Specifies the origin of the halftone brush - pptfixDest - Defines the area to be modified on the Dstination surface - prclSrc - Defines the area to be copied from the source surface - pptlMask - Specifies which pixel in the given mask corresponds to - the upper left pixel in the source rectangle - iMode - Specifies how source pixels are combined to get output pixels - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMPlgBlt entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - if (pOemPDEV->bPreAnalysis) - { - VERBOSE(TEXT("OEMPlgBlt: Begin pre-analysis...\r\n")); - - // Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass. - // Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might - // differ from the surface passed in during the rendering pass. - - // Dump the bounds of the clip window available for pre-analysis. - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - - // Although unidrv calls the hooked drawing functions, it will return before any drawing is done. - // So we should not perform any drawing on the surface. But all other pre-analysis tasks should - // be performed here. For example, certain printers need to handle black objects differently if - // they intersect with any color objects versus being stand alone. Another task could be to halftone - // stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page. - - // During the pre-analysis pass, drawing functions should not call back into Unidrv. - // So we return here. - VERBOSE(TEXT("OEMPlgBlt: End pre-analysis...\r\n")); - - return TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvPlgBlt)(psoDst, - psoSrc, - psoMask, - pco, - pxlo, - pca, - pptlBrushOrg, - pptfixDest, - prclSrc, - pptlMask, - iMode); -} - -BOOL APIENTRY -OEMPaint( - SURFOBJ *pso, - CLIPOBJ *pco, - BRUSHOBJ *pbo, - POINTL *pptlBrushOrg, - MIX mix - ) -/*++ - -Routine Description: - - Implementation of DDI hook for DrvPaint. - - DrvPaint is an obsolete function. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface on which to draw - pco - Limits the area to be modified on the Dstination - pbo - Points to a BRUSHOBJ which defined the pattern and colors to fill with - pptlBrushOrg - Specifies the origin of the halftone brush - mix - Defines the foreground and background raster operations to use for - the brush - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMPaint entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - if (pOemPDEV->bPreAnalysis) - { - VERBOSE(TEXT("OEMPaint: Begin pre-analysis...\r\n")); - - // Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass. - // Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might - // differ from the surface passed in during the rendering pass. - - // Dump the bounds of the clip window available for pre-analysis. - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - - // Although unidrv calls the hooked drawing functions, it will return before any drawing is done. - // So we should not perform any drawing on the surface. But all other pre-analysis tasks should - // be performed here. For example, certain printers need to handle black objects differently if - // they intersect with any color objects versus being stand alone. Another task could be to halftone - // stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page. - - // During the pre-analysis pass, drawing functions should not call back into Unidrv. - // So we return here. - VERBOSE(TEXT("OEMPaint: End pre-analysis...\r\n")); - - return TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvPaint)(pso, - pco, - pbo, - pptlBrushOrg, - mix); -} - -BOOL APIENTRY -OEMRealizeBrush( - BRUSHOBJ *pbo, - SURFOBJ *psoTarget, - SURFOBJ *psoPattern, - SURFOBJ *psoMask, - XLATEOBJ *pxlo, - ULONG iHatch - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvRealizeBrush. - - DrvRealizeBrush requests that the driver realize a specified brush - for a specified surface. To realize a brush, the driver converts a - GDI brush into a form that can be used internally. A realized brush - contains device-specific information needed by the device to - accelerate drawing using the brush. The driver's realization of a brush - is written into the buffer allocated by a call to BRUSHOBJ_pvAllocRBrush. - - Please refer to DDK documentation for more details. - -Arguments: - - pbo - BRUSHOBJ to be realized - psoTarget - Defines the surface for which the brush is to be realized - psoPattern - Defines the pattern for the brush - psoMask - Transparency mask for the brush - pxlo - Defines the interpretration of colors in the pattern - iHatch - Specifies whether psoPattern is one of the hatch brushes - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMRealizeBrush entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoTarget->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvRealizeBrush)(pbo, - psoTarget, - psoPattern, - psoMask, - pxlo, - iHatch); -} - -BOOL APIENTRY -OEMStrokePath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - XFORMOBJ *pxo, - BRUSHOBJ *pbo, - POINTL *pptlBrushOrg, - LINEATTRS *plineattrs, - MIX mix - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvStrokePath. - - DrvStrokePath strokes a path when called by GDI. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Identifies the surface on which to draw - ppo - Defines the path to be stroked - pco - Defines the clipping path - pxo - Specifies the world to device coordinate transformation - pbo - Specifies the brush to be used when drawing the path - pptlBrushOrg - Defines the brush origin - plineattrs - Defines the line attributes - mix - Specifies how to combine the brush with the destination - -Return Value: - - TRUE if successful - FALSE if driver cannot handle the path - DDI_ERROR if there is an error - ---*/ - -{ - VERBOSE(L"OEMStrokePath entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - if (pOemPDEV->bPreAnalysis) - { - VERBOSE(TEXT("OEMStrokePath: Begin pre-analysis...\r\n")); - - // Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass. - // Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might - // differ from the surface passed in during the rendering pass. - - // Dump the bounds of the clip window available for pre-analysis. - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - - // Although unidrv calls the hooked drawing functions, it will return before any drawing is done. - // So we should not perform any drawing on the surface. But all other pre-analysis tasks should - // be performed here. For example, certain printers need to handle black objects differently if - // they intersect with any color objects versus being stand alone. Another task could be to halftone - // stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page. - - // During the pre-analysis pass, drawing functions should not call back into Unidrv. - // So we return here. - VERBOSE(TEXT("OEMStrokePath: End pre-analysis...\r\n")); - - return TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvStrokePath)(pso, - ppo, - pco, - pxo, - pbo, - pptlBrushOrg, - plineattrs, - mix); -} - -BOOL APIENTRY -OEMFillPath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - BRUSHOBJ *pbo, - POINTL *pptlBrushOrg, - MIX mix, - FLONG flOptions - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvFillPath. - - DrvFillPath is an optional entry point to handle the filling of closed paths. - GDI can call DrvFillPath to fill a path on a device-managed surface. - When deciding whether to call this function, GDI compares the fill - requirements with the following flags in the flGraphicsCaps member of - the DEVINFO structure: GCAPS_BEZIERS, GCAPS_ALTERNATEFILL, - and GCAPS_WINDINGFILL. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface on which to draw. - ppo - Defines the path to be filled - pco - Defines the clipping path - pbo - Defines the pattern and colors to fill with - pptlBrushOrg - Defines the brush origin - mix - Defines the foreground and background ROPs to use for the brush - flOptions - Whether to use zero-winding or odd-even rule - -Return Value: - - TRUE if successful - FALSE if driver cannot handle the path - DDI_ERROR if there is an error - ---*/ - -{ - VERBOSE(L"OEMFillPath entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - if (pOemPDEV->bPreAnalysis) - { - VERBOSE(TEXT("OEMFillPath: Begin pre-analysis...\r\n")); - - // Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass. - // Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might - // differ from the surface passed in during the rendering pass. - - // Dump the bounds of the clip window available for pre-analysis. - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - - // Although unidrv calls the hooked drawing functions, it will return before any drawing is done. - // So we should not perform any drawing on the surface. But all other pre-analysis tasks should - // be performed here. For example, certain printers need to handle black objects differently if - // they intersect with any color objects versus being stand alone. Another task could be to halftone - // stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page. - - // During the pre-analysis pass, drawing functions should not call back into Unidrv. - // So we return here. - VERBOSE(TEXT("OEMFillPath: End pre-analysis...\r\n")); - - return TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvFillPath)(pso, - ppo, - pco, - pbo, - pptlBrushOrg, - mix, - flOptions); -} - -BOOL APIENTRY -OEMStrokeAndFillPath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - XFORMOBJ *pxo, - BRUSHOBJ *pboStroke, - LINEATTRS *plineattrs, - BRUSHOBJ *pboFill, - POINTL *pptlBrushOrg, - MIX mixFill, - FLONG flOptions - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvStrokeAndFillPath. - - DrvStrokeAndFillPath strokes and fills a path concurrently. - The driver can return FALSE if the path or the clipping is too - complex for the device to handle; in that case, GDI converts - to a simpler call. For example, if the device driver has set the - GCAPS_BEZIERS flag in the flGraphicsCaps member of the - DEVINFO structure and then receives a path with Bezier curves, - it can return FALSE; GDI will then convert the Bezier curves to - lines and call DrvStrokeAndFillPath again. If the device driver - returns FALSE again, GDI will further simplify the call, making - calls to DrvStrokePath and DrvFillPath, or to DrvBitBlt, depending - on the mix and width of the lines making up the path. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Describes the surface on which to draw - ppo - Describes the path to be filled - pco - Defines the clipping path - pxo - Specifies the world to device coordinate transformation - pboStroke - Specifies the brush to use when stroking the path - plineattrs - Specifies the line attributes - pboFill - Specifies the brush to use when filling the path - pptlBrushOrg - Specifies the brush origin for both brushes - mixFill - Specifies the foreground and background ROPs to use - for the fill brush - flOptions - Whether to use zero-winding or odd-even rule - -Return Value: - - TRUE if successful - FALSE if driver cannot handle the path - DDI_ERROR if there is an error - ---*/ - -{ - VERBOSE(L"OEMStrokeAndFillPath entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - if (pOemPDEV->bPreAnalysis) - { - VERBOSE(TEXT("OEMStrokeAndFillPath: Begin pre-analysis...\r\n")); - - // Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass. - // Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might - // differ from the surface passed in during the rendering pass. - - // Dump the bounds of the clip window available for pre-analysis. - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - - // Although unidrv calls the hooked drawing functions, it will return before any drawing is done. - // So we should not perform any drawing on the surface. But all other pre-analysis tasks should - // be performed here. For example, certain printers need to handle black objects differently if - // they intersect with any color objects versus being stand alone. Another task could be to halftone - // stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page. - - // During the pre-analysis pass, drawing functions should not call back into Unidrv. - // So we return here. - VERBOSE(TEXT("OEMStrokeAndFillPath: End pre-analysis...\r\n")); - - return TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvStrokeAndFillPath)(pso, - ppo, - pco, - pxo, - pboStroke, - plineattrs, - pboFill, - pptlBrushOrg, - mixFill, - flOptions); -} - -BOOL APIENTRY -OEMLineTo( - SURFOBJ *pso, - CLIPOBJ *pco, - BRUSHOBJ *pbo, - LONG x1, - LONG y1, - LONG x2, - LONG y2, - RECTL *prclBounds, - MIX mix - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvLineTo. - - DrvLineTo draws a single, solid, integer-only cosmetic line. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Describes the surface on which to draw - pco - Defines the clipping path - pbo - Defines the brush used to draw the line - x1,y1 - Specifies the line's starting point - x2,y2 - Specifies the line's ending point - prclBounds - Defines a rectangle that bounds the unclipped line. - mix - Specifies the foreground and background ROP - -Return Value: - - TRUE if successful - FALSE if driver cannot handle the path - DDI_ERROR if there is an error - ---*/ - -{ - VERBOSE(L"OEMLineTo entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - if (pOemPDEV->bPreAnalysis) - { - VERBOSE(TEXT("OEMLineTo: Begin pre-analysis...\r\n")); - - // Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass. - // Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might - // differ from the surface passed in during the rendering pass. - - // Dump the bounds of the clip window available for pre-analysis. - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - - // Although unidrv calls the hooked drawing functions, it will return before any drawing is done. - // So we should not perform any drawing on the surface. But all other pre-analysis tasks should - // be performed here. For example, certain printers need to handle black objects differently if - // they intersect with any color objects versus being stand alone. Another task could be to halftone - // stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page. - - // During the pre-analysis pass, drawing functions should not call back into Unidrv. - // So we return here. - VERBOSE(TEXT("OEMLineTo: End pre-analysis...\r\n")); - - return TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvLineTo)(pso, - pco, - pbo, - x1, - y1, - x2, - y2, - prclBounds, - mix); -} - -BOOL APIENTRY -OEMAlphaBlend( - SURFOBJ *psoDest, - SURFOBJ *psoSrc, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDest, - RECTL *prclSrc, - BLENDOBJ *pBlendObj - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvAlphaBlend. - - DrvAlphaBlend provides bit-block transfer capabilities with alpha blending. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDest - Defines the surface on which to draw - psoSrc - Defines the source - pco - Limits the area to be modified on the Destination - pxlo - Specifies how color dwIndexes are to be translated - between the source and target surfaces - prclDest - Defines the area to be modified on the Destination surface - prclSrc - Defines the area to be copied from the source surface - BlendFunction - Specifies the blend function to be used - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMAlphaBlend entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDest->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - if (pOemPDEV->bPreAnalysis) - { - VERBOSE(TEXT("OEMAlphaBlend: Begin pre-analysis...\r\n")); - - // Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass. - // Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might - // differ from the surface passed in during the rendering pass. - - // Dump the bounds of the clip window available for pre-analysis. - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - - // Although unidrv calls the hooked drawing functions, it will return before any drawing is done. - // So we should not perform any drawing on the surface. But all other pre-analysis tasks should - // be performed here. For example, certain printers need to handle black objects differently if - // they intersect with any color objects versus being stand alone. Another task could be to halftone - // stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page. - - // During the pre-analysis pass, drawing functions should not call back into Unidrv. - // So we return here. - VERBOSE(TEXT("OEMAlphaBlend: End pre-analysis...\r\n")); - - return TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvAlphaBlend)(psoDest, - psoSrc, - pco, - pxlo, - prclDest, - prclSrc, - pBlendObj); -} - -BOOL APIENTRY -OEMGradientFill( - SURFOBJ *psoDest, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - TRIVERTEX *pVertex, - ULONG nVertex, - PVOID pMesh, - ULONG nMesh, - RECTL *prclExtents, - POINTL *pptlDitherOrg, - ULONG ulMode - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvGradientFill. - - DrvGradientFill shades the specified primitives. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDest - Defines the surface on which to draw - pco - Limits the area to be modified on the Destination - pxlo - Should be ignored by the driver - pVertex - Pointer to an array of TRIVERTEX structures, - with each entry containing position and color information - nVertex - Specifies the number of TRIVERTEX structures in the - array to which pVertex points - pMesh - Pointer to an array of structures that define the connectivity - of the TRIVERTEX elements to which pVertex points - nMesh - Specifies the number of elements in the array to which - pMesh points - prclExtents - Pointer to a RECTL structure that defines the area in - which the gradient drawing is to occur - pptlDitherOrg - Pointer to a POINTL structure that defines the origin - on the surface for dithering - ulMode - Specifies the current drawing mode and how to interpret - the array to which pMesh points - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMGradientFill entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDest->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - if (pOemPDEV->bPreAnalysis) - { - VERBOSE(TEXT("OEMGradientFill: Begin pre-analysis...\r\n")); - - // Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass. - // Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might - // differ from the surface passed in during the rendering pass. - - // Dump the bounds of the clip window available for pre-analysis. - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - - // Although unidrv calls the hooked drawing functions, it will return before any drawing is done. - // So we should not perform any drawing on the surface. But all other pre-analysis tasks should - // be performed here. For example, certain printers need to handle black objects differently if - // they intersect with any color objects versus being stand alone. Another task could be to halftone - // stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page. - - // During the pre-analysis pass, drawing functions should not call back into Unidrv. - // So we return here. - VERBOSE(TEXT("OEMGradientFill: End pre-analysis...\r\n")); - - return TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvGradientFill)(psoDest, - pco, - pxlo, - pVertex, - nVertex, - pMesh, - nMesh, - prclExtents, - pptlDitherOrg, - ulMode); -} - -BOOL APIENTRY -OEMTransparentBlt( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDst, - RECTL *prclSrc, - ULONG iTransColor, - ULONG ulReserved - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvTransparentBlt. - - DrvTransparentBlt provides bit-block transfer capabilities with - transparency. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDst - Defines the surface on which to draw - psoSrc - Defines the source - pco - Limits the area to be modified on the Destination - pxlo - Specifies how color dwIndexes are to be translated - between the source and target surfaces - prclDst - Defines the area to be modified on the Destination surface - prclSrc - Defines the area to be copied from the source surface - iTransColor - Specifies the transparent color - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMTransparentBlt entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - if (pOemPDEV->bPreAnalysis) - { - VERBOSE(TEXT("OEMTransparentBlt: Begin pre-analysis...\r\n")); - - // Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass. - // Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might - // differ from the surface passed in during the rendering pass. - - // Dump the bounds of the clip window available for pre-analysis. - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - - // Although unidrv calls the hooked drawing functions, it will return before any drawing is done. - // So we should not perform any drawing on the surface. But all other pre-analysis tasks should - // be performed here. For example, certain printers need to handle black objects differently if - // they intersect with any color objects versus being stand alone. Another task could be to halftone - // stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page. - - // During the pre-analysis pass, drawing functions should not call back into Unidrv. - // So we return here. - VERBOSE(TEXT("OEMTransparentBlt: End pre-analysis...\r\n")); - - return TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvTransparentBlt)(psoDst, - psoSrc, - pco, - pxlo, - prclDst, - prclSrc, - iTransColor, - ulReserved); -} - -BOOL APIENTRY -OEMTextOut( - SURFOBJ *pso, - STROBJ *pstro, - FONTOBJ *pfo, - CLIPOBJ *pco, - RECTL *prclExtra, - RECTL *prclOpaque, - BRUSHOBJ *pboFore, - BRUSHOBJ *pboOpaque, - POINTL *pptlOrg, - MIX mix - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvTextOut. - - DrvTextOut is the entry point from GDI that calls for the - driver to render a set of glyphs at specified positions. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface on which to be written. - pstro - Defines the glyphs to be rendered and their positions - pfo - Specifies the font to be used - pco - Defines the clipping path - prclExtra - A NULL-terminated array of rectangles to be filled - prclOpaque - Specifies an opaque rectangle - pboFore - Defines the foreground brush - pboOpaque - Defines the opaque brush - pptlOrg - Pointer to POINT struct , defining th origin - mix - Specifies the foreground and background ROPs for pboFore - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMTextOut entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - DBG_SURFOBJ(DBG_VERBOSE, L"pso", pso); - DBG_STROBJ(DBG_VERBOSE, L"pstro", pstro); - DBG_FONTOBJ(DBG_VERBOSE, L"pfo", pfo); - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - DBG_BRUSHOBJ(DBG_VERBOSE, L"pboFore", pboFore); - DBG_BRUSHOBJ(DBG_VERBOSE, L"pboOpaque", pboOpaque); - - if (pOemPDEV->bPreAnalysis) - { - VERBOSE(TEXT("OEMTextOut: Begin pre-analysis...\r\n")); - - // Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass. - // Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might - // differ from the surface passed in during the rendering pass. - - // Dump the bounds of the clip window available for pre-analysis. - DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco); - - // Although unidrv calls the hooked drawing functions, it will return before any drawing is done. - // So we should not perform any drawing on the surface. But all other pre-analysis tasks should - // be performed here. For example, certain printers need to handle black objects differently if - // they intersect with any color objects versus being stand alone. Another task could be to halftone - // stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page. - - // During the pre-analysis pass, drawing functions should not call back into Unidrv. - // So we return here. - VERBOSE(TEXT("OEMTextOut: End pre-analysis...\r\n")); - - return TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvTextOut)(pso, - pstro, - pfo, - pco, - prclExtra, - prclOpaque, - pboFore, - pboOpaque, - pptlOrg, - mix); -} - -PIFIMETRICS APIENTRY -OEMQueryFont( - DHPDEV dhpdev, - ULONG_PTR iFile, - ULONG iFace, - ULONG_PTR *pid - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvQueryFont. - - DrvQueryFont is used by GDI to get the IFIMETRICS structure - for a given font. - - Please refer to DDK documentation for more details. - -Arguments: - - dhpdev - Driver device handle - iFile - Identifies the driver font file - iFace - One-based index of the driver font - pid - Points to a LONG variable for returning an identifier - which GDI will pass to DrvFree - -Return Value: - - Pointer to an IFIMETRICS structure for the given font. - NULL if there is an error - ---*/ - -{ - VERBOSE(L"OEMQueryFont entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvQueryFont)(dhpdev, - iFile, - iFace, - pid); -} - -PVOID APIENTRY -OEMQueryFontTree( - DHPDEV dhpdev, - ULONG_PTR iFile, - ULONG iFace, - ULONG iMode, - ULONG_PTR *pid - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvQueryFontTree. - - DrvQueryFontTree provides GDI with a pointer to a structure that - defines one of the following: - - A mapping from Unicode to glyph handles, including glyph variants - - A mapping of kerning pairs to kerning handles - - Please refer to DDK documentation for more details. - -Arguments: - - dhpdev - Driver device handle - iFile - Identifies the driver font file - iFace - One-based index of the driver font - iMode - Specifies the type of information to be provided - pid - Points to a LONG variable for returning an identifier - which GDI will pass to DrvFree - -Return Value: - - Pointer to the structure requested based on iMode. - NULL if there is an error - ---*/ - -{ - VERBOSE(L"OEMQueryFontTree entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvQueryFontTree)(dhpdev, - iFile, - iFace, - iMode, - pid); -} - -LONG APIENTRY -OEMQueryFontData( - DHPDEV dhpdev, - FONTOBJ *pfo, - ULONG iMode, - HGLYPH hg, - GLYPHDATA *pgd, - _Out_writes_bytes_(cjSize) PVOID pv, - ULONG cjSize - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvQueryFontData. - - DrvQueryFontData retrieves information about a realized font. - GDI provides a pointer to an array of glyph or kerning handles, - and the driver returns information about the glyphs or kerning - pairs. The driver can assume that all handles in the array are valid. - - Please refer to DDK documentation for more details. - -Arguments: - - dhpdev - Driver device handle - pfo - Points to a FONTOBJ structure - iMode - Type of information requested - hg - A glyph handle - pgd - Points to a GLYPHDATA structure - pv - Points to output buffer - cjSize - Size of output buffer - -Return Value: - - Depends on iMode. FD_ERROR if there is an error - ---*/ - -{ - VERBOSE(L"OEMQueryFontData entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvQueryFontData)(dhpdev, - pfo, - iMode, - hg, - pgd, - pv, - cjSize); -} - -ULONG APIENTRY -OEMFontManagement( - SURFOBJ *pso, - FONTOBJ *pfo, - ULONG iMode, - ULONG cjIn, - _In_reads_bytes_(cjIn) PVOID pvIn, - ULONG cjOut, - _Out_writes_bytes_(cjOut) PVOID pvOut - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvFontManagement. - - Is this function valid for Unidrv drivers? - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Points to a SURFOBJ structure - pfo - Points to a FONTOBJ structure - iMode - Escape number - cjIn - Size of input buffer - pvIn - Points to input buffer - cjOut - Size of output buffer - pvOut - Points to output buffer - -Return Value: - - 0x00000001 to 0x7fffffff for success - 0x80000000 to 0xffffffff for failure - 0 if the specified escape number if not supported - ---*/ - -{ - VERBOSE(L"OEMFontManagement entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvFontManagement)(pso, - pfo, - iMode, - cjIn, - pvIn, - cjOut, - pvOut); -} - -BOOL APIENTRY -OEMQueryAdvanceWidths( - DHPDEV dhpdev, - FONTOBJ *pfo, - ULONG iMode, - _In_reads_(cGlyphs) HGLYPH *phg, - _Out_writes_bytes_(cGlyphs*sizeof(USHORT)) PVOID pvWidths, - ULONG cGlyphs - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvQueryAdvanceWidths. - - DrvQueryAdvanceWidths returns character advance widths - for a specified set of glyphs. - - Please refer to DDK documentation for more details. - -Arguments: - - dhpdev - Driver device handle - pfo - Points to a FONTOBJ structure - iMode - Type of information to be provided - phg - Points to an array of HGLYPHs for which the driver will - provide character advance widths - pvWidths - Points to a buffer for returning width data - cGlyphs - Number of glyphs in the phg array - -Return Value: - - Depends on iMode - ---*/ - -{ - VERBOSE(L"OEMQueryAdvanceWidths entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvQueryAdvanceWidths)(dhpdev, - pfo, - iMode, - phg, - pvWidths, - cGlyphs); -} - -ULONG APIENTRY -OEMGetGlyphMode( - DHPDEV dhpdev, - FONTOBJ *pfo - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvGetGlyphMode. - - DrvGetGlyphMode tells GDI how to cache glyph information. - GDI calls a driver's DrvGetGlyphMode routine to determine the - range of font information that should be cached for a particular - font; that is, DrvGetGlyphMode determines what GDI stores in - its font cache. A device that caches fonts on its own should return - FO_HGLYPHS to minimize the storage requirements for the font. - GDI calls DrvGetGlyphMode for each font realization. For example, - a driver might want to download outlines for point sizes larger than - 12 point, but raster images for smaller fonts. However, GDI reserves - the right to refuse this request. - - Please refer to DDK documentation for more details. - -Arguments: - - dhpdev - Driver device handle - pfo - Points to a FONTOBJ structure - -Return Value: - - The glyph mode or FO_GLYPHMODE, which is the default. - ---*/ - -{ - VERBOSE(L"OEMGetGlyphMode entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvGetGlyphMode)(dhpdev, - pfo); -} - -BOOL APIENTRY -OEMStartDoc( - SURFOBJ *pso, - _In_ PWSTR pwszDocName, - DWORD dwJobId - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvStartDoc. - - DrvStartDoc is called by GDI when it is ready to - start sending a document to the driver for rendering. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface object - pDocName - Specifies a Unicode document name - jobId - Identifies the print job - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMStartDoc entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvStartDoc)(pso, - pwszDocName, - dwJobId); -} - -BOOL APIENTRY -OEMEndDoc( - SURFOBJ *pso, - FLONG fl - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvEndDoc. - - DrvEndDoc is called by GDI when it has finished - sending a document to the driver for rendering. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface object - flags - A set of flag bits - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMEndDoc entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvEndDoc)(pso, - fl); -} - -BOOL APIENTRY -OEMStartPage( - SURFOBJ *pso - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvStartPage. - - DrvStartPage is called by GDI when it is ready to - start sending the contents of a physical page to the - driver for rendering. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface object - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMStartPage entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvStartPage)(pso); -} - -BOOL APIENTRY -OEMSendPage( - SURFOBJ *pso - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvSendPage. - - DrvSendPage is called by GDI when it has finished - drawing a physical page, so the driver can send - the page to the printer. - - Please refer to DDK documentation for more details. - - NOTE: OEMSendPage will not be called in any driver that enables - pre-analysis. But the reason we implement this is that the driver - might be pushed to a down-level client and thereby have to run - without pre-analysis support. In this case, it might have to support - OEMSendPage. - -Arguments: - - pso - Defines the surface object - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMSendPage entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvSendPage)(pso); -} - -BOOL APIENTRY -OEMStartBanding( - SURFOBJ *pso, - POINTL *pptl - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvStartBanding. - - DrvStartBanding is called by GDI when it is ready to start - sending bands of a physical page to the driver for rendering. - Note: DrvStartBanding is called to prepare the driver - for banding, call only once per page (not at everyband!!) - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface object - pptl - Pointer to origin of next band (to return to GDI) - -Return Value: - - Fill out pptl to contain the origin of the first band - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMStartBanding entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - DBG_POINTL(DBG_VERBOSE, L"pptl", pptl); - - if (pptl == NULL) - { - VERBOSE(TEXT("OEMStartBanding: Start of OEM Pre-analysis pass...\r\n")); - VERBOSE(TEXT("\tOEM Pre-analysis pass...no drawing on surface in this pass.\r\n")); - pOemPDEV->bPreAnalysis = TRUE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvStartBanding)(pso, - pptl); -} - -BOOL APIENTRY -OEMNextBand( - SURFOBJ *pso, - POINTL *pptl - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvNextBand. - - DrvNextBand is called by GDI when it has finished - drawing a band for a physical page, so the driver - can send the band to the printer. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface object - pptl - Pointer to origin of next band (to return to GDI) - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"OEMNextBand entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - DBG_POINTL(DBG_VERBOSE, L"pptl", pptl); - - if (pOemPDEV->bPreAnalysis) - { - // - // First call into OEMNextBand indicates end of pre-analysis path. - // - VERBOSE(TEXT("OEMNextBand: End of OEM Pre-analysis pass...\r\n")); - pOemPDEV->bPreAnalysis = FALSE; - } - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvNextBand)(pso, - pptl); -} - -ULONG APIENTRY -OEMEscape( - SURFOBJ *pso, - ULONG iEsc, - ULONG cjIn, - _In_reads_bytes_(cjIn) PVOID pvIn, - ULONG cjOut, - _Out_writes_bytes_(cjOut) PVOID pvOut - ) - -/*++ - -Routine Description: - - Implementation of DDI entry point DrvEscape. - - DrvEscape is used for retrieving information from a device - that is not available in a device-independent device driver - interface; the particular query depends on the value of the - iEsc parameter. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Describes the surface the call is directed to - iEsc - Specifies a query - cjIn - Specifies the size in bytes of the buffer pointed to by pvIn - pvIn - Points to input data buffer - cjOut - Specifies the size in bytes of the buffer pointed to by pvOut - pvOut - Points to the output buffer - -Return Value: - - Depends on the query specified by iEsc parameter. - - Zero if the function specified by the query is not supported. - ---*/ - -{ - VERBOSE(L"OEMEscape entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvEscape)(pso, - iEsc, - cjIn, - pvIn, - cjOut, - pvOut); -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/debug.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/debug.cpp deleted file mode 100644 index f1807066..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/debug.cpp +++ /dev/null @@ -1,1503 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.cpp -// -// PURPOSE: Implementation of the debug functions. -// -// -// History: -// 06/28/03 xxx created. -// -// - -#include "precomp.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -//////////////////////////////////////////////////////// -// INTERNAL DEFINES -//////////////////////////////////////////////////////// - -#define DEBUG_BUFFER_SIZE 1024 -#define PATH_SEPARATOR '\\' - -//////////////////////////////////////////////////////// -// EXTERNAL GLOBALS -//////////////////////////////////////////////////////// - -#ifdef DBG - -INT giDebugLevel = DEBUG_LEVEL; - - -PCWSTR -EnsureLabel( - _In_opt_ PCWSTR pszInLabel, - _In_ PCWSTR pszDefLabel - ) - -/*++ - -Routine Description: - - This function checks if pszInLabel is valid. If not, it returns - pszDefLabel else pszInLabel is returned. - -Arguments: - - pszInLabel - custom label string passed in with the call to the dump function - pszDefLabel - default label string in case custom label string is not valid - -Return Value: - - pszInLabel if it is valid, else pszDefLabel - ---*/ - -{ - // By design, pszDefLabel is assumed to be a valid, non-empty - // string (since it is supplied internally). - // - if (!pszInLabel || !*pszInLabel) - { - // The caller supplied a NULL string or empty string; - // supply the internal default. - // - return pszDefLabel; - } - - return pszInLabel; -} - -BOOL OEMDebugMessage( - LPCWSTR lpszMessage, - ... - ) - -/*++ - -Routine Description: - - Outputs variable argument debug string. - -Arguments: - - dwSize - size of temp buffer to hold formatted string - lpszMessage - format string - arglist - Variable argument list... - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - va_list VAList; - HRESULT hResult; - - // Parameter checking. - if( NULL == lpszMessage) - { - return FALSE; - } - - LPWSTR lpszMsgBuf = new WCHAR[DEBUG_BUFFER_SIZE]; - if(NULL == lpszMsgBuf) - return FALSE; - - va_start(VAList, lpszMessage); - // Pass the variable parameters to wvsprintf to be formatted. - hResult = StringCchVPrintfW(lpszMsgBuf, DEBUG_BUFFER_SIZE, lpszMessage, VAList); - va_end(VAList); - - // Dump string to debug output. - OutputDebugStringW(lpszMsgBuf); - - // Clean up. - delete[] lpszMsgBuf; - - return SUCCEEDED(hResult); -} - -PCSTR -StripDirPrefixA( - IN PCSTR pstrFilename - ) - -/*++ - -Routine Description: - - Strip the directory prefix off a filename (ANSI version) - -Arguments: - - pstrFilename - Pointer to filename string - -Return Value: - - Pointer to the last component of a filename (without directory prefix) - ---*/ - -{ - PCSTR pstr; - - pstr = strrchr(pstrFilename, PATH_SEPARATOR); - if (pstr) - return pstr + 1; - - return pstrFilename; -} - -void -vDumpFlags( - DWORD dwFlags, - PDBG_FLAGS pDebugFlags - ) - -/*++ - -Routine Description: - - Dumps the combination of flags in members such as - pso->fjBitmap, pstro->flAccel, pfo->flFontType etc. - -Arguments: - - dwFlags - combined value of the relevant member - Example values are pso->fjBitmap, pstro->flAccel - pDebugFlags - structure containing the different possible values - that can be combined in dwFlags - -Return Value: - - NONE - ---*/ - -{ - DWORD dwFound = 0; - BOOL bFirstFlag = FALSE; - - OEMDebugMessage(L"%#x [", dwFlags); - - // Traverse through the list of flags to see if any match - // - for ( ; pDebugFlags->dwFlag; ++pDebugFlags) - { - if(dwFlags & pDebugFlags->dwFlag) - { - if (!bFirstFlag) - { - OEMDebugMessage(L"%s", pDebugFlags->pszFlag); - bFirstFlag = TRUE; - } - else - { - OEMDebugMessage(L" | %s", pDebugFlags->pszFlag); - } - dwFound |= pDebugFlags->dwFlag; - } - } - - OEMDebugMessage(L"]"); - - // - // Check if there are extra bits set that we don't understand. - // - if(dwFound != dwFlags) - { - OEMDebugMessage(L" ", dwFlags & ~dwFound); - } - - OEMDebugMessage(L"\r\n"); -} - -void -vDumpOemDMParam( - INT iDebugLevel, - _In_ PWSTR pszInLabel, - POEMDMPARAM pOemDMParam - ) - -/*++ - -Routine Description: - - Dumps the members of a OEMDMPARAM structure. - -Arguments: - - iDebugLevel - desired output debug level - pszInLabel - output label string - pOemDMParam - pointer to the OEMDMPARAM strct to be dumped - -Return Value: - - NONE - ---*/ - -{ - // Check if the debug level is appropriate - // - if (iDebugLevel < giDebugLevel) - { - // Nothing to output here - // - return; - } - - // Prepare the label string - // - PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pOemDMParam"); - - // Return if strct to be dumped is invalid - // - if (!pOemDMParam) - { - OEMDebugMessage(L"\npOemDMParam [%s]: NULL\r\n", pszLabel); - - // Nothing else to output - // - return; - } - - // Format the data - // - OEMDebugMessage(L"\npOemDMParam [%s]: %#x\r\n", pszLabel, pOemDMParam); - OEMDebugMessage(L"\tcbSize = %d\r\n", pOemDMParam->cbSize); - OEMDebugMessage(L"\tpdriverobj = %#x\r\n", pOemDMParam->pdriverobj); - OEMDebugMessage(L"\thPrinter = %#x\r\n", pOemDMParam->hPrinter); - OEMDebugMessage(L"\thModule = %#x\r\n", pOemDMParam->hModule); - OEMDebugMessage(L"\tpPublicDMIn = %#x\r\n", pOemDMParam->pPublicDMIn); - OEMDebugMessage(L"\tpPublicDMOut = %#x\r\n", pOemDMParam->pPublicDMOut); - OEMDebugMessage(L"\tpOEMDMIn = %#x\r\n", pOemDMParam->pOEMDMIn); - OEMDebugMessage(L"\tpOEMDMOut = %#x\r\n", pOemDMParam->pOEMDMOut); - OEMDebugMessage(L"\tcbBufSize = %d\r\n", pOemDMParam->cbBufSize); - - OEMDebugMessage(L"\n"); - -} - -#if DBG - DBG_FLAGS gafdSURFOBJ_fjBitmap[] = { - { L"BMF_TOPDOWN", BMF_TOPDOWN}, - { L"BMF_NOZEROINIT", BMF_NOZEROINIT}, - { L"BMF_DONTCACHE", BMF_DONTCACHE}, - { L"BMF_USERMEM", BMF_USERMEM}, - { L"BMF_KMSECTION", BMF_KMSECTION}, - { L"BMF_NOTSYSMEM", BMF_NOTSYSMEM}, - { L"BMF_WINDOW_BLT", BMF_WINDOW_BLT}, - {NULL, 0} // The NULL entry is important -// { L"BMF_UMPDMEM", BMF_UMPDMEM}, -// { L"BMF_RESERVED", BMF_RESERVED}, - }; -#else - DBG_FLAGS gafdSURFOBJ_fjBitmap[] = { - {NULL, 0} - }; -#endif - -void -vDumpSURFOBJ( - INT iDebugLevel, - _In_ PWSTR pszInLabel, - SURFOBJ *pso - ) - -/*++ - -Routine Description: - - Dumps the members of a SURFOBJ structure. - -Arguments: - - iDebugLevel - desired output debug level - pszInLabel - output label string - pso - pointer to the SURFOBJ strct to be dumped - -Return Value: - - NONE - ---*/ - -{ - // Check if the debug level is appropriate - // - if (iDebugLevel < giDebugLevel) - { - // Nothing to output here - // - return; - } - - // Prepare the label string - // - PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pso"); - - // Return if strct to be dumped is invalid - // - if (!pso) - { - OEMDebugMessage(L"\nSURFOBJ [%s]: NULL\r\n", pszLabel); - - // Nothing else to output - // - return; - } - - // Format the data - // - OEMDebugMessage(L"\nSURFOBJ [%s]: %#x\r\n", pszLabel, pso); - OEMDebugMessage(L"\tdhSurf: %#x\r\n", pso->dhsurf); - OEMDebugMessage(L"\thSurf: %#x\r\n", pso->hsurf); - OEMDebugMessage(L"\tdhpdev: %#x\r\n", pso->dhpdev); - OEMDebugMessage(L"\thdev: %#x\r\n", pso->hdev); - OEMDebugMessage(L"\tsizlBitmap: [%ld x %ld]\r\n", pso->sizlBitmap.cx, pso->sizlBitmap.cy); - OEMDebugMessage(L"\tcjBits: %ld\r\n", pso->cjBits); - OEMDebugMessage(L"\tpvBits: %#x\r\n", pso->pvBits); - OEMDebugMessage(L"\tpvScan0: %#x\r\n", pso->pvScan0); - OEMDebugMessage(L"\tlDelta: %ld\r\n", pso->lDelta); - OEMDebugMessage(L"\tiUniq: %ld\r\n", pso->iUniq); - - PWSTR psziBitmapFormat = L"0"; - switch (pso->iBitmapFormat) - { - case BMF_1BPP : psziBitmapFormat = L"BMF_1BPP" ; break; - case BMF_4BPP : psziBitmapFormat = L"BMF_4BPP" ; break; - case BMF_8BPP : psziBitmapFormat = L"BMF_8BPP" ; break; - case BMF_16BPP: psziBitmapFormat = L"BMF_16BPP"; break; - case BMF_24BPP: psziBitmapFormat = L"BMF_24BPP"; break; - case BMF_32BPP: psziBitmapFormat = L"BMF_32BPP"; break; - case BMF_4RLE : psziBitmapFormat = L"BMF_4RLE" ; break; - case BMF_8RLE : psziBitmapFormat = L"BMF_8RLE" ; break; - case BMF_JPEG : psziBitmapFormat = L"BMF_JPEG" ; break; - case BMF_PNG : psziBitmapFormat = L"BMF_PNG " ; break; - } - OEMDebugMessage(L"\tiBitmapFormat: %s\r\n", psziBitmapFormat); - - PWSTR psziType = L"0"; - switch (pso->iType) - { - case STYPE_BITMAP : psziType = L"STYPE_BITMAP" ; break; - case STYPE_DEVBITMAP: psziType = L"STYPE_DEVBITMAP"; break; - case STYPE_DEVICE : psziType = L"STYPE_DEVICE" ; break; - } - OEMDebugMessage(L"\tiType: %s\r\n", psziType); - - OEMDebugMessage(L"\tfjBitmap: "); - if (STYPE_BITMAP == pso->iType) - vDumpFlags(pso->fjBitmap, gafdSURFOBJ_fjBitmap); - else - OEMDebugMessage(L"IGNORE\r\n"); - - OEMDebugMessage(L"\n"); - -} - -#if DBG - DBG_FLAGS gafdSTROBJ_flAccel[] = { - { L"SO_FLAG_DEFAULT_PLACEMENT", SO_FLAG_DEFAULT_PLACEMENT}, - { L"SO_HORIZONTAL", SO_HORIZONTAL}, - { L"SO_VERTICAL", SO_VERTICAL}, - { L"SO_REVERSED", SO_REVERSED}, - { L"SO_ZERO_BEARINGS", SO_ZERO_BEARINGS}, - { L"SO_CHAR_INC_EQUAL_BM_BASE", SO_CHAR_INC_EQUAL_BM_BASE}, - { L"SO_MAXEXT_EQUAL_BM_SIDE", SO_MAXEXT_EQUAL_BM_SIDE}, - { L"SO_DO_NOT_SUBSTITUTE_DEVICE_FONT", SO_DO_NOT_SUBSTITUTE_DEVICE_FONT}, - { L"SO_GLYPHINDEX_TEXTOUT", SO_GLYPHINDEX_TEXTOUT}, - { L"SO_ESC_NOT_ORIENT", SO_ESC_NOT_ORIENT}, - { L"SO_DXDY", SO_DXDY}, - { L"SO_CHARACTER_EXTRA", SO_CHARACTER_EXTRA}, - { L"SO_BREAK_EXTRA", SO_BREAK_EXTRA}, - {NULL, 0} // The NULL entry is important - }; -#else - DBG_FLAGS gafdSTROBJ_flAccel[] = { - {NULL, 0} - }; -#endif - -void -vDumpSTROBJ( - INT iDebugLevel, - _In_ PWSTR pszInLabel, - STROBJ *pstro - ) - -/*++ - -Routine Description: - - Dumps the members of a STROBJ structure. - -Arguments: - - iDebugLevel - desired output debug level - pszInLabel - output label string - pstro - pointer to the STROBJ strct to be dumped - -Return Value: - - NONE - ---*/ - -{ - // Check if the debug level is appropriate - // - if (iDebugLevel < giDebugLevel) - { - // Nothing to output here - // - return; - } - - // Prepare the label string - // - PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pstro"); - - // Return if strct to be dumped is invalid - // - if (!pstro) - { - OEMDebugMessage(L"\nSTROBJ [%s]: NULL\r\n", pszLabel); - - // Nothing else to output - // - return; - } - - // Format the data - // - OEMDebugMessage(L"\nSTROBJ [%s]: %#x\r\n", pszLabel, pstro); - OEMDebugMessage(L"\tcGlyphs: %ld\r\n", pstro->cGlyphs); - OEMDebugMessage(L"\tflAccel: "); - vDumpFlags(pstro->flAccel, gafdSTROBJ_flAccel); - OEMDebugMessage(L"\tulCharInc: %ld\r\n", pstro->ulCharInc); - OEMDebugMessage(L"\trclBkGround: (%ld, %ld) (%ld, %ld)\r\n", pstro->rclBkGround.left, pstro->rclBkGround.top, pstro->rclBkGround.right, pstro->rclBkGround.bottom); - if (!pstro->pgp) - OEMDebugMessage(L"\tpgp: NULL\r\n"); - else - OEMDebugMessage(L"\tpgp: %#x\r\n", pstro->pgp); - OEMDebugMessage(L"\tpwszOrg: \"%s\"\r\n", pstro->pwszOrg); - - OEMDebugMessage(L"\n"); - -} - -#if DBG - DBG_FLAGS gafdFONTOBJ_flFontType[] = { - { L"FO_TYPE_RASTER", FO_TYPE_RASTER}, - { L"FO_TYPE_DEVICE", FO_TYPE_DEVICE}, - { L"FO_TYPE_TRUETYPE", FO_TYPE_TRUETYPE}, - { L"FO_TYPE_OPENTYPE", 0x8}, - { L"FO_SIM_BOLD", FO_SIM_BOLD}, - { L"FO_SIM_ITALIC", FO_SIM_ITALIC}, - { L"FO_EM_HEIGHT", FO_EM_HEIGHT}, - { L"FO_GRAY16", FO_GRAY16}, - { L"FO_NOGRAY16", FO_NOGRAY16}, - { L"FO_CFF", FO_CFF}, - { L"FO_POSTSCRIPT", FO_POSTSCRIPT}, - { L"FO_MULTIPLEMASTER", FO_MULTIPLEMASTER}, - { L"FO_VERT_FACE", FO_VERT_FACE}, - { L"FO_DBCS_FONT", FO_DBCS_FONT}, - {NULL, 0} // The NULL entry is important - }; -#else - DBG_FLAGS gafdFONTOBJ_flFontType[] = { - {NULL, 0} - }; -#endif - -void -vDumpFONTOBJ( - INT iDebugLevel, - _In_ PWSTR pszInLabel, - FONTOBJ *pfo - ) - -/*++ - -Routine Description: - - Dumps the members of a FONTOBJ structure. - -Arguments: - - iDebugLevel - desired output debug level - pszInLabel - output label string - pfo - pointer to the FONTOBJ strct to be dumped - -Return Value: - - NONE - ---*/ - -{ - // Check if the debug level is appropriate - // - if (iDebugLevel < giDebugLevel) - { - // Nothing to output here - // - return; - } - - // Prepare the label string - // - PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pfo"); - - // Return if strct to be dumped is invalid - // - if (!pfo) - { - OEMDebugMessage(L"\nFONTOBJ [%s]: NULL\r\n", pszLabel); - - // Nothing else to output - // - return; - } - - // Format the data - // - OEMDebugMessage(L"\nFONTOBJ [%s]: %#x\r\n", pszLabel, pfo); - OEMDebugMessage(L"\tiUniq: %ld\r\n", pfo->iUniq); - OEMDebugMessage(L"\tiFace: %ld\r\n", pfo->iFace); - OEMDebugMessage(L"\tcxMax: %ld\r\n", pfo->cxMax); - OEMDebugMessage(L"\tflFontType: "); - vDumpFlags(pfo->flFontType, gafdFONTOBJ_flFontType); - OEMDebugMessage(L"\tiTTUniq: %#x\r\n", pfo->iTTUniq); - OEMDebugMessage(L"\tiFile: %#x\r\n", pfo->iFile); - OEMDebugMessage(L"\tsizLogResPpi: [%ld x %ld]\r\n", pfo->sizLogResPpi.cx, pfo->sizLogResPpi.cy); - OEMDebugMessage(L"\tulStyleSize: %ld\r\n", pfo->ulStyleSize); - if (!pfo->pvConsumer) - OEMDebugMessage(L"\tpvConsumer: NULL\r\n"); - else - OEMDebugMessage(L"\tpvConsumer: %#x\r\n", pfo->pvConsumer); - if (!pfo->pvProducer) - OEMDebugMessage(L"\tpvProducer: NULL\r\n"); - else - OEMDebugMessage(L"\tpvProducer: %#x\r\n", pfo->pvProducer); - - OEMDebugMessage(L"\n"); - -} - -void -vDumpCLIPOBJ( - INT iDebugLevel, - _In_ PWSTR pszInLabel, - CLIPOBJ *pco - ) - -/*++ - -Routine Description: - - Dumps the members of a CLIPOBJ structure. - -Arguments: - - iDebugLevel - desired output debug level - pszInLabel - output label string - pco - pointer to the CLIPOBJ strct to be dumped - -Return Value: - - NONE - ---*/ - -{ - // Check if the debug level is appropriate - // - if (iDebugLevel < giDebugLevel) - { - // Nothing to output here - // - return; - } - - // Prepare the label string - // - PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pco"); - - // Return if strct to be dumped is invalid - // - if (!pco) - { - OEMDebugMessage(L"\nCLIPOBJ [%s]: NULL\r\n", pszLabel); - - // Nothing else to output - // - return; - } - - // Format the data - // - OEMDebugMessage(L"\nCLIPOBJ [%s]: %#x\r\n", pszLabel, pco); - OEMDebugMessage(L"\tiUniq: %ld\r\n", pco->iUniq); - OEMDebugMessage(L"\trclBounds: (%ld, %ld) (%ld, %ld)\r\n", pco->rclBounds.left, pco->rclBounds.top, pco->rclBounds.right, pco->rclBounds.bottom); - - PWSTR psziDComplexity = L"Unknown iDComplexity."; - switch (pco->iDComplexity ) - { - case DC_COMPLEX: psziDComplexity = L"DC_COMPLEX"; break; - case DC_RECT: psziDComplexity = L"DC_RECT"; break; - case DC_TRIVIAL: psziDComplexity = L"DC_TRIVIAL"; break; - } - OEMDebugMessage(L"\tiDComplexity: %s\r\n", psziDComplexity); - - PWSTR psziFComplexity = L"0"; - switch (pco->iFComplexity) - { - case FC_COMPLEX: psziFComplexity = L"FC_COMPLEX"; break; - case FC_RECT: psziFComplexity = L"FC_RECT"; break; - case FC_RECT4: psziFComplexity = L"FC_RECT4"; break; - } - OEMDebugMessage(L"\tiFComplexity: %s\r\n", psziFComplexity); - - PWSTR psziMode = L"0"; - switch (pco->iMode) - { - case TC_PATHOBJ: psziMode = L"TC_PATHOBJ"; break; - case TC_RECTANGLES: psziMode = L"TC_RECTANGLES"; break; - } - OEMDebugMessage(L"\tiMode: %s\r\n", psziMode); - - PWSTR pszfjOptions = L"0"; - switch (pco->fjOptions) - { - case OC_BANK_CLIP: pszfjOptions = L"TC_PATHOBJ"; break; - } - OEMDebugMessage(L"\tfjOptions: %s\r\n", pszfjOptions); - - OEMDebugMessage(L"\n"); -} - -#if DBG - DBG_FLAGS gafdBRUSHOBJ_flColorType[] = { - { L"BR_CMYKCOLOR", BR_CMYKCOLOR}, - { L"BR_DEVICE_ICM", BR_DEVICE_ICM}, - { L"BR_HOST_ICM", BR_HOST_ICM}, - {NULL, 0} // The NULL entry is important - }; -#else - DBG_FLAGS gafdBRUSHOBJ_flColorType[] = { - {NULL, 0} - }; -#endif - -void -vDumpBRUSHOBJ( - INT iDebugLevel, - _In_ PWSTR pszInLabel, - BRUSHOBJ *pbo - ) - -/*++ - -Routine Description: - - Dumps the members of a BRUSHOBJ structure. - -Arguments: - - iDebugLevel - desired output debug level - pszInLabel - output label string - pbo - pointer to the BRUSHOBJ strct to be dumped - -Return Value: - - NONE - ---*/ - -{ - // Check if the debug level is appropriate - // - if (iDebugLevel < giDebugLevel) - { - // Nothing to output here - // - return; - } - - // Prepare the label string - // - PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pbo"); - - // Return if strct to be dumped is invalid - // - if (!pbo) - { - OEMDebugMessage(L"\nBRUSHOBJ [%s]: NULL\r\n", pszLabel); - - // Nothing else to output - // - return; - } - - // Format the data - // - OEMDebugMessage(L"\nBRUSHOBJ [%s]: %#x\r\n", pszLabel, pbo); - OEMDebugMessage(L"\tiSolidColor: %#x\r\n", pbo->iSolidColor); - OEMDebugMessage(L"\tpvRbrush: %#x\r\n", pbo->pvRbrush); - OEMDebugMessage(L"\tflColorType: "); - vDumpFlags(pbo->flColorType, gafdBRUSHOBJ_flColorType); - - OEMDebugMessage(L"\n"); -} - -#if DBG - DBG_FLAGS gafdGDIINFO_flHTFlags[] = { - { L"HT_FLAG_8BPP_CMY332_MASK", HT_FLAG_8BPP_CMY332_MASK}, - { L"HT_FLAG_ADDITIVE_PRIMS", HT_FLAG_ADDITIVE_PRIMS}, - { L"HT_FLAG_DO_DEVCLR_XFORM", HT_FLAG_DO_DEVCLR_XFORM}, - { L"HT_FLAG_HAS_BLACK_DYE", HT_FLAG_HAS_BLACK_DYE}, - { L"HT_FLAG_HIGH_INK_ABSORPTION", HT_FLAG_HIGH_INK_ABSORPTION}, - { L"HT_FLAG_HIGHER_INK_ABSORPTION", HT_FLAG_HIGHER_INK_ABSORPTION}, - { L"HT_FLAG_HIGHEST_INK_ABSORPTION", HT_FLAG_HIGHEST_INK_ABSORPTION}, - { L"HT_FLAG_INK_ABSORPTION_IDX0", HT_FLAG_INK_ABSORPTION_IDX0}, - { L"HT_FLAG_INK_ABSORPTION_IDX1", HT_FLAG_INK_ABSORPTION_IDX1}, - { L"HT_FLAG_INK_ABSORPTION_IDX2", HT_FLAG_INK_ABSORPTION_IDX2}, - { L"HT_FLAG_INK_ABSORPTION_IDX3", HT_FLAG_INK_ABSORPTION_IDX3}, - { L"HT_FLAG_INK_HIGH_ABSORPTION", HT_FLAG_INK_HIGH_ABSORPTION}, - { L"HT_FLAG_LOW_INK_ABSORPTION", HT_FLAG_LOW_INK_ABSORPTION}, - { L"HT_FLAG_LOWER_INK_ABSORPTION", HT_FLAG_LOWER_INK_ABSORPTION}, - { L"HT_FLAG_LOWEST_INK_ABSORPTION", HT_FLAG_LOWEST_INK_ABSORPTION}, - { L"HT_FLAG_OUTPUT_CMY", HT_FLAG_OUTPUT_CMY}, - { L"HT_FLAG_PRINT_DRAFT_MODE", HT_FLAG_PRINT_DRAFT_MODE}, - { L"HT_FLAG_SQUARE_DEVICE_PEL", HT_FLAG_SQUARE_DEVICE_PEL}, - { L"HT_FLAG_USE_8BPP_BITMASK", HT_FLAG_USE_8BPP_BITMASK}, - { L"HT_FLAG_NORMAL_INK_ABSORPTION", HT_FLAG_NORMAL_INK_ABSORPTION}, -// { L"HT_FLAG_INVERT_8BPP_BITMASK_IDX", HT_FLAG_INVERT_8BPP_BITMASK_IDX}, - {NULL, 0} // The NULL entry is important - }; -#else - DBG_FLAGS gafdGDIINFO_flHTFlags[] = { - {NULL, 0} - }; -#endif - -void -vDumpGDIINFO( - INT iDebugLevel, - _In_ PWSTR pszInLabel, - GDIINFO *pGdiInfo - ) - -/*++ - -Routine Description: - - Dumps the members of a GDIINFO structure. - -Arguments: - - iDebugLevel - desired output debug level - pszInLabel - output label string - pGdiInfo - pointer to the GDIINFO strct to be dumped - -Return Value: - - NONE - ---*/ - -{ - // Check if the debug level is appropriate - // - if (iDebugLevel < giDebugLevel) - { - // Nothing to output here - // - return; - } - - // Prepare the label string - // - PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pGdiInfo"); - - // Return if strct to be dumped is invalid - // - if (!pGdiInfo) - { - OEMDebugMessage(L"\nGDIINFO [%s]: NULL\r\n", pszLabel); - - // Nothing else to output - // - return; - } - - // Format the data - // - OEMDebugMessage(L"\nGDIINFO [%s]: %#x\r\n", pszLabel, pGdiInfo); - OEMDebugMessage(L"\tulVersion: %#x\r\n", pGdiInfo->ulVersion); - - PWSTR pszulTechnology = L"???"; - switch (pGdiInfo->ulTechnology) - { - case DT_PLOTTER: pszulTechnology = L"DT_PLOTTER"; break; - case DT_RASDISPLAY: pszulTechnology = L"DT_RASDISPLAY"; break; - case DT_RASPRINTER: pszulTechnology = L"DT_RASPRINTER"; break; - case DT_RASCAMERA: pszulTechnology = L"DT_RASCAMERA"; break; - case DT_CHARSTREAM: pszulTechnology = L"DT_CHARSTREAM"; break; - } - OEMDebugMessage(L"\tulTechnology: %ld [%s]\r\n", pGdiInfo->ulTechnology, pszulTechnology); - - OEMDebugMessage(L"\tulHorzSize: %ld\r\n", pGdiInfo->ulHorzSize); - OEMDebugMessage(L"\tulVertSize: %ld\r\n", pGdiInfo->ulVertSize); - OEMDebugMessage(L"\tulHorzRes: %ld\r\n", pGdiInfo->ulHorzRes); - OEMDebugMessage(L"\tulVertRes: %ld\r\n", pGdiInfo->ulVertRes); - OEMDebugMessage(L"\tcBitsPixel: %ld\r\n", pGdiInfo->cBitsPixel); - OEMDebugMessage(L"\tcPlanes: %ld\r\n", pGdiInfo->cPlanes); - OEMDebugMessage(L"\tulNumColors: %ld\r\n", pGdiInfo->ulNumColors); - OEMDebugMessage(L"\tflRaster: %#x\r\n", pGdiInfo->flRaster); - OEMDebugMessage(L"\tulLogPixelsX: %ld\r\n", pGdiInfo->ulLogPixelsX); - OEMDebugMessage(L"\tulLogPixelsY: %ld\r\n", pGdiInfo->ulLogPixelsY); - - PWSTR pszTextCaps = L"Text scrolling through DrvBitBlt/DrvCopyBits"; - if (TC_SCROLLBLT == (pGdiInfo->flTextCaps & TC_SCROLLBLT)) - { - pszTextCaps = L"Text scrolling through DrvTextOut"; - } - OEMDebugMessage(L"\tflTextCaps: %s\n", pszTextCaps); - - OEMDebugMessage(L"\tulDACRed: %#x\r\n", pGdiInfo->ulDACRed); - OEMDebugMessage(L"\tulDACGreen: %#x\r\n", pGdiInfo->ulDACGreen); - OEMDebugMessage(L"\tulDACBlue: %#x\r\n", pGdiInfo->ulDACBlue); - OEMDebugMessage(L"\tulAspectX: %ld\r\n", pGdiInfo->ulAspectX); - OEMDebugMessage(L"\tulAspectY: %ld\r\n", pGdiInfo->ulAspectY); - OEMDebugMessage(L"\tulAspectXY: %ld\r\n", pGdiInfo->ulAspectXY); - OEMDebugMessage(L"\txStyleStep: %ld\r\n", pGdiInfo->xStyleStep); - OEMDebugMessage(L"\tyStyleStep: %ld\r\n", pGdiInfo->yStyleStep); - OEMDebugMessage(L"\tdenStyleStep: %ld\r\n", pGdiInfo->denStyleStep); - OEMDebugMessage(L"\tptlPhysOffset: (%ld, %ld)\r\n", pGdiInfo->ptlPhysOffset.x, pGdiInfo->ptlPhysOffset.y); - OEMDebugMessage(L"\tszlPhysSize: (%ld, %ld)\r\n", pGdiInfo->szlPhysSize.cx, pGdiInfo->szlPhysSize.cy); - OEMDebugMessage(L"\tulNumPalReg: %ld\r\n", pGdiInfo->ulNumPalReg); - OEMDebugMessage(L"\tulDevicePelsDPI: %ld\r\n", pGdiInfo->ulDevicePelsDPI); - - PWSTR pszPrimaryOrder = L"???"; - switch(pGdiInfo->ulPrimaryOrder) - { - case PRIMARY_ORDER_ABC: pszPrimaryOrder = L"PRIMARY_ORDER_ABC [RGB/CMY]"; break; - case PRIMARY_ORDER_ACB: pszPrimaryOrder = L"PRIMARY_ORDER_ACB [RBG/CYM]"; break; - case PRIMARY_ORDER_BAC: pszPrimaryOrder = L"PRIMARY_ORDER_BAC [GRB/MCY]"; break; - case PRIMARY_ORDER_BCA: pszPrimaryOrder = L"PRIMARY_ORDER_BCA [GBR/MYC]"; break; - case PRIMARY_ORDER_CBA: pszPrimaryOrder = L"PRIMARY_ORDER_CBA [BGR/YMC]"; break; - case PRIMARY_ORDER_CAB: pszPrimaryOrder = L"PRIMARY_ORDER_CAB [BRG/YCM]"; break; - } - OEMDebugMessage(L"\tulPrimaryOrder: %s\n", pszPrimaryOrder); - - PWSTR pszHTPat = L"???"; - switch(pGdiInfo->ulHTPatternSize) - { - case HT_PATSIZE_2x2 : pszHTPat = L"HT_PATSIZE_2x2 "; break; - case HT_PATSIZE_2x2_M : pszHTPat = L"HT_PATSIZE_2x2_M"; break; - case HT_PATSIZE_4x4 : pszHTPat = L"HT_PATSIZE_4x4"; break; - case HT_PATSIZE_4x4_M : pszHTPat = L"HT_PATSIZE_4x4_M"; break; - case HT_PATSIZE_6x6 : pszHTPat = L"HT_PATSIZE_6x6"; break; - case HT_PATSIZE_6x6_M : pszHTPat = L"HT_PATSIZE_6x6_M"; break; - case HT_PATSIZE_8x8 : pszHTPat = L"HT_PATSIZE_8x8"; break; - case HT_PATSIZE_8x8_M : pszHTPat = L"HT_PATSIZE_8x8_M"; break; - case HT_PATSIZE_10x10 : pszHTPat = L"HT_PATSIZE_10x10"; break; - case HT_PATSIZE_10x10_M : pszHTPat = L"HT_PATSIZE_10x10_M"; break; - case HT_PATSIZE_12x12 : pszHTPat = L"HT_PATSIZE_12x12"; break; - case HT_PATSIZE_12x12_M : pszHTPat = L"HT_PATSIZE_12x12_M"; break; - case HT_PATSIZE_14x14 : pszHTPat = L"HT_PATSIZE_14x14"; break; - case HT_PATSIZE_14x14_M : pszHTPat = L"HT_PATSIZE_14x14_M"; break; - case HT_PATSIZE_16x16 : pszHTPat = L"HT_PATSIZE_16x16"; break; - case HT_PATSIZE_16x16_M : pszHTPat = L"HT_PATSIZE_16x16_M"; break; - case HT_PATSIZE_SUPERCELL : pszHTPat = L"HT_PATSIZE_SUPERCELL"; break; - case HT_PATSIZE_SUPERCELL_M : pszHTPat = L"HT_PATSIZE_SUPERCELL_M"; break; - case HT_PATSIZE_USER : pszHTPat = L"HT_PATSIZE_USER"; break; -// case HT_PATSIZE_MAX_INDEX : pszHTPat = L"HT_PATSIZE_MAX_INDEX"; break; -// case HT_PATSIZE_DEFAULT : pszHTPat = L"HT_PATSIZE_DEFAULT"; break; - } - OEMDebugMessage(L"\tulHTPatternSize: %s\n", pszHTPat); - - PWSTR pszHTOutputFormat = L"???"; - switch(pGdiInfo->ulHTOutputFormat) - { - case HT_FORMAT_1BPP : pszHTOutputFormat = L"HT_FORMAT_1BPP"; break; - case HT_FORMAT_4BPP : pszHTOutputFormat = L"HT_FORMAT_4BPP"; break; - case HT_FORMAT_4BPP_IRGB : pszHTOutputFormat = L"HT_FORMAT_4BPP_IRGB"; break; - case HT_FORMAT_8BPP : pszHTOutputFormat = L"HT_FORMAT_8BPP"; break; - case HT_FORMAT_16BPP : pszHTOutputFormat = L"HT_FORMAT_16BPP"; break; - case HT_FORMAT_24BPP : pszHTOutputFormat = L"HT_FORMAT_24BPP"; break; - case HT_FORMAT_32BPP : pszHTOutputFormat = L"HT_FORMAT_32BPP"; break; - } - OEMDebugMessage(L"\tulHTOutputFormat: %s\n", pszHTOutputFormat); - - OEMDebugMessage(L"\tflHTFlags: "); - vDumpFlags(pGdiInfo->flHTFlags, gafdGDIINFO_flHTFlags); - OEMDebugMessage(L"\tulVRefresh: %ld\r\n", pGdiInfo->ulVRefresh); - OEMDebugMessage(L"\tulBltAlignment: %ld\r\n", pGdiInfo->ulBltAlignment); - OEMDebugMessage(L"\tulPanningHorzRes: %ld\r\n", pGdiInfo->ulPanningHorzRes); - OEMDebugMessage(L"\tulPanningVertRes: %ld\r\n", pGdiInfo->ulPanningVertRes); - OEMDebugMessage(L"\txPanningAlignment: %ld\r\n", pGdiInfo->xPanningAlignment); - OEMDebugMessage(L"\tyPanningAlignment: %ld\r\n", pGdiInfo->yPanningAlignment); - OEMDebugMessage(L"\tcxHTPat: %ld\r\n", pGdiInfo->cxHTPat); - OEMDebugMessage(L"\tcyHTPat: %ld\r\n", pGdiInfo->cyHTPat); - OEMDebugMessage(L"\tpHTPatA: %#x\r\n", pGdiInfo->pHTPatA); - OEMDebugMessage(L"\tpHTPatB: %#x\r\n", pGdiInfo->pHTPatB); - OEMDebugMessage(L"\tpHTPatC: %#x\r\n", pGdiInfo->pHTPatC); - OEMDebugMessage(L"\tflShadeBlend: %#x\r\n", pGdiInfo->flShadeBlend); - - PWSTR pszPhysPixChars = L"???"; - switch(pGdiInfo->ulPhysicalPixelCharacteristics) - { - case PPC_DEFAULT: pszPhysPixChars = L"PPC_DEFAULT"; break; - case PPC_BGR_ORDER_HORIZONTAL_STRIPES: pszPhysPixChars = L"PPC_BGR_ORDER_HORIZONTAL_STRIPES"; break; - case PPC_BGR_ORDER_VERTICAL_STRIPES: pszPhysPixChars = L"PPC_BGR_ORDER_VERTICAL_STRIPES"; break; - case PPC_RGB_ORDER_HORIZONTAL_STRIPES: pszPhysPixChars = L"PPC_RGB_ORDER_HORIZONTAL_STRIPES"; break; - case PPC_RGB_ORDER_VERTICAL_STRIPES: pszPhysPixChars = L"PPC_RGB_ORDER_VERTICAL_STRIPES"; break; - case PPC_UNDEFINED: pszPhysPixChars = L"PPC_UNDEFINED"; break; - } - OEMDebugMessage(L"\tulPhysicalPixelCharacteristics: %s\n", pszPhysPixChars); - - PWSTR pszPhysPixGamma = L"???"; - switch(pGdiInfo->ulPhysicalPixelGamma) - { - case PPG_DEFAULT: pszPhysPixGamma = L"PPG_DEFAULT"; break; - case PPG_SRGB : pszPhysPixGamma = L"PPG_SRGB"; break; - } - OEMDebugMessage(L"\tulPhysicalPixelGamma: %s\n", pszPhysPixGamma); - - OEMDebugMessage(L"\n"); -} - -#if DBG - DBG_FLAGS gafdDEVINFO_flGraphicsCaps[] = { - { L"GCAPS_BEZIERS", GCAPS_BEZIERS}, - { L"GCAPS_GEOMETRICWIDE", GCAPS_GEOMETRICWIDE}, - { L"GCAPS_ALTERNATEFILL", GCAPS_ALTERNATEFILL}, - { L"GCAPS_WINDINGFILL", GCAPS_WINDINGFILL}, - { L"GCAPS_HALFTONE", GCAPS_HALFTONE}, - { L"GCAPS_COLOR_DITHER", GCAPS_COLOR_DITHER}, - { L"GCAPS_HORIZSTRIKE", GCAPS_HORIZSTRIKE}, - { L"GCAPS_VERTSTRIKE", GCAPS_VERTSTRIKE}, - { L"GCAPS_OPAQUERECT", GCAPS_OPAQUERECT}, - { L"GCAPS_VECTORFONT", GCAPS_VECTORFONT}, - { L"GCAPS_MONO_DITHER", GCAPS_MONO_DITHER}, - { L"GCAPS_ASYNCCHANGE", GCAPS_ASYNCCHANGE}, - { L"GCAPS_ASYNCMOVE", GCAPS_ASYNCMOVE}, - { L"GCAPS_DONTJOURNAL", GCAPS_DONTJOURNAL}, - { L"GCAPS_DIRECTDRAW", GCAPS_DIRECTDRAW}, - { L"GCAPS_ARBRUSHOPAQUE", GCAPS_ARBRUSHOPAQUE}, - { L"GCAPS_PANNING", GCAPS_PANNING}, - { L"GCAPS_PALMANAGED", GCAPS_PALMANAGED}, - { L"GCAPS_DITHERONREALIZE", GCAPS_DITHERONREALIZE}, - { L"GCAPS_NO64BITMEMACCESS", GCAPS_NO64BITMEMACCESS}, - { L"GCAPS_FORCEDITHER", GCAPS_FORCEDITHER}, - { L"GCAPS_GRAY16", GCAPS_GRAY16}, - { L"GCAPS_ICM", GCAPS_ICM}, - { L"GCAPS_CMYKCOLOR", GCAPS_CMYKCOLOR}, - { L"GCAPS_LAYERED", GCAPS_LAYERED}, - { L"GCAPS_ARBRUSHTEXT", GCAPS_ARBRUSHTEXT}, - { L"GCAPS_SCREENPRECISION", GCAPS_SCREENPRECISION}, - { L"GCAPS_FONT_RASTERIZER", GCAPS_FONT_RASTERIZER}, - { L"GCAPS_NUP", GCAPS_NUP}, - {NULL, 0} // The NULL entry is important - }; - - DBG_FLAGS gafdDEVINFO_flGraphicsCaps2[] = { - { L"GCAPS2_JPEGSRC", GCAPS2_JPEGSRC}, - { L"GCAPS2_xxxx", GCAPS2_xxxx}, - { L"GCAPS2_PNGSRC", GCAPS2_PNGSRC}, - { L"GCAPS2_CHANGEGAMMARAMP", GCAPS2_CHANGEGAMMARAMP}, - { L"GCAPS2_ALPHACURSOR", GCAPS2_ALPHACURSOR}, - { L"GCAPS2_SYNCFLUSH", GCAPS2_SYNCFLUSH}, - { L"GCAPS2_SYNCTIMER", GCAPS2_SYNCTIMER}, - { L"GCAPS2_ICD_MULTIMON", GCAPS2_ICD_MULTIMON}, - { L"GCAPS2_MOUSETRAILS", GCAPS2_MOUSETRAILS}, - { L"GCAPS2_REMOTEDRIVER", GCAPS2_REMOTEDRIVER}, - {NULL, 0} // The NULL entry is important - }; -#else - DBG_FLAGS gafdDEVINFO_flGraphicsCaps[] = { - {NULL, 0} - }; - - DBG_FLAGS gafdDEVINFO_flGraphicsCaps2[] = { - {NULL, 0} - }; -#endif - -void -vDumpDEVINFO( - INT iDebugLevel, - _In_ PWSTR pszInLabel, - DEVINFO *pDevInfo - ) - -/*++ - -Routine Description: - - Dumps the members of a DEVINFO structure. - -Arguments: - - iDebugLevel - desired output debug level - pszInLabel - output label string - pDevInfo - pointer to the DEVINFO strct to be dumped - -Return Value: - - NONE - ---*/ - -{ - // Check if the debug level is appropriate - // - if (iDebugLevel < giDebugLevel) - { - // Nothing to output here - // - return; - } - - // Prepare the label string - // - PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pDevInfo"); - - // Return if strct to be dumped is invalid - // - if (!pDevInfo) - { - OEMDebugMessage(L"\nDEVINFO [%s]: NULL\r\n", pszLabel); - - // Nothing else to output - // - return; - } - - // Format the data - // - OEMDebugMessage(L"\nDEVINFO [%s]: %#x\r\n", pszLabel, pDevInfo); - OEMDebugMessage(L"\tflGraphicsCaps: "); - vDumpFlags(pDevInfo->flGraphicsCaps, gafdDEVINFO_flGraphicsCaps); - OEMDebugMessage(L"\tcFonts: %ld\r\n", pDevInfo->cFonts); - - PWSTR psziDitherFormat = L"0"; - switch (pDevInfo->iDitherFormat) - { - case BMF_1BPP : psziDitherFormat = L"BMF_1BPP" ; break; - case BMF_4BPP : psziDitherFormat = L"BMF_4BPP" ; break; - case BMF_8BPP : psziDitherFormat = L"BMF_8BPP" ; break; - case BMF_16BPP: psziDitherFormat = L"BMF_16BPP"; break; - case BMF_24BPP: psziDitherFormat = L"BMF_24BPP"; break; - case BMF_32BPP: psziDitherFormat = L"BMF_32BPP"; break; - case BMF_4RLE : psziDitherFormat = L"BMF_4RLE" ; break; - case BMF_8RLE : psziDitherFormat = L"BMF_8RLE" ; break; - case BMF_JPEG : psziDitherFormat = L"BMF_JPEG" ; break; - case BMF_PNG : psziDitherFormat = L"BMF_PNG " ; break; - } - OEMDebugMessage(L"\tiDitherFormat: %s\r\n", psziDitherFormat); - - OEMDebugMessage(L"\tcxDither: %ld\r\n", pDevInfo->cxDither); - OEMDebugMessage(L"\tcyDither: %ld\r\n", pDevInfo->cyDither); - OEMDebugMessage(L"\thpalDefault: %#x\r\n", pDevInfo->hpalDefault); - OEMDebugMessage(L"\tflGraphicsCaps2: "); - vDumpFlags(pDevInfo->flGraphicsCaps2, gafdDEVINFO_flGraphicsCaps2); - - OEMDebugMessage(L"\n"); -} - -void -vDumpBitmapInfoHeader( - INT iDebugLevel, - _In_ PWSTR pszInLabel, - BITMAPINFOHEADER *pBitmapInfoHeader - ) - -/*++ - -Routine Description: - - Dumps the members of a BITMAPINFOHEADER structure. - -Arguments: - - iDebugLevel - desired output debug level - pszInLabel - output label string - pBitmapInfoHeader - pointer to the BITMAPINFOHEADER strct to be dumped - -Return Value: - - NONE - ---*/ - -{ - // Check if the debug level is appropriate - // - if (iDebugLevel < giDebugLevel) - { - // Nothing to output here - // - return; - } - - // Prepare the label string - // - PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pBitmapInfoHeader"); - - // Return if strct to be dumped is invalid - // - if (!pBitmapInfoHeader) - { - OEMDebugMessage(L"\nBITMAPINFOHEADER [%s]: NULL\r\n", pszLabel); - - // Nothing else to output - // - return; - } - - // Format the data - // - OEMDebugMessage(L"\nBITMAPINFOHEADER [%s]: %#x\r\n", pszLabel, pBitmapInfoHeader); - OEMDebugMessage(L"\tbiSize: %ld\r\n", pBitmapInfoHeader->biSize); - OEMDebugMessage(L"\tbiWidth: %ld\r\n", pBitmapInfoHeader->biWidth); - OEMDebugMessage(L"\tbiHeight: %ld\r\n", pBitmapInfoHeader->biHeight); - OEMDebugMessage(L"\tbiPlanes: %ld\r\n", pBitmapInfoHeader->biPlanes); - OEMDebugMessage(L"\tbiBitCount: %ld\r\n", pBitmapInfoHeader->biBitCount); - - PWSTR pszbiCompression = L"0"; - switch (pBitmapInfoHeader->biCompression) - { - case BI_RGB : pszbiCompression = L"BI_RGB" ; break; - case BI_RLE8 : pszbiCompression = L"BI_RLE8" ; break; - case BI_RLE4 : pszbiCompression = L"BI_RLE4" ; break; - case BI_BITFIELDS: pszbiCompression = L"BI_BITFIELDS"; break; - case BI_JPEG : pszbiCompression = L"BI_JPEG" ; break; - case BI_PNG : pszbiCompression = L"BI_PNG " ; break; - } - OEMDebugMessage(L"\tbiCompression: %s\r\n", pszbiCompression); - - OEMDebugMessage(L"\tbiSizeImage: %ld\r\n", pBitmapInfoHeader->biSizeImage); - OEMDebugMessage(L"\tbiXPelsPerMeter: %ld\r\n", pBitmapInfoHeader->biXPelsPerMeter); - OEMDebugMessage(L"\tbiYPelsPerMeter: %ld\r\n", pBitmapInfoHeader->biYPelsPerMeter); - OEMDebugMessage(L"\tbiClrUsed: %ld\r\n", pBitmapInfoHeader->biClrUsed); - OEMDebugMessage(L"\tbiClrImportant: %ld\r\n", pBitmapInfoHeader->biClrImportant); - - OEMDebugMessage(L"\n"); -} - -void -vDumpPOINTL( - INT iDebugLevel, - _In_ PWSTR pszInLabel, - POINTL *pptl - ) - -/*++ - -Routine Description: - - Dumps the members of a POINTL structure. - -Arguments: - - iDebugLevel - desired output debug level - pszInLabel - output label string - pptl - pointer to the POINTL strct to be dumped - -Return Value: - - NONE - ---*/ - -{ - // Check if the debug level is appropriate - // - if (iDebugLevel < giDebugLevel) - { - // Nothing to output here - // - return; - } - - // Prepare the label string - // - PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pptl"); - - // Return if strct to be dumped is invalid - // - if (!pptl) - { - OEMDebugMessage(L"\nPOINTL [%s]: NULL\r\n", pszLabel); - - // Nothing else to output - // - return; - } - - // Format the data - // - OEMDebugMessage(L"\nPOINTL [%s]: %#x (%ld, %ld)\r\n", pszLabel, pptl, pptl->x, pptl->y); - - OEMDebugMessage(L"\n"); -} - -void -vDumpRECTL( - INT iDebugLevel, - _In_ PWSTR pszInLabel, - RECTL *prcl - ) - -/*++ - -Routine Description: - - Dumps the members of a RECTL structure. - -Arguments: - - iDebugLevel - desired output debug level - pszInLabel - output label string - prcl - pointer to the RECTL strct to be dumped - -Return Value: - - NONE - ---*/ - -{ - // Check if the debug level is appropriate - // - if (iDebugLevel < giDebugLevel) - { - // Nothing to output here - // - return; - } - - // Prepare the label string - // - PCWSTR pszLabel = EnsureLabel(pszInLabel, L"prcl"); - - // Return if strct to be dumped is invalid - // - if (!prcl) - { - OEMDebugMessage(L"\nRECTL [%s]: NULL\r\n", pszLabel); - - // Nothing else to output - // - return; - } - - // Format the data - // - OEMDebugMessage(L"\nRECTL [%s]: %#x (%ld, %ld) (%ld, %ld)\r\n", pszLabel, prcl, prcl->left, prcl->top, prcl->right, prcl->bottom); - - OEMDebugMessage(L"\n"); -} - -#if DBG - DBG_FLAGS gafdXLATEOBJ_flXlate[] = { - { L"XO_DEVICE_ICM", XO_DEVICE_ICM}, - { L"XO_FROM_CMYK", XO_FROM_CMYK}, - { L"XO_HOST_ICM", XO_HOST_ICM}, - { L"XO_TABLE", XO_TABLE}, - { L"XO_TO_MONO", XO_TO_MONO}, - { L"XO_TRIVIAL", XO_TRIVIAL}, - {NULL, 0} // The NULL entry is important - }; -#else - DBG_FLAGS gafdXLATEOBJ_flXlate[] = { - {NULL, 0} - }; -#endif - -void -vDumpXLATEOBJ( - INT iDebugLevel, - _In_ PWSTR pszInLabel, - XLATEOBJ *pxlo - ) - -/*++ - -Routine Description: - - Dumps the members of a XLATEOBJ structure. - -Arguments: - - iDebugLevel - desired output debug level - pszInLabel - output label string - pxlo - pointer to the XLATEOBJ strct to be dumped - -Return Value: - - NONE - ---*/ - -{ - // Check if the debug level is appropriate - // - if (iDebugLevel < giDebugLevel) - { - // Nothing to output here - // - return; - } - - // Prepare the label string - // - PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pxlo"); - - // Return if strct to be dumped is invalid - // - if (!pxlo) - { - OEMDebugMessage(L"\nXLATEOBJ [%s]: NULL\r\n", pszLabel); - - // Nothing else to output - // - return; - } - - // Format the data - // - OEMDebugMessage(L"\nXLATEOBJ [%s]: %#x\r\n", pszLabel, pxlo); - OEMDebugMessage(L"\tiUniq: %ld\r\n", pxlo->iUniq); - OEMDebugMessage(L"\tflXlate: "); - vDumpFlags(pxlo->flXlate, gafdXLATEOBJ_flXlate); - OEMDebugMessage(L"\tiSrcType: %ld [obsolete]\r\n", pxlo->iSrcType); - OEMDebugMessage(L"\tiDstType: %ld [obsolete]\r\n", pxlo->iDstType); - OEMDebugMessage(L"\tcEntries: %ld\r\n", pxlo->cEntries); - if (pxlo->pulXlate) - OEMDebugMessage(L"\tpulXlate: %#x [%ld]\r\n", pxlo->pulXlate, *pxlo->pulXlate); - else - OEMDebugMessage(L"\tpulXlate: %#x\r\n", pxlo->pulXlate); - - OEMDebugMessage(L"\n"); -} - -#if DBG - DBG_FLAGS gafdCOLORADJUSTMENT_caFlags[] = { - { L"CA_NEGATIVE", CA_NEGATIVE}, - { L"CA_LOG_FILTER", CA_LOG_FILTER}, - {NULL, 0} // The NULL entry is important - }; -#else - DBG_FLAGS gafdCOLORADJUSTMENT_caFlags[] = { - {NULL, 0} - }; -#endif - -void -vDumpCOLORADJUSTMENT( - INT iDebugLevel, - _In_ PWSTR pszInLabel, - COLORADJUSTMENT *pca - ) - -/*++ - -Routine Description: - - Dumps the members of a COLORADJUSTMENT structure. - -Arguments: - - iDebugLevel - desired output debug level - pszInLabel - output label string - pca - pointer to the COLORADJUSTMENT strct to be dumped - -Return Value: - - NONE - ---*/ - -{ - // Check if the debug level is appropriate - // - if (iDebugLevel < giDebugLevel) - { - // Nothing to output here - // - return; - } - - // Prepare the label string - // - PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pca"); - - // Return if strct to be dumped is invalid - // - if (!pca) - { - OEMDebugMessage(L"\nCOLORADJUSTMENT [%s]: NULL\r\n", pszLabel); - - // Nothing else to output - // - return; - } - - // Format the data - // - OEMDebugMessage(L"\nCOLORADJUSTMENT [%s]: %#x\r\n", pszLabel, pca); - OEMDebugMessage(L"\tcaSize: %#x\r\n", pca->caSize); - OEMDebugMessage(L"\tcaFlags: "); - if (pca->caFlags) - vDumpFlags(pca->caFlags, gafdCOLORADJUSTMENT_caFlags); - else - OEMDebugMessage(L"NULL\r\n"); - - PWSTR pszcaIlluminantIndex = L"0"; - switch (pca->caIlluminantIndex) - { - case ILLUMINANT_DEVICE_DEFAULT: pszcaIlluminantIndex = L"ILLUMINANT_DEVICE_DEFAULT" ; break; - case ILLUMINANT_A: pszcaIlluminantIndex = L"ILLUMINANT_A [Tungsten lamp]" ; break; - case ILLUMINANT_B: pszcaIlluminantIndex = L"ILLUMINANT_B [Noon sunlight]" ; break; - case ILLUMINANT_C: pszcaIlluminantIndex = L"ILLUMINANT_C [NTSC daylight]" ; break; - case ILLUMINANT_D50: pszcaIlluminantIndex = L"ILLUMINANT_D50 [Normal print]" ; break; - case ILLUMINANT_D55: pszcaIlluminantIndex = L"ILLUMINANT_D55 [Bond paper print]" ; break; - case ILLUMINANT_D65: pszcaIlluminantIndex = L"ILLUMINANT_D65 [Standard daylight]" ; break; - case ILLUMINANT_D75: pszcaIlluminantIndex = L"ILLUMINANT_D75 [Northern daylight]" ; break; - case ILLUMINANT_F2: pszcaIlluminantIndex = L"ILLUMINANT_F2 [Cool white lamp]" ; break; - } - OEMDebugMessage(L"\tcaIlluminantIndex: %s\r\n", pszcaIlluminantIndex); - - OEMDebugMessage(L"\tcaRedGamma: %d\r\n", (int)pca->caRedGamma); - OEMDebugMessage(L"\tcaGreenGamma: %d\r\n", (int)pca->caGreenGamma); - OEMDebugMessage(L"\tcaBlueGamma: %d\r\n", (int)pca->caBlueGamma); - OEMDebugMessage(L"\tcaReferenceBlack: %d\r\n", (int)pca->caReferenceBlack); - OEMDebugMessage(L"\tcaReferenceWhite: %d\r\n", (int)pca->caReferenceWhite); - OEMDebugMessage(L"\tcaContrast: %d\r\n", (int)pca->caContrast); - OEMDebugMessage(L"\tcaBrightness: %d\r\n", (int)pca->caBrightness); - OEMDebugMessage(L"\tcaColorfulness: %d\r\n", (int)pca->caColorfulness); - OEMDebugMessage(L"\tcaRedGreenTint: %d\r\n", (int)pca->caRedGreenTint); - - OEMDebugMessage(L"\n"); -} - -#endif - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/debug.h b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/debug.h deleted file mode 100644 index 2b488890..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/debug.h +++ /dev/null @@ -1,215 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.H -// -// -// PURPOSE: Define common data types, and external function prototypes -// for debugging functions. Also defines the various debug macros. -// -// -// History: -// 06/28/03 xxx created. -// -// - -#pragma once - -#include "devmode.h" - -// VC and Build use different debug defines. -// The following makes it so either will -// cause the inclusion of debugging code. -#if !defined(_DEBUG) && defined(DBG) - #define _DEBUG DBG -#elif defined(_DEBUG) && !defined(DBG) - #define DBG _DEBUG -#endif - - - -///////////////////////////////////////////////////////// -// Macros -///////////////////////////////////////////////////////// -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// VERBOSE(msg) -// Display a message if the current debug level is <= DBG_VERBOSE. -// -// TERSE(msg) -// Display a message if the current debug level is <= DBG_TERSE. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// ASSERTMSG(cond, msg) -// Verify a condition is true. If not, display a message and -// force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// These macros require extra parantheses for the msg argument -// example, ASSERTMSG(x > 0, ("x is less than 0\n")); -// WARNING(("App passed NULL pointer, ignoring...\n")); -// - -#define DBG_VERBOSE 1 -#define DBG_TERSE 2 -#define DBG_WARNING 3 -#define DBG_ERROR 4 -#define DBG_RIP 5 -#define DBG_NONE 6 - -// -// Determine what level of debugging messages to emit. -// This can be set in the sources file, or omitted -// completely -// -#ifdef VERBOSE_MSG - #define DEBUG_LEVEL DBG_VERBOSE -#elif TERSE_MSG - #define DEBUG_LEVEL DBG_TERSE -#elif WARNING_MSG - #define DEBUG_LEVEL DBG_WARNING -#elif ERROR_MSG - #define DEBUG_LEVEL DBG_ERROR -#elif RIP_MSG - #define DEBUG_LEVEL DBG_RIP -#elif NO_DBG_MSG - #define DEBUG_LEVEL DBG_NONE -#else - #define DEBUG_LEVEL DBG_WARNING -#endif - - -#if DBG - - extern INT giDebugLevel; - - #define DBGMSG(level, prefix, msg) { \ - if (giDebugLevel <= (level)) { \ - OEMDebugMessage(L"%s %s (%d): ", prefix, StripDirPrefixA(__FILE__), __LINE__); \ - OEMDebugMessage(msg); \ - } \ - } - - #define VERBOSE if(giDebugLevel <= DBG_VERBOSE) OEMDebugMessage - #define TERSE if(giDebugLevel <= DBG_TERSE) OEMDebugMessage - #define WARNING if(giDebugLevel <= DBG_WARNING) OEMDebugMessage - #define ERR if(giDebugLevel <= DBG_ERROR) OEMDebugMessage - - #define DBG_OEMDMPARAM(iDbgLvl, szLabel, pobj) {vDumpOemDMParam(iDbgLvl, szLabel, pobj);} - #define DBG_SURFOBJ(iDbgLvl, szLabel, pobj) {vDumpSURFOBJ(iDbgLvl, szLabel, pobj);} - #define DBG_STROBJ(iDbgLvl, szLabel, pobj) {vDumpSTROBJ(iDbgLvl, szLabel, pobj);} - #define DBG_FONTOBJ(iDbgLvl, szLabel, pobj) {vDumpFONTOBJ(iDbgLvl, szLabel, pobj);} - #define DBG_CLIPOBJ(iDbgLvl, szLabel, pobj) {vDumpCLIPOBJ(iDbgLvl, szLabel, pobj);} - #define DBG_BRUSHOBJ(iDbgLvl, szLabel, pobj) {vDumpBRUSHOBJ(iDbgLvl, szLabel, pobj);} - #define DBG_GDIINFO(iDbgLvl, szLabel, pobj) {vDumpGDIINFO(iDbgLvl, szLabel, pobj);} - #define DBG_DEVINFO(iDbgLvl, szLabel, pobj) {vDumpDEVINFO(iDbgLvl, szLabel, pobj);} - #define DBG_BMPINFO(iDbgLvl, szLabel, pobj) {vDumpBitmapInfoHeader(iDbgLvl, szLabel, pobj);} - #define DBG_POINTL(iDbgLvl, szLabel, pobj) {vDumpPOINTL(iDbgLvl, szLabel, pobj);} - #define DBG_RECTL(iDbgLvl, szLabel, pobj) {vDumpRECTL(iDbgLvl, szLabel, pobj);} - #define DBG_XLATEOBJ(iDbgLvl, szLabel, pobj) {vDumpXLATEOBJ(iDbgLvl, szLabel, pobj);} - #define DBG_COLORADJUSTMENT(iDbgLvl, szLabel, pobj) {vDumpCOLORADJUSTMENT(iDbgLvl, szLabel, pobj);} - - #define ASSERT(cond) \ - { \ - if (! (cond)) \ - { \ - RIP((L"\n")); \ - } \ - } - - #define ASSERTMSG(cond, msg) \ - { \ - if (! (cond)) { \ - RIP(msg); \ - } \ - } - - #define RIP(msg) \ - { \ - DBGMSG(DBG_RIP, L"RIP", msg); \ - DebugBreak(); \ - } - - typedef struct DBG_FLAGS { - LPWSTR pszFlag; - DWORD dwFlag; - } *PDBG_FLAGS; - - BOOL OEMDebugMessage(LPCWSTR, ...); - void vDumpOemDMParam(INT iDebugLevel, _In_ PWSTR pszInLabel, POEMDMPARAM pOemDMParam); - void vDumpSURFOBJ(INT iDebugLevel, _In_ PWSTR pszInLabel, SURFOBJ *pso); - void vDumpSTROBJ(INT iDebugLevel, _In_ PWSTR pszInLabel, STROBJ *pstro); - void vDumpFONTOBJ(INT iDebugLevel, _In_ PWSTR pszInLabel, FONTOBJ *pfo); - void vDumpCLIPOBJ(INT iDebugLevel, _In_ PWSTR pszInLabel, CLIPOBJ *pco); - void vDumpBRUSHOBJ(INT iDebugLevel, _In_ PWSTR pszInLabel, BRUSHOBJ *pbo); - void vDumpGDIINFO(INT iDebugLevel, _In_ PWSTR pszInLabel, GDIINFO *pGdiInfo); - void vDumpDEVINFO(INT iDebugLevel, _In_ PWSTR pszInLabel, DEVINFO *pDevInfo); - void vDumpBitmapInfoHeader(INT iDebugLevel, _In_ PWSTR pszInLabel, PBITMAPINFOHEADER pBitmapInfoHeader); - void vDumpPOINTL(INT iDebugLevel, _In_ PWSTR pszInLabel, POINTL *pptl); - void vDumpRECTL(INT iDebugLevel, _In_ PWSTR pszInLabel, RECTL *prcl); - void vDumpXLATEOBJ(INT iDebugLevel, _In_ PWSTR pszInLabel, XLATEOBJ *pxlo); - void vDumpCOLORADJUSTMENT(INT iDebugLevel, _In_ PWSTR pszInLabel, COLORADJUSTMENT *pca); - - BOOL OEMRealDebugMessage(DWORD dwSize, LPCWSTR lpszMessage, va_list arglist); - PCSTR StripDirPrefixA(IN PCSTR pstrFilename); - void vDumpFlags(DWORD dwFlags, PDBG_FLAGS pDebugFlags); - -#else // !DBG - - #define DebugMsg NOP_FUNCTION - - #define VERBOSE NOP_FUNCTION - #define TERSE NOP_FUNCTION - #define WARNING NOP_FUNCTION - #define ERR NOP_FUNCTION - - #define DBG_OEMDMPARAM(iDbgLvl, szLabel, pobj) NOP_FUNCTION - #define DBG_OEMDEVMODE(iDbgLvl, szLabel, pobj) NOP_FUNCTION - #define DBG_SURFOBJ(iDbgLvl, szLabel, pobj) NOP_FUNCTION - #define DBG_STROBJ(iDbgLvl, szLabel, pobj) NOP_FUNCTION - #define DBG_FONTOBJ(iDbgLvl, szLabel, pobj) NOP_FUNCTION - #define DBG_CLIPOBJ(iDbgLvl, szLabel, pobj) NOP_FUNCTION - #define DBG_BRUSHOBJ(iDbgLvl, szLabel, pobj) NOP_FUNCTION - #define DBG_GDIINFO(iDbgLvl, szLabel, pobj) NOP_FUNCTION - #define DBG_DEVINFO(iDbgLvl, szLabel, pobj) NOP_FUNCTION - #define DBG_BMPINFO(iDbgLvl, szLabel, pobj) NOP_FUNCTION - #define DBG_POINTL(iDbgLvl, szLabel, pobj) NOP_FUNCTION - #define DBG_RECTL(iDbgLvl, szLabel, pobj) NOP_FUNCTION - #define DBG_XLATEOBJ(iDbgLvl, szLabel, pobj) NOP_FUNCTION - #define DBG_COLORADJUSTMENT(iDbgLvl, szLabel, pobj) NOP_FUNCTION - - #define ASSERT(cond) - - #define ASSERTMSG(cond, msg) - #define RIP(msg) - -#endif - - - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/devmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/devmode.cpp deleted file mode 100644 index 92ca5dd9..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/devmode.cpp +++ /dev/null @@ -1,229 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.cpp -// -// -// PURPOSE: Implementation of Devmode functions shared with OEM UI and OEM rendering modules. -// -// History: -// 06/24/03 xxx created. -// -// - -#include "precomp.h" -#include "oemprean.h" -#include "debug.h" -#include "devmode.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -HRESULT hrOEMDevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DevMode. - hrOEMDevMode is called by IPrintOemUni::DevMode - which is defined in intrface.cpp. - - The IPrintOemUni::DevMode method, provided by - rendering plug-ins for Unidrv, performs operations - on private DEVMODE members. - - Please refer to DDK documentation for more details. - -Arguments: - - dwMode - caller-supplied constant. Refer to the docs - for more information. - pOemDMParam - pointer to an OEMDMPARAM structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - ---*/ - -{ - POEMDEV pOEMDevIn; - POEMDEV pOEMDevOut; - - VERBOSE(L"hrOEMDevMode entry."); - - // Verify parameters. - if( (NULL == pOemDMParam) - || - ( (OEMDM_SIZE != dwMode) - && - (OEMDM_DEFAULT != dwMode) - && - (OEMDM_CONVERT != dwMode) - && - (OEMDM_MERGE != dwMode) - )) - { - ERR(ERRORTEXT("DevMode() ERROR_INVALID_PARAMETER.\r\n")); - ERR(DLLTEXT("\tdwMode = %d, pOemDMParam = %#lx.\r\n"), dwMode, pOemDMParam); - - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Cast generic (i.e. PVOID) to OEM private devmode pointer type. - pOEMDevIn = (POEMDEV) pOemDMParam->pOEMDMIn; - pOEMDevOut = (POEMDEV) pOemDMParam->pOEMDMOut; - - switch(dwMode) - { - case OEMDM_SIZE: - pOemDMParam->cbBufSize = sizeof(OEMDEV); - break; - - case OEMDM_DEFAULT: - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->dwDriverData = 0; - break; - - case OEMDM_CONVERT: - bConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - break; - - case OEMDM_MERGE: - bConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - bMakeOEMDevmodeValid(pOEMDevOut); - break; - } - DBG_OEMDMPARAM(DBG_VERBOSE, L"pOemDMParam", pOemDMParam); - - return S_OK; -} - - -BOOL bConvertOEMDevmode( - PCOEMDEV pOEMDevIn, - POEMDEV pOEMDevOut - ) - -/*++ - -Routine Description: - - Converts private DEVMODE members to the - current version. - -Arguments: - - pOEMDevIn - pointer to OEM private devmode - pOEMDevOut - pointer to OEM private devmode - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE(L"bConvertOEMDevmode entry."); - - if( (NULL == pOEMDevIn) - || - (NULL == pOEMDevOut) - ) - { - ERR(ERRORTEXT("ConvertOEMDevmode() invalid parameters.\r\n")); - return FALSE; - } - - // Check OEM Signature, if it doesn't match ours, - // then just assume DMIn is bad and use defaults. - if(pOEMDevIn->dmOEMExtra.dwSignature == pOEMDevOut->dmOEMExtra.dwSignature) - { - VERBOSE(TEXT("Converting private OEM Devmode.\r\n")); - - // Set the devmode defaults so that anything the isn't copied over will - // be set to the default value. - pOEMDevOut->dwDriverData = 0; - - // Copy the old structure in to the new using which ever size is the smaller. - // Devmode maybe from newer Devmode (not likely since there is only one), or - // Devmode maybe a newer Devmode, in which case it maybe larger, - // but the first part of the structure should be the same. - - // DESIGN ASSUMPTION: the private DEVMODE structure only gets added to; - // the fields that are in the DEVMODE never change only new fields get added to the end. - - memcpy(pOEMDevOut, pOEMDevIn, __min(pOEMDevOut->dmOEMExtra.dwSize, pOEMDevIn->dmOEMExtra.dwSize)); - - // Re-fill in the size and version fields to indicated - // that the DEVMODE is the current private DEVMODE version. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - } - else - { - VERBOSE(TEXT("Unknown DEVMODE signature, pOEMDMIn ignored.\r\n")); - - // Don't know what the input DEVMODE is, so just use defaults. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->dwDriverData = 0; - } - - return TRUE; -} - - -BOOL bMakeOEMDevmodeValid( - POEMDEV pOEMDevmode - ) - -/*++ - -Routine Description: - - Ensures that private OEM devmode members are valid. - -Arguments: - - pOEMDevmode - pointer to OEM private devmode - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - if(NULL == pOEMDevmode) - { - return FALSE; - } - - // ASSUMPTION: pOEMDevmode is large enough to contain OEMDEV structure. - - // Make sure that dmOEMExtra indicates the current OEMDEV structure. - pOEMDevmode->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevmode->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevmode->dmOEMExtra.dwVersion = OEM_VERSION; - - // Set driver data. - pOEMDevmode->dwDriverData = 0; - - return TRUE; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/devmode.h b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/devmode.h deleted file mode 100644 index 05f98204..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/devmode.h +++ /dev/null @@ -1,43 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.h -// -// -// PURPOSE: Define common data types, and external function prototypes -// for devmode functions. -// -// History: -// 06/24/03 xxx created. -// -// - -#pragma once - - -//////////////////////////////////////////////////////// -// OEM Devmode Type Definitions -//////////////////////////////////////////////////////// - -typedef struct tagOEMDEV -{ - OEM_DMEXTRAHEADER dmOEMExtra; - BOOL dwDriverData; -} OEMDEV, *POEMDEV; - -typedef const OEMDEV *PCOEMDEV; - - -///////////////////////////////////////////////////////// -// Prototypes -///////////////////////////////////////////////////////// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam); -BOOL bConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut); -BOOL bMakeOEMDevmodeValid(POEMDEV pOEMDevmode); - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/dllentry.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/dllentry.cpp deleted file mode 100644 index 412f9446..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/dllentry.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cpp -// -// -// PURPOSE: Source module for DLL entry function(s). -// -// History: -// 06/24/03 xxx created. -// -// - -#include "precomp.h" -#include "oemprean.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -/////////////////////////////////////////////////////////// -// -// DLL entry point -// - -BOOL WINAPI DllMain(HINSTANCE hInst, WORD wReason, LPVOID lpReserved) -{ - VERBOSE(L"DllMain entry."); - - UNREFERENCED_PARAMETER(hInst); - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - VERBOSE(TEXT("Process attach.\r\n")); - break; - - case DLL_THREAD_ATTACH: - VERBOSE(TEXT("Thread attach.\r\n")); - break; - - case DLL_PROCESS_DETACH: - VERBOSE(TEXT("Process detach.\r\n")); - break; - - case DLL_THREAD_DETACH: - VERBOSE(TEXT("Thread detach.\r\n")); - break; - } - - return TRUE; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/intrface.cpp deleted file mode 100644 index 9c102afc..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/intrface.cpp +++ /dev/null @@ -1,1819 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.cpp -// -// -// PURPOSE: Interface for User Mode COM Customization DLL. -// -// -// Functions: -// IPrintOemUni2 interface functions -// COemCF class factory -// Registration functions: DllCanUnloadNow, DllGetClassObject -// -// History: -// 06/26/03 xxx created. -// -// - -#include "precomp.h" -#include -#include - -#include "oemprean.h" -#include "debug.h" -#include "intrface.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -// ================================================================== -// Internal Globals -// -static long g_cComponents; // Count of active components -static long g_cServerLocks; // Count of locks -// -// ================================================================== - -// ================================================================== -// The purpose of this array is to inform UNIDRV of the callbacks -// that are implemented in this driver. -// -// Note that there is *NO* order dependency in this array. New -// index values and their corresponding callbacks can be placed -// anywhere within the list as needed. -// -static const DRVFN s_aOemHookFuncs[] = -{ - // The following are defined in ddihook.cpp. - // - {INDEX_DrvAlphaBlend, (PFN)OEMAlphaBlend}, - {INDEX_DrvBitBlt, (PFN)OEMBitBlt}, - {INDEX_DrvCopyBits, (PFN)OEMCopyBits}, - {INDEX_DrvDitherColor, (PFN)OEMDitherColor}, - {INDEX_DrvFillPath, (PFN)OEMFillPath}, - {INDEX_DrvFontManagement, (PFN)OEMFontManagement}, - {INDEX_DrvGetGlyphMode, (PFN)OEMGetGlyphMode}, - {INDEX_DrvGradientFill, (PFN)OEMGradientFill}, - {INDEX_DrvLineTo, (PFN)OEMLineTo}, - {INDEX_DrvPaint, (PFN)OEMPaint}, - {INDEX_DrvPlgBlt, (PFN)OEMPlgBlt}, - {INDEX_DrvQueryAdvanceWidths, (PFN)OEMQueryAdvanceWidths}, - {INDEX_DrvQueryFont, (PFN)OEMQueryFont}, - {INDEX_DrvQueryFontData, (PFN)OEMQueryFontData}, - {INDEX_DrvQueryFontTree, (PFN)OEMQueryFontTree}, - {INDEX_DrvRealizeBrush, (PFN)OEMRealizeBrush}, - {INDEX_DrvStretchBlt, (PFN)OEMStretchBlt}, - {INDEX_DrvStretchBltROP, (PFN)OEMStretchBltROP}, - {INDEX_DrvStrokeAndFillPath, (PFN)OEMStrokeAndFillPath}, - {INDEX_DrvStrokePath, (PFN)OEMStrokePath}, - {INDEX_DrvTextOut, (PFN)OEMTextOut}, - {INDEX_DrvTransparentBlt, (PFN)OEMTransparentBlt}, - {INDEX_DrvStartDoc, (PFN)OEMStartDoc}, - {INDEX_DrvEndDoc, (PFN)OEMEndDoc}, - {INDEX_DrvStartPage, (PFN)OEMStartPage}, - {INDEX_DrvSendPage, (PFN)OEMSendPage}, - {INDEX_DrvStartBanding, (PFN)OEMStartBanding}, - {INDEX_DrvNextBand, (PFN)OEMNextBand}, - {INDEX_DrvEscape, (PFN)OEMEscape} -}; - - -//////////////////////////////////////////////////////////////////////////////// -// -// COemUni2 body -// -COemUni2::COemUni2() -{ - m_cRef = 1; - - // Increment COM component count. - InterlockedIncrement(&g_cComponents); - - m_pOEMHelp = NULL; - -} - -COemUni2::~COemUni2() -{ - // Make sure that helper interface is released. - if(NULL != m_pOEMHelp) - { - m_pOEMHelp->Release(); - m_pOEMHelp = NULL; - } - - // If this instance of the object is being deleted, then the reference - // count should be zero. - assert(0 == m_cRef); -} - -HRESULT __stdcall -COemUni2:: -QueryInterface( - const IID& iid, - void** ppv - ) -{ - VERBOSE(L"COemUni2::QueryInterface() entry."); - - if (iid == IID_IUnknown) - { - *ppv = static_cast(this); - VERBOSE(DLLTEXT("COemUni2::QueryInterface IUnknown.\r\n")); - } - else if (iid == IID_IPrintOemUni2) - { - VERBOSE(DLLTEXT("COemUni2::QueryInterface IPrintOemUni2.\r\n")); - - *ppv = static_cast(this); - } - else - { - WARNING(DLLTEXT("COemUni2::QueryInterface NULL. Returning E_NOINTERFACE.\r\n")); - - *ppv = NULL; - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -ULONG __stdcall -COemUni2:: -AddRef( - VOID - ) -{ - VERBOSE(L"COemUni2::AddRef() entry."); - - return InterlockedIncrement(&m_cRef); -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall -COemUni2:: -Release( - VOID - ) -{ - VERBOSE(L"COemUni2::Release() entry."); - ULONG cRef = InterlockedDecrement(&m_cRef); - - if (cRef == 0) - { - delete this; - return 0; - } - return cRef; -} - -HRESULT __stdcall -COemUni2:: -CommandCallback( - PDEVOBJ pdevobj, - DWORD dwCallbackID, - DWORD dwCount, - PDWORD pdwParams, - OUT INT *piResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::CommandCallback - - The IPrintOemUni::CommandCallback method is used - to provide dynamically generated printer commands - for Unidrv-supported printers. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - dwCallbackID - value representing the printer command's - *CallbackID attribute in the printer's generic printer - description (GPD) file. - dwCount - value representing the number of elements - in the array pointed to by pdwParams. Can be 0. - pdwParams - pointer to an array of DWORD-sized parameters - containing values specified by the printer commands - *Params attribute in the printer's GPD file. Can be NULL. - piResult - Receives a method-supplied result value. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE(L"COemUni2::CommandCallback() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(dwCallbackID); - UNREFERENCED_PARAMETER(dwCount); - UNREFERENCED_PARAMETER(pdwParams); - - *piResult = 0; - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -Compression( - PDEVOBJ pdevobj, - PBYTE pInBuf, - PBYTE pOutBuf, - DWORD dwInLen, - DWORD dwOutLen, - OUT INT *piResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::Compression - - The IPrintOemUni::Compression method can be used - with Unidrv-supported printers to provide a customized - bitmap compression method. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pInBuf - pointer to input scan line data. - pOutBuf - pointer to an output buffer to receive - compressed scan line data. - dwInLen - length of the input data. - dwOutLen - length of the output buffer. - piResult - Receives a method-supplied result value. If the - operation succeeds, this value should be the number - of compressed bytes, which must not be larger than - the value received for dwOutLen. If an error occurs, - or if the method cannot compress, the result value - should be -1. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE(L"COemUni2::Compression() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pInBuf); - UNREFERENCED_PARAMETER(pOutBuf); - UNREFERENCED_PARAMETER(dwInLen); - UNREFERENCED_PARAMETER(dwOutLen); - UNREFERENCED_PARAMETER(piResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -DevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DevMode - - The IPrintOemUni::DevMode method, provided by - rendering plug-ins for Unidrv, performs operations - on private DEVMODE members. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::DevMode method. - - Please refer to DDK documentation for more details. - -Arguments: - - dwMode - caller-supplied constant. Refer to the docs - for more information. - pOemDMParam - pointer to an OEMDMPARAM structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - VERBOSE(L"COemUni2:DevMode entry."); - - DBG_OEMDMPARAM(DBG_VERBOSE, L"pOemDMParam", pOemDMParam); - - return hrOEMDevMode(dwMode, pOemDMParam); -} - -HRESULT __stdcall -COemUni2:: -DisableDriver( - VOID - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DisableDriver - - The IPrintOemUni::DisableDriver method allows a rendering - plug-in for Unidrv to free resources that were allocated by the - plug-in's IPrintOemUni::EnableDriver method. This is the last - IPrintOemUni interface method that is called before the rendering - plug-in is unloaded. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::DisableDriver method. - - Please refer to DDK documentation for more details. - -Arguments: - - VOID - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - VERBOSE(L"COemUni2::DisableDriver() entry."); - - // Release reference to Printer Driver's interface. - // - if (this->m_pOEMHelp) - { - this->m_pOEMHelp->Release(); - this->m_pOEMHelp = NULL; - } - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -DisablePDEV( - PDEVOBJ pdevobj - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DisablePDEV - - The IPrintOemUni::DisablePDEV method performs the same types of - operations as the DrvDisablePDEV function. Its purpose is to allow a - rendering plug-in to delete the private PDEV structure that is pointed - to by the DEVOBJ structure's pdevOEM member. This PDEV structure - is one that was allocated by the plug-in's IPrintOemUni::EnablePDEV method. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::DisablePDEV method. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - VERBOSE(L"COemUni2::DisablePDEV() entry."); - - POEMPDEV pOemPDEV = static_cast(pdevobj->pdevOEM); - delete pOemPDEV; - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -DownloadCharGlyph( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - HGLYPH hGlyph, - PDWORD pdwWidth, - OUT DWORD *pdwResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DownloadCharGlyph - - The IPrintOemUni::DownloadCharGlyph method enables a - rendering plug-in for Unidrv to send a character glyph for - a specified soft font to the printer. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - hGlyph - glyph handle. - pdwWidth - pointer to receive the method-supplied width of the character. - pdwResult - Receives a method-supplied value representing the amount - of printer memory, in bytes, required to store the character glyph. - If the operation fails, the returned value should be zero. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE(L"COemUni2::DownloadCharGlyph() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(hGlyph); - UNREFERENCED_PARAMETER(pdwWidth); - UNREFERENCED_PARAMETER(pdwResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -DownloadFontHeader( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DownloadFontHeader - - The IPrintOemUni::DownloadFontHeader method allows a - rendering plug-in for Unidrv to send a font's header - information to a printer. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - pdwResult - Receives a method-supplied value representing the amount - of printer memory, in bytes, required to store the font header - information. If the operation fails, the returned value should be zero. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE(L"COemUni2::DownloadFontHeader() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(pdwResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -DriverDMS( - PVOID pDevObj, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DriverDMS - - The IPrintOemUni::DriverDMS method allows a rendering - plug-in for Unidrv to indicate that it uses a device-managed - drawing surface instead of the default GDI-managed surface. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::DriverDMS method. - - Please refer to DDK documentation for more details. For general info - on device managed surfaces and how to handle them, please refer to - the section titled "Handling Device-Managed Surfaces". - -Arguments: - - pDevObj - pointer to a DEVOBJ structure. - pBuffer - pointer to a buffer to receive method-specified flags. - cbSize - size, in bytes, of the buffer pointed to by pBuffer. - pcbNeeded - pointer to a location to receive the required - minimum pBuffer size. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - VERBOSE(L"COemUni2::DriverDMS() entry."); - - UNREFERENCED_PARAMETER(pDevObj); - UNREFERENCED_PARAMETER(pBuffer); - UNREFERENCED_PARAMETER(cbSize); - UNREFERENCED_PARAMETER(pcbNeeded); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -EnableDriver( - DWORD dwDriverVersion, - DWORD cbSize, - PDRVENABLEDATA pded - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::EnableDriver - - The IPrintOemUni::EnableDriver method allows a rendering - plug-in for Unidrv to hook out some graphics DDI functions. - - The IPrintOemUni::EnableDriver method allows a rendering - plug-in to perform the same types of operations as the - DrvEnableDriver function. Like the DrvEnableDriver function, - the IPrintOemUni::EnableDriver method is responsible for - providing addresses of internally supported graphics DDI functions, - or DDI hook functions. - - The method should fill the supplied DRVENABLEDATA structure - and allocate an array of DRVFN structures. It should fill the - array with pointers to hooking functions, along with winddi.h-defined - index values that identify the hooked out graphics DDI functions. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::EnableDriver method. - - Please refer to DDK documentation for more details. - -Arguments: - - DriverVersion - interface version number. This value is - defined by PRINTER_OEMINTF_VERSION, in printoem.h. - cbSize - size, in bytes, of the structure pointed to by pded. - pded - pointer to a DRVENABLEDATA structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - UNREFERENCED_PARAMETER(dwDriverVersion); - UNREFERENCED_PARAMETER(cbSize); - - VERBOSE(L"COemUni2::EnableDriver() entry."); - - pded->iDriverVersion = PRINTER_OEMINTF_VERSION; - pded->c = sizeof(s_aOemHookFuncs) / sizeof(DRVFN); - pded->pdrvfn = (DRVFN *) s_aOemHookFuncs; - - // Even if nothing is done, need to return S_OK so - // that DisableDriver() will be called, which releases - // the reference to the Printer Driver's interface. - // - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -EnablePDEV( - PDEVOBJ pdevobj, - _In_ PWSTR pPrinterName, - ULONG cPatterns, - HSURF *phsurfPatterns, - ULONG cjGdiInfo, - GDIINFO *pGdiInfo, - ULONG cjDevInfo, - DEVINFO *pDevInfo, - DRVENABLEDATA *pded, - OUT PDEVOEM *ppDevOem - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::EnablePDEV - - The IPrintOemUni::EnablePDEV method performs the same types - of operations as the DrvEnablePDEV function that is exported - by a printer graphics DLL. Its purpose is to allow a rendering - plug-in to create its own PDEV structure. For more information - about PDEV structures, see "Customized PDEV Structures" in the DDK docs. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::EnablePDEV method. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pPrinterName - pointer to a text string representing the - logical address of the printer. - cPatterns - value representing the number of HSURF-typed - surface handles contained in the buffer pointed to by - phsurfPatterns. - phsurfPatterns - pointer to a buffer that is large enough to - contain cPatterns number of HSURF-typed surface handles. - The handles represent surface fill patterns. - cjGdiInfo - value representing the size of the structure pointed - to by pGdiInfo. - pGdiInfo - pointer to a GDIINFO structure. - cjDevInfo - value representing the size of the structure pointed - to by pDevInfo. - pDevInfo - pointer to a DEVINFO structure. - pded - pointer to a DRVENABLEDATA structure containing the - addresses of the printer driver's graphics DDI hooking functions. - pDevOem - Receives a method-supplied pointer to a private PDEV structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - If the operation fails, the method should call SetLastError to set an error code. - - ---*/ - -{ - VERBOSE(L"COemUni2::EnablePDEV() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(cPatterns); - UNREFERENCED_PARAMETER(phsurfPatterns); - UNREFERENCED_PARAMETER(cjGdiInfo); - UNREFERENCED_PARAMETER(cjDevInfo); - - #ifndef DBG - UNREFERENCED_PARAMETER(pGdiInfo); - UNREFERENCED_PARAMETER(pDevInfo); - #endif - - // Allocate an instance of our private PDEV. - // - POEMPDEV pOemPDEV = new COemPDEV(); - *ppDevOem = pOemPDEV; - - if (NULL == pOemPDEV) - { - return E_FAIL; - } - - pOemPDEV->InitializeDDITable(pded); - - DBG_GDIINFO(DBG_VERBOSE, L"pGdiInfo", pGdiInfo); - DBG_DEVINFO(DBG_VERBOSE, L"pDevInfo", pDevInfo); - - pOemPDEV->bPreAnalysis = FALSE; // Initialize the pre-analysis flag - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -FilterGraphics( - PDEVOBJ pdevobj, - PBYTE pBuf, - DWORD dwLen - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::FilterGraphics - - The IPrintOemUni::FilterGraphics method can be used with - Unidrv-supported printers to modify scan line data and send - it to the spooler. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pBuf - pointer to a buffer containing scan line data to be printed. - dwLen - value representing the length, in bytes, of the data - pointed to by pBuf. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - DWORD dwResult; - - VERBOSE(L"COemUni2::FilterGraphics() entry."); - - m_pOEMHelp->DrvWriteSpoolBuf(pdevobj, pBuf, dwLen, &dwResult); - - if (dwResult == dwLen) - return S_OK; - else - return S_FALSE; -} - -HRESULT __stdcall -COemUni2:: -GetImplementedMethod( - _In_ PSTR pMethodName - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::GetImplementedMethod - - The IPrintOemUni::GetImplementedMethod method is used by - Unidrv to determine which IPrintOemUni interface methods - have been implemented by a rendering plug-in. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::GetImplemented method. - - Please refer to DDK documentation for more details. - -Arguments: - - pMethodName - pointer to a string representing the name of an - IPrintOemUni interface method, such as "ImageProcessing" - for IPrintOemUni::ImageProcessing or "FilterGraphics" for - IPrintOemUni::FilterGraphics. - -Return Value: - - S_OK The operation succeeded (the specified method is implemented). - S_FALSE The operation failed (the specified method is not implemented). - - ---*/ - -{ - HRESULT Result = S_FALSE; - - VERBOSE(L"COemUni2::GetImplementedMethod() entry."); - VERBOSE(TEXT("\tCOemUni2::%hs: "), pMethodName); - - // Unidrv only calls GetImplementedMethod for optional - // methods. The required methods are assumed to be - // supported. - - // Return S_OK for supported function (i.e. implemented), - // and S_FALSE for functions that aren't supported (i.e. not implemented). - switch (*pMethodName) - { - case 'C': - if (!strcmp(NAME_CommandCallback, pMethodName)) - { - Result = S_OK; - } - break; - case 'F': - if (!strcmp(NAME_FilterGraphics, pMethodName)) - { - Result = S_OK; - } - break; - } - - VERBOSE(Result == S_OK ? TEXT("Supported\r\n") : TEXT("NOT supported\r\n")); - - return Result; -} - -HRESULT __stdcall -COemUni2:: -GetInfo( - DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::GetInfo - - A rendering plug-in's IPrintOemUni::GetInfo method returns - identification information. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::GetInfo method. - - Please refer to DDK documentation for more details. - -Arguments: - - dwMode - Contains one of the following caller-supplied integer constants. - OEMGI_GETSIGNATURE - The method must return a unique four-byte - identification signature. The plug-in must also place this signature - in OPTITEM structures, as described in the description of the - OEMCUIPPARAM. structure's pOEMOptItems member. - OEMGI_GETVERSION - The method must return the user interface - plug-in's version number as a DWORD. The version format is - developer-defined. - pBuffer - pointer to memory allocated to receive the information specified - by dwInfo. - cbSize - size of the buffer pointed to by pBuffer. - pcbNeeded - pointer to a location to receive the number of bytes written - into the buffer pointed to by pBuffer. - -Return Value: - - S_OK The operation succeeded (the specified method is implemented). - S_FALSE The operation failed (the specified method is not implemented). - - ---*/ - -{ - PWSTR pszTag = L"COemUni2::GetInfo entry."; - - switch(dwMode) - { - case OEMGI_GETSIGNATURE: - pszTag = L"COemUni2::GetInfo entry. [OEMGI_GETSIGNATURE]"; - break; - case OEMGI_GETVERSION: - pszTag = L"COemUni2::GetInfo entry. [OEMGI_GETVERSION]"; - break; - } - - VERBOSE(pszTag); - - // Validate parameters. - if( (NULL == pcbNeeded) - || - ( (OEMGI_GETSIGNATURE != dwMode) - && - (OEMGI_GETVERSION != dwMode) ) ) - { - WARNING(DLLTEXT("COemUni2::GetInfo() exit pcbNeeded is NULL! ERROR_INVALID_PARAMETER.\r\n")); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Set expected buffer size. - *pcbNeeded = sizeof(DWORD); - - // Check buffer size is sufficient. - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - VERBOSE(TEXT("COemUni2::GetInfo() exit insufficient buffer!\r\n")); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return E_FAIL; - } - - switch(dwMode) - { - // OEM DLL Signature - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // OEM DLL version - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // dwMode not supported. - default: - // Set written bytes to zero since nothing was written. - WARNING(DLLTEXT("COemUni2::GetInfo() exit mode not supported.\r\n")); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - return E_FAIL; - } - - VERBOSE(TEXT("COemUni2::GetInfo() exit S_OK, (*pBuffer is %#x).\r\n"), *(PDWORD)pBuffer); - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -HalftonePattern( - PDEVOBJ pdevobj, - PBYTE pHTPattern, - DWORD dwHTPatternX, - DWORD dwHTPatternY, - DWORD dwHTNumPatterns, - DWORD dwCallbackID, - PBYTE pResource, - DWORD dwResourceSize - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::HalftonePattern - - The IPrintOemUni::HalftonePattern method can be used with - Unidrv-supported printers to create or modify a halftone - pattern before it is used in a halftoning operation. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pHTPattern - pointer to a buffer to receive the method-supplied - halftone pattern. Buffer size, in bytes, is: - (((dwHTPatternX * dwHTPatternY) + 3)/4) * 4 * dwHTNumPatterns. - dwHTPatternX - length, in pixels, of the halftone pattern, as specified - by the GPD file's *HTPatternSize attribute. - dwHTPatternY - height, in pixels, of the halftone pattern, as specified - by the GPD file's *HTPatternSize attribute. - dwHTNumPatterns - number of patterns, as specified by the GPD file's - *HTNumPatterns attribute. This can be 1 or 3. - dwCallbackID - value identifying the halftone method, as specified by - the GPD file's *HTCallbackID attribute. - pResource - pointer to a buffer containing a halftone pattern, as - specified by the GPD file's *rcHTPatternID attribute. This can be NULL. - dwResourceSize - size of the halftone pattern contained in the buffer - pointed to by pResource. This is zero if pResource is NULL. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE(L"COemUni2::HalftonePattern() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pHTPattern); - UNREFERENCED_PARAMETER(dwHTPatternX); - UNREFERENCED_PARAMETER(dwHTPatternY); - UNREFERENCED_PARAMETER(dwHTNumPatterns); - UNREFERENCED_PARAMETER(dwCallbackID); - UNREFERENCED_PARAMETER(pResource); - UNREFERENCED_PARAMETER(dwResourceSize); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -ImageProcessing( - PDEVOBJ pdevobj, - PBYTE pSrcBitmap, - PBITMAPINFOHEADER pBitmapInfoHeader, - PBYTE pColorTable, - DWORD dwCallbackID, - PIPPARAMS pIPParams, - OUT PBYTE *ppbResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::ImageProcessing - - The IPrintOemUni::ImageProcessing method can be used with - Unidrv-supported printers to modify image bitmap data, in order - to perform color formatting or halftoning. The method can return - the modified bitmap to Unidrv or send it directly to the print spooler. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pSrcBitmap - pointer to an input device-independent bitmap (DIB). - pBitmapInfoHeader - pointer to a BITMAPINFOHEADER structure - that describes the bitmap pointed to by pSrcBitmap. - pColorTable - pointer to a color table. Used only if the output format is - eight bits per pixel. - dwCallbackID - value assigned to the *IPCallbackID attribute of the - currently selected option for the ColorMode feature. - pIPParams - pointer to an IPPARAMS structure. - ppbResult - - If the method returns the converted DIB to Unidrv: - If the conversion succeeds, the method should return a - pointer to a buffer containing the converted DIB. - Otherwise it should return NULL. - If the method sends the converted DIB to the print spooler: - If the operation succeeds, the method should return TRUE. - Otherwise it should return FALSE. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE(L"COemUni2::ImageProcessing() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pSrcBitmap); - UNREFERENCED_PARAMETER(pBitmapInfoHeader); - UNREFERENCED_PARAMETER(pColorTable); - UNREFERENCED_PARAMETER(dwCallbackID); - UNREFERENCED_PARAMETER(pIPParams); - UNREFERENCED_PARAMETER(ppbResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -MemoryUsage( - PDEVOBJ pdevobj, - POEMMEMORYUSAGE pMemoryUsage - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::MemoryUsage - - The IPrintOemUni::MemoryUsage method can be used with - Unidrv-supported printers to specify the amount of memory - required for use by a rendering plug-in's IPrintOemUni::ImageProcessing - method. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pMemoryUsage - pointer to an OEMMEMORYUSAGE structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE(L"COemUni2::MemoryUsage() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pMemoryUsage); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -OutputCharStr( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - DWORD dwType, - DWORD dwCount, - PVOID pGlyph - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::OutputCharStr - - The IPrintOemUni::OutputCharStr method enables a rendering - plug-in to control the printing of font glyphs. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - dwType - value indicating the type of glyph specifier array - pointed to by pGlyph. Valid values are as follows: - TYPE_GLYPHHANDLE The pGlyph array elements are glyph - handles of type HGLYPH. - TYPE_GLYPHID The pGlyph array elements are glyph - identifiers of type DWORD. - dwCount - value representing the number of glyph specifiers in - the array pointed to by pGlyph. - pGlyph - pointer to an array of glyph specifiers, where the array - element type is indicated by dwType. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE(L"COemUni2::OutputCharStr() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(dwType); - UNREFERENCED_PARAMETER(dwCount); - UNREFERENCED_PARAMETER(pGlyph); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -PublishDriverInterface( - IUnknown *pIUnknown - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::PublishDriverInterface - - The IPrintOemUni::PublishDriverInterface method allows a - rendering plug-in for Unidrv to obtain the Unidrv driver's - IPrintOemDriverUni interface. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::PublishDriverInterface method and the method - must return S_OK, or the driver will not call the plug-in's other - IPrintOemUni interface methods. - - Please refer to DDK documentation for more details. - -Arguments: - - pIUnknown - pointer to the IUnknown interface of the driver's - IPrintOemDriverUni COM interface. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - VERBOSE(L"COemUni2::PublishDriverInterface() entry."); - - // Need to store pointer to Driver Helper functions, if we already haven't. - if (this->m_pOEMHelp == NULL) - { - HRESULT hResult; - - // Get Interface to Helper Functions. - hResult = pIUnknown->QueryInterface(IID_IPrintOemDriverUni, (void** ) &(this->m_pOEMHelp)); - - if(!SUCCEEDED(hResult)) - { - // Make sure that interface pointer reflects interface query failure. - this->m_pOEMHelp = NULL; - - return E_FAIL; - } - } - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -ResetPDEV( - PDEVOBJ pdevobjOld, - PDEVOBJ pdevobjNew - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::ResetPDEV - - A rendering plug-in's IPrintOemUni::ResetPDEV method performs - the same types of operations as the DrvResetPDEV function. During - the processing of an application's call to the Platform SDK ResetDC - function, the IPrintOemUni::ResetPDEV method is called by Unidrv's - DrvResetPDEV function. For more information about when DrvResetPDEV - is called, see its description in the DDK docs. - - The rendering plug-in's private PDEV structure's address is contained - in the pdevOEM member of the DEVOBJ structure pointed to by pdevobjOld. - The IPrintOemUni::ResetPDEV method should use relevant members of this - old structure to fill in the new structure, which is referenced through pdevobjNew. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::ResetPDEV method. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobjOld - pointer to a DEVOBJ structure containing current PDEV information. - pdevobjNew - pointer to a DEVOBJ structure into which the method should place - new PDEV information. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - VERBOSE(L"COemUni2::ResetPDEV() entry."); - - UNREFERENCED_PARAMETER(pdevobjOld); - UNREFERENCED_PARAMETER(pdevobjNew); - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -SendFontCmd( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - PFINVOCATION pFInv - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::SendFontCmd - - The IPrintOemUni::SendFontCmd method enables a rendering - plug-in to modify a printer's font selection command and then - send it to the printer. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - pFInv - pointer to an FINVOCATION structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE(L"COemUni2::SendFontCmd() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(pFInv); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -TextOutAsBitmap( - SURFOBJ *pso, - STROBJ *pstro, - FONTOBJ *pfo, - CLIPOBJ *pco, - RECTL *prclExtra, - RECTL *prclOpaque, - BRUSHOBJ *pboFore, - BRUSHOBJ *pboOpaque, - POINTL *pptlOrg, - MIX mix - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::TextOutAsBitmap - - The IPrintOemUni::TextOutAsBitmap method allows a rendering - plug-in to create a bitmap image of a text string, in case a - downloadable font is not available. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface on which to be written. - pstro - Defines the glyphs to be rendered and their positions - pfo - Specifies the font to be used - pco - Defines the clipping path - prclExtra - A NULL-terminated array of rectangles to be filled - prclOpaque - Specifies an opaque rectangle - pboFore - Defines the foreground brush - pboOpaque - Defines the opaque brush - pptlOrg - Pointer to POINT struct , defining th origin - mix - Specifies the foreground and background ROPs for pboFore - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE(L"COemUni2::TextOutAsBitmap() entry."); - - UNREFERENCED_PARAMETER(pso); - UNREFERENCED_PARAMETER(pstro); - UNREFERENCED_PARAMETER(pfo); - UNREFERENCED_PARAMETER(pco); - UNREFERENCED_PARAMETER(prclExtra); - UNREFERENCED_PARAMETER(prclOpaque); - UNREFERENCED_PARAMETER(pboFore); - UNREFERENCED_PARAMETER(pboOpaque); - UNREFERENCED_PARAMETER(pptlOrg); - UNREFERENCED_PARAMETER(mix); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -TTDownloadMethod( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::TTDownloadMethod - - The IPrintOemUni::TTDownloadMethod method enables a rendering - plug-in to indicate the format that Unidrv should use for a specified - TrueType soft font. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - pdwResult - Receives one of the following method-supplied constant values: - TTDOWNLOAD_BITMAP Unidrv should download the specified font as bitmaps. - TTDOWNLOAD_DONTCARE Unidrv can select the font format. - TTDOWNLOAD_GRAPHICS Unidrv should print TrueType fonts as graphics, - instead of downloading the font. - TTDOWNLOAD_TTOUTLINE Unidrv should download the specified font as outlines. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE(L"COemUni2::TTDownloadMethod() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(pdwResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -TTYGetInfo( - PDEVOBJ pdevobj, - DWORD dwInfoIndex, - PVOID pOutputBuf, - DWORD dwSize, - DWORD *pcbcNeeded - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::TTYGetInfo - - The IPrintOemUni::TTYGetInfo method enables a rendering plug-in - to supply Unidrv with information relevant to text-only printers. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - dwInfoIndex - constant identifying the type of information being requested. - The following constant values are defined: - OEMTTY_INFO_CODEPAGE - The pOutputBuf parameter points to a - DWORD in which the method should return the number of the - code page to be used. - OEMTTY_INFO_MARGINS - The pOutputBuf parameter points to a - RECT structure in which the method should return page margin - widths, in tenths of millimeters (for example, 20 represents 2 mm). - If the entire page is printable, all margin values must be 0. - OEMTTY_INFO_NUM_UFMS - The pOutputBuf parameter points to a - DWORD in which the method should return the number of resource - IDs of the UFMs for 10, 12, and 17 CPI fonts. To actually obtain - these resource IDs, perform a query using OEMTTY_INFO_UFM_IDS. - OEMTTY_INFO_UFM_IDS - The pOutputBuf parameter points to an array - of DWORDs of sufficient size to hold the number of resource IDs of - the UFMs for 10, 12, and 17 CPI fonts. (This number is obtained by - using OEMTTY_INFO_NUM_UFMS in a query.) The method should - return the resource IDs of the UFMs for 10,12, and 17 CPI fonts. - pOutputBuf - pointer to a buffer to receive the requested information. - dwSize - size, in bytes, of the buffer pointed to by pOutputBuf. - pcbcNeeded - pointer to a location to receive the number of bytes written into - the buffer pointed to by pOutputBuf. If the number of bytes required is - smaller than the number specified by dwSize, the method should supply - the required size and return E_FAIL. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE(L"COemUni2::TTYGetInfo() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(dwInfoIndex); - UNREFERENCED_PARAMETER(pOutputBuf); - UNREFERENCED_PARAMETER(dwSize); - UNREFERENCED_PARAMETER(pcbcNeeded); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -WritePrinter( - PDEVOBJ pdevobj, - PVOID pBuf, - DWORD cbBuffer, - PDWORD pcbWritten - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni2::WritePrinter - - The IPrintOemUni2::WritePrinter method, if supported, enables a - rendering plug-in to capture all output data generated by a Unidrv - driver. If this method is not supported, the output data would - otherwise be sent to the spooler in a call to the spooler's WritePrinter API. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pBuf - pointer to the first byte of an array of bytes that contains - the output data generated by the Unidrv driver. - cbBuffer - size, in bytes, of the array pointed to by pBuf. - pcbWritten - pointer to a DWORD value that receives the number - of bytes of data that were successfully sent to the plug-in. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE(L"COemUni2::WritePrinter() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pBuf); - UNREFERENCED_PARAMETER(cbBuffer); - UNREFERENCED_PARAMETER(pcbWritten); - - return E_NOTIMPL; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// oem class factory -// -class COemCF : public IClassFactory -{ -public: - // *** IUnknown methods *** - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef)(THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release)(THIS); - - // *** IClassFactory methods *** - STDMETHOD(CreateInstance)(THIS_ - LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID FAR* ppvObject); - STDMETHOD(LockServer)(THIS_ BOOL bLock); - - - // Constructor - COemCF(): m_cRef(1) { }; - - // Destructor - ~COemCF() { }; - -protected: - LONG m_cRef; - -}; - -/////////////////////////////////////////////////////////// -// -// Class factory body -// -HRESULT __stdcall -COemCF:: -QueryInterface( - const IID& iid, - void** ppv) -{ - VERBOSE(L"COemCF::QueryInterface entry."); - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this); - } - else - { - *ppv = NULL; -#if DBG && defined(USERMODE_DRIVER) - TCHAR szOutput[80] = {0}; - StringFromGUID2(iid, szOutput, _countof(szOutput)); // can not fail! - VERBOSE(TEXT("COemCF::QueryInterface %s not supported.\r\n"), szOutput); -#endif - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -ULONG __stdcall -COemCF:: -AddRef() -{ - return InterlockedIncrement(&m_cRef); -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall -COemCF:: -Release() -{ -// ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - } - return cRef; -} - -// IClassFactory implementation -HRESULT __stdcall -COemCF:: -CreateInstance( - IUnknown* pUnknownOuter, - const IID& iid, - void** ppv) -{ - VERBOSE(L"Class factory:Create component."); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Cannot aggregate. - if (pUnknownOuter != NULL) - { - return CLASS_E_NOAGGREGATION; - } - - // Create component. - COemUni2* pOemCP = new COemUni2; - if (pOemCP == NULL) - { - return E_OUTOFMEMORY; - } - - // Get the requested interface. - HRESULT hr = pOemCP->QueryInterface(iid, ppv); - - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - pOemCP->Release(); - return hr; -} - -// LockServer -HRESULT __stdcall -COemCF:: -LockServer( - BOOL bLock - ) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks); - } - else - { - InterlockedDecrement(&g_cServerLocks); - } - return S_OK; -} - - -// -// Registration functions -// - -// -// Can DLL unload now? -// -STDAPI DllCanUnloadNow(void) -{ - VERBOSE(L"DllCanUnloadNow entry."); - - // - // To avoid leaving OEM DLL still in memory when Unidrv or Pscript drivers - // are unloaded, Unidrv and Pscript driver ignore the return value of - // DllCanUnloadNow of the OEM DLL, and always call FreeLibrary on the OEMDLL. - // - // If OEM DLL spins off a working thread that also uses the OEM DLL, the - // thread needs to call LoadLibrary and FreeLibraryAndExitThread, otherwise - // it may crash after Unidrv or Pscript calls FreeLibrary. - // - - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK; - } - else - { - return S_FALSE; - } -} - -// -// Get class factory -// -STDAPI DllGetClassObject( - _In_ REFCLSID clsid, - _In_ REFIID iid, - _Outptr_ LPVOID* ppv - ) -{ - VERBOSE(L"DllGetClassObject:\tCreate class factory."); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Can we create this component? - if (clsid != CLSID_OEMRENDER) - { - ERR(ERRORTEXT("DllGetClassObject:\tClass not available!\r\n")); - return CLASS_E_CLASSNOTAVAILABLE; - } - - // Create class factory. - COemCF* pFontCF = new COemCF; // Reference count set to 1 in constructor - if (pFontCF == NULL) - { - ERR(ERRORTEXT("DllGetClassObject:\tOut of Memory!\r\n")); - return E_OUTOFMEMORY; - } - - // Get requested interface. - HRESULT hrResult = pFontCF->QueryInterface(iid, ppv); - pFontCF->Release(); - - return hrResult; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/intrface.h deleted file mode 100644 index 28b2a82f..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/intrface.h +++ /dev/null @@ -1,288 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.H -// -// -// PURPOSE: Define COM interface for User Mode Printer Customization DLL. -// -// History: -// 06/26/03 xxx created. -// -// - -#pragma once - -///////////////////////////////////////////////////////// -// String Literals -///////////////////////////////////////////////////////// - -CONST CHAR NAME_CommandCallback[] = "CommandCallback"; -CONST CHAR NAME_FilterGraphics[] = "FilterGraphics"; - -//////////////////////////////////////////////////////////////////////////////// -// -// COemUni2 -// -// Interface for Unidrv OEM sample rendering module -// -class COemUni2 : public IPrintOemUni2 -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Method for getting the implemented methods. - // Returns S_OK if the given method is implemneted. - // Returns S_FALSE if the given method is notimplemneted. - // - - STDMETHOD(GetImplementedMethod)(THIS_ _In_ PSTR pMethodName); - - // - // Method for OEM to specify DDIs that have been hooked - // - - STDMETHOD(EnableDriver) (THIS_ DWORD DriverVersion, - DWORD cbSize, - PDRVENABLEDATA pded); - - // - // Method to notify OEM plugin that it is no longer required - // - - STDMETHOD(DisableDriver) (THIS); - - // - // Method for OEM plugin to contruct its own PDEV - // - - STDMETHOD(EnablePDEV)(THIS_ PDEVOBJ pdevobj, - _In_ PWSTR pPrinterName, - ULONG cPatterns, - HSURF *phsurfPatterns, - ULONG cjGdiInfo, - GDIINFO *pGdiInfo, - ULONG cjDevInfo, - DEVINFO *pDevInfo, - DRVENABLEDATA *pded, - OUT PDEVOEM *pDevOem); - - // - // Method for OEM to free any resource associated with its PDEV - // - - STDMETHOD(DisablePDEV)(THIS_ PDEVOBJ pdevobj); - - // - // Method for OEM to transfer from old PDEV to new PDEV - // - - STDMETHOD(ResetPDEV)(THIS_ PDEVOBJ pdevobjOld, - PDEVOBJ pdevobjNew); - - // - // Get OEM dll related information - // - - STDMETHOD(GetInfo)(THIS_ DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDriverDMS - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(DriverDMS)(THIS_ PVOID pDevObj, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDevMode - // - - STDMETHOD(DevMode)(THIS_ DWORD dwMode, - POEMDMPARAM pOemDMParam); - - // - // OEMCommandCallback - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(CommandCallback)(THIS_ PDEVOBJ pdevobj, - DWORD dwCallbackID, - DWORD dwCount, - PDWORD pdwParams, - OUT INT *piResult); - - // - // OEMImageProcessing - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(ImageProcessing)(THIS_ PDEVOBJ pdevobj, - PBYTE pSrcBitmap, - PBITMAPINFOHEADER pBitmapInfoHeader, - PBYTE pColorTable, - DWORD dwCallbackID, - PIPPARAMS pIPParams, - OUT PBYTE *ppbResult); - - // - // OEMFilterGraphics - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(FilterGraphics)(THIS_ PDEVOBJ pdevobj, - PBYTE pBuf, - DWORD dwLen); - // - // OEMCompression - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(Compression)(THIS_ PDEVOBJ pdevobj, - PBYTE pInBuf, - PBYTE pOutBuf, - DWORD dwInLen, - DWORD dwOutLen, - OUT INT *piResult); - - // - // OEMHalftone - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(HalftonePattern)(THIS_ PDEVOBJ pdevobj, - PBYTE pHTPattern, - DWORD dwHTPatternX, - DWORD dwHTPatternY, - DWORD dwHTNumPatterns, - DWORD dwCallbackID, - PBYTE pResource, - DWORD dwResourceSize); - - // - // OEMMemoryUsage - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(MemoryUsage)(THIS_ PDEVOBJ pdevobj, - POEMMEMORYUSAGE pMemoryUsage); - - // - // OEMTTYGetInfo - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(TTYGetInfo)(THIS_ PDEVOBJ pdevobj, - DWORD dwInfoIndex, - PVOID pOutputBuf, - DWORD dwSize, - DWORD *pcbcNeeded); - - // - // OEMDownloadFontheader - UNIDRV only - // - - STDMETHOD(DownloadFontHeader)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult); - - // - // OEMDownloadCharGlyph - UNIDRV only - // - - STDMETHOD(DownloadCharGlyph)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - HGLYPH hGlyph, - PDWORD pdwWidth, - OUT DWORD *pdwResult); - - // - // OEMTTDownloadMethod - UNIDRV only - // - - STDMETHOD(TTDownloadMethod)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult); - - // - // OEMOutputCharStr - UNIDRV only - // - - STDMETHOD(OutputCharStr)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - DWORD dwType, - DWORD dwCount, - PVOID pGlyph); - - // - // OEMSendFontCmd - UNIDRV only - // - - - STDMETHOD(SendFontCmd)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - PFINVOCATION pFInv); - - // - // OEMTextOutAsBitmap - UNIDRV only - // - - STDMETHOD(TextOutAsBitmap)(THIS_ SURFOBJ *pso, - STROBJ *pstro, - FONTOBJ *pfo, - CLIPOBJ *pco, - RECTL *prclExtra, - RECTL *prclOpaque, - BRUSHOBJ *pboFore, - BRUSHOBJ *pboOpaque, - POINTL *pptlOrg, - MIX mix); - - // - // IPrintOemUni2 methods - // - - // - // Method for plugin to hook out spooler's WritePrinter API so it - // can get access to output data Universal driver is generating - // - // At DrvEnablePDEV time, Universal driver will call this function with - // pdevobj = NULL, pBuf = NULL, cbBuffer = 0 to detect if the plugin - // implements this function. Plugin should return S_OK to indicate it is - // implementing this function, or return E_NOTIMPL otherwise. - // - // In pcbWritten, plugins should return the number of bytes written to the - // spooler's WritePrinter function. Zero doesn't carry a special meaning, - // errors must be reported through the returned HRESULT. - // - - STDMETHOD(WritePrinter)(THIS_ PDEVOBJ pdevobj, - PVOID pBuf, - DWORD cbBuffer, - PDWORD pcbWritten); - - - COemUni2(); - ~COemUni2(); - -protected: - LONG m_cRef; - IPrintOemDriverUni* m_pOEMHelp; -}; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.def b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.def deleted file mode 100644 index a9534822..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY OEMPREAN -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.h b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.h deleted file mode 100644 index f8fa44a7..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.h +++ /dev/null @@ -1,259 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: OEMUNI.H -// -// -// PURPOSE: Define the COemPDEV class which stores the private -// PDEV for the driver. -// -// -// Functions: -// COemPDEV constructor and destructor -// COemPDEV::InitializeDDITable -// COemPDEV::_SavePFN -// COemPDEV::_ResetPointers -// -// History: -// 06/24/03 xxx created. -// -// - -#pragma once - -#include "debug.h" - -#define OEM_SIGNATURE 'MSFT' -#define OEM_VERSION 0x00000001L - -#define DLLTEXT(s) TEXT("OEMUNI: ") TEXT(s) -#define ERRORTEXT(s) TEXT("ERROR ") DLLTEXT(s) - -class COemPDEV -{ -public: - __stdcall COemPDEV(void) - { - - // Note that since our parent has AddRef'd the UNIDRV interface, - // we don't do so here since our scope is identical to our - // parent. - // - - VERBOSE(L"In COemPDEV constructor..."); - - _ResetPointers(); - } - - __stdcall ~COemPDEV(void) - { - VERBOSE(L"In COemPDEV destructor..."); - } - - void __stdcall InitializeDDITable(DRVENABLEDATA* pded) - { - VERBOSE(L"COemPDEV::InitializeDDITable entry."); - - UINT iDrvFn; - UINT cDrvFn = pded->c; - PDRVFN pDrvFn = pded->pdrvfn; - - for (iDrvFn = 0; iDrvFn < cDrvFn; ++iDrvFn, ++pDrvFn) - { - _SavePFN(pDrvFn->iFunc, pDrvFn->pfn); - } - } - -private: - - void __stdcall _SavePFN(ULONG uFunc, PFN pfn) - { - - // Note: if a "pass-through" driver is being constructed, then - // there is nothing for this method to do. So, to keep the - // compiler from complaining about a switch with no case - // statements, but which has a default statement, we surround - // the entire construct with preprocessor controls. - // - switch(uFunc) - { - // The following are the page/band related DDI hooks. - // - - case INDEX_DrvStartDoc: - m_pfnDrvStartDoc = (PFN_DrvStartDoc)pfn; - break; - case INDEX_DrvEndDoc: - m_pfnDrvEndDoc = (PFN_DrvEndDoc)pfn; - break; - case INDEX_DrvStartPage: - m_pfnDrvStartPage = (PFN_DrvStartPage)pfn; - break; - case INDEX_DrvSendPage: - m_pfnDrvSendPage = (PFN_DrvSendPage)pfn; - break; - case INDEX_DrvStartBanding: - m_pfnDrvStartBanding = (PFN_DrvStartBanding)pfn; - break; - case INDEX_DrvNextBand: - m_pfnDrvNextBand = (PFN_DrvNextBand)pfn; - break; - case INDEX_DrvEscape: - m_pfnDrvEscape = (PFN_DrvEscape)pfn; - break; - - // The following are the drawing related DDI hooks. - // - case INDEX_DrvAlphaBlend: - m_pfnDrvAlphaBlend = (PFN_DrvAlphaBlend)pfn; - break; - case INDEX_DrvBitBlt: - m_pfnDrvBitBlt = (PFN_DrvBitBlt)pfn; - break; - case INDEX_DrvCopyBits: - m_pfnDrvCopyBits = (PFN_DrvCopyBits)pfn; - break; - case INDEX_DrvDitherColor: - m_pfnDrvDitherColor = (PFN_DrvDitherColor)pfn; - break; - case INDEX_DrvFillPath: - m_pfnDrvFillPath = (PFN_DrvFillPath)pfn; - break; - case INDEX_DrvFontManagement: - m_pfnDrvFontManagement = (PFN_DrvFontManagement)pfn; - break; - case INDEX_DrvGetGlyphMode: - m_pfnDrvGetGlyphMode = (PFN_DrvGetGlyphMode)pfn; - break; - case INDEX_DrvGradientFill: - m_pfnDrvGradientFill = (PFN_DrvGradientFill)pfn; - break; - case INDEX_DrvLineTo: - m_pfnDrvLineTo = (PFN_DrvLineTo)pfn; - break; - case INDEX_DrvPaint: - m_pfnDrvPaint = (PFN_DrvPaint)pfn; - break; - case INDEX_DrvPlgBlt: - m_pfnDrvPlgBlt = (PFN_DrvPlgBlt)pfn; - break; - case INDEX_DrvQueryAdvanceWidths: - m_pfnDrvQueryAdvanceWidths = (PFN_DrvQueryAdvanceWidths)pfn; - break; - case INDEX_DrvQueryFont: - m_pfnDrvQueryFont = (PFN_DrvQueryFont)pfn; - break; - case INDEX_DrvQueryFontData: - m_pfnDrvQueryFontData = (PFN_DrvQueryFontData)pfn; - break; - case INDEX_DrvQueryFontTree: - m_pfnDrvQueryFontTree = (PFN_DrvQueryFontTree)pfn; - break; - case INDEX_DrvRealizeBrush: - m_pfnDrvRealizeBrush = (PFN_DrvRealizeBrush)pfn; - break; - case INDEX_DrvStretchBlt: - m_pfnDrvStretchBlt = (PFN_DrvStretchBlt)pfn; - break; - case INDEX_DrvStretchBltROP: - m_pfnDrvStretchBltROP = (PFN_DrvStretchBltROP)pfn; - break; - case INDEX_DrvStrokeAndFillPath: - m_pfnDrvStrokeAndFillPath = (PFN_DrvStrokeAndFillPath)pfn; - break; - case INDEX_DrvStrokePath: - m_pfnDrvStrokePath = (PFN_DrvStrokePath)pfn; - break; - case INDEX_DrvTextOut: - m_pfnDrvTextOut = (PFN_DrvTextOut)pfn; - break; - case INDEX_DrvTransparentBlt: - m_pfnDrvTransparentBlt = (PFN_DrvTransparentBlt)pfn; - break; - - } // switch(uFunc) - } - - void __stdcall _ResetPointers(void) - { - m_pfnDrvAlphaBlend = NULL; - m_pfnDrvBitBlt = NULL; - m_pfnDrvCopyBits = NULL; - m_pfnDrvDitherColor = NULL; - m_pfnDrvEndDoc = NULL; - m_pfnDrvEscape = NULL; - m_pfnDrvFillPath = NULL; - m_pfnDrvFontManagement = NULL; - m_pfnDrvGetGlyphMode = NULL; - m_pfnDrvGradientFill = NULL; - m_pfnDrvLineTo = NULL; - m_pfnDrvNextBand = NULL; - m_pfnDrvPaint = NULL; - m_pfnDrvPlgBlt = NULL; - m_pfnDrvQueryAdvanceWidths = NULL; - m_pfnDrvQueryFont = NULL; - m_pfnDrvQueryFontData = NULL; - m_pfnDrvQueryFontTree = NULL; - m_pfnDrvRealizeBrush = NULL; - m_pfnDrvSendPage = NULL; - m_pfnDrvStartBanding = NULL; - m_pfnDrvStartDoc = NULL; - m_pfnDrvStartPage = NULL; - m_pfnDrvStretchBlt = NULL; - m_pfnDrvStretchBltROP = NULL; - m_pfnDrvStrokeAndFillPath = NULL; - m_pfnDrvStrokePath = NULL; - m_pfnDrvTextOut = NULL; - m_pfnDrvTransparentBlt = NULL; - } - -public: - - // Unidrv function pointers so that we can punt - // back from the DDI hooks - // - PFN_DrvAlphaBlend m_pfnDrvAlphaBlend; - PFN_DrvBitBlt m_pfnDrvBitBlt; - PFN_DrvCopyBits m_pfnDrvCopyBits; - PFN_DrvDitherColor m_pfnDrvDitherColor; - PFN_DrvEndDoc m_pfnDrvEndDoc; - PFN_DrvEscape m_pfnDrvEscape; - PFN_DrvFillPath m_pfnDrvFillPath; - PFN_DrvFontManagement m_pfnDrvFontManagement; - PFN_DrvGetGlyphMode m_pfnDrvGetGlyphMode; - PFN_DrvGradientFill m_pfnDrvGradientFill; - PFN_DrvLineTo m_pfnDrvLineTo; - PFN_DrvNextBand m_pfnDrvNextBand; - PFN_DrvPaint m_pfnDrvPaint; - PFN_DrvPlgBlt m_pfnDrvPlgBlt; - PFN_DrvQueryAdvanceWidths m_pfnDrvQueryAdvanceWidths; - PFN_DrvQueryFont m_pfnDrvQueryFont; - PFN_DrvQueryFontData m_pfnDrvQueryFontData; - PFN_DrvQueryFontTree m_pfnDrvQueryFontTree; - PFN_DrvRealizeBrush m_pfnDrvRealizeBrush; - PFN_DrvSendPage m_pfnDrvSendPage; - PFN_DrvStartBanding m_pfnDrvStartBanding; - PFN_DrvStartDoc m_pfnDrvStartDoc; - PFN_DrvStartPage m_pfnDrvStartPage; - PFN_DrvStretchBlt m_pfnDrvStretchBlt; - PFN_DrvStretchBltROP m_pfnDrvStretchBltROP; - PFN_DrvStrokeAndFillPath m_pfnDrvStrokeAndFillPath; - PFN_DrvStrokePath m_pfnDrvStrokePath; - PFN_DrvTextOut m_pfnDrvTextOut; - PFN_DrvTransparentBlt m_pfnDrvTransparentBlt; - - /*******************************************/ - /* */ - /* Add any custom PDEV members here */ - /* */ - /*******************************************/ - - BOOL bPreAnalysis; // Indicates if a current pass is the pre-analysis pass - -}; -typedef COemPDEV* POEMPDEV; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.rc b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.rc deleted file mode 100644 index 875705f1..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.rc +++ /dev/null @@ -1,110 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Written by DDK Support Team\0" - VALUE "CompanyName", "Microsoft Corp.\0" - VALUE "FileDescription", "OEM Pre-Analysis Sample\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "OEMPREAN\0" - VALUE "LegalCopyright", "Copyright 1998-2003\0" - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation\0" - VALUE "OriginalFilename", "OEMPREAN.DLL\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Microsoft OEMPREAN\0" - VALUE "ProductVersion", "1.0\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.vcxproj deleted file mode 100644 index b1ff3191..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.vcxproj +++ /dev/null @@ -1,1096 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {D5E225D5-EEEA-45FD-AD07-E4678C542E1A} - $(MSBuildProjectName) - Win10 Debug - Win32 - {179B20BC-0106-4AEE-814D-8E6C0FD66347} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - oemprean - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - oemprean.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.vcxproj.Filters deleted file mode 100644 index eae4ad4e..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/oemprean.vcxproj.Filters +++ /dev/null @@ -1,177 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {846460B0-CFA8-4A48-BE85-411A0055B60C} - - - h;hpp;hxx;hm;inl;inc;xsd - {B95DE626-65CE-4B7F-A90F-6094DB24D175} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {3E039E41-E6A5-4CB3-8B97-DBE76450B55B} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/precomp.h deleted file mode 100644 index 3bfba083..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/precomp.h +++ /dev/null @@ -1,49 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: precomp.h -// -// PURPOSE: Consolidate common headers that do not change frequently. -// -// History: -// 06/24/03 xxx created. -// -// - -#pragma once - -// Necessary for compiling under VC. -#if(!defined(WINVER) || (WINVER < 0x0500)) - #undef WINVER - #define WINVER 0x0500 -#endif -#if(!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)) - #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0500 -#endif - -// Required header files that shouldn't change often. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// StrSafe.h needs to be included last -// to disallow unsafe string functions. -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/resource.h b/print/OEM Printer Customization Plug-in Samples/C++/oemprean/resource.h deleted file mode 100644 index 8e941820..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemprean/resource.h +++ /dev/null @@ -1,17 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by OEMUNI.rc -// - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps.ini b/print/OEM Printer Customization Plug-in Samples/C++/oemps.ini deleted file mode 100644 index 7ad0e62a..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps.ini +++ /dev/null @@ -1,3 +0,0 @@ -[OEMFiles] -OEMDriverFile1=OEMPS.DLL - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/OEMPS.rc b/print/OEM Printer Customization Plug-in Samples/C++/oemps/OEMPS.rc deleted file mode 100644 index 49008d4c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/OEMPS.rc +++ /dev/null @@ -1,109 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Written by Windows Printing & Imaging Team\0" - VALUE "CompanyName", "Microsoft Corp.\0" - VALUE "FileDescription", "OEM Customization Sample\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "OEMPS\0" - VALUE "LegalCopyright", "Copyright 1998-2003\0" - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation\0" - VALUE "OriginalFilename", "OEMPS.DLL\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Microsoft OEMPS\0" - VALUE "ProductVersion", "1.0\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/OEMPS.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/oemps/OEMPS.vcxproj deleted file mode 100644 index c30249a8..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/OEMPS.vcxproj +++ /dev/null @@ -1,1096 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {9F374241-B8F9-45D3-B163-7E84E8E22C1F} - $(MSBuildProjectName) - Win10 Debug - Win32 - {143DF0A4-9C2F-48FB-A070-C9D9465D83B2} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - OEMPS - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - OEMPS.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/OEMPS.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/oemps/OEMPS.vcxproj.Filters deleted file mode 100644 index 6935f366..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/OEMPS.vcxproj.Filters +++ /dev/null @@ -1,220 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {CFF33BBA-FC87-4E95-B9C5-476E1462EEBF} - - - h;hpp;hxx;hm;inl;inc;xsd - {9BFF3627-E67C-4BAB-A7A6-BCE2D1B5C993} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {87727098-2810-47BA-A965-219906793BC2} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/command.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemps/command.cpp deleted file mode 100644 index 06e049c9..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/command.cpp +++ /dev/null @@ -1,278 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: command.cpp -// -// PURPOSE: Source module for OEM customized Command(s). -// - -#include "precomp.h" -#include "oemps.h" -#include "debug.h" -#include "command.h" -#include "resource.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// Internal String Literals -//////////////////////////////////////////////////////// - -const CHAR TEST_BEGINSTREAM[] = "%%Test: Before begin stream\r\n"; -const CHAR TEST_PSADOBE[] = "%%Test: Before %!PS-Adobe\r\n"; -const CHAR TEST_PAGESATEND[] = "%%Test: Replace driver's %%PagesAtend\r\n"; -const CHAR TEST_PAGES[] = "%%Test: Replace driver's %%Pages: (atend)\r\n"; -const CHAR TEST_DOCUMENTPROCESSCOLORS[] = "%%Test: Replace driver's %%DocumentProcessColors: (atend)\r\n"; -const CHAR TEST_COMMENTS[] = "%%Test: Before %%EndComments\r\n"; -const CHAR TEST_DEFAULTS[] = "%%Test: Before %%BeginDefaults and %%EndDefaults\r\n"; -const CHAR TEST_BEGINPROLOG[] = "%%Test: After %%BeginProlog\r\n"; -const CHAR TEST_ENDPROLOG[] = "%%Test: Before %%EndProlog\r\n"; -const CHAR TEST_BEGINSETUP[] = "%%Test: After %%BeginSetup\r\n"; -const CHAR TEST_ENDSETUP[] = "%%Test: Before %%EndSetup\r\n"; -const CHAR TEST_BEGINPAGESETUP[] = "%%Test: After %%BeginPageSetup\r\n"; -const CHAR TEST_ENDPAGESETUP[] = "%%Test: Before %%EndpageSetup\r\n"; -const CHAR TEST_PAGETRAILER[] = "%%Test: After %%PageTrailer\r\n"; -const CHAR TEST_TRAILER[] = "%%Test: After %%Trailer\r\n"; -const CHAR TEST_PAGENUMBER[] = "%%Test: Replace driver's %%Page:\r\n"; -const CHAR TEST_PAGEORDER[] = "%%Test: Replace driver's %%PageOrder:\r\n"; -const CHAR TEST_ORIENTATION[] = "%%Test: Replace driver's %%Orientation:\r\n"; -const CHAR TEST_BOUNDINGBOX[] = "%%Test: Replace driver's %%BoundingBox:\r\n"; -const CHAR TEST_DOCNEEDEDRES[] = "%%Test: Append to driver's %%DocumentNeededResourc\r\n"; -const CHAR TEST_DOCSUPPLIEDRES[] = "%%Test: Append to driver's %%DocumentSuppliedResou\r\n"; -const CHAR TEST_EOF[] = "%%Test: After %%EOF\r\n"; -const CHAR TEST_ENDSTREAM[] = "%%Test: After the last byte of job stream\r\n"; -const CHAR TEST_DOCUMENTPROCESSCOLORSATEND[] = "%%Test: DocumentProcessColorsAtend\r\n"; -const CHAR TEST_VMSAVE[] = "%%Test: %%VMSave\r\n"; -const CHAR TEST_VMRESTORE[] = "%%Test: %%VMRestore\r\n"; -const CHAR TEST_PLATECOLOR[] = "%%Test: %%PlateColor:\r\n"; -const CHAR TEST_SHOWPAGE[] = "%%Test: %%SowPage:\r\n"; -const CHAR TEST_PAGEBBOX[] = "%%Test: %%PageBox:\r\n"; -const CHAR TEST_ENDPAGECOMMENTS[] = "%%Test: %%EndPageComments:\r\n"; - - -//////////////////////////////////////////////////////////////////////////////////// -// The PSCRIPT driver calls this OEM function at specific points during output -// generation. This gives the OEM DLL an opportunity to insert code fragments -// at specific injection points in the driver's code. It should use -// DrvWriteSpoolBuf for generating any output it requires. - -HRESULT PSCommand(PDEVOBJ pdevobj, DWORD dwIndex, PVOID pData, DWORD cbSize, - IPrintOemDriverPS* pOEMHelp, PDWORD pdwReturn) -{ - PCSTR pProcedure = NULL; - DWORD dwLen = 0; - DWORD dwSize = 0; - HRESULT hResult = E_FAIL; - - VERBOSE("Entering OEMCommand...\r\n"); - - UNREFERENCED_PARAMETER(cbSize); - UNREFERENCED_PARAMETER(pData); - - switch (dwIndex) - { - case PSINJECT_BEGINSTREAM: - VERBOSE("OEMCommand PSINJECT_BEGINSTREAM\n"); - pProcedure = TEST_BEGINSTREAM; - break; - - case PSINJECT_PSADOBE: - VERBOSE("OEMCommand PSINJECT_PSADOBE\n"); - pProcedure = TEST_PSADOBE; - break; - - case PSINJECT_PAGESATEND: - VERBOSE("OEMCommand PSINJECT_PAGESATEND\n"); - pProcedure = TEST_PAGESATEND; - break; - - case PSINJECT_PAGES: - VERBOSE("OEMCommand PSINJECT_PAGES\n"); - pProcedure = TEST_PAGES; - break; - - case PSINJECT_DOCNEEDEDRES: - VERBOSE("OEMCommand PSINJECT_DOCNEEDEDRES\n"); - pProcedure = TEST_DOCNEEDEDRES; - break; - - case PSINJECT_DOCSUPPLIEDRES: - VERBOSE("OEMCommand PSINJECT_DOCSUPPLIEDRES\n"); - pProcedure = TEST_DOCSUPPLIEDRES; - break; - - case PSINJECT_PAGEORDER: - VERBOSE("OEMCommand PSINJECT_PAGEORDER\n"); - pProcedure = TEST_PAGEORDER; - break; - - case PSINJECT_ORIENTATION: - VERBOSE("OEMCommand PSINJECT_ORIENTATION\n"); - pProcedure = TEST_ORIENTATION; - break; - - case PSINJECT_BOUNDINGBOX: - VERBOSE("OEMCommand PSINJECT_BOUNDINGBOX\n"); - pProcedure = TEST_BOUNDINGBOX; - break; - - case PSINJECT_DOCUMENTPROCESSCOLORS: - VERBOSE("OEMCommand PSINJECT_DOCUMENTPROCESSCOLORS\n"); - pProcedure = TEST_DOCUMENTPROCESSCOLORS; - break; - - case PSINJECT_COMMENTS: - VERBOSE("OEMCommand PSINJECT_COMMENTS\n"); - pProcedure = TEST_COMMENTS; - break; - - case PSINJECT_BEGINDEFAULTS: - VERBOSE("OEMCommand PSINJECT_BEGINDEFAULTS\n"); - pProcedure = TEST_DEFAULTS; - break; - - case PSINJECT_ENDDEFAULTS: - VERBOSE("OEMCommand PSINJECT_BEGINDEFAULTS\n"); - pProcedure = TEST_DEFAULTS; - break; - - case PSINJECT_BEGINPROLOG: - VERBOSE("OEMCommand PSINJECT_BEGINPROLOG\n"); - pProcedure = TEST_BEGINPROLOG; - break; - - case PSINJECT_ENDPROLOG: - VERBOSE("OEMCommand PSINJECT_ENDPROLOG\n"); - pProcedure = TEST_ENDPROLOG; - break; - - case PSINJECT_BEGINSETUP: - VERBOSE("OEMCommand PSINJECT_BEGINSETUP\n"); - pProcedure = TEST_BEGINSETUP; - break; - - case PSINJECT_ENDSETUP: - VERBOSE("OEMCommand PSINJECT_ENDSETUP\n"); - pProcedure = TEST_ENDSETUP; - break; - - case PSINJECT_BEGINPAGESETUP: - VERBOSE("OEMCommand PSINJECT_BEGINPAGESETUP\n"); - pProcedure = TEST_BEGINPAGESETUP; - break; - - case PSINJECT_ENDPAGESETUP: - VERBOSE("OEMCommand PSINJECT_ENDPAGESETUP\n"); - pProcedure = TEST_ENDPAGESETUP; - break; - - case PSINJECT_PAGETRAILER: - VERBOSE("OEMCommand PSINJECT_PAGETRAILER\n"); - pProcedure = TEST_PAGETRAILER; - break; - - case PSINJECT_TRAILER: - VERBOSE("OEMCommand PSINJECT_TRAILER\n"); - pProcedure = TEST_TRAILER; - break; - - case PSINJECT_PAGENUMBER: - VERBOSE("OEMCommand PSINJECT_PAGENUMBER\n"); - pProcedure = TEST_PAGENUMBER; - break; - - case PSINJECT_EOF: - VERBOSE("OEMCommand PSINJECT_EOF\n"); - pProcedure = TEST_EOF; - break; - - case PSINJECT_ENDSTREAM: - VERBOSE("OEMCommand PSINJECT_ENDSTREAM\n"); - pProcedure = TEST_ENDSTREAM; - break; - - case PSINJECT_DOCUMENTPROCESSCOLORSATEND: - VERBOSE("OEMCommand PSINJECT_DOCUMENTPROCESSCOLORSATEND\n"); - pProcedure = TEST_DOCUMENTPROCESSCOLORSATEND; - break; - - case PSINJECT_VMSAVE: - VERBOSE("OEMCommand PSINJECT_VMSAVE\n"); - pProcedure = TEST_VMSAVE; - break; - - case PSINJECT_VMRESTORE: - VERBOSE("OEMCommand PSINJECT_VMRESTORE\n"); - pProcedure = TEST_VMRESTORE; - break; - - case PSINJECT_PLATECOLOR: - VERBOSE("OEMCommand PSINJECT_PLATECOLOR\n"); - pProcedure = TEST_PLATECOLOR; - break; - - case PSINJECT_SHOWPAGE: - VERBOSE("OEMCommand PSINJECT_SHOWPAGE\n"); - pProcedure = TEST_SHOWPAGE; - break; - - case PSINJECT_PAGEBBOX: - VERBOSE("OEMCommand PSINJECT_PAGEBBOX\n"); - pProcedure = TEST_PAGEBBOX; - break; - - case PSINJECT_ENDPAGECOMMENTS: - VERBOSE("OEMCommand PSINJECT_ENDPAGECOMMENTS\n"); - pProcedure = TEST_ENDPAGECOMMENTS; - break; - - default: - ERR("Undefined PSCommand!\r\n"); - *pdwReturn = ERROR_NOT_SUPPORTED; - return E_NOTIMPL; - } - - // INVARIANT: should have injection string. - - if(NULL != pProcedure) - { - // Write PostScript to spool file. - dwLen = (DWORD)strlen(pProcedure); - if (dwLen > 0) - { - hResult = pOEMHelp->DrvWriteSpoolBuf(pdevobj, const_cast(pProcedure), dwLen, &dwSize); - } - - // Set return values. - if(SUCCEEDED(hResult) && (dwLen == dwSize)) - { - *pdwReturn = ERROR_SUCCESS; - } - else - { - // Return a meaningful - // error value. - *pdwReturn = GetLastError(); - if(ERROR_SUCCESS == *pdwReturn) - { - *pdwReturn = ERROR_WRITE_FAULT; - } - - // Make sure we return failure - // if the write didn't succeded. - if(SUCCEEDED(hResult)) - { - hResult = HRESULT_FROM_WIN32(*pdwReturn); - } - } - } - - return hResult; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/command.h b/print/OEM Printer Customization Plug-in Samples/C++/oemps/command.h deleted file mode 100644 index e18cdfac..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/command.h +++ /dev/null @@ -1,24 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Command.h -// -// -// PURPOSE: Declare the function that handles custom -// processing of commands. -// - -#pragma once - -///////////////////////////////////////////////////////// -// Prototypes -///////////////////////////////////////////////////////// - -HRESULT PSCommand(PDEVOBJ, DWORD, PVOID, DWORD, IPrintOemDriverPS*, PDWORD); - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/ddihook.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemps/ddihook.cpp deleted file mode 100644 index e14d9cdd..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/ddihook.cpp +++ /dev/null @@ -1,1049 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: DDIHook.cpp -// -// -// PURPOSE: DDI Hook routines for User Mode COM Customization DLL. -// - -#include "precomp.h" -#include "debug.h" -#include "oemps.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -// -// OEMBitBlt -// - -BOOL APIENTRY -OEMBitBlt( - SURFOBJ *psoTrg, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclTrg, - POINTL *pptlSrc, - POINTL *pptlMask, - BRUSHOBJ *pbo, - POINTL *pptlBrush, - ROP4 rop4 - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMBitBlt() entry.\r\n"); - - pdevobj = (PDEVOBJ)psoTrg->dhpdev; - - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvBitBlt)(poempdev->pfnPS[UD_DrvBitBlt])) ( - psoTrg, - psoSrc, - psoMask, - pco, - pxlo, - prclTrg, - pptlSrc, - pptlMask, - pbo, - pptlBrush, - rop4)); - -} - -// -// OEMStretchBlt -// - -BOOL APIENTRY -OEMStretchBlt( - SURFOBJ *psoDest, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - COLORADJUSTMENT *pca, - POINTL *pptlHTOrg, - RECTL *prclDest, - RECTL *prclSrc, - POINTL *pptlMask, - ULONG iMode - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMStretchBlt() entry.\r\n"); - - pdevobj = (PDEVOBJ)psoDest->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - - // - // turn around to call PS - // - - return (((PFN_DrvStretchBlt)(poempdev->pfnPS[UD_DrvStretchBlt])) ( - psoDest, - psoSrc, - psoMask, - pco, - pxlo, - pca, - pptlHTOrg, - prclDest, - prclSrc, - pptlMask, - iMode)); - -} - - -// -// OEMCopyBits -// - -BOOL APIENTRY -OEMCopyBits( - SURFOBJ *psoDest, - SURFOBJ *psoSrc, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDest, - POINTL *pptlSrc - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMCopyBits() entry.\r\n"); - - pdevobj = (PDEVOBJ)psoDest->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvCopyBits)(poempdev->pfnPS[UD_DrvCopyBits])) ( - psoDest, - psoSrc, - pco, - pxlo, - prclDest, - pptlSrc)); - -} - -// -// OEMTextOut -// - -BOOL APIENTRY -OEMTextOut( - SURFOBJ *pso, - STROBJ *pstro, - FONTOBJ *pfo, - CLIPOBJ *pco, - RECTL *prclExtra, - RECTL *prclOpaque, - BRUSHOBJ *pboFore, - BRUSHOBJ *pboOpaque, - POINTL *pptlOrg, - MIX mix - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMTextOut() entry.\r\n"); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvTextOut)(poempdev->pfnPS[UD_DrvTextOut])) ( - pso, - pstro, - pfo, - pco, - prclExtra, - prclOpaque, - pboFore, - pboOpaque, - pptlOrg, - mix)); - -} - -// -// OEMStrokePath -// - -BOOL APIENTRY -OEMStrokePath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - XFORMOBJ *pxo, - BRUSHOBJ *pbo, - POINTL *pptlBrushOrg, - LINEATTRS *plineattrs, - MIX mix - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMStokePath() entry.\r\n"); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvStrokePath)(poempdev->pfnPS[UD_DrvStrokePath])) ( - pso, - ppo, - pco, - pxo, - pbo, - pptlBrushOrg, - plineattrs, - mix)); - -} - -// -// OEMFillPath -// - -BOOL APIENTRY -OEMFillPath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - BRUSHOBJ *pbo, - POINTL *pptlBrushOrg, - MIX mix, - FLONG flOptions - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMFillPath() entry.\r\n"); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvFillPath)(poempdev->pfnPS[UD_DrvFillPath])) ( - pso, - ppo, - pco, - pbo, - pptlBrushOrg, - mix, - flOptions)); - -} - -// -// OEMStrokeAndFillPath -// - -BOOL APIENTRY -OEMStrokeAndFillPath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - XFORMOBJ *pxo, - BRUSHOBJ *pboStroke, - LINEATTRS *plineattrs, - BRUSHOBJ *pboFill, - POINTL *pptlBrushOrg, - MIX mixFill, - FLONG flOptions - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMStrokeAndFillPath() entry.\r\n"); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvStrokeAndFillPath)(poempdev->pfnPS[UD_DrvStrokeAndFillPath])) ( - pso, - ppo, - pco, - pxo, - pboStroke, - plineattrs, - pboFill, - pptlBrushOrg, - mixFill, - flOptions)); - -} - -// -// OEMRealizeBrush -// - -BOOL APIENTRY -OEMRealizeBrush( - BRUSHOBJ *pbo, - SURFOBJ *psoTarget, - SURFOBJ *psoPattern, - SURFOBJ *psoMask, - XLATEOBJ *pxlo, - ULONG iHatch - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMRealizeBrush() entry.\r\n"); - - pdevobj = (PDEVOBJ)psoTarget->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvRealizeBrush)(poempdev->pfnPS[UD_DrvRealizeBrush])) ( - pbo, - psoTarget, - psoPattern, - psoMask, - pxlo, - iHatch)); - -} - -// -// OEMStartPage -// - -BOOL APIENTRY -OEMStartPage( - SURFOBJ *pso - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMStartPage() entry.\r\n"); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvStartPage)(poempdev->pfnPS[UD_DrvStartPage]))(pso)); - -} - -#define OEM_TESTSTRING "The DDICMDCB DLL adds this line of text." - -// -// OEMSendPage -// - -BOOL APIENTRY -OEMSendPage( - SURFOBJ *pso - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMSendPage() entry.\r\n"); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // print a line of text, just for testing - // - if (pso->iType == STYPE_BITMAP) - { - pdevobj->pDrvProcs->DrvXMoveTo(pdevobj, 0, 0); - pdevobj->pDrvProcs->DrvYMoveTo(pdevobj, 0, 0); - pdevobj->pDrvProcs->DrvWriteSpoolBuf(pdevobj, OEM_TESTSTRING, - sizeof(OEM_TESTSTRING)); - } - - // - // turn around to call PS - // - - return (((PFN_DrvSendPage)(poempdev->pfnPS[UD_DrvSendPage]))(pso)); - -} - -// -// OEMEscape -// - -ULONG APIENTRY -OEMEscape( - SURFOBJ *pso, - ULONG iEsc, - ULONG cjIn, - _In_reads_bytes_(cjIn) PVOID pvIn, - ULONG cjOut, - _Out_writes_bytes_(cjOut) PVOID pvOut - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMEscape() entry.\r\n"); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvEscape)(poempdev->pfnPS[UD_DrvEscape])) ( - pso, - iEsc, - cjIn, - pvIn, - cjOut, - pvOut)); - -} - -// -// OEMStartDoc -// - -BOOL APIENTRY -OEMStartDoc( - SURFOBJ *pso, - _In_ PWSTR pwszDocName, - DWORD dwJobId - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMStartDoc() entry.\r\n"); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvStartDoc)(poempdev->pfnPS[UD_DrvStartDoc])) ( - pso, - pwszDocName, - dwJobId)); - -} - -// -// OEMEndDoc -// - -BOOL APIENTRY -OEMEndDoc( - SURFOBJ *pso, - FLONG fl - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMEndDoc() entry.\r\n"); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvEndDoc)(poempdev->pfnPS[UD_DrvEndDoc])) ( - pso, - fl)); - -} - -//////// -// NOTE: -// OEM DLL needs to hook out the following six font related DDI calls only -// if it enumerates additional fonts beyond what's in the GPD file. -// And if it does, it needs to take care of its own fonts for all font DDI -// calls and DrvTextOut call. -/////// - -// -// OEMQueryFont -// - -PIFIMETRICS APIENTRY -OEMQueryFont( - DHPDEV dhpdev, - ULONG_PTR iFile, - ULONG iFace, - ULONG_PTR *pid - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMQueryFont() entry.\r\n"); - - pdevobj = (PDEVOBJ)dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvQueryFont)(poempdev->pfnPS[UD_DrvQueryFont])) ( - dhpdev, - iFile, - iFace, - pid)); - -} - -// -// OEMQueryFontTree -// - -PVOID APIENTRY -OEMQueryFontTree( - DHPDEV dhpdev, - ULONG_PTR iFile, - ULONG iFace, - ULONG iMode, - ULONG_PTR *pid - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMQueryFontTree() entry.\r\n"); - - pdevobj = (PDEVOBJ)dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvQueryFontTree)(poempdev->pfnPS[UD_DrvQueryFontTree])) ( - dhpdev, - iFile, - iFace, - iMode, - pid)); - -} - -// -// OEMQueryFontData -// - -LONG APIENTRY -OEMQueryFontData( - DHPDEV dhpdev, - FONTOBJ *pfo, - ULONG iMode, - HGLYPH hg, - GLYPHDATA *pgd, - _Out_writes_bytes_(cjSize) PVOID pv, - ULONG cjSize - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMQueryFontData() entry.\r\n"); - - pdevobj = (PDEVOBJ)dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS if this is not the font that OEM enumerated. - // - - return (((PFN_DrvQueryFontData)(poempdev->pfnPS[UD_DrvQueryFontData])) ( - dhpdev, - pfo, - iMode, - hg, - pgd, - pv, - cjSize)); - -} - -// -// OEMQueryAdvanceWidths -// - -BOOL APIENTRY -OEMQueryAdvanceWidths( - DHPDEV dhpdev, - FONTOBJ *pfo, - ULONG iMode, - _In_reads_(cGlyphs) HGLYPH *phg, - _Out_writes_bytes_(cGlyphs*sizeof(USHORT)) PVOID pvWidths, - ULONG cGlyphs - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMQueryAdvanceWidths() entry.\r\n"); - - pdevobj = (PDEVOBJ)dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS if this is not the font that OEM enumerated. - // - - return (((PFN_DrvQueryAdvanceWidths) - (poempdev->pfnPS[UD_DrvQueryAdvanceWidths])) ( - dhpdev, - pfo, - iMode, - phg, - pvWidths, - cGlyphs)); - -} - -// -// OEMFontManagement -// - -ULONG APIENTRY -OEMFontManagement( - SURFOBJ *pso, - FONTOBJ *pfo, - ULONG iMode, - ULONG cjIn, - _In_reads_bytes_(cjIn) PVOID pvIn, - ULONG cjOut, - _Out_writes_bytes_(cjOut) PVOID pvOut - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMFontManagement() entry.\r\n"); - - // - // Note that PS will not call OEM DLL for iMode==QUERYESCSUPPORT. - // So pso is not NULL for sure. - // - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS if this is not the font that OEM enumerated. - // - - return (((PFN_DrvFontManagement)(poempdev->pfnPS[UD_DrvFontManagement])) ( - pso, - pfo, - iMode, - cjIn, - pvIn, - cjOut, - pvOut)); - -} - -// -// OEMGetGlyphMode -// - -ULONG APIENTRY -OEMGetGlyphMode( - DHPDEV dhpdev, - FONTOBJ *pfo - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMGetGlyphMode() entry.\r\n"); - - pdevobj = (PDEVOBJ)dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS if this is not the font that OEM enumerated. - // - - return (((PFN_DrvGetGlyphMode)(poempdev->pfnPS[UD_DrvGetGlyphMode])) ( - dhpdev, - pfo)); - -} - - -// -// OEMStretchBltROP -// - -BOOL APIENTRY -OEMStretchBltROP( - SURFOBJ *psoDest, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - COLORADJUSTMENT *pca, - POINTL *pptlHTOrg, - RECTL *prclDest, - RECTL *prclSrc, - POINTL *pptlMask, - ULONG iMode, - BRUSHOBJ *pbo, - ROP4 rop4 - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMStretchBltROP() entry.\r\n"); - - pdevobj = (PDEVOBJ)psoDest->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvStretchBltROP)(poempdev->pfnPS[UD_DrvStretchBltROP])) ( - psoDest, - psoSrc, - psoMask, - pco, - pxlo, - pca, - pptlHTOrg, - prclDest, - prclSrc, - pptlMask, - iMode, - pbo, - rop4 - )); - - -} - -// -// OEMPlgBlt -// - -BOOL APIENTRY -OEMPlgBlt( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - COLORADJUSTMENT *pca, - POINTL *pptlBrushOrg, - POINTFIX *pptfixDest, - RECTL *prclSrc, - POINTL *pptlMask, - ULONG iMode - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMPlgBlt() entry.\r\n"); - - pdevobj = (PDEVOBJ)psoDst->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvPlgBlt)(poempdev->pfnPS[UD_DrvPlgBlt])) ( - psoDst, - psoSrc, - psoMask, - pco, - pxlo, - pca, - pptlBrushOrg, - pptfixDest, - prclSrc, - pptlMask, - iMode)); - -} - -// -// OEMAlphaBlend -// - -BOOL APIENTRY -OEMAlphaBlend( - SURFOBJ *psoDest, - SURFOBJ *psoSrc, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDest, - RECTL *prclSrc, - BLENDOBJ *pBlendObj - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMAlphaBlend() entry.\r\n"); - - pdevobj = (PDEVOBJ)psoDest->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvAlphaBlend)(poempdev->pfnPS[UD_DrvAlphaBlend])) ( - psoDest, - psoSrc, - pco, - pxlo, - prclDest, - prclSrc, - pBlendObj - )); - -} - -// -// OEMGradientFill -// - -BOOL APIENTRY -OEMGradientFill( - SURFOBJ *psoDest, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - TRIVERTEX *pVertex, - ULONG nVertex, - PVOID pMesh, - ULONG nMesh, - RECTL *prclExtents, - POINTL *pptlDitherOrg, - ULONG ulMode - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMGradientFill() entry.\r\n"); - - pdevobj = (PDEVOBJ)psoDest->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvGradientFill)(poempdev->pfnPS[UD_DrvGradientFill])) ( - psoDest, - pco, - pxlo, - pVertex, - nVertex, - pMesh, - nMesh, - prclExtents, - pptlDitherOrg, - ulMode - )); - -} - -BOOL APIENTRY -OEMTransparentBlt( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDst, - RECTL *prclSrc, - ULONG iTransColor, - ULONG ulReserved - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMTransparentBlt() entry.\r\n"); - - pdevobj = (PDEVOBJ)psoDst->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvTransparentBlt)(poempdev->pfnPS[UD_DrvTransparentBlt])) ( - psoDst, - psoSrc, - pco, - pxlo, - prclDst, - prclSrc, - iTransColor, - ulReserved - )); - -} - -HANDLE APIENTRY -OEMIcmCreateColorTransform( - DHPDEV dhpdev, - LPLOGCOLORSPACEW pLogColorSpace, - _In_reads_bytes_opt_(cjSourceProfile) PVOID pvSourceProfile, - ULONG cjSourceProfile, - _In_reads_bytes_(cjDestProfile) PVOID pvDestProfile, - ULONG cjDestProfile, - _In_reads_bytes_opt_(cjTargetProfile) PVOID pvTargetProfile, - ULONG cjTargetProfile, - DWORD dwReserved - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMCreateColorTransform() entry.\r\n"); - - pdevobj = (PDEVOBJ)dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvIcmCreateColorTransform)(poempdev->pfnPS[UD_DrvIcmCreateColorTransform])) ( - dhpdev, - pLogColorSpace, - pvSourceProfile, - cjSourceProfile, - pvDestProfile, - cjDestProfile, - pvTargetProfile, - cjTargetProfile, - dwReserved - )); - -} - -BOOL APIENTRY -OEMIcmDeleteColorTransform( - DHPDEV dhpdev, - HANDLE hcmXform - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMDeleteColorTransform() entry.\r\n"); - - pdevobj = (PDEVOBJ)dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvIcmDeleteColorTransform)(poempdev->pfnPS[UD_DrvIcmDeleteColorTransform])) ( - dhpdev, - hcmXform - )); - -} - -BOOL APIENTRY -OEMQueryDeviceSupport( - SURFOBJ *pso, - XLATEOBJ *pxlo, - XFORMOBJ *pxo, - ULONG iType, - ULONG cjIn, - _In_reads_bytes_(cjIn) PVOID pvIn, - ULONG cjOut, - _Out_writes_bytes_(cjOut) PVOID pvOut - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE("OEMQueryDeviceSupport() entry.\r\n"); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call PS - // - - return (((PFN_DrvQueryDeviceSupport)(poempdev->pfnPS[UD_DrvQueryDeviceSupport])) ( - pso, - pxlo, - pxo, - iType, - cjIn, - pvIn, - cjOut, - pvOut - )); -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/debug.h b/print/OEM Printer Customization Plug-in Samples/C++/oemps/debug.h deleted file mode 100644 index 0414569c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/debug.h +++ /dev/null @@ -1,82 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.H -// -// PURPOSE: Define common data types, and external function prototypes -// for debugging functions. Also defines the various debug macros. -// -// - -#pragma once - -///////////////////////////////////////////////////////// -// Macros -///////////////////////////////////////////////////////// -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// WARNING("App passed NULL pointer, ignoring...\n"); -// - -#define DBG_VERBOSE 0 -#define DBG_WARNING 1 -#define DBG_ERROR 2 -#define DBG_NONE 3 - -// VC and Build use different debug defines. -#if defined (DBG) || defined (_DEBUG) - - // __declspec(selectany) ensures that even if this is defined in multiple compilation - // modules, they will all resolve to the same symbol in the linked DLL - __declspec(selectany) INT giDebugLevel = 2; - - #define STRINGIZE(x) #x - #define QUOTE(x) STRINGIZE(x) - #define FILE_AND_LINE __FILE__ "@" QUOTE(__LINE__) - - #define VERBOSE(msg) { if(giDebugLevel <= DBG_VERBOSE) OutputDebugStringA( FILE_AND_LINE ": " msg); } - #define WARNING(msg) { if(giDebugLevel <= DBG_WARNING) OutputDebugStringA( FILE_AND_LINE ": Warning: " msg); } - #define ERR(msg) { if(giDebugLevel <= DBG_ERROR) OutputDebugStringA(FILE_AND_LINE ": Error:" msg); } - #define ASSERT(cond) { if (!(cond)) RIP("\n"); } - #define RIP(msg) { OutputDebugStringA(FILE_AND_LINE ": Error (not recoverable): " msg); DebugBreak(); } - -#else // !DBG - - #define VERBOSE(msg) - #define WARNING(msg) - #define ERR(msg) - #define ASSERT(cond) - #define RIP(msg) - -#endif - - - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/devmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemps/devmode.cpp deleted file mode 100644 index 3e66faeb..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/devmode.cpp +++ /dev/null @@ -1,151 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.cpp -// -// -// PURPOSE: Implementation of Devmode functions shared with OEM UI and OEM rendering modules. -// - -#include "precomp.h" -#include "oemps.h" -#include "debug.h" -#include "devmode.h" - - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam) -{ - POEMDEV pOEMDevIn; - POEMDEV pOEMDevOut; - - - // Verify parameters. - if( (NULL == pOemDMParam) - || - ( (OEMDM_SIZE != dwMode) - && - (OEMDM_DEFAULT != dwMode) - && - (OEMDM_CONVERT != dwMode) - && - (OEMDM_MERGE != dwMode) - ) - ) - { - ERR("DevMode() ERROR_INVALID_PARAMETER.\r\n"); - - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Cast generic (i.e. PVOID) to OEM private devomode pointer type. - pOEMDevIn = (POEMDEV) pOemDMParam->pOEMDMIn; - pOEMDevOut = (POEMDEV) pOemDMParam->pOEMDMOut; - - switch(dwMode) - { - case OEMDM_SIZE: - pOemDMParam->cbBufSize = sizeof(OEMDEV); - break; - - case OEMDM_DEFAULT: - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->dwDriverData = 0; - break; - - case OEMDM_CONVERT: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - break; - - case OEMDM_MERGE: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - MakeOEMDevmodeValid(pOEMDevOut); - break; - } - - return S_OK; -} - - -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut) -{ - if( (NULL == pOEMDevIn) - || - (NULL == pOEMDevOut) - ) - { - ERR("ConvertOEMDevmode() invalid parameters.\r\n"); - return FALSE; - } - - // Check OEM Signature, if it doesn't match ours, - // then just assume DMIn is bad and use defaults. - if(pOEMDevIn->dmOEMExtra.dwSignature == pOEMDevOut->dmOEMExtra.dwSignature) - { - VERBOSE("Converting private OEM Devmode.\r\n"); - - // Set the devmode defaults so that anything the isn't copied over will - // be set to the default value. - pOEMDevOut->dwDriverData = 0; - - // Copy the old structure in to the new using which ever size is the smaller. - // Devmode maybe from newer Devmode (not likely since there is only one), or - // Devmode maybe a newer Devmode, in which case it maybe larger, - // but the first part of the structure should be the same. - - // DESIGN ASSUMPTION: the private DEVMODE structure only gets added to; - // the fields that are in the DEVMODE never change only new fields get added to the end. - - memcpy(pOEMDevOut, pOEMDevIn, __min(pOEMDevOut->dmOEMExtra.dwSize, pOEMDevIn->dmOEMExtra.dwSize)); - - // Re-fill in the size and version fields to indicated - // that the DEVMODE is the current private DEVMODE version. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - } - else - { - WARNING("Unknown DEVMODE signature, pOEMDMIn ignored.\r\n"); - - // Don't know what the input DEVMODE is, so just use defaults. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->dwDriverData = 0; - } - - return TRUE; -} - - -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode) -{ - if(NULL == pOEMDevmode) - { - return FALSE; - } - - // ASSUMPTION: pOEMDevmode is large enough to contain OEMDEV structure. - - // Make sure that dmOEMExtra indicates the current OEMDEV structure. - pOEMDevmode->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevmode->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevmode->dmOEMExtra.dwVersion = OEM_VERSION; - - // Set driver data. - pOEMDevmode->dwDriverData = 0; - - return TRUE; -} - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/devmode.h b/print/OEM Printer Customization Plug-in Samples/C++/oemps/devmode.h deleted file mode 100644 index 3cf13641..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/devmode.h +++ /dev/null @@ -1,44 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.h -// -// -// PURPOSE: Define common data types, and external function prototypes -// for devmode functions. -// -#pragma once - -//////////////////////////////////////////////////////// -// OEM Devmode Defines -//////////////////////////////////////////////////////// - -#define OEM_SIGNATURE 'MSFT' -#define OEM_VERSION 0x00000001L - -//////////////////////////////////////////////////////// -// OEM Devmode Type Definitions -//////////////////////////////////////////////////////// - -typedef struct tagOEMDEV -{ - OEM_DMEXTRAHEADER dmOEMExtra; - BOOL dwDriverData; - -} OEMDEV, *POEMDEV; - -typedef const OEMDEV *PCOEMDEV; - -///////////////////////////////////////////////////////// -// Prototypes -///////////////////////////////////////////////////////// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam); -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut); -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode); -void Dump(PCOEMDEV pOEMDevIn); - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/dllentry.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemps/dllentry.cpp deleted file mode 100644 index d9851eff..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/dllentry.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cpp -// -// -// PURPOSE: Source module for DLL entry function(s). -// - -#include "precomp.h" -#include "oemps.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////////////////////////// -// -// DLL entry point -// -BOOL WINAPI DllMain(HINSTANCE hInst, WORD wReason, LPVOID lpReserved) -{ - UNREFERENCED_PARAMETER(hInst); - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - VERBOSE("Process attach.\r\n"); - break; - - case DLL_THREAD_ATTACH: - VERBOSE("Thread attach.\r\n"); - break; - - case DLL_PROCESS_DETACH: - VERBOSE("Process detach.\r\n"); - break; - - case DLL_THREAD_DETACH: - VERBOSE("Thread detach.\r\n"); - break; - } - - return TRUE; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemps/intrface.cpp deleted file mode 100644 index 34f0914c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/intrface.cpp +++ /dev/null @@ -1,632 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.cpp -// -// -// PURPOSE: Interface for User Mode COM Customization DLL. -// - -#include "precomp.h" - -#include "debug.h" - -#include "devmode.h" -#include "oemps.h" -#include "command.h" -#include "intrface.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -//////////////////////////////////////////////////////// -// Internal Globals -//////////////////////////////////////////////////////// - -static long g_cComponents; // Count of active components -static long g_cServerLocks; // Count of locks - -//////////////////////////////////////////////////////// -// Internal Constants -//////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////// -// Warning: the following array order must match the -// order in enum ENUMHOOKS. -/////////////////////////////////////////////////////// -static const DRVFN OEMHookFuncs[] = -{ - { INDEX_DrvRealizeBrush, (PFN) OEMRealizeBrush }, - { INDEX_DrvCopyBits, (PFN) OEMCopyBits }, - { INDEX_DrvBitBlt, (PFN) OEMBitBlt }, - { INDEX_DrvStretchBlt, (PFN) OEMStretchBlt }, - { INDEX_DrvTextOut, (PFN) OEMTextOut }, - { INDEX_DrvStrokePath, (PFN) OEMStrokePath }, - { INDEX_DrvFillPath, (PFN) OEMFillPath }, - { INDEX_DrvStrokeAndFillPath, (PFN) OEMStrokeAndFillPath }, - { INDEX_DrvStartPage, (PFN) OEMStartPage }, - { INDEX_DrvSendPage, (PFN) OEMSendPage }, - { INDEX_DrvEscape, (PFN) OEMEscape }, - { INDEX_DrvStartDoc, (PFN) OEMStartDoc }, - { INDEX_DrvEndDoc, (PFN) OEMEndDoc }, - { INDEX_DrvQueryFont, (PFN) OEMQueryFont }, - { INDEX_DrvQueryFontTree, (PFN) OEMQueryFontTree }, - { INDEX_DrvQueryFontData, (PFN) OEMQueryFontData }, - { INDEX_DrvQueryAdvanceWidths, (PFN) OEMQueryAdvanceWidths }, - { INDEX_DrvFontManagement, (PFN) OEMFontManagement }, - { INDEX_DrvGetGlyphMode, (PFN) OEMGetGlyphMode }, - { INDEX_DrvStretchBltROP, (PFN) OEMStretchBltROP }, - { INDEX_DrvPlgBlt, (PFN) OEMPlgBlt }, - { INDEX_DrvTransparentBlt, (PFN) OEMTransparentBlt }, - { INDEX_DrvAlphaBlend, (PFN) OEMAlphaBlend }, - { INDEX_DrvGradientFill, (PFN) OEMGradientFill }, - { INDEX_DrvIcmCreateColorTransform, (PFN) OEMIcmCreateColorTransform }, - { INDEX_DrvIcmDeleteColorTransform, (PFN) OEMIcmDeleteColorTransform }, - { INDEX_DrvQueryDeviceSupport, (PFN) OEMQueryDeviceSupport }, -}; - - -//////////////////////////////////////////////////////////////////////////////// -// -// IOemPS body -// -IOemPS::IOemPS() : m_cRef(1) -{ - VERBOSE("IOemPS::IOemPS() entered.\r\n"); - - // Increment COM component count. - InterlockedIncrement(&g_cComponents); - - m_pOEMHelp = NULL; - - VERBOSE("IOemPS::IOemPS() leaving.\r\n"); -} - - -IOemPS::~IOemPS() -{ - // Make sure that helper interface is released. - if(NULL != m_pOEMHelp) - { - m_pOEMHelp->Release(); - m_pOEMHelp = NULL; - } - - // If this instance of the object is being deleted, then the reference - // count should be zero. - assert(0 == m_cRef); - - // Decrement COM compontent count. - InterlockedDecrement(&g_cComponents); -} - - -HRESULT __stdcall IOemPS::QueryInterface(const IID& iid, void** ppv) -{ - if (iid == IID_IUnknown) - { - *ppv = static_cast(this); - VERBOSE("IOemPS::QueryInterface IUnknown.\r\n"); - } - else if (iid == IID_IPrintOemPS) - { - *ppv = static_cast(this); - VERBOSE("IOemPS::QueryInterface IPrintOemPs.\r\n"); - } - else - { - VERBOSE("IOemPS::QueryInterface (interface not supported).\r\n"); - *ppv = NULL; - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -ULONG __stdcall IOemPS::AddRef() -{ - VERBOSE("IOemPS::AddRef() entry.\r\n"); - return InterlockedIncrement(&m_cRef); -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemPS::Release() -{ - VERBOSE("IOemPS::Release() entry.\r\n"); - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - - -HRESULT __stdcall IOemPS::GetInfo ( - DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded) -{ - VERBOSE("IOemPS::GetInfo(%d) entry.\r\n"); - - // Validate parameters. - if( (NULL == pcbNeeded) - || - ( (OEMGI_GETSIGNATURE != dwMode) - && - (OEMGI_GETVERSION != dwMode) - && - (OEMGI_GETPUBLISHERINFO != dwMode) - ) - ) - { - ERR("IOemPS::GetInfo() exit pcbNeeded is NULL!\r\n"); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Set expected buffer size. - if(OEMGI_GETPUBLISHERINFO != dwMode) - { - *pcbNeeded = sizeof(DWORD); - } - else - { - *pcbNeeded = sizeof(PUBLISHERINFO); - return E_FAIL; - } - - // Check buffer size is sufficient. - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - ERR("IOemPS::GetInfo() exit insufficient buffer!\r\n"); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return E_FAIL; - } - - switch(dwMode) - { - // OEM DLL Signature - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // OEM DLL version - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // dwMode not supported. - case OEMGI_GETPUBLISHERINFO: - case OEMGI_GETREQUESTEDHELPERINTERFACES: - default: - // Set written bytes to zero since nothing was written. - ERR("IOemPS::GetInfo() exit, mode not supported.\r\n"); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - return E_FAIL; - } - - return S_OK; -} - -HRESULT __stdcall IOemPS::PublishDriverInterface( - IUnknown *pIUnknown) -{ - VERBOSE("IOemPS::PublishDriverInterface() entry.\r\n"); - - // Need to store pointer to Driver Helper functions, if we already haven't. - if (this->m_pOEMHelp == NULL) - { - HRESULT hResult; - - - // Get Interface to Helper Functions. - hResult = pIUnknown->QueryInterface(IID_IPrintOemDriverPS, (void** ) &(this->m_pOEMHelp)); - - if(!SUCCEEDED(hResult)) - { - // Make sure that interface pointer reflects interface query failure. - this->m_pOEMHelp = NULL; - - return E_FAIL; - } - } - - return S_OK; -} - - -HRESULT __stdcall IOemPS::EnableDriver(DWORD dwDriverVersion, - DWORD cbSize, - PDRVENABLEDATA pded) -{ - VERBOSE("IOemPS::EnableDriver() entry.\r\n"); - - UNREFERENCED_PARAMETER(dwDriverVersion); - UNREFERENCED_PARAMETER(cbSize); - - // List DDI functions that are hooked. - pded->iDriverVersion = PRINTER_OEMINTF_VERSION; - pded->c = sizeof(OEMHookFuncs) / sizeof(DRVFN); - pded->pdrvfn = (DRVFN *) OEMHookFuncs; - - // Even if nothing is done, need to return S_OK so - // that DisableDriver() will be called, which releases - // the reference to the Printer Driver's interface. - // If error occurs, return E_FAIL. - return S_OK; -} - -HRESULT __stdcall IOemPS::DisableDriver(VOID) -{ - VERBOSE("IOemPS::DisaleDriver() entry.\r\n"); - - // Release reference to Printer Driver's interface. - if (this->m_pOEMHelp) - { - this->m_pOEMHelp->Release(); - this->m_pOEMHelp = NULL; - } - - return S_OK; -} - -HRESULT __stdcall IOemPS::DisablePDEV( - PDEVOBJ pdevobj) -{ - VERBOSE("IOemPS::DisablePDEV() entry.\r\n"); - - // - // Free memory for OEMPDEV and any memory block that hangs off OEMPDEV. - // - assert(NULL != pdevobj->pdevOEM); - delete pdevobj->pdevOEM; - - return S_OK; -}; - -HRESULT __stdcall IOemPS::EnablePDEV( - PDEVOBJ pdevobj, - _In_ PWSTR pPrinterName, - ULONG cPatterns, - HSURF *phsurfPatterns, - ULONG cjGdiInfo, - GDIINFO *pGdiInfo, - ULONG cjDevInfo, - DEVINFO *pDevInfo, - DRVENABLEDATA *pded, - OUT PDEVOEM *pDevOem) -{ - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(cPatterns); - UNREFERENCED_PARAMETER(phsurfPatterns); - UNREFERENCED_PARAMETER(cjGdiInfo); - UNREFERENCED_PARAMETER(pGdiInfo); - UNREFERENCED_PARAMETER(cjDevInfo); - UNREFERENCED_PARAMETER(pDevInfo); - - VERBOSE("IOemPS::EnablePDEV() entry.\r\n"); - - POEMPDEV poempdev; - INT i, j; - DWORD dwDDIIndex; - PDRVFN pdrvfn; - - // - // Allocate the OEMDev - // - poempdev = new OEMPDEV; - if (NULL == poempdev) - { - return E_FAIL; - } - - // - // Fill in OEMDEV - // - - for (i = 0; i < MAX_DDI_HOOKS; i++) - { - // - // search through PS's hooks and locate the function ptr - // - dwDDIIndex = OEMHookFuncs[i].iFunc; - for (j = pded->c, pdrvfn = pded->pdrvfn; j > 0; j--, pdrvfn++) - { - if (dwDDIIndex == pdrvfn->iFunc) - { - poempdev->pfnPS[i] = pdrvfn->pfn; - break; - } - } - if (j == 0) - { - // - // Didn't find the hook. This could mean PS doesn't hook this DDI but allows OEMs to hook it out. - // - poempdev->pfnPS[i] = NULL; - } - - } - - *pDevOem = (POEMPDEV) poempdev; - - return S_OK; -} - - -HRESULT __stdcall IOemPS::ResetPDEV( - PDEVOBJ pdevobjOld, - PDEVOBJ pdevobjNew) -{ - UNREFERENCED_PARAMETER(pdevobjOld); - UNREFERENCED_PARAMETER(pdevobjNew); - - VERBOSE("IOemPS::ResetPDEV() entry.\r\n"); - - // - // If any information from the previous PDEV needs to be preserved, - // copy it in this function. - // - - return TRUE; -} - - -HRESULT __stdcall IOemPS::DevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam) -{ - VERBOSE("IOemPS:DevMode entry.\n"); - return hrOEMDevMode(dwMode, pOemDMParam); -} - -HRESULT __stdcall IOemPS::Command( - PDEVOBJ pdevobj, - DWORD dwIndex, - PVOID pData, - DWORD cbSize, - OUT DWORD *pdwResult) -{ - HRESULT hResult = E_NOTIMPL; - - - VERBOSE("IOemPS::Command() entry.\r\n"); - hResult = PSCommand(pdevobj, dwIndex, pData, cbSize, m_pOEMHelp, pdwResult); - - return hResult; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// oem class factory -// -class IOemCF : public IClassFactory -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // *** IClassFactory methods *** - STDMETHOD(CreateInstance) (THIS_ - LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID FAR* ppvObject); - STDMETHOD(LockServer) (THIS_ BOOL bLock); - - - // Constructor - IOemCF(); - ~IOemCF(); - -protected: - long m_cRef; -}; - -/////////////////////////////////////////////////////////// -// -// Class factory body -// -IOemCF::IOemCF() : m_cRef(1) -{ - VERBOSE("IOemCF::IOemCF() entered.\r\n"); -} - -IOemCF::~IOemCF() -{ - VERBOSE("IOemCF::~IOemCF() entered.\r\n"); - - // If this instance of the object is being deleted, then the reference - // count should be zero. - assert(0 == m_cRef); -} - -HRESULT __stdcall IOemCF::QueryInterface(const IID& iid, void** ppv) -{ - VERBOSE("IOemCF::QueryInterface entered.\r\n"); - - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this); - } - else - { - WARNING("IOemCF::QueryInterface (interface not supported).\r\n"); - *ppv = NULL; - return E_NOINTERFACE; - } - - reinterpret_cast(*ppv)->AddRef(); - - VERBOSE("IOemCF::QueryInterface leaving.\r\n"); - - return S_OK; -} - -ULONG __stdcall IOemCF::AddRef() -{ - VERBOSE("IOemCF::AddRef() called.\r\n"); - return InterlockedIncrement(&m_cRef); -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemCF::Release() -{ - VERBOSE("IOemCF::Release() called.\r\n"); - - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -// IClassFactory implementation -HRESULT __stdcall IOemCF::CreateInstance(IUnknown* pUnknownOuter, - const IID& iid, - void** ppv) -{ - VERBOSE("Class factory: Create component.\r\n"); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Cannot aggregate. - if (pUnknownOuter != NULL) - { - WARNING("Class factory: non-Null pUnknownOuter.\r\n"); - - return CLASS_E_NOAGGREGATION; - } - - // Create component. - IOemPS* pOemCP = new IOemPS; - if (pOemCP == NULL) - { - ERR("Class factory: failed to allocate IOemPS.\r\n"); - - return E_OUTOFMEMORY; - } - - // Get the requested interface. - HRESULT hr = pOemCP->QueryInterface(iid, ppv); - - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - pOemCP->Release(); - return hr; -} - -// LockServer -HRESULT __stdcall IOemCF::LockServer(BOOL bLock) -{ - VERBOSE("IOemCF::LockServer entered.\r\n"); - - if (bLock) - { - InterlockedIncrement(&g_cServerLocks); - } - else - { - InterlockedDecrement(&g_cServerLocks); - } - - VERBOSE("IOemCF::LockServer() leaving.\r\n"); - return S_OK; -} - - -// -// Registration functions -// - -// -// Can DLL unload now? -// -STDAPI DllCanUnloadNow() -{ - // - // To avoid leaving OEM DLL still in memory when Unidrv or Pscript drivers - // are unloaded, Unidrv and Pscript driver ignore the return value of - // DllCanUnloadNow of the OEM DLL, and always call FreeLibrary on the OEMDLL. - // - // If OEM DLL spins off a working thread that also uses the OEM DLL, the - // thread needs to call LoadLibrary and FreeLibraryAndExitThread, otherwise - // it may crash after Unidrv or Pscript calls FreeLibrary. - // - - VERBOSE("DllCanUnloadNow entered.\r\n"); - - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK; - } - else - { - return S_FALSE; - } -} - -// -// Get class factory -// -STDAPI DllGetClassObject( - _In_ REFCLSID clsid, - _In_ REFIID iid, - _Outptr_ LPVOID* ppv) -{ - VERBOSE("DllGetClassObject: Create class factory entered.\r\n"); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Can we create this component? - if (clsid != CLSID_OEMRENDER) - { - WARNING("DllGetClassObject: doesn't support clsid!\r\n"); - return CLASS_E_CLASSNOTAVAILABLE; - } - - // Create class factory. - IOemCF* pFontCF = new IOemCF; // Reference count set to 1 - // in constructor - if (pFontCF == NULL) - { - WARNING("DllGetClassObject: memory allocation failed!\r\n"); - return E_OUTOFMEMORY; - } - - // Get requested interface. - HRESULT hr = pFontCF->QueryInterface(iid, ppv); - pFontCF->Release(); - - return hr; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/oemps/intrface.h deleted file mode 100644 index 87b00473..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/intrface.h +++ /dev/null @@ -1,119 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.H -// -// -// PURPOSE: Define COM interface for User Mode Printer Customization DLL. -// -#pragma once - -//////////////////////////////////////////////////////////////////////////////// -// -// IOemPS -// -// Interface for PostScript OEM sample rendering module -// -class IOemPS : public IPrintOemPS -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // *** IPrintOemPS methods *** - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Method for OEM to specify DDI hook out - // - - STDMETHOD(EnableDriver) (THIS_ DWORD DriverVersion, - DWORD cbSize, - PDRVENABLEDATA pded); - - // - // Method to notify OEM plugin that it is no longer required - // - - STDMETHOD(DisableDriver) (THIS); - - // - // Method for OEM to contruct its own PDEV - // - - STDMETHOD(EnablePDEV) (THIS_ PDEVOBJ pdevobj, - _In_ PWSTR pPrinterName, - ULONG cPatterns, - HSURF *phsurfPatterns, - ULONG cjGdiInfo, - GDIINFO *pGdiInfo, - ULONG cjDevInfo, - DEVINFO *pDevInfo, - DRVENABLEDATA *pded, - OUT PDEVOEM *pDevOem); - - // - // Method for OEM to free any resource associated with its PDEV - // - - STDMETHOD(DisablePDEV) (THIS_ PDEVOBJ pdevobj); - - // - // Method for OEM to transfer from old PDEV to new PDEV - // - - STDMETHOD(ResetPDEV) (THIS_ PDEVOBJ pdevobjOld, - PDEVOBJ pdevobjNew); - - - // - // Get OEM dll related information - // - - STDMETHOD(GetInfo) (THIS_ DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded); - // - // OEMDevMode - // - - STDMETHOD(DevMode) (THIS_ DWORD dwMode, - POEMDMPARAM pOemDMParam); - - // - // OEMCommand - PSCRIPT only, return E_NOTIMPL on Unidrv - // - - STDMETHOD(Command) (THIS_ PDEVOBJ pdevobj, - DWORD dwIndex, - PVOID pData, - DWORD cbSize, - OUT DWORD *pdwResult); - - IOemPS(); - ~IOemPS(); - -protected: - - long m_cRef; - - IPrintOemDriverPS* m_pOEMHelp; -}; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/oemps.def b/print/OEM Printer Customization Plug-in Samples/C++/oemps/oemps.def deleted file mode 100644 index 9992eb3e..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/oemps.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY OEMPS -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/oemps.h b/print/OEM Printer Customization Plug-in Samples/C++/oemps/oemps.h deleted file mode 100644 index 4fc07721..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/oemps.h +++ /dev/null @@ -1,76 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: OEMPS.H -// -// -// PURPOSE: Define common data types, and external function prototypes -// for oemps.cpp. -// -#pragma once - - -/////////////////////////////////////////////////////// -// Warning: the following enum order must match the -// order in OEMHookFuncs[]. -/////////////////////////////////////////////////////// -typedef enum tag_Hooks { - UD_DrvRealizeBrush, - UD_DrvCopyBits, - UD_DrvBitBlt, - UD_DrvStretchBlt, - UD_DrvTextOut, - UD_DrvStrokePath, - UD_DrvFillPath, - UD_DrvStrokeAndFillPath, - UD_DrvStartPage, - UD_DrvSendPage, - UD_DrvEscape, - UD_DrvStartDoc, - UD_DrvEndDoc, - UD_DrvQueryFont, - UD_DrvQueryFontTree, - UD_DrvQueryFontData, - UD_DrvQueryAdvanceWidths, - UD_DrvFontManagement, - UD_DrvGetGlyphMode, - UD_DrvStretchBltROP, - UD_DrvPlgBlt, - UD_DrvTransparentBlt, - UD_DrvAlphaBlend, - UD_DrvGradientFill, - UD_DrvIcmCreateColorTransform, - UD_DrvIcmDeleteColorTransform, - UD_DrvQueryDeviceSupport, - - MAX_DDI_HOOKS, - -} ENUMHOOKS; - - -typedef struct _OEMPDEV { - // - // define whatever needed, such as working buffers, tracking information, - // etc. - // - // This test DLL hooks out every drawing DDI. So it needs to remember - // PS's hook function pointer so it call back. - // - PFN pfnPS[MAX_DDI_HOOKS]; - - // - // define whatever needed, such as working buffers, tracking information, - // etc. - // - DWORD dwReserved[1]; - -} OEMPDEV, *POEMPDEV; - - - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/oemps/precomp.h deleted file mode 100644 index 4efe4e6f..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/precomp.h +++ /dev/null @@ -1,47 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: precomp.h -// -// PURPOSE: Header files that should be in the precompiled header. -// -#pragma once - -// Necessary for compiling under VC. -#if(!defined(WINVER) || (WINVER < 0x0500)) - #undef WINVER - #define WINVER 0x0500 -#endif -#if(!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)) - #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0500 -#endif - - -// Required header files that shouldn't change often. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// StrSafe.h needs to be included last -// to disallow unsafe string functions. -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemps/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemps/resource.h b/print/OEM Printer Customization Plug-in Samples/C++/oemps/resource.h deleted file mode 100644 index 48f784ad..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemps/resource.h +++ /dev/null @@ -1,15 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by OEMPS.rc -// - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui.ini b/print/OEM Printer Customization Plug-in Samples/C++/oemui.ini deleted file mode 100644 index 6324a104..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui.ini +++ /dev/null @@ -1,3 +0,0 @@ -[OEMFiles] -OEMConfigFile1=OEMUI.DLL - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.def b/print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.def deleted file mode 100644 index 68bdffc0..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY OEMUI -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.rc b/print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.rc deleted file mode 100644 index c9968413..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.rc +++ /dev/null @@ -1,169 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Written by Windows Printing & Imaging Team" - VALUE "CompanyName", "Microsoft Corp." - VALUE "FileDescription", "OEM UI Test Module." - VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "OEMUI" - VALUE "LegalCopyright", "Copyright 1998 - 2003 Microsoft Corp." - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation" - VALUE "OriginalFilename", "OEMUI.dll" - VALUE "ProductName", "Microsoft OEMUI" - VALUE "ProductVersion", "1.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_DEVICE_PROPPAGE DIALOG 0, 0, 179, 113 -STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Device Property Page" -FONT 8, "MS Shell Dialog" -BEGIN - LTEXT "OEM UI Added Page",IDC_STATIC,55,14,68,11 - PUSHBUTTON "Calibrate",IDC_CALIBRATE,61,34,50,14 -END - -IDD_DOC_PROPPAGE DIALOG 0, 0, 210, 154 -STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Document Property Page" -FONT 8, "MS Shell Dialog" -BEGIN - LTEXT "OEM UI Document Property Page",IDC_STATIC,60,73,108,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_DEVICE_PROPPAGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 172 - TOPMARGIN, 8 - BOTTOMMARGIN, 106 - END - - IDD_DOC_PROPPAGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 203 - TOPMARGIN, 7 - BOTTOMMARGIN, 147 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_SECTION "OEM UI Added Item" - IDS_CALIBRATED "Printer has been calibrated." - IDS_NAME "OEM UI Customization DLL" - IDS_DEV_SECTION "Device Settings OEM UI Added Item" - IDS_ADV_SECTION "Advanced OEM UI Added Item" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.vcxproj deleted file mode 100644 index 7c5e5bcc..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.vcxproj +++ /dev/null @@ -1,1042 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {452209BF-AEB7-457D-956B-90CDE70CED7D} - $(MSBuildProjectName) - Win10 Debug - Win32 - {84C69391-30E8-404B-B0F2-7C88DEB2A456} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - OEMUI - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;advapi32.lib;uuid.lib - - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - OEMUI.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.vcxproj.Filters deleted file mode 100644 index 07492222..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/OEMUI.vcxproj.Filters +++ /dev/null @@ -1,220 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {03B02FF3-CA63-4469-8907-F08C69CCE4DC} - - - h;hpp;hxx;hm;inl;inc;xsd - {5AE6A39D-71A9-44D0-B561-2746C654DA3B} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {C46C5ADA-08FD-4FA4-829D-1007F014DC71} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/debug.h b/print/OEM Printer Customization Plug-in Samples/C++/oemui/debug.h deleted file mode 100644 index 0414569c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/debug.h +++ /dev/null @@ -1,82 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.H -// -// PURPOSE: Define common data types, and external function prototypes -// for debugging functions. Also defines the various debug macros. -// -// - -#pragma once - -///////////////////////////////////////////////////////// -// Macros -///////////////////////////////////////////////////////// -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// WARNING("App passed NULL pointer, ignoring...\n"); -// - -#define DBG_VERBOSE 0 -#define DBG_WARNING 1 -#define DBG_ERROR 2 -#define DBG_NONE 3 - -// VC and Build use different debug defines. -#if defined (DBG) || defined (_DEBUG) - - // __declspec(selectany) ensures that even if this is defined in multiple compilation - // modules, they will all resolve to the same symbol in the linked DLL - __declspec(selectany) INT giDebugLevel = 2; - - #define STRINGIZE(x) #x - #define QUOTE(x) STRINGIZE(x) - #define FILE_AND_LINE __FILE__ "@" QUOTE(__LINE__) - - #define VERBOSE(msg) { if(giDebugLevel <= DBG_VERBOSE) OutputDebugStringA( FILE_AND_LINE ": " msg); } - #define WARNING(msg) { if(giDebugLevel <= DBG_WARNING) OutputDebugStringA( FILE_AND_LINE ": Warning: " msg); } - #define ERR(msg) { if(giDebugLevel <= DBG_ERROR) OutputDebugStringA(FILE_AND_LINE ": Error:" msg); } - #define ASSERT(cond) { if (!(cond)) RIP("\n"); } - #define RIP(msg) { OutputDebugStringA(FILE_AND_LINE ": Error (not recoverable): " msg); DebugBreak(); } - -#else // !DBG - - #define VERBOSE(msg) - #define WARNING(msg) - #define ERR(msg) - #define ASSERT(cond) - #define RIP(msg) - -#endif - - - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/devmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemui/devmode.cpp deleted file mode 100644 index dd9ff650..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/devmode.cpp +++ /dev/null @@ -1,182 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.cpp -// -// -// PURPOSE: Implementation of Devmode functions shared with OEM UI and OEM rendering modules. -// - -#include "precomp.h" -#include "debug.h" -#include "devmode.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -// -//Performs operation on UI Plugins Private DevMode Members. -//Called via IOemUI::DevMode -// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam) -{ - POEMDEV pOEMDevIn; - POEMDEV pOEMDevOut; - - - // Verify parameters. - if( (NULL == pOemDMParam) - || - ( (OEMDM_SIZE != dwMode) - && - (OEMDM_DEFAULT != dwMode) - && - (OEMDM_CONVERT != dwMode) - && - (OEMDM_MERGE != dwMode) - ) - ) - { - ERR("DevMode() ERROR_INVALID_PARAMETER.\r\n"); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Cast generic (i.e. PVOID) to OEM private devomode pointer type. - pOEMDevIn = (POEMDEV) pOemDMParam->pOEMDMIn; - pOEMDevOut = (POEMDEV) pOemDMParam->pOEMDMOut; - - switch(dwMode) - { - // - //The Method should return the size of the memory allocation needed to store the UI plugin Private DEVMODE. - // - case OEMDM_SIZE: - pOemDMParam->cbBufSize = sizeof(OEMDEV); - break; - - // - //Should fill the Private DEVMODE with the default values. - // - case OEMDM_DEFAULT: - // - //OEM_DMEXTRAHEADER Members - // - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - - // - //Private members - // - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - break; - - // - //The method should convert private DEVMODE members to the current version, if necessary. - // - case OEMDM_CONVERT: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - break; - - // - //The method should validate the information contained in private DEVMODE members and merge validated values into a private DEVMODE structure containing default values - // - case OEMDM_MERGE: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - MakeOEMDevmodeValid(pOEMDevOut); - break; - } - - return S_OK; -} - - -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut) -{ - if( (NULL == pOEMDevIn) - || - (NULL == pOEMDevOut) - ) - { - ERR("ConvertOEMDevmode() invalid parameters.\r\n"); - return FALSE; - } - - // Check OEM Signature, if it doesn't match ours, - // then just assume DMIn is bad and use defaults. - if(pOEMDevIn->dmOEMExtra.dwSignature == pOEMDevOut->dmOEMExtra.dwSignature) - { - VERBOSE("Converting private OEM Devmode.\r\n"); - - // Set the devmode defaults so that anything the isn't copied over will - // be set to the default value. - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - - // Copy the old structure in to the new using which ever size is the smaller. - // Devmode maybe from newer Devmode (not likely since there is only one), or - // Devmode maybe a newer Devmode, in which case it maybe larger, - // but the first part of the structure should be the same. - - // DESIGN ASSUMPTION: the private DEVMODE structure only gets added to; - // the fields that are in the DEVMODE never change only new fields get added to the end. - - memcpy(pOEMDevOut, pOEMDevIn, __min(pOEMDevOut->dmOEMExtra.dwSize, pOEMDevIn->dmOEMExtra.dwSize)); - - // Re-fill in the size and version fields to indicated - // that the DEVMODE is the current private DEVMODE version. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - } - else - { - WARNING("Unknown DEVMODE signature, pOEMDMIn ignored.\r\n"); - - // Don't know what the input DEVMODE is, so just use defaults. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->dwDriverData = 0; - pOEMDevOut->dwAdvancedData = 0; - } - - return TRUE; -} - - -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode) -{ - if(NULL == pOEMDevmode) - { - return FALSE; - } - - // ASSUMPTION: pOEMDevmode is large enough to contain OEMDEV structure. - - // Make sure that dmOEMExtra indicates the current OEMDEV structure. - pOEMDevmode->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevmode->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevmode->dmOEMExtra.dwVersion = OEM_VERSION; - - // Set driver data, if not valid. - if(pOEMDevmode->dwDriverData > 100) - { - pOEMDevmode->dwDriverData = 0; - } - - // Set Advanced driver data, if not valid. - if(pOEMDevmode->dwAdvancedData > 100) - { - pOEMDevmode->dwAdvancedData = 0; - } - - return TRUE; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/devmode.h b/print/OEM Printer Customization Plug-in Samples/C++/oemui/devmode.h deleted file mode 100644 index 3dcbba25..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/devmode.h +++ /dev/null @@ -1,52 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.h -// -// PURPOSE: Define common data types, and external function prototypes -// for devmode functions. -// - -#pragma once - -//////////////////////////////////////////////////////// -// OEM Devmode Defines -//////////////////////////////////////////////////////// - -#define OEM_SIGNATURE 'MSFT' -#define OEM_VERSION 0x00000001L - -//////////////////////////////////////////////////////// -// OEM Devmode Type Definitions -//////////////////////////////////////////////////////// - -// -// This structure must be prefixed by OEM_DMEXTRAHEADER -// Plug-ins must implement the IPrintOemUI::DevMode method -// -typedef struct tagOEMDEV -{ - OEM_DMEXTRAHEADER dmOEMExtra; - DWORD dwDriverData; - DWORD dwAdvancedData; - - // - //Private DevMode Members - // - -} OEMDEV, *POEMDEV; - -typedef const OEMDEV *PCOEMDEV; - - -///////////////////////////////////////////////////////// -// ProtoTypes -///////////////////////////////////////////////////////// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam); -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut); -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode); diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/dllentry.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemui/dllentry.cpp deleted file mode 100644 index 0823030c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/dllentry.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cpp -// -// PURPOSE: Source module for DLL entry function(s). -// - -#include "precomp.h" -#include "debug.h" -#include "globals.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////////////////////////// -// -// DLL entry point -// -BOOL WINAPI DllMain(HINSTANCE hInst, WORD wReason, LPVOID lpReserved) -{ - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - VERBOSE("Process attach.\r\n"); - ghInstance = hInst; - break; - - case DLL_THREAD_ATTACH: - VERBOSE("Thread attach.\r\n"); - break; - - case DLL_PROCESS_DETACH: - VERBOSE("Process detach.\r\n"); - break; - - case DLL_THREAD_DETACH: - VERBOSE("Thread detach.\r\n"); - break; - } - - return TRUE; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/globals.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemui/globals.cpp deleted file mode 100644 index 40cfbbc2..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/globals.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Globals.cpp -// -// PURPOSE: File that contains all the globals. -// - -#include "precomp.h" -#include "globals.h" - - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -// Module's Instance handle from DLLEntry of process. -HINSTANCE ghInstance = NULL; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/globals.h b/print/OEM Printer Customization Plug-in Samples/C++/oemui/globals.h deleted file mode 100644 index c809fdc6..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/globals.h +++ /dev/null @@ -1,17 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Globals.h -// -// PURPOSE: Lists of globals declared in Globals.cpp. -// - -#pragma once - -// Module's Instance handle from DLLEntry of process. -extern HINSTANCE ghInstance; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemui/intrface.cpp deleted file mode 100644 index a05b4643..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/intrface.cpp +++ /dev/null @@ -1,567 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.cpp -// -// PURPOSE: Implementation of interface for PScript5 and Unidrv UI plug-ins. -// - -#include "precomp.h" - -#include "debug.h" -#include "devmode.h" -#include "oemui.h" -#include "intrface.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// Internal Globals -//////////////////////////////////////////////////////// - -static long g_cComponents = 0 ; // Count of active components -static long g_cServerLocks = 0 ; // Count of locks - -//////////////////////////////////////////////////////////////////////////////// -// -// IOemUI body -// -IOemUI::~IOemUI() -{ - // Make sure that helper interface is released. - if(NULL != m_pOEMHelp) - { - m_pOEMHelp->Release(); - m_pOEMHelp = NULL; - } - - // If this instance of the object is being deleted, then the reference - // count should be zero. - assert(0 == m_cRef); -} - -HRESULT __stdcall IOemUI::QueryInterface(const IID& iid, void** ppv) -{ - VERBOSE("IOemUI:QueryInterface entry.\r\n\r\n"); - if (iid == IID_IUnknown) - { - *ppv = static_cast(this); - VERBOSE("IOemUI:Return pointer to IUnknown.\r\n\r\n"); - } - else if (iid == IID_IPrintOemUI) - { - *ppv = static_cast(this) ; - VERBOSE("IOemUI:Return pointer to IPrintOemUI.\r\n"); - } - else - { - VERBOSE("IOemUI::QueryInterface IID not supported.\r\n"); - *ppv = NULL ; - return E_NOINTERFACE ; - } - reinterpret_cast(*ppv)->AddRef() ; - return S_OK ; -} - -ULONG __stdcall IOemUI::AddRef() -{ - VERBOSE("IOemUI:AddRef entry.\r\n"); - return InterlockedIncrement(&m_cRef) ; -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemUI::Release() -{ - VERBOSE("IOemUI:Release entry.\r\n"); - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -HRESULT __stdcall IOemUI::PublishDriverInterface( - IUnknown *pIUnknown) -{ - VERBOSE("IOemUI:PublishDriverInterface entry.\r\n"); - - // Need to store pointer to Driver Helper functions, if we already haven't. - if (m_pOEMHelp == NULL) - { - HRESULT hResult; - - - // Get Interface to Helper Functions. - hResult = pIUnknown->QueryInterface(IID_IPrintOemDriverUI, (void** ) &(m_pOEMHelp)); - - if(!SUCCEEDED(hResult)) - { - // Make sure that interface pointer reflects interface query failure. - m_pOEMHelp = NULL; - - return E_FAIL; - } - } - - return S_OK; -} - -HRESULT __stdcall IOemUI::GetInfo( - DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded) -{ - VERBOSE("IOemUI::GetInfo entry.\r\r\n"); - - // Validate parameters. - if( (NULL == pcbNeeded) - || - ( (OEMGI_GETSIGNATURE != dwMode) - && - (OEMGI_GETVERSION != dwMode) - && - (OEMGI_GETPUBLISHERINFO != dwMode) - ) - ) - { - WARNING("IOemUI::GetInfo() exit pcbNeeded is NULL! ERROR_INVALID_PARAMETER\r\r\n"); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Set expected buffer size and number of bytes written. - *pcbNeeded = sizeof(DWORD); - - // Check buffer size is sufficient. - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - WARNING("IOemUI::GetInfo() exit insufficient buffer!\r\r\n"); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return E_FAIL; - } - - switch(dwMode) - { - // OEM DLL Signature - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // OEM DLL version - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // dwMode not supported. - default: - // Set written bytes to zero since nothing was written. - WARNING("IOemUI::GetInfo() exit mode not supported.\r\r\n"); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - return E_FAIL; - } - - VERBOSE("IOemUI::GetInfo() exit S_OK\r\n"); - return S_OK; -} - -HRESULT __stdcall IOemUI::DevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam) -{ - VERBOSE("IOemUI:DevMode entry.\r\n"); - - return hrOEMDevMode(dwMode, pOemDMParam); -} - -HRESULT __stdcall IOemUI::CommonUIProp( - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam) -{ - VERBOSE("IOemUI:CommonUIProp entry.\r\n"); - - return hrOEMPropertyPage(dwMode, pOemCUIPParam); -} - - -HRESULT __stdcall IOemUI::DocumentPropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam) -{ - VERBOSE("IOemUI:DocumentPropertySheets entry.\r\n"); - - return hrOEMDocumentPropertySheets(pPSUIInfo, lParam, m_pOEMHelp); -} - -HRESULT __stdcall IOemUI::DevicePropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam) -{ - VERBOSE("IOemUI:DevicePropertySheets entry.\r\n"); - - return hrOEMDevicePropertySheets(pPSUIInfo, lParam); -} - -HRESULT __stdcall IOemUI::DeviceCapabilities( - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult) -{ - VERBOSE("IOemUI:DeviceCapabilities entry.\r\n"); - - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(pDeviceName); - UNREFERENCED_PARAMETER(wCapability); - UNREFERENCED_PARAMETER(pOutput); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - UNREFERENCED_PARAMETER(dwOld); - UNREFERENCED_PARAMETER(dwResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::DevQueryPrintEx( - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM) -{ - VERBOSE("IOemUI:DevQueryPrintEx entry.\r\n"); - - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pDQPInfo); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::UpgradePrinter( - DWORD dwLevel, - PBYTE pDriverUpgradeInfo) -{ - VERBOSE("IOemUI:UpgradePrinter entry.\r\n"); - - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverUpgradeInfo); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::PrinterEvent( - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam) -{ - VERBOSE("IOemUI:PrinterEvent entry.\r\n"); - - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(iDriverEvent); - UNREFERENCED_PARAMETER(dwFlags); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - -HRESULT __stdcall IOemUI::DriverEvent( - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam) -{ - VERBOSE("IOemUI:DriverEvent entry.\r\n"); - - UNREFERENCED_PARAMETER(dwDriverEvent); - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - - -#define PROFILE_NAME L"OEMPROFILE.icm\0" - -HRESULT __stdcall IOemUI::QueryColorProfile( - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulQueryMode, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData) -{ - HRESULT Result = E_FAIL; - - VERBOSE("IOemUI:QueryColorProfile entry.\r\n"); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - - if(QCP_DEVICEPROFILE == ulQueryMode) - { - if(NULL == pvProfileData) - { - *pcbProfileData = sizeof(PROFILE_NAME); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - } - else - { - if(*pcbProfileData < sizeof(PROFILE_NAME)) - { - *pcbProfileData = sizeof(PROFILE_NAME); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - } - else - { - Result = StringCbCopy((LPWSTR)pvProfileData, *pcbProfileData, PROFILE_NAME); - *pcbProfileData = sizeof(PROFILE_NAME); - *pflProfileData = QCP_PROFILEDISK; - - if(FAILED(Result)) - { - SetLastError(Result); - } - } - } - } - - return Result; -}; - -HRESULT __stdcall IOemUI::FontInstallerDlgProc( - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam) -{ - VERBOSE("IOemUI:FontInstallerDlgProc entry.\r\n"); - - UNREFERENCED_PARAMETER(hWnd); - UNREFERENCED_PARAMETER(usMsg); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - -HRESULT __stdcall IOemUI::UpdateExternalFonts( - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges) -{ - VERBOSE("IOemUI:UpdateExternalFonts entry.\r\n"); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(hHeap); - UNREFERENCED_PARAMETER(pwstrCartridges); - - return E_NOTIMPL; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// oem class factory -// -class IOemCF : public IClassFactory -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) STDMETHOD_(ULONG,Release)(THIS); - - // *** IClassFactory methods *** - STDMETHOD(CreateInstance) (THIS_ - LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID FAR* ppvObject); - STDMETHOD(LockServer) (THIS_ BOOL bLock); - - - // Constructor - IOemCF(): m_cRef(1) { }; - ~IOemCF() { }; - -protected: - LONG m_cRef; - -}; - -/////////////////////////////////////////////////////////// -// -// Class factory body -// -HRESULT __stdcall IOemCF::QueryInterface(const IID& iid, void** ppv) -{ - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this) ; - } - else - { - VERBOSE("IOemCF::QueryInterface IID not supported.\r\n"); - *ppv = NULL ; - return E_NOINTERFACE ; - } - reinterpret_cast(*ppv)->AddRef() ; - return S_OK ; -} - -ULONG __stdcall IOemCF::AddRef() -{ - return InterlockedIncrement(&m_cRef) ; -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemCF::Release() -{ - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -// IClassFactory implementation -HRESULT __stdcall IOemCF::CreateInstance(IUnknown* pUnknownOuter, - const IID& iid, - void** ppv) -{ - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Cannot aggregate. - if (pUnknownOuter != NULL) - { - return CLASS_E_NOAGGREGATION ; - } - - // Create component. - IOemUI* pOemCB = new IOemUI ; - if (pOemCB == NULL) - { - return E_OUTOFMEMORY ; - } - // Get the requested interface. - HRESULT hr = pOemCB->QueryInterface(iid, ppv) ; - - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - pOemCB->Release() ; - return hr ; -} - -// LockServer -HRESULT __stdcall IOemCF::LockServer(BOOL bLock) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks) ; - } - else - { - InterlockedDecrement(&g_cServerLocks) ; - } - return S_OK ; -} - -/////////////////////////////////////////////////////////// -// -// Exported functions -// - - -// Can DLL unload now? -// -STDAPI DllCanUnloadNow() -{ - // - // To avoid leaving OEM DLL still in memory when Unidrv or Pscript drivers - // are unloaded, Unidrv and Pscript driver ignore the return value of - // DllCanUnloadNow of the OEM DLL, and always call FreeLibrary on the OEMDLL. - // - // If OEM DLL spins off a working thread that also uses the OEM DLL, the - // thread needs to call LoadLibrary and FreeLibraryAndExitThread, otherwise - // it may crash after Unidrv or Pscript calls FreeLibrary. - // - - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK ; - } - else - { - return S_FALSE; - } -} - -// -// Get class factory -// -STDAPI DllGetClassObject( - _In_ REFCLSID clsid, - _In_ REFIID iid, - _Outptr_ LPVOID* ppv) -{ - VERBOSE("DllGetClassObject:Create class factory.\r\n"); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Can we create this component? - if (clsid != CLSID_OEMUI) - { - return CLASS_E_CLASSNOTAVAILABLE ; - } - - // Create class factory. - IOemCF* pFontCF = new IOemCF ; // Reference count set to 1 - // in constructor - if (pFontCF == NULL) - { - return E_OUTOFMEMORY ; - } - - // Get requested interface. - HRESULT hr = pFontCF->QueryInterface(iid, ppv) ; - pFontCF->Release() ; - - return hr ; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/oemui/intrface.h deleted file mode 100644 index 3ae5c07c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/intrface.h +++ /dev/null @@ -1,178 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.cpp -// -// -// PURPOSE: Header of interface for PScript5 & Unidrv UI plug-ins. -// -#pragma once - -//////////////////////////////////////////////////////////////////////////////// -// -// IOemUI -// -class IOemUI: public IPrintOemUI -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) STDMETHOD_(ULONG,Release)(THIS); - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Get OEM dll related information - // - - STDMETHOD(GetInfo) (THIS_ DWORD dwMode, PVOID pBuffer, DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDevMode - // - - STDMETHOD(DevMode) (THIS_ DWORD dwMode, POEMDMPARAM pOemDMParam) ; - - // - // OEMCommonUIProp - // - - STDMETHOD(CommonUIProp) (THIS_ - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam - ); - - // - // OEMDocumentPropertySheets - // - - STDMETHOD(DocumentPropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - // - // OEMDevicePropertySheets - // - - STDMETHOD(DevicePropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - - // - // OEMDevQueryPrintEx - // - - STDMETHOD(DevQueryPrintEx) (THIS_ - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM - ); - - // - // OEMDeviceCapabilities - // - - STDMETHOD(DeviceCapabilities) (THIS_ - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult - ); - - // - // OEMUpgradePrinter - // - - STDMETHOD(UpgradePrinter) (THIS_ - DWORD dwLevel, - PBYTE pDriverUpgradeInfo - ); - - // - // OEMPrinterEvent - // - - STDMETHOD(PrinterEvent) (THIS_ - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam - ); - - // - // OEMDriverEvent - // - - STDMETHOD(DriverEvent)(THIS_ - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam - ); - - // - // OEMQueryColorProfile - // - - STDMETHOD(QueryColorProfile) (THIS_ - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulReserved, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData); - - // - // OEMFontInstallerDlgProc - // - - STDMETHOD(FontInstallerDlgProc) (THIS_ - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam - ); - // - // UpdateExternalFonts - // - - STDMETHOD(UpdateExternalFonts) (THIS_ - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges - ); - - - IOemUI() { m_cRef = 1; m_pOEMHelp = NULL; }; - ~IOemUI(); - -protected: - LONG m_cRef; - IPrintOemDriverUI* m_pOEMHelp; -}; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/oemui.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemui/oemui.cpp deleted file mode 100644 index 421fa9d0..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/oemui.cpp +++ /dev/null @@ -1,737 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: OEMUI.cpp -// -// PURPOSE: Main file for OEM UI test module. -// - -#include "precomp.h" - -#include "debug.h" -#include "resource.h" -#include "globals.h" -#include "devmode.h" -#include "oemui.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// INTERNAL MACROS and DEFINES -//////////////////////////////////////////////////////// - -typedef struct _tagCBUserData -{ - HANDLE hComPropSheet; - HANDLE hPropPage; - POEMUIPSPARAM pOEMUIParam; - PFNCOMPROPSHEET pfnComPropSheet; - -} CBUSERDATA, *PCBUSERDATA; - - - -//////////////////////////////////////////////////////// -// INTERNAL PROTOTYPES -//////////////////////////////////////////////////////// - -static HRESULT hrDocumentPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -static HRESULT hrPrinterPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -LONG APIENTRY OEMPrinterUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam); -LONG APIENTRY OEMDocUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam); -LONG APIENTRY OEMDocUICallBack2(PCPSUICBPARAM pCallbackParam); -INT_PTR CALLBACK DevicePropPageProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam); -static POPTITEM CreateOptItems(HANDLE hHeap, DWORD dwOptItems); -static void InitOptItems(POPTITEM pOptItems, DWORD dwOptItems); -static POPTTYPE CreateOptType(HANDLE hHeap, WORD wOptParams); -static PTSTR GetStringResource(HANDLE hHeap, HANDLE hModule, UINT uResource); - - - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM device or document property UI. -// -HRESULT hrOEMPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - HRESULT hResult = S_OK; - - VERBOSE("hrOEMPropertyPage entry.\r\n"); - - // Validate parameters. - if( (OEMCUIP_DOCPROP != dwMode) - && - (OEMCUIP_PRNPROP != dwMode) - ) - { - ERR("hrOEMPropertyPage() ERROR_INVALID_PARAMETER.\r\n"); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - switch(dwMode) - { - case OEMCUIP_DOCPROP: - hResult = hrDocumentPropertyPage(dwMode, pOEMUIParam); - break; - - case OEMCUIP_PRNPROP: - hResult = hrPrinterPropertyPage(dwMode, pOEMUIParam); - break; - - default: - // Should never reach this! - ERR("hrOEMPropertyPage() Invalid dwMode"); - SetLastError(ERROR_INVALID_PARAMETER); - hResult = E_FAIL; - break; - } - - return hResult; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM document property UI. -// -static HRESULT hrDocumentPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - UNREFERENCED_PARAMETER(dwMode); - - if(NULL == pOEMUIParam->pOEMOptItems) - { - // Fill in the number of OptItems to create for OEM document property UI. - pOEMUIParam->cOEMOptItems = 1; - - VERBOSE("hrDocumentPropertyPage() requesting items.\r\n"); - } - else - { - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - - VERBOSE("hrDocumentPropertyPage() fill out items.\r\n"); - - // Init UI Callback reference. - pOEMUIParam->OEMCUIPCallback = OEMDocUICallBack; - - // Init OEMOptItmes. - InitOptItems(pOEMUIParam->pOEMOptItems, pOEMUIParam->cOEMOptItems); - - // Fill out tree view items. - - // New section. - pOEMUIParam->pOEMOptItems[0].Level = 1; - pOEMUIParam->pOEMOptItems[0].Flags = OPTIF_COLLAPSE; - pOEMUIParam->pOEMOptItems[0].pName = GetStringResource(pOEMUIParam->hOEMHeap, pOEMUIParam->hModule, IDS_ADV_SECTION); - pOEMUIParam->pOEMOptItems[0].Sel = pOEMDev->dwAdvancedData; - - pOEMUIParam->pOEMOptItems[0].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 2); - - pOEMUIParam->pOEMOptItems[0].pOptType->Type = TVOT_UDARROW; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].IconID = 0; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].lParam = 100; - } - - return S_OK; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM printer property UI. -// -static HRESULT hrPrinterPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - UNREFERENCED_PARAMETER(dwMode); - - if(NULL == pOEMUIParam->pOEMOptItems) - { - // Fill in the number of OptItems to create for OEM printer property UI. - pOEMUIParam->cOEMOptItems = 1; - - VERBOSE("hrPrinterPropertyPage() requesting items.\r\n"); - } - else - { - DWORD dwError; - DWORD dwDeviceValue; - DWORD dwType; - DWORD dwNeeded; - - - VERBOSE("hrPrinterPropertyPage() fill out items.\r\n"); - - // Get device settings value from printer. - dwError = GetPrinterData(pOEMUIParam->hPrinter, OEMUI_VALUE, &dwType, (PBYTE) &dwDeviceValue, - sizeof(dwDeviceValue), &dwNeeded); - if( (ERROR_SUCCESS != dwError) - || - (dwDeviceValue > 100) - ) - { - // Failed to get the device value or value is invalid, just use the default. - dwDeviceValue = 0; - } - - // Init UI Callback reference. - pOEMUIParam->OEMCUIPCallback = OEMPrinterUICallBack; - - // Init OEMOptItmes. - InitOptItems(pOEMUIParam->pOEMOptItems, pOEMUIParam->cOEMOptItems); - - // Fill out tree view items. - - // New section. - pOEMUIParam->pOEMOptItems[0].Level = 1; - pOEMUIParam->pOEMOptItems[0].Flags = OPTIF_COLLAPSE; - pOEMUIParam->pOEMOptItems[0].pName = GetStringResource(pOEMUIParam->hOEMHeap, pOEMUIParam->hModule, IDS_DEV_SECTION); - pOEMUIParam->pOEMOptItems[0].Sel = dwDeviceValue; - - pOEMUIParam->pOEMOptItems[0].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 2); - - pOEMUIParam->pOEMOptItems[0].pOptType->Type = TVOT_UDARROW; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].IconID = 0; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].lParam = 100; - } - - return S_OK; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Adds property page to Document property sheet. -// -HRESULT hrOEMDocumentPropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam, - IPrintOemDriverUI* pOEMHelp) -{ - LONG_PTR lResult = 0; - HRESULT hrResult = S_OK; - - VERBOSE("hrOEMDocumentPropertySheets() entry.\r\n"); - - UNREFERENCED_PARAMETER(pOEMHelp); - - // Validate parameters. - if( (NULL == pPSUIInfo) - || - (PROPSHEETUI_INFO_VERSION != pPSUIInfo->Version) - ) - { - ERR("hrOEMDocumentPropertySheets() ERROR_INVALID_PARAMETER.\r\n"); - - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Do action. - switch(pPSUIInfo->Reason) - { - case PROPSHEETUI_REASON_INIT: - { - DWORD dwSheets = 0; - PCBUSERDATA pUserData = NULL; - POEMUIPSPARAM pOEMUIParam = (POEMUIPSPARAM) pPSUIInfo->lParamInit; - HANDLE hHeap = pOEMUIParam->hOEMHeap; - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - COMPROPSHEETUI Sheet; - - - // Init property page. - memset(&Sheet, 0, sizeof(COMPROPSHEETUI)); - Sheet.cbSize = sizeof(COMPROPSHEETUI); - Sheet.Flags = CPSUIF_UPDATE_PERMISSION; - Sheet.hInstCaller = ghInstance; - Sheet.pCallerName = GetStringResource(hHeap, ghInstance, IDS_NAME); - Sheet.pHelpFile = NULL; - Sheet.pfnCallBack = OEMDocUICallBack2; - Sheet.pDlgPage = CPSUI_PDLGPAGE_TREEVIEWONLY; - Sheet.cOptItem = 1; - Sheet.IconID = IDI_CPSUI_PRINTER; - Sheet.pOptItemName = GetStringResource(hHeap, ghInstance, IDS_SECTION); - Sheet.CallerVersion = 0x100; - Sheet.OptItemVersion = 0x100; - - // Init user data. - pUserData = (PCBUSERDATA) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(CBUSERDATA)); - if (NULL == pUserData) - { - ERR("hrOEMDocumentPropertySheets() failed to allocate user data.\r\n"); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - pUserData->hComPropSheet = pPSUIInfo->hComPropSheet; - pUserData->pfnComPropSheet = pPSUIInfo->pfnComPropSheet; - pUserData->pOEMUIParam = pOEMUIParam; - Sheet.UserData = (ULONG_PTR) pUserData; - - // Create OptItems for page. - Sheet.pOptItem = CreateOptItems(hHeap, Sheet.cOptItem); - if (NULL == Sheet.pOptItem) - { - ERR("hrOEMDocumentPropertySheets() failed to allocate OPTITEMs.\r\n"); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // Initialize OptItems - Sheet.pOptItem[0].Level = 1; - Sheet.pOptItem[0].Flags = OPTIF_COLLAPSE; - Sheet.pOptItem[0].pName = GetStringResource(hHeap, ghInstance, IDS_SECTION); - Sheet.pOptItem[0].Sel = pOEMDev->dwDriverData; - - Sheet.pOptItem[0].pOptType = CreateOptType(hHeap, 2); - if (NULL == Sheet.pOptItem[0].pOptType) - { - ERR("hrOEMDocumentPropertySheets() failed to allocate OPTTYPE.\r\n"); - - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - Sheet.pOptItem[0].pOptType->Type = TVOT_UDARROW; - Sheet.pOptItem[0].pOptType->pOptParam[1].IconID = 0; - Sheet.pOptItem[0].pOptType->pOptParam[1].lParam = 100; - - - // Add property sheets. - lResult = pPSUIInfo->pfnComPropSheet(pPSUIInfo->hComPropSheet, CPSFUNC_ADD_PCOMPROPSHEETUI, - (LPARAM)&Sheet, (LPARAM)&dwSheets); - } - break; - - case PROPSHEETUI_REASON_GET_INFO_HEADER: - { - PPROPSHEETUI_INFO_HEADER pHeader = (PPROPSHEETUI_INFO_HEADER) lParam; - - pHeader->pTitle = (LPTSTR)PROP_TITLE; - lResult = TRUE; - } - break; - - case PROPSHEETUI_REASON_GET_ICON: - // No icon - lResult = 0; - break; - - case PROPSHEETUI_REASON_SET_RESULT: - { - PSETRESULT_INFO pInfo = (PSETRESULT_INFO) lParam; - - lResult = pInfo->Result; - } - break; - - case PROPSHEETUI_REASON_DESTROY: - lResult = TRUE; - break; - } - -Exit: - - pPSUIInfo->Result = lResult; - return hrResult; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Adds property page to printer property sheet. -// -HRESULT hrOEMDevicePropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam) -{ - LONG_PTR lResult = 0; - - VERBOSE("hrOEMDevicePropertySheets entry\r\n"); - - // Validate parameters. - if( (NULL == pPSUIInfo) - || - (PROPSHEETUI_INFO_VERSION != pPSUIInfo->Version) - ) - { - ERR("hrOEMDevicePropertySheets() ERROR_INVALID_PARAMETER.\r\n"); - - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Do action. - switch(pPSUIInfo->Reason) - { - case PROPSHEETUI_REASON_INIT: - { - PROPSHEETPAGE Page; - - // Init property page. - memset(&Page, 0, sizeof(PROPSHEETPAGE)); - Page.dwSize = sizeof(PROPSHEETPAGE); - Page.dwFlags = PSP_DEFAULT; - Page.hInstance = ghInstance; - Page.pszTemplate = MAKEINTRESOURCE(IDD_DEVICE_PROPPAGE); - Page.pfnDlgProc = DevicePropPageProc; - - // Add property sheets. - lResult = pPSUIInfo->pfnComPropSheet(pPSUIInfo->hComPropSheet, CPSFUNC_ADD_PROPSHEETPAGE, (LPARAM)&Page, 0); - } - break; - - case PROPSHEETUI_REASON_GET_INFO_HEADER: - { - PPROPSHEETUI_INFO_HEADER pHeader = (PPROPSHEETUI_INFO_HEADER) lParam; - - pHeader->pTitle = (LPTSTR)PROP_TITLE; - lResult = TRUE; - } - break; - - case PROPSHEETUI_REASON_GET_ICON: - // No icon - lResult = 0; - break; - - case PROPSHEETUI_REASON_SET_RESULT: - { - PSETRESULT_INFO pInfo = (PSETRESULT_INFO) lParam; - - lResult = pInfo->Result; - } - break; - - case PROPSHEETUI_REASON_DESTROY: - lResult = TRUE; - break; - } - - pPSUIInfo->Result = lResult; - return S_OK; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// OptItems call back for OEM printer property UI. -// -LONG APIENTRY OEMPrinterUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - - VERBOSE("OEMPrinterUICallBack() entry.\r\n"); - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - { - DWORD dwDriverValue = pOEMUIParam->pOEMOptItems[0].Sel; - - // Store OptItems state in printer data. - SetPrinterData(pOEMUIParam->hPrinter, OEMUI_VALUE, REG_DWORD, (PBYTE) &dwDriverValue, sizeof(DWORD)); - } - break; - - default: - break; - } - - return lReturn; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Call back for OEM device property UI. -// -#pragma warning(push) -#pragma warning( disable : 6262 ) // 2 MAX_PATH strings exceeds the default prefast stack size warning threshold by a few bytes. -INT_PTR CALLBACK DevicePropPageProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) -{ - switch (uiMsg) - { - case WM_COMMAND: - switch(HIWORD(wParam)) - { - case BN_CLICKED: - switch(LOWORD(wParam)) - { - case IDC_CALIBRATE: - // Just display a message that the printer is calibrated, - // since we don't acutally calibrate anything. - { - TCHAR szName[MAX_PATH]; - TCHAR szCalibrated[MAX_PATH]; - - - LoadString(ghInstance, IDS_NAME, szName, sizeof(szName)/sizeof(szName[0])); - LoadString(ghInstance, IDS_CALIBRATED, szCalibrated, sizeof(szCalibrated)/sizeof(szCalibrated[0])); - MessageBox(hDlg, szCalibrated, szName, MB_OK); - } - break; - } - break; - - default: - return FALSE; - } - return TRUE; - - case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->code) // type of notification message - { - case PSN_SETACTIVE: - break; - - case PSN_KILLACTIVE: - break; - - case PSN_APPLY: - break; - - case PSN_RESET: - break; - } - } - break; - } - - return FALSE; -} -#pragma warning(pop) - -//////////////////////////////////////////////////////////////////////////////// -// -// OptItems call back for OEM document property UI. -// -LONG APIENTRY OEMDocUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - - - VERBOSE("OEMDocUICallBack() entry\r\n"); - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - // Update UI item data. - pOEMDev->dwAdvancedData = pOEMUIParam->pOEMOptItems[0].Sel; - break; - - case CPSUICB_REASON_KILLACTIVE: - // Update devmode if settings have changed. - if(pOEMDev->dwAdvancedData != (DWORD)(pOEMUIParam->pOEMOptItems[0].Sel)) - { - // Update OEM Devmode driver data. - pOEMDev->dwAdvancedData = pOEMUIParam->pOEMOptItems[0].Sel; - } - break; - - case CPSUICB_REASON_SETACTIVE: - if((DWORD)(pOEMUIParam->pOEMOptItems[0].Sel) != pOEMDev->dwAdvancedData) - { - pOEMUIParam->pOEMOptItems[0].Sel = pOEMDev->dwAdvancedData; - pOEMUIParam->pOEMOptItems[0].Flags |= OPTIF_CHANGED; - lReturn = CPSUICB_ACTION_OPTIF_CHANGED; - } - break; - - default: - break; - } - - return lReturn; -} - - -LONG APIENTRY OEMDocUICallBack2(PCPSUICBPARAM pCallbackParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - PCBUSERDATA pUserData = (PCBUSERDATA) pCallbackParam->UserData; - POEMDEV pOEMDev = (POEMDEV) pUserData->pOEMUIParam->pOEMDM; - - - VERBOSE("OEMDocUICallBack2() entry.\r\n"); - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - // Update OEM devmode driver data. - pOEMDev->dwDriverData = pCallbackParam->pOptItem[0].Sel; - pUserData->pfnComPropSheet(pUserData->hComPropSheet, CPSFUNC_SET_RESULT, - (LPARAM)pUserData->hPropPage, - (LPARAM)CPSUI_OK); - break; - - case CPSUICB_REASON_KILLACTIVE: - if(pOEMDev->dwDriverData != (DWORD)(pCallbackParam->pOptItem[0].Sel)) - { - // Update OEM devmode driver data. - pOEMDev->dwDriverData = pCallbackParam->pOptItem[0].Sel; - } - break; - - case CPSUICB_REASON_SETACTIVE: - if((DWORD)(pCallbackParam->pOptItem[0].Sel) != pOEMDev->dwDriverData) - { - pCallbackParam->pOptItem[0].Sel = pOEMDev->dwDriverData; - pCallbackParam->pOptItem[0].Flags |= OPTIF_CHANGED; - lReturn = CPSUICB_ACTION_OPTIF_CHANGED; - } - break; - - default: - break; - } - - return lReturn; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Creates and Initializes OptItems. -// -static POPTITEM CreateOptItems(HANDLE hHeap, DWORD dwOptItems) -{ - POPTITEM pOptItems = NULL; - - - // Allocate memory for OptItems; - pOptItems = (POPTITEM) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(OPTITEM) * dwOptItems); - if(NULL != pOptItems) - { - InitOptItems(pOptItems, dwOptItems); - } - else - { - ERR("CreateOptItems() failed to allocate memory for OPTITEMs!\r\n"); - } - - return pOptItems; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems. -// -static void InitOptItems(POPTITEM pOptItems, DWORD dwOptItems) -{ - VERBOSE("InitOptItems() entry.\r\n"); - - // Zero out memory. - memset(pOptItems, 0, sizeof(OPTITEM) * dwOptItems); - - // Set each OptItem's size, and Public DM ID. - for(DWORD dwCount = 0; dwCount < dwOptItems; dwCount++) - { - pOptItems[dwCount].cbSize = sizeof(OPTITEM); - pOptItems[dwCount].DMPubID = DMPUB_NONE; - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Allocates and initializes OptType for OptItem. -// -static POPTTYPE CreateOptType(HANDLE hHeap, WORD wOptParams) -{ - POPTTYPE pOptType = NULL; - - - VERBOSE("CreateOptType() entry.\r\n"); - - // Allocate memory from the heap for the OPTTYPE; the driver will take care of clean up. - pOptType = (POPTTYPE) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(OPTTYPE)); - if(NULL != pOptType) - { - // Initialize OPTTYPE. - pOptType->cbSize = sizeof(OPTTYPE); - pOptType->Count = wOptParams; - - // Allocate memory from the heap for the OPTPARAMs for the OPTTYPE. - pOptType->pOptParam = (POPTPARAM) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, wOptParams * sizeof(OPTPARAM)); - if(NULL != pOptType->pOptParam) - { - // Initialize the OPTPARAMs. - for(WORD wCount = 0; wCount < wOptParams; wCount++) - { - pOptType->pOptParam[wCount].cbSize = sizeof(OPTPARAM); - } - } - else - { - ERR("CreateOptType() failed to allocated memory for OPTPARAMs!\r\n"); - - // Free allocated memory and return NULL. - HeapFree(hHeap, 0, pOptType); - pOptType = NULL; - } - } - else - { - ERR("CreateOptType() failed to allocated memory for OPTTYPE!\r\n"); - } - - return pOptType; -} - -//////////////////////////////////////////////////////////////////////////////////// -// -// Retrieves pointer to a String resource. -// -static PTSTR GetStringResource(HANDLE hHeap, HANDLE hModule, UINT uResource) -{ - int nResult; - DWORD dwSize = MAX_PATH; - PTSTR pszString = NULL; - - VERBOSE("GetStringResource entered.\r\n"); - - // Allocate buffer for string resource from heap; let the driver clean it up. - pszString = (PTSTR) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, dwSize * sizeof(TCHAR)); - if(NULL != pszString) - { - // Load string resource; resize after loading so as not to waste memory. - nResult = LoadString((HMODULE)hModule, uResource, pszString, dwSize); - if(nResult > 0) - { - PTSTR pszTemp; - - pszTemp = (PTSTR) HeapReAlloc(hHeap, HEAP_ZERO_MEMORY, pszString, (nResult + 1) * sizeof(TCHAR)); - if(NULL != pszTemp) - { - pszString = pszTemp; - } - else - { - ERR("GetStringResource() HeapReAlloc() of string retrieved failed!\r\n"); - } - } - else - { - ERR("LoadString() failed.\r\n"); - ERR("GetStringResource() failed to load string resource !\r\n"); - - pszString = NULL; - } - } - else - { - ERR("GetStringResource() failed to allocate string buffer!\r\n"); - } - - return pszString; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/oemui.h b/print/OEM Printer Customization Plug-in Samples/C++/oemui/oemui.h deleted file mode 100644 index b584893e..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/oemui.h +++ /dev/null @@ -1,37 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: OEMUI.H -// -// -// PURPOSE: Define common data types, and external function prototypes -// for OEMUI Test Module. -// -#pragma once - -//////////////////////////////////////////////////////// -// OEM UI Defines -//////////////////////////////////////////////////////// - -// OEM Signature and version. -#define PROP_TITLE L"OEM UI Page" - -// Printer registry keys where OEM data is stored. -#define OEMUI_VALUE TEXT("OEMUI_VALUE") -#define OEMUI_DEVICE_VALUE TEXT("OEMUI_DEVICE_VALUE") - - - -//////////////////////////////////////////////////////// -// Prototypes -//////////////////////////////////////////////////////// - -HRESULT hrOEMPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -HRESULT hrOEMDocumentPropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam, IPrintOemDriverUI* pOEMHelp); -HRESULT hrOEMDevicePropertySheets(PPROPSHEETUI_INFO pPSUIInfo, LPARAM lParam); - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/oemui/precomp.h deleted file mode 100644 index bd1a22de..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/precomp.h +++ /dev/null @@ -1,52 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: precomp.H -// -// PURPOSE: Optimize compilation of headers that don't change frequently. -// -#pragma once - -// Necessary for compiling under VC. -#if(!defined(WINVER) || (WINVER < 0x0500)) - #undef WINVER - #define WINVER 0x0500 -#endif -#if(!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)) - #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0500 -#endif - - -// Required header files that shouldn't change often. - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// StrSafe.h needs to be included last -// to disallow unsafe string functions. -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemui/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemui/resource.h b/print/OEM Printer Customization Plug-in Samples/C++/oemui/resource.h deleted file mode 100644 index 71d3d3d6..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemui/resource.h +++ /dev/null @@ -1,24 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by OEMUI.rc -// -#define IDS_SECTION 1 -#define IDS_CALIBRATED 2 -#define IDS_NAME 3 -#define IDS_DEV_SECTION 4 -#define IDS_DEVICE_SECTION 4 -#define IDS_ADV_SECTION 10 -#define IDD_DEVICE_PROPPAGE 106 -#define IDD_DOC_PROPPAGE 107 -#define IDC_CALIBRATE 1001 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1002 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni.ini b/print/OEM Printer Customization Plug-in Samples/C++/oemuni.ini deleted file mode 100644 index 399b2f9b..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni.ini +++ /dev/null @@ -1,3 +0,0 @@ -[OEMFiles] -OEMDriverFile1=OEMUNI.DLL - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.def b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.def deleted file mode 100644 index be2aaf17..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY OEMUNI -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.h b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.h deleted file mode 100644 index 6df79055..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.h +++ /dev/null @@ -1,234 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: OEMUNI.H -// -// -// PURPOSE: Define the COemPDEV class which stores the private -// PDEV for the driver. -// - -#pragma once - -class COemPDEV -{ -public: - __stdcall COemPDEV(void) - { - - // Note that since our parent has AddRef'd the UNIDRV interface, - // we don't do so here since our scope is identical to our - // parent. - // - - VERBOSE("In COemPDEV constructor..."); - - _ResetPointers(); - } - - __stdcall ~COemPDEV(void) - { - VERBOSE("In COemPDEV destructor..."); - } - - void __stdcall InitializeDDITable(DRVENABLEDATA* pded) - { - VERBOSE("COemPDEV::InitializeDDITable entry."); - - UINT iDrvFn; - UINT cDrvFn = pded->c; - PDRVFN pDrvFn = pded->pdrvfn; - - for (iDrvFn = 0; iDrvFn < cDrvFn; ++iDrvFn, ++pDrvFn) - { - _SavePFN(pDrvFn->iFunc, pDrvFn->pfn); - } - } - -private: - - void __stdcall _SavePFN(ULONG uFunc, PFN pfn) - { - - // Note: if a "pass-through" driver is being constructed, then - // there is nothing for this method to do. So, to keep the - // compiler from complaining about a switch with no case - // statements, but which has a default statement, we surround - // the entire construct with preprocessor controls. - // - switch(uFunc) - { - // The following are the drawing related DDI hooks. - // - case INDEX_DrvAlphaBlend: - m_pfnDrvAlphaBlend = (PFN_DrvAlphaBlend)pfn; - break; - case INDEX_DrvBitBlt: - m_pfnDrvBitBlt = (PFN_DrvBitBlt)pfn; - break; - case INDEX_DrvCopyBits: - m_pfnDrvCopyBits = (PFN_DrvCopyBits)pfn; - break; - case INDEX_DrvDitherColor: - m_pfnDrvDitherColor = (PFN_DrvDitherColor)pfn; - break; - case INDEX_DrvFillPath: - m_pfnDrvFillPath = (PFN_DrvFillPath)pfn; - break; - case INDEX_DrvFontManagement: - m_pfnDrvFontManagement = (PFN_DrvFontManagement)pfn; - break; - case INDEX_DrvGetGlyphMode: - m_pfnDrvGetGlyphMode = (PFN_DrvGetGlyphMode)pfn; - break; - case INDEX_DrvGradientFill: - m_pfnDrvGradientFill = (PFN_DrvGradientFill)pfn; - break; - case INDEX_DrvLineTo: - m_pfnDrvLineTo = (PFN_DrvLineTo)pfn; - break; - case INDEX_DrvPaint: - m_pfnDrvPaint = (PFN_DrvPaint)pfn; - break; - case INDEX_DrvPlgBlt: - m_pfnDrvPlgBlt = (PFN_DrvPlgBlt)pfn; - break; - case INDEX_DrvQueryAdvanceWidths: - m_pfnDrvQueryAdvanceWidths = (PFN_DrvQueryAdvanceWidths)pfn; - break; - case INDEX_DrvQueryFont: - m_pfnDrvQueryFont = (PFN_DrvQueryFont)pfn; - break; - case INDEX_DrvQueryFontData: - m_pfnDrvQueryFontData = (PFN_DrvQueryFontData)pfn; - break; - case INDEX_DrvQueryFontTree: - m_pfnDrvQueryFontTree = (PFN_DrvQueryFontTree)pfn; - break; - case INDEX_DrvRealizeBrush: - m_pfnDrvRealizeBrush = (PFN_DrvRealizeBrush)pfn; - break; - case INDEX_DrvStretchBlt: - m_pfnDrvStretchBlt = (PFN_DrvStretchBlt)pfn; - break; - case INDEX_DrvStretchBltROP: - m_pfnDrvStretchBltROP = (PFN_DrvStretchBltROP)pfn; - break; - case INDEX_DrvStrokeAndFillPath: - m_pfnDrvStrokeAndFillPath = (PFN_DrvStrokeAndFillPath)pfn; - break; - case INDEX_DrvStrokePath: - m_pfnDrvStrokePath = (PFN_DrvStrokePath)pfn; - break; - case INDEX_DrvTextOut: - m_pfnDrvTextOut = (PFN_DrvTextOut)pfn; - break; - case INDEX_DrvTransparentBlt: - m_pfnDrvTransparentBlt = (PFN_DrvTransparentBlt)pfn; - break; - // The following are the page/band related DDI hooks. - // - case INDEX_DrvStartDoc: - m_pfnDrvStartDoc = (PFN_DrvStartDoc)pfn; - break; - case INDEX_DrvEndDoc: - m_pfnDrvEndDoc = (PFN_DrvEndDoc)pfn; - break; - case INDEX_DrvStartPage: - m_pfnDrvStartPage = (PFN_DrvStartPage)pfn; - break; - case INDEX_DrvSendPage: - m_pfnDrvSendPage = (PFN_DrvSendPage)pfn; - break; - case INDEX_DrvStartBanding: - m_pfnDrvStartBanding = (PFN_DrvStartBanding)pfn; - break; - case INDEX_DrvNextBand: - m_pfnDrvNextBand = (PFN_DrvNextBand)pfn; - break; - case INDEX_DrvEscape: - m_pfnDrvEscape = (PFN_DrvEscape)pfn; - break; - } // switch(uFunc) - } - - void __stdcall _ResetPointers(void) - { - m_pfnDrvAlphaBlend = NULL; - m_pfnDrvBitBlt = NULL; - m_pfnDrvCopyBits = NULL; - m_pfnDrvDitherColor = NULL; - m_pfnDrvEndDoc = NULL; - m_pfnDrvEscape = NULL; - m_pfnDrvFillPath = NULL; - m_pfnDrvFontManagement = NULL; - m_pfnDrvGetGlyphMode = NULL; - m_pfnDrvGradientFill = NULL; - m_pfnDrvLineTo = NULL; - m_pfnDrvNextBand = NULL; - m_pfnDrvPaint = NULL; - m_pfnDrvPlgBlt = NULL; - m_pfnDrvQueryAdvanceWidths = NULL; - m_pfnDrvQueryFont = NULL; - m_pfnDrvQueryFontData = NULL; - m_pfnDrvQueryFontTree = NULL; - m_pfnDrvRealizeBrush = NULL; - m_pfnDrvSendPage = NULL; - m_pfnDrvStartBanding = NULL; - m_pfnDrvStartDoc = NULL; - m_pfnDrvStartPage = NULL; - m_pfnDrvStretchBlt = NULL; - m_pfnDrvStretchBltROP = NULL; - m_pfnDrvStrokeAndFillPath = NULL; - m_pfnDrvStrokePath = NULL; - m_pfnDrvTextOut = NULL; - m_pfnDrvTransparentBlt = NULL; - } - -public: - - // Unidrv function pointers so that we can punt - // back from the DDI hooks - // - PFN_DrvAlphaBlend m_pfnDrvAlphaBlend; - PFN_DrvBitBlt m_pfnDrvBitBlt; - PFN_DrvCopyBits m_pfnDrvCopyBits; - PFN_DrvDitherColor m_pfnDrvDitherColor; - PFN_DrvEndDoc m_pfnDrvEndDoc; - PFN_DrvEscape m_pfnDrvEscape; - PFN_DrvFillPath m_pfnDrvFillPath; - PFN_DrvFontManagement m_pfnDrvFontManagement; - PFN_DrvGetGlyphMode m_pfnDrvGetGlyphMode; - PFN_DrvGradientFill m_pfnDrvGradientFill; - PFN_DrvLineTo m_pfnDrvLineTo; - PFN_DrvNextBand m_pfnDrvNextBand; - PFN_DrvPaint m_pfnDrvPaint; - PFN_DrvPlgBlt m_pfnDrvPlgBlt; - PFN_DrvQueryAdvanceWidths m_pfnDrvQueryAdvanceWidths; - PFN_DrvQueryFont m_pfnDrvQueryFont; - PFN_DrvQueryFontData m_pfnDrvQueryFontData; - PFN_DrvQueryFontTree m_pfnDrvQueryFontTree; - PFN_DrvRealizeBrush m_pfnDrvRealizeBrush; - PFN_DrvSendPage m_pfnDrvSendPage; - PFN_DrvStartBanding m_pfnDrvStartBanding; - PFN_DrvStartDoc m_pfnDrvStartDoc; - PFN_DrvStartPage m_pfnDrvStartPage; - PFN_DrvStretchBlt m_pfnDrvStretchBlt; - PFN_DrvStretchBltROP m_pfnDrvStretchBltROP; - PFN_DrvStrokeAndFillPath m_pfnDrvStrokeAndFillPath; - PFN_DrvStrokePath m_pfnDrvStrokePath; - PFN_DrvTextOut m_pfnDrvTextOut; - PFN_DrvTransparentBlt m_pfnDrvTransparentBlt; - - /*******************************************/ - /* */ - /* Add any custom PDEV members here */ - /* */ - /*******************************************/ - -}; -typedef COemPDEV* POEMPDEV; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.rc b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.rc deleted file mode 100644 index 6a21e8d3..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.rc +++ /dev/null @@ -1,110 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Written by DDK Support Team\0" - VALUE "CompanyName", "Microsoft Corp.\0" - VALUE "FileDescription", "OEM Customization Sample\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "OEMUNI\0" - VALUE "LegalCopyright", "Copyright 1998-2003\0" - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation\0" - VALUE "OriginalFilename", "OEMUNI.DLL\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Microsoft OEMUNI\0" - VALUE "ProductVersion", "1.0\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.vcxproj deleted file mode 100644 index eeeac176..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.vcxproj +++ /dev/null @@ -1,1090 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {B0F13767-2056-47FC-B37B-41D7E339900B} - $(MSBuildProjectName) - Win10 Debug - Win32 - {96600CA6-8E9E-4691-ACB9-0225A5B57563} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - OEMUNI - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;USERMODE_DRIVER - %(AdditionalIncludeDirectories);.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;winspool.lib;user32.lib;ole32.lib - - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - OEMUNI.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.vcxproj.Filters deleted file mode 100644 index 8287cc90..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/OEMUNI.vcxproj.Filters +++ /dev/null @@ -1,174 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {25BB1250-6D65-4A18-B7D2-D29AB885B616} - - - h;hpp;hxx;hm;inl;inc;xsd - {C1A83E63-7DD3-4CAD-9079-BA272CB24B89} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {6B77C327-966D-4CD1-AC7A-EB5A773904D2} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/ddihook.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/ddihook.cpp deleted file mode 100644 index 48922ae6..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/ddihook.cpp +++ /dev/null @@ -1,1670 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: DDIHook.cpp -// -// PURPOSE: DDI Hook routines for User Mode COM Customization DLL. This module -// implements the following methods defined in printoem.h -// OEMCopyBits -// OEMBitBlt -// OEMStretchBlt -// OEMDitherColor -// OEMStretchBltROP -// OEMPlgBlt -// OEMPaint -// OEMRealizeBrush -// OEMStrokePath -// OEMFillPath -// OEMStrokeAndFillPath -// OEMLineTo -// OEMAlphaBlend -// OEMGradientFill -// OEMTransparentBlt -// OEMTextOut -// OEMQueryFont -// OEMQueryFontTree -// OEMQueryFontData -// OEMFontManagement -// OEMQueryAdvanceWidths -// OEMGetGlyphMode -// OEMStartDoc -// OEMEndDoc -// OEMStartPage -// OEMSendPage -// OEMStartBanding -// OEMNextBand -// OEMEscape -// - -#include "precomp.h" -#include "debug.h" -#include "devmode.h" -#include "oemuni.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -BOOL APIENTRY -OEMCopyBits( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDst, - POINTL *pptlSrc - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvCopyBits. - - DrvCopyBits translates between device-managed - raster surfaces and GDI standard-format bitmaps. - GDI will call DrvCopyBits when it needs to copy from - one surface to another and at least one of the - surfaces is device-managed. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDst - Points to the Dstination surface - psoSrc - Points to the source surface - pxlo - XLATEOBJ provided by the engine - pco - Defines a clipping region on the Dstination surface - pxlo - Defines the translation of color indices - between the source and target surfaces - prclDst - Defines the area to be modified - pptlSrc - Defines the upper-left corner of the source rectangle - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMCopyBits entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvCopyBits)(psoDst, - psoSrc, - pco, - pxlo, - prclDst, - pptlSrc); -} - -BOOL APIENTRY -OEMBitBlt( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDst, - POINTL *pptlSrc, - POINTL *pptlMask, - BRUSHOBJ *pbo, - POINTL *pptlBrush, - ROP4 rop4 - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvBitBlt. - - DrvBitBlt provides general bit-block transfer capabilities - between device-managed surfaces, between GDI-managed - standard-format bitmaps, or between a device-managed - surface and a GDI-managed standard-format bitmap. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDst - Describes the target surface - psoSrc - Describes the source surface - psoMask - Describes the mask for rop4 - pco - Limits the area to be modified - pxlo - Specifies how color indices are translated - between the source and target surfaces - prclDst - Defines the area to be modified - pptlSrc - Defines the upper left corner of the source rectangle - pptlMask - Defines which pixel in the mask corresponds to - the upper left corner of the source rectangle - pbo - Defines the pattern for bitblt - pptlBrush - Defines the origin of the brush in the Dstination surface - rop4 - ROP code that defines how the mask, pattern, source, and - Dstination pixels are combined to write to the Dstination surface - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMBitBlt entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvBitBlt)(psoDst, - psoSrc, - psoMask, - pco, - pxlo, - prclDst, - pptlSrc, - pptlMask, - pbo, - pptlBrush, - rop4); -} - -BOOL APIENTRY -OEMStretchBlt( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - COLORADJUSTMENT *pca, - POINTL *pptlHTOrg, - RECTL *prclDst, - RECTL *prclSrc, - POINTL *pptlMask, - ULONG iMode - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvStretchBlt. - - DrvStretchBlt provides stretching bit-block transfer - capabilities between any combination of device-managed - and GDI-managed surfaces. DrvStretchBlt enables the - device driver to write to GDI bitmaps, especially when the - driver can do halftoning. This function allows the same - halftoning algorithm to be applied to GDI bitmaps and - device surfaces. This function can be provided to handle - only certain forms of stretching, such as by integer multiples. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDst - Defines the surface on which to draw - psoSrc - Defines the source for blt operation - psoMask - Defines a surface that provides a mask for the source - pco - Limits the area to be modified on the Dstination - pxlo - Specifies how color dwIndexes are to be translated - between the source and target surfaces - pca - Defines color adjustment values to be applied to the source bitmap - pptlHTOrg - Specifies the origin of the halftone brush - prclDst - Defines the area to be modified on the Dstination surface - prclSrc - Defines the area to be copied from the source surface - pptlMask - Specifies which pixel in the given mask corresponds to - the upper left pixel in the source rectangle - iMode - Specifies how source pixels are combined to get output pixels - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMStretchBlt entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvStretchBlt)(psoDst, - psoSrc, - psoMask, - pco, - pxlo, - pca, - pptlHTOrg, - prclDst, - prclSrc, - pptlMask, - iMode); -} - -ULONG APIENTRY -OEMDitherColor( - DHPDEV dhpdev, - ULONG iMode, - ULONG rgbColor, - ULONG *pulDither - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvDitherColor. - - DrvDitherColor requests the device to create a - brush dithered against a device palette. - - Please refer to DDK documentation for more details. - -Arguments: - - dhpdev - DHPDEV passed, it is our pDEV - iMode - Not used - rgbColor - Solid rgb color to be used - pulDither - buffer to put the halftone brush. - -Return Value: - - Returns halftone method. - - DCR_DRIVER if the dither values have been calculated by the driver. - DCR_SOLID if the engine should use the best solid color approximation of the color. - DCR_HALFTONE if the engine should create a halftone approximation for the driver. - ---*/ - -{ - VERBOSE("OEMDitherColor entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvDitherColor)(dhpdev, - iMode, - rgbColor, - pulDither); -} - -BOOL APIENTRY -OEMStretchBltROP( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - COLORADJUSTMENT *pca, - POINTL *pptlHTOrg, - RECTL *prclDst, - RECTL *prclSrc, - POINTL *pptlMask, - ULONG iMode, - BRUSHOBJ *pbo, - ROP4 rop4 - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvStretchBltROP. - - DrvStretchBltROP performs a stretching bit-block transfer - using a ROP. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDst - Specifies the target surface - psoSrc - Specifies the source surface - psoMask - Specifies the mask surface - pco - Limits the area to be modified - pxlo - Specifies how color indices are translated - between the source and target surfaces - pca - Defines color adjustment values to be applied to the source bitmap - pptlHTOrg - Specifies the halftone origin - prclDst - Area to be modified on the destination surface - prclSrc - Rectangle area on the source surface - pptlMask - Defines which pixel in the mask corresponds to - the upper left corner of the source rectangle - iMode - Specifies how source pixels are combined to get output pixels - pbo - Defines the pattern for bitblt - rop4 - ROP code that defines how the mask, pattern, source, and - destination pixels are combined on the destination surface - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMStretchBltROP entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvStretchBltROP)(psoDst, - psoSrc, - psoMask, - pco, - pxlo, - pca, - pptlHTOrg, - prclDst, - prclSrc, - pptlMask, - iMode, - pbo, - rop4); -} - -BOOL APIENTRY -OEMPlgBlt( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - COLORADJUSTMENT *pca, - POINTL *pptlBrushOrg, - POINTFIX *pptfixDest, - RECTL *prclSrc, - POINTL *pptlMask, - ULONG iMode - ) -/*++ - -Routine Description: - - Implementation of DDI hook for DrvPlgBlt. - - DrvPlgBlt provides rotate bit-block transfer capabilities between - combinations of device-managed and GDI-managed surfaces. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDst - Defines the surface on which to draw - psoSrc - Defines the source for blt operation - psoMask - Defines a surface that provides a mask for the source - pco - Limits the area to be modified on the Dstination - pxlo - Specifies how color dwIndexes are to be translated - between the source and target surfaces - pca - Defines color adjustment values to be applied to the source bitmap - pptlBrushOrg - Specifies the origin of the halftone brush - pptfixDest - Defines the area to be modified on the Dstination surface - prclSrc - Defines the area to be copied from the source surface - pptlMask - Specifies which pixel in the given mask corresponds to - the upper left pixel in the source rectangle - iMode - Specifies how source pixels are combined to get output pixels - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMPlgBlt entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvPlgBlt)(psoDst, - psoSrc, - psoMask, - pco, - pxlo, - pca, - pptlBrushOrg, - pptfixDest, - prclSrc, - pptlMask, - iMode); -} - -BOOL APIENTRY -OEMPaint( - SURFOBJ *pso, - CLIPOBJ *pco, - BRUSHOBJ *pbo, - POINTL *pptlBrushOrg, - MIX mix - ) -/*++ - -Routine Description: - - Implementation of DDI hook for DrvPaint. - - DrvPaint is an obsolete function. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface on which to draw - pco - Limits the area to be modified on the Dstination - pbo - Points to a BRUSHOBJ which defined the pattern and colors to fill with - pptlBrushOrg - Specifies the origin of the halftone brush - mix - Defines the foreground and background raster operations to use for - the brush - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMPaint entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvPaint)(pso, - pco, - pbo, - pptlBrushOrg, - mix); -} - -BOOL APIENTRY -OEMRealizeBrush( - BRUSHOBJ *pbo, - SURFOBJ *psoTarget, - SURFOBJ *psoPattern, - SURFOBJ *psoMask, - XLATEOBJ *pxlo, - ULONG iHatch - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvRealizeBrush. - - DrvRealizeBrush requests that the driver realize a specified brush - for a specified surface. To realize a brush, the driver converts a - GDI brush into a form that can be used internally. A realized brush - contains device-specific information needed by the device to - accelerate drawing using the brush. The driver's realization of a brush - is written into the buffer allocated by a call to BRUSHOBJ_pvAllocRBrush. - - Please refer to DDK documentation for more details. - -Arguments: - - pbo - BRUSHOBJ to be realized - psoTarget - Defines the surface for which the brush is to be realized - psoPattern - Defines the pattern for the brush - psoMask - Transparency mask for the brush - pxlo - Defines the interpretration of colors in the pattern - iHatch - Specifies whether psoPattern is one of the hatch brushes - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMRealizeBrush entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoTarget->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvRealizeBrush)(pbo, - psoTarget, - psoPattern, - psoMask, - pxlo, - iHatch); -} - -BOOL APIENTRY -OEMStrokePath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - XFORMOBJ *pxo, - BRUSHOBJ *pbo, - POINTL *pptlBrushOrg, - LINEATTRS *plineattrs, - MIX mix - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvStrokePath. - - DrvStrokePath strokes a path when called by GDI. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Identifies the surface on which to draw - ppo - Defines the path to be stroked - pco - Defines the clipping path - pxo - Specifies the world to device coordinate transformation - pbo - Specifies the brush to be used when drawing the path - pptlBrushOrg - Defines the brush origin - plineattrs - Defines the line attributes - mix - Specifies how to combine the brush with the destination - -Return Value: - - TRUE if successful - FALSE if driver cannot handle the path - DDI_ERROR if there is an error - ---*/ - -{ - VERBOSE("OEMStrokePath entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvStrokePath)(pso, - ppo, - pco, - pxo, - pbo, - pptlBrushOrg, - plineattrs, - mix); -} - -BOOL APIENTRY -OEMFillPath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - BRUSHOBJ *pbo, - POINTL *pptlBrushOrg, - MIX mix, - FLONG flOptions - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvFillPath. - - DrvFillPath is an optional entry point to handle the filling of closed paths. - GDI can call DrvFillPath to fill a path on a device-managed surface. - When deciding whether to call this function, GDI compares the fill - requirements with the following flags in the flGraphicsCaps member of - the DEVINFO structure: GCAPS_BEZIERS, GCAPS_ALTERNATEFILL, - and GCAPS_WINDINGFILL. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface on which to draw. - ppo - Defines the path to be filled - pco - Defines the clipping path - pbo - Defines the pattern and colors to fill with - pptlBrushOrg - Defines the brush origin - mix - Defines the foreground and background ROPs to use for the brush - flOptions - Whether to use zero-winding or odd-even rule - -Return Value: - - TRUE if successful - FALSE if driver cannot handle the path - DDI_ERROR if there is an error - ---*/ - -{ - VERBOSE("OEMFillPath entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvFillPath)(pso, - ppo, - pco, - pbo, - pptlBrushOrg, - mix, - flOptions); -} - -BOOL APIENTRY -OEMStrokeAndFillPath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - XFORMOBJ *pxo, - BRUSHOBJ *pboStroke, - LINEATTRS *plineattrs, - BRUSHOBJ *pboFill, - POINTL *pptlBrushOrg, - MIX mixFill, - FLONG flOptions - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvStrokeAndFillPath. - - DrvStrokeAndFillPath strokes and fills a path concurrently. - The driver can return FALSE if the path or the clipping is too - complex for the device to handle; in that case, GDI converts - to a simpler call. For example, if the device driver has set the - GCAPS_BEZIERS flag in the flGraphicsCaps member of the - DEVINFO structure and then receives a path with Bezier curves, - it can return FALSE; GDI will then convert the Bezier curves to - lines and call DrvStrokeAndFillPath again. If the device driver - returns FALSE again, GDI will further simplify the call, making - calls to DrvStrokePath and DrvFillPath, or to DrvBitBlt, depending - on the mix and width of the lines making up the path. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Describes the surface on which to draw - ppo - Describes the path to be filled - pco - Defines the clipping path - pxo - Specifies the world to device coordinate transformation - pboStroke - Specifies the brush to use when stroking the path - plineattrs - Specifies the line attributes - pboFill - Specifies the brush to use when filling the path - pptlBrushOrg - Specifies the brush origin for both brushes - mixFill - Specifies the foreground and background ROPs to use - for the fill brush - flOptions - Whether to use zero-winding or odd-even rule - -Return Value: - - TRUE if successful - FALSE if driver cannot handle the path - DDI_ERROR if there is an error - ---*/ - -{ - VERBOSE("OEMStrokeAndFillPath entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvStrokeAndFillPath)(pso, - ppo, - pco, - pxo, - pboStroke, - plineattrs, - pboFill, - pptlBrushOrg, - mixFill, - flOptions); -} - -BOOL APIENTRY -OEMLineTo( - SURFOBJ *pso, - CLIPOBJ *pco, - BRUSHOBJ *pbo, - LONG x1, - LONG y1, - LONG x2, - LONG y2, - RECTL *prclBounds, - MIX mix - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvLineTo. - - DrvLineTo draws a single, solid, integer-only cosmetic line. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Describes the surface on which to draw - pco - Defines the clipping path - pbo - Defines the brush used to draw the line - x1,y1 - Specifies the line's starting point - x2,y2 - Specifies the line's ending point - prclBounds - Defines a rectangle that bounds the unclipped line. - mix - Specifies the foreground and background ROP - -Return Value: - - TRUE if successful - FALSE if driver cannot handle the path - DDI_ERROR if there is an error - ---*/ - -{ - VERBOSE("OEMLineTo entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvLineTo)(pso, - pco, - pbo, - x1, - y1, - x2, - y2, - prclBounds, - mix); -} - -BOOL APIENTRY -OEMAlphaBlend( - SURFOBJ *psoDest, - SURFOBJ *psoSrc, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDest, - RECTL *prclSrc, - BLENDOBJ *pBlendObj - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvAlphaBlend. - - DrvAlphaBlend provides bit-block transfer capabilities with alpha blending. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDest - Defines the surface on which to draw - psoSrc - Defines the source - pco - Limits the area to be modified on the Destination - pxlo - Specifies how color dwIndexes are to be translated - between the source and target surfaces - prclDest - Defines the area to be modified on the Destination surface - prclSrc - Defines the area to be copied from the source surface - BlendFunction - Specifies the blend function to be used - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMAlphaBlend entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDest->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvAlphaBlend)(psoDest, - psoSrc, - pco, - pxlo, - prclDest, - prclSrc, - pBlendObj); -} - -BOOL APIENTRY -OEMGradientFill( - SURFOBJ *psoDest, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - TRIVERTEX *pVertex, - ULONG nVertex, - PVOID pMesh, - ULONG nMesh, - RECTL *prclExtents, - POINTL *pptlDitherOrg, - ULONG ulMode - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvGradientFill. - - DrvGradientFill shades the specified primitives. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDest - Defines the surface on which to draw - pco - Limits the area to be modified on the Destination - pxlo - Should be ignored by the driver - pVertex - Pointer to an array of TRIVERTEX structures, - with each entry containing position and color information - nVertex - Specifies the number of TRIVERTEX structures in the - array to which pVertex points - pMesh - Pointer to an array of structures that define the connectivity - of the TRIVERTEX elements to which pVertex points - nMesh - Specifies the number of elements in the array to which - pMesh points - prclExtents - Pointer to a RECTL structure that defines the area in - which the gradient drawing is to occur - pptlDitherOrg - Pointer to a POINTL structure that defines the origin - on the surface for dithering - ulMode - Specifies the current drawing mode and how to interpret - the array to which pMesh points - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMGradientFill entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDest->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvGradientFill)(psoDest, - pco, - pxlo, - pVertex, - nVertex, - pMesh, - nMesh, - prclExtents, - pptlDitherOrg, - ulMode); -} - -BOOL APIENTRY -OEMTransparentBlt( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDst, - RECTL *prclSrc, - ULONG iTransColor, - ULONG ulReserved - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvTransparentBlt. - - DrvTransparentBlt provides bit-block transfer capabilities with - transparency. - - Please refer to DDK documentation for more details. - -Arguments: - - psoDst - Defines the surface on which to draw - psoSrc - Defines the source - pco - Limits the area to be modified on the Destination - pxlo - Specifies how color dwIndexes are to be translated - between the source and target surfaces - prclDst - Defines the area to be modified on the Destination surface - prclSrc - Defines the area to be copied from the source surface - iTransColor - Specifies the transparent color - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMTransparentBlt entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvTransparentBlt)(psoDst, - psoSrc, - pco, - pxlo, - prclDst, - prclSrc, - iTransColor, - ulReserved); -} - -BOOL APIENTRY -OEMTextOut( - SURFOBJ *pso, - STROBJ *pstro, - FONTOBJ *pfo, - CLIPOBJ *pco, - RECTL *prclExtra, - RECTL *prclOpaque, - BRUSHOBJ *pboFore, - BRUSHOBJ *pboOpaque, - POINTL *pptlOrg, - MIX mix - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvTextOut. - - DrvTextOut is the entry point from GDI that calls for the - driver to render a set of glyphs at specified positions. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface on which to be written. - pstro - Defines the glyphs to be rendered and their positions - pfo - Specifies the font to be used - pco - Defines the clipping path - prclExtra - A NULL-terminated array of rectangles to be filled - prclOpaque - Specifies an opaque rectangle - pboFore - Defines the foreground brush - pboOpaque - Defines the opaque brush - pptlOrg - Pointer to POINT struct , defining th origin - mix - Specifies the foreground and background ROPs for pboFore - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMTextOut entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvTextOut)(pso, - pstro, - pfo, - pco, - prclExtra, - prclOpaque, - pboFore, - pboOpaque, - pptlOrg, - mix); -} - -PIFIMETRICS APIENTRY -OEMQueryFont( - DHPDEV dhpdev, - ULONG_PTR iFile, - ULONG iFace, - ULONG_PTR *pid - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvQueryFont. - - DrvQueryFont is used by GDI to get the IFIMETRICS structure - for a given font. - - Please refer to DDK documentation for more details. - -Arguments: - - dhpdev - Driver device handle - iFile - Identifies the driver font file - iFace - One-based index of the driver font - pid - Points to a LONG variable for returning an identifier - which GDI will pass to DrvFree - -Return Value: - - Pointer to an IFIMETRICS structure for the given font. - NULL if there is an error - ---*/ - -{ - VERBOSE("OEMQueryFont entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvQueryFont)(dhpdev, - iFile, - iFace, - pid); -} - -PVOID APIENTRY -OEMQueryFontTree( - DHPDEV dhpdev, - ULONG_PTR iFile, - ULONG iFace, - ULONG iMode, - ULONG_PTR *pid - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvQueryFontTree. - - DrvQueryFontTree provides GDI with a pointer to a structure that - defines one of the following: - - A mapping from Unicode to glyph handles, including glyph variants - - A mapping of kerning pairs to kerning handles - - Please refer to DDK documentation for more details. - -Arguments: - - dhpdev - Driver device handle - iFile - Identifies the driver font file - iFace - One-based index of the driver font - iMode - Specifies the type of information to be provided - pid - Points to a LONG variable for returning an identifier - which GDI will pass to DrvFree - -Return Value: - - Pointer to the structure requested based on iMode. - NULL if there is an error - ---*/ - -{ - VERBOSE("OEMQueryFontTree entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvQueryFontTree)(dhpdev, - iFile, - iFace, - iMode, - pid); -} - -LONG APIENTRY -OEMQueryFontData( - DHPDEV dhpdev, - FONTOBJ *pfo, - ULONG iMode, - HGLYPH hg, - GLYPHDATA *pgd, - _Out_writes_bytes_(cjSize) PVOID pv, - ULONG cjSize - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvQueryFontData. - - DrvQueryFontData retrieves information about a realized font. - GDI provides a pointer to an array of glyph or kerning handles, - and the driver returns information about the glyphs or kerning - pairs. The driver can assume that all handles in the array are valid. - - Please refer to DDK documentation for more details. - -Arguments: - - dhpdev - Driver device handle - pfo - Points to a FONTOBJ structure - iMode - Type of information requested - hg - A glyph handle - pgd - Points to a GLYPHDATA structure - pv - Points to output buffer - cjSize - Size of output buffer - -Return Value: - - Depends on iMode. FD_ERROR if there is an error - ---*/ - -{ - VERBOSE("OEMQueryFontData entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvQueryFontData)(dhpdev, - pfo, - iMode, - hg, - pgd, - pv, - cjSize); -} - -ULONG APIENTRY -OEMFontManagement( - SURFOBJ *pso, - FONTOBJ *pfo, - ULONG iMode, - ULONG cjIn, - _In_reads_bytes_(cjIn) PVOID pvIn, - ULONG cjOut, - _Out_writes_bytes_(cjOut) PVOID pvOut - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvFontManagement. - - Is this function valid for Unidrv drivers? - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Points to a SURFOBJ structure - pfo - Points to a FONTOBJ structure - iMode - Escape number - cjIn - Size of input buffer - pvIn - Points to input buffer - cjOut - Size of output buffer - pvOut - Points to output buffer - -Return Value: - - 0x00000001 to 0x7fffffff for success - 0x80000000 to 0xffffffff for failure - 0 if the specified escape number if not supported - ---*/ - -{ - VERBOSE("OEMFontManagement entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvFontManagement)(pso, - pfo, - iMode, - cjIn, - pvIn, - cjOut, - pvOut); -} - -BOOL APIENTRY -OEMQueryAdvanceWidths( - DHPDEV dhpdev, - FONTOBJ *pfo, - ULONG iMode, - _In_reads_(cGlyphs) HGLYPH *phg, - _Out_writes_bytes_(cGlyphs*sizeof(USHORT)) PVOID pvWidths, - ULONG cGlyphs - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvQueryAdvanceWidths. - - DrvQueryAdvanceWidths returns character advance widths - for a specified set of glyphs. - - Please refer to DDK documentation for more details. - -Arguments: - - dhpdev - Driver device handle - pfo - Points to a FONTOBJ structure - iMode - Type of information to be provided - phg - Points to an array of HGLYPHs for which the driver will - provide character advance widths - pvWidths - Points to a buffer for returning width data - cGlyphs - Number of glyphs in the phg array - -Return Value: - - Depends on iMode - ---*/ - -{ - VERBOSE("OEMQueryAdvanceWidths entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvQueryAdvanceWidths)(dhpdev, - pfo, - iMode, - phg, - pvWidths, - cGlyphs); -} - -ULONG APIENTRY -OEMGetGlyphMode( - DHPDEV dhpdev, - FONTOBJ *pfo - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvGetGlyphMode. - - DrvGetGlyphMode tells GDI how to cache glyph information. - GDI calls a driver's DrvGetGlyphMode routine to determine the - range of font information that should be cached for a particular - font; that is, DrvGetGlyphMode determines what GDI stores in - its font cache. A device that caches fonts on its own should return - FO_HGLYPHS to minimize the storage requirements for the font. - GDI calls DrvGetGlyphMode for each font realization. For example, - a driver might want to download outlines for point sizes larger than - 12 point, but raster images for smaller fonts. However, GDI reserves - the right to refuse this request. - - Please refer to DDK documentation for more details. - -Arguments: - - dhpdev - Driver device handle - pfo - Points to a FONTOBJ structure - -Return Value: - - The glyph mode or FO_GLYPHMODE, which is the default. - ---*/ - -{ - VERBOSE("OEMGetGlyphMode entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvGetGlyphMode)(dhpdev, - pfo); -} - -BOOL APIENTRY -OEMStartDoc( - SURFOBJ *pso, - _In_ PWSTR pwszDocName, - DWORD dwJobId - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvStartDoc. - - DrvStartDoc is called by GDI when it is ready to - start sending a document to the driver for rendering. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface object - pDocName - Specifies a Unicode document name - jobId - Identifies the print job - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMStartDoc entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvStartDoc)(pso, - pwszDocName, - dwJobId); -} - -BOOL APIENTRY -OEMEndDoc( - SURFOBJ *pso, - FLONG fl - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvEndDoc. - - DrvEndDoc is called by GDI when it has finished - sending a document to the driver for rendering. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface object - flags - A set of flag bits - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMEndDoc entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvEndDoc)(pso, - fl); -} - -BOOL APIENTRY -OEMStartPage( - SURFOBJ *pso - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvStartPage. - - DrvStartPage is called by GDI when it is ready to - start sending the contents of a physical page to the - driver for rendering. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface object - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMStartPage entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvStartPage)(pso); -} - -BOOL APIENTRY -OEMSendPage( - SURFOBJ *pso - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvSendPage. - - DrvSendPage is called by GDI when it has finished - drawing a physical page, so the driver can send - the page to the printer. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface object - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMSendPage entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvSendPage)(pso); -} - -BOOL APIENTRY -OEMStartBanding( - SURFOBJ *pso, - POINTL *pptl - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvStartBanding. - - DrvStartBanding is called by GDI when it is ready to start - sending bands of a physical page to the driver for rendering. - Note: DrvStartBanding is called to prepare the driver - for banding, call only once per page (not at everyband!!) - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface object - pptl - Pointer to origin of next band (to return to GDI) - -Return Value: - - Fill out pptl to contain the origin of the first band - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMStartBanding entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvStartBanding)(pso, - pptl); -} - -BOOL APIENTRY -OEMNextBand( - SURFOBJ *pso, - POINTL *pptl - ) - -/*++ - -Routine Description: - - Implementation of DDI hook for DrvNextBand. - - DrvNextBand is called by GDI when it has finished - drawing a band for a physical page, so the driver - can send the band to the printer. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface object - pptl - Pointer to origin of next band (to return to GDI) - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("OEMNextBand entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvNextBand)(pso, - pptl); -} - -ULONG APIENTRY -OEMEscape( - SURFOBJ *pso, - ULONG iEsc, - ULONG cjIn, - _In_reads_bytes_(cjIn) PVOID pvIn, - ULONG cjOut, - _Out_writes_bytes_(cjOut) PVOID pvOut - ) - -/*++ - -Routine Description: - - Implementation of DDI entry point DrvEscape. - - DrvEscape is used for retrieving information from a device - that is not available in a device-independent device driver - interface; the particular query depends on the value of the - iEsc parameter. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Describes the surface the call is directed to - iEsc - Specifies a query - cjIn - Specifies the size in bytes of the buffer pointed to by pvIn - pvIn - Points to input data buffer - cjOut - Specifies the size in bytes of the buffer pointed to by pvOut - pvOut - Points to the output buffer - -Return Value: - - Depends on the query specified by iEsc parameter. - - Zero if the function specified by the query is not supported. - ---*/ - -{ - VERBOSE("OEMEscape entry."); - - PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev; - POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM; - - // Punt call back to UNIDRV. - // - return (pOemPDEV->m_pfnDrvEscape)(pso, - iEsc, - cjIn, - pvIn, - cjOut, - pvOut); -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/debug.h b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/debug.h deleted file mode 100644 index 0414569c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/debug.h +++ /dev/null @@ -1,82 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.H -// -// PURPOSE: Define common data types, and external function prototypes -// for debugging functions. Also defines the various debug macros. -// -// - -#pragma once - -///////////////////////////////////////////////////////// -// Macros -///////////////////////////////////////////////////////// -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// WARNING("App passed NULL pointer, ignoring...\n"); -// - -#define DBG_VERBOSE 0 -#define DBG_WARNING 1 -#define DBG_ERROR 2 -#define DBG_NONE 3 - -// VC and Build use different debug defines. -#if defined (DBG) || defined (_DEBUG) - - // __declspec(selectany) ensures that even if this is defined in multiple compilation - // modules, they will all resolve to the same symbol in the linked DLL - __declspec(selectany) INT giDebugLevel = 2; - - #define STRINGIZE(x) #x - #define QUOTE(x) STRINGIZE(x) - #define FILE_AND_LINE __FILE__ "@" QUOTE(__LINE__) - - #define VERBOSE(msg) { if(giDebugLevel <= DBG_VERBOSE) OutputDebugStringA( FILE_AND_LINE ": " msg); } - #define WARNING(msg) { if(giDebugLevel <= DBG_WARNING) OutputDebugStringA( FILE_AND_LINE ": Warning: " msg); } - #define ERR(msg) { if(giDebugLevel <= DBG_ERROR) OutputDebugStringA(FILE_AND_LINE ": Error:" msg); } - #define ASSERT(cond) { if (!(cond)) RIP("\n"); } - #define RIP(msg) { OutputDebugStringA(FILE_AND_LINE ": Error (not recoverable): " msg); DebugBreak(); } - -#else // !DBG - - #define VERBOSE(msg) - #define WARNING(msg) - #define ERR(msg) - #define ASSERT(cond) - #define RIP(msg) - -#endif - - - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/devmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/devmode.cpp deleted file mode 100644 index 6196a054..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/devmode.cpp +++ /dev/null @@ -1,222 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.cpp -// -// PURPOSE: Implementation of Devmode functions shared with OEM UI and OEM rendering modules. -// - -#include "precomp.h" - -#include "resource.h" -#include "devmode.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -HRESULT hrOEMDevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DevMode. - hrOEMDevMode is called by IPrintOemUni::DevMode - which is defined in intrface.cpp. - - The IPrintOemUni::DevMode method, provided by - rendering plug-ins for Unidrv, performs operations - on private DEVMODE members. - - Please refer to DDK documentation for more details. - -Arguments: - - dwMode - caller-supplied constant. Refer to the docs - for more information. - pOemDMParam - pointer to an OEMDMPARAM structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - ---*/ - -{ - POEMDEV pOEMDevIn; - POEMDEV pOEMDevOut; - - VERBOSE("hrOEMDevMode entry."); - - // Verify parameters. - if( (NULL == pOemDMParam) - || - ( (OEMDM_SIZE != dwMode) - && - (OEMDM_DEFAULT != dwMode) - && - (OEMDM_CONVERT != dwMode) - && - (OEMDM_MERGE != dwMode) - )) - { - ERR("DevMode() ERROR_INVALID_PARAMETER.\r\n"); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Cast generic (i.e. PVOID) to OEM private devmode pointer type. - pOEMDevIn = (POEMDEV) pOemDMParam->pOEMDMIn; - pOEMDevOut = (POEMDEV) pOemDMParam->pOEMDMOut; - - switch(dwMode) - { - case OEMDM_SIZE: - pOemDMParam->cbBufSize = sizeof(OEMDEV); - break; - - case OEMDM_DEFAULT: - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->dwDriverData = 0; - break; - - case OEMDM_CONVERT: - bConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - break; - - case OEMDM_MERGE: - bConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - bMakeOEMDevmodeValid(pOEMDevOut); - break; - } - - return S_OK; -} - - -BOOL bConvertOEMDevmode( - PCOEMDEV pOEMDevIn, - POEMDEV pOEMDevOut - ) - -/*++ - -Routine Description: - - Converts private DEVMODE members to the - current version. - -Arguments: - - pOEMDevIn - pointer to OEM private devmode - pOEMDevOut - pointer to OEM private devmode - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - VERBOSE("bConvertOEMDevmode entry."); - - if( (NULL == pOEMDevIn) - || - (NULL == pOEMDevOut) - ) - { - ERR("ConvertOEMDevmode() invalid parameters.\r\n"); - return FALSE; - } - - // Check OEM Signature, if it doesn't match ours, - // then just assume DMIn is bad and use defaults. - if(pOEMDevIn->dmOEMExtra.dwSignature == pOEMDevOut->dmOEMExtra.dwSignature) - { - VERBOSE("Converting private OEM Devmode.\r\n"); - - // Set the devmode defaults so that anything the isn't copied over will - // be set to the default value. - pOEMDevOut->dwDriverData = 0; - - // Copy the old structure in to the new using which ever size is the smaller. - // Devmode maybe from newer Devmode (not likely since there is only one), or - // Devmode maybe a newer Devmode, in which case it maybe larger, - // but the first part of the structure should be the same. - - // DESIGN ASSUMPTION: the private DEVMODE structure only gets added to; - // the fields that are in the DEVMODE never change only new fields get added to the end. - - memcpy(pOEMDevOut, pOEMDevIn, __min(pOEMDevOut->dmOEMExtra.dwSize, pOEMDevIn->dmOEMExtra.dwSize)); - - // Re-fill in the size and version fields to indicated - // that the DEVMODE is the current private DEVMODE version. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - } - else - { - VERBOSE("Unknown DEVMODE signature, pOEMDMIn ignored.\r\n"); - - // Don't know what the input DEVMODE is, so just use defaults. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->dwDriverData = 0; - } - - return TRUE; -} - - -BOOL bMakeOEMDevmodeValid( - POEMDEV pOEMDevmode - ) - -/*++ - -Routine Description: - - Ensures that private OEM devmode members are valid. - -Arguments: - - pOEMDevmode - pointer to OEM private devmode - -Return Value: - - TRUE if successful, FALSE if there is an error - ---*/ - -{ - if(NULL == pOEMDevmode) - { - return FALSE; - } - - // ASSUMPTION: pOEMDevmode is large enough to contain OEMDEV structure. - - // Make sure that dmOEMExtra indicates the current OEMDEV structure. - pOEMDevmode->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevmode->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevmode->dmOEMExtra.dwVersion = OEM_VERSION; - - // Set driver data. - pOEMDevmode->dwDriverData = 0; - - return TRUE; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/devmode.h b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/devmode.h deleted file mode 100644 index 02af4909..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/devmode.h +++ /dev/null @@ -1,43 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.h -// -// PURPOSE: Define common data types, and external function prototypes -// for devmode functions. -// - -#pragma once - -//////////////////////////////////////////////////////// -// OEM Devmode Defines -//////////////////////////////////////////////////////// - -#define OEM_SIGNATURE 'MSFT' -#define OEM_VERSION 0x00000001L - -//////////////////////////////////////////////////////// -// OEM Devmode Type Definitions -//////////////////////////////////////////////////////// - -typedef struct tagOEMDEV -{ - OEM_DMEXTRAHEADER dmOEMExtra; - BOOL dwDriverData; -} OEMDEV, *POEMDEV; - -typedef const OEMDEV *PCOEMDEV; - - -///////////////////////////////////////////////////////// -// ProtoTypes -///////////////////////////////////////////////////////// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam); -BOOL bConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut); -BOOL bMakeOEMDevmodeValid(POEMDEV pOEMDevmode); - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/dllentry.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/dllentry.cpp deleted file mode 100644 index 8ed3e0e7..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/dllentry.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cpp -// -// PURPOSE: Source module for DLL entry function(s). -// - -#include "precomp.h" - -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -/////////////////////////////////////////////////////////// -// -// DLL entry point -// - -// DllMain isn't called/used for kernel mode version. -// -BOOL WINAPI DllMain(HINSTANCE hInst, WORD wReason, LPVOID lpReserved) -{ - VERBOSE("DllMain entry."); - - UNREFERENCED_PARAMETER(hInst); - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - VERBOSE("Process attach.\r\n"); - break; - - case DLL_THREAD_ATTACH: - VERBOSE("Thread attach.\r\n"); - break; - - case DLL_PROCESS_DETACH: - VERBOSE("Process detach.\r\n"); - break; - - case DLL_THREAD_DETACH: - VERBOSE("Thread detach.\r\n"); - break; - } - - return TRUE; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/intrface.cpp deleted file mode 100644 index 8d87053f..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/intrface.cpp +++ /dev/null @@ -1,1797 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.cpp -// -// PURPOSE: Interface for User Mode COM Customization DLL. -// - -#include "precomp.h" -#include "resource.h" -#include "devmode.h" -#include "debug.h" -#include "oemuni.h" -#include "intrface.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -// ================================================================== -// Internal Globals -// -static long g_cComponents; // Count of active components -static long g_cServerLocks; // Count of locks -// -// ================================================================== - -// ================================================================== -// The purpose of this array is to inform UNIDRV of the callbacks -// that are implemented in this driver. -// -// Note that there is *NO* order dependency in this array. New -// index values and their corresponding callbacks can be placed -// anywhere within the list as needed. -// -static const DRVFN s_aOemHookFuncs[] = -{ - // The following are declared in printoem.h and defined in ddihook.cpp. - {INDEX_DrvAlphaBlend, (PFN)OEMAlphaBlend}, - {INDEX_DrvBitBlt, (PFN)OEMBitBlt}, - {INDEX_DrvCopyBits, (PFN)OEMCopyBits}, - {INDEX_DrvDitherColor, (PFN)OEMDitherColor}, - {INDEX_DrvFillPath, (PFN)OEMFillPath}, - {INDEX_DrvFontManagement, (PFN)OEMFontManagement}, - {INDEX_DrvGetGlyphMode, (PFN)OEMGetGlyphMode}, - {INDEX_DrvGradientFill, (PFN)OEMGradientFill}, - {INDEX_DrvLineTo, (PFN)OEMLineTo}, - {INDEX_DrvPaint, (PFN)OEMPaint}, - {INDEX_DrvPlgBlt, (PFN)OEMPlgBlt}, - {INDEX_DrvQueryAdvanceWidths, (PFN)OEMQueryAdvanceWidths}, - {INDEX_DrvQueryFont, (PFN)OEMQueryFont}, - {INDEX_DrvQueryFontData, (PFN)OEMQueryFontData}, - {INDEX_DrvQueryFontTree, (PFN)OEMQueryFontTree}, - {INDEX_DrvRealizeBrush, (PFN)OEMRealizeBrush}, - {INDEX_DrvStretchBlt, (PFN)OEMStretchBlt}, - {INDEX_DrvStretchBltROP, (PFN)OEMStretchBltROP}, - {INDEX_DrvStrokeAndFillPath, (PFN)OEMStrokeAndFillPath}, - {INDEX_DrvStrokePath, (PFN)OEMStrokePath}, - {INDEX_DrvTextOut, (PFN)OEMTextOut}, - {INDEX_DrvTransparentBlt, (PFN)OEMTransparentBlt}, - {INDEX_DrvStartDoc, (PFN)OEMStartDoc}, - {INDEX_DrvEndDoc, (PFN)OEMEndDoc}, - {INDEX_DrvStartPage, (PFN)OEMStartPage}, - {INDEX_DrvSendPage, (PFN)OEMSendPage}, - {INDEX_DrvStartBanding, (PFN)OEMStartBanding}, - {INDEX_DrvNextBand, (PFN)OEMNextBand}, - {INDEX_DrvEscape, (PFN)OEMEscape} -}; - -//////////////////////////////////////////////////////////////////////////////// -// -// COemUni2 body -// -COemUni2::COemUni2() -{ - m_cRef = 1; - - // Increment COM component count. - InterlockedIncrement(&g_cComponents); - - m_pOEMHelp = NULL; -} - -COemUni2::~COemUni2() -{ - // Make sure that helper interface is released. - if(NULL != m_pOEMHelp) - { - m_pOEMHelp->Release(); - m_pOEMHelp = NULL; - } - - // If this instance of the object is being deleted, then the reference - // count should be zero. - assert(0 == m_cRef); -} - -HRESULT __stdcall -COemUni2:: -QueryInterface( - const IID& iid, - void** ppv - ) -{ - VERBOSE("COemUni2::QueryInterface() entry."); - - if (iid == IID_IUnknown) - { - *ppv = static_cast(this); - VERBOSE("COemUni2::QueryInterface IUnknown.\r\n"); - } - else if (iid == IID_IPrintOemUni2) - { - VERBOSE("COemUni2::QueryInterface IPrintOemUni2.\r\n"); - - *ppv = static_cast(this); - } - else - { - WARNING("COemUni2::QueryInterface NULL. Returning E_NOINTERFACE.\r\n"); - - *ppv = NULL; - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -ULONG __stdcall -COemUni2:: -AddRef( - VOID - ) -{ - VERBOSE("COemUni2::AddRef() entry."); - - return InterlockedIncrement(&m_cRef); -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall -COemUni2:: -Release( - VOID - ) -{ - VERBOSE("COemUni2::Release() entry."); - ULONG cRef = InterlockedDecrement(&m_cRef); - - if (cRef == 0) - { - delete this; - return 0; - } - return cRef; -} - -HRESULT __stdcall -COemUni2:: -CommandCallback( - PDEVOBJ pdevobj, - DWORD dwCallbackID, - DWORD dwCount, - PDWORD pdwParams, - OUT INT *piResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::CommandCallback - - The IPrintOemUni::CommandCallback method is used - to provide dynamically generated printer commands - for Unidrv-supported printers. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - dwCallbackID - value representing the printer command's - *CallbackID attribute in the printer's generic printer - description (GPD) file. - dwCount - value representing the number of elements - in the array pointed to by pdwParams. Can be 0. - pdwParams - pointer to an array of DWORD-sized parameters - containing values specified by the printer commands - *Params attribute in the printer's GPD file. Can be NULL. - piResult - Receives a method-supplied result value. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE("COemUni2::CommandCallback() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(dwCallbackID); - UNREFERENCED_PARAMETER(dwCount); - UNREFERENCED_PARAMETER(pdwParams); - - *piResult = 0; - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -Compression( - PDEVOBJ pdevobj, - PBYTE pInBuf, - PBYTE pOutBuf, - DWORD dwInLen, - DWORD dwOutLen, - OUT INT *piResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::Compression - - The IPrintOemUni::Compression method can be used - with Unidrv-supported printers to provide a customized - bitmap compression method. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pInBuf - pointer to input scan line data. - pOutBuf - pointer to an output buffer to receive - compressed scan line data. - dwInLen - length of the input data. - dwOutLen - length of the output buffer. - piResult - Receives a method-supplied result value. If the - operation succeeds, this value should be the number - of compressed bytes, which must not be larger than - the value received for dwOutLen. If an error occurs, - or if the method cannot compress, the result value - should be -1. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE("COemUni2::Compression() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pInBuf); - UNREFERENCED_PARAMETER(pOutBuf); - UNREFERENCED_PARAMETER(dwInLen); - UNREFERENCED_PARAMETER(dwOutLen); - UNREFERENCED_PARAMETER(piResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -DevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DevMode - - The IPrintOemUni::DevMode method, provided by - rendering plug-ins for Unidrv, performs operations - on private DEVMODE members. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::DevMode method. - - Please refer to DDK documentation for more details. - -Arguments: - - dwMode - caller-supplied constant. Refer to the docs - for more information. - pOemDMParam - pointer to an OEMDMPARAM structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - VERBOSE("COemUni2:DevMode entry."); - - return hrOEMDevMode(dwMode, pOemDMParam); -} - -HRESULT __stdcall -COemUni2:: -DisableDriver( - VOID - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DisableDriver - - The IPrintOemUni::DisableDriver method allows a rendering - plug-in for Unidrv to free resources that were allocated by the - plug-in's IPrintOemUni::EnableDriver method. This is the last - IPrintOemUni interface method that is called before the rendering - plug-in is unloaded. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::DisableDriver method. - - Please refer to DDK documentation for more details. - -Arguments: - - VOID - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - VERBOSE("COemUni2::DisableDriver() entry."); - - // Release reference to Printer Driver's interface. - // - if (this->m_pOEMHelp) - { - this->m_pOEMHelp->Release(); - this->m_pOEMHelp = NULL; - } - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -DisablePDEV( - PDEVOBJ pdevobj - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DisablePDEV - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::DisablePDEV method. - - The IPrintOemUni::DisablePDEV method performs the same types of - operations as the DrvDisablePDEV function. Its purpose is to allow a - rendering plug-in to delete the private PDEV structure that is pointed - to by the DEVOBJ structure's pdevOEM member. This PDEV structure - is one that was allocated by the plug-in's IPrintOemUni::EnablePDEV method. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - VERBOSE("COemUni2::DisablePDEV() entry."); - - POEMPDEV pOemPDEV = (POEMPDEV)pdevobj->pdevOEM; - delete pOemPDEV; - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -DownloadCharGlyph( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - HGLYPH hGlyph, - PDWORD pdwWidth, - OUT DWORD *pdwResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DownloadCharGlyph - - The IPrintOemUni::DownloadCharGlyph method enables a - rendering plug-in for Unidrv to send a character glyph for - a specified soft font to the printer. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - hGlyph - glyph handle. - pdwWidth - pointer to receive the method-supplied width of the character. - pdwResult - Receives a method-supplied value representing the amount - of printer memory, in bytes, required to store the character glyph. - If the operation fails, the returned value should be zero. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE("COemUni2::DownloadCharGlyph() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(hGlyph); - UNREFERENCED_PARAMETER(pdwWidth); - UNREFERENCED_PARAMETER(pdwResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -DownloadFontHeader( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DownloadFontHeader - - The IPrintOemUni::DownloadFontHeader method allows a - rendering plug-in for Unidrv to send a font's header - information to a printer. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - pdwResult - Receives a method-supplied value representing the amount - of printer memory, in bytes, required to store the font header - information. If the operation fails, the returned value should be zero. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE("COemUni2::DownloadFontHeader() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(pdwResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -DriverDMS( - PVOID pDevObj, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::DriverDMS - - The IPrintOemUni::DriverDMS method allows a rendering - plug-in for Unidrv to indicate that it uses a device-managed - drawing surface instead of the default GDI-managed surface. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::DriverDMS method. - - Please refer to DDK documentation for more details. For general info - on device managed surfaces and how to handle them, please refer to - the section titled "Handling Device-Managed Surfaces". - -Arguments: - - pDevObj - pointer to a DEVOBJ structure. - pBuffer - pointer to a buffer to receive method-specified flags. - cbSize - size, in bytes, of the buffer pointed to by pBuffer. - pcbNeeded - pointer to a location to receive the required - minimum pBuffer size. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - VERBOSE("COemUni2::DriverDMS() entry."); - - UNREFERENCED_PARAMETER(pDevObj); - UNREFERENCED_PARAMETER(pBuffer); - UNREFERENCED_PARAMETER(cbSize); - UNREFERENCED_PARAMETER(pcbNeeded); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -EnableDriver( - DWORD dwDriverVersion, - DWORD cbSize, - PDRVENABLEDATA pded - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::EnableDriver - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::EnableDriver method. - - The IPrintOemUni::EnableDriver method allows a rendering - plug-in to perform the same types of operations as the - DrvEnableDriver function. Like the DrvEnableDriver function, - the IPrintOemUni::EnableDriver method is responsible for - providing addresses of internally supported graphics DDI functions, - or DDI hook functions. - - The method should fill the supplied DRVENABLEDATA structure - and allocate an array of DRVFN structures. It should fill the - array with pointers to hooking functions, along with winddi.h-defined - index values that identify the hooked out graphics DDI functions. - - Please refer to DDK documentation for more details. - -Arguments: - - DriverVersion - interface version number. This value is - defined by PRINTER_OEMINTF_VERSION, in printoem.h. - cbSize - size, in bytes, of the structure pointed to by pded. - pded - pointer to a DRVENABLEDATA structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - VERBOSE("COemUni2::EnableDriver() entry."); - - UNREFERENCED_PARAMETER(dwDriverVersion); - UNREFERENCED_PARAMETER(cbSize); - - // We need to return the DDI functions that have been hooked - // in pded. Here we fill out the fields in pded. - // - pded->iDriverVersion = PRINTER_OEMINTF_VERSION; - pded->c = sizeof(s_aOemHookFuncs) / sizeof(DRVFN); - pded->pdrvfn = (DRVFN *) s_aOemHookFuncs; - - // Even if nothing is done, need to return S_OK so - // that DisableDriver() will be called, which releases - // the reference to the Printer Driver's interface. - // - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -EnablePDEV( - PDEVOBJ pdevobj, - _In_ PWSTR pPrinterName, - ULONG cPatterns, - HSURF *phsurfPatterns, - ULONG cjGdiInfo, - GDIINFO *pGdiInfo, - ULONG cjDevInfo, - DEVINFO *pDevInfo, - DRVENABLEDATA *pded, - OUT PDEVOEM *pDevOem - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::EnablePDEV - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::EnablePDEV method. - - The IPrintOemUni::EnablePDEV method performs the same types - of operations as the DrvEnablePDEV function that is exported - by a printer graphics DLL. Its purpose is to allow a rendering - plug-in to create its own PDEV structure. For more information - about PDEV structures, see "Customized PDEV Structures" in the DDK docs. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pPrinterName - pointer to a text string representing the - logical address of the printer. - cPatterns - value representing the number of HSURF-typed - surface handles contained in the buffer pointed to by - phsurfPatterns. - phsurfPatterns - pointer to a buffer that is large enough to - contain cPatterns number of HSURF-typed surface handles. - The handles represent surface fill patterns. - cjGdiInfo - value representing the size of the structure pointed - to by pGdiInfo. - pGdiInfo - pointer to a GDIINFO structure. - cjDevInfo - value representing the size of the structure pointed - to by pDevInfo. - pDevInfo - pointer to a DEVINFO structure. - pded - pointer to a DRVENABLEDATA structure containing the - addresses of the printer driver's graphics DDI hooking functions. - pDevOem - Receives a method-supplied pointer to a private PDEV structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - If the operation fails, the method should call SetLastError to set an error code. - - ---*/ - -{ - VERBOSE("COemUni2::EnablePDEV() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(cPatterns); - UNREFERENCED_PARAMETER(phsurfPatterns); - UNREFERENCED_PARAMETER(cjGdiInfo); - UNREFERENCED_PARAMETER(cjDevInfo); - UNREFERENCED_PARAMETER(pDevInfo); - UNREFERENCED_PARAMETER(pGdiInfo); - - // Allocate an instance of our private PDEV. - // - POEMPDEV pOemPDEV = new COemPDEV(); - - if (NULL == pOemPDEV) - { - return NULL; - } - - pOemPDEV->InitializeDDITable(pded); - - *pDevOem = pOemPDEV; - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -FilterGraphics( - PDEVOBJ pdevobj, - PBYTE pBuf, - DWORD dwLen - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::FilterGraphics - - The IPrintOemUni::FilterGraphics method can be used with - Unidrv-supported printers to modify scan line data and send - it to the spooler. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pBuf - pointer to a buffer containing scan line data to be printed. - dwLen - value representing the length, in bytes, of the data - pointed to by pBuf. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - DWORD dwResult; - - VERBOSE("COemUni2::FilterGraphics() entry."); - - m_pOEMHelp->DrvWriteSpoolBuf(pdevobj, pBuf, dwLen, &dwResult); - - if (dwResult == dwLen) - return S_OK; - else - return S_FALSE; -} - -HRESULT __stdcall -COemUni2:: -GetImplementedMethod( - _In_ PSTR pMethodName - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::GetImplementedMethod - - The IPrintOemUni::GetImplementedMethod method is used by - Unidrv to determine which IPrintOemUni interface methods - have been implemented by a rendering plug-in. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::GetImplemented method. - - Please refer to DDK documentation for more details. - -Arguments: - - pMethodName - pointer to a string representing the name of an - IPrintOemUni interface method, such as "ImageProcessing" - for IPrintOemUni::ImageProcessing or "FilterGraphics" for - IPrintOemUni::FilterGraphics. - -Return Value: - - S_OK The operation succeeded (the specified method is implemented). - S_FALSE The operation failed (the specified method is not implemented). - - ---*/ - -{ - HRESULT Result = S_FALSE; - - VERBOSE("COemUni2::GetImplementedMethod() entry."); - - // Unidrv only calls GetImplementedMethod for optional - // methods. The required methods are assumed to be - // supported. - - // Return S_OK for supported function (i.e. implemented), - // and S_FALSE for functions that aren't supported (i.e. not implemented). - switch (*pMethodName) - { - case 'C': - if (!strcmp(NAME_CommandCallback, pMethodName)) - { - Result = S_OK; - } - break; - case 'F': - if (!strcmp(NAME_FilterGraphics, pMethodName)) - { - Result = S_OK; - } - break; - } - - return Result; -} - -HRESULT __stdcall -COemUni2:: -GetInfo( - DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::GetInfo - - A rendering plug-in's IPrintOemUni::GetInfo method returns - identification information. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::GetInfo method. - - Please refer to DDK documentation for more details. - -Arguments: - - dwMode - Contains one of the following caller-supplied integer constants. - OEMGI_GETSIGNATURE - The method must return a unique four-byte - identification signature. The plug-in must also place this signature - in OPTITEM structures, as described in the description of the - OEMCUIPPARAM. structure's pOEMOptItems member. - OEMGI_GETVERSION - The method must return the user interface - plug-in's version number as a DWORD. The version format is - developer-defined. - pBuffer - pointer to memory allocated to receive the information specified - by dwInfo. - cbSize - size of the buffer pointed to by pBuffer. - pcbNeeded - pointer to a location to receive the number of bytes written - into the buffer pointed to by pBuffer. - -Return Value: - - S_OK The operation succeeded (the specified method is implemented). - S_FALSE The operation failed (the specified method is not implemented). - - ---*/ - -{ - PWSTR pszTag = L"COemUni2::GetInfo entry."; - switch(dwMode) - { - case OEMGI_GETSIGNATURE: - pszTag = L"COemUni2::GetInfo entry. [OEMGI_GETSIGNATURE]"; - break; - case OEMGI_GETVERSION: - pszTag = L"COemUni2::GetInfo entry. [OEMGI_GETVERSION]"; - break; - - } - - // Validate parameters. - if( (NULL == pcbNeeded) - || - ( (OEMGI_GETSIGNATURE != dwMode) - && - (OEMGI_GETVERSION != dwMode) ) ) - { - WARNING("COemUni2::GetInfo() exit pcbNeeded is NULL! ERROR_INVALID_PARAMETER.\r\n"); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Set expected buffer size. - *pcbNeeded = sizeof(DWORD); - - // Check buffer size is sufficient. - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - VERBOSE("COemUni2::GetInfo() exit insufficient buffer!\r\n"); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return E_FAIL; - } - - switch(dwMode) - { - // OEM DLL Signature - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // OEM DLL version - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // dwMode not supported. - default: - // Set written bytes to zero since nothing was written. - WARNING("COemUni2::GetInfo() exit mode not supported.\r\n"); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - return E_FAIL; - } - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -HalftonePattern( - PDEVOBJ pdevobj, - PBYTE pHTPattern, - DWORD dwHTPatternX, - DWORD dwHTPatternY, - DWORD dwHTNumPatterns, - DWORD dwCallbackID, - PBYTE pResource, - DWORD dwResourceSize - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::HalftonePattern - - The IPrintOemUni::HalftonePattern method can be used with - Unidrv-supported printers to create or modify a halftone - pattern before it is used in a halftoning operation. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pHTPattern - pointer to a buffer to receive the method-supplied - halftone pattern. Buffer size, in bytes, is: - (((dwHTPatternX * dwHTPatternY) + 3)/4) * 4 * dwHTNumPatterns. - dwHTPatternX - length, in pixels, of the halftone pattern, as specified - by the GPD file's *HTPatternSize attribute. - dwHTPatternY - height, in pixels, of the halftone pattern, as specified - by the GPD file's *HTPatternSize attribute. - dwHTNumPatterns - number of patterns, as specified by the GPD file's - *HTNumPatterns attribute. This can be 1 or 3. - dwCallbackID - value identifying the halftone method, as specified by - the GPD file's *HTCallbackID attribute. - pResource - pointer to a buffer containing a halftone pattern, as - specified by the GPD file's *rcHTPatternID attribute. This can be NULL. - dwResourceSize - size of the halftone pattern contained in the buffer - pointed to by pResource. This is zero if pResource is NULL. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE("COemUni2::HalftonePattern() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pHTPattern); - UNREFERENCED_PARAMETER(dwHTPatternX); - UNREFERENCED_PARAMETER(dwHTPatternY); - UNREFERENCED_PARAMETER(dwHTNumPatterns); - UNREFERENCED_PARAMETER(dwCallbackID); - UNREFERENCED_PARAMETER(pResource); - UNREFERENCED_PARAMETER(dwResourceSize); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -ImageProcessing( - PDEVOBJ pdevobj, - PBYTE pSrcBitmap, - PBITMAPINFOHEADER pBitmapInfoHeader, - PBYTE pColorTable, - DWORD dwCallbackID, - PIPPARAMS pIPParams, - OUT PBYTE *ppbResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::ImageProcessing - - The IPrintOemUni::ImageProcessing method can be used with - Unidrv-supported printers to modify image bitmap data, in order - to perform color formatting or halftoning. The method can return - the modified bitmap to Unidrv or send it directly to the print spooler. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pSrcBitmap - pointer to an input device-independent bitmap (DIB). - pBitmapInfoHeader - pointer to a BITMAPINFOHEADER structure - that describes the bitmap pointed to by pSrcBitmap. - pColorTable - pointer to a color table. Used only if the output format is - eight bits per pixel. - dwCallbackID - value assigned to the *IPCallbackID attribute of the - currently selected option for the ColorMode feature. - pIPParams - pointer to an IPPARAMS structure. - ppbResult - - If the method returns the converted DIB to Unidrv: - If the conversion succeeds, the method should return a - pointer to a buffer containing the converted DIB. - Otherwise it should return NULL. - If the method sends the converted DIB to the print spooler: - If the operation succeeds, the method should return TRUE. - Otherwise it should return FALSE. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE("COemUni2::ImageProcessing() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pSrcBitmap); - UNREFERENCED_PARAMETER(pBitmapInfoHeader); - UNREFERENCED_PARAMETER(pColorTable); - UNREFERENCED_PARAMETER(dwCallbackID); - UNREFERENCED_PARAMETER(pIPParams); - UNREFERENCED_PARAMETER(ppbResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -MemoryUsage( - PDEVOBJ pdevobj, - POEMMEMORYUSAGE pMemoryUsage - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::MemoryUsage - - The IPrintOemUni::MemoryUsage method can be used with - Unidrv-supported printers to specify the amount of memory - required for use by a rendering plug-in's IPrintOemUni::ImageProcessing - method. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pMemoryUsage - pointer to an OEMMEMORYUSAGE structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE("COemUni2::MemoryUsage() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pMemoryUsage); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -OutputCharStr( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - DWORD dwType, - DWORD dwCount, - PVOID pGlyph - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::OutputCharStr - - The IPrintOemUni::OutputCharStr method enables a rendering - plug-in to control the printing of font glyphs. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - dwType - value indicating the type of glyph specifier array - pointed to by pGlyph. Valid values are as follows: - TYPE_GLYPHHANDLE The pGlyph array elements are glyph - handles of type HGLYPH. - TYPE_GLYPHID The pGlyph array elements are glyph - identifiers of type DWORD. - dwCount - value representing the number of glyph specifiers in - the array pointed to by pGlyph. - pGlyph - pointer to an array of glyph specifiers, where the array - element type is indicated by dwType. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE("COemUni2::OutputCharStr() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(dwType); - UNREFERENCED_PARAMETER(dwCount); - UNREFERENCED_PARAMETER(pGlyph); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -PublishDriverInterface( - IUnknown *pIUnknown - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::PublishDriverInterface - - The IPrintOemUni::PublishDriverInterface method allows a - rendering plug-in for Unidrv to obtain the Unidrv driver's - IPrintOemDriverUni interface. - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::PublishDriverInterface method and the method - must return S_OK, or the driver will not call the plug-in's other - IPrintOemUni interface methods. - - Please refer to DDK documentation for more details. - -Arguments: - - pIUnknown - pointer to the IUnknown interface of the driver's - IPrintOemDriverUni COM interface. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - VERBOSE("COemUni2::PublishDriverInterface() entry."); - - // Need to store pointer to Driver Helper functions, if we already haven't. - if (this->m_pOEMHelp == NULL) - { - HRESULT hResult; - - // Get Interface to Helper Functions. - hResult = pIUnknown->QueryInterface(IID_IPrintOemDriverUni, (void** ) &(this->m_pOEMHelp)); - - if(!SUCCEEDED(hResult)) - { - // Make sure that interface pointer reflects interface query failure. - this->m_pOEMHelp = NULL; - - return E_FAIL; - } - } - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -ResetPDEV( - PDEVOBJ pdevobjOld, - PDEVOBJ pdevobjNew - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::ResetPDEV - - A rendering plug-in for Unidrv MUST implement the - IPrintOemUni::ResetPDEV method. - - A rendering plug-in's IPrintOemUni::ResetPDEV method performs - the same types of operations as the DrvResetPDEV function. During - the processing of an application's call to the Platform SDK ResetDC - function, the IPrintOemUni::ResetPDEV method is called by Unidrv's - DrvResetPDEV function. For more information about when DrvResetPDEV - is called, see its description in the DDK docs. - - The rendering plug-in's private PDEV structure's address is contained - in the pdevOEM member of the DEVOBJ structure pointed to by pdevobjOld. - The IPrintOemUni::ResetPDEV method should use relevant members of this - old structure to fill in the new structure, which is referenced through pdevobjNew. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobjOld - pointer to a DEVOBJ structure containing current PDEV information. - pdevobjNew - pointer to a DEVOBJ structure into which the method should place - new PDEV information. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - - ---*/ - -{ - VERBOSE("COemUni2::ResetPDEV() entry."); - - UNREFERENCED_PARAMETER(pdevobjOld); - UNREFERENCED_PARAMETER(pdevobjNew); - - return S_OK; -} - -HRESULT __stdcall -COemUni2:: -SendFontCmd( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - PFINVOCATION pFInv - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::SendFontCmd - - The IPrintOemUni::SendFontCmd method enables a rendering - plug-in to modify a printer's font selection command and then - send it to the printer. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - pFInv - pointer to an FINVOCATION structure. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE("COemUni2::SendFontCmd() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(pFInv); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -TextOutAsBitmap( - SURFOBJ *pso, - STROBJ *pstro, - FONTOBJ *pfo, - CLIPOBJ *pco, - RECTL *prclExtra, - RECTL *prclOpaque, - BRUSHOBJ *pboFore, - BRUSHOBJ *pboOpaque, - POINTL *pptlOrg, - MIX mix - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::TextOutAsBitmap - - The IPrintOemUni::TextOutAsBitmap method allows a rendering - plug-in to create a bitmap image of a text string, in case a - downloadable font is not available. - - Please refer to DDK documentation for more details. - -Arguments: - - pso - Defines the surface on which to be written. - pstro - Defines the glyphs to be rendered and their positions - pfo - Specifies the font to be used - pco - Defines the clipping path - prclExtra - A NULL-terminated array of rectangles to be filled - prclOpaque - Specifies an opaque rectangle - pboFore - Defines the foreground brush - pboOpaque - Defines the opaque brush - pptlOrg - Pointer to POINT struct , defining th origin - mix - Specifies the foreground and background ROPs for pboFore - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE("COemUni2::TextOutAsBitmap() entry."); - - UNREFERENCED_PARAMETER(pso); - UNREFERENCED_PARAMETER(pstro); - UNREFERENCED_PARAMETER(pfo); - UNREFERENCED_PARAMETER(pco); - UNREFERENCED_PARAMETER(prclExtra); - UNREFERENCED_PARAMETER(prclOpaque); - UNREFERENCED_PARAMETER(pboFore); - UNREFERENCED_PARAMETER(pboOpaque); - UNREFERENCED_PARAMETER(pptlOrg); - UNREFERENCED_PARAMETER(mix); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -TTDownloadMethod( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::TTDownloadMethod - - The IPrintOemUni::TTDownloadMethod method enables a rendering - plug-in to indicate the format that Unidrv should use for a specified - TrueType soft font. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pUFObj - pointer to a UNIFONTOBJ structure. - pdwResult - Receives one of the following method-supplied constant values: - TTDOWNLOAD_BITMAP Unidrv should download the specified font as bitmaps. - TTDOWNLOAD_DONTCARE Unidrv can select the font format. - TTDOWNLOAD_GRAPHICS Unidrv should print TrueType fonts as graphics, - instead of downloading the font. - TTDOWNLOAD_TTOUTLINE Unidrv should download the specified font as outlines. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE("COemUni2::TTDownloadMethod() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(pdwResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -TTYGetInfo( - PDEVOBJ pdevobj, - DWORD dwInfoIndex, - PVOID pOutputBuf, - DWORD dwSize, - DWORD *pcbcNeeded - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni::TTYGetInfo - - The IPrintOemUni::TTYGetInfo method enables a rendering plug-in - to supply Unidrv with information relevant to text-only printers. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - dwInfoIndex - constant identifying the type of information being requested. - The following constant values are defined: - OEMTTY_INFO_CODEPAGE - The pOutputBuf parameter points to a - DWORD in which the method should return the number of the - code page to be used. - OEMTTY_INFO_MARGINS - The pOutputBuf parameter points to a - RECT structure in which the method should return page margin - widths, in tenths of millimeters (for example, 20 represents 2 mm). - If the entire page is printable, all margin values must be 0. - OEMTTY_INFO_NUM_UFMS - The pOutputBuf parameter points to a - DWORD in which the method should return the number of resource - IDs of the UFMs for 10, 12, and 17 CPI fonts. To actually obtain - these resource IDs, perform a query using OEMTTY_INFO_UFM_IDS. - OEMTTY_INFO_UFM_IDS - The pOutputBuf parameter points to an array - of DWORDs of sufficient size to hold the number of resource IDs of - the UFMs for 10, 12, and 17 CPI fonts. (This number is obtained by - using OEMTTY_INFO_NUM_UFMS in a query.) The method should - return the resource IDs of the UFMs for 10,12, and 17 CPI fonts. - pOutputBuf - pointer to a buffer to receive the requested information. - dwSize - size, in bytes, of the buffer pointed to by pOutputBuf. - pcbcNeeded - pointer to a location to receive the number of bytes written into - the buffer pointed to by pOutputBuf. If the number of bytes required is - smaller than the number specified by dwSize, the method should supply - the required size and return E_FAIL. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE("COemUni2::TTYGetInfo() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(dwInfoIndex); - UNREFERENCED_PARAMETER(pOutputBuf); - UNREFERENCED_PARAMETER(dwSize); - UNREFERENCED_PARAMETER(pcbcNeeded); - - return E_NOTIMPL; -} - -HRESULT __stdcall -COemUni2:: -WritePrinter( - PDEVOBJ pdevobj, - PVOID pBuf, - DWORD cbBuffer, - PDWORD pcbWritten - ) - -/*++ - -Routine Description: - - Implementation of IPrintOemUni2::WritePrinter - - The IPrintOemUni2::WritePrinter method, if supported, enables a - rendering plug-in to capture all output data generated by a Unidrv - driver. If this method is not supported, the output data would - otherwise be sent to the spooler in a call to the spooler's WritePrinter API. - - Please refer to DDK documentation for more details. - -Arguments: - - pdevobj - pointer to a DEVOBJ structure. - pBuf - pointer to the first byte of an array of bytes that contains - the output data generated by the Unidrv driver. - cbBuffer - size, in bytes, of the array pointed to by pBuf. - pcbWritten - pointer to a DWORD value that receives the number - of bytes of data that were successfully sent to the plug-in. - -Return Value: - - S_OK The operation succeeded. - E_FAIL The operation failed. - E_NOTIMPL The method is not implemented. - - ---*/ - -{ - VERBOSE("COemUni2::WritePrinter() entry."); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pBuf); - UNREFERENCED_PARAMETER(cbBuffer); - UNREFERENCED_PARAMETER(pcbWritten); - - return E_NOTIMPL; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// oem class factory -// -class COemCF : public IClassFactory -{ -public: - // *** IUnknown methods *** - // - - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef)(THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release)(THIS); - - // *** IClassFactory methods *** - // - STDMETHOD(CreateInstance)(THIS_ - LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID FAR* ppvObject); - STDMETHOD(LockServer)(THIS_ BOOL bLock); - - - // Constructor - // - COemCF(): m_cRef(1) { }; - - // Destructor - // - ~COemCF() { }; - -protected: - LONG m_cRef; - -}; - -/////////////////////////////////////////////////////////// -// -// Class factory body -// -HRESULT __stdcall -COemCF:: -QueryInterface( - const IID& iid, - void** ppv) -{ - VERBOSE("COemCF::QueryInterface entry."); - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this); - } - else - { - *ppv = NULL; - VERBOSE("COemCF::QueryInterface IID not supported.\r\n"); - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -ULONG __stdcall -COemCF:: -AddRef() -{ - return InterlockedIncrement(&m_cRef); -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall -COemCF:: -Release() -{ - assert(0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - } - return cRef; -} - -// IClassFactory implementation -// -HRESULT __stdcall -COemCF:: -CreateInstance( - IUnknown* pUnknownOuter, - const IID& iid, - void** ppv) -{ - VERBOSE("Class factory:Create component."); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Cannot aggregate. - // - if (pUnknownOuter != NULL) - { - return CLASS_E_NOAGGREGATION; - } - - // Create component. - // - COemUni2* pOemCP = new COemUni2; - if (pOemCP == NULL) - { - return E_OUTOFMEMORY; - } - - // Get the requested interface. - // - HRESULT hr = pOemCP->QueryInterface(iid, ppv); - - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - // - pOemCP->Release(); - return hr; -} - -// LockServer -// -HRESULT __stdcall -COemCF:: -LockServer( - BOOL bLock - ) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks); - } - else - { - InterlockedDecrement(&g_cServerLocks); - } - return S_OK; -} - - -// -// Registration functions -// - -// -// Can DLL unload now? -// -STDAPI DllCanUnloadNow(void) -{ - VERBOSE("DllCanUnloadNow entry."); - - // - // To avoid leaving OEM DLL still in memory when Unidrv or Pscript drivers - // are unloaded, Unidrv and Pscript driver ignore the return value of - // DllCanUnloadNow of the OEM DLL, and always call FreeLibrary on the OEMDLL. - // - // If OEM DLL spins off a working thread that also uses the OEM DLL, the - // thread needs to call LoadLibrary and FreeLibraryAndExitThread, otherwise - // it may crash after Unidrv or Pscript calls FreeLibrary. - // - - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK; - } - else - { - return S_FALSE; - } -} - -// -// Get class factory -// -STDAPI DllGetClassObject( - _In_ REFCLSID clsid, - _In_ REFIID iid, - _Outptr_ LPVOID* ppv) -{ - VERBOSE("DllGetClassObject:\tCreate class factory."); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Can we create this component? - // - if (clsid != CLSID_OEMRENDER) - { - ERR("DllGetClassObject:\tClass not available!\r\n"); - return CLASS_E_CLASSNOTAVAILABLE; - } - - // Create class factory. - // - COemCF* pFontCF = new COemCF; // Reference count set to 1 in constructor - if (pFontCF == NULL) - { - ERR("DllGetClassObject:\tOut of Memory!\r\n"); - return E_OUTOFMEMORY; - } - - // Get requested interface. - // - HRESULT hrResult = pFontCF->QueryInterface(iid, ppv); - pFontCF->Release(); - - return hrResult; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/intrface.h deleted file mode 100644 index 771a42c7..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/intrface.h +++ /dev/null @@ -1,283 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.H -// -// -// PURPOSE: Define COM interface for User Mode Printer Customization DLL. -// - -#pragma once - -///////////////////////////////////////////////////////// -// String Literals -///////////////////////////////////////////////////////// - -CONST CHAR NAME_CommandCallback[] = "CommandCallback"; -CONST CHAR NAME_FilterGraphics[] = "FilterGraphics"; - -//////////////////////////////////////////////////////////////////////////////// -// -// COemUni2 -// -// Interface for Unidrv OEM sample rendering module -// -class COemUni2 : public IPrintOemUni2 -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Method for getting the implemented methods. - // Returns S_OK if the given method is implemneted. - // Returns S_FALSE if the given method is notimplemneted. - // - - STDMETHOD(GetImplementedMethod)(THIS_ _In_ PSTR pMethodName); - - // - // Method for OEM to specify DDIs that have been hooked - // - - STDMETHOD(EnableDriver) (THIS_ DWORD DriverVersion, - DWORD cbSize, - PDRVENABLEDATA pded); - - // - // Method to notify OEM plugin that it is no longer required - // - - STDMETHOD(DisableDriver) (THIS); - - // - // Method for OEM plugin to contruct its own PDEV - // - - STDMETHOD(EnablePDEV)(THIS_ PDEVOBJ pdevobj, - _In_ PWSTR pPrinterName, - ULONG cPatterns, - HSURF *phsurfPatterns, - ULONG cjGdiInfo, - GDIINFO *pGdiInfo, - ULONG cjDevInfo, - DEVINFO *pDevInfo, - DRVENABLEDATA *pded, - OUT PDEVOEM *pDevOem); - - // - // Method for OEM to free any resource associated with its PDEV - // - - STDMETHOD(DisablePDEV)(THIS_ PDEVOBJ pdevobj); - - // - // Method for OEM to transfer from old PDEV to new PDEV - // - - STDMETHOD(ResetPDEV)(THIS_ PDEVOBJ pdevobjOld, - PDEVOBJ pdevobjNew); - - // - // Get OEM dll related information - // - - STDMETHOD(GetInfo)(THIS_ DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDriverDMS - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(DriverDMS)(THIS_ PVOID pDevObj, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDevMode - // - - STDMETHOD(DevMode)(THIS_ DWORD dwMode, - POEMDMPARAM pOemDMParam); - - // - // OEMCommandCallback - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(CommandCallback)(THIS_ PDEVOBJ pdevobj, - DWORD dwCallbackID, - DWORD dwCount, - PDWORD pdwParams, - OUT INT *piResult); - - // - // OEMImageProcessing - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(ImageProcessing)(THIS_ PDEVOBJ pdevobj, - PBYTE pSrcBitmap, - PBITMAPINFOHEADER pBitmapInfoHeader, - PBYTE pColorTable, - DWORD dwCallbackID, - PIPPARAMS pIPParams, - OUT PBYTE *ppbResult); - - // - // OEMFilterGraphics - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(FilterGraphics)(THIS_ PDEVOBJ pdevobj, - PBYTE pBuf, - DWORD dwLen); - // - // OEMCompression - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(Compression)(THIS_ PDEVOBJ pdevobj, - PBYTE pInBuf, - PBYTE pOutBuf, - DWORD dwInLen, - DWORD dwOutLen, - OUT INT *piResult); - - // - // OEMHalftone - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(HalftonePattern)(THIS_ PDEVOBJ pdevobj, - PBYTE pHTPattern, - DWORD dwHTPatternX, - DWORD dwHTPatternY, - DWORD dwHTNumPatterns, - DWORD dwCallbackID, - PBYTE pResource, - DWORD dwResourceSize); - - // - // OEMMemoryUsage - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(MemoryUsage)(THIS_ PDEVOBJ pdevobj, - POEMMEMORYUSAGE pMemoryUsage); - - // - // OEMTTYGetInfo - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(TTYGetInfo)(THIS_ PDEVOBJ pdevobj, - DWORD dwInfoIndex, - PVOID pOutputBuf, - DWORD dwSize, - DWORD *pcbcNeeded); - - // - // OEMDownloadFontheader - UNIDRV only - // - - STDMETHOD(DownloadFontHeader)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult); - - // - // OEMDownloadCharGlyph - UNIDRV only - // - - STDMETHOD(DownloadCharGlyph)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - HGLYPH hGlyph, - PDWORD pdwWidth, - OUT DWORD *pdwResult); - - // - // OEMTTDownloadMethod - UNIDRV only - // - - STDMETHOD(TTDownloadMethod)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult); - - // - // OEMOutputCharStr - UNIDRV only - // - - STDMETHOD(OutputCharStr)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - DWORD dwType, - DWORD dwCount, - PVOID pGlyph); - - // - // OEMSendFontCmd - UNIDRV only - // - - - STDMETHOD(SendFontCmd)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - PFINVOCATION pFInv); - - // - // OEMTextOutAsBitmap - UNIDRV only - // - - STDMETHOD(TextOutAsBitmap)(THIS_ SURFOBJ *pso, - STROBJ *pstro, - FONTOBJ *pfo, - CLIPOBJ *pco, - RECTL *prclExtra, - RECTL *prclOpaque, - BRUSHOBJ *pboFore, - BRUSHOBJ *pboOpaque, - POINTL *pptlOrg, - MIX mix); - - // - // IPrintOemUni2 methods - // - - // - // Method for plugin to hook out spooler's WritePrinter API so it - // can get access to output data Universal driver is generating - // - // At DrvEnablePDEV time, Universal driver will call this function with - // pdevobj = NULL, pBuf = NULL, cbBuffer = 0 to detect if the plugin - // implements this function. Plugin should return S_OK to indicate it is - // implementing this function, or return E_NOTIMPL otherwise. - // - // In pcbWritten, plugins should return the number of bytes written to the - // spooler's WritePrinter function. Zero doesn't carry a special meaning, - // errors must be reported through the returned HRESULT. - // - - STDMETHOD(WritePrinter)(THIS_ PDEVOBJ pdevobj, - PVOID pBuf, - DWORD cbBuffer, - PDWORD pcbWritten); - - - COemUni2(); - ~COemUni2(); - -protected: - LONG m_cRef; - IPrintOemDriverUni* m_pOEMHelp; -}; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/precomp.h deleted file mode 100644 index 89396205..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/precomp.h +++ /dev/null @@ -1,36 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Precomp.h -// -// PURPOSE: Header files that should be in the precompiled header. -// - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -// This should always be included last -#include - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/resource.h b/print/OEM Printer Customization Plug-in Samples/C++/oemuni/resource.h deleted file mode 100644 index 8e941820..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/oemuni/resource.h +++ /dev/null @@ -1,17 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by OEMUNI.rc -// - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/psuirep.ini b/print/OEM Printer Customization Plug-in Samples/C++/psuirep.ini deleted file mode 100644 index 74fbd433..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/psuirep.ini +++ /dev/null @@ -1,3 +0,0 @@ -[OEMFiles] -OEMConfigFile1=PSUIREP.DLL - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/syncset.gpd b/print/OEM Printer Customization Plug-in Samples/C++/syncset.gpd deleted file mode 100644 index 39f7a0e2..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/syncset.gpd +++ /dev/null @@ -1,654 +0,0 @@ -*GPDSpecVersion: "1.0" -*Include: "StdNames.gpd" -*ModelName: "OEM CUSTOM SAMPLE SYNC DATA IN UI" -*MasterUnits: PAIR(1200, 1200) -*ResourceDLL: "unires.dll" -*PrinterType: PAGE -*MaxCopies: 99 - -*PrintRate: 8 -*PrintRateUnit: PPM -*PrintRatePPM: 8 - -*Feature: Orientation -{ - *rcNameID: =ORIENTATION_DISPLAY - *DefaultOption: PORTRAIT - *Option: PORTRAIT - { - *rcNameID: =PORTRAIT_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.6 - *Cmd: "<1B>&l0O" - } - } - *Option: LANDSCAPE_CC90 - { - *rcNameID: =LANDSCAPE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.6 - *Cmd: "<1B>&l1O" - } - } -} -*Feature: InputBin -{ - *rcNameID: =PAPER_SOURCE_DISPLAY - *DefaultOption: UPPER - *Option: UPPER - { - *rcNameID: =UPPER_TRAY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l1H" - } - } -} -*Feature: Resolution -{ - *rcNameID: =RESOLUTION_DISPLAY - *DefaultOption: Option1 - *Option: Option1 - { - *Name: "300 x 300 " =DOTS_PER_INCH - *DPI: PAIR(300, 300) - *TextDPI: PAIR(300, 300) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED,TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.4 - *Cmd: "<1B>%%-12345X" -+ "@PJL COMMENT HP Color LaserJet 5/5M " -+ "Version 0.56<0A>" -+ "@PJL SET RESOLUTION=300<0A>" -+ "@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t300R" - } - } - *Option: Option2 - { - *Name: "150 x 150 " =DOTS_PER_INCH - *DPI: PAIR(150, 150) - *TextDPI: PAIR(300, 300) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED,TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.4 - *Cmd: "<1B>%%-12345X" -+ "@PJL COMMENT HP Color LaserJet 5/5M " -+ "Version 0.56<0A>" -+ "@PJL SET RESOLUTION=150<0A>" -+ "@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t300R" - } - } -} - -*Feature: PaperSize -{ - *rcNameID: =PAPER_SIZE_DISPLAY - *DefaultOption: LETTER - *Option: LETTER - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *%(9600, 12648) -*% *PrintableArea: PAIR(9600, 12648) - *PrintableArea: PAIR(9564, 12600) -*% *PrintableArea: PAIR(5000,5000) - *PrintableOrigin: PAIR(300, 300) -*% *PrintableOrigin: PAIR(300, 500) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (9600->9592) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (12648->12640) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(9592, 12640) -*% Warning: the following printable origin X is adjusted (300->304) so it is divisible by the resolution X scale. -*% Warning: the following printable origin Y is adjusted (300->304) so it is divisible by the resolution Y scale. - *PrintableOrigin: PAIR(304, 304) - } - } - *CursorOrigin: PAIR(300, 180) - *Command: CmdSelect - { - *%5760 -- 7560 - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t5760x7604Y" - } - } - *case: LANDSCAPE_CC90 - { - *%(9720, 12648) - *PrintableArea: PAIR(9760, 12688) - *PrintableOrigin: PAIR(200, 272) - *CursorOrigin: PAIR(200, 12960) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t7632x5880Y" - } - } - } - } - *Option: LEGAL - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9540, 16248) - *PrintableOrigin: PAIR(300, 300) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (9600->9592) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (16248->16240) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(9592, 16240) -*% Warning: the following printable origin X is adjusted (300->304) so it is divisible by the resolution X scale. -*% Warning: the following printable origin Y is adjusted (300->304) so it is divisible by the resolution Y scale. - *PrintableOrigin: PAIR(304, 304) - } - } - *CursorOrigin: PAIR(300, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t5760x9864Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9760, 16288) - *PrintableOrigin: PAIR(200, 272) - *CursorOrigin: PAIR(200, 16560) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t9792x5880Y" - } - } - } - } - *Option: EXECUTIVE - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(8100, 12000) - *PrintableOrigin: PAIR(300, 300) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (8100->8096) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (12000->11992) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(8096, 11992) -*% Warning: the following printable origin X is adjusted (300->304) so it is divisible by the resolution X scale. -*% Warning: the following printable origin Y is adjusted (300->304) so it is divisible by the resolution Y scale. - *PrintableOrigin: PAIR(304, 304) - } - } - *CursorOrigin: PAIR(300, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t4860x7344Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(8200, 12080) - *PrintableOrigin: PAIR(240, 280) - *CursorOrigin: PAIR(200, 12360) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t7272x4980Y" - } - } - } - } - *Option: A4 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9324, 13476) - *PrintableOrigin: PAIR(300, 300) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (9324->9320) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (13476->13472) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(9320, 13472) -*% Warning: the following printable origin X is adjusted (300->304) so it is divisible by the resolution X scale. -*% Warning: the following printable origin Y is adjusted (300->304) so it is divisible by the resolution Y scale. - *PrintableOrigin: PAIR(304, 304) - } - } - *CursorOrigin: PAIR(300, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t5594x8201Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9464, 13516) - *PrintableOrigin: PAIR(220, 272) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (9464->9456) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (13516->13512) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(9456, 13512) -*% Warning: the following printable origin X is adjusted (220->224) so it is divisible by the resolution X scale. - *PrintableOrigin: PAIR(224, 272) - } - } - *CursorOrigin: PAIR(200, 13788) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t8129x5714Y" - } - } - } - } - *Option: A3 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(13428, 19308) - *PrintableOrigin: PAIR(300, 300) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (13428->13424) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (19308->19304) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(13424, 19304) -*% Warning: the following printable origin X is adjusted (300->304) so it is divisible by the resolution X scale. -*% Warning: the following printable origin Y is adjusted (300->304) so it is divisible by the resolution Y scale. - *PrintableOrigin: PAIR(304, 304) - } - } - *CursorOrigin: PAIR(300, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l27a8c1E<1B>*p0x0Y<1B>*c0t8057x11693Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(13588, 19368) - *PrintableOrigin: PAIR(200, 240) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (13588->13584) so it is divisible by the resolution X scale. - *PrintableArea: PAIR(13584, 19368) - } - } - *CursorOrigin: PAIR(200, 19608) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l27a8c1E<1B>*p0x0Y<1B>*c0t11621x8177Y" - } - } - } - } - *Option: TABLOID - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *switch: Orientation - { - *case: PORTRAIT - { -*% *PrintableArea: PAIR(12600, 19800) - *PrintableArea: PAIR(12540, 19740) - *PrintableOrigin: PAIR(300, 300) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (12600->12592) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (19800->19792) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(12592, 19792) -*% Warning: the following printable origin X is adjusted (300->304) so it is divisible by the resolution X scale. -*% Warning: the following printable origin Y is adjusted (300->304) so it is divisible by the resolution Y scale. - *PrintableOrigin: PAIR(304, 304) - } - } - *CursorOrigin: PAIR(300, 200) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l6a8c1E<1B>*p0x0Y<1B>*c0t7560x12000Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(12600, 19800) - *PrintableOrigin: PAIR(300, 300) - *switch: Resolution - { - *case: Option2 - { -*% Warning: the following printable width is adjusted (12600->12592) so it is divisible by the resolution X scale. -*% Warning: the following printable length is adjusted (19800->19792) so it is divisible by the resolution Y scale. - *PrintableArea: PAIR(12592, 19792) -*% Warning: the following printable origin X is adjusted (300->304) so it is divisible by the resolution X scale. -*% Warning: the following printable origin Y is adjusted (300->304) so it is divisible by the resolution Y scale. - *PrintableOrigin: PAIR(304, 304) - } - } - *CursorOrigin: PAIR(200, 20100) - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l6a8c1E<1B>*p0x0Y<1B>*c0t11880x7680Y" - } - } - } - } -} -*Feature: MediaType -{ - *rcNameID: =MEDIA_TYPE_DISPLAY - *DefaultOption: STANDARD - *Option: STANDARD - { - *rcNameID: =PLAIN_PAPER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.14 - *Cmd: "<1B>&l0M" - } - } - *Option: TRANSPARENCY - { - *rcNameID: =TRANSPARENCY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.14 - *Cmd: "<1B>&l4M" - } - } -} -*Feature: ColorMode -{ - *rcNameID: =COLOR_PRINTING_MODE_DISPLAY - *HelpIndex: 12004 - *DefaultOption: 24bpp - *Option: 24bpp - { - *rcNameID: =24BPP_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 24 - *DrvBPP: 24 - *Command: CmdEnableDRC { *Cmd : "<1B>*b3M" } - *PaletteSize: 256 - *PaletteProgrammable? : TRUE - *Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" %d{PaletteIndexToProgram} -+ "I" } - *Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } - *Command: CmdSetSrcBmpWidth { *Cmd : "<1B>*r" %d{RasterDataWidthInBytes / 3}"S" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "<1B>*v1N<1B>*v1O<1B>*l184O<1B>*v6W<0003080808081B>*v0a0b0c7i255a255b255c0I<1B>*" -+ "o3W<060400>" - } - } -} -*Feature: Halftone -{ - *rcNameID: =HALFTONING_DISPLAY - *HelpIndex: 12005 - *DefaultOption: HT_PATSIZE_AUTO - *Option: HT_PATSIZE_AUTO - { - *rcNameID: =HT_AUTO_SELECT_DISPLAY - } - *Option: HT_PATSIZE_SUPERCELL_M - { - *rcNameID: =HT_SUPERCELL_DISPLAY - } - *Option: HT_PATSIZE_6x6_M - { - *rcNameID: =HT_DITHER6X6_DISPLAY - } - *Option: HT_PATSIZE_8x8_M - { - *rcNameID: =HT_DITHER8X8_DISPLAY - } -} - -*%------------------------------------------------------------------------- -*% Duplex -*%------------------------------------------------------------------------- -*Feature: Duplex -{ - *rcNameID: =TWO_SIDED_PRINTING_DISPLAY - *DefaultOption: NONE - *Option: NONE - { - *rcNameID: =NONE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l0S" - } - } - *Option: VERTICAL - { - *rcNameID: =FLIP_ON_LONG_EDGE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l1S" - - } - } - *Option: HORIZONTAL - { - *rcNameID: =FLIP_ON_SHORT_EDGE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.10 - *Cmd: "<1B>&l2S" - } - } -} - -*%------------------------------------------------------------------------- -*% Installable Option - Duplex Unit -*% IMPORTANT NOTE: The OEM extension assumes that this feature's keyname is -*% "DuplexUnit" and the options are "TRUE" and "FALSE" -*%------------------------------------------------------------------------- -*Feature: DuplexUnit -{ - *Name: "Optional Duplex Unit" *% Duplex Unit - *HelpIndex: 12004 - *FeatureType: PRINTER_PROPERTY - *DefaultOption: FALSE - *Option: FALSE - { - *Name: "Not Installed" - *DisabledFeatures: LIST(Duplex) - } - *Option: TRUE - { - *Name: "Installed" - } -} - - -*%------------------------------------------------------------------------- -*% Installable Option - Envelope Feeder -*% IMPORTANT NOTE: The OEM extension assumes that this feature's keyname is -*% "EnvFeeder" and the options are "TRUE" and "FALSE" -*%------------------------------------------------------------------------- -*Feature: EnvFeeder -{ - *Name: "Envelope Feeder" - *HelpIndex: 12000 - *FeatureType: PRINTER_PROPERTY - *DefaultOption: FALSE - *Option: FALSE - { - *Name: "Not Installed" - } - *Option: TRUE - { - *Name: "Installed" - } -} - - -*%------------------------------------------------------------------------- -*% Installable Option - PrinterHardDisk -*% IMPORTANT NOTE: The OEM extension assumes that this feature's keyname is -*% "PrinterHardDisk" and the options are "TRUE" and "FALSE" -*%------------------------------------------------------------------------- -*Feature: PrinterHardDisk -{ - *Name: "Printer Hard-Disk" *% Printer Hard-Disk - *HelpIndex: 12002 - *FeatureType: PRINTER_PROPERTY - *DefaultOption: FALSE - *Option: FALSE - { - *Name: "Not Installed" - *%*Constraints: LIST(JobRetention.Option2, JobRetention.Option4) - } - *Option: TRUE - { - *Name: "Installed" - } -} - - - -*Command: CmdStartDoc -{ - *Order: DOC_SETUP.5 - *Cmd: "<1B>&u300D<1B>*r0F" -} -*Command: CmdStartPage -{ - *Order: PAGE_SETUP.1 - *Cmd: "<1B>*b0M<0D>" -} -*Command: CmdEndJob -{ - *Order: JOB_FINISH.1 - *Cmd: "<1B>E<1B>%%-12345X" -} -*Command: CmdCopies -{ - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l" %d{NumOfCopies}"X" -} -*RotateCoordinate?: TRUE -*RotateRaster?: TRUE -*RotateFont?: TRUE -*TextCaps: LIST(TC_CR_90,TC_UA_ABLE) -*MemoryUsage: LIST(FONT) -*CursorXAfterCR: AT_PRINTABLE_X_ORIGIN -*BadCursorMoveInGrxMode: LIST(X_PORTRAIT,Y_LANDSCAPE) -*XMoveThreshold: 0 -*YMoveThreshold: 0 -*XMoveUnit: 300 -*YMoveUnit: 300 -*Command: CmdXMoveAbsolute { *Cmd : "<1B>*p" %d{(DestX / 4) }"X" } -*Command: CmdXMoveRelRight { *Cmd : "<1B>*p+" %d[0,9600]{max_repeat((DestXRel / 4) )}"X" } -*Command: CmdXMoveRelLeft { *Cmd : "<1B>*p-" %d[0,9600]{max_repeat((DestXRel / 4) )}"X" } -*Command: CmdYMoveAbsolute { *Cmd : "<1B>*p" %d{(DestY / 4) }"Y" } -*Command: CmdYMoveRelDown { *Cmd : "<1B>*p+" %d[1,12600]{max_repeat((DestYRel / 4) )}"Y" } -*Command: CmdYMoveRelUp { *Cmd : "<1B>*p-" %d[1,12600]{max_repeat((DestYRel / 4) )}"Y" } -*Command: CmdCR { *Cmd : "<0D>" } -*Command: CmdLF { *Cmd : "<0A>" } -*Command: CmdFF { *Cmd : "<0C>" } -*Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" %d{PaletteIndexToProgram} -+ "I" } -*Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } -*Command: CmdBackSpace { *Cmd : "<08>" } -*Command: CmdUniDirectionOn { *Cmd : "<00>" } -*Command: CmdUniDirectionOff { *Cmd : "<00>" } -*Command: CmdPushCursor { *Cmd : "<1B>&f0S" } -*Command: CmdPopCursor { *Cmd : "<1B>&f1S" } -*Command: CmdSetSimpleRotation { *Cmd : "<1B>&a" %d{PrintDirInCCDegrees}"P" } -*EjectPageWithFF?: TRUE -*Command: CmdEnableTIFF4 { *Cmd : "<1B>*b2M" } -*Command: CmdDisableCompression { *Cmd : "<1B>*b0M" } -*OutputDataFormat: H_BYTE -*OptimizeLeftBound?: TRUE -*CursorXAfterSendBlockData: AT_GRXDATA_ORIGIN -*CursorYAfterSendBlockData: AUTO_INCREMENT - -*DefaultFont: 136 -*DefaultCTT: 0 -*CharPosition: BASELINE -*TTFSEnabled?: TRUE -*DeviceFonts: LIST(134,135,136,137,138,139,140,146,147,148,149,150,151,152,153,154, -+ 155,156,157,164,165,166,196,197,198,199,200,201,202,203,209,210, -+ 211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226, -+ 227,228,229,230) - -*MinFontID: 16534 -*MaxFontID: 32768 -*FontFormat: HPPCL_OUTLINE -*% When the %f format is implemented we can remove the /100 part of -*% CmdSelectFontHeight and CmdSelectFontWidth -*% NOTE: MasterUnits.x is hardcoded here! -*% NOTE: THIS dividing by 200 because I want to /100 and then /2 for now. -*% The number 60000 may look strange, but it's 1200/2 * 100. -*Command: CmdSelectFontHeight { *Cmd : "<1B>(s" %d{FontHeight}"V" } -*Command: CmdSelectFontWidth { *Cmd : "<1B>(s" %f{1200 / FontWidth}"H" } -*Command: CmdSetFontID { *Cmd : "<1B>*c" %d{NextFontID}"D" } -*Command: CmdSelectFontID { *Cmd : "<1B>(" %d{CurrentFontID}"X" } -*Command: CmdSetCharCode { *Cmd : "<1B>*c" %d{NextGlyph}"E" } -*Command: CmdUnderlineOn { *Cmd : "<1B>&dD" } -*Command: CmdUnderlineOff { *Cmd : "<1B>&d@" } -*Command: CmdWhiteTextOn { *Cmd : "<1B>*v1o1T" } -*Command: CmdWhiteTextOff { *Cmd : "<1B>*v0o0T" } -*MinGrayFill: 1 -*MaxGrayFill: 100 -*Command: CmdSetRectWidth { *Cmd : "<1B>*c" %d{(RectXSize / 4) }"A" } -*Command: CmdSetRectHeight { *Cmd : "<1B>*c" %d{(RectYSize / 4) }"B" } -*Command: CmdRectGrayFill { *Cmd : "<1B>*c" %d{GrayPercentage }"g2P" } -*Command: CmdRectWhiteFill { *Cmd : "<1B>*c1P" } -*Command: CmdRectBlackFill { *Cmd : "<1B>*c0P" } diff --git a/print/OEM Printer Customization Plug-in Samples/C++/syncset.ini b/print/OEM Printer Customization Plug-in Samples/C++/syncset.ini deleted file mode 100644 index 11e9f7b0..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/syncset.ini +++ /dev/null @@ -1,3 +0,0 @@ -[OEMFiles] -OEMConfigFile1=SYNCSET.DLL - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/themeui.ini b/print/OEM Printer Customization Plug-in Samples/C++/themeui.ini deleted file mode 100644 index c3c9d2c9..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/themeui.ini +++ /dev/null @@ -1,3 +0,0 @@ -[OEMFiles] -OEMConfigFile1=ThemeUISmpl.DLL - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf b/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf deleted file mode 100644 index 6c07b2c7..00000000 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/uisamples.inf and /dev/null differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.gpd b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.gpd deleted file mode 100644 index f376bfe7..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.gpd +++ /dev/null @@ -1,559 +0,0 @@ -*GPDFileName: "uniuirep.gpd" -*GPDFileVersion: "1.0" -*GPDSpecVersion: "1.0" -*Include: "StdNames.gpd" -*ModelName: "OEM Unidrv Full UI Replacement Sample" -*MasterUnits: PAIR(1200, 1200) -*ResourceDLL: "unires.dll" -*PrinterType: PAGE -*MaxCopies: 99 -*PrintRate: 16 -*PrintRateUnit: PPM -*PrintRatePPM: 16 - -*%****************************************************************************************** -*% Orientation -*%****************************************************************************************** -*Feature: Orientation -{ - *rcNameID: =ORIENTATION_DISPLAY - *DefaultOption: PORTRAIT - *Option: PORTRAIT - { - *rcNameID: =PORTRAIT_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.6 - *Cmd: "<1B>&l0O" - } - } - *Option: LANDSCAPE_CC90 - { - *rcNameID: =LANDSCAPE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.8 - *Cmd: "<1B>&l1O" - } - } -} - -*%****************************************************************************************** -*% Input Bin -*%****************************************************************************************** -*Feature: InputBin -{ - *rcNameID: =PAPER_SOURCE_DISPLAY - *DefaultOption: AUTO - *Option: AUTO - { - *rcNameID: =AUTO_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l0H" - } - } - *Option: UPPER - { - *rcNameID: =UPPER_TRAY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l1H" - } - } -} - -*%****************************************************************************************** -*% Resolution -*%****************************************************************************************** -*Feature: Resolution -{ - *rcNameID: =RESOLUTION_DISPLAY - *DefaultOption: 300dpi - *Option: 600dpi - { - *Name: "600 x 600" =DOTS_PER_INCH - *DPI: PAIR(600, 600) - *TextDPI: PAIR(600, 600) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED,TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "@PJL SET RESOLUTION=600<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t600R" - } - } - *Option: 300dpi - { - *Name: "300 x 300" =DOTS_PER_INCH - *DPI: PAIR(300, 300) - *TextDPI: PAIR(300, 300) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED, TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "@PJL SET RESOLUTION=300<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t300R" - } - } - *Option: 150dpi - { - *Name: "150 x 150" =DOTS_PER_INCH - *DPI: PAIR(150, 150) - *TextDPI: PAIR(150, 150) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED, TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.7 - *Cmd: "@PJL SET RESOLUTION=150<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t150R" - } - } -} - -*%****************************************************************************************** -*% HP-GL/2 Graphics Support -*%****************************************************************************************** -*Ifdef: WINNT_51 -*Personality: =PERSONALITY_HPGL2 -*Feature: GraphicsMode -{ - *rcNameID: =GRAPHICSMODE_DISPLAY - *DefaultOption: HPGL2MODE - *Option: HPGL2MODE - { - *rcNameID: =GRAPHICSMODE_HPGL2_DISPLAY - } - *Option: RASTERMODE - { - *rcNameID: =GRAPHICSMODE_RASTER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.5 - *Cmd: "@PJL SET LIMAGEENHANCE=OFF<0A>" - } - } -} -*Endif: - -*%****************************************************************************************** -*% Paper Size -*%****************************************************************************************** -*Feature: PaperSize -{ - *rcNameID: =PAPER_SIZE_DISPLAY - *DefaultOption: LETTER - *Option: LETTER - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1028 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9500, 12500) - *PrintableOrigin: PAIR(400, 400) - *CursorOrigin: PAIR(300, 300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t5260x7704Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9500, 12200) - *PrintableOrigin: PAIR(450, 300) - *CursorOrigin: PAIR(200, 12900) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t7332x5880Y" - } - } - } - } - *Option: LEGAL - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1692 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 600) - *CursorOrigin: PAIR(180, 300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t5880x8900Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 900) - *CursorOrigin: PAIR(180, 16500) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t8900x5880Y" - } - } - } - } - *Option: EXECUTIVE - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4109 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(8100, 11500) - *PrintableOrigin: PAIR(300, 300) - *CursorOrigin: PAIR(300, 200) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t4860x7344Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(8300, 11500) - *PrintableOrigin: PAIR(200, 300) - *CursorOrigin: PAIR(200, 12300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t7272x4980Y" - } - } - } - } - *Option: A4 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4249 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9100, 13200) - *PrintableOrigin: PAIR(400, 300) - *CursorOrigin: PAIR(288, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t5594x8201Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9100, 13200) - *PrintableOrigin: PAIR(400, 300) - *CursorOrigin: PAIR(204, 13824) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t8129x5714Y" - } - } - } - } - *Option: B5 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 3198 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(7900, 11140) - *PrintableOrigin: PAIR(352, 300) - *CursorOrigin: PAIR(300, 100) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l12a8c1E<1B>*p0x0Y<1B>*c0t4970x7040Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(7760, 11140) - *PrintableOrigin: PAIR(300, 400) - *CursorOrigin: PAIR(100, 11940) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l12a8c1E<1B>*p0x0Y<1B>*c0t6780x4970Y" - } - } - } - } -} - -*%****************************************************************************************** -*% Outputbin -*%****************************************************************************************** - - -*Feature: OutputBin -{ - *rcNameID: =OUTPUTBIN_DISPLAY - *HelpIndex: 12006 - *DefaultOption: Option1 - *Option: Option1 - { - *% Auto Select - *Name: "default" - *Command: CmdSelect - { - *Order: DOC_SETUP.4 - *Cmd: "@PJL SET OUTBIN=OPTIONALOUTBIN2<0A>@PJL SET FINISH=NONE<0A>" - } - } - *Option: Option14 - { - *% Stacker - *Name: "stacker" *% Stacker - *Command: CmdSelect - { - *Order: DOC_SETUP.4 - *Cmd: "@PJL SET OUTBIN=OPTIONALOUTBIN2<0A>@PJL SET FINISH=NONE<0A>" - } - } -} - - -*%****************************************************************************************** -*% Media Type -*%****************************************************************************************** -*Feature: MediaType -{ - *rcNameID: =MEDIA_TYPE_DISPLAY - *DefaultOption: PLAIN - *Option: PLAIN - { - *rcNameID: =PLAIN_PAPER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.15 - *Cmd: "<1B>&n6WdPlain" - } - } - *Option: TRANSPARENCY - { - *rcNameID: =TRANSPARENCY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.15 - *Cmd: "<1B>&n13WdTransparency" - } - } -} - - - -*%****************************************************************************************** -*% HalfTone -*%****************************************************************************************** -*Feature: Halftone -{ - *rcNameID: =HALFTONING_DISPLAY - *DefaultOption: HT_PATSIZE_AUTO - *Option: HT_PATSIZE_AUTO - { - *rcNameID: =HT_AUTO_SELECT_DISPLAY - } - *Option: HT_PATSIZE_SUPERCELL_M - { - *rcNameID: =HT_SUPERCELL_DISPLAY - } - *Option: HT_PATSIZE_6x6_M - { - *rcNameID: =HT_DITHER6X6_DISPLAY - } - *Option: HT_PATSIZE_8x8_M - { - *rcNameID: =HT_DITHER8X8_DISPLAY - } -} - -*%****************************************************************************************** -*% Memory -*% -*% Note: Unidrv uses the font memory information to estimate when it needs to stop -*% downloading fonts for a page, and thus driver writers should err on the conservative -*% side. Otherwise, printers will generate "out of memory" device errors for pages with -*% a large number of fonts / unique glyphs. -*%****************************************************************************************** -*Feature: Memory -{ - *rcNameID: =PRINTER_MEMORY_DISPLAY - *DefaultOption: 32768KB - *Option: 16384KB - { - *Name: "16MB" - *MemoryConfigKB: PAIR(16384, 13950) - } - *Option: 32768KB - { - *Name: "32MB" - *MemoryConfigKB: PAIR(32768, 28350) - } -} - -*%****************************************************************************************** -*% Page Protect -*%****************************************************************************************** -*Feature: PageProtect -{ - *rcNameID: =PAGE_PROTECTION_DISPLAY - *DefaultOption: OFF - *Option: ON - { - *rcNameID: =ON_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.1 - *Cmd: "<1B>%%-12345X@PJL SET PAGEPROTECT=LETTER<0A>" - } - } - *Option: OFF - { - *rcNameID: =OFF_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.1 - *Cmd: "<1B>%%-12345X@PJL SET PAGEPROTECT=OFF<0A>" - } - } -} - -*%****************************************************************************************** -*% Doc setup commands -*%****************************************************************************************** -*Command: CmdStartDoc -{ - *Order: DOC_SETUP.7 - *Cmd: "<1B>&u1200D<1B>*r0F" -} -*Command: CmdStartPage -{ - *Order: PAGE_SETUP.1 - *Cmd: "<1B>*b0M<0D>" -} -*Command: CmdEndJob -{ - *Order: JOB_FINISH.1 - *Cmd: "<1B>E<1B>%%-12345X@PJL<20>LPORTROTATE<0A><1B>%%-12345X" -} -*Command: CmdCopies -{ - *Order: DOC_SETUP.13 - *Cmd: "<1B>&l" %d{NumOfCopies}"X" -} - -*%****************************************************************************************** -*% Cursor, Page and Color Commands -*%****************************************************************************************** -*RotateCoordinate?: TRUE -*RotateRaster?: TRUE -*RotateFont?: TRUE -*TextCaps: LIST(TC_CR_90,TC_UA_ABLE) -*MemoryUsage: LIST(FONT, RASTER, VECTOR) -*CursorXAfterCR: AT_PRINTABLE_X_ORIGIN -*BadCursorMoveInGrxMode: LIST(X_PORTRAIT,Y_LANDSCAPE) -*XMoveThreshold: 0 -*YMoveThreshold: 0 -*XMoveUnit: 300 -*YMoveUnit: 300 -*Command: CmdXMoveAbsolute { *Cmd : "<1B>*p" %d{(DestX) }"X" } -*Command: CmdXMoveRelRight { *Cmd : "<1B>*p+" %d[0,9600]{max_repeat((DestXRel) )}"X" } -*Command: CmdXMoveRelLeft { *Cmd : "<1B>*p-" %d[0,9600]{max_repeat((DestXRel) )}"X" } -*Command: CmdYMoveAbsolute { *Cmd : "<1B>*p" %d{(DestY) }"Y" } -*Command: CmdYMoveRelDown { *Cmd : "<1B>*p+" %d{(DestYRel) }"Y" } -*Command: CmdYMoveRelUp { *Cmd : "<1B>*p-" %d{(DestYRel) }"Y" } -*Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" -+ %d{PaletteIndexToProgram} "I" } -*Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } -*Command: CmdCR { *Cmd : "<0D>" } -*Command: CmdLF { *Cmd : "<0A>" } -*Command: CmdFF { *Cmd : "<0C>" } -*Command: CmdBackSpace { *Cmd : "<08>" } -*Command: CmdUniDirectionOn { *Cmd : "<00>" } -*Command: CmdUniDirectionOff { *Cmd : "<00>" } -*Command: CmdPushCursor { *Cmd : "<1B>&f0S" } -*Command: CmdPopCursor { *Cmd : "<1B>&f1S" } -*Command: CmdSetSimpleRotation { *Cmd : "<1B>&a" %d{PrintDirInCCDegrees}"P" } -*EjectPageWithFF?: TRUE -*Command: CmdEnableTIFF4 { *Cmd : "<1B>*b2M" } -*Command: CmdDisableCompression { *Cmd : "<1B>*b0M" } -*OutputDataFormat: H_BYTE -*OptimizeLeftBound?: TRUE -*CursorXAfterSendBlockData: AT_GRXDATA_ORIGIN -*CursorYAfterSendBlockData: AUTO_INCREMENT - -*%****************************************************************************************** -*% Font Descriptions and Commands -*%****************************************************************************************** -*DefaultFont: 136 -*DefaultCTT: 0 -*CharPosition: BASELINE -*DeviceFonts: LIST(136,138,146,147,148,149,150,151,152,153,154,155,156,157, -+ 163,164,165,166,196,197,198,199,200,201,202,203,209,210, -+ 211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226, -+ 227,228,229,230) -*MinFontID: 16534 -*MaxFontID: 32768 -*switch: Resolution -{ - *case: 600dpi - { - *FontFormat: HPPCL_OUTLINE - } - *case: 300dpi - { - *FontFormat: HPPCL_OUTLINE - } - *case: 150dpi - { - *FontFormat: HPPCL_RES - } -} -*Command: CmdSetFontID { *Cmd : "<1B>*c" %d{NextFontID}"D" } -*Command: CmdSelectFontID { *Cmd : "<1B>(" %d{CurrentFontID}"X" } -*Command: CmdSetCharCode { *Cmd : "<1B>*c" %d{NextGlyph}"E" } -*Command: CmdUnderlineOn { *Cmd : "<1B>&dD" } -*Command: CmdUnderlineOff { *Cmd : "<1B>&d@" } -*Command: CmdWhiteTextOn { *Cmd : "<1B>*v1o1T" } -*Command: CmdWhiteTextOff { *Cmd : "<1B>*v0o0T" } - - -*%******************************************************************************************** -*%* Vector Commands. -*%******************************************************************************************** -*MinGrayFill: 1 -*MaxGrayFill: 100 -*Command: CmdSetRectWidth { *Cmd : "<1B>*c" %d{(RectXSize) }"A" } -*Command: CmdSetRectHeight { *Cmd : "<1B>*c" %d{(RectYSize) }"B" } -*Command: CmdRectGrayFill { *Cmd : "<1B>*c" %d{GrayPercentage }"g2P" } -*Command: CmdRectWhiteFill { *Cmd : "<1B>*c1P" } -*Command: CmdRectBlackFill { *Cmd : "<1B>*c0P" } diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf deleted file mode 100644 index 2dba999f..00000000 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.inf and /dev/null differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.ini b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.ini deleted file mode 100644 index 55701ada..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/res/uniuirep.ini +++ /dev/null @@ -1,3 +0,0 @@ -[OEMFiles] -OEMConfigFile1=UNIUIREP.DLL - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/Features.cpp b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/Features.cpp deleted file mode 100644 index f2663bc0..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/Features.cpp +++ /dev/null @@ -1,1991 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: Features.cpp -// -// PURPOSE: Implements wrapper classes for managing the features & -// options supported by the driver. -// -//-------------------------------------------------------------------------- - -#include "precomp.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// Internal Defines and Macros -//////////////////////////////////////////////////////// - -// -// TAG the identifies feature OPTITEM data stuct. -// -#define FEATURE_OPTITEM_TAG 'FETR' - - -//////////////////////////////////////////////////////// -// Type Definitions -//////////////////////////////////////////////////////// -// -// Struct used to identify OPTITEM as feature OPTITEM and to map back -// from an OPTITEM to the feature. -// -typedef struct _tagFeatureOptItemData -{ - DWORD dwSize; - DWORD dwTag; - PCSTR pszFeatureKeyword; - CFeature *pFeature; - -} FEATUREOPTITEMDATA, *PFEATUREOPTITEMDATA; - -// -// Mapping of feature names to keywords -// -static CONST KEYWORDMAP gkmFeatureMap[] = -{ - {"RESDLL", NULL, IDS_RESDLL, OEMCUIP_PRNPROP}, - {"InputBin", TEXT("COMPSTUI.DLL"), IDS_CPSUI_SOURCE, OEMCUIP_DOCPROP}, - {"Orientation", TEXT("COMPSTUI.DLL"), IDS_CPSUI_ORIENTATION, OEMCUIP_DOCPROP}, - {"Resolution", TEXT("COMPSTUI.DLL"), IDS_CPSUI_RESOLUTION, OEMCUIP_DOCPROP}, - {"GraphicsMode", NULL, IDS_GRAPHICS_MODE, OEMCUIP_DOCPROP}, - {"PaperSize", TEXT("COMPSTUI.DLL"), IDS_CPSUI_FORMNAME, OEMCUIP_DOCPROP}, - {"MediaType", TEXT("COMPSTUI.DLL"), IDS_CPSUI_MEDIA, OEMCUIP_DOCPROP}, - {"ColorMode", TEXT("COMPSTUI.DLL"), IDS_CPSUI_COLOR_APPERANCE, OEMCUIP_DOCPROP}, - {"Halftone", TEXT("COMPSTUI.DLL"), IDS_CPSUI_HALFTONE, OEMCUIP_DOCPROP}, - {"DuplexUnit", NULL, IDS_DUPLEX_UNIT, OEMCUIP_PRNPROP}, - {"Duplex", TEXT("COMPSTUI.DLL"), IDS_CPSUI_DUPLEX, OEMCUIP_DOCPROP}, - {"Memory", NULL, IDS_INSTALLED_MEMORY, OEMCUIP_PRNPROP}, - {"OutputBin", TEXT("COMPSTUI.DLL"), IDS_CPSUI_OUTPUTBIN, OEMCUIP_DOCPROP}, - {"PageProtect", TEXT("COMPSTUI.DLL"), IDS_CPSUI_PAGEPROTECT, OEMCUIP_PRNPROP}, - {"%PagePerSheet", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP, OEMCUIP_DOCPROP}, - {"%PageOrder", TEXT("COMPSTUI.DLL"), IDS_CPSUI_PAGEORDER, OEMCUIP_DOCPROP}, - {"%PagesPerSheetOrdering", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP_DIRECTION, OEMCUIP_DOCPROP}, - {"%PagesPerSheetBorder", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP_BORDER, OEMCUIP_DOCPROP}, - {"%TextAsGraphics", NULL, IDS_TEXT_ASGRX, OEMCUIP_DOCPROP}, - {"%MetafileSpooling", NULL, IDS_METAFILE_SPOOLING, OEMCUIP_DOCPROP} -}; - -// -// Number of elements in the feature map table. -// -static const NUM_FEATURE_MAP = (sizeof(gkmFeatureMap)/sizeof(gkmFeatureMap[0])); - -// -// Mapping of option names to resources. A more complete driver would parse -// this mapping from the GDL file, rather than use hard-coded mappings. -// -static CONST KEYWORDMAP gkmOptionMap[] = -{ - {"ON", TEXT("COMPSTUI.DLL"), IDS_CPSUI_ON, 0}, - {"OFF", TEXT("COMPSTUI.DLL"), IDS_CPSUI_OFF, 0}, - {"NONE", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NONE, 0}, - {"None", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NONE, 0}, - {"True", TEXT("COMPSTUI.DLL"), IDS_CPSUI_TRUE, 0}, - {"False", TEXT("COMPSTUI.DLL"), IDS_CPSUI_FALSE, 0,}, - {"PORTRAIT", TEXT("COMPSTUI.DLL"), IDS_CPSUI_PORTRAIT, 0}, - {"LANDSCAPE", TEXT("COMPSTUI.DLL"), IDS_CPSUI_LANDSCAPE, 0}, - {"LANDSCAPE_CC90", TEXT("COMPSTUI.DLL"), IDS_CPSUI_ROT_LAND, 0}, - {"FORMSOURCE", TEXT("COMPSTUI.DLL"), IDS_CPSUI_FORMSOURCE, 0}, - {"UPPER", TEXT("COMPSTUI.DLL"), IDS_CPSUI_UPPER_TRAY, 0}, - {"AUTO", TEXT("COMPSTUI.DLL"), IDS_CPSUI_PRINTFLDSETTING, 0}, - {"Auto", TEXT("COMPSTUI.DLL"), IDS_CPSUI_PRINTFLDSETTING, 0}, - {"PLAIN", TEXT("COMPSTUI.DLL"), IDS_CPSUI_STANDARD, 0}, - {"TRANSPARENCY", TEXT("COMPSTUI.DLL"), IDS_CPSUI_TRANSPARENCY, 0}, - {"HORIZONTAL", TEXT("COMPSTUI.DLL"), IDS_CPSUI_HORIZONTAL, 0}, - {"VERTICAL", TEXT("COMPSTUI.DLL"), IDS_CPSUI_VERTICAL, 0}, - {"FrontToBack", TEXT("COMPSTUI.DLL"), IDS_CPSUI_FRONTTOBACK, 0}, - {"BackToFront", TEXT("COMPSTUI.DLL"), IDS_CPSUI_BACKTOFRONT, 0}, - {"1", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP_NORMAL, 0}, - {"2", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP_TWOUP, 0}, - {"4", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP_FOURUP, 0}, - {"6", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP_SIXUP, 0}, - {"9", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP_NINEUP, 0}, - {"16", TEXT("COMPSTUI.DLL"), IDS_CPSUI_NUP_SIXTEENUP, 0}, - {"Booklet", TEXT("COMPSTUI.DLL"), IDS_CPSUI_BOOKLET, 0}, - {"RightThenDown", TEXT("COMPSTUI.DLL"), IDS_CPSUI_RIGHT_THEN_DOWN, 0}, - {"DownThenRight", TEXT("COMPSTUI.DLL"), IDS_CPSUI_DOWN_THEN_RIGHT, 0}, - {"LeftThenDown", TEXT("COMPSTUI.DLL"), IDS_CPSUI_LEFT_THEN_DOWN, 0}, - {"DownThenLeft", TEXT("COMPSTUI.DLL"), IDS_CPSUI_DOWN_THEN_LEFT, 0}, - {"UniresDLL", NULL, IDS_UNIRESDLL, 0}, - {"600dpi", NULL, IDS_RESOLUTION_600_DPI, 0}, - {"300dpi", NULL, IDS_RESOLUTION_300_DPI, 0}, - {"150dpi", NULL, IDS_RESOLUTION_150_DPI, 0}, - {"RASTERMODE", NULL, IDS_RASTERMODE, 0}, - {"HPGL2MODE", NULL, IDS_HPGL2MODE, 0}, - {"LETTER", NULL, IDS_PAPERSIZE_LETTER, 0}, - {"LEGAL", NULL, IDS_PAPERSIZE_LEGAL, 0}, - {"EXECUTIVE", NULL, IDS_PAPERSIZE_EXECUTIVE, 0}, - {"A4", NULL, IDS_PAPERSIZE_A4, 0}, - {"B5", NULL, IDS_PAPERSIZE_B5, 0}, - {"Mono", NULL, IDS_COLORMODE_MONO, 0}, - {"Color", TEXT("COMPSTUI.DLL"), IDS_CPSUI_COLOR_APPERANCE, 0}, - {"24bpp", NULL, IDS_COLORMODE_24BPP, 0}, - {"8bpp", NULL, IDS_COLORMODE_8BPP, 0}, - {"HT_PATSIZE_AUTO", NULL, IDS_HALFTONE_AUTO, 0}, - {"HT_PATSIZE_SUPERCELL_M", NULL, IDS_HALFTONE_SUPERCELL_M, 0}, - {"HT_PATSIZE_6x6_M", NULL, IDS_HALFTONE_6x6_M, 0}, - {"HT_PATSIZE_8x8_M", NULL, IDS_HALFTONE_8x8_M, 0}, - {"Option1", NULL, IDS_OUTBIN_DEFAULT, 0}, - {"Option14", NULL, IDS_OUTBIN_STACKER, 0}, - {"EnvTray", NULL, IDS_UIREP_ENVTRAY, 0}, - {"Automatic", NULL, IDS_TTDL_DEFAULT, 0}, - {"Outline", NULL, IDS_TTDL_TYPE1, 0}, - {"Bitmap", NULL, IDS_TTDL_TYPE3, 0}, - {"NativeTrueType", NULL, IDS_TTDL_TYPE42, 0}, - {"16384KB", NULL, IDS_MEMORY_STD, 0}, - {"32768KB", NULL, IDS_MEMORY_UPGRADE, 0} -}; - -// -// Number of elements in the option map table. -// -static const NUM_OPTION_MAP = (sizeof(gkmOptionMap)/sizeof(gkmOptionMap[0])); - -// -// Fall-back mapping for any feature or option that doesn't -// have a pre-defined display name. -// -KEYWORDMAP gDefaultMapping = {"", NULL, IDS_MISSINGNAME, OEMCUIP_DOCPROP}; - - -//+--------------------------------------------------------------------------- -// -// Member: -// COption::Acquire -// -// Synopsis: -// Load the option information as described in the mapping. -// -// -//---------------------------------------------------------------------------- -HRESULT -COption::Acquire( - HANDLE hHeap, - PCKEYWORDMAP pMapping - ) -{ - m_pMapping = pMapping; - m_hHeap = hHeap; - - return GetDisplayNameFromMapping(hHeap, m_pMapping, &m_pszDisplayName); -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeaturePairs::ClearPair( -// -// Synopsis: -// Remove a feature-option pair entry from the set of feature / option -// pairs. -// -// -//---------------------------------------------------------------------------- -VOID -CFeaturePairs::ClearPair( - size_t iIndex - // Index of the feature-option pair to be removed. - ) -{ - if (m_pData[iIndex].pszFeature) - { - free((VOID*)m_pData[iIndex].pszFeature); - m_pData[iIndex].pszFeature = NULL; - } - - if (m_pData[iIndex].pszOption) - { - free((VOID*)m_pData[iIndex].pszOption); - m_pData[iIndex].pszOption = NULL; - } -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeaturePairs Constructor -// -// Synopsis: -// Create a feature-pairs object containing cElements entries, and -// initialize them all to NULL. -// -// -//---------------------------------------------------------------------------- -CFeaturePairs::CFeaturePairs( - size_t cElements - // number of elements to remove. - ) -{ - m_pData = NULL; - size_t cbFeatureOptions = 0; - m_cElements = 0; - - if (SUCCEEDED(SizeTMult(cElements, sizeof(PRINT_FEATURE_OPTION), &cbFeatureOptions))) - { - m_pData = new PRINT_FEATURE_OPTION[cElements]; - - if (m_pData) - { - m_cElements = cElements; - memset(m_pData, 0, cbFeatureOptions); - } - } -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeaturePairs destructor -// -// Synopsis: -// Release any memory used by this object -// -// -//---------------------------------------------------------------------------- -CFeaturePairs::~CFeaturePairs() -{ - if (m_pData) - { - for (size_t iPair = 0; iPair < m_cElements; iPair++) - { - ClearPair(iPair); - } - - delete m_pData; - } -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeaturePairs::SetPair -// -// Synopsis: -// Set the pair at the specified index to the specified value. Each -// pair represents a feature and a currently selected option for that -// feature. -// -// Returns: -// S_OK -// E_OUTOFMEMORY -// E_INVALIDARG if the index is out of of bounds. -// -// -//---------------------------------------------------------------------------- -HRESULT -CFeaturePairs::SetPair( - size_t iIndex, - // Index of the entry to set. - PCSTR pcszFeature, - // The name of the feature. This doesn't - // hold a pointer to the string passed in. - PCSTR pcszOption - // The name of the option. This doesn't - // hold a pointer to the string passed in. - ) -{ - - if (iIndex > m_cElements || !pcszFeature || !pcszOption) - { - return E_INVALIDARG; - } - - // - // Deferred error result from failed constructor... - // - if (!m_pData) - { - return E_OUTOFMEMORY; - } - - // - // Configure the data elements - // - m_pData[iIndex].pszFeature = new CHAR[strlen(pcszFeature)+1]; - m_pData[iIndex].pszOption = new CHAR[strlen(pcszOption)+1]; - - if (m_pData[iIndex].pszFeature && m_pData[iIndex].pszOption) - { - memcpy((PSTR)m_pData[iIndex].pszFeature, pcszFeature, (strlen(pcszFeature)+1)); - memcpy((PSTR)m_pData[iIndex].pszOption, pcszOption, (strlen(pcszOption)+1)); - return S_OK; - } - else - { - return E_OUTOFMEMORY; - } -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeature::Clear -// -// Synopsis: -// Reset the option collection information to it's state before otions -// were acquired. -// -// -//---------------------------------------------------------------------------- - -VOID -CFeature::Clear() -{ - if (m_pOptions != NULL) - { - delete [] m_pOptions; - m_pOptions = NULL; - } - - if (m_pszDisplayName != NULL && !IS_INTRESOURCE(m_pszDisplayName)) - { - HeapFree(m_hHeap, 0, m_pszDisplayName); - } - - m_dwOptions = 0; - m_Sel = 0; - m_pszFeature = NULL; - m_hHeap = NULL; - m_pOptions = NULL; - m_pMapping = &gDefaultMapping; - m_pszDisplayName = NULL; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeature (constructor) -// -// Synopsis: -// Initialize the option collection to a default state. Does -// not acquire the options from the GPD / helper. -// -// -//---------------------------------------------------------------------------- -CFeature::CFeature() : - m_dwOptions(0), - m_Sel(0), - m_pszFeature(NULL), - m_hHeap(NULL), - m_pOptions(NULL), - m_pMapping(&gDefaultMapping), - m_pszDisplayName(NULL) -{ -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeature (destructor) -// -// Synopsis: -// Clean up any memory we're holding. -// -// -//---------------------------------------------------------------------------- -CFeature::~CFeature() -{ - Clear(); -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeature::Acquire -// -// Synopsis: -// Populate the options in the collection using the -// supplied helper to acquire options for the specified -// feature. -// -// Returns: -// S_OK on success, else E_* -// -// -//---------------------------------------------------------------------------- -HRESULT -CFeature::Acquire( - _In_ HANDLE hHeap, - // The heap to make allocations from - _In_ IPrintCoreHelper* pHelper, - // Pointer to the Unidrv supplied helper object - _In_ PCSTR pszFeature - // The name of the feature to read settings for. - ) -{ - VERBOSE(DLLTEXT("CFeature::Acquire entry.")); - - HRESULT hrResult = S_OK; - PCSTR *ppszOptions = NULL; - - // - // Don't retreive the Options again if we already got them. - // - if ((m_dwOptions > 0) && - (m_pszFeature != NULL) && - !lstrcmpA(m_pszFeature, pszFeature)) - { - WARNING(DLLTEXT("CFeature::Acquire: Already have options for feature %hs. Returning S_OK.\r\n"), m_pszFeature); - return S_OK; - } - - // - // Save the heap handle for use later, such as freeing memory at destruction. - // - m_hHeap = hHeap; - - // - // Store Keyword string. - // - m_pszFeature = pszFeature; - - // - // Get or build a keyword mapping entry that - // maps from keyword to info such as display name & - // whether the feature is a device setting or document - // setting. - // - m_pMapping = GetKeywordMapping(gkmFeatureMap, NUM_FEATURE_MAP, pszFeature); - - // - // Get the display name for this feature - // - hrResult = GetDisplayNameFromMapping(hHeap, m_pMapping, &m_pszDisplayName); - - if (!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("CFeature::Acquire: Failed to get display name for feature %hs with error code 0x%x!\r\n"), - pszFeature, - hrResult); - goto Exit; - } - - // - // Enumerate Options. - // - hrResult = pHelper->EnumOptions(m_pszFeature, - &ppszOptions, - &m_dwOptions - ); - - // - // Make sure we got the option list. - // Can't do anything more with out it. - // - if (!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("CFeature::Acquire: Failed to enumerate options for feature %hs. (hrResult = 0x%x)\r\n"), m_pszFeature, hrResult); - goto Exit; - } - - // - // Build COption - // - m_pOptions = new COption[m_dwOptions]; - - if (m_pOptions == NULL) - { - ERR(ERRORTEXT("COption::Acquire: Failed to allocate memory for option info array!\r\n")); - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // - // For each option, build and/or get useful info like display name etc. - // - for (DWORD dwIndex = 0; dwIndex < m_dwOptions; dwIndex++) - { - PCKEYWORDMAP pMapping = - GetKeywordMapping(gkmOptionMap, NUM_OPTION_MAP, ppszOptions[dwIndex]); - - // - // Get or build a keyword mapping entry that - // maps from keyword to info such as display name, - // icon, option type etc. which we can't get from - // the helper interface - // - hrResult = m_pOptions[dwIndex].Acquire(m_hHeap, - pMapping); - - if (!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("CFeature::Acquire: Failed to load information for option %hs of feature %hs with error code 0x%x!\r\n"), - ppszOptions[dwIndex], - m_pszFeature, - hrResult); - goto Exit; - } - } - - // - // Get current option selection. - // - if(SUCCEEDED(hrResult) && m_dwOptions > 0) - { - hrResult = RefreshSelection(pHelper); - } - -Exit: - - // - // Cleanup if weren't successful - // - if (!SUCCEEDED(hrResult)) - { - Clear(); - } - - return hrResult; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeature::GetOption -// -// Synopsis: -// Get a reference to the description of the option at the specified index. -// -// Returns: -// A pointer to the requested option if available, otherwise NULL. -// -// -//---------------------------------------------------------------------------- -CONST COption * -CFeature::GetOption( - DWORD dwIndex - // Index of the option for which the display name is requested. - ) const -{ - VERBOSE(DLLTEXT("CFeature::GetOption entry.")); - - if ((dwIndex >= m_dwOptions) || (m_pOptions == NULL)) - { - ERR(ERRORTEXT("CFeature::GetOption: Invalid parameters!\r\n")); - return NULL; - } - - return &(m_pOptions[dwIndex]); -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeature::FindOption -// -// Synopsis: -// Find the index of the option with the specified keyword. If no such -// option exists, this routine returns the specified result instead. -// -// -//---------------------------------------------------------------------------- -_Success_(return != FALSE) BOOL -CFeature::FindOption( - _In_ PCSTR pszOption, - // The name of the option to look for - _Out_ DWORD *pdwOption - // The index of the default option to use if the name isn't found - ) const -{ - VERBOSE(DLLTEXT("CFeature::FindOption entry.")); - - BOOL bFound = FALSE; - - // - // Validate parameters - // - if (pszOption == NULL || - pdwOption == NULL) - { - return FALSE; - } - - // - // Walk the option keyword looking for a match. - // - for(DWORD dwIndex = 0; !bFound && (dwIndex < m_dwOptions); dwIndex++) - { - bFound = !lstrcmpA(pszOption, m_pOptions[dwIndex].GetKeyword()); - - if(bFound) - { - *pdwOption = dwIndex; - } - } - - return bFound; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeature::InitOptItem -// -// Synopsis: -// Configure the provided OPTITEM with the options in this collection. -// -// Returns: -// -// Notes: -// -// -//---------------------------------------------------------------------------- -HRESULT -CFeature::InitOptItem( - _In_ HANDLE hHeap, - // The heap to allocate memory from. - _Inout_ POPTITEM pOptItem - // The optitem struct being initialized. - ) -{ - VERBOSE(DLLTEXT("CFeature::InitOptItem entry.")); - - HRESULT hrResult = S_OK; - - // - // Add feature OPTITEM data to OPTITEM to facilitate saving - // selection changes - // - PFEATUREOPTITEMDATA pData = - (PFEATUREOPTITEMDATA)HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(FEATUREOPTITEMDATA)); - - if (pData == NULL) - { - ERR(ERRORTEXT("CFeatureCollection::InitOptItem: Failed to allocated memory for feature OPTITEM data.")); - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // - // Configure the callback data structure - // - pData->dwSize = sizeof(FEATUREOPTITEMDATA); - pData->dwTag = FEATURE_OPTITEM_TAG; - pData->pszFeatureKeyword = this->GetKeyword(); - pData->pFeature = this; - - // - // Configure the optitem - // - pOptItem->UserData = (ULONG_PTR)pData; - pOptItem->pName = const_cast(this->GetDisplayName()); - pOptItem->Sel = m_Sel; - - // - // If there's only 1 option, mark the feature as disabled. - // - if (GetCount() > 1) - { - pOptItem->Flags = 0; - } - else - { - pOptItem->Flags |= OPTIF_DISABLED; - } - - // - // Only create options if there are options defined - // for this feature. - // - if (GetCount() > 0) - { - // - // Allocate memory for feature options. - // - pOptItem->pOptType = CreateOptType(hHeap, (WORD)GetCount()); - - if (pOptItem->pOptType == NULL) - { - ERR(ERRORTEXT("CFeature::InitOptItem: Failed to allocate OPTTYPEs for OPTITEM %hs!\r\n"), - this->GetKeyword()); - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // - // Set OPTTYPE type & display string for each OPTPARAM in the ot - // - pOptItem->pOptType->Type = TVOT_COMBOBOX; - - for (DWORD dwIndex = 0; dwIndex < GetCount(); dwIndex++) - { - pOptItem->pOptType->pOptParam[dwIndex].pData = const_cast(this->GetOption(dwIndex)->GetDisplayName()); - } - } - -Exit: - - return hrResult; - -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeature::RefreshSelection -// -// Synopsis: -// Synchronize the currently selected option with the option -// that Unidrvui recognizes as being selected. -// -// Returns: -// S_OK on success, else E_* -// -// -//---------------------------------------------------------------------------- -HRESULT -CFeature::RefreshSelection( - _In_ IPrintCoreHelper *pHelper - // Pointer to the Unidrv supplied helper object - ) -{ - VERBOSE(DLLTEXT("CFeature::RefreshSelection entry.")); - - PCSTR pszSel = NULL; - HRESULT hrResult = S_OK; - - // - // Get current option selection. - // - hrResult = pHelper->GetOption(NULL, 0, m_pszFeature, &pszSel); - - if(SUCCEEDED(hrResult)) - { - if (!FindOption(pszSel, &m_Sel)) - { - // - // The option name should always match something in the option - // array. If for some reason that's not the case, default - // back to option 0. - // - WARNING(ERRORTEXT("CFeature::RefreshSelection: Failed to find selected option!\r\n")); - m_Sel = 0; - } - } - else if(hrResult == E_FAIL) - { - // - // GetOption fails with E_FAIL when trying to read document- - // sticky options if the printer preferences is being shown. - // Hide the error & default the selection. The feature won't - // be shown in the UI. - // - m_Sel = 0; - hrResult = S_OK; - } - - return hrResult; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeatureCollection::Clear -// -// Synopsis: -// Release any memory associated with this feature collection and reset -// values to defaults. -// -// -//---------------------------------------------------------------------------- -VOID -CFeatureCollection::Clear() -{ - // - // feature info array allocated with new so - // that each of the constructors for CFeature - // will be called. - // - if (m_pFeatures) - { - delete [] m_pFeatures; - } - - // - // Re-initialize - // - m_dwFeatures = 0; - m_dwDocFeatures = 0; - m_dwPrintFeatures = 0; - m_hHeap = NULL; - m_pFeatures = NULL; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeatureCollection::GetModelessIndex -// -// Synopsis: -// Get the absolute index of the feature, assuming the index provided is -// for the specified mode. This if there are three features, -// -// DocFeature1 -// DocFeature2 -// PrinterFeature1 -// -// If this routine is called with index 0, and mode OEMCUIP_PRNPROP, -// it will return the absolute index of the first printer-sticky feature, -// which in this case would be 2 (remember, the first index is 0). -// -// -//---------------------------------------------------------------------------- -DWORD -CFeatureCollection::GetModelessIndex( - DWORD dwIndex, - // The index relative to the specified mode. - DWORD dwMode - // The mode for which the index applies. See synopsis above for - // a more detailed explanation of mode. - ) const -{ - DWORD dwCount = 0; - - switch(dwMode) - { - // - // Number of features, all modes - // - case 0: - dwCount = dwIndex; - break; - - case OEMCUIP_DOCPROP: - case OEMCUIP_PRNPROP: - // - // Walk the feature list looking for the nth feature - // with matching mode - // - for (dwCount = 0; dwCount < m_dwFeatures; dwCount++) - { - // - // Count down to the feature we want - // Only countdown for matching modes - // - if (dwMode == m_pFeatures[dwCount].GetMode()) - { - if (dwIndex == 0) - { - break; - } - else - { - --dwIndex; - } - } - } - break; - } - - return dwCount; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeatureCollection (constructor) -// -// Synopsis: -// -// -//---------------------------------------------------------------------------- -CFeatureCollection::CFeatureCollection() : - m_dwFeatures(0), - m_dwDocFeatures(0), - m_dwPrintFeatures(0), - m_hHeap(NULL), - m_pFeatures(NULL) -{ -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeatureCollection (destructor) -// -// Synopsis: -// Release all resources held by this object -// -// -//---------------------------------------------------------------------------- -CFeatureCollection::~CFeatureCollection() -{ - // - // Clean up class. - // - Clear(); -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeatureCollection::Acquire -// -// Synopsis: -// Load all of the features supported by unidrv as well as those specified -// in the GPD using the provided helper object -// -// Returns: -// S_OK on success else E_* -// -// -//---------------------------------------------------------------------------- -HRESULT -CFeatureCollection::Acquire( - HANDLE hHeap, - // The heap from which any allocations should be made - IPrintCoreHelper *pHelper - // The helper object that provides access to the core driver features. - ) -{ - VERBOSE(DLLTEXT("CFeatureCollection::Acquire entry.")); - - HRESULT hrResult = S_OK; - - PCSTR *ppszKeywords = NULL; - // String list that points to each feature keyword - - // - // Don't retreive the Features again if we already got them. - // - if (m_dwFeatures > 0) - { - WARNING(DLLTEXT("CFeatureCollection::Acquire: Features have already been enumerated. Returning S_OK.\r\n")); - return S_OK; - } - - // Save the heap handle for use later, such as freeing memory at destruction. - m_hHeap = hHeap; - - // Enumerate features. - hrResult = pHelper->EnumFeatures(&ppszKeywords, &m_dwFeatures); - - if (FAILED(hrResult)) - { - ERR(ERRORTEXT("CFeatureCollection::Acquire() failed to enumerate features. (hrResult = 0x%x)\r\n"), hrResult); - } - else - { - // - // Build Feature information - // - m_pFeatures = new CFeature[m_dwFeatures]; - - if (m_pFeatures == NULL) - { - ERR(ERRORTEXT("CFeatureCollection::Acquire: Failed to allocate feature info array!\r\n")); - hrResult = E_OUTOFMEMORY; - } - - // - // For each feature, build/get feature info - // - for (DWORD dwIndex = 0; SUCCEEDED(hrResult) && dwIndex < m_dwFeatures ; dwIndex++) - { - // - // Get options for each feature - // Note: Some features don't have options, the HRESULT will be E_NOTIMPL for these - // - hrResult = m_pFeatures[dwIndex].Acquire(hHeap, - pHelper, - ppszKeywords[dwIndex]); - - if (!SUCCEEDED(hrResult) && (hrResult != E_NOTIMPL)) - { - ERR(ERRORTEXT("CFeatureCollection::Acquire: Failed to get options for feature %hs with error code 0x%x!\r\n"), - ppszKeywords[dwIndex], - hrResult); - } - - // - // Keep track of mode counts - // - if (SUCCEEDED(hrResult)) - { - switch(m_pFeatures[dwIndex].GetMode()) - { - case OEMCUIP_DOCPROP: - ++m_dwDocFeatures; - break; - - case OEMCUIP_PRNPROP: - ++m_dwPrintFeatures; - break; - - default: - ERR(ERRORTEXT("CFeatureCollection::Acquire: Unknown stickiness for feature %hs!\r\n"), - ppszKeywords[dwIndex]); - break; - } - } - } - } - - // - // Clean up if we weren't successful - // - if (FAILED(hrResult)) - { - Clear(); - } - - return hrResult; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeatureCollection::GetCount -// -// Synopsis: -// Get the number of features in the collection. -// -// -//---------------------------------------------------------------------------- -DWORD -CFeatureCollection::GetCount( - DWORD dwMode - // Should this routine count the doc-sticky features, printer sticky - // features, or both? - ) CONST -{ - DWORD dwCount = 0; - - switch(dwMode) - { - case 0: - dwCount = m_dwFeatures; - break; - - case OEMCUIP_DOCPROP: - dwCount = m_dwDocFeatures; - break; - - case OEMCUIP_PRNPROP: - dwCount = m_dwPrintFeatures; - break; - } - - return dwCount; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// CFeatureCollection::GetFeature -// -// Synopsis: -// Get the options for the feature at the specified index. -// -// -//---------------------------------------------------------------------------- -CFeature* -CFeatureCollection::GetFeature( - DWORD dwIndex, - // The index of the feature to look up. - DWORD dwMode - // The mode associated with the feature index. - ) const -{ - // - // Validate parameters - // - if ((dwIndex >= GetCount(dwMode)) || (m_pFeatures == NULL)) - { - return NULL; - } - - // - // Get internal index - // - dwIndex = GetModelessIndex(dwIndex, dwMode); - - // - // Return options pointer - // - return &(m_pFeatures[dwIndex]); -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::GetDisplayNameFromMapping -// -// Synopsis: -// Load the string resource associated with the specified mapping entry. -// -// Returns: -// S_OK on success, else E_* -// -// -//---------------------------------------------------------------------------- -HRESULT -GetDisplayNameFromMapping( - _In_ HANDLE hHeap, - // The heap to perform allocations from - _In_ PCKEYWORDMAP pMapping, - // The mapping element for the element. Could be a feature or option. - _Out_ PWSTR *ppszDisplayName - // The location where this routine supplies the display name to the - // caller. - ) -{ - HMODULE hModule = NULL; - HRESULT hrResult = S_OK; - - VERBOSE(DLLTEXT("GetDisplayNameFromMapping entry.")); - - if ((hHeap == NULL) || (pMapping == NULL) || (ppszDisplayName == NULL)) - { - return E_INVALIDARG; - } - - // - // Check for simple case of returning INT resource - // - if (pMapping->pwszModule == NULL) - { - // - // Just need to do MAKEINTRESOURCE on the resource ID and return - // - *ppszDisplayName = MAKEINTRESOURCE(pMapping->uDisplayNameID); - } - else - { - // - // We need to get the module name if we aren't loading the - // resource from this module (pwszModule != NULL). As an - // optimization, we assume that the module has already been loaded, - // since the only cases currently are this module, driver ui and compstui.dll. - // - hModule = GetModuleHandle(pMapping->pwszModule); - - if (hModule == NULL) - { - DWORD dwError = GetLastError(); - - ERR(ERRORTEXT("GetDisplayNameFromMapping: Failed to load module %s with error code %d!\r\n"), - pMapping->pwszModule, - dwError); - - hrResult = HRESULT_FROM_WIN32(dwError); - - // - // In case last error wasn't set correctly, force it to an error value. - // - if (SUCCEEDED(hrResult)) - { - hrResult = E_FAIL; - } - } - - // - // Get the string resource - // - if (SUCCEEDED(hrResult)) - { - hrResult = GetStringResource(hHeap, hModule, pMapping->uDisplayNameID, ppszDisplayName); - if (FAILED(hrResult)) - { - ERR(ERRORTEXT("GetDisplayNameFromMapping: Failed to load string with error code 0x%x!\r\n"), hrResult); - } - } - } - - return hrResult; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// ::GetKeywordMapping -// -// Synopsis: -// Find the mapping in the provided table associated with the specified -// keyword. This routine can be used to look up both feature & option -// mappings. -// -// Returns: -// The requested mapping on success, otherwise NULL. -// -// -//---------------------------------------------------------------------------- -PCKEYWORDMAP -GetKeywordMapping( - _In_reads_(dwMapSize) PCKEYWORDMAP pKeywordMap, - // The mapping table to search in - DWORD dwMapSize, - // Number of elements in the mapping table. - PCSTR pszKeyword - // Keyword to look for in the table. - ) -{ - BOOL bFound = FALSE; - PCKEYWORDMAP pMapping = &gDefaultMapping; - - if ((pKeywordMap != NULL) && (pszKeyword != NULL)) - { - // - // Walk mapping array for matching keyword - // - for (DWORD dwIndex = 0; !bFound && (dwIndex < dwMapSize); dwIndex++) - { - bFound = !lstrcmpA(pszKeyword, pKeywordMap[dwIndex].pszKeyword); - - if (bFound) - { - pMapping = pKeywordMap + dwIndex; - } - } - } - - return pMapping; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// ::IsFeatureOptItem -// -// Synopsis: -// Test if an OPTITEM is an OPTITEM for a feature. -// -// Returns: -// TRUE if the OPTITEM represents a feature, else FALSE. -// -// -//---------------------------------------------------------------------------- -BOOL -IsFeatureOptItem( - POPTITEM pOptItem - // The otitem to check - ) -{ - BOOL bRet = FALSE; - PFEATUREOPTITEMDATA pData = NULL; - - - // Make sure pointers are NULL. - if( (NULL == pOptItem) - || - (NULL == pOptItem->UserData) - ) - { - // - // INVARIANT: can't be feature OPTITEM, since one of - // the necessary pointer are NULL. - // - - return FALSE; - } - - // For convienience, assign to pointer to feature OPTITEM data. - pData = (PFEATUREOPTITEMDATA)(pOptItem->UserData); - - // Check size and tag. - bRet = (sizeof(FEATUREOPTITEMDATA) == pData->dwSize) - && - (FEATURE_OPTITEM_TAG == pData->dwTag); - - return bRet; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::SaveFeatureOptItems -// -// Synopsis: -// Walks array of OPTITEMs saving each feature OPTITEM -// that has changed. -// -// Returns: -// S_OK on success, else E_* -// -// -//---------------------------------------------------------------------------- -HRESULT -SaveFeatureOptItems( - HANDLE hHeap, - // The heap to perform allocations from - IPrintCoreHelper* pHelper, - // Pointer to the Unidrv supplied helper object - HWND hWnd, - // The current window object. Used as the parent of any model dialogs / - // message boxes displayed from this routine. - _In_reads_(dwItems) POPTITEM pOptItem, - // The option items to save - DWORD dwItems - // The number of optitems in the array - ) -{ - VERBOSE(DLLTEXT("SaveFeatureOptItems entry.")); - - DWORD dwPairsWritten = 0; - DWORD dwResult = 0; - HRESULT hrResult = S_OK; - CFeaturePairs *pPairs = NULL; - - // - // Validate parameters - // - if (!(hHeap && pHelper && pOptItem)) - { - ERR(ERRORTEXT("SaveFeatureOptItems: Invalid arguments!\r\n")); - return E_INVALIDARG; - } - - // - // Get feature option pairs to save - // - hrResult = GetChangedFeatureOptions(pOptItem, dwItems, &pPairs); - - if(FAILED(hrResult)) - { - ERR(ERRORTEXT("SaveFeatureOptItems: Failed to get changed feature option pairs! (error code 0x%x)\r\n"), - hrResult); - } - - // - // Only update options if something changed. - // - if (SUCCEEDED(hrResult) && - pPairs && - pPairs->GetElementCount() > 0) - { - - // - // Set the change feature options. - // For the first SetOptions() call, don't have the - // core driver UI resolve conflicts, so we can - // prompt user for automatic resolution or let - // them do the conflict resolving. - // - hrResult = pHelper->SetOptions(NULL, - 0, - FALSE, - pPairs->GetData(), - (DWORD)pPairs->GetElementCount(), - &dwPairsWritten, - &dwResult); - - if(FAILED(hrResult)) - { - ERR(ERRORTEXT("SaveFeatureOptItems: SetOptions failed with dwResult = %d! (hrResult = 0x%x)\r\n"), - dwResult, - hrResult); - } - else if(SETOPTIONS_RESULT_CONFLICT_REMAINED == dwResult) - { - // - // SetOptions succeeded, but there was a conflict in the selected - // options that was not resolved. Ask the user if they'd like the - // plug-in to resolve the conflict for them. - // - int nRet; - CONST PRINT_FEATURE_OPTION *pConflicts; - DWORD dwConflicts; - PWSTR pszMessage = NULL; - - hrResult = GetStringResource(hHeap, ghInstance, IDS_CONSTRAINT_CONFLICT, &pszMessage); - if(FAILED(hrResult)) - { - ERR(ERRORTEXT("SaveFeatureOptItems: Failed to load conflict resource string (error code 0x%x)\r\n"), - hrResult); - } - - // - // INVARIANT: constraint conflict, options weren't saved. - // - // Get list of all features that have conflict. - // - if (SUCCEEDED(hrResult)) - { - hrResult = GetFirstConflictingFeature(pHelper, - pOptItem, - dwItems, - &pConflicts, - &dwConflicts); - - if (SUCCEEDED(hrResult) && dwConflicts == 0) - { - hrResult = E_FAIL; - ERR(ERRORTEXT("SaveFeatureOptItems: Driver indicated conflict, but didn't provide conflicting options!\r\n")); - } - - if(FAILED(hrResult)) - { - ERR(ERRORTEXT("GetFirstConflictingFeature failed!")); - } - } - - if (SUCCEEDED(hrResult)) - { - // - // Display simple message box with prompt - // - nRet = MessageBox(hWnd, - pszMessage, - L"UI Replacement Test", - MB_YESNO | MB_ICONWARNING); - - // - // Check to see how user wants to resolve conflict - // - if(nRet == IDYES) - { - // - // Let core driver resolve conflict resolution - // - hrResult = pHelper->SetOptions(NULL, - 0, - TRUE, - pPairs->GetData(), - (DWORD)pPairs->GetElementCount(), - &dwPairsWritten, - &dwResult); - - // - // Conflict resolution requires refreshing current option - // selection for each feature, since selection may have - // changed because of conflict resolution. - // - if (SUCCEEDED(hrResult)) - { - RefreshOptItemSelection(pHelper, pOptItem, dwItems); - } - } - - // - // Return failure if there are still conflicts - // - if(dwResult == SETOPTIONS_RESULT_CONFLICT_REMAINED) - { - ERR(ERRORTEXT("SaveFeatureOptItems: Conflicts still exist even after calling core driver to resolve them!")); - hrResult = E_FAIL; - } - } - - if(pszMessage != NULL) - { - HeapFree(hHeap, 0, pszMessage); - } - } - } - - // - // Clean up - // - - if (pPairs) - { - delete pPairs; - } - - return hrResult; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// GetChangedFeatureOptions -// -// Synopsis: -// Creates a collection of all of the features that have changed in the -// provided collection of OPTITEMs -// -// Returns: -// S_OK on success, else E_*. -// -// Notes: -// if no settings have been changed, the routine may return S_OK -// and *ppPairs == NULL. -// -// -//---------------------------------------------------------------------------- -HRESULT -GetChangedFeatureOptions( - _In_reads_(dwItems) POPTITEM pOptItem, - // The array of optitems to search through - DWORD dwItems, - // The number of optitems in the provided array - _Outptr_result_maybenull_ CFeaturePairs **ppPairs - // feature / option keyword pairs describing the options that - // have changed. - ) -{ - VERBOSE(DLLTEXT("GetChangedFeatureOptions entry.")); - - DWORD dwCount = 0; - DWORD dwChanged = 0; - HRESULT hrResult = S_OK; - CFeaturePairs *pPairs; - - *ppPairs = NULL; - - // - // Walk OPTITEM array looking or changed options, - // and calculating size needed for multi-sz buffer. - // - for (dwCount = 0; dwCount < dwItems; dwCount++) - { - // - // Just go to next item if this OPTITEM hasn't - // changed or isn't a feature OPTITEM - // - if ((OPTIF_CHANGEONCE & pOptItem[dwCount].Flags) && - IsFeatureOptItem(&(pOptItem[dwCount])) - ) - { - ++dwChanged; - } - } - - // - // Don't need to do anything more if no feature options changed. - // - if(dwChanged != 0) - { - pPairs = new CFeaturePairs(dwChanged); - - if (pPairs == NULL || - pPairs->GetElementCount() == 0 - ) - { - ERR(ERRORTEXT("GetChangedFeatureOptions: Failed to allocate feature-option array!\r\n")); - hrResult = E_OUTOFMEMORY; - - if ( pPairs ) - { - delete pPairs; - pPairs = NULL; - } - - } - - // - // Build array of feature option pairs that changed - // - for (dwCount = 0; - SUCCEEDED(hrResult) && (dwCount < dwItems) && dwChanged; - dwCount++) - { - // - // Just go to next item if this OPTITEM hasn't - // changed or isn't a feature OPTITEM - // - if((OPTIF_CHANGEONCE & pOptItem[dwCount].Flags) && - IsFeatureOptItem(&(pOptItem[dwCount])) - ) - { - // - // For convienience, assign to pointer to feature OPTITEM data - // - PFEATUREOPTITEMDATA pData = (PFEATUREOPTITEMDATA)(pOptItem[dwCount].UserData); - - // - // Add feature option pair - // - PCSTR pszOption = GetOptionKeywordFromOptItem(&pOptItem[dwCount]); - - if (pszOption != NULL) - { - --dwChanged; - hrResult = pPairs->SetPair(dwChanged, pData->pszFeatureKeyword, pszOption); - } - } - } - - if(SUCCEEDED(hrResult)) - { - *ppPairs = pPairs; - } - else if (pPairs) - { - delete pPairs; - } - } - - return hrResult; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::GetOptionKeywordFromOptItem -// -// Synopsis: -// Returns pointer to option keyword for a feature OPTITEM -// -// Returns: -// The requested string on success, otherwise NULL -// -// -//---------------------------------------------------------------------------- -PCSTR -GetOptionKeywordFromOptItem( - POPTITEM pOptItem - // The opt item from which the keyword shoudl be read - ) -{ - VERBOSE(DLLTEXT("GetOptionKeywordFromOptItem entry.")); - - PCSTR pszOption = NULL; - - // - // Validate parameters - // - if(!IsFeatureOptItem(pOptItem)) - { - ERR(ERRORTEXT("GetOptionKeywordFromOptItem: Invalid parameter!\r\n")); - } - else if(pOptItem->pOptType->Type != TVOT_COMBOBOX) - { - ERR(ERRORTEXT("GetOptionKeywordFromOptItem: OPTTYPE type %d number of OPTPARAMS not handled!\r\n"), - pOptItem->pOptType->Type); - } - else - { - // - // Option selection is based on type of OPTTYPE - // - PFEATUREOPTITEMDATA pData = ((PFEATUREOPTITEMDATA)(pOptItem->UserData)); - CONST COption *pOption = pData->pFeature->GetOption((DWORD)pOptItem->Sel); - - if (pOption) - { - pszOption = pOption->GetKeyword(); - } - else - { - ERR(ERRORTEXT("GetOptionKeywordFromOptItem: Invalid option index %d!\r\n"), (DWORD)pOptItem->Sel); - } - } - - return pszOption; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::RefreshOptItemSelection -// -// Synopsis: -// For each feature update the currently selected option with the value -// that the core driver has selected. This is useful for updating the -// UI after resolving constraints. -// -// Returns: -// S_OK on success, else E_* -// -// -//---------------------------------------------------------------------------- -HRESULT -RefreshOptItemSelection( - IPrintCoreHelper *pHelper, - // Pointer to the Unidrv supplied helper object - _In_reads_(dwItems) POPTITEM pOptItems, - // An array of options to update - DWORD dwItems - // The number of options in the provided array - ) -{ - HRESULT hrResult = S_OK; - PFEATUREOPTITEMDATA pData = NULL; - - // - // Walk OPTITEM array refreshing feature OPTITEMs - // - for (DWORD dwCount = 0; dwCount < dwItems; dwCount++) - { - // - // Just go to next item if this OPTITEM isn't a feature OPTITEM - // - if (!IsFeatureOptItem(pOptItems + dwCount)) - { - continue; - } - - // - // For convienience, assign to pointer to feature OPTITEM data - // - pData = (PFEATUREOPTITEMDATA)(pOptItems[dwCount].UserData); - - // - // Refresh COption selection - // - pData->pFeature->RefreshSelection(pHelper); - - // - // Assign COption selection to OPTITEM selection - // - pOptItems[dwCount].Sel = pData->pFeature->GetSelection(); - } - - return hrResult; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// ::GetFirstConflictingFeature -// -// Synopsis: -// Finds the first features that it finds to be in conflict with one -// another and supplies those features in the ppConstraints parameter -// -// Returns: -// S_OK on success, else E_*. Note that this routine can succeed even -// if no features are in conflict. In that case, *ppConstraints will -// be NULL. -// -// -//---------------------------------------------------------------------------- -HRESULT -GetFirstConflictingFeature( - IPrintCoreHelper *pHelper, - // Pointer to the Unidrv supplied helper object - _In_reads_(dwItems) POPTITEM pOptItem, - // The array of options to look for a conflict in - DWORD dwItems, - // The number of options in the array - CONST PRINT_FEATURE_OPTION **ppConstraints, - // If any constraints are found, supplies pairs of - // feature / option keywords to the caller indicating - // which options cannot be used together. - DWORD *pdwConstraints - // The number of constrained options - ) -{ - VERBOSE(DLLTEXT("GetFirstConflictingFeature entry.")); - - DWORD dwCount = 0; - HRESULT hrResult = S_OK; - PCSTR pszOptionKeyword = NULL; - - *ppConstraints = NULL; - - // - // Walk OPTITEM array looking for changed options that are in conflict - // - for (dwCount = 0; dwCount < dwItems; dwCount++) - { - // - // Just go to next item if this OPTITEM hasn't - // changed or isn't a feature OPTITEM - // - if(!(OPTIF_CHANGEONCE & pOptItem[dwCount].Flags) || - !IsFeatureOptItem(&(pOptItem[dwCount])) - ) - { - continue; - } - - PFEATUREOPTITEMDATA pData = (PFEATUREOPTITEMDATA)(pOptItem[dwCount].UserData); - - // - // Init conflict record if this feature is in conflict - // - pszOptionKeyword = GetOptionKeywordFromOptItem(&pOptItem[dwCount]); - - if (pszOptionKeyword != NULL) - { - // - // Get reason for conflict - // - hrResult = pHelper->WhyConstrained(NULL, - 0, - pData->pszFeatureKeyword, - pszOptionKeyword, - ppConstraints, - pdwConstraints); - - if (FAILED(hrResult)) - { - ERR(ERRORTEXT("GetConflictingFeatures: Failed to get reason for feature %hs option %hs constraint! (hrResult = 0x%x)\r\n"), - pData->pszFeatureKeyword, - pszOptionKeyword, - hrResult); - break; - } - - if (*pdwConstraints > 0) - { - break; - } - } - } - - return hrResult; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// CreateOptType -// -// Synopsis: -// Allocates and initializes OptType for OptItem & OPTPARAMs for the -// options under that struct. -// -// Returns: -// A newly allocated POPTYPE from the specified heap on success, else -// NULL. -// -// -//---------------------------------------------------------------------------- -POPTTYPE -CreateOptType( - HANDLE hHeap, - // heap to allocate the type from. - WORD wOptParams - // The number of options available for this feature. - ) -{ - VERBOSE(DLLTEXT("CreateOptType entry.")); - - POPTTYPE pOptType = NULL; - // out parameter containing the allocated type struct & array of options. - - // - // Allocate memory from the heap for the OPTTYPE; the driver will take - // care of clean up. - // - pOptType = (POPTTYPE) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(OPTTYPE)); - - if(NULL != pOptType) - { - // Initialize OPTTYPE. - pOptType->cbSize = sizeof(OPTTYPE); - pOptType->Count = wOptParams; - - // Allocate memory from the heap for the OPTPARAMs for the OPTTYPE. - pOptType->pOptParam = (POPTPARAM) HeapAlloc(hHeap, - HEAP_ZERO_MEMORY, - wOptParams * sizeof(OPTPARAM)); - - if(NULL != pOptType->pOptParam) - { - // Initialize the OPTPARAMs. - for(WORD wCount = 0; wCount < wOptParams; wCount++) - { - pOptType->pOptParam[wCount].cbSize = sizeof(OPTPARAM); - } - } - else - { - // Free allocated memory and return NULL. - ERR(ERRORTEXT("CreateOptType() failed to allocated memory for OPTPARAMs!\r\n")); - HeapFree(hHeap, 0, pOptType); - pOptType = NULL; - } - } - else - { - ERR(ERRORTEXT("CreateOptType() failed to allocated memory for OPTTYPE!\r\n")); - } - - return pOptType; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::GetStringResource -// -// Synopsis: -// Load a string from the resource section of hte specied module. -// -// Returns: -// S_OK on failure, else E_* -// -// -//---------------------------------------------------------------------------- -HRESULT -GetStringResource( - _In_ HANDLE hHeap, - // Heap to allocate space for the resource from. - _In_ HMODULE hModule, - // Module to load the resource from - UINT uResource, - // resource ID - _Out_ PWSTR *ppszString - // out pointer to string resource loaded. - ) -{ - VERBOSE(DLLTEXT("GetStringResource entry.")); - - HRESULT hr = S_OK; - - // - // Allocate buffer for string resource from heap; - // let the driver clean it up. - // - *ppszString = NULL; - *ppszString = (PTSTR) HeapAlloc(hHeap, - HEAP_ZERO_MEMORY, - MAX_PATH * sizeof(TCHAR)); - - if(NULL != *ppszString) - { - // - // Load string resource; resize after loading so - // as not to waste memory. - // - INT nResult = LoadString(hModule, - uResource, - *ppszString, - MAX_PATH); - - if( nResult > 0) - { - PWSTR pszTemp = (PWSTR) HeapReAlloc(hHeap, HEAP_ZERO_MEMORY, *ppszString, (nResult + 1) * sizeof(WCHAR)); - - if (NULL != pszTemp) - { - *ppszString = pszTemp; - } - else - { - // - // a realloc failure doesn't free the original string, so - // re-alloc failing in this case is not critical. - // - VERBOSE(ERRORTEXT("GetStringResource() HeapReAlloc() of string retrieved failed! (Last Error was %d)\r\n"), GetLastError()); - } - } - else - { - ERR(ERRORTEXT("LoadString() returned %d! (Last Error was %d)\r\n"), nResult, GetLastError()); - ERR(ERRORTEXT("GetStringResource() failed to load string resource %d!\r\n"), uResource); - HeapFree(hHeap, 0, *ppszString); - *ppszString = NULL; - hr = E_FAIL; - } - } - else - { - ERR(ERRORTEXT("GetStringResource() failed to allocate string buffer!\r\n")); - hr = E_OUTOFMEMORY; - } - - return hr; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/Features.h b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/Features.h deleted file mode 100644 index adab6eec..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/Features.h +++ /dev/null @@ -1,388 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: Features.h -// -// PURPOSE: Defines wrapper class for WinXP PS Features and Options. -// -//-------------------------------------------------------------------------- - -#pragma once - -//////////////////////////////////////////////////////// -// Type Definitions -//////////////////////////////////////////////////////// - -// -// Struct used to map keyword to information -// such as display name and stickiness. -// -typedef struct _tagKeywordMap -{ - PCSTR pszKeyword; - PCWSTR pwszModule; - UINT uDisplayNameID; - DWORD dwMode; - -} KEYWORDMAP, *PKEYWORDMAP; - -typedef CONST KEYWORDMAP *PCKEYWORDMAP; - - -//////////////////////////////////////////////////////// -// Class Definitions -//////////////////////////////////////////////////////// - - -// -// Option Infomation -// -class COption -{ -private: - PCKEYWORDMAP m_pMapping; - PWSTR m_pszDisplayName; - HANDLE m_hHeap; - -public: - COption() - : - m_pMapping(NULL), - m_pszDisplayName(NULL), - m_hHeap(NULL) - { - } - - virtual ~COption() - { - if (m_hHeap && m_pszDisplayName && !IS_INTRESOURCE(m_pszDisplayName)) - { - HeapFree(m_hHeap, 0, m_pszDisplayName); - } - } - - HRESULT - Acquire( - HANDLE hHeap, - PCKEYWORDMAP pMapping - ); - - CONST PCWSTR - GetDisplayName() CONST - { - return m_pszDisplayName; - } - - CONST PCSTR - GetKeyword() CONST - { - if (m_pMapping) - { - return m_pMapping->pszKeyword; - } - else - { - return NULL; - } - } -}; - - -// -// Class wrapper and container for Core Driver Feature -// Options. -// -class CFeature -{ -private: - - PCKEYWORDMAP m_pMapping; - - PWSTR m_pszDisplayName; - - DWORD m_dwOptions; - // Count of the number of options contained for an instance of the class. - - PCSTR m_pszFeature; - // Pointer to the feature for which the enumerated options belong. - - HANDLE m_hHeap; - // Heap to do allocations from. - - COption *m_pOptions; - // Array of info about each option for a feature - - DWORD m_Sel; - // An optitem selection is indicated either with a pointer or an - // index. Since combo-boxes use indices, and this custom UI only - // generates combo boxes, this class always uses an index to - // indicate the current selection. - -public: - - CFeature(); - - virtual ~CFeature(); - - // - // Populate Options list for specified keyword. - // - HRESULT - Acquire( - _In_ HANDLE hHeap, - _In_ IPrintCoreHelper* pHelper, - _In_ PCSTR pszFeature - ); - - // - // Returns number of feature options contained in class instance. - // - DWORD - GetCount() const {return m_dwOptions;} - - // - // Return nth option. - // - CONST COption * - GetOption( - DWORD dwIndex - ) const; - - - // - // Get the currently selected option index. - // - LONG - GetSelection() - { - return m_Sel; - } - - // - // Find option with matching keyword string. - // - _Success_(return != FALSE) BOOL - FindOption( - _In_ PCSTR pszOption, - _Out_ DWORD *pdwOption - ) const; - - // - // Initializes options portion of OPTITEM. - // - HRESULT - InitOptItem( - _In_ HANDLE hHeap, - _Inout_ POPTITEM pOptItem - ); - - // - // Refresh option selection. - // - HRESULT - RefreshSelection( - _In_ IPrintCoreHelper* pHelper - ); - - CONST PCWSTR - GetDisplayName() - { - return m_pszDisplayName; - } - - CONST PCSTR - GetKeyword() - { - return m_pszFeature; - } - - DWORD - GetMode() - { - return m_pMapping->dwMode; - } - -private: - - VOID - Clear(); -}; - - -// -// Class wrapper and container for Core Driver Features. -// -class CFeatureCollection -{ -private: - - DWORD m_dwFeatures; - // Count of the number of features. - - DWORD m_dwDocFeatures; - // Count of the number of document sticky features - - DWORD m_dwPrintFeatures; - // Count of the number of printer sticky features. - - HANDLE m_hHeap; - // Heap to do allocations from. - - CFeature *m_pFeatures; - // Array of feature information about each of the enumerate features. - -public: - - CFeatureCollection(); - virtual ~CFeatureCollection(); - - // - // Populates the Feature list - // - HRESULT Acquire( - HANDLE hHeap, - IPrintCoreHelper* pHelper - ); - - // - // Returns number of features contained in class instance. - // - DWORD GetCount( - DWORD dwMode = 0 - ) const; - - // Returns pointer to option class for nth feature. - // - CFeature* GetFeature( - DWORD wIndex, - DWORD dwMode = 0 - ) const; - -private: - - VOID Clear(); - - DWORD GetModelessIndex( - DWORD dwIndex, - DWORD dwMode - ) const; -}; - - -class CFeaturePairs -{ -private: - - PRINT_FEATURE_OPTION * m_pData; - size_t m_cElements; - - VOID - ClearPair( - size_t iIndex - ); - -public: - - CFeaturePairs(size_t cElements); - - ~CFeaturePairs(); - - HRESULT - SetPair( - size_t iIndex, - PCSTR pcszFeature, - PCSTR pcszOption - ); - - PRINT_FEATURE_OPTION * - GetData() - { - return m_pData; - } - - size_t - GetElementCount() - { - return m_cElements; - } -}; - -//////////////////////////////////////////////////////// -// Prototypes -//////////////////////////////////////////////////////// - -HRESULT -GetDisplayNameFromMapping( - _In_ HANDLE hHeap, - _In_ PCKEYWORDMAP pMapping, - _Out_ PWSTR *ppszDisplayName - ); - -PCKEYWORDMAP -GetKeywordMapping( - _In_reads_(dwMapSize) PCKEYWORDMAP pKeywordMap, - DWORD dwMapSize, - PCSTR pszKeyword - ); - -BOOL -IsFeatureOptItem( - POPTITEM pOptItem - ); - -HRESULT -SaveFeatureOptItems( - HANDLE hHeap, - IPrintCoreHelper* pHelper, - HWND hWnd, - _In_reads_(dwItems) POPTITEM pOptItem, - DWORD dwItems - ); - -HRESULT -GetChangedFeatureOptions( - _In_reads_(dwItems) POPTITEM pOptItem, - DWORD dwItems, - _Outptr_result_maybenull_ CFeaturePairs **ppPairs - ); - -PCSTR -GetOptionKeywordFromOptItem( - POPTITEM pOptItem - ); - -HRESULT -RefreshOptItemSelection( - IPrintCoreHelper* pHelper, - _In_reads_(dwItems) POPTITEM pOptItems, - DWORD dwItems - ); - -HRESULT -GetFirstConflictingFeature( - IPrintCoreHelper *pHelper, - _In_reads_(dwItems) POPTITEM pOptItem, - DWORD dwItems, - CONST PRINT_FEATURE_OPTION **pConstraints, - DWORD *pdwConstraints - ); - -POPTTYPE -CreateOptType( - HANDLE hHeap, - WORD wOptParams - ); - -HRESULT -GetStringResource( - _In_ HANDLE hHeap, - _In_ HMODULE hModule, - UINT uResource, - _Out_ PWSTR *ppszString - ); diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/UNIUIREP.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/UNIUIREP.vcxproj deleted file mode 100644 index e7dfa837..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/UNIUIREP.vcxproj +++ /dev/null @@ -1,1066 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {7C66BD86-A7CA-4F53-A5B2-9361A6B80E16} - $(MSBuildProjectName) - Win10 Debug - Win32 - {B571A415-8077-4F31-891E-02760FE89ED2} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - UNIUIREP - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - - - %(AdditionalDependencies);gdi32.lib;kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;uuid.lib - - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - UNIUIREP.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/UNIUIREP.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/UNIUIREP.vcxproj.Filters deleted file mode 100644 index 359932e0..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/UNIUIREP.vcxproj.Filters +++ /dev/null @@ -1,223 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {7212E25C-3AC4-4F4D-A600-63E91A451AD6} - - - h;hpp;hxx;hm;inl;inc;xsd - {72D49995-C0D7-4527-9A60-C2A300B80E2B} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {B53D0C7F-CD45-4EC5-893D-05FBEE34246B} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - Header Files - - - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/debug.cpp b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/debug.cpp deleted file mode 100644 index f7a3d842..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/debug.cpp +++ /dev/null @@ -1,405 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.cpp -// -// PURPOSE: Debug functions. -// -// - -#include "precomp.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// INTERNAL DEFINES -//////////////////////////////////////////////////////// - -#define DEBUG_BUFFER_SIZE 1024 -#define PATH_SEPARATOR '\\' -#define MAX_LOOP 10 - -// Determine what level of debugging messages to eject. -#ifdef VERBOSE_MSG - #define DEBUG_LEVEL DBG_VERBOSE -#elif TERSE_MSG - #define DEBUG_LEVEL DBG_TERSE -#elif WARNING_MSG - #define DEBUG_LEVEL DBG_WARNING -#elif ERROR_MSG - #define DEBUG_LEVEL DBG_ERROR -#elif RIP_MSG - #define DEBUG_LEVEL DBG_RIP -#elif NO_DBG_MSG - #define DEBUG_LEVEL DBG_NONE -#else - #define DEBUG_LEVEL DBG_WARNING -#endif - - - -//////////////////////////////////////////////////////// -// EXTERNAL GLOBALS -//////////////////////////////////////////////////////// - -INT giDebugLevel = DEBUG_LEVEL; - - - - -//////////////////////////////////////////////////////// -// INTERNAL PROTOTYPES -//////////////////////////////////////////////////////// - -static BOOL DebugMessageV(LPCSTR lpszMessage, va_list arglist); -static BOOL DebugMessageV(DWORD dwSize, LPCWSTR lpszMessage, va_list arglist); - - - - -////////////////////////////////////////////////////////////////////////// -// Function: DebugMessageV -// -// Description: Outputs variable argument debug string. -// -// -// Parameters: -// -// dwSize Size of temp buffer to hold formated string. -// -// lpszMessage Format string. -// -// arglist Variable argument list.. -// -// -// Returns: -// -// -// Comments: -// -// -////////////////////////////////////////////////////////////////////////// - -static BOOL DebugMessageV(LPCSTR lpszMessage, va_list arglist) -{ - DWORD dwSize = DEBUG_BUFFER_SIZE; - DWORD dwLoop = 0; - LPSTR lpszMsgBuf = NULL; - HRESULT hr; - - - // Parameter checking. - if( (NULL == lpszMessage) - || - (0 == dwSize) - ) - { - return FALSE; - } - - do - { - // Allocate memory for message buffer. - if(NULL != lpszMsgBuf) - { - delete[] lpszMsgBuf; - dwSize *= 2; - } - lpszMsgBuf = new CHAR[dwSize + 1]; - if(NULL == lpszMsgBuf) - { - return FALSE; - } - - hr = StringCbVPrintfA(lpszMsgBuf, (dwSize + 1) * sizeof(CHAR), lpszMessage, arglist); - - // Pass the variable parameters to wvsprintf to be formated. - } while (FAILED(hr) && (STRSAFE_E_INSUFFICIENT_BUFFER == hr) && (++dwLoop < MAX_LOOP) ); - - // Dump string to Debug output. - OutputDebugStringA(lpszMsgBuf); - - // Cleanup. - delete[] lpszMsgBuf; - - return SUCCEEDED(hr); -} - - -////////////////////////////////////////////////////////////////////////// -// Function: DebugMessageV -// -// Description: Outputs variable argument debug string. -// -// -// Parameters: -// -// dwSize Size of temp buffer to hold formated string. -// -// lpszMessage Format string. -// -// arglist Variable argument list.. -// -// -// Returns: -// -// -// Comments: -// -// -////////////////////////////////////////////////////////////////////////// - -static BOOL DebugMessageV(DWORD dwSize, LPCWSTR lpszMessage, va_list arglist) -{ - LPWSTR lpszMsgBuf; - HRESULT hResult; - - - // Parameter checking. - if( (NULL == lpszMessage) - || - (0 == dwSize) - ) - { - return FALSE; - } - - // Allocate memory for message buffer. - lpszMsgBuf = new WCHAR[dwSize + 1]; - if(NULL == lpszMsgBuf) - return FALSE; - - // Pass the variable parameters to wvsprintf to be formated. - hResult = StringCbVPrintfW(lpszMsgBuf, (dwSize + 1) * sizeof(WCHAR), lpszMessage, arglist); - - // Dump string to debug output. - OutputDebugStringW(lpszMsgBuf); - - // Clean up. - delete[] lpszMsgBuf; - - return SUCCEEDED(hResult); -} - - -////////////////////////////////////////////////////////////////////////// -// Function: DebugMessage -// -// Description: Outputs variable argument debug string. -// -// -// Parameters: -// -// lpszMessage Format string. -// -// -// Returns: -// -// -// Comments: -// -// -////////////////////////////////////////////////////////////////////////// - -BOOL DebugMessage(LPCSTR lpszMessage, ...) -{ - BOOL bResult; - va_list VAList; - - - // Pass the variable parameters to DebugMessageV for processing. - va_start(VAList, lpszMessage); - bResult = DebugMessageV(lpszMessage, VAList); - va_end(VAList); - - return bResult; -} - - -////////////////////////////////////////////////////////////////////////// -// Function: DebugMessage -// -// Description: Outputs variable argument debug string. -// -// -// Parameters: -// -// lpszMessage Format string. -// -// -// Returns: -// -// -// Comments: -// -// -////////////////////////////////////////////////////////////////////////// - -BOOL DebugMessage(LPCWSTR lpszMessage, ...) -{ - BOOL bResult; - va_list VAList; - - - // Pass the variable parameters to DebugMessageV to be processed. - va_start(VAList, lpszMessage); - bResult = DebugMessageV(MAX_PATH, lpszMessage, VAList); - va_end(VAList); - - return bResult; -} - -void Dump(PPUBLISHERINFO pPublisherInfo) -{ - VERBOSE(TEXT("pPublisherInfo:\r\n")); - if(NULL == pPublisherInfo) - { - VERBOSE(TEXT("\tpPublisherInfo is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\tdwMode = %#x\r\n"), pPublisherInfo->dwMode); - VERBOSE(TEXT("\twMinoutlinePPEM = %d\r\n"), pPublisherInfo->wMinoutlinePPEM); - VERBOSE(TEXT("\twMaxbitmapPPEM = %d\r\n"), pPublisherInfo->wMaxbitmapPPEM); -} - -void Dump(POEMDMPARAM pOemDMParam) -{ - VERBOSE(TEXT("pOemDMParam:\r\n")); - if(NULL == pOemDMParam) - { - VERBOSE(TEXT("\tpOemDMParam is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\tcbSize = %d\r\n"), pOemDMParam->cbSize); - VERBOSE(TEXT("\tpdriverobj = %#x\r\n"), pOemDMParam->pdriverobj); - VERBOSE(TEXT("\thPrinter = %#x\r\n"), pOemDMParam->hPrinter); - VERBOSE(TEXT("\thModule = %#x\r\n"), pOemDMParam->hModule); - VERBOSE(TEXT("\tpPublicDMIn = %#x\r\n"), pOemDMParam->pPublicDMIn); - VERBOSE(TEXT("\tpPublicDMOut = %#x\r\n"), pOemDMParam->pPublicDMOut); - VERBOSE(TEXT("\tpOEMDMIn = %#x\r\n"), pOemDMParam->pOEMDMIn); - VERBOSE(TEXT("\tpOEMDMOut = %#x\r\n"), pOemDMParam->pOEMDMOut); - VERBOSE(TEXT("\tcbBufSize = %d\r\n"), pOemDMParam->cbBufSize); -} - -void Dump(PPROPSHEETUI_INFO pPSUIInfo) -{ - VERBOSE(TEXT("pPSUIInfo:\r\n")); - if(NULL == pPSUIInfo) - { - VERBOSE(TEXT("\tpPSUIInfo is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\tcbSize = %d\r\n"), pPSUIInfo->cbSize); - VERBOSE(TEXT("\tVersion = %#x\r\n"), pPSUIInfo->Version); - VERBOSE(TEXT("\tFlags = %#x\r\n"), pPSUIInfo->Flags); - VERBOSE(TEXT("\tReason = %d\r\n"), pPSUIInfo->Reason); - VERBOSE(TEXT("\thComPropSheet = %#x\r\n"), pPSUIInfo->hComPropSheet); - VERBOSE(TEXT("\tpfnComPropSheet = %#x\r\n"), pPSUIInfo->pfnComPropSheet); - VERBOSE(TEXT("\tlParamInit = %#x\r\n"), pPSUIInfo->lParamInit); - VERBOSE(TEXT("\tUserData = %#x\r\n"), pPSUIInfo->UserData); - VERBOSE(TEXT("\tResult = %#x\r\n"), pPSUIInfo->Result); -} - -void Dump(POPTITEM pOptItem) -{ - VERBOSE(TEXT("pOptItem:\r\n")); - if(NULL == pOptItem) - { - VERBOSE(TEXT("\tpOptItem is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\tcbSize = %d\r\n"), pOptItem->cbSize); - VERBOSE(TEXT("\tLevel = %d\r\n"), pOptItem->Level); - VERBOSE(TEXT("\tDlgPageIdx = %d\r\n"), pOptItem->DlgPageIdx); - VERBOSE(TEXT("\tFlags = 0x%x\r\n"), pOptItem->Flags); - VERBOSE(TEXT("\tUserData = 0x%p\r\n"), pOptItem->UserData); - VERBOSE(TEXT("\tpName = %s\r\n"), pOptItem->pName ? pOptItem->pName : TEXT("")); - VERBOSE(TEXT("\tpSel = 0x%p\r\n"), pOptItem->pSel); - VERBOSE(TEXT("\tpExtChkBox = 0x%p\r\n"), pOptItem->pExtChkBox); - VERBOSE(TEXT("\tpExtChkBox = 0x%p\r\n"), pOptItem->pExtChkBox); - VERBOSE(TEXT("\tHelpIndex = 0x%x\r\n"), pOptItem->HelpIndex); - VERBOSE(TEXT("\tDMPubID = 0x%x\r\n"), pOptItem->DMPubID); - VERBOSE(TEXT("\tUserItemID = 0x%x\r\n"), pOptItem->UserItemID); - VERBOSE(TEXT("\twReserved = 0x%x\r\n"), pOptItem->wReserved); - VERBOSE(TEXT("\tpOIExt = 0x%p\r\n"), pOptItem->pOIExt); - - Dump(pOptItem->pOptType); -} - -void Dump(POPTTYPE pOptType) -{ - VERBOSE(TEXT("\tpOptType:\r\n")); - if(NULL == pOptType) - { - VERBOSE(TEXT("\t\tpOptType is NULL!\r\n")); - return; - } - VERBOSE(TEXT("\t\tcbSize = %d\r\n"), pOptType->cbSize); - VERBOSE(TEXT("\t\tType = 0x%x\r\n"), pOptType->Type); - VERBOSE(TEXT("\t\tFlags = 0x%x\r\n"), pOptType->Flags); - VERBOSE(TEXT("\t\tCount = %d\r\n"), pOptType->Count); - VERBOSE(TEXT("\t\tCount = 0x%x\r\n"), pOptType->BegCtrlID); - VERBOSE(TEXT("\t\tStyle = 0x%x\r\n"), pOptType->Style); - - Dump(pOptType->pOptParam, pOptType->Count); -} - -void Dump(POPTPARAM pOptParam, WORD wCount) -{ - if(NULL == pOptParam) - { - VERBOSE(TEXT("\t\tpOptParam is NULL!\r\n")); - return; - } - - for(WORD wIndex = 0; wIndex < wCount; ++wIndex) - { - VERBOSE(TEXT("\t\tpOptParam[wIndex]:\r\n")); - VERBOSE(TEXT("\t\t\tcbSize = %d\r\n"), pOptParam[wIndex].cbSize); - VERBOSE(TEXT("\t\t\tFlags = 0x%x\r\n"), pOptParam[wIndex].Flags); - VERBOSE(TEXT("\t\t\tStyle = 0x%x\r\n"), pOptParam[wIndex].Style); - VERBOSE(TEXT("\t\t\tpData = 0x%p\r\n"), pOptParam[wIndex].pData); - VERBOSE(TEXT("\t\t\tIconID = 0x%p\r\n"), pOptParam[wIndex].IconID); - VERBOSE(TEXT("\t\t\tlParam = 0x%p\r\n"), pOptParam[wIndex].lParam); - } -} - - -PCSTR -StripDirPrefixA( - IN PCSTR pstrFilename - ) - -/*++ - -Routine Description: - - Strip the directory prefix off a filename (ANSI version) - -Arguments: - - pstrFilename - Pointer to filename string - -Return Value: - - Pointer to the last component of a filename (without directory prefix) - ---*/ - -{ - PCSTR pstr; - - pstr = strrchr(pstrFilename, PATH_SEPARATOR); - if (pstr) - return pstr + 1; - - return pstrFilename; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/debug.h b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/debug.h deleted file mode 100644 index b4d57b0b..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/debug.h +++ /dev/null @@ -1,166 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.H -// -// -// PURPOSE: Define common data types, and external function prototypes -// for debugging functions. -// -// - -#pragma once - -// VC and Build use different debug defines. -// The following makes it so either will -// cause the inclusion of debugging code. -#if !defined(_DEBUG) && defined(DBG) - #define _DEBUG DBG -#elif defined(_DEBUG) && !defined(DBG) - #define DBG _DEBUG -#endif - - - -///////////////////////////////////////////////////////// -// Macros -///////////////////////////////////////////////////////// - -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// VERBOSE(msg) -// Display a message if the current debug level is <= DBG_VERBOSE. -// -// TERSE(msg) -// Display a message if the current debug level is <= DBG_TERSE. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// ASSERTMSG(cond, msg) -// Verify a condition is true. If not, display a message and -// force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// These macros require extra parantheses for the msg argument -// example, ASSERTMSG(x > 0, ("x is less than 0\n")); -// WARNING(("App passed NULL pointer, ignoring...\n")); -// - -#define DBG_VERBOSE 1 -#define DBG_TERSE 2 -#define DBG_WARNING 3 -#define DBG_ERROR 4 -#define DBG_RIP 5 -#define DBG_NONE 6 - -#if DBG - - #define DebugMsg DebugMessage - - // - // Strip the directory prefix from a filename (ANSI version) - // - - PCSTR - StripDirPrefixA( - IN PCSTR pstrFilename - ); - - extern INT giDebugLevel; - - - #define DBGMSG(level, prefix, msg) { \ - if (giDebugLevel <= (level)) { \ - DebugMsg("%s %s (%d): ", prefix, StripDirPrefixA(__FILE__), __LINE__); \ - DebugMsg(msg); \ - } \ - } - - #define DBGPRINT(level, msg) { \ - if (giDebugLevel <= (level)) { \ - DebugMsg(msg); \ - } \ - } - - #define VERBOSE if(giDebugLevel <= DBG_VERBOSE) DebugMsg - #define TERSE if(giDebugLevel <= DBG_TERSE) DebugMsg - #define WARNING if(giDebugLevel <= DBG_WARNING) DebugMsg - #define ERR if(giDebugLevel <= DBG_ERROR) DebugMsg - - #define ASSERT(cond) { \ - if (! (cond)) { \ - RIP(("\n")); \ - } \ - } - - #define ASSERTMSG(cond, msg) { \ - if (! (cond)) { \ - RIP(msg); \ - } \ - } - - #define RIP(msg) { \ - DBGMSG(DBG_RIP, "RIP", msg); \ - DebugBreak(); \ - } - - -#else // !DBG - - #define DebugMsg NOP_FUNCTION - - #define VERBOSE NOP_FUNCTION - #define TERSE NOP_FUNCTION - #define WARNING NOP_FUNCTION - #define ERR NOP_FUNCTION - - #define ASSERT(cond) - - #define ASSERTMSG(cond, msg) - #define RIP(msg) - #define DBGMSG(level, prefix, msg) - #define DBGPRINT(level, msg) - -#endif - - - - -///////////////////////////////////////////////////////// -// ProtoTypes -///////////////////////////////////////////////////////// - -BOOL DebugMessage(LPCSTR, ...); -BOOL DebugMessage(LPCWSTR, ...); -void Dump(PPUBLISHERINFO pPublisherInfo); -void Dump(POEMDMPARAM pOemDMParam); -void Dump(PPROPSHEETUI_INFO pPSUIInfo); -void Dump(POPTITEM pOptItem); -void Dump(POPTTYPE pOptType); -void Dump(POPTPARAM pOptParam, WORD wCount); - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/devmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/devmode.cpp deleted file mode 100644 index 1f872cde..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/devmode.cpp +++ /dev/null @@ -1,255 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: devmode.cpp -// -// PURPOSE: Implementation of Devmode functions shared with OEM UI and OEM rendering modules. -// -//-------------------------------------------------------------------------- - -#include "precomp.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -BOOL -ConvertOEMDevmode( - _In_ PCOEMDEV pOEMDevIn, - _Inout_ POEMDEV pOEMDevOut - ); - -BOOL -MakeOEMDevmodeValid( - _Out_ POEMDEV pOEMDevmode - ); - -//+--------------------------------------------------------------------------- -// -// Member: -// ::hrOEMDevMode -// -// Synopsis: -// Performs operation on UI Plugins Private DevMode Members. -// Called via IOemUI::DevMode -// -// Returns: -// S_OK or E_FAIL. For more detailed failure info, -// check GetLastError -// -// Last error: -// ERROR_INVALID_PARAMETER -// -// -//---------------------------------------------------------------------------- -HRESULT -hrOEMDevMode( - DWORD dwMode, - // Indicates which operation should be performed - _Inout_ POEMDMPARAM pOemDMParam - // contains various data structures needed by this - // routine. The usage of this struct is determined by - // the dwMode flag. - ) -{ - VERBOSE(DLLTEXT("hrOEMDevMode entry.")); - - HRESULT hr = S_OK; - // Return value. - - // - // Verify parameters. - // - if ((NULL == pOemDMParam) || - ((OEMDM_SIZE != dwMode) && - (OEMDM_DEFAULT != dwMode) && - (OEMDM_CONVERT != dwMode) && - (OEMDM_MERGE != dwMode))) - { - ERR(ERRORTEXT("DevMode() ERROR_INVALID_PARAMETER.\r\n")); - ERR(DLLTEXT("\tdwMode = %d, pOemDMParam = %#lx.\r\n"), dwMode, pOemDMParam); - - SetLastError(ERROR_INVALID_PARAMETER); - hr = E_FAIL; - } - else - { - POEMDEV pOEMDevIn = (POEMDEV) pOemDMParam->pOEMDMIn;; - // Pointer to the supplied OEM devmode data, if applicable - // based on dwMode. - - POEMDEV pOEMDevOut = (POEMDEV) pOemDMParam->pOEMDMOut;; - // Pointer to the DEVMODE data that this routine is - // expected to configure, if applicable based on dwMode. - - switch (dwMode) - { - // - // The Method should return the size of the memory allocation - // needed to store the UI plugin Private DEVMODE. - // - case OEMDM_SIZE: - pOemDMParam->cbBufSize = sizeof(OEMDEV); - break; - - // - //Should fill the Private DEVMODE with the default values. - // - case OEMDM_DEFAULT: - // - //OEM_DMEXTRAHEADER Members - // - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - break; - - // - // The method should convert private DEVMODE members to - // the current version, if necessary. - // - case OEMDM_CONVERT: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - break; - - // - // The method should validate the information contained in private - // DEVMODE members and merge validated values into a private - // DEVMODE structure containing default values - // - case OEMDM_MERGE: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - MakeOEMDevmodeValid(pOEMDevOut); - break; - } - } - - return hr; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::ConvertOEMDevmode -// -// Synopsis: -// confirm that the private DEVMODE being passed in is data that -// this driver recognizes, read the settings from the input -// OEM DEVMODE data, and write them to pOEMDevOut. -// -// Returns: -// True unless the routine was called with null pointers -// -// -//---------------------------------------------------------------------------- -BOOL -ConvertOEMDevmode( - _In_ PCOEMDEV pOEMDevIn, - // Caller supplied DEVMODE that we are attempting to read - _Inout_ POEMDEV pOEMDevOut - // OEM private DEVMODE configured by this routine based on the settings - // in pOEMDevIn - ) -{ - VERBOSE(DLLTEXT("ConvertOEMDevmode entry.")); - - if ((NULL == pOEMDevIn) || - (NULL == pOEMDevOut)) - { - ERR(ERRORTEXT("ConvertOEMDevmode() invalid parameters.\r\n")); - return FALSE; - } - - // - // Check OEM Signature, if it doesn't match ours, - // then just assume DMIn is bad and use defaults. - // - if(pOEMDevIn->dmOEMExtra.dwSignature == pOEMDevOut->dmOEMExtra.dwSignature) - { - VERBOSE(DLLTEXT("Converting private OEM Devmode.\r\n")); - - // - // Copy the old structure in to the new using which ever size is the - // smaller. Devmode maybe from newer Devmode (not likely since there - // is only one), or Devmode maybe a newer Devmode, in which case it - // maybe larger, but the first part of the structure should be the same. - // - // DESIGN ASSUMPTION: the private DEVMODE structure only gets added to; - // the fields that are in the DEVMODE never change only new fields get - // added to the end. - // - memcpy(pOEMDevOut, - pOEMDevIn, - __min(pOEMDevOut->dmOEMExtra.dwSize, pOEMDevIn->dmOEMExtra.dwSize)); - - // - // Re-fill in the size and version fields to indicated - // that the DEVMODE is the current private DEVMODE version. - // - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - - // - // If the plug-in is capable of recognizing multiple versions of it's - // private DEVMODE data add custom handling here to support it. - // - } - else - { - WARNING(DLLTEXT("Unknown DEVMODE signature, pOEMDMIn ignored.\r\n")); - - // - // The private DEVMODE data is not something that this plug-in understands, - // so use defaults. - // - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - } - - return TRUE; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::MakeOEMDevmodeValid -// -// Synopsis: -// Force the OEM devmode settings to valid values. -// -// Returns: -// True if the OEMDEV was configured, else FALSE. Only return false if -// the parameter is NULL. -// -// -//---------------------------------------------------------------------------- -BOOL -MakeOEMDevmodeValid( - _Out_ POEMDEV pOEMDevmode - // OEM DEVMODE data to modify - ) -{ - if(NULL == pOEMDevmode) - { - return FALSE; - } - - // - // Assumption: pOEMDevmode is large enough to contain OEMDEV structure. - // - pOEMDevmode->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevmode->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevmode->dmOEMExtra.dwVersion = OEM_VERSION; - - return TRUE; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/devmode.h b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/devmode.h deleted file mode 100644 index 342ce190..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/devmode.h +++ /dev/null @@ -1,48 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: devmode.h -// -// PURPOSE: Define common data types, and external function prototypes -// for devmode functions. -//-------------------------------------------------------------------------- - -#pragma once - -// -// OEM private DEVMODE data structure. This gets included in the DEVMODE -// used by Unidrv. -// -typedef struct tagOEMDEV -{ - OEM_DMEXTRAHEADER dmOEMExtra; - // This structure MUST be prefixed by OEM_DMEXTRAHEADER - - // - // Add private DevMode members here, after the standard header - // information. - // - -} OEMDEV, *POEMDEV; - -typedef const OEMDEV *PCOEMDEV; - - -// -// ProtoTypes -// - -HRESULT -hrOEMDevMode( - DWORD dwMode, - _Inout_ POEMDMPARAM pOemDMParam - ); - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/dllentry.cpp b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/dllentry.cpp deleted file mode 100644 index 3160dfb4..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/dllentry.cpp +++ /dev/null @@ -1,82 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cpp -// -// PURPOSE: Source module for DLL entry function(s). -// -//-------------------------------------------------------------------------- - -#include "precomp.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::DllMain -// -// Synopsis: -// Dll's main routine, called when new -// threads or processes reference the module -// -// Returns: -// TRUE. Currently has no failure paths. Return false if the module -// cannot be properly initialized. -// -// Notes: -// The caller of this routine holds a process-wide lock preventing more -// than one module from being initialized at a time. In general, -// plug-ins should do as little as possible in this routine to avoid -// stalling other threads that may need to load modules. Also, calling -// any function that would, in-turn, cause another module to be loaded -// could result in a deadlock. -// -// -//---------------------------------------------------------------------------- -BOOL -WINAPI DllMain( - HINSTANCE hInst, - WORD wReason, - LPVOID lpReserved - ) -{ - VERBOSE(DLLTEXT("DllMain entry.")); - - UNREFERENCED_PARAMETER(hInst); - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - VERBOSE(DLLTEXT("Process attach.\r\n")); - ghInstance = hInst; - break; - - case DLL_THREAD_ATTACH: - VERBOSE(DLLTEXT("Thread attach.\r\n")); - break; - - case DLL_PROCESS_DETACH: - VERBOSE(DLLTEXT("Process detach.\r\n")); - break; - - case DLL_THREAD_DETACH: - VERBOSE(DLLTEXT("Thread detach.\r\n")); - break; - } - - return TRUE; -} - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/intrface.cpp deleted file mode 100644 index 5513741e..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/intrface.cpp +++ /dev/null @@ -1,1151 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.cpp -// -// PURPOSE: Implementation of interface for PScript5, Unidrv5 UI plug-ins. -// -//-------------------------------------------------------------------------- - -#include "precomp.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -//-------------------------------------------------------------------------- -// Globals -//-------------------------------------------------------------------------- - -HINSTANCE ghInstance = NULL; - // Module's Instance handle from DLLEntry of process. - - -//-------------------------------------------------------------------------- -// Internal Globals -//-------------------------------------------------------------------------- - -static long g_cComponents = 0; - // Count of active components - -static long g_cServerLocks = 0; - // Count of locks - - -//-------------------------------------------------------------------------- -// Class factory for the Plug-In object -//-------------------------------------------------------------------------- -class COemCF : public IClassFactory -{ -public: - - // IUnknown methods - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - _COM_Outptr_ LPVOID FAR* ppvObj - ); - - STDMETHOD_(ULONG,AddRef) (THIS); - STDMETHOD_(ULONG,Release) (THIS); - - // IClassFactory methods - STDMETHOD(CreateInstance) (THIS_ - _In_opt_ LPUNKNOWN pUnkOuter, - _In_ REFIID riid, - _COM_Outptr_ LPVOID FAR* ppvObject - ); - - STDMETHOD(LockServer) (THIS_ - BOOL bLock - ); - - // Class-specific methods. - COemCF(): m_cRef(1) { }; - - ~COemCF() { }; - -protected: - LONG m_cRef; - -}; - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::DllCanUnloadNow -// -// Synopsis: -// Can the DLL be unloaded from memory? Answers no if any objects are -// still allocated, or if the server has been locked. -// -// To avoid leaving OEM DLL still in memory when Unidrv or Pscript -// drivers are unloaded, Unidrv and Pscript driver ignore the return -// value of DllCanUnloadNow of the OEM DLL, and always call FreeLibrary -// on the OEMDLL. -// -// If the plug-in spins off a working thread that also uses this DLL, -// the thread needs to call LoadLibrary and FreeLibraryAndExitThread, -// otherwise it may crash after Unidrv or Pscript calls FreeLibrary. -// -// Returns: -// S_OK if the DLL can be unloaded safely, otherwise S_FALSE -// -// -//---------------------------------------------------------------------------- -STDAPI DllCanUnloadNow() -{ - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK; - } - else - { - return S_FALSE; - } -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::DllGetClassObject -// -// Synopsis: -// Retrieve the class factory object for the indicated class. -// -// Returns: -// CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, or S_OK. -// -// Notes: -// -// -//---------------------------------------------------------------------------- -STDAPI -DllGetClassObject( - _In_ CONST CLSID& clsid, - // GUID of the class object that the caller wants a class factory - // for - _In_ CONST IID& iid, - // Interface ID to provide in ppv - _Outptr_ VOID** ppv - // out pointer to the interface requested. - ) -{ - VERBOSE(DLLTEXT("DllGetClassObject:Create class factory.")); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // - // Can we create this component? - // - if (clsid != CLSID_OEMUI) - { - return CLASS_E_CLASSNOTAVAILABLE; - } - - // - // Create class factory. - // Reference count set to 1 in Constructor - // - COemCF* pUIReplacementCF = new COemCF; - if (pUIReplacementCF == NULL) - { - return E_OUTOFMEMORY; - } - - // - // Get requested interface. - // - HRESULT hr = pUIReplacementCF->QueryInterface(iid, ppv); - pUIReplacementCF->Release(); - - return hr; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemCF::QueryInterface -// -// Synopsis: -// Standard COM IUnknown implementation. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemCF::QueryInterface( - CONST IID& iid, - _COM_Outptr_ VOID** ppv - ) -{ - VERBOSE(DLLTEXT("COemCF::QueryInterface entry.")); - - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this); - } - else - { - *ppv = NULL; - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemCF::AddRef -// -// Synopsis: -// Standard COM IUnknown implementation. -// -// -//---------------------------------------------------------------------------- -ULONG __stdcall -COemCF::AddRef() -{ - return InterlockedIncrement(&m_cRef); -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemCF::Release -// -// Synopsis: -// Standard COM IUnknown implementation. -// -// -//---------------------------------------------------------------------------- -ULONG __stdcall -COemCF::Release() -{ - assert(0 != m_cRef); - - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - } - return cRef; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemCF::CreateInstance -// -// Synopsis: -// Attempt to create an object that implements the specified interface. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemCF::CreateInstance( - _In_opt_ IUnknown* pUnknownOuter, - _In_ CONST IID& iid, - _COM_Outptr_ VOID** ppv - ) -{ - VERBOSE(DLLTEXT("COemCF::CreateInstance entry.")); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // - // Cannot aggregate. - // - if (pUnknownOuter != NULL) - { - return CLASS_E_NOAGGREGATION; - } - - HRESULT hr = S_OK; - - if (iid == IID_IUnknown || - iid == IID_IPrintOemUI2) - { - VERBOSE(DLLTEXT("COemCF::IID_IUnknown\r\n")); - - // - // Create component. - // - COemUI2* pOemCB = new COemUI2; - if (pOemCB == NULL) - { - hr = E_OUTOFMEMORY; - } - else - { - // - // Get the requested interface. - // - hr = pOemCB->QueryInterface(iid, ppv); - - // - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - // - pOemCB->Release(); - } - } - else - { - hr = E_NOINTERFACE; - } - - return hr; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemCF::LockServer -// -// Synopsis: -// Locking the server holds the objects server in memory, so that new -// instances of objects can be created more quickly. -// -// Returns: -// S_OK -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemCF::LockServer( - BOOL bLock - // If true, increment the lock count, otherwise decrement the lock - // count. - ) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks); - } - else - { - InterlockedDecrement(&g_cServerLocks); - } - - return S_OK; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2 (destructor) -// -// Synopsis: -// Release the helper interface, as well as any other resources that -// the plug-in is holding onto. -// -// Returns: -// -// Notes: -// -// -//---------------------------------------------------------------------------- -COemUI2::~COemUI2() -{ - // - // Make sure that helper interface is released. - // - if(NULL != m_pCoreHelper) - { - m_pCoreHelper->Release(); - m_pCoreHelper = NULL; - } - - // - // If this instance of the object is being deleted, then the reference - // count should be zero. - // - assert(0 == m_cRef); -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::QueryInterface -// -// Synopsis: -// Standard COM IUnknown implementation. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::QueryInterface( - CONST IID& iid, - _COM_Outptr_ VOID** ppv - ) -{ - VERBOSE(DLLTEXT("COemUI2::QueryInterface entry.")); - - if (iid == IID_IUnknown) - { - *ppv = static_cast(this); - VERBOSE(DLLTEXT("COemUI2::QueryInterface - Return pointer to IUnknown.\r\n")); - } - else if (iid == IID_IPrintOemUI2) - { - *ppv = static_cast(this); - VERBOSE(DLLTEXT("COemUI2::QueryInterface - Return pointer to IPrintOemUI.\r\n")); - } - else - { -#if DBG - TCHAR szOutput[80] = {0}; - StringFromGUID2(iid, szOutput, _countof(szOutput)); // can not fail! - VERBOSE(DLLTEXT("COemUI2::QueryInterface %s not supported.\r\n"), szOutput); -#endif - - *ppv = NULL; - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::AddRef -// -// Synopsis: -// Standard COM IUnknown implementation. -// -// -//---------------------------------------------------------------------------- -ULONG __stdcall -COemUI2::AddRef() -{ - VERBOSE(DLLTEXT("COemUI2::AddRef entry.")); - - return InterlockedIncrement(&m_cRef); -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::Release -// -// Synopsis: -// Standard COM IUnknown implementation. -// -// -//---------------------------------------------------------------------------- -ULONG __stdcall -COemUI2::Release() -{ - VERBOSE(DLLTEXT("COemUI2::Release entry.")); - - assert(0 != m_cRef); - - ULONG cRef = InterlockedDecrement(&m_cRef); - - if (0 == cRef) - { - delete this; - return 0; - - } - - return cRef; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::PublishDriverInterface -// -// Synopsis: -// This routine is called by the core driver to supply objects to the -// plug-in which the plug-in can use to implement various features. -// -// This implementation requires an object that IPrintCoreHelper interface -// from the core driver to implement full UI replacement. If the object -// passed in is the one desired, this routine will return S_OK, otherwise -// it will return E_FAIL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::PublishDriverInterface( - IUnknown *pIUnknown - ) -{ - VERBOSE(DLLTEXT("COemUI2::PublishDriverInterface entry.")); - - HRESULT hrResult = S_OK; - - // - // Determine whether the published object is the helper interface - // introduced in Vista to support full UI replacement. - // - if (m_pCoreHelper == NULL) - { - hrResult = pIUnknown->QueryInterface(IID_IPrintCoreHelper, (VOID**) &(m_pCoreHelper)); - - if (!SUCCEEDED(hrResult)) - { - m_pCoreHelper = NULL; - hrResult = E_FAIL; - } - } - - return hrResult; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::GetInfo -// -// Synopsis: -// Most of this routine is a standard implementation common to most -// plug-ins. Of particular note in this sample is that to get a handle -// the IPrintCoreHelper plug-in in the PublishDriverInterface callback, -// this routine must return OEMPUBLISH_IPRINTCOREHELPER in the out -// parameter when the mode is OEMGI_GETREQUESTEDHELPERINTERFACES. -// -// Returns: -// S_OK for supported modes, E_FAIL for everything else. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::GetInfo( - _In_ DWORD dwMode, - // The mode indicates what information is being requested by the - // core driver. - _Out_writes_bytes_to_(cbSize, *pcbNeeded) PVOID pBuffer, - // The output buffer is the location into which the requested info - // should be written - _In_ DWORD cbSize, - // The size of the output buffer. - _Out_ PDWORD pcbNeeded - // If the size of the buffer is insufficient, use this parameter - // to indicate to the core driver how much space is required. - ) -{ - HRESULT hrResult = S_OK; - -#if DBG - PWSTR pszTag; - - switch(dwMode) - { - case OEMGI_GETSIGNATURE: pszTag = L"COemUI2::GetInfo entry. [OEMGI_GETSIGNATURE]"; break; - case OEMGI_GETVERSION: pszTag = L"COemUI2::GetInfo entry. [OEMGI_GETVERSION]"; break; - case OEMGI_GETREQUESTEDHELPERINTERFACES: pszTag = L"COemUI2::GetInfo entry. [OEMGI_GETREQUESTEDHELPERINTERFACES]"; break; - default: pszTag = L"COemUI2::GetInfo entry."; break; - } - - VERBOSE(pszTag); -#endif - - // - // Validate parameters. OEMGI_GETPUBLISHERINFO is excluded from this - // list because that GetInfo mode applies only to PScript rendering plug-ins. - // - if ((NULL == pcbNeeded) || - ((OEMGI_GETSIGNATURE != dwMode) && - (OEMGI_GETVERSION != dwMode) && - (OEMGI_GETREQUESTEDHELPERINTERFACES != dwMode))) - { - WARNING(DLLTEXT("COemUI2::GetInfo() exit pcbNeeded is NULL or mode is not supported\r\n")); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // - // Set expected buffer size and number of bytes written. - // - *pcbNeeded = sizeof(DWORD); - - // - // Check buffer size is sufficient. - // - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - WARNING(DLLTEXT("COemUI2::GetInfo() exit insufficient buffer!\r\n")); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - hrResult = E_FAIL; - } - else - { - switch(dwMode) - { - // - // OEM DLL Signature - // - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // - // OEM DLL version - // - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // - // New core helper interface support - // - case OEMGI_GETREQUESTEDHELPERINTERFACES: - *(PDWORD)pBuffer = 0; - *(PDWORD)pBuffer |= OEMPUBLISH_IPRINTCOREHELPER; - break; - - // - // dwMode not supported. - // - default: - // Set written bytes to zero since nothing was written. - // - WARNING(DLLTEXT("COemUI2::GetInfo() exit mode not supported.\r\n")); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - hrResult = E_FAIL; - } - } - - return hrResult; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::DevMode -// -// Synopsis: -// This routine operates in various modes to manage the private DEVMODE. -// This sample does not provide much by way of illustration of how to -// handle OEM settings in the private DEVMODE. See the sample OEMUI for -// a more in-depth look at this routine. The function hrOEMDevMode in -// devmode.cpp also provides more information on how to handle the various -// modes. -// -// Returns: -// S_OK on success, else E_* -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::DevMode( - DWORD dwMode, - // The operation that should be performed - POEMDMPARAM pOemDMParam - // The input & output DEVMODEs, including pointers to the public & - // private DEVMODE data. - ) -{ - VERBOSE(DLLTEXT("COemUI2::Devmode entry.")); - - return hrOEMDevMode(dwMode, pOemDMParam); -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::HideStandardUI -// -// Synopsis: -// This routine is critical to supporting full UI replacement. This -// routine allows the plug-in to disable Unidrv's (or PScript's) standard -// UI panels. If this returns E_NOTIMPL, the panel isn't hidden. If -// this routine returns S_OK, Unidrv will not display any UI for the -// specified mode. If this returns E_NOTIMPL, Unidrv will display it's -// standard UI. -// -// Returns: -// S_OK to hide the indicated UI if desired, otherwise E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::HideStandardUI( - DWORD dwMode - // document property sheets, printer property sheets, or possibly - // something not yet defined. - ) -{ - VERBOSE(DLLTEXT("COemUI2::HideStandardUI entry.")); - - HRESULT hrResult = E_NOTIMPL; - - switch(dwMode) - { - case OEMCUIP_DOCPROP: - case OEMCUIP_PRNPROP: - hrResult = S_OK; - break; - default: - // If we don't recognize the mode, assume that we don't want to hide - // the UI provided by Unidrv. - hrResult = E_NOTIMPL; - } - - return hrResult; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::DocumentPropertySheets -// -// Synopsis: -// See function hrOEMDocumentPropertySheets in uniuirep.cpp. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::DocumentPropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ) -{ - VERBOSE(DLLTEXT("COemUI2::DocumentPropertySheets entry.")); - - return hrCommonPropSheetMethod(pPSUIInfo, lParam, m_pCoreHelper, &m_Features, OEMCUIP_DOCPROP); -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::DevicePropertySheets -// -// Synopsis: -// See function hrOEMDevicePropertySheets in uniuirep.cpp -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::DevicePropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ) -{ - VERBOSE(DLLTEXT("COemUI2::DevicePropertySheets entry.")); - - return hrCommonPropSheetMethod(pPSUIInfo, lParam, m_pCoreHelper, &m_Features, OEMCUIP_PRNPROP); -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::CommonUIProp -// -// Synopsis: -// This routine is used to interact with the Unidrv-supplied -// property sheet pages. Since this plug-in implements full-UI -// replacement, those property sheet pages are disabled, and this -// routine does not need to do anything. -// -// Returns: -// S_OK -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::CommonUIProp( - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam - ) -{ - VERBOSE(DLLTEXT("COemUI2::CommonUIProp entry.")); - - UNREFERENCED_PARAMETER(dwMode); - UNREFERENCED_PARAMETER(pOemCUIPParam); - - return S_OK; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::DeviceCapabilities -// -// Synopsis: -// This routine can be used to replace the Unidrvs device capabilities -// handling. In this implementation, no custom capabilities handling is -// provided. -// -// Returns: -// E_FAIL -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::DeviceCapabilities( - _Inout_ POEMUIOBJ poemuiobj, - // OEM settings & information - _In_ HANDLE hPrinter, - // Handle to the printer that the capabilities are being requested for - _In_ PWSTR pDeviceName, - // Name of the device / driver - _In_ WORD wCapability, - // The DC_ ID indicating which capability was requested. - _Out_writes_(_Inexpressible_("varies with wCapability")) PVOID pOutput, - // Buffer to write requested information to. - _In_ PDEVMODE pPublicDM, - // Pointer to the public DEVMODE representing the settings to get - // capabilities with respect to. - _In_ PVOID pOEMDM, - // OEM private DEVMODE settings. - _In_ DWORD dwOld, - // Result from previous plug-in call to this routine. - _Out_ DWORD *dwResult - // Result of this call. If there are multiple UI plug-ins, this - // result is passed to the next one as dwOld - ) -{ - VERBOSE(DLLTEXT("COemUI2::DeviceCapabilities entry.")); - - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(pDeviceName); - UNREFERENCED_PARAMETER(wCapability); - UNREFERENCED_PARAMETER(pOutput); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - UNREFERENCED_PARAMETER(dwOld); - UNREFERENCED_PARAMETER(dwResult); - - // - // Do nothing. Let Unidrv handle the device capabilities processing. - // - - return E_NOTIMPL; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::DevQueryPrintEx -// -// Synopsis: -// This routine is used to determine print job compatibility with the -// current driver. The plug-in can supplement Unidrv's handling of this -// routine. If Unidrv determines that a job can be printed on the current -// printer it will call this routine to ask the plug-in whether it can -// also handle the current job. If Unidrv determines that the job cannot -// be printed, it will not call the plug-in. Additionally, XPS drivers -// built on the Unidrv and PScript UI modules may not recieve this call- -// back. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::DevQueryPrintEx( - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM - ) -{ - VERBOSE(DLLTEXT("COemUI2::DevQueryPrintEx entry.")); - - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pDQPInfo); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - - return E_NOTIMPL; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::UpgradePrinter -// -// Synopsis: -// Use this callback to upgrade any settings from previous versions -// that are stored in the registry by the plug-in Not applicabe to -// this sample. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::UpgradePrinter( - _In_ DWORD dwLevel, - _At_((PDRIVER_UPGRADE_INFO_1)pDriverUpgradeInfo, _In_) PBYTE pDriverUpgradeInfo - ) -{ - VERBOSE(DLLTEXT("COemUI2::UpgradePrinter entry.")); - - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverUpgradeInfo); - - return E_NOTIMPL; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::PrinterEvent -// -// Synopsis: -// Perform any special processing needed when various events occur to the -// print queue. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::PrinterEvent( - _In_ PWSTR pPrinterName, - _In_ INT iDriverEvent, - _In_ DWORD dwFlags, - _In_ LPARAM lParam - ) -{ - VERBOSE(DLLTEXT("COemUI2::PrinterEvent entry.")); - - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(iDriverEvent); - UNREFERENCED_PARAMETER(dwFlags); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::DriverEvent -// -// Synopsis: -// Notifies the plug-in of changes or events relevant to the driver, -// such as installing and upgrading. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::DriverEvent( - _In_ DWORD dwDriverEvent, - _In_ DWORD dwLevel, - _In_reads_(_Inexpressible_("varies")) LPBYTE pDriverInfo, - _In_ LPARAM lParam - ) -{ - VERBOSE(DLLTEXT("COemUI2::DriverEvent entry.")); - - UNREFERENCED_PARAMETER(dwDriverEvent); - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::QueryColorProfile -// -// Synopsis: -// This routine can be implemented to provide a color profile from the -// driver. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::QueryColorProfile( - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulQueryMode, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData - ) -{ - VERBOSE(DLLTEXT("COemUI2::QueryColorProfile entry.")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - UNREFERENCED_PARAMETER(ulQueryMode); - UNREFERENCED_PARAMETER(pvProfileData); - UNREFERENCED_PARAMETER(pcbProfileData); - UNREFERENCED_PARAMETER(pflProfileData); - - return E_NOTIMPL; -}; - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::FontInstallerDlgProc -// -// Synopsis: -// Plug-ins can use this method to replace Unidrv's provided soft-font -// installer dialog. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::FontInstallerDlgProc( - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam - ) -{ - VERBOSE(DLLTEXT("COemUI2::FontInstallerDlgProc entry.")); - - UNREFERENCED_PARAMETER(hWnd); - UNREFERENCED_PARAMETER(usMsg); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::UpdateExternalFonts -// -// Synopsis: -// This routine is used to notify the UI of any changes to installed -// font cartridges, primarily for supporting soft-font UI replacement. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::UpdateExternalFonts( - _In_ HANDLE hPrinter, - _In_ HANDLE hHeap, - _In_ PWSTR pwstrCartridges - ) -{ - VERBOSE(DLLTEXT("COemUI2::UpdateExternalFonts entry.")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(hHeap); - UNREFERENCED_PARAMETER(pwstrCartridges); - - return E_NOTIMPL; -} - -//+--------------------------------------------------------------------------- -// -// Member: -// -// Synopsis: -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::QueryJobAttributes( - _In_ HANDLE hPrinter, - _In_ PDEVMODE pDevmode, - _In_range_(1, 4) DWORD dwLevel, - _In_reads_(_Inexpressible_("varies")) LPBYTE lpAttributeInfo - ) -{ - VERBOSE(DLLTEXT("COemUI2::QueryJobAttributes entry.")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(pDevmode); - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(lpAttributeInfo); - - return E_NOTIMPL; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// COemUI2::DocumentEvent -// -// Synopsis: -// Perform any special processing needed at various points in time while -// a job is printing. -// -// Implementation of this routine is optional. To indicate that the -// plug-in does not support this call, return E_NOTIMPL. -// -// -//---------------------------------------------------------------------------- -HRESULT __stdcall -COemUI2::DocumentEvent( - HANDLE hPrinter, - HDC hdc, - INT iEsc, - ULONG cbIn, - PVOID pbIn, - ULONG cbOut, - PVOID pbOut, - PINT piResult - ) -{ - VERBOSE(DLLTEXT("COemUI2::DocumentEvent entry.")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(hdc); - UNREFERENCED_PARAMETER(iEsc); - UNREFERENCED_PARAMETER(cbIn); - UNREFERENCED_PARAMETER(pbIn); - UNREFERENCED_PARAMETER(cbOut); - UNREFERENCED_PARAMETER(pbOut); - UNREFERENCED_PARAMETER(piResult); - - return E_NOTIMPL; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/intrface.h deleted file mode 100644 index 09a61f4a..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/intrface.h +++ /dev/null @@ -1,222 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.h -// -// PURPOSE: Define COM interface for User Mode Printer Customization DLL. -// -//-------------------------------------------------------------------------- - -#pragma once - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -extern HINSTANCE ghInstance; - // Module's Instance handle from DLLEntry of process. - -class COemUI2: public IPrintOemUI2 -{ -public: - // - // *** IUnknown methods *** - // - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, _COM_Outptr_ LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - STDMETHOD_(ULONG,Release) (THIS); - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Get OEM dll related information - // - STDMETHOD(GetInfo) (THIS_ - _In_ DWORD dwMode, - _Out_writes_bytes_to_(cbSize, *pcbNeeded) PVOID pBuffer, - _In_ DWORD cbSize, - _Out_ PDWORD pcbNeeded); - - // - // OEMDevMode - // - STDMETHOD(DevMode) (THIS_ DWORD dwMode, POEMDMPARAM pOemDMParam); - - // - // OEMCommonUIProp - // - STDMETHOD(CommonUIProp) (THIS_ - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam - ); - - // - // OEMDocumentPropertySheets - // - STDMETHOD(DocumentPropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - // - // OEMDevicePropertySheets - // - STDMETHOD(DevicePropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - - // - // OEMDevQueryPrintEx - // - STDMETHOD(DevQueryPrintEx) (THIS_ - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM - ); - - // - // OEMDeviceCapabilities - // - STDMETHOD(DeviceCapabilities) (THIS_ - _Inout_ POEMUIOBJ poemuiobj, - _In_ HANDLE hPrinter, - _In_ PWSTR pDeviceName, - _In_ WORD wCapability, - _Out_writes_(_Inexpressible_("varies with wCapability")) PVOID pOutput, - _In_ PDEVMODE pPublicDM, - _In_ PVOID pOEMDM, - _In_ DWORD dwOld, - _Out_ DWORD *dwResult - ); - - // - // OEMUpgradePrinter - // - STDMETHOD(UpgradePrinter) (THIS_ - _In_ DWORD dwLevel, - _At_((PDRIVER_UPGRADE_INFO_1)pDriverUpgradeInfo, _In_) PBYTE pDriverUpgradeInfo - ); - - // - // OEMPrinterEvent - // - STDMETHOD(PrinterEvent) (THIS_ - _In_ PWSTR pPrinterName, - _In_ INT iDriverEvent, - _In_ DWORD dwFlags, - _In_ LPARAM lParam - ); - - // - // OEMDriverEvent - // - STDMETHOD(DriverEvent)(THIS_ - _In_ DWORD dwDriverEvent, - _In_ DWORD dwLevel, - _In_reads_(_Inexpressible_("varies")) LPBYTE pDriverInfo, - _In_ LPARAM lParam - ); - - // - // OEMQueryColorProfile - // - STDMETHOD( QueryColorProfile) (THIS_ - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulReserved, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData); - - // - // OEMFontInstallerDlgProc - // - STDMETHOD(FontInstallerDlgProc) (THIS_ - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam - ); - // - // UpdateExternalFonts - // - STDMETHOD(UpdateExternalFonts) (THIS_ - _In_ HANDLE hPrinter, - _In_ HANDLE hHeap, - _In_ PWSTR pwstrCartridges - ); - - // - // IPrintOemUI2 methods - // - - // - // QueryJobAttributes - // - STDMETHOD(QueryJobAttributes) (THIS_ - _In_ HANDLE hPrinter, - _In_ PDEVMODE pDevmode, - _In_range_(1, 4) DWORD dwLevel, - _In_reads_(_Inexpressible_("varies")) LPBYTE lpAttributeInfo - ); - - // - // Hide Standard UI - // - STDMETHOD(HideStandardUI) (THIS_ - DWORD dwMode - ); - - // - // DocumentEvent - // - STDMETHOD(DocumentEvent) (THIS_ - HANDLE hPrinter, - HDC hdc, - INT iEsc, - ULONG cbIn, - PVOID pbIn, - ULONG cbOut, - PVOID pbOut, - PINT piResult - ); - - COemUI2() - { - m_cRef = 1; - m_pCoreHelper = NULL; - }; - - virtual ~COemUI2(); - -protected: - - LONG m_cRef; - // reference count of this object - - IPrintCoreHelper* m_pCoreHelper; - // Pointer to the helper interface introduced in Windows Vista. - - CFeatureCollection m_Features; - // Collection of features advertised as supported by the helper - // interface. -}; - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/precomp.h deleted file mode 100644 index cf24303c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/precomp.h +++ /dev/null @@ -1,68 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: precomp.h -// -// PURPOSE: Header files that should be in the precompiled header. -// -//-------------------------------------------------------------------------- - -#pragma once - -// Necessary for compiling under VC. -#if(!defined(WINVER) || (WINVER < 0x0500)) - #undef WINVER - #define WINVER 0x0500 -#endif -#if(!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)) - #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0500 -#endif - - -// Required header files that shouldn't change often. - - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "resource.h" -#include "devmode.h" -#include "Features.h" -#include "uniuirep.h" -#include "debug.h" -#include "intrface.h" - -#include - -// Include this file after any other standard include files -// to disallow unsafe string handling functions. -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/resource.h b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/resource.h deleted file mode 100644 index d7eda884..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/resource.h +++ /dev/null @@ -1,57 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -// -// Used by uirepplug.rc. Keep this in sync with the definitions in that file. -// -//-------------------------------------------------------------------------- - -// -//{{NO_DEPENDENCIES}} -// -#define IDS_SECTION 1 -#define IDS_NAME 3 -#define IDS_DEVICE_SETTINGS_NAME 4 -#define IDS_CONSTRAINT_CONFLICT 5 -#define IDD_DOC_PROPPAGE 107 -#define IDS_METAFILE_SPOOLING 419 -#define IDS_TEXT_ASGRX 431 -#define IDS_TTDL_DEFAULT 460 -#define IDS_TTDL_TYPE1 461 -#define IDS_TTDL_TYPE3 462 -#define IDS_TTDL_TYPE42 463 -#define IDS_MISSINGNAME 464 -#define IDS_RESDLL 700 -#define IDS_GRAPHICS_MODE 701 -#define IDS_DUPLEX_UNIT 702 -#define IDS_UNIRESDLL 707 -#define IDS_RESOLUTION_600_DPI 708 -#define IDS_RESOLUTION_300_DPI 709 -#define IDS_RESOLUTION_150_DPI 710 -#define IDS_RASTERMODE 711 -#define IDS_HPGL2MODE 712 -#define IDS_PAPERSIZE_LETTER 713 -#define IDS_PAPERSIZE_LEGAL 714 -#define IDS_PAPERSIZE_EXECUTIVE 715 -#define IDS_PAPERSIZE_A4 716 -#define IDS_PAPERSIZE_B5 717 -#define IDS_COLORMODE_MONO 718 -#define IDS_COLORMODE_24BPP 719 -#define IDS_COLORMODE_8BPP 720 -#define IDS_HALFTONE_AUTO 721 -#define IDS_HALFTONE_SUPERCELL_M 722 -#define IDS_HALFTONE_6x6_M 723 -#define IDS_HALFTONE_8x8_M 724 -#define IDS_UIREP_ENVTRAY 728 -#define IDS_OUTBIN_STACKER 735 -#define IDS_OUTBIN_DEFAULT 736 -#define IDS_MEMORY_STD 737 -#define IDS_MEMORY_UPGRADE 738 -#define IDS_INSTALLED_MEMORY 739 - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.cpp b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.cpp deleted file mode 100644 index d75e3215..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.cpp +++ /dev/null @@ -1,492 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: uniuirep.cpp -// -// PURPOSE: This module handles COMPSTUI initialization and -// callback behavior. -// -//-------------------------------------------------------------------------- - - -#include "precomp.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// INTERNAL MACROS and DEFINES -//////////////////////////////////////////////////////// - -typedef struct _tagCBUserData -{ - HANDLE hComPropSheet; - HANDLE hPropPage; - POEMUIPSPARAM pOEMUIParam; - PFNCOMPROPSHEET pfnComPropSheet; - IPrintCoreHelper* pHelper; - BOOL bPermission; - -} CBUSERDATA, *PCBUSERDATA; - - -//////////////////////////////////////////////////////// -// INTERNAL PROTOTYPES -//////////////////////////////////////////////////////// - -LONG APIENTRY -OEMCommonUICallBack( - _In_ PCPSUICBPARAM pCallbackParam - ); - -POPTITEM -CreateOptItems( - HANDLE hHeap, - DWORD dwOptItems - ); - - -//+--------------------------------------------------------------------------- -// -// Member: -// ::hrCommonPropSheetMethod -// -// Synopsis: -// Adds property page to printer property sheet. -// -// Returns: -// S_OK on success, E_FAIL on failure. Sets LastError. -// -// -//---------------------------------------------------------------------------- -HRESULT -hrCommonPropSheetMethod( - PPROPSHEETUI_INFO pPSUIInfo, - // Property sheet information, including - // the reason for calling this function. - LPARAM lParam, - // Optional parameter. Value is determined - // by the reason member of pPSUIInfo. - IPrintCoreHelper* pHelper, - // Pointer to the helper interface used to control - // settings described in the GPD - CFeatureCollection* pFeatures, - // Collection of all features that we're supporting - // in our custom UI. - DWORD dwMode - // Should our sheet show device or document features? - ) -{ - LONG_PTR lResult = TRUE; - // result supplied to COMPSTUI via pPSUIInfo - - HRESULT hrResult = S_OK; - // Result returned to the immediate caller. - - VERBOSE(DLLTEXT("hrCommonPropSheetMethod entry.")); - - // - // Validate parameters. - // - if ((NULL == pPSUIInfo) || - (PROPSHEETUI_INFO_VERSION != pPSUIInfo->Version)) - { - ERR(ERRORTEXT("hrCommonPropSheetMethod() ERROR_INVALID_PARAMETER.\r\n")); - - // - // Return invalid parameter error. - // - SetLastError(ERROR_INVALID_PARAMETER); - hrResult = E_FAIL; - goto Exit; - } - - Dump(pPSUIInfo); - - // - // Do action. - // - switch(pPSUIInfo->Reason) - { - case PROPSHEETUI_REASON_INIT: - { - WORD wFeatures = 0; - DWORD dwSheets = 0; - PCBUSERDATA pUserData = NULL; - POEMUIPSPARAM pOEMUIParam = (POEMUIPSPARAM)pPSUIInfo->lParamInit; - BOOL bPermission = 0; - HANDLE hHeap = pOEMUIParam->hOEMHeap; - COMPROPSHEETUI Sheet; - - // - // If the user doesn't have permission to change settings, - // make a note of it so we can disable controls later. - // - if (dwMode == OEMCUIP_PRNPROP) - { - bPermission = ((pOEMUIParam->dwFlags & DPS_NOPERMISSION)==0); - } - else - { - bPermission = ((pOEMUIParam->dwFlags & DM_NOPERMISSION)==0); - } - - // - // Make sure that we have the core driver features - // - hrResult = pFeatures->Acquire(hHeap, pHelper); - if (!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrCommonPropSheetMethod: Failed to load core driver features! (hrResult = 0x%x)\r\n"), - hrResult); - goto Exit; - } - - // - // Wait until after the call to Acquire to read the number of features. - // - wFeatures = (WORD)pFeatures->GetCount(dwMode); - - // - // Init device settings replacement page - // - memset(&Sheet, 0, sizeof(COMPROPSHEETUI)); - Sheet.cbSize = sizeof(COMPROPSHEETUI); - Sheet.Flags = bPermission ? CPSUIF_UPDATE_PERMISSION : 0; - Sheet.hInstCaller = ghInstance; - Sheet.pHelpFile = NULL; - Sheet.pfnCallBack = OEMCommonUICallBack; - Sheet.cOptItem = wFeatures; - Sheet.IconID = IDI_CPSUI_PRINTER; - Sheet.CallerVersion = 0x100; - Sheet.OptItemVersion = 0x100; - - // - // Initialize mode-specific fields - // - if (dwMode == OEMCUIP_PRNPROP) - { - // - // Use a DlgPage structure to set the text in the tab - // in the printer propertues view. - // - DLGPAGE DlgPage; - memset(&DlgPage, 0, sizeof(DLGPAGE)); - DlgPage.cbSize = sizeof(DLGPAGE); - DlgPage.DlgTemplateID = DP_STD_TREEVIEWPAGE; - - // - // Get device settings display name - // - hrResult = GetStringResource(hHeap, ghInstance, IDS_DEVICE_SETTINGS_NAME, &DlgPage.pTabName); - - if (!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrCommonPropSheetMethod: Failed to get tab name! (hrResult = 0x%x)\r\n"), - hrResult); - goto Exit; - } - Sheet.pDlgPage = &DlgPage; - Sheet.cDlgPage = 1; - } - else - { - // - // printing preferences settings - // - Sheet.pDlgPage = CPSUI_PDLGPAGE_TREEVIEWONLY; - } - - // - // Get caller name - // - hrResult = GetStringResource(hHeap, ghInstance, IDS_NAME, &Sheet.pCallerName); - if (!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrCommonPropSheetMethod: Failed to get caller name! (hrResult = 0x%x)\r\n"), hrResult); - goto Exit; - } - - // - // Get section name - // - hrResult = GetStringResource(hHeap, ghInstance, IDS_SECTION, &Sheet.pOptItemName); - if (!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrCommonPropSheetMethod: Failed to get section name! (hrResult = 0x%x)\r\n"), hrResult); - goto Exit; - } - - // - // Init user data. - // - pUserData = (PCBUSERDATA)HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(CBUSERDATA)); - - if (pUserData == NULL) - { - ERR(ERRORTEXT("hrCommonPropSheetMethod: Failed to allocate user data!\r\n")); - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - pUserData->hComPropSheet = pPSUIInfo->hComPropSheet; - pUserData->pfnComPropSheet = pPSUIInfo->pfnComPropSheet; - pUserData->pOEMUIParam = pOEMUIParam; - pUserData->pHelper = pHelper; - pUserData->bPermission = bPermission; - Sheet.UserData = (ULONG_PTR)pUserData; - - // - // Create OptItems for page. - // - Sheet.pOptItem = CreateOptItems(hHeap, Sheet.cOptItem); - - if (Sheet.pOptItem == NULL) - { - ERR(ERRORTEXT("hrCommonPropSheetMethod: Failed to allocate OPTITEMS!\r\n")); - hrResult = E_OUTOFMEMORY; - goto Exit; - } - - // - // Add core driver features - // - for (DWORD wIndex = 0; wIndex < wFeatures; wIndex++) - { - // - // Initialize level and basic state for feature - // - Sheet.pOptItem[wIndex].Level = 1; - Sheet.pOptItem[wIndex].Flags = OPTIF_COLLAPSE; - CFeature *pFeature = pFeatures->GetFeature(wIndex, dwMode); - - if (pFeature == NULL) - { - ERR(ERRORTEXT("hrCommonPropSheetMethod: Feature not found or features not initialized!\r\n")); - hrResult = E_UNEXPECTED; - goto Exit; - } - - // - // Get OPTITEM for this feature - // - hrResult = pFeature->InitOptItem(hHeap, Sheet.pOptItem + wIndex); - - if (!SUCCEEDED(hrResult)) - { - ERR(ERRORTEXT("hrCommonPropSheetMethod: Failed to get OPTITEM for feature %s\r\n"), pFeature->GetKeyword()); - goto Exit; - } - - } - - // - // Add property sheets. - // - lResult = pPSUIInfo->pfnComPropSheet(pPSUIInfo->hComPropSheet, - CPSFUNC_ADD_PCOMPROPSHEETUI, - (LPARAM)&Sheet, - (LPARAM)&dwSheets); - - - if (!lResult) - { - ERR(DLLTEXT("hrCommonPropSheetMethod() pfnComPropSheet returned %d.\r\n"), lResult); - ERR(ERRORTEXT("ComPropSheet failed! Failed to add device settings tab!\n")); - } - } - break; - - case PROPSHEETUI_REASON_GET_INFO_HEADER: - { - // - // Set header title - // - PPROPSHEETUI_INFO_HEADER pHeader = (PPROPSHEETUI_INFO_HEADER)lParam; - pHeader->pTitle = (LPTSTR)PROP_TITLE; - lResult = TRUE; - } - break; - - case PROPSHEETUI_REASON_GET_ICON: - // - // No icon - // - lResult = 0; - break; - - case PROPSHEETUI_REASON_SET_RESULT: - { - PSETRESULT_INFO pInfo = (PSETRESULT_INFO)lParam; - lResult = pInfo->Result; - } - break; - - case PROPSHEETUI_REASON_DESTROY: - lResult = TRUE; - break; - } - - pPSUIInfo->Result = lResult; - -Exit: - - return hrResult; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// OEMCommonUICallBack -// -// Synopsis: -// Callback function to handle changes to the feature list panel -// added by this plug-in to the document properties UI. -// -// Returns: -// CPSUICB_ACTION_NONE if nothing further needs done. -// CPSUICB_ACTION_NO_APPLY_EXIT if settings changes were aborted -// -// -//---------------------------------------------------------------------------- -LONG APIENTRY -OEMCommonUICallBack( - _In_ PCPSUICBPARAM pCallbackParam - // struct containing all of the relevant callback parameters, - // including the reason that the callback is being made. - ) -{ - VERBOSE(DLLTEXT("OEMCommonUICallBack entry.")); - - WORD wItems = pCallbackParam->cOptItem; - LONG lReturn = CPSUICB_ACTION_NONE; - POPTITEM pOptItem = pCallbackParam->pOptItem; - PCBUSERDATA pUserData = (PCBUSERDATA) pCallbackParam->UserData; - HANDLE hHeap = pUserData->pOEMUIParam->hOEMHeap; - HRESULT hrResult = S_OK; - - VERBOSE(DLLTEXT("Reason = %d"), pCallbackParam->Reason); - - // - // If user has no permission to change anything, then simply - // return without any action - // - if (!pUserData->bPermission && - (pCallbackParam->Reason != CPSUICB_REASON_ABOUT)) - { - WARNING(DLLTEXT("OEMCommonUICallBack: User does not have appropriate permission!\r\n")); - lReturn = CPSUICB_ACTION_NONE; - } - else - { - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - if (wItems > 0) - { - // - // Save features if hiding std UI - // - hrResult = SaveFeatureOptItems(hHeap, - pUserData->pHelper, - pCallbackParam->hDlg, - pOptItem, - wItems); - - if (!SUCCEEDED(hrResult)) - { - // - // Return that we didn't save changes. - // NOTE: It is upto SaveFeatureOptItems() to display any - // UI for failure - // - lReturn = CPSUICB_ACTION_NO_APPLY_EXIT; - } - else - { - pUserData->pfnComPropSheet(pUserData->hComPropSheet, - CPSFUNC_SET_RESULT, - (LPARAM)pUserData->hPropPage, - (LPARAM)CPSUI_OK); - } - } - break; - - case CPSUICB_REASON_KILLACTIVE: - // - // This active property sheet page is changing, and this page is - // going inactive. - // - break; - - case CPSUICB_REASON_SETACTIVE: - // - // This property sheet page is about to become the active page. - // - default: - break; - } - } - - return lReturn; -} - - -//+--------------------------------------------------------------------------- -// -// Member: -// -// Synopsis: -// Creates and Initializes OptItems. -// -// Returns: -// Pointer to an array of optitems on success, else -// NULL on failure. -// -// -//---------------------------------------------------------------------------- -POPTITEM -CreateOptItems( - HANDLE hHeap, - // Heap to allocate data from - DWORD dwOptItems - // Number of opt items to allocate. - ) -{ - VERBOSE(DLLTEXT("CreateOptItems entry.")); - - POPTITEM pOptItems = NULL; - // OPTITEMs to be returned to caller. - - ULONG cbOptItems = 0; - // Number of bytes needed for optitems. - - // Allocate memory for OptItems. - if (SUCCEEDED(ULongMult( sizeof(OPTITEM), dwOptItems, &cbOptItems)) && - (pOptItems = (POPTITEM)HeapAlloc(hHeap, HEAP_ZERO_MEMORY, cbOptItems)) != NULL) - { - // Zero out memory. - memset(pOptItems, 0, sizeof(OPTITEM) * dwOptItems); - - // Set each OptItem's size, and Public DM ID. - for (DWORD dwCount = 0; dwCount < dwOptItems; dwCount++) - { - pOptItems[dwCount].cbSize = sizeof(OPTITEM); - pOptItems[dwCount].DMPubID = DMPUB_NONE; - } - } - else - { - ERR(ERRORTEXT("CreateOptItems() failed to allocate memory for OPTITEMs!\r\n")); - } - - return pOptItems; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.def b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.def deleted file mode 100644 index bf87f4c2..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.def +++ /dev/null @@ -1,18 +0,0 @@ -; -; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -; ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -; PARTICULAR PURPOSE. -; -; Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -; -; Abstract: -; -; This file contains a listing of all of the methods to be exported -; from the DLL, as well as rules for how to name the exports. -; - -LIBRARY UIREPPLUG - -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.h b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.h deleted file mode 100644 index 52980245..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.h +++ /dev/null @@ -1,55 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: UNIUIREP.H -// -// PURPOSE: Define common data types, and external function prototypes -// for UI replacement sample. -// -//-------------------------------------------------------------------------- - -#pragma once - -#define DLLTEXT(s) TEXT("[UIREPPLUG] ") TEXT(s) -#define FUNCTEXT(s) _T(__FUNCTION__) TEXT(s) -#define ERRORTEXT(s) TEXT("ERROR ") DLLTEXT(s) - -// -// OEM Signature is used to identify the -// private DEVMODE portion to mitigate against -// data corruption. Replace this with a unique string -// for your organization. -// -#define OEM_SIGNATURE 'UIRP' -#define OEM_VERSION 0x00000001L - -// -// OEM Signature and version. -// -#define PROP_TITLE L"UIRepPlug Page" - -// -// Printer registry keys where OEM data is stored. -// -#define UIREPPLUG_VALUE TEXT("UIREPPLUG_VALUE") -#define UIREPPLUG_DEVICE_VALUE TEXT("UIREPPLUG_DEVICE_VALUE") - -// -// Method prototypes -// - -HRESULT -hrCommonPropSheetMethod( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam, - IPrintCoreHelper* pHelper, - CFeatureCollection* pFeatures, - DWORD dwMode - ); - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.rc b/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.rc deleted file mode 100644 index 67cad8ae..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/uniuirep/src/uniuirep.rc +++ /dev/null @@ -1,192 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2005 Microsoft Corporation. All Rights Reserved. -// -// FILE: uniuirep.rc -// -// PURPOSE: Resource script containing all localizable strings for this -// module -// -//-------------------------------------------------------------------------- - -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Written by Windows Printing & Imaging Team" - VALUE "CompanyName", "Microsoft Corp." - VALUE "FileDescription", "UI Replacement PrintTicket Plugin." - VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "UIREPPLUG" - VALUE "LegalCopyright", "Copyright 1998 - 2005 Microsoft Corp." - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation" - VALUE "OriginalFilename", "UIREPPLUG.dll" - VALUE "ProductName", "Microsoft UIREPPLUG" - VALUE "ProductVersion", "1.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_SECTION "UIRepPlug Added Item" - IDS_NAME "UI Replacement PrintTicket Plugin" - IDS_DEVICE_SETTINGS_NAME "Device Settings" - IDS_CONSTRAINT_CONFLICT "There are one or more conflicting settings.\r\nDo you want driver to automatically resolve conflicts?" -END - -STRINGTABLE -BEGIN - IDS_RESDLL "Resource DLL" - IDS_GRAPHICS_MODE "Graphics Mode" - IDS_DUPLEX_UNIT "Duplex Unit" -END - -STRINGTABLE -BEGIN - IDS_UNIRESDLL "unires.dll" - IDS_RESOLUTION_600_DPI "600 x 600 dots per inch" - IDS_RESOLUTION_300_DPI "300 x 300 dots per inch" - IDS_RESOLUTION_150_DPI "150 x 150 dots per inch" - IDS_RASTERMODE "Raster mode" - IDS_HPGL2MODE "HPGL2 mode" - IDS_PAPERSIZE_LETTER "Letter" - IDS_PAPERSIZE_LEGAL "Legal" - IDS_PAPERSIZE_EXECUTIVE "Executive" - IDS_PAPERSIZE_A4 "A4" - IDS_PAPERSIZE_B5 "B5" - IDS_COLORMODE_MONO "Monochrome" - IDS_COLORMODE_24BPP "24 bits per pixel" - IDS_MISSINGNAME "" -END - -STRINGTABLE -BEGIN - IDS_COLORMODE_8BPP "8 bits per pixel" - IDS_HALFTONE_AUTO "Auto Select" - IDS_HALFTONE_SUPERCELL_M "Super Cell" - IDS_HALFTONE_6x6_M "Dither 6x6" - IDS_HALFTONE_8x8_M "Dither 8x8" - IDS_UIREP_ENVTRAY "Envelope Feeder Tray" - IDS_INSTALLED_MEMORY "Device Memory" - IDS_MEMORY_STD "Standard Memory" - IDS_MEMORY_UPGRADE "16MB Upgrade" - -END - -STRINGTABLE -BEGIN - IDS_OUTBIN_STACKER "Stacker" - IDS_OUTBIN_DEFAULT "Default" -END - -STRINGTABLE -BEGIN - IDS_METAFILE_SPOOLING "Advanced Printing Features" - IDS_TEXT_ASGRX "Print Optimizations" -END - -STRINGTABLE -BEGIN - IDS_TTDL_DEFAULT "Automatic" - IDS_TTDL_TYPE1 "Outline" - IDS_TTDL_TYPE3 "Bitmap" - IDS_TTDL_TYPE42 "Native TrueType" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/common/debug.h b/print/OEM Printer Customization Plug-in Samples/C++/watermark/common/debug.h deleted file mode 100644 index 0414569c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/common/debug.h +++ /dev/null @@ -1,82 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.H -// -// PURPOSE: Define common data types, and external function prototypes -// for debugging functions. Also defines the various debug macros. -// -// - -#pragma once - -///////////////////////////////////////////////////////// -// Macros -///////////////////////////////////////////////////////// -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// WARNING("App passed NULL pointer, ignoring...\n"); -// - -#define DBG_VERBOSE 0 -#define DBG_WARNING 1 -#define DBG_ERROR 2 -#define DBG_NONE 3 - -// VC and Build use different debug defines. -#if defined (DBG) || defined (_DEBUG) - - // __declspec(selectany) ensures that even if this is defined in multiple compilation - // modules, they will all resolve to the same symbol in the linked DLL - __declspec(selectany) INT giDebugLevel = 2; - - #define STRINGIZE(x) #x - #define QUOTE(x) STRINGIZE(x) - #define FILE_AND_LINE __FILE__ "@" QUOTE(__LINE__) - - #define VERBOSE(msg) { if(giDebugLevel <= DBG_VERBOSE) OutputDebugStringA( FILE_AND_LINE ": " msg); } - #define WARNING(msg) { if(giDebugLevel <= DBG_WARNING) OutputDebugStringA( FILE_AND_LINE ": Warning: " msg); } - #define ERR(msg) { if(giDebugLevel <= DBG_ERROR) OutputDebugStringA(FILE_AND_LINE ": Error:" msg); } - #define ASSERT(cond) { if (!(cond)) RIP("\n"); } - #define RIP(msg) { OutputDebugStringA(FILE_AND_LINE ": Error (not recoverable): " msg); DebugBreak(); } - -#else // !DBG - - #define VERBOSE(msg) - #define WARNING(msg) - #define ERR(msg) - #define ASSERT(cond) - #define RIP(msg) - -#endif - - - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/common/devmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermark/common/devmode.cpp deleted file mode 100644 index 71ffc11d..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/common/devmode.cpp +++ /dev/null @@ -1,229 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.cpp -// -// PURPOSE: Implementation of Devmode functions shared with OEM UI and OEM rendering modules. -// - -// This file is wrapped in fdevmode.cpp in other parts of the watermark sample. -// The appropriate precompiled header should be included there. -// #include "precomp.h - -#include "debug.h" -#include "devmode.h" - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam) -{ - HRESULT hResult = S_OK; - POEMDEV pOEMDevIn = NULL; - POEMDEV pOEMDevOut = NULL; - - - // Verify parameters. - if( (NULL == pOemDMParam) - || - ( (OEMDM_SIZE != dwMode) - && - (OEMDM_DEFAULT != dwMode) - && - (OEMDM_CONVERT != dwMode) - && - (OEMDM_MERGE != dwMode) - ) - ) - { - ERR(DLLTEXT("DevMode() ERROR_INVALID_PARAMETER.\r\n")); - - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Cast generic (i.e. PVOID) to OEM private devomode pointer type. - pOEMDevIn = (POEMDEV) pOemDMParam->pOEMDMIn; - pOEMDevOut = (POEMDEV) pOemDMParam->pOEMDMOut; - - switch(dwMode) - { - case OEMDM_SIZE: - pOemDMParam->cbBufSize = sizeof(OEMDEV); - break; - - case OEMDM_DEFAULT: - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->bEnabled = WATER_MARK_DEFAULT_ENABLED; - pOEMDevOut->dfRotate = WATER_MARK_DEFAULT_ROTATION; - pOEMDevOut->dwFontSize = WATER_MARK_DEFAULT_FONTSIZE; - pOEMDevOut->crTextColor = WATER_MARK_DEFAULT_COLOR; - hResult = StringCbCopyW(pOEMDevOut->szWaterMark, sizeof(pOEMDevOut->szWaterMark), WATER_MARK_DEFAULT_TEXT); - break; - - case OEMDM_CONVERT: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - break; - - case OEMDM_MERGE: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - MakeOEMDevmodeValid(pOEMDevOut); - break; - } - - return hResult; -} - - -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut) -{ - HRESULT hCopy = S_OK; - - - if( (NULL == pOEMDevIn) - || - (NULL == pOEMDevOut) - ) - { - ERR(DLLTEXT("ConvertOEMDevmode() invalid parameters.\r\n")); - return FALSE; - } - - // Check OEM Signature, if it doesn't match ours, - // then just assume DMIn is bad and use defaults. - if(pOEMDevIn->dmOEMExtra.dwSignature == pOEMDevOut->dmOEMExtra.dwSignature) - { - VERBOSE(DLLTEXT("Converting private OEM Devmode.\r\n")); - - // Set the devmode defaults so that anything the isn't copied over will - // be set to the default value. - pOEMDevOut->bEnabled = WATER_MARK_DEFAULT_ENABLED; - pOEMDevOut->dfRotate = WATER_MARK_DEFAULT_ROTATION; - pOEMDevOut->dwFontSize = WATER_MARK_DEFAULT_FONTSIZE; - pOEMDevOut->crTextColor = WATER_MARK_DEFAULT_COLOR; - hCopy = StringCbCopyW(pOEMDevOut->szWaterMark, sizeof(pOEMDevOut->szWaterMark), WATER_MARK_DEFAULT_TEXT); - - // Copy the old structure in to the new using which ever size is the smaller. - // Devmode maybe from newer Devmode (not likely since there is only one), or - // Devmode maybe a newer Devmode, in which case it maybe larger, - // but the first part of the structure should be the same. - - // DESIGN ASSUMPTION: the private DEVMODE structure only gets added to; - // the fields that are in the DEVMODE never change only new fields get added to the end. - - memcpy(pOEMDevOut, pOEMDevIn, __min(pOEMDevOut->dmOEMExtra.dwSize, pOEMDevIn->dmOEMExtra.dwSize)); - - // Re-fill in the size and version fields to indicated - // that the DEVMODE is the current private DEVMODE version. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - } - else - { - WARNING(DLLTEXT("Unknown DEVMODE signature, pOEMDMIn ignored.\r\n")); - - // Don't know what the input DEVMODE is, so just use defaults. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->bEnabled = WATER_MARK_DEFAULT_ENABLED; - pOEMDevOut->dfRotate = WATER_MARK_DEFAULT_ROTATION; - pOEMDevOut->dwFontSize = WATER_MARK_DEFAULT_FONTSIZE; - pOEMDevOut->crTextColor = WATER_MARK_DEFAULT_COLOR; - hCopy = StringCbCopyW(pOEMDevOut->szWaterMark, sizeof(pOEMDevOut->szWaterMark), WATER_MARK_DEFAULT_TEXT); - } - - return SUCCEEDED(hCopy); -} - - -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode) -{ - if(NULL == pOEMDevmode) - { - return FALSE; - } - - // ASSUMPTION: pOEMDevmode is large enough to contain OEMDEV structure. - - // Make sure that dmOEMExtra indicates the current OEMDEV structure. - pOEMDevmode->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevmode->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevmode->dmOEMExtra.dwVersion = OEM_VERSION; - - // bEnable should be either TRUE or FALSE. - if( (TRUE != pOEMDevmode->bEnabled) - && - (FALSE != pOEMDevmode->bEnabled) - ) - { - pOEMDevmode->bEnabled = WATER_MARK_DEFAULT_ENABLED; - } - - // dfRotate should be between 0 and 360 inclusive. - if( (0 > pOEMDevmode->dfRotate) - || - (360 < pOEMDevmode->dfRotate) - ) - { - pOEMDevmode->dfRotate = WATER_MARK_DEFAULT_ROTATION; - } - - // dwFontSize should be 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, or 72. - if(!IsValidFontSize(pOEMDevmode->dwFontSize)) - { - pOEMDevmode->dwFontSize = WATER_MARK_DEFAULT_FONTSIZE; - } - - // The high byte of the hi word should be zero. - if(0 != HIBYTE(HIWORD(pOEMDevmode->crTextColor))) - { - pOEMDevmode->crTextColor = WATER_MARK_DEFAULT_COLOR; - } - - // Make sure that water mark string is terminated. - pOEMDevmode->szWaterMark[WATER_MARK_TEXT_SIZE - 1] = L'\0'; - - return TRUE; -} - - -BOOL IsValidFontSize(DWORD dwFontSize) -{ - BOOL bValid = FALSE; - - - switch(dwFontSize) - { - case 8: - case 9: - case 10: - case 11: - case 12: - case 14: - case 16: - case 18: - case 20: - case 22: - case 24: - case 26: - case 28: - case 36: - case 48: - case 72: - bValid = TRUE; - break; - - default: - ERR(DLLTEXT("IsValidFontSize() found invalid font size\r\n")); - break; - } - - return bValid; -} - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/common/devmode.h b/print/OEM Printer Customization Plug-in Samples/C++/watermark/common/devmode.h deleted file mode 100644 index f9df1f26..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/common/devmode.h +++ /dev/null @@ -1,56 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.h -// -// -// PURPOSE: Define common data types, and external function prototypes -// for devmode functions. -// -#pragma once - -//////////////////////////////////////////////////////// -// OEM Devmode Defines -//////////////////////////////////////////////////////// - -#define WATER_MARK_TEXT_SIZE 128 -#define WATER_MARK_DEFAULT_ENABLED TRUE -#define WATER_MARK_DEFAULT_ROTATION 30 -#define WATER_MARK_DEFAULT_FONTSIZE 28 -#define WATER_MARK_DEFAULT_COLOR RGB(230, 230, 230) -#define WATER_MARK_DEFAULT_TEXT L"WaterMark" - - - -//////////////////////////////////////////////////////// -// OEM Devmode Type Definitions -//////////////////////////////////////////////////////// - -typedef struct tagOEMDEV -{ - OEM_DMEXTRAHEADER dmOEMExtra; - BOOL bEnabled; - DOUBLE dfRotate; - DWORD dwFontSize; - COLORREF crTextColor; - WCHAR szWaterMark[WATER_MARK_TEXT_SIZE]; - -} OEMDEV, *POEMDEV; - -typedef const OEMDEV *PCOEMDEV; - - - -///////////////////////////////////////////////////////// -// ProtoTypes -///////////////////////////////////////////////////////// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam); -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut); -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode); -BOOL IsValidFontSize(DWORD dwFontSize); - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/common/oem.h b/print/OEM Printer Customization Plug-in Samples/C++/watermark/common/oem.h deleted file mode 100644 index f9615579..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/common/oem.h +++ /dev/null @@ -1,24 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997- 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: oem.H -// -// -// PURPOSE: Define common data types, and external function prototypes -// for debug.cpp. -// - -#pragma once - - -//////////////////////////////////////////////////////// -// OEM Defines -//////////////////////////////////////////////////////// - -#define OEM_SIGNATURE 'MSFT' -#define OEM_VERSION 0x00000001L - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMARKPS.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMARKPS.vcxproj deleted file mode 100644 index 47a5db53..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMARKPS.vcxproj +++ /dev/null @@ -1,1090 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {4B90E6E4-34B2-460F-9BF7-D75B5334F2E5} - $(MSBuildProjectName) - Win10 Debug - Win32 - {37DC3583-1F5D-4DB4-A930-535E9C096174} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - WMARKPS - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - WMARKPS.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMARKPS.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMARKPS.vcxproj.Filters deleted file mode 100644 index 7e7da8cc..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMARKPS.vcxproj.Filters +++ /dev/null @@ -1,137 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {7E7CEB8F-7E3D-4FBB-AEBE-D62B0C9D9B2E} - - - h;hpp;hxx;hm;inl;inc;xsd - {88C3214E-2B6E-4482-A2B8-16CD0E6A9A3A} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {3A0703EF-8A1F-4955-8F7E-0765109DEBF0} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMarkPS.def b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMarkPS.def deleted file mode 100644 index fcfcd598..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMarkPS.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY WMARKPS -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMarkPS.rc b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMarkPS.rc deleted file mode 100644 index 9653478a..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/WMarkPS.rc +++ /dev/null @@ -1,130 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Neutral resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) -#ifdef _WIN32 -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// PSCRIPT -// - -IDR_WATERMARK_DRAW RC_PSCRIPT drawmark.ps -IDR_WATERMARK_PROLOGUE RC_PSCRIPT wmark.ps - -#endif // Neutral resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Written by Windows Printing & Imaging Team\0" - VALUE "CompanyName", "Microsoft Corp.\0" - VALUE "FileDescription", "OEM Customization Water Mark Sample\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "WMarkPS\0" - VALUE "LegalCopyright", "Copyright 1998-2003\0" - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation\0" - VALUE "OriginalFilename", "WMarkPS.DLL\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Microsoft WaterMark\0" - VALUE "ProductVersion", "1.0\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/command.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/command.cpp deleted file mode 100644 index e4758d1c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/command.cpp +++ /dev/null @@ -1,410 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: command.cpp -// -// PURPOSE: Source module for OEM customized Command(s). -// - -#include "precomp.h" -#include "wmarkps.h" -#include "debug.h" -#include "command.h" -#include "resource.h" - - - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -///////////////////////////////////////////////////////// -// Internal Macros & Defines -///////////////////////////////////////////////////////// - -// Macros to convert from Windows RGB to PostScript RGB -#define GetPS2Color(dw) ((dw) / 255.0) -#define GetPS2RValue(cr) (GetPS2Color(GetRValue(cr))) -#define GetPS2GValue(cr) (GetPS2Color(GetGValue(cr))) -#define GetPS2BValue(cr) (GetPS2Color(GetBValue(cr))) - - -// Initial buffer size -#define INITIAL_BUFFER_SIZE 16 - - -// String format defines characters -#define FORMAT_DELIM '!' -#define FORMAT_STRING_ANSI 's' -#define FORMAT_STRING_UNICODE 'S' -#define FORMAT_CHAR '%' - - -// Loop limiter. -#define MAX_LOOP 10 - - -///////////////////////////////////////////////////////// -// Internal ProtoTypes -///////////////////////////////////////////////////////// - -static PSTR GetPostScriptResource(HMODULE hModule, LPCTSTR pszResource, PDWORD pdwSize); -static PSTR CreateWaterMarkProlog(HMODULE hModule, PDWORD pdwSize, _In_ LPWSTR pszWaterMark, - DWORD dwFontSize, _In_ LPSTR pszColor, _In_ LPSTR pszAngle); -static PSTR DoWaterMarkProlog(HMODULE hModule, POEMDEV pOemDevmode, PDWORD pdwSize); -static DWORD FormatResource(_In_ LPSTR pszResource, _Out_ LPSTR *ppszProlog, ...); - - -//////////////////////////////////////////////////////////////////////////////////// -// The PSCRIPT driver calls this OEM function at specific points during output -// generation. This gives the OEM DLL an opportunity to insert code fragments -// at specific injection points in the driver's code. It should use -// DrvWriteSpoolBuf for generating any output it requires. - -HRESULT PSCommand(PDEVOBJ pdevobj, DWORD dwIndex, PVOID pData, DWORD cbSize, - IPrintOemDriverPS* pOEMHelp, PDWORD pdwReturn) -{ - BOOL bFreeProcedure = FALSE; - PSTR pProcedure = NULL; - DWORD dwLen = 0; - DWORD dwSize = 0; - HRESULT hResult = E_FAIL; - - VERBOSE(DLLTEXT("Entering OEMCommand...\r\n")); - - UNREFERENCED_PARAMETER(pData); - UNREFERENCED_PARAMETER(cbSize); - - switch (dwIndex) - { - case PSINJECT_BEGINPROLOG: - { - POEMDEV pOemDevmode = (POEMDEV) pdevobj->pOEMDM; - - - VERBOSE(DLLTEXT("OEMCommand PSINJECT_BEGINPROLOG\r\n")); - - // Only do Water Mark PS prolog injection if Water Mark is enabled. - if(pOemDevmode->bEnabled) - { - pProcedure = DoWaterMarkProlog((HMODULE) pdevobj->hOEM, pOemDevmode, &dwSize); - bFreeProcedure = (NULL != pProcedure); - } - } - break; - - case PSINJECT_BEGINPAGESETUP: - { - POEMDEV pOemDevmode = (POEMDEV) pdevobj->pOEMDM; - - - VERBOSE(DLLTEXT("OEMCommand PSINJECT_BEGINPAGESETUP\r\n")); - - // Only do Water Mark PS page injection if Water Mark is enabled. - if(pOemDevmode->bEnabled) - { - pProcedure = GetPostScriptResource((HMODULE) pdevobj->hOEM, MAKEINTRESOURCE(IDR_WATERMARK_DRAW), &dwSize); - } - } - break; - - default: - VERBOSE(DLLTEXT("PSCommand Default...\r\n")); - *pdwReturn = ERROR_NOT_SUPPORTED; - return E_NOTIMPL; - } - - if(NULL != pProcedure) - { - // Write PostScript to spool file. - dwLen = (DWORD)strlen(pProcedure); - if (dwLen > 0) - { - hResult = pOEMHelp->DrvWriteSpoolBuf(pdevobj, pProcedure, dwLen, &dwSize); - } - - // Set return values. - if(SUCCEEDED(hResult) && (dwLen == dwSize)) - { - *pdwReturn = ERROR_SUCCESS; - } - else - { - // Try to return meaningful - // error value. - *pdwReturn = GetLastError(); - if(ERROR_SUCCESS == *pdwReturn) - { - *pdwReturn = ERROR_WRITE_FAULT; - } - - // Make sure we return failure - // if the write didn't succeded. - if(SUCCEEDED(hResult)) - { - hResult = HRESULT_FROM_WIN32(*pdwReturn); - } - } - - if(bFreeProcedure) - { - // INVARIANT: pProcedure was created with 'new' and needs to be freed. - delete[] pProcedure; - } - } - else - { - // pProcedure will be NULL if water mark isn't enabled. - *pdwReturn = ERROR_NOT_SUPPORTED; - hResult = E_NOTIMPL; - } - - // dwLen should always equal dwSize. - ASSERT(dwLen == dwSize); - - return hResult; -} - - -//////////////////////////////////////////////////////////////////////////////////// -// -// Retrieves pointer to a PostScript resource. -// -static PSTR GetPostScriptResource(HMODULE hModule, LPCTSTR pszResource, PDWORD pdwSize) -{ - PSTR pszPostScript = NULL; - HRSRC hFind = NULL; - HGLOBAL hResource = NULL; - - - VERBOSE(DLLTEXT("GetPostScriptResource() entered.\r\n")); - - // pszResource and pdwSize Parameters should not be NULL. - assert(NULL != pszResource); - assert(NULL != pdwSize); - - // Load PostScript resource. - hFind = FindResource(hModule, pszResource, MAKEINTRESOURCE(RC_PSCRIPT)); - //hFind = FindResource(hModule, pszResource, TEXT("PSCRIPT")); - if(NULL != hFind) - { - hResource = LoadResource(hModule, hFind); - if(NULL != hResource) - { - pszPostScript = (PSTR) LockResource(hResource); - *pdwSize = SizeofResource(hModule, hFind); - } - else - { - ERR(DLLTEXT("ERROR: Failed to load PSCRIPT resource!\r\n")); - } - } - else - { - ERR(DLLTEXT("ERROR: Failed to find PSCRIPT resource!\r\n")); - } - - // Should have found the PScript resource. - ASSERT(NULL != pszPostScript); - - return pszPostScript; -} - - -//////////////////////////////////////////////////////////////////////////////////// -// -// Formats Water Mark prolog with parameter. -// -static PSTR CreateWaterMarkProlog(HMODULE hModule, PDWORD pdwSize, _In_ LPWSTR pszWaterMark, - DWORD dwFontSize, _In_ LPSTR pszColor, _In_ LPSTR pszAngle) -{ - PSTR pszProlog = NULL; - PSTR pszResource = NULL; - - // Parameters that are pointers should not be NULL! - if (NULL == pdwSize || - NULL == pszWaterMark || - NULL == pszColor || - NULL == pszAngle) - { - ERR(DLLTEXT("CreateWaterMarkProlog: Invalid argument\r\n")); - return NULL; - } - - // Get Water Mark prolog resource. - pszResource = GetPostScriptResource(hModule, MAKEINTRESOURCE(IDR_WATERMARK_PROLOGUE), pdwSize); - - // Allocate and format the Water Mark Prolog with the correct values. - if(NULL != pszResource) - { - *pdwSize = FormatResource(pszResource, &pszProlog, pszWaterMark, dwFontSize, pszColor, pszAngle); - } - else - { - ERR(DLLTEXT("CreateWaterMarkProlog: Failed to get resource\r\n")); - } - - return pszProlog; -} - - -//////////////////////////////////////////////////////////////////////////////////// -// -// Does the pre-formating of parameters before calling the routine -// that creates the prolog. -// -static PSTR DoWaterMarkProlog(HMODULE hModule, POEMDEV pOemDevmode, PDWORD pdwSize) -{ - PSTR pszProlog = NULL; - - // Parameters should not be NULL. - if (NULL == hModule || - NULL == pOemDevmode || - NULL == pdwSize) - { - ERR(DLLTEXT("CreateWaterMarkProlog: Invalid argument\r\n")); - return NULL; - } - - // Only do prolog if Water Mark is enabled. - if(pOemDevmode->bEnabled) - { - CHAR szColor[INITIAL_BUFFER_SIZE] = "\0"; - DWORD dwAngleSize = INITIAL_BUFFER_SIZE; - LPSTR pszAngle = NULL; - - // Format angle as a string. - do - { - if(NULL != pszAngle) - { - delete[] pszAngle; - dwAngleSize *= 2; - } - pszAngle = new CHAR[dwAngleSize]; - - } while( (NULL != pszAngle) - && - (dwAngleSize < 1024) - && - (FAILED(StringCbPrintfA(pszAngle, dwAngleSize, "%.1f", pOemDevmode->dfRotate)) ) - ); - - if(NULL != pszAngle) - { - // Format text color as string. - if(FAILED(StringCbPrintfA(szColor, sizeof(szColor), - "%1.2f %1.2f %1.2f", - GetPS2RValue(pOemDevmode->crTextColor), - GetPS2GValue(pOemDevmode->crTextColor), - GetPS2BValue(pOemDevmode->crTextColor)))) - { - ERR(DLLTEXT("DoWaterMarkProlog() failed to create PostScript color string for water mark.")); - } - - // Create Water Mark prolog. - pszProlog = CreateWaterMarkProlog(hModule, pdwSize, pOemDevmode->szWaterMark, - pOemDevmode->dwFontSize, szColor, pszAngle); - - // Angle string is no longer needed. - delete[] pszAngle; - } - } - - return pszProlog; -} - - -//////////////////////////////////////////////////////////////////////////////////// -// -// Formats Resource. -// -static DWORD FormatResource(_In_ LPSTR pszResource, _Out_ LPSTR *ppszBuffer, ...) -{ - DWORD dwSize = (DWORD)strlen(pszResource) + MAX_PATH; - DWORD dwLoop = 0; - va_list vaList; - HRESULT hResult = E_FAIL; - - - va_start(vaList, ppszBuffer); - - // *ppszBuffer should be NULL when passed in. - *ppszBuffer = NULL; - - // Allocate and format the string. - do { - - if(NULL != *ppszBuffer) - { - delete[] *ppszBuffer; - } - *ppszBuffer = new CHAR[dwSize]; - if(NULL == *ppszBuffer) - { - goto Cleanup; - } - - hResult = StringCbVPrintfA(*ppszBuffer, dwSize, pszResource, vaList); - - if(STRSAFE_E_INSUFFICIENT_BUFFER == hResult) - { - dwSize *= 2; - } - - } while ( FAILED(hResult) && (dwLoop++ < MAX_LOOP)); - -Cleanup: - - // Check to see if we hit error. - if(FAILED(hResult)) - { - if(NULL != *ppszBuffer) - { - delete[] *ppszBuffer; - *ppszBuffer = NULL; - } - } - - va_end(vaList); - - if(*ppszBuffer) - { - DWORD dwToReturn = 0; - - if(SUCCEEDED(SIZETToDWord(strlen(*ppszBuffer), &dwToReturn))) - { - return dwToReturn; - } - } - return 0; -} - - -DWORD CharSize(DWORD dwValue, DWORD dwBase) -{ - DWORD dwSize = 1; - - - // Make sure taht base is more than 2. - if(dwBase < 2) - { - return dwSize; - } - - // Loop until dwValue is less than dwBase, - // dividing by dwBase each time. - while(dwValue >= dwBase) - { - dwValue /= dwBase; - ++dwSize; - } - - return dwSize; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/command.h b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/command.h deleted file mode 100644 index 4b74bd77..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/command.h +++ /dev/null @@ -1,22 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Command.h -// -// -// PURPOSE: Define common data types, and external function prototypes -// for OEM Command function(s). -// -#pragma once - - -///////////////////////////////////////////////////////// -// ProtoTypes -///////////////////////////////////////////////////////// - -HRESULT PSCommand(PDEVOBJ, DWORD, PVOID, DWORD, IPrintOemDriverPS*, PDWORD pdwReturn); - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/dllentry.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/dllentry.cpp deleted file mode 100644 index 3aa73908..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/dllentry.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cpp -// -// -// PURPOSE: Source module for DLL entry function(s). -// -// - -#include "precomp.h" -#include "wmarkps.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -/////////////////////////////////////////////////////////// -// -// DLL entry point -// - -// DllMain isn't called/used for kernel mode version. -BOOL WINAPI DllMain(HINSTANCE hInst, WORD wReason, LPVOID lpReserved) -{ - UNREFERENCED_PARAMETER(hInst); - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - VERBOSE(DLLTEXT("Process attach.\r\n")); - break; - - case DLL_THREAD_ATTACH: - VERBOSE(DLLTEXT("Thread attach.\r\n")); - break; - - case DLL_PROCESS_DETACH: - VERBOSE(DLLTEXT("Process detach.\r\n")); - break; - - case DLL_THREAD_DETACH: - VERBOSE(DLLTEXT("Thread detach.\r\n")); - break; - } - - return TRUE; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/drawmark.ps b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/drawmark.ps deleted file mode 100644 index 4e0fa74e..00000000 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/drawmark.ps and /dev/null differ diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/fdevmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/fdevmode.cpp deleted file mode 100644 index e7e2d472..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/fdevmode.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: fDevmode.cpp -// -// -// PURPOSE: Place holder file for devmode functions. -// - -#include "precomp.h" -#include "wmarkps.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -#include diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/intrface.cpp deleted file mode 100644 index 5e892275..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/intrface.cpp +++ /dev/null @@ -1,491 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.cpp -// -// -// PURPOSE: Interface for User Mode COM Customization DLL. -// -// -#pragma once - -#include "precomp.h" - -#include "wmarkps.h" -#include "debug.h" -#include "command.h" -#include "intrface.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -//////////////////////////////////////////////////////// -// Internal Globals -//////////////////////////////////////////////////////// - -static long g_cComponents = 0; // Count of active components -static long g_cServerLocks = 0; // Count of locks - - -//////////////////////////////////////////////////////////////////////////////// -// -// IWaterMarkPS body -// -IWaterMarkPS::~IWaterMarkPS() -{ - // Make sure that helper interface is released. - if(NULL != m_pOEMHelp) - { - m_pOEMHelp->Release(); - m_pOEMHelp = NULL; - } - - // If this instance of the object is being deleted, then the reference - // count should be zero. - assert(0 == m_cRef); -} - - -HRESULT __stdcall IWaterMarkPS::QueryInterface(const IID& iid, void** ppv) -{ - if (iid == IID_IUnknown) - { - *ppv = static_cast(this); - VERBOSE(DLLTEXT("IWaterMarkPS::QueryInterface IUnknown.\r\n")); - } - else if (iid == IID_IPrintOemPS) - { - *ppv = static_cast(this); - VERBOSE(DLLTEXT("IWaterMarkPS::QueryInterface IPrintOemPs.\r\n")); - } - else - { -#if DBG && defined(USERMODE_DRIVER) - TCHAR szOutput[80] = {0}; - StringFromGUID2(iid, szOutput, _countof(szOutput)); // can not fail! - VERBOSE(DLLTEXT("IWaterMarkPS::QueryInterface interface not supported.\r\n")); -#endif - *ppv = NULL; - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -ULONG __stdcall IWaterMarkPS::AddRef() -{ - VERBOSE(DLLTEXT("IWaterMarkPS::AddRef() entry.\r\n")); - return InterlockedIncrement(&m_cRef); -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IWaterMarkPS::Release() -{ - VERBOSE(DLLTEXT("IWaterMarkPS::Release() entry.\r\n")); - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - - -HRESULT __stdcall IWaterMarkPS::GetInfo ( - DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded) -{ - VERBOSE(DLLTEXT("IWaterMarkPS::GetInfo entry.\r\n")); - - // Validate parameters. - if( (NULL == pcbNeeded) - || - ( (OEMGI_GETSIGNATURE != dwMode) - && - (OEMGI_GETVERSION != dwMode) - && - (OEMGI_GETPUBLISHERINFO != dwMode) - ) - ) - { - VERBOSE(DLLTEXT("IWaterMarkPS::GetInfo() exit pcbNeeded is NULL! ERROR_INVALID_PARAMETER\r\n")); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Set expected buffer size. - if(OEMGI_GETPUBLISHERINFO != dwMode) - { - *pcbNeeded = sizeof(DWORD); - } - else - { - *pcbNeeded = sizeof(PUBLISHERINFO); - return E_FAIL; - } - - // Check buffer size is sufficient. - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - WARNING(DLLTEXT("IWaterMarkPS::GetInfo() exit insufficient buffer!\r\n")); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return E_FAIL; - } - - switch(dwMode) - { - // OEM DLL Signature - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // OEM DLL version - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // dwMode not supported. - case OEMGI_GETPUBLISHERINFO: - default: - // Set written bytes to zero since nothing was written. - WARNING(DLLTEXT("IWaterMarkPS::GetInfo() exit mode not supported.\r\n")); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - return E_FAIL; - } - - return S_OK; -} - -HRESULT __stdcall IWaterMarkPS::PublishDriverInterface( - IUnknown *pIUnknown) -{ - VERBOSE(DLLTEXT("IWaterMarkPS::PublishDriverInterface() entry.\r\n")); - - // Need to store pointer to Driver Helper functions, if we already haven't. - if (this->m_pOEMHelp == NULL) - { - HRESULT hResult; - - - // Get Interface to Helper Functions. - hResult = pIUnknown->QueryInterface(IID_IPrintOemDriverPS, (void** ) &(this->m_pOEMHelp)); - - if(!SUCCEEDED(hResult)) - { - // Make sure that interface pointer reflects interface query failure. - this->m_pOEMHelp = NULL; - - return E_FAIL; - } - } - - return S_OK; -} - - -HRESULT __stdcall IWaterMarkPS::EnableDriver(DWORD dwDriverVersion, - DWORD cbSize, - PDRVENABLEDATA pded) -{ - VERBOSE(DLLTEXT("IWaterMarkPS::EnableDriver() entry.\r\n")); - - UNREFERENCED_PARAMETER(dwDriverVersion); - UNREFERENCED_PARAMETER(cbSize); - UNREFERENCED_PARAMETER(pded); - - // Need to return S_OK so that DisableDriver() will be called, which Releases - // the reference to the Printer Driver's interface. - // If error occurs, return E_FAIL. - return S_OK; -} - -HRESULT __stdcall IWaterMarkPS::DisableDriver(VOID) -{ - VERBOSE(DLLTEXT("IWaterMarkPS::DisaleDriver() entry.\r\n")); - - // Release reference to Printer Driver's interface. - if (this->m_pOEMHelp) - { - this->m_pOEMHelp->Release(); - this->m_pOEMHelp = NULL; - } - - return S_OK; -} - -HRESULT __stdcall IWaterMarkPS::DisablePDEV( - PDEVOBJ pdevobj) -{ - VERBOSE(DLLTEXT("IWaterMarkPS::DisablePDEV() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobj); - - return E_NOTIMPL; -}; - -HRESULT __stdcall IWaterMarkPS::EnablePDEV( - PDEVOBJ pdevobj, - _In_ PWSTR pPrinterName, - ULONG cPatterns, - HSURF *phsurfPatterns, - ULONG cjGdiInfo, - GDIINFO *pGdiInfo, - ULONG cjDevInfo, - DEVINFO *pDevInfo, - DRVENABLEDATA *pded, - OUT PDEVOEM *pDevOem) -{ - VERBOSE(DLLTEXT("IWaterMarkPS::EnablePDEV() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(cPatterns); - UNREFERENCED_PARAMETER(phsurfPatterns); - UNREFERENCED_PARAMETER(cjGdiInfo); - UNREFERENCED_PARAMETER(pGdiInfo); - UNREFERENCED_PARAMETER(cjDevInfo); - UNREFERENCED_PARAMETER(pDevInfo); - UNREFERENCED_PARAMETER(pded); - UNREFERENCED_PARAMETER(pDevOem); - - return E_NOTIMPL; -} - - -HRESULT __stdcall IWaterMarkPS::ResetPDEV( - PDEVOBJ pdevobjOld, - PDEVOBJ pdevobjNew) -{ - VERBOSE(DLLTEXT("IWaterMarkPS::ResetPDEV() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobjOld); - UNREFERENCED_PARAMETER(pdevobjNew); - - return E_NOTIMPL; -} - -HRESULT __stdcall IWaterMarkPS::DevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam) -{ - VERBOSE(DLLTEXT("IWaterMarkPS:DevMode entry.\n")); - return hrOEMDevMode(dwMode, pOemDMParam); -} - -HRESULT __stdcall IWaterMarkPS::Command( - PDEVOBJ pdevobj, - DWORD dwIndex, - PVOID pData, - DWORD cbSize, - OUT DWORD *pdwResult) -{ - HRESULT hResult = E_NOTIMPL; - - - VERBOSE(DLLTEXT("IWaterMarkPS::Command() entry.\r\n")); - hResult = PSCommand(pdevobj, dwIndex, pData, cbSize, m_pOEMHelp, pdwResult); - - return hResult; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// oem class factory -// -class IOemCF : public IClassFactory -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // *** IClassFactory methods *** - STDMETHOD(CreateInstance) (THIS_ - LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID FAR* ppvObject); - STDMETHOD(LockServer) (THIS_ BOOL bLock); - - - // Constructor - IOemCF(): m_cRef(1) { }; - ~IOemCF() { }; - -protected: - LONG m_cRef; - -}; - -/////////////////////////////////////////////////////////// -// -// Class factory body -// -HRESULT __stdcall IOemCF::QueryInterface(const IID& iid, void** ppv) -{ - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this); - } - else - { - VERBOSE(DLLTEXT("IOemCF::QueryInterface interface not supported.\r\n")); - *ppv = NULL; - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -ULONG __stdcall IOemCF::AddRef() -{ - return InterlockedIncrement(&m_cRef); -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemCF::Release() -{ - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -// IClassFactory implementation -HRESULT __stdcall IOemCF::CreateInstance(IUnknown* pUnknownOuter, - const IID& iid, - void** ppv) -{ - //VERBOSE(DLLTEXT("Class factory:\t\tCreate component.")); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Cannot aggregate. - if (pUnknownOuter != NULL) - { - return CLASS_E_NOAGGREGATION; - } - - // Create component. - IWaterMarkPS* pOemCP = new IWaterMarkPS; - if (pOemCP == NULL) - { - return E_OUTOFMEMORY; - } - - // Get the requested interface. - HRESULT hr = pOemCP->QueryInterface(iid, ppv); - - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - pOemCP->Release(); - return hr; -} - -// LockServer -HRESULT __stdcall IOemCF::LockServer(BOOL bLock) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks); - } - else - { - InterlockedDecrement(&g_cServerLocks); - } - return S_OK; -} - - -// -// Registration functions -// - -// -// Can DLL unload now? -// -STDAPI DllCanUnloadNow() -{ - // - // To avoid leaving OEM DLL still in memory when Unidrv or Pscript drivers - // are unloaded, Unidrv and Pscript driver ignore the return value of - // DllCanUnloadNow of the OEM DLL, and always call FreeLibrary on the OEMDLL. - // - // If OEM DLL spins off a working thread that also uses the OEM DLL, the - // thread needs to call LoadLibrary and FreeLibraryAndExitThread, otherwise - // it may crash after Unidrv or Pscript calls FreeLibrary. - // - - VERBOSE(DLLTEXT("DllCanUnloadNow entered.\r\n")); - - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK; - } - else - { - return S_FALSE; - } -} - -// -// Get class factory -// -STDAPI DllGetClassObject( - _In_ REFCLSID clsid, - _In_ REFIID iid, - _Outptr_ LPVOID* ppv) -{ - VERBOSE(DLLTEXT("DllGetClassObject:\tCreate class factory.\r\n")); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Can we create this component? - if (clsid != CLSID_OEMRENDER) - { - return CLASS_E_CLASSNOTAVAILABLE; - } - - // Create class factory. - IOemCF* pFontCF = new IOemCF; // Reference count set to 1 - // in constructor - if (pFontCF == NULL) - { - return E_OUTOFMEMORY; - } - - // Get requested interface. - HRESULT hr = pFontCF->QueryInterface(iid, ppv); - pFontCF->Release(); - - return hr; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/intrface.h deleted file mode 100644 index 7a4a3c84..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/intrface.h +++ /dev/null @@ -1,116 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.H -// -// -// PURPOSE: Define COM interface for User Mode Printer Customization DLL. -// -#pragma once - -//////////////////////////////////////////////////////////////////////////////// -// -// IWaterMarkPS -// -// Interface for PostScript OEM sample rendering module -// -class IWaterMarkPS : public IPrintOemPS -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Method for OEM to specify DDI hook out - // - - STDMETHOD(EnableDriver) (THIS_ DWORD DriverVersion, - DWORD cbSize, - PDRVENABLEDATA pded); - - // - // Method to notify OEM plugin that it is no longer required - // - - STDMETHOD(DisableDriver) (THIS); - - // - // Method for OEM to contruct its own PDEV - // - - STDMETHOD(EnablePDEV) (THIS_ PDEVOBJ pdevobj, - _In_ PWSTR pPrinterName, - ULONG cPatterns, - HSURF *phsurfPatterns, - ULONG cjGdiInfo, - GDIINFO *pGdiInfo, - ULONG cjDevInfo, - DEVINFO *pDevInfo, - DRVENABLEDATA *pded, - OUT PDEVOEM *pDevOem); - - // - // Method for OEM to free any resource associated with its PDEV - // - - STDMETHOD(DisablePDEV) (THIS_ PDEVOBJ pdevobj); - - // - // Method for OEM to transfer from old PDEV to new PDEV - // - - STDMETHOD(ResetPDEV) (THIS_ PDEVOBJ pdevobjOld, - PDEVOBJ pdevobjNew); - - - // - // Get OEM dll related information - // - - STDMETHOD(GetInfo) (THIS_ DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded); - // - // OEMDevMode - // - - STDMETHOD(DevMode) (THIS_ DWORD dwMode, - POEMDMPARAM pOemDMParam); - - // - // OEMCommand - PSCRIPT only, return E_NOTIMPL on Unidrv - // - - STDMETHOD(Command) (THIS_ PDEVOBJ pdevobj, - DWORD dwIndex, - PVOID pData, - DWORD cbSize, - OUT DWORD *pdwResult); - - // - - IWaterMarkPS() { m_cRef = 1; m_pOEMHelp = NULL; }; - ~IWaterMarkPS(); - -protected: - LONG m_cRef; - IPrintOemDriverPS* m_pOEMHelp; -}; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/precomp.h deleted file mode 100644 index 1c44a730..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/precomp.h +++ /dev/null @@ -1,51 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: precomp.h -// -// PURPOSE: Header files that should be in the precompiled header. - -#pragma once - -// Necessary for compiling under VC. -#if(!defined(WINVER) || (WINVER < 0x0500)) - #undef WINVER - #define WINVER 0x0500 -#endif -#if(!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)) - #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0500 -#endif - - -// Required header files that shouldn't change often. - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Safe integer functions to detect integer overflow/underflow conditions: -#include - -// StrSafe.h needs to be included last -// to disallow unsafe string functions. -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/resource.h b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/resource.h deleted file mode 100644 index 819dbd98..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/resource.h +++ /dev/null @@ -1,18 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by WMarkPS.rc -// -#define IDR_WATERMARK_PROLOGUE 1 -#define IDR_WATERMARK_DRAW 2 -#define RC_PSCRIPT 0x5053 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 105 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 102 -#endif -#endif diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/wmark.ps b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/wmark.ps deleted file mode 100644 index e9200e65..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/wmark.ps +++ /dev/null @@ -1,33 +0,0 @@ -userdict /DrawWaterMark { -userdict begin -/Watermark (%ls) def -/FontSize %d def -/Font /Helvetica def -/WaterMarkColor {%s setrgbcolor} bind def -/Angle %s def - -gsave -initgraphics - -Angle rotate - -clippath -pathbbox /MaxY exch def /MaxX exch def /MinY exch def /MinX exch def - -Font findfont FontSize scalefont setfont -/MarkLen Watermark stringwidth pop 1.20 mul def -WaterMarkColor - -MinY FontSize MaxY -{ - MinX MarkLen MaxX - { - 1 index moveto Watermark show - } for - pop -} bind for -grestore -end -} bind put - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/wmarkps.h b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/wmarkps.h deleted file mode 100644 index d16c6581..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkps/wmarkps.h +++ /dev/null @@ -1,25 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: WMarkPS.H -// -// PURPOSE: Define common data types, and external function prototypes -// for debug.cpp. -// -#pragma once - -#include -#include - - -//////////////////////////////////////////////////////// -// OEM Defines -//////////////////////////////////////////////////////// - -#define DLLTEXT(s) "WMARKPS: " s - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/WMARKUI.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/WMARKUI.vcxproj deleted file mode 100644 index 323f5446..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/WMARKUI.vcxproj +++ /dev/null @@ -1,1096 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {BE3E261C-4EF8-4BC2-AAD2-49F1292512CE} - $(MSBuildProjectName) - Win10 Debug - Win32 - {975265B8-77E8-4C62-AD5A-C554605BE6DF} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - WMARKUI - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - WMARKUI.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/WMARKUI.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/WMARKUI.vcxproj.Filters deleted file mode 100644 index d5115804..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/WMARKUI.vcxproj.Filters +++ /dev/null @@ -1,140 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {0B03BE39-8181-4B6F-B5BE-004CA8F13B55} - - - h;hpp;hxx;hm;inl;inc;xsd - {F94EBF1D-EB81-461D-9960-95F6ABDC92C2} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {43EA5B9C-BE86-4C59-BE80-7DAF38D33EEE} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/dllentry.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/dllentry.cpp deleted file mode 100644 index ae16c921..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/dllentry.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cpp -// -// -// PURPOSE: Source module for DLL entry function(s). -// - - -#include "precomp.h" -#include "wmarkui.h" -#include "debug.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////////////////////////// -// -// DLL entry point -// -BOOL WINAPI DllMain(HINSTANCE hInst, WORD wReason, LPVOID lpReserved) -{ - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - VERBOSE(DLLTEXT("Process attach.\r\n")); - ghInstance = hInst; - break; - - case DLL_THREAD_ATTACH: - VERBOSE(DLLTEXT("Thread attach.\r\n")); - break; - - case DLL_PROCESS_DETACH: - VERBOSE(DLLTEXT("Process detach.\r\n")); - break; - - case DLL_THREAD_DETACH: - VERBOSE(DLLTEXT("Thread detach.\r\n")); - break; - } - - return TRUE; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/fdevmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/fdevmode.cpp deleted file mode 100644 index bc8d4b6e..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/fdevmode.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: fDevmode.cpp -// -// -// PURPOSE: Place holder file for devmode functions. -// - - -#include "precomp.h" -#include "wmarkui.h" - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -#include diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/globals.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/globals.cpp deleted file mode 100644 index 39f8e57a..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/globals.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Globals.cpp -// -// -// PURPOSE: File that contains all the globals. -// - -#pragma once -#include "precomp.h" -#include "wmarkui.h" - - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -// Module's Instance handle from DLLEntry of process. -HINSTANCE ghInstance = NULL; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/globals.h b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/globals.h deleted file mode 100644 index 5472f514..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/globals.h +++ /dev/null @@ -1,22 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Globals.h -// -// -// PURPOSE: Lists of globals declared in Globals.cpp. -// - -#pragma once - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -// Module's Instance handle from DLLEntry of process. -extern HINSTANCE ghInstance; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/intrface.cpp deleted file mode 100644 index d610f46d..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/intrface.cpp +++ /dev/null @@ -1,522 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: intrface.cpp -// -// PURPOSE: Implement the UI interface plug-in -// - -#include "precomp.h" - -#include "wmarkui.h" -#include "debug.h" -#include "intrface.h" - - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// Internal Globals -//////////////////////////////////////////////////////// - -static long g_cComponents = 0 ; // Count of active components -static long g_cServerLocks = 0 ; // Count of locks - - - -//////////////////////////////////////////////////////////////////////////////// -// -// IWaterMarkUI body -// -HRESULT __stdcall IWaterMarkUI::QueryInterface(const IID& iid, void** ppv) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:QueryInterface entry.\r\n\r\n")); - if (iid == IID_IUnknown) - { - *ppv = static_cast(this); - VERBOSE(DLLTEXT("IWaterMarkUI:Return pointer to IUnknown.\r\n\r\n")); - } - else if (iid == IID_IPrintOemUI) - { - *ppv = static_cast(this) ; - VERBOSE(DLLTEXT("IWaterMarkUI:Return pointer to IPrintOemUI.\r\n")); - } - else - { - VERBOSE(DLLTEXT("IWaterMarkUI::QueryInterface: interface not supported.\r\n")); - *ppv = NULL ; - return E_NOINTERFACE ; - } - reinterpret_cast(*ppv)->AddRef() ; - return S_OK ; -} - -ULONG __stdcall IWaterMarkUI::AddRef() -{ - VERBOSE(DLLTEXT("IWaterMarkUI:AddRef entry.\r\n")); - return InterlockedIncrement(&m_cRef) ; -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IWaterMarkUI::Release() -{ - VERBOSE(DLLTEXT("IWaterMarkUI:Release entry.\r\n")); - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -HRESULT __stdcall IWaterMarkUI::PublishDriverInterface( - IUnknown *pIUnknown) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:PublishDriverInterface entry.\r\n")); - - UNREFERENCED_PARAMETER(pIUnknown); - - // Don't use the DriverInterface, so don't store it. - - return S_OK; -} - -HRESULT __stdcall IWaterMarkUI::GetInfo( - DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded) -{ - VERBOSE(DLLTEXT("IWaterMarkUI::GetInfo entry.\r\r\n")); - - // Validate parameters. - if( (NULL == pcbNeeded) - || - ( (OEMGI_GETSIGNATURE != dwMode) - && - (OEMGI_GETVERSION != dwMode) - && - (OEMGI_GETPUBLISHERINFO != dwMode) - ) - ) - { - VERBOSE(DLLTEXT("IWaterMarkUI::GetInfo() exit pcbNeeded is NULL!\r\r\n")); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Set expected buffer size and number of bytes written. - *pcbNeeded = sizeof(DWORD); - - // Check buffer size is sufficient. - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - WARNING(DLLTEXT("IWaterMarkUI::GetInfo() exit insufficient buffer!\r\r\n")); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return E_FAIL; - } - - switch(dwMode) - { - // OEM DLL Signature - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // OEM DLL version - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // dwMode not supported. - default: - // Set written bytes to zero since nothing was written. - WARNING(DLLTEXT("IWaterMarkUI::GetInfo() exit mode not supported.\r\r\n")); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - return E_FAIL; - } - - VERBOSE(DLLTEXT("IWaterMarkUI::GetInfo() exit S_OK.\r\r\n")); - return S_OK; -} - -HRESULT __stdcall IWaterMarkUI::DevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:DevMode entry.\r\n")); - - return hrOEMDevMode(dwMode, pOemDMParam); -} - -HRESULT __stdcall IWaterMarkUI::CommonUIProp( - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:CommonUIProp entry.\r\n")); - - return hrOEMPropertyPage(dwMode, pOemCUIPParam); -} - - -HRESULT __stdcall IWaterMarkUI::DocumentPropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:DocumentPropertySheets entry.\r\n")); - - UNREFERENCED_PARAMETER(pPSUIInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - -HRESULT __stdcall IWaterMarkUI::DevicePropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:DevicePropertySheets entry.\r\n")); - - UNREFERENCED_PARAMETER(pPSUIInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - -HRESULT __stdcall IWaterMarkUI::DeviceCapabilities( - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:DeviceCapabilities entry.\r\n")); - - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(pDeviceName); - UNREFERENCED_PARAMETER(wCapability); - UNREFERENCED_PARAMETER(pOutput); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - UNREFERENCED_PARAMETER(dwOld); - UNREFERENCED_PARAMETER(dwResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall IWaterMarkUI::DevQueryPrintEx( - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:DevQueryPrintEx entry.\r\n")); - - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pDQPInfo); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - - return E_NOTIMPL; -} - -HRESULT __stdcall IWaterMarkUI::UpgradePrinter( - DWORD dwLevel, - PBYTE pDriverUpgradeInfo) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:UpgradePrinter entry.\r\n")); - - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverUpgradeInfo); - - return E_NOTIMPL; -} - -HRESULT __stdcall IWaterMarkUI::PrinterEvent( - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:PrinterEvent entry.\r\n")); - - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(iDriverEvent); - UNREFERENCED_PARAMETER(dwFlags); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - -HRESULT __stdcall IWaterMarkUI::DriverEvent( - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:DriverEvent entry.\r\n")); - - UNREFERENCED_PARAMETER(dwDriverEvent); - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - - -HRESULT __stdcall IWaterMarkUI::QueryColorProfile( - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulQueryMode, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:QueryColorProfile entry.\r\n")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - UNREFERENCED_PARAMETER(ulQueryMode); - UNREFERENCED_PARAMETER(pvProfileData); - UNREFERENCED_PARAMETER(pcbProfileData); - UNREFERENCED_PARAMETER(pflProfileData); - - return E_NOTIMPL; -}; - -HRESULT __stdcall IWaterMarkUI::FontInstallerDlgProc( - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:FontInstallerDlgProc entry.\r\n")); - - UNREFERENCED_PARAMETER(hWnd); - UNREFERENCED_PARAMETER(usMsg); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - -HRESULT __stdcall IWaterMarkUI::UpdateExternalFonts( - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:UpdateExternalFonts entry.\r\n")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(hHeap); - UNREFERENCED_PARAMETER(pwstrCartridges); - - return E_NOTIMPL; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// oem class factory -// -class IOemCF : public IClassFactory -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // *** IClassFactory methods *** - STDMETHOD(CreateInstance) (THIS_ - LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID FAR* ppvObject); - STDMETHOD(LockServer) (THIS_ BOOL bLock); - - - // Constructor - IOemCF(): m_cRef(1) { }; - ~IOemCF() { }; - -protected: - LONG m_cRef; - -}; - -/////////////////////////////////////////////////////////// -// -// Class factory body -// -HRESULT __stdcall IOemCF::QueryInterface(const IID& iid, void** ppv) -{ - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this) ; - } - else - { - WARNING(DLLTEXT("IOemCF::QueryInterface: interface not supported.\r\n")); - *ppv = NULL ; - return E_NOINTERFACE ; - } - reinterpret_cast(*ppv)->AddRef() ; - return S_OK ; -} - -ULONG __stdcall IOemCF::AddRef() -{ - return InterlockedIncrement(&m_cRef) ; -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemCF::Release() -{ - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -// IClassFactory implementation -HRESULT __stdcall IOemCF::CreateInstance(IUnknown* pUnknownOuter, - const IID& iid, - void** ppv) -{ - //DbgPrint(DLLTEXT("Class factory:\t\tCreate component.")) ; - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Cannot aggregate. - if (pUnknownOuter != NULL) - { - return CLASS_E_NOAGGREGATION ; - } - - // Create component. - IWaterMarkUI* pOemCB = new IWaterMarkUI ; - if (pOemCB == NULL) - { - return E_OUTOFMEMORY ; - } - // Get the requested interface. - HRESULT hr = pOemCB->QueryInterface(iid, ppv) ; - - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - pOemCB->Release() ; - return hr ; -} - -// LockServer -HRESULT __stdcall IOemCF::LockServer(BOOL bLock) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks) ; - } - else - { - InterlockedDecrement(&g_cServerLocks) ; - } - return S_OK ; -} - -/////////////////////////////////////////////////////////// -// -// Exported functions -// - - -// Can DLL unload now? -// -STDAPI DllCanUnloadNow() -{ - // - // To avoid leaving OEM DLL still in memory when Unidrv or Pscript drivers - // are unloaded, Unidrv and Pscript driver ignore the return value of - // DllCanUnloadNow of the OEM DLL, and always call FreeLibrary on the OEMDLL. - // - // If OEM DLL spins off a working thread that also uses the OEM DLL, the - // thread needs to call LoadLibrary and FreeLibraryAndExitThread, otherwise - // it may crash after Unidrv or Pscript calls FreeLibrary. - // - - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK ; - } - else - { - return S_FALSE; - } -} - -// -// Get class factory -// -STDAPI DllGetClassObject( - _In_ REFCLSID clsid, - _In_ REFIID iid, - _Outptr_ LPVOID* ppv) -{ - VERBOSE(DLLTEXT("DllGetClassObject:Create class factory.\r\n")); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Can we create this component? - if (clsid != CLSID_OEMUI) - { - return CLASS_E_CLASSNOTAVAILABLE ; - } - - // Create class factory. - IOemCF* pFontCF = new IOemCF ; // Reference count set to 1 - // in constructor - if (pFontCF == NULL) - { - return E_OUTOFMEMORY ; - } - - // Get requested interface. - HRESULT hr = pFontCF->QueryInterface(iid, ppv) ; - pFontCF->Release() ; - - return hr ; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/intrface.h deleted file mode 100644 index cccfce7d..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/intrface.h +++ /dev/null @@ -1,177 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: intrface.H -// -// PURPOSE: Define the UI interface plug-in -// -#pragma once - -//////////////////////////////////////////////////////////////////////////////// -// -// IWaterMarkUI -// -class IWaterMarkUI: public IPrintOemUI -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Get OEM dll related information - // - - STDMETHOD(GetInfo) (THIS_ DWORD dwMode, PVOID pBuffer, DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDevMode - // - - STDMETHOD(DevMode) (THIS_ DWORD dwMode, POEMDMPARAM pOemDMParam) ; - - // - // OEMCommonUIProp - // - - STDMETHOD(CommonUIProp) (THIS_ - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam - ); - - // - // OEMDocumentPropertySheets - // - - STDMETHOD(DocumentPropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - // - // OEMDevicePropertySheets - // - - STDMETHOD(DevicePropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - - // - // OEMDevQueryPrintEx - // - - STDMETHOD(DevQueryPrintEx) (THIS_ - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM - ); - - // - // OEMDeviceCapabilities - // - - STDMETHOD(DeviceCapabilities) (THIS_ - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult - ); - - // - // OEMUpgradePrinter - // - - STDMETHOD(UpgradePrinter) (THIS_ - DWORD dwLevel, - PBYTE pDriverUpgradeInfo - ); - - // - // OEMPrinterEvent - // - - STDMETHOD(PrinterEvent) (THIS_ - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam - ); - - // - // OEMDriverEvent - // - - STDMETHOD(DriverEvent)(THIS_ - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam - ); - - // - // OEMQueryColorProfile - // - - STDMETHOD(QueryColorProfile) (THIS_ - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulReserved, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData); - - // - // OEMFontInstallerDlgProc - // - - STDMETHOD(FontInstallerDlgProc) (THIS_ - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam - ); - // - // UpdateExternalFonts - // - - STDMETHOD(UpdateExternalFonts) (THIS_ - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges - ); - - - IWaterMarkUI() { m_cRef = 1; }; - ~IWaterMarkUI() { }; - -protected: - LONG m_cRef; -}; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/precomp.h deleted file mode 100644 index e861cd21..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/precomp.h +++ /dev/null @@ -1,50 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: precomp.h -// -// PURPOSE: Header files that should be in the precompiled header. - -#pragma once - -// Necessary for compiling under VC. -#if(!defined(WINVER) || (WINVER < 0x0500)) - #undef WINVER - #define WINVER 0x0500 -#endif -#if(!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)) - #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0500 -#endif - -// Required header files that shouldn't change often. - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "WINDDIUI.H" -#include -#include -#include - -// StrSafe.h needs to be included last -// to disallow unsafe string functions. -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/resource.h b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/resource.h deleted file mode 100644 index 5993d40c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/resource.h +++ /dev/null @@ -1,24 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by wmarkui.rc -// -#define IDS_WATERMARK 1 -#define IDS_TEXT 2 -#define IDS_FONTSIZE 3 -#define IDS_ANGLE 4 -#define IDS_COLOR 5 -#define IDS_GRAY 6 -#define IDS_RED 7 -#define IDS_GREEN 8 -#define IDS_BLUE 9 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.cpp deleted file mode 100644 index c09e47c6..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.cpp +++ /dev/null @@ -1,590 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: WMarkUI.cpp -// -// -// PURPOSE: Main file for OEM UI test module. -// -// - -#include "precomp.h" -#include "resource.h" -#include "debug.h" -#include "wmarkui.h" - - -// This indicates to Prefast that this is a usermode driver file. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -//////////////////////////////////////////////////////// -// INTERNAL MACROS and DEFINES -//////////////////////////////////////////////////////// - - - -//////////////////////////////////////////////////////// -// INTERNAL PROTOTYPES -//////////////////////////////////////////////////////// - -LONG APIENTRY OEMUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam); -static HRESULT hrDocumentPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -static void InitOptItems(POPTITEM pOptItems, DWORD dwOptItems); -static POPTTYPE CreateOptType(HANDLE hHeap, WORD wOptParams); -static DWORD FontSizeToIndex(DWORD dwFontSize); -static DWORD FontIndexToSize(DWORD dwIndex); -static DWORD TextColorToIndex(COLORREF crTextColor); -static COLORREF IndexToTextColor(DWORD dwIndex); -static PTSTR GetStringResource(HANDLE hHeap, HMODULE hModule, UINT uResource); - - - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM device or document property UI. -// -HRESULT hrOEMPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - HRESULT hResult = S_OK; - - - VERBOSE(DLLTEXT("hrOEMPropertyPage entry.\r\n")); - - // Validate parameters. - if( (OEMCUIP_DOCPROP != dwMode) - && - (OEMCUIP_PRNPROP != dwMode) - ) - { - ERR(DLLTEXT("hrOEMPropertyPage() ERROR_INVALID_PARAMETER.\r\n")); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - switch(dwMode) - { - case OEMCUIP_DOCPROP: - hResult = hrDocumentPropertyPage(dwMode, pOEMUIParam); - break; - - case OEMCUIP_PRNPROP: - // Don't have any Printer Proptery UI. - hResult = E_NOTIMPL; - break; - - default: - // Should never reach this! - ERR(DLLTEXT("hrOEMPropertyPage() Invalid dwMode")); - SetLastError(ERROR_INVALID_PARAMETER); - hResult = E_FAIL; - break; - } - - return hResult; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// OptItems call back for OEM device or document property UI. -// -LONG APIENTRY OEMUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - - - VERBOSE(DLLTEXT("OEMUICallBack() entry.\r\n")); - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - // Store OptItems state in DEVMODE. - pOEMDev->bEnabled = !pOEMUIParam->pOEMOptItems[0].Sel; - if(FAILED(StringCbCopyW(pOEMDev->szWaterMark, sizeof(pOEMDev->szWaterMark), (LPWSTR)pOEMUIParam->pOEMOptItems[1].pSel))) - { - ERR(DLLTEXT("OEMUICallBack() failed to copy water mark text\r\n")); - } - pOEMDev->dwFontSize = FontIndexToSize(pOEMUIParam->pOEMOptItems[2].Sel); - pOEMDev->dfRotate = (DOUBLE) pOEMUIParam->pOEMOptItems[3].Sel; - pOEMDev->crTextColor = IndexToTextColor(pOEMUIParam->pOEMOptItems[4].Sel); - break; - - default: - break; - } - - return lReturn; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM document property UI. -// -static HRESULT hrDocumentPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - if(NULL == pOEMUIParam->pOEMOptItems) - { - // Fill in the number of OptItems to create for OEM document property UI. - pOEMUIParam->cOEMOptItems = 5; - - VERBOSE(DLLTEXT("hrDocumentPropertyPage() requesting items.\r\n")); - } - else if(dwMode == OEMCUIP_DOCPROP) - { - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - - - VERBOSE(DLLTEXT("hrDocumentPropertyPage() fill out items.\r\n")); - - // Init UI Callback reference. - pOEMUIParam->OEMCUIPCallback = OEMUICallBack; - - // Init OEMOptItmes. - InitOptItems(pOEMUIParam->pOEMOptItems, pOEMUIParam->cOEMOptItems); - - // Fill out tree view items. - - // Water Mark Section Name. - pOEMUIParam->pOEMOptItems[0].Level = 1; - pOEMUIParam->pOEMOptItems[0].Flags = OPTIF_COLLAPSE; - pOEMUIParam->pOEMOptItems[0].pName = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_WATERMARK); - pOEMUIParam->pOEMOptItems[0].Sel = pOEMDev->bEnabled ? 0 : 1; - - pOEMUIParam->pOEMOptItems[0].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 2); - - pOEMUIParam->pOEMOptItems[0].pOptType->Type = TVOT_COMBOBOX; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[0].pData = L"Enabled"; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[0].IconID = IDI_CPSUI_ON; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].pData = L"Disabled"; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].IconID = IDI_CPSUI_OFF; - - - // WaterMark Text. - pOEMUIParam->pOEMOptItems[1].Level = 2; - pOEMUIParam->pOEMOptItems[1].Flags = 0; - pOEMUIParam->pOEMOptItems[1].pName = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_TEXT); - pOEMUIParam->pOEMOptItems[1].pSel = (LPTSTR) HeapAlloc(pOEMUIParam->hOEMHeap, HEAP_ZERO_MEMORY, MAX_PATH * sizeof(WCHAR)); - if (pOEMUIParam->pOEMOptItems[1].pSel == NULL) - { - ERR(DLLTEXT("hrDocumentPropertyPage() failed to copy water mark text\r\n")); - return E_OUTOFMEMORY; - } - - if(FAILED(StringCbCopyW((LPWSTR)pOEMUIParam->pOEMOptItems[1].pSel, MAX_PATH * sizeof(WCHAR), pOEMDev->szWaterMark))) - { - ERR(DLLTEXT("hrDocumentPropertyPage() failed to copy water mark text\r\n")); - } - - pOEMUIParam->pOEMOptItems[1].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 2); - - pOEMUIParam->pOEMOptItems[1].pOptType->Type = TVOT_EDITBOX; - pOEMUIParam->pOEMOptItems[1].pOptType->pOptParam[1].IconID = sizeof(((POEMDEV)NULL)->szWaterMark)/sizeof(WCHAR); - - - // WaterMark Font Size. - pOEMUIParam->pOEMOptItems[2].Level = 2; - pOEMUIParam->pOEMOptItems[2].Flags = 0; - pOEMUIParam->pOEMOptItems[2].pName = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_FONTSIZE); - pOEMUIParam->pOEMOptItems[2].Sel = FontSizeToIndex(pOEMDev->dwFontSize); - - pOEMUIParam->pOEMOptItems[2].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 16); - - pOEMUIParam->pOEMOptItems[2].pOptType->Type = TVOT_COMBOBOX; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[0].pData = L"8"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[1].pData = L"9"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[2].pData = L"10"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[3].pData = L"11"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[4].pData = L"12"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[5].pData = L"14"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[6].pData = L"16"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[7].pData = L"18"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[8].pData = L"20"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[9].pData = L"22"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[10].pData = L"24"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[11].pData = L"26"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[12].pData = L"28"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[13].pData = L"36"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[14].pData = L"48"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[15].pData = L"72"; - - - // WaterMark Angle. - pOEMUIParam->pOEMOptItems[3].Level = 2; - pOEMUIParam->pOEMOptItems[3].Flags = 0; - pOEMUIParam->pOEMOptItems[3].pName = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_ANGLE); - pOEMUIParam->pOEMOptItems[3].Sel = (LONG) pOEMDev->dfRotate; - - pOEMUIParam->pOEMOptItems[3].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 2); - - pOEMUIParam->pOEMOptItems[3].pOptType->Type = TVOT_UDARROW; - pOEMUIParam->pOEMOptItems[3].pOptType->pOptParam[1].IconID = 0; - pOEMUIParam->pOEMOptItems[3].pOptType->pOptParam[1].lParam = 360; - - - // WaterMark Color. - pOEMUIParam->pOEMOptItems[4].Level = 2; - pOEMUIParam->pOEMOptItems[4].Flags = 0; - pOEMUIParam->pOEMOptItems[4].pName = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_COLOR); - pOEMUIParam->pOEMOptItems[4].Sel = TextColorToIndex(pOEMDev->crTextColor); - - pOEMUIParam->pOEMOptItems[4].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 4); - - pOEMUIParam->pOEMOptItems[4].pOptType->Type = TVOT_COMBOBOX; - pOEMUIParam->pOEMOptItems[4].pOptType->pOptParam[0].pData = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_GRAY); - pOEMUIParam->pOEMOptItems[4].pOptType->pOptParam[1].pData = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_RED); - pOEMUIParam->pOEMOptItems[4].pOptType->pOptParam[2].pData = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_GREEN); - pOEMUIParam->pOEMOptItems[4].pOptType->pOptParam[3].pData = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_BLUE); - } - - return S_OK; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems. -// -static void InitOptItems(POPTITEM pOptItems, DWORD dwOptItems) -{ - VERBOSE(DLLTEXT("InitOptItems() entry.\r\n")); - - // Zero out memory. - memset(pOptItems, 0, sizeof(OPTITEM) * dwOptItems); - - // Set each OptItem's size, and Public DM ID. - for(DWORD dwCount = 0; dwCount < dwOptItems; dwCount++) - { - pOptItems[dwCount].cbSize = sizeof(OPTITEM); - pOptItems[dwCount].DMPubID = DMPUB_NONE; - } -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Allocates and initializes OptType for OptItem. -// -static POPTTYPE CreateOptType(HANDLE hHeap, WORD wOptParams) -{ - POPTTYPE pOptType = NULL; - - - VERBOSE(DLLTEXT("CreateOptType() entry.\r\n")); - - // Allocate memory from the heap for the OPTTYPE; the driver will take care of clean up. - pOptType = (POPTTYPE) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(OPTTYPE)); - if(NULL != pOptType) - { - // Initialize OPTTYPE. - pOptType->cbSize = sizeof(OPTTYPE); - pOptType->Count = wOptParams; - - // Allocate memory from the heap for the OPTPARAMs for the OPTTYPE. - pOptType->pOptParam = (POPTPARAM) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, wOptParams * sizeof(OPTPARAM)); - if(NULL != pOptType->pOptParam) - { - // Initialize the OPTPARAMs. - for(WORD wCount = 0; wCount < wOptParams; wCount++) - { - pOptType->pOptParam[wCount].cbSize = sizeof(OPTPARAM); - } - } - else - { - ERR(DLLTEXT("CreateOptType() failed to allocated memory for OPTPARAMs!\r\n")); - - // Free allocated memory and return NULL. - HeapFree(hHeap, 0, pOptType); - pOptType = NULL; - } - } - else - { - ERR(DLLTEXT("CreateOptType() failed to allocated memory for OPTTYPE!\r\n")); - } - - return pOptType; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Converts Font point size to index in combo box. -// -static DWORD FontSizeToIndex(DWORD dwFontSize) -{ - DWORD dwIndex; - - - switch(dwFontSize) - { - case 8: - dwIndex = 0; - break; - - case 9: - dwIndex = 1; - break; - - case 10: - dwIndex = 2; - break; - - case 11: - dwIndex = 3; - break; - - case 12: - dwIndex = 4; - break; - - case 14: - dwIndex = 5; - break; - - case 16: - dwIndex = 6; - break; - - case 18: - dwIndex = 7; - break; - - case 20: - dwIndex = 8; - break; - - case 22: - dwIndex = 9; - break; - - case 24: - dwIndex = 10; - break; - - case 26: - dwIndex = 11; - break; - - default: - case 28: - dwIndex = 12; - break; - - case 36: - dwIndex = 13; - break; - - case 48: - dwIndex = 14; - break; - - case 72: - dwIndex = 15; - break; - } - - - return dwIndex; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Converts Font combo box index to font point size. -// -static DWORD FontIndexToSize(DWORD dwIndex) -{ - DWORD dwFontSize = 0; - - - switch(dwIndex) - { - case 0: - dwFontSize = 8; - break; - - case 1: - dwFontSize = 9; - break; - - case 2: - dwFontSize = 10; - break; - - case 3: - dwFontSize = 11; - break; - - case 4: - dwFontSize = 12; - break; - - case 5: - dwFontSize = 14; - break; - - case 6: - dwFontSize = 16; - break; - - case 7: - dwFontSize = 18; - break; - - case 8: - dwFontSize = 20; - break; - - case 9: - dwFontSize = 22; - break; - - case 10: - dwFontSize = 24; - break; - - case 11: - dwFontSize = 26; - break; - - case 12: - dwFontSize = 28; - break; - - case 13: - dwFontSize = 36; - break; - - case 14: - dwFontSize = 48; - break; - - case 15: - dwFontSize = 72; - break; - } - - return dwFontSize; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Converts text color to combo box index. -// -static DWORD TextColorToIndex(COLORREF crTextColor) -{ - DWORD dwIndex; - - - // The color is what ever color is dominate. If none are, then it is gray. - if( (GetRValue(crTextColor) > GetGValue(crTextColor)) - && - (GetGValue(crTextColor) >= GetBValue(crTextColor)) - ) - { - // Set index to red. - dwIndex = 1; - } - else if( (GetRValue(crTextColor) < GetGValue(crTextColor)) - && - (GetGValue(crTextColor) > GetBValue(crTextColor)) - ) - { - // Set index to green. - dwIndex = 2; - } - else if( (GetRValue(crTextColor) <= GetGValue(crTextColor)) - && - (GetGValue(crTextColor) < GetBValue(crTextColor)) - ) - { - // Set index to blue. - dwIndex = 3; - } - else - { - // Set index to gray. - dwIndex = 0; - } - - return dwIndex; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Converts text combo box index to text color. -// -static COLORREF IndexToTextColor(DWORD dwIndex) -{ - COLORREF crTextColor; - - // Map index to desired text color. - // We just support 4 colors in the UI: Red, Green, Blue, and gray. - // The rendering module is capable of using any color for the Water Mark Text. - switch(dwIndex) - { - case 1: - // Color is red. - crTextColor = RGB(255, 216, 216); - break; - - case 2: - // Color is green. - crTextColor = RGB(216, 255, 216); - break; - - case 3: - // Color is blue. - crTextColor = RGB(216, 216, 255); - break; - - default: - case 0: - // Color is gray. - crTextColor = WATER_MARK_DEFAULT_COLOR; - break; - } - - return crTextColor; -} - -//////////////////////////////////////////////////////////////////////////////////// -// -// Retrieves pointer to a String resource. -// -static PTSTR GetStringResource(HANDLE hHeap, HMODULE hModule, UINT uResource) -{ - int nResult; - DWORD dwSize = MAX_PATH; - PTSTR pszString = NULL; - - - VERBOSE(DLLTEXT("GetStringResource() entered.\r\n")); - - // Allocate buffer for string resource from heap; let the driver clean it up. - pszString = (PTSTR) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, dwSize * sizeof(TCHAR)); - if(NULL != pszString) - { - PTSTR pTemp; - - // Load string resource; resize after loading so as not to waste memory. - nResult = LoadString(hModule, uResource, pszString, dwSize); - pTemp = (PTSTR) HeapReAlloc(hHeap, HEAP_ZERO_MEMORY, pszString, (nResult + 1) * sizeof(TCHAR)); - if(NULL != pTemp) - { - pszString = pTemp; - } - } - else - { - ERR(DLLTEXT("GetStringResource() failed to allocate string buffer!\r\n")); - } - - return pszString; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.def b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.def deleted file mode 100644 index 8bea2782..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY WMARKUI -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.h b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.h deleted file mode 100644 index 909056be..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.h +++ /dev/null @@ -1,35 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: WMarkUI.H -// -// PURPOSE: Define common data types, and external function prototypes -// for WaterMark UI. -// -#pragma once - -#include -#include -#include "globals.h" - - -//////////////////////////////////////////////////////// -// OEM UI Defines -//////////////////////////////////////////////////////// - - -// OEM Signature and version. -#define PROP_TITLE L"WaterMark UI Page" -#define DLLTEXT(s) "WMARKUI: " s - -//////////////////////////////////////////////////////// -// Prototypes -//////////////////////////////////////////////////////// - -HRESULT hrOEMPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.rc b/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.rc deleted file mode 100644 index 3ac11d52..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermark/wmarkui/wmarkui.rc +++ /dev/null @@ -1,128 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Written by Windows Printing & Imaging Team\0" - VALUE "CompanyName", "Microsoft Corp.\0" - VALUE "FileDescription", "WaterMark UI\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "WMarkUI\0" - VALUE "LegalCopyright", "Copyright 1998-2003\0" - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation\0" - VALUE "OriginalFilename", "WMarkUI.dll\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Microsoft WaterMark\0" - VALUE "ProductVersion", "1.0\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_WATERMARK "Water Mark" - IDS_TEXT "Text" - IDS_FONTSIZE "Font Size" - IDS_ANGLE "Angle" - IDS_COLOR "Color" - IDS_GRAY "Gray" - IDS_RED "Red" - IDS_GREEN "Green" - IDS_BLUE "Blue" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/debug.h b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/debug.h deleted file mode 100644 index 0414569c..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/debug.h +++ /dev/null @@ -1,82 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Debug.H -// -// PURPOSE: Define common data types, and external function prototypes -// for debugging functions. Also defines the various debug macros. -// -// - -#pragma once - -///////////////////////////////////////////////////////// -// Macros -///////////////////////////////////////////////////////// -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// WARNING("App passed NULL pointer, ignoring...\n"); -// - -#define DBG_VERBOSE 0 -#define DBG_WARNING 1 -#define DBG_ERROR 2 -#define DBG_NONE 3 - -// VC and Build use different debug defines. -#if defined (DBG) || defined (_DEBUG) - - // __declspec(selectany) ensures that even if this is defined in multiple compilation - // modules, they will all resolve to the same symbol in the linked DLL - __declspec(selectany) INT giDebugLevel = 2; - - #define STRINGIZE(x) #x - #define QUOTE(x) STRINGIZE(x) - #define FILE_AND_LINE __FILE__ "@" QUOTE(__LINE__) - - #define VERBOSE(msg) { if(giDebugLevel <= DBG_VERBOSE) OutputDebugStringA( FILE_AND_LINE ": " msg); } - #define WARNING(msg) { if(giDebugLevel <= DBG_WARNING) OutputDebugStringA( FILE_AND_LINE ": Warning: " msg); } - #define ERR(msg) { if(giDebugLevel <= DBG_ERROR) OutputDebugStringA(FILE_AND_LINE ": Error:" msg); } - #define ASSERT(cond) { if (!(cond)) RIP("\n"); } - #define RIP(msg) { OutputDebugStringA(FILE_AND_LINE ": Error (not recoverable): " msg); DebugBreak(); } - -#else // !DBG - - #define VERBOSE(msg) - #define WARNING(msg) - #define ERR(msg) - #define ASSERT(cond) - #define RIP(msg) - -#endif - - - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/devmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/devmode.cpp deleted file mode 100644 index 328d6fb4..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/devmode.cpp +++ /dev/null @@ -1,216 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.cpp -// -// PURPOSE: Implementation of Devmode functions shared with OEM UI and OEM rendering modules. -// - -// This file is wrapped in fdebug.cpp in other parts of the watermark sample. -// The appropriate precompiled header should be included there. -// #include "precomp.h -#include "debug.h" -#include "devmode.h" - -// indicate to prefast that this is a user-mode component. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam) -{ - HRESULT hResult = S_OK; - POEMDEV pOEMDevIn = NULL; - POEMDEV pOEMDevOut = NULL; - - - // Verify parameters. - if( (NULL == pOemDMParam) - || - ( (OEMDM_SIZE != dwMode) - && - (OEMDM_DEFAULT != dwMode) - && - (OEMDM_CONVERT != dwMode) - && - (OEMDM_MERGE != dwMode) - ) - ) - { - ERR(DLLTEXT("DevMode() ERROR_INVALID_PARAMETER.\r\n")); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Cast generic (i.e. PVOID) to OEM private devomode pointer type. - pOEMDevIn = (POEMDEV) pOemDMParam->pOEMDMIn; - pOEMDevOut = (POEMDEV) pOemDMParam->pOEMDMOut; - - switch(dwMode) - { - case OEMDM_SIZE: - pOemDMParam->cbBufSize = sizeof(OEMDEV); - break; - - case OEMDM_DEFAULT: - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->bWmarkEnabled = WATER_MARK_DEFAULT_ENABLED; - pOEMDevOut->dwWmarkFontSize = WATER_MARK_DEFAULT_FONTSIZE; - pOEMDevOut->crWmarkTextColor = WATER_MARK_DEFAULT_COLOR; - hResult = StringCbCopyW(pOEMDevOut->szWaterMark, sizeof(pOEMDevOut->szWaterMark), WATER_MARK_DEFAULT_TEXT); - break; - - case OEMDM_CONVERT: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - break; - - case OEMDM_MERGE: - ConvertOEMDevmode(pOEMDevIn, pOEMDevOut); - MakeOEMDevmodeValid(pOEMDevOut); - break; - } - - return hResult; -} - - -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut) -{ - HRESULT hCopy = S_OK; - - - if( (NULL == pOEMDevIn) - || - (NULL == pOEMDevOut) - ) - { - ERR(DLLTEXT("ConvertOEMDevmode() invalid parameters.\r\n")); - return FALSE; - } - - // Check OEM Signature, if it doesn't match ours, - // then just assume DMIn is bad and use defaults. - if(pOEMDevIn->dmOEMExtra.dwSignature == pOEMDevOut->dmOEMExtra.dwSignature) - { - VERBOSE(DLLTEXT("Converting private OEM Devmode.\r\n")); - - // Set the devmode defaults so that anything the isn't copied over will - // be set to the default value. - pOEMDevOut->bWmarkEnabled = WATER_MARK_DEFAULT_ENABLED; - pOEMDevOut->dwWmarkFontSize = WATER_MARK_DEFAULT_FONTSIZE; - pOEMDevOut->crWmarkTextColor = WATER_MARK_DEFAULT_COLOR; - hCopy = StringCbCopyW(pOEMDevOut->szWaterMark, sizeof(pOEMDevOut->szWaterMark), WATER_MARK_DEFAULT_TEXT); - - // Copy the old structure in to the new using which ever size is the smaller. - // Devmode maybe from newer Devmode (not likely since there is only one), or - // Devmode maybe a newer Devmode, in which case it maybe larger, - // but the first part of the structure should be the same. - - // DESIGN ASSUMPTION: the private DEVMODE structure only gets added to; - // the fields that are in the DEVMODE never change only new fields get added to the end. - - memcpy(pOEMDevOut, pOEMDevIn, __min(pOEMDevOut->dmOEMExtra.dwSize, pOEMDevIn->dmOEMExtra.dwSize)); - - // Re-fill in the size and version fields to indicated - // that the DEVMODE is the current private DEVMODE version. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - } - else - { - WARNING(DLLTEXT("Unknown DEVMODE signature, pOEMDMIn ignored.\r\n")); - - // Don't know what the input DEVMODE is, so just use defaults. - pOEMDevOut->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevOut->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevOut->dmOEMExtra.dwVersion = OEM_VERSION; - pOEMDevOut->bWmarkEnabled = WATER_MARK_DEFAULT_ENABLED; - pOEMDevOut->dwWmarkFontSize = WATER_MARK_DEFAULT_FONTSIZE; - pOEMDevOut->crWmarkTextColor = WATER_MARK_DEFAULT_COLOR; - hCopy = StringCbCopyW(pOEMDevOut->szWaterMark, sizeof(pOEMDevOut->szWaterMark), WATER_MARK_DEFAULT_TEXT); - } - - return SUCCEEDED(hCopy); -} - - -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode) -{ - if(NULL == pOEMDevmode) - { - return FALSE; - } - - // ASSUMPTION: pOEMDevmode is large enough to contain OEMDEV structure. - - // Make sure that dmOEMExtra indicates the current OEMDEV structure. - pOEMDevmode->dmOEMExtra.dwSize = sizeof(OEMDEV); - pOEMDevmode->dmOEMExtra.dwSignature = OEM_SIGNATURE; - pOEMDevmode->dmOEMExtra.dwVersion = OEM_VERSION; - - // bEnable should be either TRUE or FALSE. - if( (TRUE != pOEMDevmode->bWmarkEnabled) - && - (FALSE != pOEMDevmode->bWmarkEnabled) - ) - { - pOEMDevmode->bWmarkEnabled = WATER_MARK_DEFAULT_ENABLED; - } - - - // dwWmarkFontSize should be 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, or 72. - if(!IsValidFontSize(pOEMDevmode->dwWmarkFontSize)) - { - pOEMDevmode->dwWmarkFontSize = WATER_MARK_DEFAULT_FONTSIZE; - } - - // The high byte of the hi word should be zero. - if(0 != HIBYTE(HIWORD(pOEMDevmode->crWmarkTextColor))) - { - pOEMDevmode->crWmarkTextColor = WATER_MARK_DEFAULT_COLOR; - } - - // Make sure that water mark string is terminated. - pOEMDevmode->szWaterMark[WATER_MARK_TEXT_SIZE - 1] = L'\0'; - - return TRUE; -} - - -BOOL IsValidFontSize(DWORD dwWmarkFontSize) -{ - BOOL bValid = FALSE; - - - switch(dwWmarkFontSize) - { - case 8: - case 9: - case 10: - case 11: - case 12: - case 14: - case 16: - case 18: - case 20: - case 22: - case 24: - case 26: - case 28: - case 36: - case 48: - case 72: - bValid = TRUE; - break; - - default: - ERR(DLLTEXT("IsValidFontSize() found invalid font size\r\n")); - break; - } - - return bValid; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/devmode.h b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/devmode.h deleted file mode 100644 index de7ee919..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/devmode.h +++ /dev/null @@ -1,52 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Devmode.h -// -// PURPOSE: Define common data types, and external function prototypes -// for devmode functions. -// -#pragma once - -//////////////////////////////////////////////////////// -// OEM Devmode Defines -//////////////////////////////////////////////////////// - -#define WATER_MARK_TEXT_SIZE 128 -#define WATER_MARK_DEFAULT_ENABLED TRUE -#define WATER_MARK_DEFAULT_FONTSIZE 28 -#define WATER_MARK_DEFAULT_COLOR RGB(230, 230, 230) -#define WATER_MARK_DEFAULT_TEXT L"WaterMark" - - - -//////////////////////////////////////////////////////// -// OEM Devmode Type Definitions -//////////////////////////////////////////////////////// - -typedef struct tagOEMDEV -{ - OEM_DMEXTRAHEADER dmOEMExtra; - BOOL bWmarkEnabled; - DWORD dwWmarkFontSize; - COLORREF crWmarkTextColor; - WCHAR szWaterMark[WATER_MARK_TEXT_SIZE]; - -} OEMDEV, *POEMDEV; - -typedef const OEMDEV *PCOEMDEV; - - - -///////////////////////////////////////////////////////// -// ProtoTypes -///////////////////////////////////////////////////////// - -HRESULT hrOEMDevMode(DWORD dwMode, POEMDMPARAM pOemDMParam); -BOOL ConvertOEMDevmode(PCOEMDEV pOEMDevIn, POEMDEV pOEMDevOut); -BOOL MakeOEMDevmodeValid(POEMDEV pOEMDevmode); -BOOL IsValidFontSize(DWORD dwWmarkFontSize); diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/oem.h b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/oem.h deleted file mode 100644 index d63814ad..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/common/oem.h +++ /dev/null @@ -1,23 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997- 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: oem.H -// -// PURPOSE: Define common data types, and external function prototypes -// for debug.cpp. -// -#pragma once - -//////////////////////////////////////////////////////// -// OEM Defines -//////////////////////////////////////////////////////// - -#define OEM_SIGNATURE 'MSFT' -#define OEM_VERSION 0x00000001L - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/WMARKUNIUI.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/WMARKUNIUI.vcxproj deleted file mode 100644 index 4e88c6a9..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/WMARKUNIUI.vcxproj +++ /dev/null @@ -1,1150 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {1D0BAFC7-C244-4EC1-9DE3-5AC3937DDD62} - $(MSBuildProjectName) - Win10 Debug - Win32 - {39C728EB-3DCE-45B1-BC93-76678BB2A0A6} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - WMARKUNIUI - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - true - Level4 - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);..\common;. - - - %(AdditionalDependencies);kernel32.lib;user32.lib;ole32.lib;advapi32.lib;uuid.lib - - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - WMARKUNIUI.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/WMARKUNIUI.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/WMARKUNIUI.vcxproj.Filters deleted file mode 100644 index 660c3ddf..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/WMARKUNIUI.vcxproj.Filters +++ /dev/null @@ -1,140 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {6078E9AC-04DC-4263-AA1A-9501916D09D2} - - - h;hpp;hxx;hm;inl;inc;xsd - {0E5A51EE-1609-4F50-8955-63F7D0C1A20E} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {C5E399CF-1AAE-4A3D-B806-84CCA8D9930D} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/dllentry.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/dllentry.cpp deleted file mode 100644 index f4769ff4..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/dllentry.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cpp -// -// PURPOSE: Source module for DLL entry function(s). -// - -#include "precomp.h" -#include "wmarkui.h" -#include "debug.h" - -// indicate to prefast that this is a user-mode component. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -/////////////////////////////////////////////////////////// -// -// DLL entry point -// -BOOL WINAPI DllMain(HINSTANCE hInst, WORD wReason, LPVOID lpReserved) -{ - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - VERBOSE(DLLTEXT("Process attach.\r\n")); - ghInstance = hInst; - break; - - case DLL_THREAD_ATTACH: - VERBOSE(DLLTEXT("Thread attach.\r\n")); - break; - - case DLL_PROCESS_DETACH: - VERBOSE(DLLTEXT("Process detach.\r\n")); - break; - - case DLL_THREAD_DETACH: - VERBOSE(DLLTEXT("Thread detach.\r\n")); - break; - } - - return TRUE; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/fdevmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/fdevmode.cpp deleted file mode 100644 index c82072c5..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/fdevmode.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: fDevmode.cpp -// -// -// PURPOSE: Place holder file for devmode functions. -// - -#include "precomp.h" -#include "wmarkui.h" - -// indicate to prefast that this is a user-mode component. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/globals.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/globals.cpp deleted file mode 100644 index dd0ea334..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/globals.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Globals.cpp -// -// -// PURPOSE: File that contains all the globals. -// - -#include "precomp.h" -#include "wmarkui.h" - -// indicate to prefast that this is a user-mode component. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -// Module's Instance handle from DLLEntry of process. -HINSTANCE ghInstance = NULL; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/globals.h b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/globals.h deleted file mode 100644 index eac586c2..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/globals.h +++ /dev/null @@ -1,21 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Globals.h -// -// -// PURPOSE: Lists of globals declared in Globals.cpp. -// -// -#pragma once - -/////////////////////////////////////// -// Globals -/////////////////////////////////////// - -// Module's Instance handle from DLLEntry of process. -extern HINSTANCE ghInstance; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/intrface.cpp deleted file mode 100644 index cc8cceae..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/intrface.cpp +++ /dev/null @@ -1,525 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.cpp -// -// -// PURPOSE: Interface for User Mode COM Customization DLL. -// - -#include "precomp.h" - -#include "wmarkui.h" -#include "debug.h" -#include "intrface.h" - -// indicate to prefast that this is a user-mode component. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - - -//////////////////////////////////////////////////////// -// Internal Globals -//////////////////////////////////////////////////////// - -static long g_cComponents = 0 ; // Count of active components -static long g_cServerLocks = 0 ; // Count of locks - - - -//////////////////////////////////////////////////////////////////////////////// -// -// IWaterMarkUI body -// -HRESULT __stdcall IWaterMarkUI::QueryInterface(const IID& iid, void** ppv) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:QueryInterface entry.\r\n\r\n")); - if (iid == IID_IUnknown) - { - *ppv = static_cast(this); - VERBOSE(DLLTEXT("IWaterMarkUI:Return pointer to IUnknown.\r\n\r\n")); - } - else if (iid == IID_IPrintOemUI) - { - *ppv = static_cast(this) ; - VERBOSE(DLLTEXT("IWaterMarkUI:Return pointer to IPrintOemUI.\r\n")); - } - else - { - VERBOSE(DLLTEXT("IWaterMarkUI::QueryInterface: interface not supported.\r\n")); - *ppv = NULL ; - return E_NOINTERFACE ; - } - reinterpret_cast(*ppv)->AddRef() ; - return S_OK ; -} - -ULONG __stdcall IWaterMarkUI::AddRef() -{ - VERBOSE(DLLTEXT("IWaterMarkUI:AddRef entry.\r\n")); - return InterlockedIncrement(&m_cRef) ; -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IWaterMarkUI::Release() -{ - VERBOSE(DLLTEXT("IWaterMarkUI:Release entry.\r\n")); - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -HRESULT __stdcall IWaterMarkUI::PublishDriverInterface( - IUnknown *pIUnknown) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:PublishDriverInterface entry.\r\n")); - - UNREFERENCED_PARAMETER(pIUnknown); - - // Don't use the DriverInterface, so don't store it. - - return S_OK; -} - -HRESULT __stdcall IWaterMarkUI::GetInfo( - DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded) -{ - VERBOSE(DLLTEXT("IWaterMarkUI::GetInfo entry.\r\r\n")); - - // Validate parameters. - if( (NULL == pcbNeeded) - || - ( (OEMGI_GETSIGNATURE != dwMode) - && - (OEMGI_GETVERSION != dwMode) - && - (OEMGI_GETPUBLISHERINFO != dwMode) - ) - ) - { - VERBOSE(DLLTEXT("IWaterMarkUI::GetInfo() exit pcbNeeded is NULL!\r\r\n")); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Set expected buffer size and number of bytes written. - *pcbNeeded = sizeof(DWORD); - - // Check buffer size is sufficient. - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - WARNING(DLLTEXT("IWaterMarkUI::GetInfo() exit insufficient buffer!\r\r\n")); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return E_FAIL; - } - - switch(dwMode) - { - // OEM DLL Signature - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // OEM DLL version - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // dwMode not supported. - default: - // Set written bytes to zero since nothing was written. - WARNING(DLLTEXT("IWaterMarkUI::GetInfo() exit mode not supported.\r\r\n")); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - return E_FAIL; - } - - VERBOSE(DLLTEXT("IWaterMarkUI::GetInfo() exit S_OK.\r\r\n")); - return S_OK; -} - -HRESULT __stdcall IWaterMarkUI::DevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:DevMode entry.\r\n")); - - return hrOEMDevMode(dwMode, pOemDMParam); -} - -HRESULT __stdcall IWaterMarkUI::CommonUIProp( - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:CommonUIProp entry.\r\n")); - - return hrOEMPropertyPage(dwMode, pOemCUIPParam); -} - - -HRESULT __stdcall IWaterMarkUI::DocumentPropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:DocumentPropertySheets entry.\r\n")); - - UNREFERENCED_PARAMETER(pPSUIInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - -HRESULT __stdcall IWaterMarkUI::DevicePropertySheets( - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:DevicePropertySheets entry.\r\n")); - - UNREFERENCED_PARAMETER(pPSUIInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - -HRESULT __stdcall IWaterMarkUI::DeviceCapabilities( - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:DeviceCapabilities entry.\r\n")); - - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(pDeviceName); - UNREFERENCED_PARAMETER(wCapability); - UNREFERENCED_PARAMETER(pOutput); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - UNREFERENCED_PARAMETER(dwOld); - UNREFERENCED_PARAMETER(dwResult); - - return E_NOTIMPL; -} - -HRESULT __stdcall IWaterMarkUI::DevQueryPrintEx( - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:DevQueryPrintEx entry.\r\n")); - - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pDQPInfo); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - - return E_NOTIMPL; -} - -HRESULT __stdcall IWaterMarkUI::UpgradePrinter( - DWORD dwLevel, - PBYTE pDriverUpgradeInfo) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:UpgradePrinter entry.\r\n")); - - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverUpgradeInfo); - - return E_NOTIMPL; -} - -HRESULT __stdcall IWaterMarkUI::PrinterEvent( - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:PrinterEvent entry.\r\n")); - - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(iDriverEvent); - UNREFERENCED_PARAMETER(dwFlags); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -} - -HRESULT __stdcall IWaterMarkUI::DriverEvent( - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:DriverEvent entry.\r\n")); - - UNREFERENCED_PARAMETER(dwDriverEvent); - UNREFERENCED_PARAMETER(dwLevel); - UNREFERENCED_PARAMETER(pDriverInfo); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - - -HRESULT __stdcall IWaterMarkUI::QueryColorProfile( - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulQueryMode, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:QueryColorProfile entry.\r\n")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(poemuiobj); - UNREFERENCED_PARAMETER(pPublicDM); - UNREFERENCED_PARAMETER(pOEMDM); - UNREFERENCED_PARAMETER(ulQueryMode); - UNREFERENCED_PARAMETER(pvProfileData); - UNREFERENCED_PARAMETER(pcbProfileData); - UNREFERENCED_PARAMETER(pflProfileData); - - return E_NOTIMPL; -}; - -HRESULT __stdcall IWaterMarkUI::FontInstallerDlgProc( - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:FontInstallerDlgProc entry.\r\n")); - - UNREFERENCED_PARAMETER(hWnd); - UNREFERENCED_PARAMETER(usMsg); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); - - return E_NOTIMPL; -}; - -HRESULT __stdcall IWaterMarkUI::UpdateExternalFonts( - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges) -{ - VERBOSE(DLLTEXT("IWaterMarkUI:UpdateExternalFonts entry.\r\n")); - - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(hHeap); - UNREFERENCED_PARAMETER(pwstrCartridges); - - return E_NOTIMPL; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// oem class factory -// -class IOemCF : public IClassFactory -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // *** IClassFactory methods *** - STDMETHOD(CreateInstance) (THIS_ - LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID FAR* ppvObject); - STDMETHOD(LockServer) (THIS_ BOOL bLock); - - - // Constructor - IOemCF(): m_cRef(1) { }; - ~IOemCF() { }; - -protected: - LONG m_cRef; - -}; - -/////////////////////////////////////////////////////////// -// -// Class factory body -// -HRESULT __stdcall IOemCF::QueryInterface(const IID& iid, void** ppv) -{ - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this) ; - } - else - { - WARNING(DLLTEXT("IOemCF::QueryInterface: interface not supported.\r\n")); - *ppv = NULL ; - return E_NOINTERFACE ; - } - reinterpret_cast(*ppv)->AddRef() ; - return S_OK ; -} - -ULONG __stdcall IOemCF::AddRef() -{ - return InterlockedIncrement(&m_cRef) ; -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemCF::Release() -{ - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -// IClassFactory implementation -HRESULT __stdcall IOemCF::CreateInstance(IUnknown* pUnknownOuter, - const IID& iid, - void** ppv) -{ - //DbgPrint(DLLTEXT("Class factory:\t\tCreate component.")) ; - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Cannot aggregate. - if (pUnknownOuter != NULL) - { - return CLASS_E_NOAGGREGATION ; - } - - // Create component. - IWaterMarkUI* pOemCB = new IWaterMarkUI ; - if (pOemCB == NULL) - { - return E_OUTOFMEMORY ; - } - // Get the requested interface. - HRESULT hr = pOemCB->QueryInterface(iid, ppv) ; - - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - pOemCB->Release() ; - return hr ; -} - -// LockServer -HRESULT __stdcall IOemCF::LockServer(BOOL bLock) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks) ; - } - else - { - InterlockedDecrement(&g_cServerLocks) ; - } - return S_OK ; -} - -/////////////////////////////////////////////////////////// -// -// Exported functions -// - - -// Can DLL unload now? -// -STDAPI DllCanUnloadNow() -{ - // - // To avoid leaving OEM DLL still in memory when Unidrv or Pscript drivers - // are unloaded, Unidrv and Pscript driver ignore the return value of - // DllCanUnloadNow of the OEM DLL, and always call FreeLibrary on the OEMDLL. - // - // If OEM DLL spins off a working thread that also uses the OEM DLL, the - // thread needs to call LoadLibrary and FreeLibraryAndExitThread, otherwise - // it may crash after Unidrv or Pscript calls FreeLibrary. - // - - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK ; - } - else - { - return S_FALSE; - } -} - -// -// Get class factory -// -STDAPI DllGetClassObject( - _In_ REFCLSID clsid, - _In_ REFIID iid, - _Outptr_ LPVOID* ppv) -{ - VERBOSE(DLLTEXT("DllGetClassObject:Create class factory.\r\n")); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Can we create this component? - if (clsid != CLSID_OEMUI) - { - return CLASS_E_CLASSNOTAVAILABLE ; - } - - // Create class factory. - IOemCF* pFontCF = new IOemCF ; // Reference count set to 1 - // in constructor - if (pFontCF == NULL) - { - return E_OUTOFMEMORY ; - } - - // Get requested interface. - HRESULT hr = pFontCF->QueryInterface(iid, ppv) ; - pFontCF->Release() ; - - return hr ; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/intrface.h deleted file mode 100644 index 7f1ebad8..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/intrface.h +++ /dev/null @@ -1,178 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.H -// -// PURPOSE: Define COM interface for User Mode Printer UI plug-in. -// -#pragma once - -//////////////////////////////////////////////////////////////////////////////// -// -// IWaterMarkUI -// -class IWaterMarkUI: public IPrintOemUI -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Get OEM dll related information - // - - STDMETHOD(GetInfo) (THIS_ DWORD dwMode, PVOID pBuffer, DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDevMode - // - - STDMETHOD(DevMode) (THIS_ DWORD dwMode, POEMDMPARAM pOemDMParam) ; - - // - // OEMCommonUIProp - // - - STDMETHOD(CommonUIProp) (THIS_ - DWORD dwMode, - POEMCUIPPARAM pOemCUIPParam - ); - - // - // OEMDocumentPropertySheets - // - - STDMETHOD(DocumentPropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - // - // OEMDevicePropertySheets - // - - STDMETHOD(DevicePropertySheets) (THIS_ - PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam - ); - - - // - // OEMDevQueryPrintEx - // - - STDMETHOD(DevQueryPrintEx) (THIS_ - POEMUIOBJ poemuiobj, - PDEVQUERYPRINT_INFO pDQPInfo, - PDEVMODE pPublicDM, - PVOID pOEMDM - ); - - // - // OEMDeviceCapabilities - // - - STDMETHOD(DeviceCapabilities) (THIS_ - POEMUIOBJ poemuiobj, - HANDLE hPrinter, - _In_ PWSTR pDeviceName, - WORD wCapability, - PVOID pOutput, - PDEVMODE pPublicDM, - PVOID pOEMDM, - DWORD dwOld, - DWORD *dwResult - ); - - // - // OEMUpgradePrinter - // - - STDMETHOD(UpgradePrinter) (THIS_ - DWORD dwLevel, - PBYTE pDriverUpgradeInfo - ); - - // - // OEMPrinterEvent - // - - STDMETHOD(PrinterEvent) (THIS_ - _In_ PWSTR pPrinterName, - INT iDriverEvent, - DWORD dwFlags, - LPARAM lParam - ); - - // - // OEMDriverEvent - // - - STDMETHOD(DriverEvent)(THIS_ - DWORD dwDriverEvent, - DWORD dwLevel, - LPBYTE pDriverInfo, - LPARAM lParam - ); - - // - // OEMQueryColorProfile - // - - STDMETHOD(QueryColorProfile) (THIS_ - HANDLE hPrinter, - POEMUIOBJ poemuiobj, - PDEVMODE pPublicDM, - PVOID pOEMDM, - ULONG ulReserved, - VOID *pvProfileData, - ULONG *pcbProfileData, - FLONG *pflProfileData); - - // - // OEMFontInstallerDlgProc - // - - STDMETHOD(FontInstallerDlgProc) (THIS_ - HWND hWnd, - UINT usMsg, - WPARAM wParam, - LPARAM lParam - ); - // - // UpdateExternalFonts - // - - STDMETHOD(UpdateExternalFonts) (THIS_ - HANDLE hPrinter, - HANDLE hHeap, - _In_ PWSTR pwstrCartridges - ); - - - IWaterMarkUI() { m_cRef = 1; }; - ~IWaterMarkUI() { }; - -protected: - LONG m_cRef; -}; - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/precomp.h deleted file mode 100644 index 644d21cd..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/precomp.h +++ /dev/null @@ -1,54 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: precomp.H -// -// -// PURPOSE: Optimize compilation of headers that don't change frequently. -// -#pragma once - -// Necessary for compiling under VC. -#if(!defined(WINVER) || (WINVER < 0x0500)) - #undef WINVER - #define WINVER 0x0500 -#endif -#if(!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)) - #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0500 -#endif - - - -// Required header files that shouldn't change often. - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "WINDDIUI.H" -#include -#include -#include - - -// StrSafe.h needs to be included last -// to disallow unsafe string functions. -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/resource.h b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/resource.h deleted file mode 100644 index 22c03be5..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/resource.h +++ /dev/null @@ -1,26 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by wmarkui.rc -// -#define IDS_WATERMARK 1 -#define IDS_TEXT 2 -#define IDS_FONTSIZE 3 -#define IDS_COLOR 5 -#define IDS_GRAY 6 -#define IDS_RED 7 -#define IDS_GREEN 8 -#define IDS_BLUE 9 -#define IDS_ENBLED 10 -#define IDS_ENABLED 10 -#define IDS_DISABLED 11 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkui.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkui.cpp deleted file mode 100644 index fb875d30..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkui.cpp +++ /dev/null @@ -1,594 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: WMarkUI.cpp -// -// -// PURPOSE: Main file for OEM UI test module. -// -// - -#include "precomp.h" -#include "resource.h" -#include "debug.h" -#include "wmarkui.h" - -// indicate to prefast that this is a user-mode component. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - - -//////////////////////////////////////////////////////// -// INTERNAL MACROS and DEFINES -//////////////////////////////////////////////////////// - - - -//////////////////////////////////////////////////////// -// INTERNAL PROTOTYPES -//////////////////////////////////////////////////////// - -LONG APIENTRY OEMUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam); -static HRESULT hrDocumentPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); -static void InitOptItems(POPTITEM pOptItems, DWORD dwOptItems); -static POPTTYPE CreateOptType(HANDLE hHeap, WORD wOptParams); -static DWORD FontSizeToIndex(DWORD dwWmarkFontSize); -static DWORD FontIndexToSize(DWORD dwIndex); -static DWORD TextColorToIndex(COLORREF crWmarkTextColor); -static COLORREF IndexToTextColor(DWORD dwIndex); -static PTSTR GetStringResource(HANDLE hHeap, HMODULE hModule, UINT uResource); - - - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM device or document property UI. -// -HRESULT hrOEMPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - HRESULT hResult = S_OK; - - - VERBOSE(DLLTEXT("hrOEMPropertyPage entry.\r\n")); - - // Validate parameters. - if( (OEMCUIP_DOCPROP != dwMode) - && - (OEMCUIP_PRNPROP != dwMode) - ) - { - ERR(DLLTEXT("hrOEMPropertyPage() ERROR_INVALID_PARAMETER.\r\n")); - - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - switch(dwMode) - { - case OEMCUIP_DOCPROP: - hResult = hrDocumentPropertyPage(dwMode, pOEMUIParam); - break; - - case OEMCUIP_PRNPROP: - // Don't have any Printer Proptery UI. - hResult = E_NOTIMPL; - break; - - default: - // Should never reach this! - ERR(DLLTEXT("hrOEMPropertyPage() Invalid dwMode")); - SetLastError(ERROR_INVALID_PARAMETER); - hResult = E_FAIL; - break; - } - - return hResult; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// OptItems call back for OEM device or document property UI. -// -LONG APIENTRY OEMUICallBack(PCPSUICBPARAM pCallbackParam, POEMCUIPPARAM pOEMUIParam) -{ - LONG lReturn = CPSUICB_ACTION_NONE; - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - - - VERBOSE(DLLTEXT("OEMUICallBack() entry.\r\n")); - - switch(pCallbackParam->Reason) - { - case CPSUICB_REASON_APPLYNOW: - // Store OptItems state in DEVMODE. - pOEMDev->bWmarkEnabled = !pOEMUIParam->pOEMOptItems[0].Sel; - if(FAILED(StringCbCopyW(pOEMDev->szWaterMark, sizeof(pOEMDev->szWaterMark), (LPWSTR)pOEMUIParam->pOEMOptItems[1].pSel))) - { - ERR(DLLTEXT("OEMUICallBack() failed to copy water mark text\r\n")); - } - pOEMDev->dwWmarkFontSize = FontIndexToSize(pOEMUIParam->pOEMOptItems[2].Sel); - pOEMDev->crWmarkTextColor = IndexToTextColor(pOEMUIParam->pOEMOptItems[3].Sel); - break; - - default: - break; - } - - return lReturn; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems to display OEM document property UI. -// -static HRESULT hrDocumentPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam) -{ - if ( NULL == pOEMUIParam || NULL == pOEMUIParam->pOEMDM ) - { - ERR(DLLTEXT("hrDocumentPropertyPage() ERROR_INVALID_PARAMETER.\r\n")); - // Return invalid parameter error. - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - if(NULL == pOEMUIParam->pOEMOptItems) - { - // Fill in the number of OptItems to create for OEM document property UI. - pOEMUIParam->cOEMOptItems = 4; - - VERBOSE(DLLTEXT("hrDocumentPropertyPage() requesting items.\r\n")); - } - else if(dwMode == OEMCUIP_DOCPROP) - { - POEMDEV pOEMDev = (POEMDEV) pOEMUIParam->pOEMDM; - - - VERBOSE(DLLTEXT("hrDocumentPropertyPage() fill out items.\r\n")); - - // Init UI Callback reference. - pOEMUIParam->OEMCUIPCallback = OEMUICallBack; - - // Init OEMOptItmes. - InitOptItems(pOEMUIParam->pOEMOptItems, pOEMUIParam->cOEMOptItems); - - // Fill out tree view items. - - // Water Mark Section Name. - pOEMUIParam->pOEMOptItems[0].Level = 1; - pOEMUIParam->pOEMOptItems[0].Flags = OPTIF_COLLAPSE; - pOEMUIParam->pOEMOptItems[0].pName = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_WATERMARK); - pOEMUIParam->pOEMOptItems[0].Sel = pOEMDev->bWmarkEnabled ? 0 : 1; - - pOEMUIParam->pOEMOptItems[0].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 2); - - pOEMUIParam->pOEMOptItems[0].pOptType->Type = TVOT_COMBOBOX; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[0].pData = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_ENABLED); - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[0].IconID = IDI_CPSUI_ON; - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].pData = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_DISABLED); - pOEMUIParam->pOEMOptItems[0].pOptType->pOptParam[1].IconID = IDI_CPSUI_OFF; - - - // WaterMark Text. - pOEMUIParam->pOEMOptItems[1].Level = 2; - pOEMUIParam->pOEMOptItems[1].Flags = 0; - pOEMUIParam->pOEMOptItems[1].pName = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_TEXT); - pOEMUIParam->pOEMOptItems[1].pSel = (LPTSTR) HeapAlloc(pOEMUIParam->hOEMHeap, HEAP_ZERO_MEMORY, MAX_PATH * sizeof(WCHAR)); - if (pOEMUIParam->pOEMOptItems[1].pSel == NULL) - { - ERR(DLLTEXT("hrDocumentPropertyPage() failed to copy water mark text\r\n")); - return E_OUTOFMEMORY; - } - - if(FAILED(StringCbCopyW((LPWSTR)pOEMUIParam->pOEMOptItems[1].pSel, MAX_PATH * sizeof(WCHAR), pOEMDev->szWaterMark))) - { - ERR(DLLTEXT("hrDocumentPropertyPage() failed to copy water mark text \r\n")); - } - - pOEMUIParam->pOEMOptItems[1].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 2); - - pOEMUIParam->pOEMOptItems[1].pOptType->Type = TVOT_EDITBOX; - pOEMUIParam->pOEMOptItems[1].pOptType->pOptParam[1].IconID = sizeof(((POEMDEV)NULL)->szWaterMark)/sizeof(WCHAR); - - - // WaterMark Font Size. - pOEMUIParam->pOEMOptItems[2].Level = 2; - pOEMUIParam->pOEMOptItems[2].Flags = 0; - pOEMUIParam->pOEMOptItems[2].pName = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_FONTSIZE); - pOEMUIParam->pOEMOptItems[2].Sel = FontSizeToIndex(pOEMDev->dwWmarkFontSize); - - pOEMUIParam->pOEMOptItems[2].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 16); - - pOEMUIParam->pOEMOptItems[2].pOptType->Type = TVOT_COMBOBOX; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[0].pData = L"8"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[1].pData = L"9"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[2].pData = L"10"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[3].pData = L"11"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[4].pData = L"12"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[5].pData = L"14"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[6].pData = L"16"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[7].pData = L"18"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[8].pData = L"20"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[9].pData = L"22"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[10].pData = L"24"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[11].pData = L"26"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[12].pData = L"28"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[13].pData = L"36"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[14].pData = L"48"; - pOEMUIParam->pOEMOptItems[2].pOptType->pOptParam[15].pData = L"72"; - - - // WaterMark Color. - pOEMUIParam->pOEMOptItems[3].Level = 2; - pOEMUIParam->pOEMOptItems[3].Flags = 0; - pOEMUIParam->pOEMOptItems[3].pName = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_COLOR); - pOEMUIParam->pOEMOptItems[3].Sel = TextColorToIndex(pOEMDev->crWmarkTextColor); - - pOEMUIParam->pOEMOptItems[3].pOptType = CreateOptType(pOEMUIParam->hOEMHeap, 4); - - pOEMUIParam->pOEMOptItems[3].pOptType->Type = TVOT_COMBOBOX; - pOEMUIParam->pOEMOptItems[3].pOptType->pOptParam[0].pData = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_GRAY); - pOEMUIParam->pOEMOptItems[3].pOptType->pOptParam[1].pData = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_RED); - pOEMUIParam->pOEMOptItems[3].pOptType->pOptParam[2].pData = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_GREEN); - pOEMUIParam->pOEMOptItems[3].pOptType->pOptParam[3].pData = GetStringResource(pOEMUIParam->hOEMHeap, ghInstance, IDS_BLUE); - } - - return S_OK; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Initializes OptItems. -// -static void InitOptItems(POPTITEM pOptItems, DWORD dwOptItems) -{ - VERBOSE(DLLTEXT("InitOptItems() entry.\r\n")); - - // Zero out memory. - memset(pOptItems, 0, sizeof(OPTITEM) * dwOptItems); - - // Set each OptItem's size, and Public DM ID. - for(DWORD dwCount = 0; dwCount < dwOptItems; dwCount++) - { - pOptItems[dwCount].cbSize = sizeof(OPTITEM); - pOptItems[dwCount].DMPubID = DMPUB_NONE; - } -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Allocates and initializes OptType for OptItem. -// -static POPTTYPE CreateOptType(HANDLE hHeap, WORD wOptParams) -{ - POPTTYPE pOptType = NULL; - - - VERBOSE(DLLTEXT("CreateOptType() entry.\r\n")); - - // Allocate memory from the heap for the OPTTYPE; the driver will take care of clean up. - pOptType = (POPTTYPE) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(OPTTYPE)); - if(NULL != pOptType) - { - // Initialize OPTTYPE. - pOptType->cbSize = sizeof(OPTTYPE); - pOptType->Count = wOptParams; - - // Allocate memory from the heap for the OPTPARAMs for the OPTTYPE. - pOptType->pOptParam = (POPTPARAM) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, wOptParams * sizeof(OPTPARAM)); - if(NULL != pOptType->pOptParam) - { - // Initialize the OPTPARAMs. - for(WORD wCount = 0; wCount < wOptParams; wCount++) - { - pOptType->pOptParam[wCount].cbSize = sizeof(OPTPARAM); - } - } - else - { - ERR(DLLTEXT("CreateOptType() failed to allocated memory for OPTPARAMs!\r\n")); - - // Free allocated memory and return NULL. - HeapFree(hHeap, 0, pOptType); - pOptType = NULL; - } - } - else - { - ERR(DLLTEXT("CreateOptType() failed to allocated memory for OPTTYPE!\r\n")); - } - - return pOptType; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Converts Font point size to index in combo box. -// -static DWORD FontSizeToIndex(DWORD dwWmarkFontSize) -{ - DWORD dwIndex; - - - switch(dwWmarkFontSize) - { - case 8: - dwIndex = 0; - break; - - case 9: - dwIndex = 1; - break; - - case 10: - dwIndex = 2; - break; - - case 11: - dwIndex = 3; - break; - - case 12: - dwIndex = 4; - break; - - case 14: - dwIndex = 5; - break; - - case 16: - dwIndex = 6; - break; - - case 18: - dwIndex = 7; - break; - - case 20: - dwIndex = 8; - break; - - case 22: - dwIndex = 9; - break; - - case 24: - dwIndex = 10; - break; - - case 26: - dwIndex = 11; - break; - - case 36: - dwIndex = 13; - break; - - case 48: - dwIndex = 14; - break; - - case 72: - dwIndex = 15; - break; - - case 28: - default: - dwIndex = 12; - break; - } - - return dwIndex; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Converts Font combo box index to font point size. -// -static DWORD FontIndexToSize(DWORD dwIndex) -{ - DWORD dwWmarkFontSize; - - switch(dwIndex) - { - case 0: - dwWmarkFontSize = 8; - break; - - case 1: - dwWmarkFontSize = 9; - break; - - case 2: - dwWmarkFontSize = 10; - break; - - case 3: - dwWmarkFontSize = 11; - break; - - case 4: - dwWmarkFontSize = 12; - break; - - case 5: - dwWmarkFontSize = 14; - break; - - case 6: - dwWmarkFontSize = 16; - break; - - case 7: - dwWmarkFontSize = 18; - break; - - case 8: - dwWmarkFontSize = 20; - break; - - case 9: - dwWmarkFontSize = 22; - break; - - case 10: - dwWmarkFontSize = 24; - break; - - case 11: - dwWmarkFontSize = 26; - break; - - case 13: - dwWmarkFontSize = 36; - break; - - case 14: - dwWmarkFontSize = 48; - break; - - case 15: - dwWmarkFontSize = 72; - break; - - case 12: - default: - dwWmarkFontSize = 28; - break; - } - - return dwWmarkFontSize; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// Converts text color to combo box index. -// -static DWORD TextColorToIndex(COLORREF crWmarkTextColor) -{ - DWORD dwIndex; - - - // The color is what ever color is dominate. If none are, then it is gray. - if( (GetRValue(crWmarkTextColor) > GetGValue(crWmarkTextColor)) - && - (GetGValue(crWmarkTextColor) >= GetBValue(crWmarkTextColor)) - ) - { - // Set index to red. - dwIndex = 1; - } - else if( (GetRValue(crWmarkTextColor) < GetGValue(crWmarkTextColor)) - && - (GetGValue(crWmarkTextColor) > GetBValue(crWmarkTextColor)) - ) - { - // Set index to green. - dwIndex = 2; - } - else if( (GetRValue(crWmarkTextColor) <= GetGValue(crWmarkTextColor)) - && - (GetGValue(crWmarkTextColor) < GetBValue(crWmarkTextColor)) - ) - { - // Set index to blue. - dwIndex = 3; - } - else - { - // Set index to gray. - dwIndex = 0; - } - - return dwIndex; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// Converts text combo box index to text color. -// -static COLORREF IndexToTextColor(DWORD dwIndex) -{ - COLORREF crWmarkTextColor; - - // Map index to desired text color. - // We just support 4 colors in the UI: Red, Green, Blue, and gray. - // The rendering module is capable of using any color for the Water Mark Text. - switch(dwIndex) - { - case 1: - // Color is red. - crWmarkTextColor = RGB(255, 216, 216); - break; - - case 2: - // Color is green. - crWmarkTextColor = RGB(216, 255, 216); - break; - - case 3: - // Color is blue. - crWmarkTextColor = RGB(216, 216, 255); - break; - - default: - case 0: - // Color is gray. - crWmarkTextColor = WATER_MARK_DEFAULT_COLOR; - break; - } - - return crWmarkTextColor; -} - -//////////////////////////////////////////////////////////////////////////////////// -// -// Retrieves pointer to a String resource. -// -static PTSTR GetStringResource(HANDLE hHeap, HMODULE hModule, UINT uResource) -{ - int nResult; - DWORD dwSize = MAX_PATH; - PTSTR pszString = NULL; - - - VERBOSE(DLLTEXT("GetStringResource() entered.\r\n")); - - // Allocate buffer for string resource from heap; let the driver clean it up. - pszString = (PTSTR) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, dwSize * sizeof(TCHAR)); - if(NULL != pszString) - { - PTSTR pTemp; - - // Load string resource; resize after loading so as not to waste memory. - nResult = LoadString(hModule, uResource, pszString, dwSize); - if (0 == nResult) - { - ERR(DLLTEXT("GetStringResource() failed to load the the string resource!\r\n")); - HeapFree(hHeap, 0, pszString); - pszString=NULL; - } - else - { - pTemp = (PTSTR) HeapReAlloc(hHeap, HEAP_ZERO_MEMORY, pszString, (nResult + 1) * sizeof(TCHAR)); - if(NULL != pTemp) - { - pszString = pTemp; - } - } - } - else - { - ERR(DLLTEXT("GetStringResource() failed to allocate string buffer!\r\n")); - } - - return pszString; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkui.h b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkui.h deleted file mode 100644 index ca19064a..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkui.h +++ /dev/null @@ -1,37 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: WMarkUI.H -// -// -// PURPOSE: Define common data types, and external function prototypes -// for WaterMark UI. -// -#pragma once - -#include -#include -#include "globals.h" - - -//////////////////////////////////////////////////////// -// OEM UI Defines -//////////////////////////////////////////////////////// - - -// OEM Signature and version. -#define PROP_TITLE L"WaterMark UI Page" -#define DLLTEXT(s) "WMARKUI: " s - -//////////////////////////////////////////////////////// -// Prototypes -//////////////////////////////////////////////////////// - -HRESULT hrOEMPropertyPage(DWORD dwMode, POEMCUIPPARAM pOEMUIParam); - - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkui.rc b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkui.rc deleted file mode 100644 index 44358b9a..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkui.rc +++ /dev/null @@ -1,124 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Written by Windows Printing & Imaging Team" - VALUE "CompanyName", "Microsoft Corp." - VALUE "FileDescription", "WaterMarkUni UI" - VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "WMarkUniUI" - VALUE "LegalCopyright", "Copyright 1998-2003" - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation" - VALUE "OriginalFilename", "WMarkUniUI.dll" - VALUE "ProductName", "Microsoft WaterMark" - VALUE "ProductVersion", "1.0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_WATERMARK "Water Mark" - IDS_TEXT "Text" - IDS_FONTSIZE "Font Size" - IDS_COLOR "Color" - IDS_GRAY "Gray" - IDS_RED "Red" - IDS_GREEN "Green" - IDS_BLUE "Blue" - IDS_ENABLED "Enabled" - IDS_DISABLED "Disabled" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkuniui.def b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkuniui.def deleted file mode 100644 index 26c192f9..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkui/wmarkuniui.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY WMARKUI -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/WMARKUNI.vcxproj b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/WMARKUNI.vcxproj deleted file mode 100644 index 0ad2b890..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/WMARKUNI.vcxproj +++ /dev/null @@ -1,1090 +0,0 @@ - - - - - Win10 Debug - ARM64 - - - Win10 Debug - Win32 - - - Win10 Debug - x64 - - - Win10 Release - ARM64 - - - Win10 Release - Win32 - - - Win10 Release - x64 - - - Win8.1 Debug - Win32 - - - Win8 Debug - Win32 - - - Win7 Debug - Win32 - - - Win8.1 Release - Win32 - - - Win8 Release - Win32 - - - Win7 Release - Win32 - - - Win8.1 Debug - x64 - - - Win8 Debug - x64 - - - Win7 Debug - x64 - - - Win8.1 Release - x64 - - - Win8 Release - x64 - - - Win7 Release - x64 - - - - {866141A6-4989-41D7-9409-4A5A73B535B0} - $(MSBuildProjectName) - Win10 Debug - Win32 - {FF810DA7-AF7F-4167-9078-A43C6CA46E83} - - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - False - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - False - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Win7 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Win8 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - WindowsV6.3 - True - - WindowsApplicationForDrivers8.1 - DynamicLibrary - - - Windows10 - True - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - WMARKUNI - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - true - Level4 - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(PreprocessorDefinitions);KERNEL_MODE;_UNICODE;UNICODE;OEMCOM;USERMODE_DRIVER - %(AdditionalIncludeDirectories);..\common;.. - - - %(AdditionalDependencies);uuid.lib;kernel32.lib;user32.lib;ole32.lib - - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0603 - 0x06030000 - - - 0x0A00 - 0x0A000000 - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - WMARKUNI.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/WMARKUNI.vcxproj.Filters b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/WMARKUNI.vcxproj.Filters deleted file mode 100644 index 480c5f75..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/WMARKUNI.vcxproj.Filters +++ /dev/null @@ -1,137 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {0906BEFF-05C5-43D6-A8A8-56287C3F1FDD} - - - h;hpp;hxx;hm;inl;inc;xsd - {33052901-7C1C-4E06-A9A5-0FDB9BE8B947} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {F0995942-2A83-43B2-B61A-69B8DFE2E12D} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/ddihook.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/ddihook.cpp deleted file mode 100644 index 36615fac..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/ddihook.cpp +++ /dev/null @@ -1,1226 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: DDIHook.cpp -// -// -// PURPOSE: DDI Hook routines for User Mode COM Customization DLL. -// -// - -#include "precomp.h" -#include "debug.h" -#include "wmarkuni.h" - -// indicate to prefast that this is a user-mode component. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -// Loop limiter. -#define MAX_LOOP 10 - -void RenderWaterMark(PDEVOBJ pdevobj); -static DWORD FormatResource(_In_ LPSTR pszResource, _Out_ LPSTR *ppszBuffer, ...); -// -// OEMBitBlt -// - - - -BOOL APIENTRY -OEMBitBlt( - SURFOBJ *psoTrg, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclTrg, - POINTL *pptlSrc, - POINTL *pptlMask, - BRUSHOBJ *pbo, - POINTL *pptlBrush, - ROP4 rop4 - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMBitBlt() entry.\r\n")); - - pdevobj = (PDEVOBJ)psoTrg->dhpdev; - - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvBitBlt)(poempdev->pfnUnidrv[UD_DrvBitBlt])) ( - psoTrg, - psoSrc, - psoMask, - pco, - pxlo, - prclTrg, - pptlSrc, - pptlMask, - pbo, - pptlBrush, - rop4)); - -} - -// -// OEMStretchBlt -// - -BOOL APIENTRY -OEMStretchBlt( - SURFOBJ *psoDest, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - COLORADJUSTMENT *pca, - POINTL *pptlHTOrg, - RECTL *prclDest, - RECTL *prclSrc, - POINTL *pptlMask, - ULONG iMode - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMStretchBlt() entry.\r\n")); - - pdevobj = (PDEVOBJ)psoDest->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - - // - // turn around to call Unidrv - // - - return (((PFN_DrvStretchBlt)(poempdev->pfnUnidrv[UD_DrvStretchBlt])) ( - psoDest, - psoSrc, - psoMask, - pco, - pxlo, - pca, - pptlHTOrg, - prclDest, - prclSrc, - pptlMask, - iMode)); - -} - -// -// OEMCopyBits -// - -BOOL APIENTRY -OEMCopyBits( - SURFOBJ *psoDest, - SURFOBJ *psoSrc, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDest, - POINTL *pptlSrc - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMCopyBits() entry.\r\n")); - - pdevobj = (PDEVOBJ)psoDest->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvCopyBits)(poempdev->pfnUnidrv[UD_DrvCopyBits])) ( - psoDest, - psoSrc, - pco, - pxlo, - prclDest, - pptlSrc)); - -} - -// -// OEMTextOut -// - -BOOL APIENTRY -OEMTextOut( - SURFOBJ *pso, - STROBJ *pstro, - FONTOBJ *pfo, - CLIPOBJ *pco, - RECTL *prclExtra, - RECTL *prclOpaque, - BRUSHOBJ *pboFore, - BRUSHOBJ *pboOpaque, - POINTL *pptlOrg, - MIX mix - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMTextOut() entry.\r\n")); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvTextOut)(poempdev->pfnUnidrv[UD_DrvTextOut])) ( - pso, - pstro, - pfo, - pco, - prclExtra, - prclOpaque, - pboFore, - pboOpaque, - pptlOrg, - mix)); - -} - -// -// OEMStrokePath -// - -BOOL APIENTRY -OEMStrokePath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - XFORMOBJ *pxo, - BRUSHOBJ *pbo, - POINTL *pptlBrushOrg, - LINEATTRS *plineattrs, - MIX mix - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMStokePath() entry.\r\n")); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvStrokePath)(poempdev->pfnUnidrv[UD_DrvStrokePath])) ( - pso, - ppo, - pco, - pxo, - pbo, - pptlBrushOrg, - plineattrs, - mix)); - -} - -// -// OEMFillPath -// - -BOOL APIENTRY -OEMFillPath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - BRUSHOBJ *pbo, - POINTL *pptlBrushOrg, - MIX mix, - FLONG flOptions - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMFillPath() entry.\r\n")); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvFillPath)(poempdev->pfnUnidrv[UD_DrvFillPath])) ( - pso, - ppo, - pco, - pbo, - pptlBrushOrg, - mix, - flOptions)); - -} - -// -// OEMStrokeAndFillPath -// - -BOOL APIENTRY -OEMStrokeAndFillPath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - XFORMOBJ *pxo, - BRUSHOBJ *pboStroke, - LINEATTRS *plineattrs, - BRUSHOBJ *pboFill, - POINTL *pptlBrushOrg, - MIX mixFill, - FLONG flOptions - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMStrokeAndFillPath() entry.\r\n")); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvStrokeAndFillPath)(poempdev->pfnUnidrv[UD_DrvStrokeAndFillPath])) ( - pso, - ppo, - pco, - pxo, - pboStroke, - plineattrs, - pboFill, - pptlBrushOrg, - mixFill, - flOptions)); - -} - -// -// OEMRealizeBrush -// - -BOOL APIENTRY -OEMRealizeBrush( - BRUSHOBJ *pbo, - SURFOBJ *psoTarget, - SURFOBJ *psoPattern, - SURFOBJ *psoMask, - XLATEOBJ *pxlo, - ULONG iHatch - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMRealizeBrush() entry.\r\n")); - - pdevobj = (PDEVOBJ)psoTarget->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvRealizeBrush)(poempdev->pfnUnidrv[UD_DrvRealizeBrush])) ( - pbo, - psoTarget, - psoPattern, - psoMask, - pxlo, - iHatch)); -} - -// -// OEMStartPage -// - -BOOL APIENTRY -OEMStartPage( - SURFOBJ *pso - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMStartPage() entry.\r\n")); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // turn around to call Unidrv - // - - return (((PFN_DrvStartPage)(poempdev->pfnUnidrv[UD_DrvStartPage]))(pso)); - -} - -#define OEM_TESTSTRING "The DDICMDCB DLL adds this line of text." - -// -// OEMSendPage -// - -BOOL APIENTRY -OEMSendPage( - SURFOBJ *pso - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMSendPage() entry.\r\n")); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - POEMDEV pOemDevmode = (POEMDEV) pdevobj->pOEMDM; - if(pOemDevmode && pOemDevmode->bWmarkEnabled) - { - RenderWaterMark(pdevobj); - } - // - // print a line of text, just for testing - // - if (pso->iType == STYPE_BITMAP) - { - pdevobj->pDrvProcs->DrvXMoveTo(pdevobj, 0, 0); - pdevobj->pDrvProcs->DrvYMoveTo(pdevobj, 0, 0); - pdevobj->pDrvProcs->DrvWriteSpoolBuf(pdevobj, OEM_TESTSTRING, - sizeof(OEM_TESTSTRING)); - } - - // - // turn around to call Unidrv - // - - return (((PFN_DrvSendPage)(poempdev->pfnUnidrv[UD_DrvSendPage]))(pso)); - -} - -// -// OEMEscape -// - -ULONG APIENTRY -OEMEscape( - SURFOBJ *pso, - ULONG iEsc, - ULONG cjIn, - _In_reads_bytes_(cjIn) PVOID pvIn, - ULONG cjOut, - _Out_writes_bytes_(cjOut) PVOID pvOut - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMEscape() entry.\r\n")); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvEscape)(poempdev->pfnUnidrv[UD_DrvEscape])) ( - pso, - iEsc, - cjIn, - pvIn, - cjOut, - pvOut)); - -} - -// -// OEMStartDoc -// - -BOOL APIENTRY -OEMStartDoc( - SURFOBJ *pso, - _In_ PWSTR pwszDocName, - DWORD dwJobId - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMStartDoc() entry.\r\n")); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvStartDoc)(poempdev->pfnUnidrv[UD_DrvStartDoc])) ( - pso, - pwszDocName, - dwJobId)); - -} - -// -// OEMEndDoc -// - -BOOL APIENTRY -OEMEndDoc( - SURFOBJ *pso, - FLONG fl - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMEndDoc() entry.\r\n")); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvEndDoc)(poempdev->pfnUnidrv[UD_DrvEndDoc])) ( - pso, - fl)); - -} - -//////// -// NOTE: -// OEM DLL needs to hook out the following six font related DDI calls only -// if it enumerates additional fonts beyond what's in the GPD file. -// And if it does, it needs to take care of its own fonts for all font DDI -// calls and DrvTextOut call. -/////// - -// -// OEMQueryFont -// - -PIFIMETRICS APIENTRY -OEMQueryFont( - DHPDEV dhpdev, - ULONG_PTR iFile, - ULONG iFace, - ULONG_PTR *pid - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMQueryFont() entry.\r\n")); - - pdevobj = (PDEVOBJ)dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvQueryFont)(poempdev->pfnUnidrv[UD_DrvQueryFont])) ( - dhpdev, - iFile, - iFace, - pid)); - -} - -// -// OEMQueryFontTree -// - -PVOID APIENTRY -OEMQueryFontTree( - DHPDEV dhpdev, - ULONG_PTR iFile, - ULONG iFace, - ULONG iMode, - ULONG_PTR *pid - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMQueryFontTree() entry.\r\n")); - - pdevobj = (PDEVOBJ)dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvQueryFontTree)(poempdev->pfnUnidrv[UD_DrvQueryFontTree])) ( - dhpdev, - iFile, - iFace, - iMode, - pid)); - -} - -// -// OEMQueryFontData -// - -LONG APIENTRY -OEMQueryFontData( - DHPDEV dhpdev, - FONTOBJ *pfo, - ULONG iMode, - HGLYPH hg, - GLYPHDATA *pgd, - _Out_writes_bytes_(cjSize) PVOID pv, - ULONG cjSize - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMQueryFontData() entry.\r\n")); - - pdevobj = (PDEVOBJ)dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv if this is not the font that OEM enumerated. - // - - return (((PFN_DrvQueryFontData)(poempdev->pfnUnidrv[UD_DrvQueryFontData])) ( - dhpdev, - pfo, - iMode, - hg, - pgd, - pv, - cjSize)); - -} - -// -// OEMQueryAdvanceWidths -// - -BOOL APIENTRY -OEMQueryAdvanceWidths( - DHPDEV dhpdev, - FONTOBJ *pfo, - ULONG iMode, - _In_reads_(cGlyphs) HGLYPH *phg, - _Out_writes_bytes_(cGlyphs*sizeof(USHORT)) PVOID pvWidths, - ULONG cGlyphs - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMQueryAdvanceWidths() entry.\r\n")); - - pdevobj = (PDEVOBJ)dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv if this is not the font that OEM enumerated. - // - - return (((PFN_DrvQueryAdvanceWidths) - (poempdev->pfnUnidrv[UD_DrvQueryAdvanceWidths])) ( - dhpdev, - pfo, - iMode, - phg, - pvWidths, - cGlyphs)); - -} - -// -// OEMFontManagement -// - -ULONG APIENTRY -OEMFontManagement( - SURFOBJ *pso, - FONTOBJ *pfo, - ULONG iMode, - ULONG cjIn, - _In_reads_bytes_(cjIn) PVOID pvIn, - ULONG cjOut, - _Out_writes_bytes_(cjOut) PVOID pvOut - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMFontManagement() entry.\r\n")); - - // - // Note that Unidrv will not call OEM DLL for iMode==QUERYESCSUPPORT. - // So pso is not NULL for sure. - // - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv if this is not the font that OEM enumerated. - // - - return (((PFN_DrvFontManagement)(poempdev->pfnUnidrv[UD_DrvFontManagement])) ( - pso, - pfo, - iMode, - cjIn, - pvIn, - cjOut, - pvOut)); - -} - -// -// OEMGetGlyphMode -// - -ULONG APIENTRY -OEMGetGlyphMode( - DHPDEV dhpdev, - FONTOBJ *pfo - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMGetGlyphMode() entry.\r\n")); - - pdevobj = (PDEVOBJ)dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv if this is not the font that OEM enumerated. - // - - return (((PFN_DrvGetGlyphMode)(poempdev->pfnUnidrv[UD_DrvGetGlyphMode])) ( - dhpdev, - pfo)); - -} - -BOOL APIENTRY -OEMNextBand( - SURFOBJ *pso, - POINTL *pptl - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMNextBand() entry.\r\n")); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvNextBand)(poempdev->pfnUnidrv[UD_DrvNextBand])) ( - pso, - pptl)); - -} - -BOOL APIENTRY -OEMStartBanding( - SURFOBJ *pso, - POINTL *pptl - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMStartBanding() entry.\r\n")); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - POEMDEV pOemDevmode = (POEMDEV) pdevobj->pOEMDM; - if(pOemDevmode->bWmarkEnabled) - { - RenderWaterMark(pdevobj); - } - - // - // turn around to call Unidrv - // - - return (((PFN_DrvStartBanding)(poempdev->pfnUnidrv[UD_DrvStartBanding])) ( - pso, - pptl)); - - -} - -ULONG APIENTRY -OEMDitherColor( - DHPDEV dhpdev, - ULONG iMode, - ULONG rgbColor, - ULONG *pulDither - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMDitherColor() entry.\r\n")); - - pdevobj = (PDEVOBJ)dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvDitherColor)(poempdev->pfnUnidrv[UD_DrvDitherColor])) ( - dhpdev, - iMode, - rgbColor, - pulDither)); - -} - -BOOL APIENTRY -OEMPaint( - SURFOBJ *pso, - CLIPOBJ *pco, - BRUSHOBJ *pbo, - POINTL *pptlBrushOrg, - MIX mix - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMPaint() entry.\r\n")); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvPaint)(poempdev->pfnUnidrv[UD_DrvPaint])) ( - pso, - pco, - pbo, - pptlBrushOrg, - mix)); - -} - -BOOL APIENTRY -OEMLineTo( - SURFOBJ *pso, - CLIPOBJ *pco, - BRUSHOBJ *pbo, - LONG x1, - LONG y1, - LONG x2, - LONG y2, - RECTL *prclBounds, - MIX mix - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMLineTo() entry.\r\n")); - - pdevobj = (PDEVOBJ)pso->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvLineTo)(poempdev->pfnUnidrv[UD_DrvLineTo])) ( - pso, - pco, - pbo, - x1, - y1, - x2, - y2, - prclBounds, - mix)); - -} - - -// -// OEMStretchBltROP -// - -BOOL APIENTRY -OEMStretchBltROP( - SURFOBJ *psoDest, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - COLORADJUSTMENT *pca, - POINTL *pptlHTOrg, - RECTL *prclDest, - RECTL *prclSrc, - POINTL *pptlMask, - ULONG iMode, - BRUSHOBJ *pbo, - ROP4 rop4 - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMStretchBltROP() entry.\r\n")); - - pdevobj = (PDEVOBJ)psoDest->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvStretchBltROP)(poempdev->pfnUnidrv[UD_DrvStretchBltROP])) ( - psoDest, - psoSrc, - psoMask, - pco, - pxlo, - pca, - pptlHTOrg, - prclDest, - prclSrc, - pptlMask, - iMode, - pbo, - rop4 - )); - - -} - -// -// OEMPlgBlt -// - -BOOL APIENTRY -OEMPlgBlt( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - COLORADJUSTMENT *pca, - POINTL *pptlBrushOrg, - POINTFIX *pptfixDest, - RECTL *prclSrc, - POINTL *pptlMask, - ULONG iMode - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMPlgBlt() entry.\r\n")); - - pdevobj = (PDEVOBJ)psoDst->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvPlgBlt)(poempdev->pfnUnidrv[UD_DrvPlgBlt])) ( - psoDst, - psoSrc, - psoMask, - pco, - pxlo, - pca, - pptlBrushOrg, - pptfixDest, - prclSrc, - pptlMask, - iMode)); - -} - -// -// OEMAlphaBlend -// - -BOOL APIENTRY -OEMAlphaBlend( - SURFOBJ *psoDest, - SURFOBJ *psoSrc, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDest, - RECTL *prclSrc, - BLENDOBJ *pBlendObj - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMAlphaBlend() entry.\r\n")); - - pdevobj = (PDEVOBJ)psoDest->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvAlphaBlend)(poempdev->pfnUnidrv[UD_DrvAlphaBlend])) ( - psoDest, - psoSrc, - pco, - pxlo, - prclDest, - prclSrc, - pBlendObj - )); - -} - -// -// OEMGradientFill -// - -BOOL APIENTRY -OEMGradientFill( - SURFOBJ *psoDest, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - TRIVERTEX *pVertex, - ULONG nVertex, - PVOID pMesh, - ULONG nMesh, - RECTL *prclExtents, - POINTL *pptlDitherOrg, - ULONG ulMode - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMGradientFill() entry.\r\n")); - - pdevobj = (PDEVOBJ)psoDest->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvGradientFill)(poempdev->pfnUnidrv[UD_DrvGradientFill])) ( - psoDest, - pco, - pxlo, - pVertex, - nVertex, - pMesh, - nMesh, - prclExtents, - pptlDitherOrg, - ulMode - )); - -} - -BOOL APIENTRY -OEMTransparentBlt( - SURFOBJ *psoDst, - SURFOBJ *psoSrc, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDst, - RECTL *prclSrc, - ULONG iTransColor, - ULONG ulReserved - ) -{ - PDEVOBJ pdevobj; - POEMPDEV poempdev; - - VERBOSE(DLLTEXT("OEMTransparentBlt() entry.\r\n")); - - pdevobj = (PDEVOBJ)psoDst->dhpdev; - poempdev = (POEMPDEV)pdevobj->pdevOEM; - - // - // turn around to call Unidrv - // - - return (((PFN_DrvTransparentBlt)(poempdev->pfnUnidrv[UD_DrvTransparentBlt])) ( - psoDst, - psoSrc, - pco, - pxlo, - prclDst, - prclSrc, - iTransColor, - ulReserved - )); - -} - -void RenderWaterMark(PDEVOBJ pdevobj) -{ - POEMDEV pOemDevmode = (POEMDEV) pdevobj->pOEMDM; - // We have a programmable palette. See GPD file for PaletteProgrammable option. - // We are programming color index 8 to the new color and selectiing it with the PJL code "\xv%da%db%dc8I\xib*v8S". - // In the font selection code, we are selecting the arial font (4148)"\x1b(19U\x1b(s4148t0b0s%dv1P" - // Cursor position is hard coded to but you it can also be made dependent on user input. - // PCL5 can print in 0,90,180 and 270 degrees. So Vertical can also be supported. - // The \x1b*v7S after the watermark sets the foreground color back to black - - /* - //Note we can push and pop the cursor position if needed. - Push/Pop Cursor position - \x1b&f0S //push - \x1b&f1S //pop - */ - - PSTR pszBuffer = NULL; - char str_wmark[]="\x1b*v%da%db%dc8I\x1b*v8S\x1b(19U\x1b(s4148t0b0s%dv1P\x1b*p1000Y\x1b*p750X%ls\x1b*v7S"; - DWORD dwLen= FormatResource (str_wmark, - &pszBuffer, - GetRValue(pOemDevmode->crWmarkTextColor), - GetGValue(pOemDevmode->crWmarkTextColor), - GetBValue(pOemDevmode->crWmarkTextColor), - pOemDevmode->dwWmarkFontSize,pOemDevmode->szWaterMark); - - if ( dwLen != 0 ) - { - pdevobj->pDrvProcs->DrvWriteSpoolBuf(pdevobj, pszBuffer, dwLen); - } - - if ( pszBuffer ) - { - delete[]pszBuffer; - pszBuffer = NULL; - } -} - - -DWORD -FormatResource( - _In_ LPSTR pszResource, - _Out_ LPSTR *ppszBuffer, - ...) -{ - DWORD dwBufferSize = 0; - DWORD dwLoop = 0; - va_list vaList; - HRESULT hResult = S_OK; - - if ( NULL == pszResource || - NULL == ppszBuffer ) - { - hResult = E_INVALIDARG; - return 0; - } - - - if ( SUCCEEDED(hResult) ) - { - dwBufferSize = (DWORD)strlen(pszResource) + MAX_PATH; - - va_start(vaList, ppszBuffer); - - // *ppszBuffer should be NULL when passed in. - *ppszBuffer = NULL; - - // Allocate and format the string. - do { - - if(NULL != *ppszBuffer) - { - delete[] *ppszBuffer; - } - *ppszBuffer = new CHAR[dwBufferSize]; - if(NULL == *ppszBuffer) - { - hResult = E_OUTOFMEMORY; - goto Cleanup; - } - - hResult = StringCbVPrintfA(*ppszBuffer, dwBufferSize, pszResource, vaList); - - if(STRSAFE_E_INSUFFICIENT_BUFFER == hResult) - { - dwBufferSize *= 2; - } - - } while ( FAILED(hResult) && (dwLoop++ < MAX_LOOP)); - } - -Cleanup: - - // Check to see if we hit error. - if(FAILED(hResult)) - { - if(NULL != *ppszBuffer) - { - delete[] *ppszBuffer; - *ppszBuffer = NULL; - } - } - - va_end(vaList); - - if ( *ppszBuffer ) - { - DWORD dwToReturn = 0; - - if (SUCCEEDED(SIZETToDWord(strlen(*ppszBuffer), &dwToReturn))) - { - return dwToReturn; - } - } - return 0; -} diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/dllentry.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/dllentry.cpp deleted file mode 100644 index 5230f243..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/dllentry.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: dllentry.cpp -// -// PURPOSE: Source module for DLL entry function(s). -// - -#include "precomp.h" -#include "wmarkuni.h" -#include "debug.h" - -// indicate to prefast that this is a user-mode component. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -/////////////////////////////////////////////////////////// -// -// DLL entry point -// -BOOL WINAPI DllMain(HINSTANCE hInst, WORD wReason, LPVOID lpReserved) -{ - UNREFERENCED_PARAMETER(hInst); - UNREFERENCED_PARAMETER(lpReserved); - - switch(wReason) - { - case DLL_PROCESS_ATTACH: - VERBOSE(DLLTEXT("Process attach.\r\n")); - break; - - case DLL_THREAD_ATTACH: - VERBOSE(DLLTEXT("Thread attach.\r\n")); - break; - - case DLL_PROCESS_DETACH: - VERBOSE(DLLTEXT("Process detach.\r\n")); - break; - - case DLL_THREAD_DETACH: - VERBOSE(DLLTEXT("Thread detach.\r\n")); - break; - } - - return TRUE; -} - - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/fdevmode.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/fdevmode.cpp deleted file mode 100644 index c32e0bcb..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/fdevmode.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: fDevmode.cpp -// -// -// PURPOSE: Place holder file for devmode functions. -// - -#include "precomp.h" -#include "wmarkuni.h" - -// indicate to prefast that this is a user-mode component. -_Analysis_mode_(_Analysis_code_type_user_driver_); - - -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/intrface.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/intrface.cpp deleted file mode 100644 index 5688cb8d..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/intrface.cpp +++ /dev/null @@ -1,950 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.cpp -// -// -// PURPOSE: Interface for User Mode COM Customization DLL. -// - -#include "precomp.h" - -#include "wmarkuni.h" -#include "debug.h" -#include "intrface.h" -#include "name.h" - -// indicate to prefast that this is a user-mode component. -_Analysis_mode_(_Analysis_code_type_user_driver_); - -//////////////////////////////////////////////////////// -// Internal Globals -//////////////////////////////////////////////////////// - -static long g_cComponents = 0; // Count of active components -static long g_cServerLocks = 0; // Count of locks - -//////////////////////////////////////////////////////// -// Internal Constants -//////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////// -// Warning: the following array order must match the -// order in enum ENUMHOOKS. -/////////////////////////////////////////////////////// - -static const DRVFN OEMHookFuncs[] = -{ - { INDEX_DrvRealizeBrush, (PFN) OEMRealizeBrush }, - { INDEX_DrvDitherColor, (PFN) OEMDitherColor }, - { INDEX_DrvCopyBits, (PFN) OEMCopyBits }, - { INDEX_DrvBitBlt, (PFN) OEMBitBlt }, - { INDEX_DrvStretchBlt, (PFN) OEMStretchBlt }, - { INDEX_DrvTextOut, (PFN) OEMTextOut }, - { INDEX_DrvStrokePath, (PFN) OEMStrokePath }, - { INDEX_DrvFillPath, (PFN) OEMFillPath }, - { INDEX_DrvStrokeAndFillPath, (PFN) OEMStrokeAndFillPath }, - { INDEX_DrvPaint, (PFN) OEMPaint }, - { INDEX_DrvLineTo, (PFN) OEMLineTo }, - { INDEX_DrvStartPage, (PFN) OEMStartPage }, - { INDEX_DrvSendPage, (PFN) OEMSendPage }, - { INDEX_DrvEscape, (PFN) OEMEscape }, - { INDEX_DrvStartDoc, (PFN) OEMStartDoc }, - { INDEX_DrvEndDoc, (PFN) OEMEndDoc }, - { INDEX_DrvNextBand, (PFN) OEMNextBand }, - { INDEX_DrvStartBanding, (PFN) OEMStartBanding }, - { INDEX_DrvQueryFont, (PFN) OEMQueryFont }, - { INDEX_DrvQueryFontTree, (PFN) OEMQueryFontTree }, - { INDEX_DrvQueryFontData, (PFN) OEMQueryFontData }, - { INDEX_DrvQueryAdvanceWidths, (PFN) OEMQueryAdvanceWidths }, - { INDEX_DrvFontManagement, (PFN) OEMFontManagement }, - { INDEX_DrvGetGlyphMode, (PFN) OEMGetGlyphMode }, - { INDEX_DrvStretchBltROP, (PFN) OEMStretchBltROP }, - { INDEX_DrvPlgBlt, (PFN) OEMPlgBlt }, - { INDEX_DrvTransparentBlt, (PFN) OEMTransparentBlt }, - { INDEX_DrvAlphaBlend, (PFN) OEMAlphaBlend }, - { INDEX_DrvGradientFill, (PFN) OEMGradientFill }, -}; - -//////////////////////////////////////////////////////////////////////////////// -// -// IWmarkUni body -// -IWmarkUni::~IWmarkUni() -{ - // Make sure that helper interface is released. - if(NULL != m_pOEMHelp) - { - m_pOEMHelp->Release(); - m_pOEMHelp = NULL; - } - - // If this instance of the object is being deleted, then the reference - // count should be zero. - assert(0 == m_cRef); -} - - -HRESULT __stdcall IWmarkUni::QueryInterface(const IID& iid, void** ppv) -{ - if (iid == IID_IUnknown) - { - *ppv = static_cast(this); - VERBOSE(DLLTEXT("IWmarkUni::QueryInterface IUnknown.\r\n")); - } - else if (iid == IID_IPrintOemUni) - { - *ppv = static_cast(this); - VERBOSE(DLLTEXT("IWmarkUni::QueryInterface IPrintOemUni.\r\n")); - } - else - { - *ppv = NULL; - VERBOSE(DLLTEXT("IWmarkUni::QueryInterface interface not supported.\r\n")); - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -ULONG __stdcall IWmarkUni::AddRef() -{ - VERBOSE(DLLTEXT("IWmarkUni::AddRef() entry.\r\n")); - return InterlockedIncrement(&m_cRef); -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IWmarkUni::Release() -{ - VERBOSE(DLLTEXT("IWmarkUni::Release() entry.\r\n")); - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - - -HRESULT __stdcall IWmarkUni::GetInfo ( - DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded) -{ - VERBOSE(DLLTEXT("IWmarkUni::GetInfo entry.\r\n")); - - // Validate parameters. - if( (NULL == pcbNeeded) - || - ( (OEMGI_GETSIGNATURE != dwMode) - && - (OEMGI_GETVERSION != dwMode) - && - (OEMGI_GETPUBLISHERINFO != dwMode) - ) - ) - { - WARNING(DLLTEXT("IWmarkUni::GetInfo() exit pcbNeeded is NULL! ERROR_INVALID_PARAMETER.\r\n")); - SetLastError(ERROR_INVALID_PARAMETER); - return E_FAIL; - } - - // Set expected buffer size. - if(OEMGI_GETPUBLISHERINFO != dwMode) - { - *pcbNeeded = sizeof(DWORD); - } - else - { - *pcbNeeded = sizeof(PUBLISHERINFO); - return E_FAIL; - } - - // Check buffer size is sufficient. - if((cbSize < *pcbNeeded) || (NULL == pBuffer)) - { - VERBOSE(DLLTEXT("IWmarkUni::GetInfo() exit insufficient buffer!\r\n")); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return E_FAIL; - } - - switch(dwMode) - { - // OEM DLL Signature - case OEMGI_GETSIGNATURE: - *(PDWORD)pBuffer = OEM_SIGNATURE; - break; - - // OEM DLL version - case OEMGI_GETVERSION: - *(PDWORD)pBuffer = OEM_VERSION; - break; - - // dwMode not supported. - case OEMGI_GETPUBLISHERINFO: - default: - // Set written bytes to zero since nothing was written. - WARNING(DLLTEXT("IWmarkUni::GetInfo() exit mode not supported.\r\n")); - *pcbNeeded = 0; - SetLastError(ERROR_NOT_SUPPORTED); - return E_FAIL; - } - - VERBOSE(DLLTEXT("IWmarkUni::GetInfo() exit S_OK.\r\n")); - - return S_OK; -} - -HRESULT __stdcall IWmarkUni::PublishDriverInterface( - IUnknown *pIUnknown) -{ - VERBOSE(DLLTEXT("IWmarkUni::PublishDriverInterface() entry.\r\n")); - - // Need to store pointer to Driver Helper functions, if we already haven't. - if (this->m_pOEMHelp == NULL) - { - HRESULT hResult; - - - // Get Interface to Helper Functions. - hResult = pIUnknown->QueryInterface(IID_IPrintOemDriverUni, (void** ) &(this->m_pOEMHelp)); - - if(!SUCCEEDED(hResult)) - { - // Make sure that interface pointer reflects interface query failure. - this->m_pOEMHelp = NULL; - - return E_FAIL; - } - } - - return S_OK; -} - - -HRESULT __stdcall IWmarkUni::EnableDriver( - DWORD dwDriverVersion, - DWORD cbSize, - PDRVENABLEDATA pded) -{ - VERBOSE(DLLTEXT("IWmarkUni::EnableDriver() entry.\r\n")); - - UNREFERENCED_PARAMETER(dwDriverVersion); - UNREFERENCED_PARAMETER(cbSize); - - // List DDI functions that are hooked. - pded->iDriverVersion = PRINTER_OEMINTF_VERSION; - pded->c = sizeof(OEMHookFuncs) / sizeof(DRVFN); - pded->pdrvfn = (DRVFN *) OEMHookFuncs; - - // Even if nothing is done, need to return S_OK so - // that DisableDriver() will be called, which releases - // the reference to the Printer Driver's interface. - // If error occurs, return E_FAIL. - return S_OK; -} - -HRESULT __stdcall IWmarkUni::DisableDriver(VOID) -{ - VERBOSE(DLLTEXT("IWmarkUni::DisaleDriver() entry.\r\n")); - - // Release reference to Printer Driver's interface. - if (this->m_pOEMHelp) - { - this->m_pOEMHelp->Release(); - this->m_pOEMHelp = NULL; - } - - return S_OK; -} - -HRESULT __stdcall IWmarkUni::DisablePDEV( - PDEVOBJ pdevobj) -{ - VERBOSE(DLLTEXT("IWmarkUni::DisablePDEV() entry.\r\n")); - - assert(NULL != pdevobj->pdevOEM); - delete pdevobj->pdevOEM; - - return S_OK; -}; - -HRESULT __stdcall IWmarkUni::EnablePDEV( - PDEVOBJ pdevobj, - _In_ PWSTR pPrinterName, - ULONG cPatterns, - HSURF *phsurfPatterns, - ULONG cjGdiInfo, - GDIINFO *pGdiInfo, - ULONG cjDevInfo, - DEVINFO *pDevInfo, - DRVENABLEDATA *pded, - OUT PDEVOEM *pDevOem) -{ - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pPrinterName); - UNREFERENCED_PARAMETER(cPatterns); - UNREFERENCED_PARAMETER(phsurfPatterns); - UNREFERENCED_PARAMETER(cjGdiInfo); - UNREFERENCED_PARAMETER(pGdiInfo); - UNREFERENCED_PARAMETER(cjDevInfo); - UNREFERENCED_PARAMETER(pDevInfo); - - VERBOSE(DLLTEXT("IWmarkUni::EnablePDEV() entry.\r\n")); - - POEMPDEV poempdev; - INT i, j; - DWORD dwDDIIndex; - PDRVFN pdrvfn; - - // - // Allocate the OEMDev - // - poempdev = new OEMPDEV; - if (NULL == poempdev) - { - return NULL; - } - - // - // Fill in OEMDEV - // - - for (i = 0; i < MAX_DDI_HOOKS; i++) - { - // - // search through Unidrv's hooks and locate the function ptr - // - dwDDIIndex = OEMHookFuncs[i].iFunc; - for (j = pded->c, pdrvfn = pded->pdrvfn; j > 0; j--, pdrvfn++) - { - if (dwDDIIndex == pdrvfn->iFunc) - { - poempdev->pfnUnidrv[i] = pdrvfn->pfn; - break; - } - } - if (j == 0) - { - // - // Didn't find the hook. This could mean Unidrv doesn't hook this DDI but allows OEMs to hook it out. - // - poempdev->pfnUnidrv[i] = NULL; - } - - } - - *pDevOem = (POEMPDEV) poempdev; - - return (NULL != *pDevOem ? S_OK : E_FAIL); -} - - -HRESULT __stdcall IWmarkUni::ResetPDEV( - PDEVOBJ pdevobjOld, - PDEVOBJ pdevobjNew) -{ - VERBOSE(DLLTEXT("IWmarkUni::ResetPDEV() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobjOld); - UNREFERENCED_PARAMETER(pdevobjNew); - - return S_OK; -} - - -HRESULT __stdcall IWmarkUni::DevMode( - DWORD dwMode, - POEMDMPARAM pOemDMParam) -{ - VERBOSE(DLLTEXT("IWmarkUni:DevMode entry.\n")); - return hrOEMDevMode(dwMode, pOemDMParam); -} - -HRESULT __stdcall IWmarkUni::GetImplementedMethod(_In_ PSTR pMethodName) -{ - HRESULT Result = S_FALSE; - - - VERBOSE(DLLTEXT("IWmarkUni::GetImplementedMethod() entry.\r\n")); - - // Unidrv only calls GetImplementedMethod for optional - // methods. The required methods are assumed to be - // supported. - - // Return S_OK for supported function (i.e. implemented), - // and S_FALSE for functions that aren't supported (i.e. not implemented). - switch (*pMethodName) - { - case 'C': - if (!strcmp(NAME_CommandCallback, pMethodName)) - { - Result = S_OK; - } - else if (!strcmp(NAME_Compression, pMethodName)) - { - Result = S_FALSE; - } - break; - - case 'D': - if (!strcmp(NAME_DownloadFontHeader, pMethodName)) - { - Result = S_FALSE; - } - else if (!strcmp(NAME_DownloadCharGlyph, pMethodName)) - { - Result = S_FALSE; - } - break; - - case 'F': - if (!strcmp(NAME_FilterGraphics, pMethodName)) - { - Result = S_OK; - } - break; - - case 'H': - if (!strcmp(NAME_HalftonePattern, pMethodName)) - { - Result = S_FALSE; - } - break; - - case 'I': - if (!strcmp(NAME_ImageProcessing, pMethodName)) - { - Result = S_OK; - } - break; - - case 'M': - if (!strcmp(NAME_MemoryUsage, pMethodName)) - { - Result = S_FALSE; - } - break; - - case 'O': - if (!strcmp(NAME_OutputCharStr, pMethodName)) - { - Result = S_FALSE; - } - break; - - case 'S': - if (!strcmp(NAME_SendFontCmd, pMethodName)) - { - Result = S_FALSE; - } - break; - - case 'T': - if (!strcmp(NAME_TextOutAsBitmap, pMethodName)) - { - Result = S_FALSE; - } - else if (!strcmp(NAME_TTDownloadMethod, pMethodName)) - { - Result = S_FALSE; - } - else if (!strcmp(NAME_TTYGetInfo, pMethodName)) - { - Result = S_FALSE; - } - break; - - case 'W': - if(!strcmp(NAME_WritePrinter, pMethodName)) - { - Result = S_FALSE; - } - break; - } - - return Result; -} - -HRESULT __stdcall IWmarkUni::CommandCallback( - PDEVOBJ pdevobj, - DWORD dwCallbackID, - DWORD dwCount, - PDWORD pdwParams, - OUT INT *piResult) -{ - VERBOSE(DLLTEXT("IWmarkUni::CommandCallback() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(dwCallbackID); - UNREFERENCED_PARAMETER(dwCount); - UNREFERENCED_PARAMETER(pdwParams); - - *piResult = 0; - - return S_OK; -} - -HRESULT __stdcall IWmarkUni::ImageProcessing( - PDEVOBJ pdevobj, - PBYTE pSrcBitmap, - PBITMAPINFOHEADER pBitmapInfoHeader, - PBYTE pColorTable, - DWORD dwCallbackID, - PIPPARAMS pIPParams, - OUT PBYTE *ppbResult) -{ - VERBOSE(DLLTEXT("IWmarkUni::ImageProcessing() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pSrcBitmap); - UNREFERENCED_PARAMETER(pBitmapInfoHeader); - UNREFERENCED_PARAMETER(pColorTable); - UNREFERENCED_PARAMETER(dwCallbackID); - UNREFERENCED_PARAMETER(pIPParams); - UNREFERENCED_PARAMETER(ppbResult); - - return S_OK; -} - -HRESULT __stdcall IWmarkUni::FilterGraphics( - PDEVOBJ pdevobj, - PBYTE pBuf, - DWORD dwLen) -{ - DWORD dwResult; - VERBOSE(DLLTEXT("IWmarkUni::FilterGraphis() entry.\r\n")); - m_pOEMHelp->DrvWriteSpoolBuf(pdevobj, pBuf, dwLen, &dwResult); - - if (dwResult == dwLen) - return S_OK; - else - return E_FAIL; -} - -HRESULT __stdcall IWmarkUni::Compression( - PDEVOBJ pdevobj, - PBYTE pInBuf, - PBYTE pOutBuf, - DWORD dwInLen, - DWORD dwOutLen, - OUT INT *piResult) -{ - VERBOSE(DLLTEXT("IWmarkUni::Compression() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pInBuf); - UNREFERENCED_PARAMETER(pOutBuf); - UNREFERENCED_PARAMETER(dwInLen); - UNREFERENCED_PARAMETER(dwOutLen); - UNREFERENCED_PARAMETER(piResult); - - // When implemented, the return from GetImplementedMethod - // for this method name must be S_OK. - - return E_NOTIMPL; -} - - -HRESULT __stdcall IWmarkUni::HalftonePattern( - PDEVOBJ pdevobj, - PBYTE pHTPattern, - DWORD dwHTPatternX, - DWORD dwHTPatternY, - DWORD dwHTNumPatterns, - DWORD dwCallbackID, - PBYTE pResource, - DWORD dwResourceSize) -{ - VERBOSE(DLLTEXT("IWmarkUni::HalftonePattern() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pHTPattern); - UNREFERENCED_PARAMETER(dwHTPatternX); - UNREFERENCED_PARAMETER(dwHTPatternY); - UNREFERENCED_PARAMETER(dwHTNumPatterns); - UNREFERENCED_PARAMETER(dwCallbackID); - UNREFERENCED_PARAMETER(pResource); - UNREFERENCED_PARAMETER(dwResourceSize); - - // When implemented, the return from GetImplementedMethod - // for this method name must be S_OK. - - return E_NOTIMPL; -} - -HRESULT __stdcall IWmarkUni::MemoryUsage( - PDEVOBJ pdevobj, - POEMMEMORYUSAGE pMemoryUsage) -{ - VERBOSE(DLLTEXT("IWmarkUni::MemoryUsage() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pMemoryUsage); - - // When implemented, the return from GetImplementedMethod - // for this method name must be S_OK. - - return E_NOTIMPL; -} - -HRESULT __stdcall IWmarkUni::DownloadFontHeader( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult) -{ - VERBOSE(DLLTEXT("IWmarkUni::DownloadFontHeader() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(pdwResult); - - // When implemented, the return from GetImplementedMethod - // for this method name must be S_OK. - - return E_NOTIMPL; -} - -HRESULT __stdcall IWmarkUni::DownloadCharGlyph( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - HGLYPH hGlyph, - PDWORD pdwWidth, - OUT DWORD *pdwResult) -{ - VERBOSE(DLLTEXT("IWmarkUni::DownloadCharGlyph() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(hGlyph); - UNREFERENCED_PARAMETER(pdwWidth); - UNREFERENCED_PARAMETER(pdwResult); - - // When implemented, the return from GetImplementedMethod - // for this method name must be S_OK. - - return E_NOTIMPL; -} - -HRESULT __stdcall IWmarkUni::TTDownloadMethod( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult) -{ - VERBOSE(DLLTEXT("IWmarkUni::TTDownloadMethod() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(pdwResult); - - // When implemented, the return from GetImplementedMethod - // for this method name must be S_OK. - - return E_NOTIMPL; -} - -HRESULT __stdcall IWmarkUni::OutputCharStr( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - DWORD dwType, - DWORD dwCount, - PVOID pGlyph) -{ - VERBOSE(DLLTEXT("IWmarkUni::OutputCharStr() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(dwType); - UNREFERENCED_PARAMETER(dwCount); - UNREFERENCED_PARAMETER(pGlyph); - - // When implemented, the return from GetImplementedMethod - // for this method name must be S_OK. - - return E_NOTIMPL; -} - -HRESULT __stdcall IWmarkUni::SendFontCmd( - PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - PFINVOCATION pFInv) -{ - VERBOSE(DLLTEXT("IWmarkUni::SendFontCmd() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(pUFObj); - UNREFERENCED_PARAMETER(pFInv); - - // When implemented, the return from GetImplementedMethod - // for this method name must be S_OK. - - return E_NOTIMPL; -} - -HRESULT __stdcall IWmarkUni::DriverDMS( - PVOID pDevObj, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded) -{ - VERBOSE(DLLTEXT("IWmarkUni::DriverDMS() entry.\r\n")); - - UNREFERENCED_PARAMETER(pDevObj); - UNREFERENCED_PARAMETER(pBuffer); - UNREFERENCED_PARAMETER(cbSize); - UNREFERENCED_PARAMETER(pcbNeeded); - - return E_NOTIMPL; -} - -HRESULT __stdcall IWmarkUni::TextOutAsBitmap( - SURFOBJ *pso, - STROBJ *pstro, - FONTOBJ *pfo, - CLIPOBJ *pco, - RECTL *prclExtra, - RECTL *prclOpaque, - BRUSHOBJ *pboFore, - BRUSHOBJ *pboOpaque, - POINTL *pptlOrg, - MIX mix) -{ - VERBOSE(DLLTEXT("IWmarkUni::TextOutAsBitmap() entry.\r\n")); - - UNREFERENCED_PARAMETER(pso); - UNREFERENCED_PARAMETER(pstro); - UNREFERENCED_PARAMETER(pfo); - UNREFERENCED_PARAMETER(pco); - UNREFERENCED_PARAMETER(prclExtra); - UNREFERENCED_PARAMETER(prclOpaque); - UNREFERENCED_PARAMETER(pboFore); - UNREFERENCED_PARAMETER(pboOpaque); - UNREFERENCED_PARAMETER(pptlOrg); - UNREFERENCED_PARAMETER(mix); - - // When implemented, the return from GetImplementedMethod - // for this method name must be S_OK. - - return E_NOTIMPL; -} - -HRESULT __stdcall IWmarkUni::TTYGetInfo( - PDEVOBJ pdevobj, - DWORD dwInfoIndex, - PVOID pOutputBuf, - DWORD dwSize, - DWORD *pcbcNeeded) -{ - VERBOSE(DLLTEXT("IWmarkUni::TTYGetInfo() entry.\r\n")); - - UNREFERENCED_PARAMETER(pdevobj); - UNREFERENCED_PARAMETER(dwInfoIndex); - UNREFERENCED_PARAMETER(pOutputBuf); - UNREFERENCED_PARAMETER(dwSize); - UNREFERENCED_PARAMETER(pcbcNeeded); - - // When implemented, the return from GetImplementedMethod - // for this method name must be S_OK. - - return E_NOTIMPL; -} - - -//////////////////////////////////////////////////////////////////////////////// -// -// oem class factory -// -class IOemCF : public IClassFactory -{ -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // *** IClassFactory methods *** - STDMETHOD(CreateInstance) (THIS_ - LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID FAR* ppvObject); - STDMETHOD(LockServer) (THIS_ BOOL bLock); - - - // Constructor - IOemCF(): m_cRef(1) { }; - ~IOemCF() { }; - -protected: - LONG m_cRef; - -}; - -/////////////////////////////////////////////////////////// -// -// Class factory body -// -HRESULT __stdcall IOemCF::QueryInterface(const IID& iid, void** ppv) -{ - if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) - { - *ppv = static_cast(this); - } - else - { - *ppv = NULL; - VERBOSE(DLLTEXT("IOemCF::QueryInterface interface not supported.\r\n")); - return E_NOINTERFACE; - } - reinterpret_cast(*ppv)->AddRef(); - return S_OK; -} - -ULONG __stdcall IOemCF::AddRef() -{ - return InterlockedIncrement(&m_cRef); -} - -_At_(this, __drv_freesMem(object)) -ULONG __stdcall IOemCF::Release() -{ - ASSERT( 0 != m_cRef); - ULONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) - { - delete this; - - } - return cRef; -} - -// IClassFactory implementation -HRESULT __stdcall IOemCF::CreateInstance(IUnknown* pUnknownOuter, - const IID& iid, - void** ppv) -{ - //VERBOSE(DLLTEXT("Class factory:\t\tCreate component.")); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Cannot aggregate. - if (pUnknownOuter != NULL) - { - return CLASS_E_NOAGGREGATION; - } - - // Create component. - IWmarkUni* pOemCP = new IWmarkUni; - if (pOemCP == NULL) - { - return E_OUTOFMEMORY; - } - - // Get the requested interface. - HRESULT hr = pOemCP->QueryInterface(iid, ppv); - - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - pOemCP->Release(); - return hr; -} - -// LockServer -HRESULT __stdcall IOemCF::LockServer(BOOL bLock) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks); - } - else - { - InterlockedDecrement(&g_cServerLocks); - } - return S_OK; -} - - -// -// Registration functions -// - -// -// Can DLL unload now? -// -STDAPI DllCanUnloadNow() -{ - // - // To avoid leaving OEM DLL still in memory when Unidrv or Pscript drivers - // are unloaded, Unidrv and Pscript driver ignore the return value of - // DllCanUnloadNow of the OEM DLL, and always call FreeLibrary on the OEMDLL. - // - // If OEM DLL spins off a working thread that also uses the OEM DLL, the - // thread needs to call LoadLibrary and FreeLibraryAndExitThread, otherwise - // it may crash after Unidrv or Pscript calls FreeLibrary. - // - - VERBOSE(DLLTEXT("DllCanUnloadNow entered.\r\n")); - - if ((g_cComponents == 0) && (g_cServerLocks == 0)) - { - return S_OK; - } - else - { - return S_FALSE; - } -} - -// -// Get class factory -// -STDAPI DllGetClassObject( - _In_ REFCLSID clsid, - _In_ REFIID iid, - _Outptr_ LPVOID* ppv) -{ - VERBOSE(DLLTEXT("DllGetClassObject:\tCreate class factory.\r\n")); - - if (ppv == NULL) - { - return E_POINTER; - } - *ppv = NULL; - - // Can we create this component? - if (clsid != CLSID_OEMRENDER) - { - return CLASS_E_CLASSNOTAVAILABLE; - } - - // Create class factory. - IOemCF* pFontCF = new IOemCF; // Reference count set to 1 - // in constructor - if (pFontCF == NULL) - { - return E_OUTOFMEMORY; - } - - // Get requested interface. - HRESULT hr = pFontCF->QueryInterface(iid, ppv); - pFontCF->Release(); - - return hr; -} - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/intrface.h b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/intrface.h deleted file mode 100644 index a87f5ba4..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/intrface.h +++ /dev/null @@ -1,254 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Intrface.H -// -// -// PURPOSE: Define COM interface for User Mode Printer Customization DLL. -// -#pragma once - - -//////////////////////////////////////////////////////////////////////////////// -// -// IWmarkUni -// -// Interface for Unidrv OEM sample rendering module -// -class IWmarkUni : public IPrintOemUni -{ -public: -public: - // *** IUnknown methods *** - - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj); - - STDMETHOD_(ULONG,AddRef) (THIS); - - // the _At_ tag here tells prefast that once release - // is called, the memory should not be considered leaked - _At_(this, __drv_freesMem(object)) - STDMETHOD_(ULONG,Release) (THIS); - - // - // Method for publishing Driver interface. - // - STDMETHOD(PublishDriverInterface)(THIS_ IUnknown *pIUnknown); - - // - // Method for getting the implemented methods. - // Returns S_OK if the given method is implemneted. - // Returns S_FALSE if the given method is notimplemneted. - // - - STDMETHOD(GetImplementedMethod)(THIS_ _In_ PSTR pMethodName); - - // - // Method for OEM to specify DDI hook out - // - - STDMETHOD(EnableDriver) (THIS_ DWORD DriverVersion, - DWORD cbSize, - PDRVENABLEDATA pded); - - // - // Method to notify OEM plugin that it is no longer required - // - - STDMETHOD(DisableDriver) (THIS); - - // - // Method for OEM to contruct its own PDEV - // - - STDMETHOD(EnablePDEV) (THIS_ PDEVOBJ pdevobj, - _In_ PWSTR pPrinterName, - ULONG cPatterns, - HSURF *phsurfPatterns, - ULONG cjGdiInfo, - GDIINFO *pGdiInfo, - ULONG cjDevInfo, - DEVINFO *pDevInfo, - DRVENABLEDATA *pded, - OUT PDEVOEM *pDevOem); - - // - // Method for OEM to free any resource associated with its PDEV - // - - STDMETHOD(DisablePDEV) (THIS_ PDEVOBJ pdevobj); - - // - // Method for OEM to transfer from old PDEV to new PDEV - // - - STDMETHOD(ResetPDEV) (THIS_ PDEVOBJ pdevobjOld, - PDEVOBJ pdevobjNew); - - // - // Get OEM dll related information - // - - STDMETHOD(GetInfo) (THIS_ DWORD dwMode, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDriverDMS - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(DriverDMS)(THIS_ PVOID pDevObj, - PVOID pBuffer, - DWORD cbSize, - PDWORD pcbNeeded); - - // - // OEMDevMode - // - - STDMETHOD(DevMode) (THIS_ DWORD dwMode, - POEMDMPARAM pOemDMParam); - - // - // OEMCommandCallback - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(CommandCallback)(THIS_ PDEVOBJ pdevobj, - DWORD dwCallbackID, - DWORD dwCount, - PDWORD pdwParams, - OUT INT *piResult); - - // - // OEMImageProcessing - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(ImageProcessing)(THIS_ PDEVOBJ pdevobj, - PBYTE pSrcBitmap, - PBITMAPINFOHEADER pBitmapInfoHeader, - PBYTE pColorTable, - DWORD dwCallbackID, - PIPPARAMS pIPParams, - OUT PBYTE *ppbResult); - - // - // OEMFilterGraphics - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(FilterGraphics) (THIS_ PDEVOBJ pdevobj, - PBYTE pBuf, - DWORD dwLen); - // - // OEMCompression - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(Compression)(THIS_ PDEVOBJ pdevobj, - PBYTE pInBuf, - PBYTE pOutBuf, - DWORD dwInLen, - DWORD dwOutLen, - OUT INT *piResult); - - // - // OEMHalftone - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(HalftonePattern) (THIS_ PDEVOBJ pdevobj, - PBYTE pHTPattern, - DWORD dwHTPatternX, - DWORD dwHTPatternY, - DWORD dwHTNumPatterns, - DWORD dwCallbackID, - PBYTE pResource, - DWORD dwResourceSize); - - // - // OEMMemoryUsage - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(MemoryUsage) (THIS_ PDEVOBJ pdevobj, - POEMMEMORYUSAGE pMemoryUsage); - - // - // OEMTTYGetInfo - UNIDRV only, return E_NOTIMPL on Pscript - // - - STDMETHOD(TTYGetInfo)(THIS_ PDEVOBJ pdevobj, - DWORD dwInfoIndex, - PVOID pOutputBuf, - DWORD dwSize, - DWORD *pcbcNeeded); - - // - // OEMDownloadFontheader - UNIDRV only - // - - STDMETHOD(DownloadFontHeader)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult); - - // - // OEMDownloadCharGlyph - UNIDRV only - // - - STDMETHOD(DownloadCharGlyph)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - HGLYPH hGlyph, - PDWORD pdwWidth, - OUT DWORD *pdwResult); - - // - // OEMTTDownloadMethod - UNIDRV only - // - - STDMETHOD(TTDownloadMethod)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - OUT DWORD *pdwResult); - - // - // OEMOutputCharStr - UNIDRV only - // - - STDMETHOD(OutputCharStr)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - DWORD dwType, - DWORD dwCount, - PVOID pGlyph); - - // - // OEMSendFontCmd - UNIDRV only - // - - - STDMETHOD(SendFontCmd)(THIS_ PDEVOBJ pdevobj, - PUNIFONTOBJ pUFObj, - PFINVOCATION pFInv); - - // - // OEMTextOutAsBitmap - UNIDRV only - // - - STDMETHOD(TextOutAsBitmap)(THIS_ SURFOBJ *pso, - STROBJ *pstro, - FONTOBJ *pfo, - CLIPOBJ *pco, - RECTL *prclExtra, - RECTL *prclOpaque, - BRUSHOBJ *pboFore, - BRUSHOBJ *pboOpaque, - POINTL *pptlOrg, - MIX mix); - - - IWmarkUni() { m_cRef = 1; m_pOEMHelp = NULL; }; - ~IWmarkUni(); - -protected: - LONG m_cRef; - IPrintOemDriverUni* m_pOEMHelp; -}; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/name.h b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/name.h deleted file mode 100644 index 3018823b..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/name.h +++ /dev/null @@ -1,34 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1996 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: Name.H -// -// -// PURPOSE: Define string literals for interface funcion names. -// -#pragma once - -///////////////////////////////////////////////////////// -// String Leterals -///////////////////////////////////////////////////////// - - -CONST CHAR NAME_CommandCallback[] = "CommandCallback"; -CONST CHAR NAME_Compression[] = "Compression"; -CONST CHAR NAME_DownloadCharGlyph[] = "DownloadCharGlyph"; -CONST CHAR NAME_DownloadFontHeader[] = "DownloadFontHeader"; -CONST CHAR NAME_FilterGraphics[] = "FilterGraphics"; -CONST CHAR NAME_HalftonePattern[] = "HalftonePattern"; -CONST CHAR NAME_ImageProcessing[] = "ImageProcessing"; -CONST CHAR NAME_MemoryUsage[] = "MemoryUsage"; -CONST CHAR NAME_OutputCharStr[] = "OutputCharStr"; -CONST CHAR NAME_SendFontCmd[] = "SendFontCmd"; -CONST CHAR NAME_TextOutAsBitmap[] = "TextOutAsBitmap"; -CONST CHAR NAME_TTDownloadMethod[] = "TTDownloadMethod"; -CONST CHAR NAME_TTYGetInfo[] = "TTYGetInfo"; -CONST CHAR NAME_WritePrinter[] = "WritePrinter"; - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/precomp.h b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/precomp.h deleted file mode 100644 index 48078a7d..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/precomp.h +++ /dev/null @@ -1,53 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: precomp.H -// -// -// PURPOSE: Optimize compilation of headers that don't change frequently. -// -#pragma once - -// Necessary for compiling under VC. -#if(!defined(WINVER) || (WINVER < 0x0500)) - #undef WINVER - #define WINVER 0x0500 -#endif -#if(!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)) - #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0500 -#endif - - - -// Required header files that shouldn't change often. - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Safe integer functions to detect integer overflow/underflow conditions: -#include - -// StrSafe.h needs to be included last -// to disallow unsafe string functions. -#include - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/precompsrc.cpp b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/resource.h b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/resource.h deleted file mode 100644 index 35637c60..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/resource.h +++ /dev/null @@ -1,17 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by WMARKUNI.rc -// - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/wmarkuni.def b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/wmarkuni.def deleted file mode 100644 index 86e376e8..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/wmarkuni.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY WMARKUNI -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/wmarkuni.h b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/wmarkuni.h deleted file mode 100644 index 87415a42..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/wmarkuni.h +++ /dev/null @@ -1,82 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright 1997 - 2003 Microsoft Corporation. All Rights Reserved. -// -// FILE: WMARKUNI.H -// -// -// PURPOSE: Define common data types, and external function prototypes -// for debug.cpp. -// -#pragma once - -#include "OEM.H" -#include "DEVMODE.H" - - -//////////////////////////////////////////////////////// -// OEM Defines -//////////////////////////////////////////////////////// - -#define DLLTEXT(s) "WMARKUNI: " s - -/////////////////////////////////////////////////////// -// Warning: the following enum order must match the -// order in OEMHookFuncs[]. -/////////////////////////////////////////////////////// -typedef enum tag_Hooks { - UD_DrvRealizeBrush, - UD_DrvDitherColor, - UD_DrvCopyBits, - UD_DrvBitBlt, - UD_DrvStretchBlt, - UD_DrvTextOut, - UD_DrvStrokePath, - UD_DrvFillPath, - UD_DrvStrokeAndFillPath, - UD_DrvPaint, - UD_DrvLineTo, - UD_DrvStartPage, - UD_DrvSendPage, - UD_DrvEscape, - UD_DrvStartDoc, - UD_DrvEndDoc, - UD_DrvNextBand, - UD_DrvStartBanding, - UD_DrvQueryFont, - UD_DrvQueryFontTree, - UD_DrvQueryFontData, - UD_DrvQueryAdvanceWidths, - UD_DrvFontManagement, - UD_DrvGetGlyphMode, - UD_DrvStretchBltROP, - UD_DrvPlgBlt, - UD_DrvTransparentBlt, - UD_DrvAlphaBlend, - UD_DrvGradientFill, - - MAX_DDI_HOOKS, - -} ENUMHOOKS; - - -typedef struct _OEMPDEV { - // - // define whatever needed, such as working buffers, tracking information, - // etc. - // - // This test DLL hooks out every drawing DDI. So it needs to remember - // Unidrv's hook function pointer so it call back. - // - PFN pfnUnidrv[MAX_DDI_HOOKS]; - - // - // define whatever needed, such as working buffers, tracking information, - // etc. - // - DWORD dwReserved[1]; - -} OEMPDEV, *POEMPDEV; diff --git a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/wmarkuni.rc b/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/wmarkuni.rc deleted file mode 100644 index 54b0f627..00000000 --- a/print/OEM Printer Customization Plug-in Samples/C++/watermarkuni/wmarkuni/wmarkuni.rc +++ /dev/null @@ -1,104 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Written by Printing & Imaging Team" - VALUE "CompanyName", "Microsoft Corp." - VALUE "FileDescription", "Watermark Unidriver Sample" - VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "OEMPS" - VALUE "LegalCopyright", "Copyright 1998-2003" - VALUE "LegalTrademarks", "Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation" - VALUE "OriginalFilename", "WMARKUNI.DLL" - VALUE "ProductName", "Microsoft WMARKUNI" - VALUE "ProductVersion", "1.0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/print/OEM Printer Customization Plug-in Samples/C++/winxp.inf b/print/OEM Printer Customization Plug-in Samples/C++/winxp.inf deleted file mode 100644 index cf0ab050..00000000 Binary files a/print/OEM Printer Customization Plug-in Samples/C++/winxp.inf and /dev/null differ diff --git a/print/OEM Printer Customization Plug-in Samples/README.md b/print/OEM Printer Customization Plug-in Samples/README.md deleted file mode 100644 index 4a5fcf8d..00000000 --- a/print/OEM Printer Customization Plug-in Samples/README.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -page_type: sample -description: "Provides examples of how to build OEM printer customization plug-ins." -languages: -- cpp -products: -- windows -- windows-wdk ---- - -# OEM Printer Customization Plug-in Samples - -The OEMDLL samples are an illustration of OEM customization plug-ins. The BITMAP, OEMPS, OEMUI, OEMUNI, OEMPREAN, CUSTHLP, SyncSet, ThemeUI, PSUIRep, and Watermark samples do not affect the printer output. They are only examples of how to build OEM Customization DLLs of various types. - -The following samples are included as part of this sample set: - -| Sample | Description | -| --- | --- | -| BITMAP | A Unidrv-based bitmap rendering plug-in. This sample demonstrates how to write a Unidrv-based rendering plug-in that functions as a bitmap driver. The sample is based on the redesigned version of the OEMUNI sample. | -| CUSTHLP | An OEM help-customization plug-in. This sample demonstrates adding OEM help to your customization plug-in and how to replace standard Microsoft supplied help with customized help. | -| OEMPREAN | Illustrates how you can leverage the pre-analysis feature in Unidrv. This sample is built on the redesigned version of the OEMUNI sample. | -| OEMPS | A PostScript rendering plug-in. This sample demonstrates how to write a PostScript-based rendering plug-in. | -| OEMUI | A user interface plug-in (both PostScript and Unidrv flavors are available). The OEMUI sample demonstrates common UI tasks such as adding additional elements to the UI (that is, items and pages). | -| OEMUNI | A user interface plug-in (both PostScript and Unidrv flavors are available). The OEMUI sample demonstrates common UI tasks such as adding additional elements to the UI (that is, items and pages). | -| PSUIREP | A PostScript UI replacement sample. This sample demonstrates how to completely replace the standard printer driver UI for PostScript driver plug-ins. | -| PTPCPIPR | The Unidrv Plug-in for Print Ticket Provider Interface sample contains a functional Unidrv configuration plug-in that implements the IPrintOemPrintTicketProvider interface. You can use this code as a starting point for developing new driver plug-ins that support PrintTicket functionality. | -| SYNCSET | A synchronization plug-in. This sample demonstrates how to synchronize driver settings between the OEM customization page and the standard device settings page. | -| THEMEUI | A theming plug-in. This sample demonstrates how to use theming (that is, comctl v6) for printer driver UI. | -| UNIUIREP | This Universal Printer Driver (Unidrv) UI plugin sample shows how to fully replace Unidrv's standard UI and how to use the new IPrintCoreHelper interface to enumerate GDP features/options, enumerate constraints, get/set Unidrv settings, and create a GDL snapshot. | -| WATERMARK | Demonstrates how to produce customizable watermark page simulation by controlling PostScript injected in the printing stream. The components of the sample include a PostScript-based rendering module in conjunction with a UI module. The rendering module is responsible for the injection of the modified PostScript into the printing stream. This sample demonstrates the required COM interfaces, required functions with sample code and how to use the OEM's private DEVMODE section to communicate between the UI and rendering modules. | -| WATERMARKUNI | Demonstrates how to produce customizable watermark page simulation by controlling PCL data injected in the printing stream. The components of the sample include a UNIDRV-based rendering module in conjunction with a UI module. The rendering module is responsible for the injection of the PCL data into the printing stream. This sample demonstrates the required COM interfaces, required functions with sample code and how to use the OEM's private DEVMODE section to communicate between the UI and rendering modules. This sample works only if you have a page printer that has its own fonts. It doesn't download any fonts nor convert fonts to bitmap. | - -For information about how to develop a plug-in for customizing the print driver UI, see [COM Interfaces for UI Plug-Ins](https://docs.microsoft.com/windows-hardware/drivers/print/com-interfaces-for-ui-plug-ins). - -> [!NOTE] -> The OEMDLL samples are for the v3 print driver model only. - -To build this sample, you can use Microsoft Visual Studio 2017 (Community, Professional, or Enterprise) and Windows Driver Kit (WDK) 10. You can get Visual Studio 2017 [here](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=15) and WDK 10 [here](https://docs.microsoft.com/windows-hardware/drivers/download-the-wdk). - -You can also build this sample with Visual Studio 2013 (Professional or Ultimate) and Windows Driver Kit (WDK) 8.1. - -For Windows Driver Kit (WDK) 8 samples, download the WDK 8 samples pack. The samples in the WDK 8 samples pack will build only with Microsoft Visual Studio Professional 2012 (Professional or Ultimate) and WDK 8. - -## Operating system requirements - -Client - Windows 7 or later -Server - Windows Server 2008 R2 or later - -## Build the sample - -To build a driver solution using Windows 10 driver kit (Windows Driver Kit (WDK)) and Visual Studio 2017, perform the following steps: - -1. Open the solution file in Visual Studio 2017 - -1. Add all non-binary files (usually located in the \install directory of the sample) to the Package project - - 1. In the **Solution Explorer**, right click **Driver Files**. If you can't find **Driver Files** in this step, please change the "Platform Toolset" like below - - a. In the **Solution Explorer**, right click the Package project which you want to build and select **Properties** - - b. Select **General** under the **Configuration Properties** - - c. Change **Platform Toolset** to **WindowsKernelModeDriver10.0** or **WindowsUserModeDriver10.0** - - 1. Select **Add**, then click **Existing Item** - - 1. Navigate to the location to which you downloaded the sample, and select all the files in the install directory, or the equivalent set of non-binary files such as INFs, INIs, GPD, PPD files, etc. - - 1. Click **Add** - -1. Configure these files to be added into the driver package - - 1. In the **Solution Explorer**, right click the Package project and select **Properties** - - 1. In the left pane, click **Configuration Properties** > **Driver Install** > **Package Files**. - - 1. In the right pane, use the ellipsis button (...) to browse to the set of files that needs to be added to the driver package. All the data files that you added in **Step 2-c**, except the INF file, should be added. This configuration is per-architecture, so this configuration must be repeated for each architecture that will be built. - - 1. Click **OK** - -1. Open the INF file and edit it to match the built output - - 1. Open the INF file - - 1. In the Version section, add a reference to a catalog file that matches the .INF name like this: CatalogFile=XpsDrvSmpl.cat - - 1. In the SourceDisksFiles section, change the location of the DLL files you are building, to =1. This indicates that there is no architecture specific directory in this driver. If you ship multiple architectures simultaneously, you will need to collate the driver INF manually. - -At this point, Visual Studio 2017 will be able to build a driver package and output the files to disk. In order to configure driver signing and deployment, see [Developing, Testing, and Deploying Drivers](https://docs.microsoft.com/windows-hardware/drivers/develop/). - -For more information about how to build a driver solution using Microsoft Visual Studio, see [Building a Driver with Visual Studio and the WDK](https://docs.microsoft.com/windows-hardware/drivers/develop/building-a-driver). - -## Run the sample - -### Installation - -After building the samples, you can install them by using the Add Printer Wizard. Select the local printer, click Have Disk, and point to the directory that contains the relevant INF (oemdll.inf, bitmap.inf, oemprean.inf, and so on) file. - -## Design and Operation - -### BITMAP - -This sample includes the following features: - -- The supported ColorMode options in the bitmap driver's GPD are monochrome, 4bpp, 8bpp, and 24bpp. - -- The bitmap driver implements the IPrintOemUni::ImageProcessing callback to access bitmap data one band at a time. The driver's implementation of ImageProcessing buffers the band data every time it is called. The function is also responsible for filling the BITMAPINFOHEADER and COLORTABLE structures that are necessary for dumping the data out to a bitmap file. - -- The bitmap driver implements the OEMEndDoc DDI hook to dump the buffered bitmap data to the spooler at the end of the print job. The driver's implementation of OEMEndDoc dumps the headers first and then the buffered data. - -- The GrowBuffer helper function is called every time the buffer needs to be enlarged to hold the bitmap data. - -- The bitmap driver renders multi-page documents into a single large output bitmap file. - -This sample has the following limitations: - -- The plug-in does not support landscape orientation although the option exists in the GPD. - -- In 24bpp mode, documents larger than three pages will produce an extremely large bitmap (.bmp) file. Although the output is correct, you might not be able to view it because of memory limitations in the bitmap viewer. - -### OEMPREAN - -When preanalysis is enabled in the GPD (for more details about preanalysis, see the WDK documentation), Unidrv defines the surface as a banding surface but causes the first playback (that is, the first band) to be of the entire page. Unidrv performs this definition by setting the GDI clip window to the entire page. Unidrv enables all drawing commands to be hooked but returns before any drawing can be done. On the subsequent passes, Unidrv resets the clip window back to the original band size and bands normally. - -In order for plugins to also take part in preanalysis, they can enable OEM preanalysis by specifying the `"*PreAnalysisOptions: 8"` parameter in the GPD. The OEM rendering plug-in must hook both `DrvStartBanding` and `DrvNextBand` when this mode is enabled in the GPD. The OEM rendering plug-in must test the `pptl` parameter of the `OEMStartBanding` call to determine whether preanalysis has been enabled on this page. If the `pptl` parameter is `NULL`, preanalysis has been enabled, and the OEM rendering plug-in should consider all drawing calls up to the first call to `OEMNextBand` to be part of preanalysis. - -During these preanalysis phase drawing calls, the plug-in should not draw on the surface. The plug-in should also not call back into unidrv. You should use this phase only for analysis of the objects on the page. For example, certain printers need to handle black objects that intersect with color objects differently from black objects that appear by themselves. Other printers might need to halftone `StretchBlt` objects differently from `BitBlt` objects. -You should be aware that after preanalysis, you might get more calls than you saw in the normal rendering, because primitives that cross band boundaries yield two or more DDI calls after the preanalysis pass. -The sample uses the `bPreAnalysis` flag in the OEMPDEV structure to denote whether a particular pass is the preanalysis pass or the actual rendering pass. If the `bPreAnalysis` flag is set, it indicates that the current pass is the preanalysis pass. The sample implements all of the drawing function hooks in Ddihook.cpp. The sample uses the `OEMStartBanding` and `OEMNextBand` functions to respectively set and reset the `bPreAnalysis` flag. The sample also uses the `DBG_CLIPOBJ` debug macro function to dump the bounds of the clipping rectangle available for preanalysis in each of the drawing functions during the preanalysis pass. To view all of the debug output in the debugger, you must set the debug level to VERBOSE. The rest of the sample is identical to the Oemuni sample that illustrates a basic OEM rendering plug-in. - -> [!NOTE] -> The surface used during preanalysis might differ from the surface passed in during the rendering pass. - -### PTPCPIPR - -This sample is an educational example that illustrates the basic functionality that a Unidrv plug-in for the `IPrintOemPrintTicketProvider` interface should implement. -The primary functionality of the plug-in is to support the PhotoPrintingIntent PrintSchema keyword. The PhotoPrintingIntent keyword is designed to provide a mechanism for photo printers to support enhancements that are specific to photo printing. An application or the user (through the print UI) can then specify whether a particular print job is a photo-printing job, in which case the device can apply appropriate enhancements. -The intent setting is communicated to the device driver in a PrintTicket. The actual enhancements made are device-specific, and as such, the driver has to map the high-level intent setting into specific output settings, like resolution or bpp. This plug-in sample demonstrates the conversion. -The plug-in implements the `ExpandIntentOptions` method of the `IPrintOemPrintTicketProvider` interface. This method is called with an input print-ticket. The plug-in checks if the print-ticket contains a photo-printing intent setting, and if so, removes the setting, while instead adding to the print-ticket output settings as mentioned above. The code sample uses MSXML6 for all PrintTicket XML handling. - -### UINUIREP - -This sample shows how a plug-in for a Unidrv-based driver can replace the default UI. It provides new property sheets for the printer property and printing preferences pages. -Use this sample as an example of implementing full UI replacement in a Unidrv-based plugin. It also demonstrates the use of the new `IPrintCoreHelper` interface. - -This sample is only provided for educational purposes and should not be used in a production environment. diff --git a/print/OEM Printer Customization Plug-in Samples/license.rtf b/print/OEM Printer Customization Plug-in Samples/license.rtf deleted file mode 100644 index 690a7ad0..00000000 --- a/print/OEM Printer Customization Plug-in Samples/license.rtf +++ /dev/null @@ -1,25 +0,0 @@ -{\rtf1\ansi\ansicpg1252\uc1\htmautsp\deff2{\fonttbl{\f0\fcharset0 Times New Roman;}{\f2\fcharset0 MS Shell Dlg;}}{\colortbl\red0\green0\blue0;\red255\green255\blue255;}\loch\hich\dbch\pard\plain\ltrpar\itap0{\lang1033\fs16\f2\cf0 \cf0\ql{\f2 \line \li0\ri0\sa0\sb0\fi0\ql\par} -{\fs40\f2 {\ltrch MICROSOFT LIMITED PUBLIC LICENSE version 1.1}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 \line {\ltrch ----------------------}\line \li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch This license governs use of code marked as \ldblquote sample\rdblquote or \ldblquote example\rdblquote available on this web site without a license agreement, as provided under the section above titled \ldblquote NOTICE SPECIFIC TO SOFTWARE AVAILABLE ON THIS WEB SITE.\rdblquote If you use such code (the \ldblquote software\rdblquote ), you accept this license. If you do not accept the license, do not use the software.}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 \line \li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch 1. Definitions}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch The terms \ldblquote reproduce,\rdblquote \ldblquote reproduction,\rdblquote \ldblquote derivative works,\rdblquote and \ldblquote distribution\rdblquote have the same meaning here as under U.S. copyright law. }\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch A \ldblquote contribution\rdblquote is the original software, or any additions or changes to the software.}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch A \ldblquote contributor\rdblquote is any person that distributes its contribution under this license.}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch \ldblquote Licensed patents\rdblquote are a contributor\rquote s patent claims that read directly on its contribution.}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 \line \li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch 2. Grant of Rights}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch (A) Copyright Grant - Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch (B) Patent Grant - Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 \line \li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch 3. Conditions and Limitations}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch (A) No Trademark License- This license does not grant you rights to use any contributors\rquote name, logo, or trademarks.}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch (E) The software is licensed \ldblquote as-is.\rdblquote You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 {\ltrch (F) Platform Limitation - The licenses granted in sections 2(A) and 2(B) extend only to the software or derivative works that you create that run directly on a Microsoft Windows operating system product, Microsoft run-time technology (such as the .NET Framework or Silverlight), or Microsoft application platform (such as Microsoft Office or Microsoft Dynamics).}\li0\ri0\sa0\sb0\fi0\ql\par} -{\f2 \line \li0\ri0\sa0\sb0\fi0\ql\par} -} -} \ No newline at end of file diff --git a/print/README.md b/print/README.md new file mode 100644 index 00000000..4550aae0 --- /dev/null +++ b/print/README.md @@ -0,0 +1,5 @@ +# Printer Device Development with Print Support Apps (PSA) + +We recommend that you use Microsoft's IPP inbox class driver, along with Print Support Apps (PSA), to customize the print experience in Windows 10 and 11 for printer device development. + +For more information, see [Print support app design guide](https://learn.microsoft.com/windows-hardware/drivers/devapps/print-support-app-design-guide). diff --git a/print/SampleOpenXPS/BlankProjSrc/BlankProject.vcxproj b/print/SampleOpenXPS/BlankProjSrc/BlankProject.vcxproj deleted file mode 100644 index f59d1592..00000000 --- a/print/SampleOpenXPS/BlankProjSrc/BlankProject.vcxproj +++ /dev/null @@ -1,194 +0,0 @@ - - - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {3B7F3284-4571-493B-87DF-0DCEB924EDED} - $(MSBuildProjectName) - false - Debug - Win32 - {BA1AE07D-3F9D-449F-B619-E3B4F1A30603} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - BlankProject - - - BlankProject - - - BlankProject - - - BlankProject - - - BlankProject - - - BlankProject - - - - - - - - true - - - - - - - - - true - - - - - - - - - true - - - - - - - - - true - - - - - - - - - true - - - - - - - - - true - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/SampleOpenXPS/BlankProjSrc/BlankProject.vcxproj.Filters b/print/SampleOpenXPS/BlankProjSrc/BlankProject.vcxproj.Filters deleted file mode 100644 index 43165228..00000000 --- a/print/SampleOpenXPS/BlankProjSrc/BlankProject.vcxproj.Filters +++ /dev/null @@ -1,17 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {42A3275D-9934-47FA-AD0F-7DBA1E120F71} - - - h;hpp;hxx;hm;inl;inc;xsd - {FFB74D15-891F-4C17-9361-01A451D65842} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {04F8087D-4C32-4605-8E33-40D0F6A3B97E} - - - \ No newline at end of file diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M1.1a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M1.1a.oxps deleted file mode 100644 index 7d57c6fa..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M1.1a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M1.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M1.2a.oxps deleted file mode 100644 index 8da67915..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M1.2a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.14a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.14a.oxps deleted file mode 100644 index a68e8299..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.14a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.17a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.17a.oxps deleted file mode 100644 index 5787ab9e..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.17a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.20a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.20a.oxps deleted file mode 100644 index 272f75ff..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.20a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.24a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.24a.oxps deleted file mode 100644 index 3cb95fbd..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.24a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.27a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.27a.oxps deleted file mode 100644 index b6dd42fc..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.27a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.27b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.27b.oxps deleted file mode 100644 index 2d5a4a59..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.27b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.30a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.30a.oxps deleted file mode 100644 index 0063c896..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.30a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.31a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.31a.oxps deleted file mode 100644 index 82a3cec8..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.31a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.32a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.32a.oxps deleted file mode 100644 index 821826a6..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.32a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.33a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.33a.oxps deleted file mode 100644 index 1a709467..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.33a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.35a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.35a.oxps deleted file mode 100644 index c35fb749..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.35a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.36a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.36a.oxps deleted file mode 100644 index d9176b43..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.36a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.36b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.36b.oxps deleted file mode 100644 index ca568053..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.36b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.41a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.41a.oxps deleted file mode 100644 index 092826a0..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.41a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.41b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.41b.oxps deleted file mode 100644 index 1c48a335..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.41b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.42a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.42a.oxps deleted file mode 100644 index b57510e9..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.42a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.42b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.42b.oxps deleted file mode 100644 index 7877aadf..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.42b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.43a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.43a.oxps deleted file mode 100644 index 91f3c64a..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.43a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.43b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.43b.oxps deleted file mode 100644 index 661578e4..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.43b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.44a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.44a.oxps deleted file mode 100644 index a5a26d00..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.44a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.48a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.48a.oxps deleted file mode 100644 index 15313e86..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.48a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.49a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.49a.oxps deleted file mode 100644 index 7e238cda..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.49a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.49b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.49b.oxps deleted file mode 100644 index 3a1c4ae3..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.49b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.50a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.50a.oxps deleted file mode 100644 index 31045006..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.50a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.52a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.52a.oxps deleted file mode 100644 index d2c0d68f..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.52a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.55a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.55a.oxps deleted file mode 100644 index d9a21ca3..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.55a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.56a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.56a.oxps deleted file mode 100644 index 9c82a8c6..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.56a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M1.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M1.2a.oxps deleted file mode 100644 index 12c0d526..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M1.2a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.23a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.23a.oxps deleted file mode 100644 index e4183e92..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.23a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.6a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.6a.oxps deleted file mode 100644 index 18955f95..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.6a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.6b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.6b.oxps deleted file mode 100644 index e2d0085f..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.6b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.2a.oxps deleted file mode 100644 index b080ba72..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.2a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.3a.oxps deleted file mode 100644 index 0a83e2d0..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.3a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.3b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.3b.oxps deleted file mode 100644 index 6c0bda7a..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.3b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5a.oxps deleted file mode 100644 index cc2330fa..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5b.oxps deleted file mode 100644 index b02d1522..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5c.oxps deleted file mode 100644 index dd8abe81..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.7a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.7a.oxps deleted file mode 100644 index f65645da..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.7a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.10a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.10a.oxps deleted file mode 100644 index 4db2144d..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.10a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.10b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.10b.oxps deleted file mode 100644 index ccbf170e..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.10b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.13a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.13a.oxps deleted file mode 100644 index 356a7c0a..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.13a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.13b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.13b.oxps deleted file mode 100644 index 81819935..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.13b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.14a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.14a.oxps deleted file mode 100644 index 8b629d76..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.14a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.14b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.14b.oxps deleted file mode 100644 index 2e23e20b..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.14b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.17a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.17a.oxps deleted file mode 100644 index 9aa2db0b..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.17a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.18a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.18a.oxps deleted file mode 100644 index 6c4dc4da..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.18a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.25a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.25a.oxps deleted file mode 100644 index d3764cb1..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.25a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2a.oxps deleted file mode 100644 index 2e587765..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2b.oxps deleted file mode 100644 index a766c766..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2c.oxps deleted file mode 100644 index f94c3782..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.35a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.35a.oxps deleted file mode 100644 index 5cac28ee..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.35a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.36a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.36a.oxps deleted file mode 100644 index 615bcd03..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.36a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.37a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.37a.oxps deleted file mode 100644 index 26d9cc97..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.37a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39a.oxps deleted file mode 100644 index 4856a8f4..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39b.oxps deleted file mode 100644 index 976a3ffb..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39c.oxps deleted file mode 100644 index 163a06a0..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3a.oxps deleted file mode 100644 index fe72bc82..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3b.oxps deleted file mode 100644 index bd84ede6..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3c.oxps deleted file mode 100644 index 48f5513e..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.4a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.4a.oxps deleted file mode 100644 index 635ba653..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.4a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.4b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.4b.oxps deleted file mode 100644 index 53f585b7..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.4b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.54a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.54a.oxps deleted file mode 100644 index 02e067b0..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.54a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59a.oxps deleted file mode 100644 index 749fc46c..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59b.oxps deleted file mode 100644 index 1732ba01..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59c.oxps deleted file mode 100644 index d4530964..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.5a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.5a.oxps deleted file mode 100644 index eab5315b..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.5a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.5b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.5b.oxps deleted file mode 100644 index 003785dc..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.5b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6a.oxps deleted file mode 100644 index 7d49183d..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6b.oxps deleted file mode 100644 index 344a2a4c..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6c.oxps deleted file mode 100644 index 8e6a3fee..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.70a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.70a.oxps deleted file mode 100644 index dd8207dd..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.70a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71a.oxps deleted file mode 100644 index a4768f4e..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71b.oxps deleted file mode 100644 index 3875027e..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71c.oxps deleted file mode 100644 index 6f0cb60b..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72a.oxps deleted file mode 100644 index 034178df..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72b.oxps deleted file mode 100644 index 24fa8200..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72c.oxps deleted file mode 100644 index cf695786..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.73a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.73a.oxps deleted file mode 100644 index a19a1d76..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.73a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.73b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.73b.oxps deleted file mode 100644 index c4c02c89..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.73b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74a.oxps deleted file mode 100644 index 34754853..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74b.oxps deleted file mode 100644 index 7ec5e802..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74c.oxps deleted file mode 100644 index 70df17e7..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75a.oxps deleted file mode 100644 index 3d6c80c6..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75b.oxps deleted file mode 100644 index f9453775..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75c.oxps deleted file mode 100644 index a6af0c05..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75d.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75d.oxps deleted file mode 100644 index 860d6ef7..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75d.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.76a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.76a.oxps deleted file mode 100644 index 04009798..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.76a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.77a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.77a.oxps deleted file mode 100644 index b09370b0..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.77a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.77b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.77b.oxps deleted file mode 100644 index d4c716aa..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.77b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7a.oxps deleted file mode 100644 index 43ae8dd4..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7b.oxps deleted file mode 100644 index cd438ae8..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7c.oxps deleted file mode 100644 index 5769291e..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.80.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.80.oxps deleted file mode 100644 index 54be15f5..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.80.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.81.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.81.oxps deleted file mode 100644 index 3ee96f65..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.81.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.82.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.82.oxps deleted file mode 100644 index c4f7bc34..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.82.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8a.oxps deleted file mode 100644 index 6d7ac332..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8b.oxps deleted file mode 100644 index c89d5178..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8c.oxps deleted file mode 100644 index 9189599c..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.11a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.11a.oxps deleted file mode 100644 index 6a245834..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.11a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.11b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.11b.oxps deleted file mode 100644 index 67b452f2..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.11b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.12a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.12a.oxps deleted file mode 100644 index 51dd9a58..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.12a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.12b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.12b.oxps deleted file mode 100644 index 1436e752..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.12b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.13a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.13a.oxps deleted file mode 100644 index 86d736fd..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.13a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.14a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.14a.oxps deleted file mode 100644 index 61153510..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.14a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.20a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.20a.oxps deleted file mode 100644 index 54991b08..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.20a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.20b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.20b.oxps deleted file mode 100644 index 48170f5d..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.20b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.2a.oxps deleted file mode 100644 index 4249ffcf..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.2a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.2b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.2b.oxps deleted file mode 100644 index 3fb18d33..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.2b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.3a.oxps deleted file mode 100644 index 65627a53..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.3a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.5a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.5a.oxps deleted file mode 100644 index d692b79e..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.5a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.5b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.5b.oxps deleted file mode 100644 index 9c778641..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.5b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.6a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.6a.oxps deleted file mode 100644 index 19bf2016..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.6a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.6b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.6b.oxps deleted file mode 100644 index 072980cc..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.6b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1a.oxps deleted file mode 100644 index 27b1345f..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1b.oxps deleted file mode 100644 index a8ba179c..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1c.oxps deleted file mode 100644 index e0e0dfdd..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.2a.oxps deleted file mode 100644 index f7e297c5..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.2a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.2b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.2b.oxps deleted file mode 100644 index ec497e43..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.2b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.3a.oxps deleted file mode 100644 index fe050dcc..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.3a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.15a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.15a.oxps deleted file mode 100644 index 75944cfa..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.15a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2a.oxps deleted file mode 100644 index 3b83175d..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2b.oxps deleted file mode 100644 index 95a4fdfd..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2c.oxps deleted file mode 100644 index 3b334728..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3a.oxps deleted file mode 100644 index 9cd37caa..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3b.oxps deleted file mode 100644 index fac36836..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3c.oxps deleted file mode 100644 index 47b8e96f..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.4a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.4a.oxps deleted file mode 100644 index 56874b52..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.4a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.4b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.4b.oxps deleted file mode 100644 index d02e3e5b..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.4b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.7a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.7a.oxps deleted file mode 100644 index 67ea2d89..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.7a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.1a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.1a.oxps deleted file mode 100644 index 10082c32..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.1a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.1b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.1b.oxps deleted file mode 100644 index a495ea08..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.1b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.2a.oxps deleted file mode 100644 index 47cb778b..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.2a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.2b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.2b.oxps deleted file mode 100644 index d3f3abc8..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.2b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.3a.oxps deleted file mode 100644 index f4366daa..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.3a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.3b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.3b.oxps deleted file mode 100644 index 42c68be9..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.3b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.4a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.4a.oxps deleted file mode 100644 index ca2a1fd8..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.4a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.4b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.4b.oxps deleted file mode 100644 index a5011cc2..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.4b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.5a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.5a.oxps deleted file mode 100644 index 31c389e5..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.5a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.5b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.5b.oxps deleted file mode 100644 index 2153d0c1..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.5b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.6a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.6a.oxps deleted file mode 100644 index 8879e4c7..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.6a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.6b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.6b.oxps deleted file mode 100644 index c5c2f609..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.6b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.11a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.11a.oxps deleted file mode 100644 index 73a45e80..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.11a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.11b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.11b.oxps deleted file mode 100644 index b86db281..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.11b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.2a.oxps deleted file mode 100644 index e82f6990..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.2a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.2b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.2b.oxps deleted file mode 100644 index 69ba04cf..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.2b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.3a.oxps deleted file mode 100644 index c6d8e028..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.3a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.5a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.5a.oxps deleted file mode 100644 index 14bed3c0..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.5a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.6a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.6a.oxps deleted file mode 100644 index 1e6f679e..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.6a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M8.14a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M8.14a.oxps deleted file mode 100644 index 6bd6cba4..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M8.14a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M9.10a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M9.10a.oxps deleted file mode 100644 index b933f9bb..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M9.10a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M9.10b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M9.10b.oxps deleted file mode 100644 index 0691b803..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M9.10b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.10a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.10a.oxps deleted file mode 100644 index 86bb6c6d..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.10a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.10b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.10b.oxps deleted file mode 100644 index 3e2820be..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.10b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.11a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.11a.oxps deleted file mode 100644 index f2a269d9..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.11a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.12a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.12a.oxps deleted file mode 100644 index f0f51a6a..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.12a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.13a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.13a.oxps deleted file mode 100644 index 29fd37e8..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.13a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.13b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.13b.oxps deleted file mode 100644 index 4a1aa928..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.13b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14a.oxps deleted file mode 100644 index a5b1c2fd..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14b.oxps deleted file mode 100644 index bda7b613..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14c.oxps deleted file mode 100644 index b16535f1..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.15a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.15a.oxps deleted file mode 100644 index e62a2c04..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.15a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.17a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.17a.oxps deleted file mode 100644 index b46a75a8..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.17a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.17b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.17b.oxps deleted file mode 100644 index abc66d3a..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.17b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.18a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.18a.oxps deleted file mode 100644 index 8c4db483..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.18a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.18b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.18b.oxps deleted file mode 100644 index 61f134ad..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.18b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.1a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.1a.oxps deleted file mode 100644 index 9fb579e9..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.1a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.20a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.20a.oxps deleted file mode 100644 index dbf7e7b5..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.20a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.20b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.20b.oxps deleted file mode 100644 index 5618a606..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.20b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.21a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.21a.oxps deleted file mode 100644 index 7161dda4..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.21a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.21b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.21b.oxps deleted file mode 100644 index 600251fa..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.21b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.22a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.22a.oxps deleted file mode 100644 index f115a574..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.22a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.25a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.25a.oxps deleted file mode 100644 index 92acd6dc..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.25a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.26a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.26a.oxps deleted file mode 100644 index a1105597..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.26a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.26b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.26b.oxps deleted file mode 100644 index 7f97b408..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.26b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.27a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.27a.oxps deleted file mode 100644 index 66210956..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.27a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.27b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.27b.oxps deleted file mode 100644 index 38d0a4c3..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.27b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.28a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.28a.oxps deleted file mode 100644 index c4cd0cff..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.28a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.28b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.28b.oxps deleted file mode 100644 index 0b31ee13..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.28b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2a.oxps deleted file mode 100644 index c28b2d74..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2b.oxps deleted file mode 100644 index a41da49d..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2c.oxps deleted file mode 100644 index e57161b6..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.30a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.30a.oxps deleted file mode 100644 index 389055ab..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.30a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.30b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.30b.oxps deleted file mode 100644 index 34a11721..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.30b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.3a.oxps deleted file mode 100644 index 43458263..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.3a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.5a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.5a.oxps deleted file mode 100644 index 527dacf3..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.5a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6a.oxps deleted file mode 100644 index 3380472a..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6b.oxps deleted file mode 100644 index 53b246e8..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6c.oxps deleted file mode 100644 index 1b412c9f..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6d.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6d.oxps deleted file mode 100644 index c0656f7a..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6d.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.7a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.7a.oxps deleted file mode 100644 index c7312c0c..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.7a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.7b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.7b.oxps deleted file mode 100644 index f30e067c..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.7b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8a.oxps deleted file mode 100644 index edfee4f6..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8b.oxps deleted file mode 100644 index 56be3417..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8c.oxps deleted file mode 100644 index 447aa316..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8c.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.9a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.9a.oxps deleted file mode 100644 index 39a2bab7..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.9a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.10a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.10a.oxps deleted file mode 100644 index d59d1efb..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.10a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.18a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.18a.oxps deleted file mode 100644 index b913fb02..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.18a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.4a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.4a.oxps deleted file mode 100644 index 2ff018f6..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.4a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.5a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.5a.oxps deleted file mode 100644 index d3377da4..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.5a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.5b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.5b.oxps deleted file mode 100644 index c720fb68..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.5b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.6a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.6a.oxps deleted file mode 100644 index d91da44f..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.6a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.6b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.6b.oxps deleted file mode 100644 index b6e8e3a2..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.6b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.7a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.7a.oxps deleted file mode 100644 index 2cb5018c..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.7a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.7b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.7b.oxps deleted file mode 100644 index 6f4ee6d0..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.7b.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.10a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.10a.oxps deleted file mode 100644 index 1cbac9f4..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.10a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.14a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.14a.oxps deleted file mode 100644 index a2579585..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.14a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.9a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.9a.oxps deleted file mode 100644 index 6b5fef0b..00000000 Binary files a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.9a.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/OpenXPSTestFiles_EndUserLicenseAgreement.txt b/print/SampleOpenXPS/OpenXPSTestFiles_EndUserLicenseAgreement.txt deleted file mode 100644 index bb9b187b..00000000 --- a/print/SampleOpenXPS/OpenXPSTestFiles_EndUserLicenseAgreement.txt +++ /dev/null @@ -1,7 +0,0 @@ -END-USER LICENSE AGREEMENT -IMPORTANTREAD CAREFULLY: This Microsoft End-User License Agreement (EULA) is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation (Microsoft) for Test Files owned by Microsoft and identified below. By installing, copying, or otherwise using the Test Files, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, you may not install or use the Test Files. - -Microsoft owns a library of sample Open XML Paper Specification (OpenXPS) files, which Microsoft created for testing features of the OpenXPS format (the Test Files). The Test Files are protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. This is a license, not a sale, of the Test Files. -1. GRANT OF LICENSE. Microsoft grants to you as an individual, a personal, nonexclusive, and limited license to make and use copies of the Test Files on any number of computers residing on your premises for the sole purpose of developing and testing your software and/or hardware products. These license rights are conditioned on your compliance with the license restrictions and requirements described below. -2. TERMINATION. Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. -3. DISCLAIMER OF WARRANTIES. To the maximum extent permitted by applicable law, Microsoft provides the Test Files AS IS AND WITH ALL FAULTS, and hereby disclaim all warranties and conditions, either express, implied or statutory, including, but not limited to, any (if any) implied warranties or conditions of merchantability, of fitness for a particular purpose, of lack of viruses, of accuracy or completeness of responses, of results, and of lack of negligence or lack of workmanlike effort, all with regard to the Test Files. ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT, WITH REGARD TO THE TEST FILES. THE ENTIRE RISK AS TO THE QUALITY OF OR ARISING OUT OF USE OR PERFORMANCE OF THE SAMPLE CODE, IF ANY, REMAINS WITH YOU. diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb01.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb01.oxps deleted file mode 100644 index 3e80f38a..00000000 Binary files a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb01.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb02.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb02.oxps deleted file mode 100644 index ff9cfa89..00000000 Binary files a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb02.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb03.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb03.oxps deleted file mode 100644 index b92f8aa0..00000000 Binary files a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb03.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb04.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb04.oxps deleted file mode 100644 index 4db94294..00000000 Binary files a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb04.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb05.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb05.oxps deleted file mode 100644 index a3352a3c..00000000 Binary files a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb05.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb06.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb06.oxps deleted file mode 100644 index 99e89c53..00000000 Binary files a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb06.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb07.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb07.oxps deleted file mode 100644 index 2fa2eb7e..00000000 Binary files a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb07.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb08.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb08.oxps deleted file mode 100644 index f40d61cc..00000000 Binary files a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb08.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb09.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb09.oxps deleted file mode 100644 index eca31524..00000000 Binary files a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb09.oxps and /dev/null differ diff --git a/print/SampleOpenXPS/README.md b/print/SampleOpenXPS/README.md deleted file mode 100644 index 98269683..00000000 --- a/print/SampleOpenXPS/README.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -page_type: sample -description: "Contains a set of documents that exercise a variety of features of OpenXPS." -languages: -- cpp -products: -- windows -- windows-wdk ---- - -# OpenXPS Documents Print Sample - -This sample contains a set of documents that were generated from a variety of sources, including those generated from the Windows Presentation Foundation in the .NET Framework, from Office 2007, and from the Microsoft XPS Document Writer (MXDW). A few of the documents were either hand-built from scratch or hand-modified from another source. They have been included to provide you with a few documents that exercise a variety of features of the XML Paper Specification. - -In addition, a few high-quality documents have been provided in the Showcase directory to highlight some of the XPS advantages in terms of screen-to-print fidelity. We've also created some documents that are intended to fail, by violating at least one conformance rule. These are in the ConformanceViolations directory. For information about OpenXPS in Windows, see [Improvements in XPSDrv](https://docs.microsoft.com/windows-hardware/drivers/print/improvements-in-xpsdrv) and [Driver Support for OpenXPS](https://docs.microsoft.com/windows-hardware/drivers/print/driver-support-for-openxps). diff --git a/print/SampleOpenXPS/SampleOpenXPS.sln b/print/SampleOpenXPS/SampleOpenXPS.sln deleted file mode 100644 index d532a21b..00000000 --- a/print/SampleOpenXPS/SampleOpenXPS.sln +++ /dev/null @@ -1,34 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26430.16 -MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BlankProject", "BlankProjSrc\BlankProject.vcxproj", "{3B7F3284-4571-493B-87DF-0DCEB924EDED}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM64 = Debug|ARM64 - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|ARM64 = Release|ARM64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3B7F3284-4571-493B-87DF-0DCEB924EDED}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {3B7F3284-4571-493B-87DF-0DCEB924EDED}.Debug|ARM64.Build.0 = Debug|ARM64 - {3B7F3284-4571-493B-87DF-0DCEB924EDED}.Debug|Win32.ActiveCfg = Debug|Win32 - {3B7F3284-4571-493B-87DF-0DCEB924EDED}.Debug|Win32.Build.0 = Debug|Win32 - {3B7F3284-4571-493B-87DF-0DCEB924EDED}.Debug|x64.ActiveCfg = Debug|x64 - {3B7F3284-4571-493B-87DF-0DCEB924EDED}.Debug|x64.Build.0 = Debug|x64 - {3B7F3284-4571-493B-87DF-0DCEB924EDED}.Release|ARM64.ActiveCfg = Release|ARM64 - {3B7F3284-4571-493B-87DF-0DCEB924EDED}.Release|ARM64.Build.0 = Release|ARM64 - {3B7F3284-4571-493B-87DF-0DCEB924EDED}.Release|Win32.ActiveCfg = Release|Win32 - {3B7F3284-4571-493B-87DF-0DCEB924EDED}.Release|Win32.Build.0 = Release|Win32 - {3B7F3284-4571-493B-87DF-0DCEB924EDED}.Release|x64.ActiveCfg = Release|x64 - {3B7F3284-4571-493B-87DF-0DCEB924EDED}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/print/SampleXPS/BlankProjSrc/BlankProject.vcxproj b/print/SampleXPS/BlankProjSrc/BlankProject.vcxproj deleted file mode 100644 index 35a097ad..00000000 --- a/print/SampleXPS/BlankProjSrc/BlankProject.vcxproj +++ /dev/null @@ -1,194 +0,0 @@ - - - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {58038762-96ED-45A6-A3FF-C5898C7D1618} - $(MSBuildProjectName) - false - Debug - Win32 - {D934F796-350B-4012-9110-5FC97B7D9854} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - BlankProject - - - BlankProject - - - BlankProject - - - BlankProject - - - BlankProject - - - BlankProject - - - - - - - - true - - - - - - - - - true - - - - - - - - - true - - - - - - - - - true - - - - - - - - - true - - - - - - - - - true - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/SampleXPS/BlankProjSrc/BlankProject.vcxproj.Filters b/print/SampleXPS/BlankProjSrc/BlankProject.vcxproj.Filters deleted file mode 100644 index 5a2cdec7..00000000 --- a/print/SampleXPS/BlankProjSrc/BlankProject.vcxproj.Filters +++ /dev/null @@ -1,17 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {37D24E25-CD7F-41C0-AEB7-8778E808B081} - - - h;hpp;hxx;hm;inl;inc;xsd - {0BA751BA-90F8-4A21-BD3C-7FAB627E3EB1} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {383DE7BA-4B35-47EF-BE41-4FAFAF442060} - - - \ No newline at end of file diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M1.1a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M1.1a.xps deleted file mode 100644 index c32c6403..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M1.1a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M1.2a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M1.2a.xps deleted file mode 100644 index 48bd6490..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M1.2a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.13a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.13a.xps deleted file mode 100644 index f5f1ac2f..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.13a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.14a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.14a.xps deleted file mode 100644 index 538f9e59..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.14a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.17a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.17a.xps deleted file mode 100644 index 023790ec..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.17a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.20a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.20a.xps deleted file mode 100644 index dd55104c..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.20a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.24a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.24a.xps deleted file mode 100644 index 0ba82cb8..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.24a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.27a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.27a.xps deleted file mode 100644 index 3bc52c0c..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.27a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.27b.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.27b.xps deleted file mode 100644 index 87fa16b3..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.27b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.30a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.30a.xps deleted file mode 100644 index 2828247f..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.30a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.31a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.31a.xps deleted file mode 100644 index f046b027..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.31a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.32a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.32a.xps deleted file mode 100644 index fd60c9c3..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.32a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.33a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.33a.xps deleted file mode 100644 index 76ecf75e..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.33a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.35a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.35a.xps deleted file mode 100644 index 8c8483dc..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.35a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.35b.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.35b.xps deleted file mode 100644 index 5d98e244..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.35b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.36a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.36a.xps deleted file mode 100644 index 6f77126d..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.36a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.41a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.41a.xps deleted file mode 100644 index 34ee4f7d..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.41a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.42a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.42a.xps deleted file mode 100644 index 3cb183e0..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.42a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.43a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.43a.xps deleted file mode 100644 index 69ecfb7a..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.43a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.44a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.44a.xps deleted file mode 100644 index d0875741..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.44a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.48a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.48a.xps deleted file mode 100644 index d0478fe8..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.48a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.49a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.49a.xps deleted file mode 100644 index 11a06bb0..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.49a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.50a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.50a.xps deleted file mode 100644 index 58edc94f..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.50a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.52a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.52a.xps deleted file mode 100644 index 91ae6a0f..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.52a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.55a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.55a.xps deleted file mode 100644 index b89e6f3e..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.55a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.56a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.56a.xps deleted file mode 100644 index 96723169..00000000 Binary files a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.56a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.10a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.10a.xps deleted file mode 100644 index 413b8ce8..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.10a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.11a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.11a.xps deleted file mode 100644 index aa8f754c..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.11a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.17a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.17a.xps deleted file mode 100644 index ae7640fb..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.17a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.18a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.18a.xps deleted file mode 100644 index 8b682539..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.18a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.18b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.18b.xps deleted file mode 100644 index b1291f17..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.18b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.1a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.1a.xps deleted file mode 100644 index cf92a350..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.1a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.1b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.1b.xps deleted file mode 100644 index 568f188e..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.1b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.20a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.20a.xps deleted file mode 100644 index 84c5263b..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.20a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26a.xps deleted file mode 100644 index 0f2ca598..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26b.xps deleted file mode 100644 index 0bd649d5..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26c.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26c.xps deleted file mode 100644 index 17c7bcc5..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26c.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.27a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.27a.xps deleted file mode 100644 index bb352cce..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.27a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.28a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.28a.xps deleted file mode 100644 index 606b7913..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.28a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.2a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.2a.xps deleted file mode 100644 index 44c799ab..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.2a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.2b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.2b.xps deleted file mode 100644 index 1a27e88a..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.2b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.34a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.34a.xps deleted file mode 100644 index b054bbe9..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.34a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.3a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.3a.xps deleted file mode 100644 index 597de9ed..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.3a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.5a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.5a.xps deleted file mode 100644 index 30da6c1f..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.5a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.6a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.6a.xps deleted file mode 100644 index 1dcebd8a..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.6a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.6b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.6b.xps deleted file mode 100644 index b52b7acc..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.6b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.7a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.7a.xps deleted file mode 100644 index f6746cd0..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.7a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.7c.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.7c.xps deleted file mode 100644 index 6bd60336..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.7c.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.8a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.8a.xps deleted file mode 100644 index e3f75acf..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.8a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.18a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.18a.xps deleted file mode 100644 index 6670b2f0..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.18a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.24a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.24a.xps deleted file mode 100644 index 4198d1f8..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.24a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.5a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.5a.xps deleted file mode 100644 index 32d09c18..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.5a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.5b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.5b.xps deleted file mode 100644 index 53ae6333..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.5b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.6a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.6a.xps deleted file mode 100644 index e48d3250..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.6a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.6b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.6b.xps deleted file mode 100644 index 50e0193f..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.6b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.7a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.7a.xps deleted file mode 100644 index 5ceb15a3..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.7a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.7b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.7b.xps deleted file mode 100644 index f8278ecb..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.7b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10a.xps deleted file mode 100644 index 477c0183..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10b.xps deleted file mode 100644 index 31ac45f5..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10c.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10c.xps deleted file mode 100644 index b4eecdfd..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10c.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.11a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.11a.xps deleted file mode 100644 index 995040b6..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.11a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.11b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.11b.xps deleted file mode 100644 index 64a8af21..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.11b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.12a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.12a.xps deleted file mode 100644 index 498fe5cd..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.12a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.12b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.12b.xps deleted file mode 100644 index ebca085e..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.12b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.13a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.13a.xps deleted file mode 100644 index 5ec3479f..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.13a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.14a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.14a.xps deleted file mode 100644 index ab717318..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.14a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.15a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.15a.xps deleted file mode 100644 index 35dea693..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.15a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.16a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.16a.xps deleted file mode 100644 index 4d8ac00d..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.16a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.17a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.17a.xps deleted file mode 100644 index 7cbf5580..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.17a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.17b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.17b.xps deleted file mode 100644 index 97876410..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.17b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.18a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.18a.xps deleted file mode 100644 index f81fe6f2..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.18a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.1a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.1a.xps deleted file mode 100644 index a425eff9..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.1a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.1b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.1b.xps deleted file mode 100644 index 052c570b..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.1b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.20a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.20a.xps deleted file mode 100644 index 5ec3479f..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.20a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.21a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.21a.xps deleted file mode 100644 index 7bb049e6..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.21a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.21b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.21b.xps deleted file mode 100644 index c1d6f3b4..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.21b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.25a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.25a.xps deleted file mode 100644 index 08c33e3d..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.25a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.26a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.26a.xps deleted file mode 100644 index 8a05d7b7..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.26a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.28a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.28a.xps deleted file mode 100644 index 18ccf0d9..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.28a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.29a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.29a.xps deleted file mode 100644 index 9f4dede8..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.29a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.2a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.2a.xps deleted file mode 100644 index 43d3896e..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.2a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.31a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.31a.xps deleted file mode 100644 index 63134db2..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.31a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.31b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.31b.xps deleted file mode 100644 index d4b716da..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.31b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.32a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.32a.xps deleted file mode 100644 index d1adc199..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.32a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.32b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.32b.xps deleted file mode 100644 index 5bbf1e0e..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.32b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.4a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.4a.xps deleted file mode 100644 index ec57c709..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.4a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.4b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.4b.xps deleted file mode 100644 index 6eb0d1ce..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.4b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.5a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.5a.xps deleted file mode 100644 index 6593e647..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.5a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.6a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.6a.xps deleted file mode 100644 index ed36762e..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.6a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.7a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.7a.xps deleted file mode 100644 index c7af760c..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.7a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.8a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.8a.xps deleted file mode 100644 index 342b5ced..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.8a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9a.xps deleted file mode 100644 index ef42bb32..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9b.xps deleted file mode 100644 index 6dbd62c6..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9c.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9c.xps deleted file mode 100644 index d791407a..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9c.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.1a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.1a.xps deleted file mode 100644 index abac7f24..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.1a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.2a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.2a.xps deleted file mode 100644 index e3f75acf..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.2a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.3a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.3a.xps deleted file mode 100644 index 60e7330f..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.3a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.1a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.1a.xps deleted file mode 100644 index 05e660a0..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.1a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.2a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.2a.xps deleted file mode 100644 index 544d2978..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.2a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.4a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.4a.xps deleted file mode 100644 index 942f4003..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.4a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.6a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.6a.xps deleted file mode 100644 index 42cf8e0e..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.6a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.7a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.7a.xps deleted file mode 100644 index e71811e5..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.7a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.8a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.8a.xps deleted file mode 100644 index 07219ea1..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.8a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M7.2a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M7.2a.xps deleted file mode 100644 index 7d0b1036..00000000 Binary files a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M7.2a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M1.2a.xps b/print/SampleXPS/ConformanceViolations/XPS/M1.2a.xps deleted file mode 100644 index aa0aab99..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M1.2a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M12.2a.xps b/print/SampleXPS/ConformanceViolations/XPS/M12.2a.xps deleted file mode 100644 index 37b7f4a9..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M12.2a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M12.3b.xps b/print/SampleXPS/ConformanceViolations/XPS/M12.3b.xps deleted file mode 100644 index dd3cd57e..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M12.3b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M12.5a.xps b/print/SampleXPS/ConformanceViolations/XPS/M12.5a.xps deleted file mode 100644 index a559be55..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M12.5a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M12.7a.xps b/print/SampleXPS/ConformanceViolations/XPS/M12.7a.xps deleted file mode 100644 index af87d904..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M12.7a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.10a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.10a.xps deleted file mode 100644 index 5a589bb1..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.10a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.13a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.13a.xps deleted file mode 100644 index 08dd879f..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.13a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.13b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.13b.xps deleted file mode 100644 index cb9c951e..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.13b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.14a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.14a.xps deleted file mode 100644 index 5b2d29ef..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.14a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.18a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.18a.xps deleted file mode 100644 index 918a5b84..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.18a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.25a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.25a.xps deleted file mode 100644 index 64cb6df8..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.25a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.36a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.36a.xps deleted file mode 100644 index cc56b711..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.36a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.37a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.37a.xps deleted file mode 100644 index 6832246f..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.37a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.3a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.3a.xps deleted file mode 100644 index 36faa225..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.3a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.3b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.3b.xps deleted file mode 100644 index a04712b7..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.3b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.3c.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.3c.xps deleted file mode 100644 index 61417822..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.3c.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.4a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.4a.xps deleted file mode 100644 index a2b7b46b..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.4a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.4b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.4b.xps deleted file mode 100644 index 6ba3ba3d..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.4b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.59a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.59a.xps deleted file mode 100644 index 4ed69dc3..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.59a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.5a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.5a.xps deleted file mode 100644 index 284cdf99..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.5a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.5b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.5b.xps deleted file mode 100644 index c2779265..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.5b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.6a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.6a.xps deleted file mode 100644 index 2b311786..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.6a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.6b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.6b.xps deleted file mode 100644 index a7af6881..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.6b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.71a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.71a.xps deleted file mode 100644 index d2fd6911..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.71a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.71b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.71b.xps deleted file mode 100644 index 8e129faf..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.71b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.71c.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.71c.xps deleted file mode 100644 index 6fcf2746..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.71c.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.73a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.73a.xps deleted file mode 100644 index 3724f3f2..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.73a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.73b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.73b.xps deleted file mode 100644 index cb492cde..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.73b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.74a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.74a.xps deleted file mode 100644 index 754a1dac..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.74a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.75a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.75a.xps deleted file mode 100644 index e60d1999..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.75a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.75b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.75b.xps deleted file mode 100644 index afb8579f..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.75b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.76a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.76a.xps deleted file mode 100644 index 70dcad6a..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M2.76a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M3.2a.xps b/print/SampleXPS/ConformanceViolations/XPS/M3.2a.xps deleted file mode 100644 index 974c52c8..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M3.2a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M3.3a.xps b/print/SampleXPS/ConformanceViolations/XPS/M3.3a.xps deleted file mode 100644 index 2d5f0f4c..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M3.3a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M3.5a.xps b/print/SampleXPS/ConformanceViolations/XPS/M3.5a.xps deleted file mode 100644 index 7471ee04..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M3.5a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M3.6a.xps b/print/SampleXPS/ConformanceViolations/XPS/M3.6a.xps deleted file mode 100644 index 0a2ec5ec..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M3.6a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M3.6b.xps b/print/SampleXPS/ConformanceViolations/XPS/M3.6b.xps deleted file mode 100644 index 3c353b55..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M3.6b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M4.3a.xps b/print/SampleXPS/ConformanceViolations/XPS/M4.3a.xps deleted file mode 100644 index dbceda8b..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M4.3a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M5.15a.xps b/print/SampleXPS/ConformanceViolations/XPS/M5.15a.xps deleted file mode 100644 index 1cea3661..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M5.15a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M5.2a.xps b/print/SampleXPS/ConformanceViolations/XPS/M5.2a.xps deleted file mode 100644 index abf74ae2..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M5.2a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M5.2b.xps b/print/SampleXPS/ConformanceViolations/XPS/M5.2b.xps deleted file mode 100644 index b3f2559d..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M5.2b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M5.4a.xps b/print/SampleXPS/ConformanceViolations/XPS/M5.4a.xps deleted file mode 100644 index 44f206c0..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M5.4a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M5.4b.xps b/print/SampleXPS/ConformanceViolations/XPS/M5.4b.xps deleted file mode 100644 index 77596f04..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M5.4b.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M5.7a.xps b/print/SampleXPS/ConformanceViolations/XPS/M5.7a.xps deleted file mode 100644 index 72860767..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M5.7a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M6.2a.xps b/print/SampleXPS/ConformanceViolations/XPS/M6.2a.xps deleted file mode 100644 index 7c64d19f..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M6.2a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M6.3a.xps b/print/SampleXPS/ConformanceViolations/XPS/M6.3a.xps deleted file mode 100644 index b62a394a..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M6.3a.xps and /dev/null differ diff --git a/print/SampleXPS/ConformanceViolations/XPS/M7.5a.xps b/print/SampleXPS/ConformanceViolations/XPS/M7.5a.xps deleted file mode 100644 index 93b14d89..00000000 Binary files a/print/SampleXPS/ConformanceViolations/XPS/M7.5a.xps and /dev/null differ diff --git a/print/SampleXPS/QualityLogicMinBar/mb01.xps b/print/SampleXPS/QualityLogicMinBar/mb01.xps deleted file mode 100644 index 138c8594..00000000 Binary files a/print/SampleXPS/QualityLogicMinBar/mb01.xps and /dev/null differ diff --git a/print/SampleXPS/QualityLogicMinBar/mb02.xps b/print/SampleXPS/QualityLogicMinBar/mb02.xps deleted file mode 100644 index ed09e1ef..00000000 Binary files a/print/SampleXPS/QualityLogicMinBar/mb02.xps and /dev/null differ diff --git a/print/SampleXPS/QualityLogicMinBar/mb03.xps b/print/SampleXPS/QualityLogicMinBar/mb03.xps deleted file mode 100644 index 2739c036..00000000 Binary files a/print/SampleXPS/QualityLogicMinBar/mb03.xps and /dev/null differ diff --git a/print/SampleXPS/QualityLogicMinBar/mb04.xps b/print/SampleXPS/QualityLogicMinBar/mb04.xps deleted file mode 100644 index 0287b040..00000000 Binary files a/print/SampleXPS/QualityLogicMinBar/mb04.xps and /dev/null differ diff --git a/print/SampleXPS/QualityLogicMinBar/mb05.xps b/print/SampleXPS/QualityLogicMinBar/mb05.xps deleted file mode 100644 index 225eed4e..00000000 Binary files a/print/SampleXPS/QualityLogicMinBar/mb05.xps and /dev/null differ diff --git a/print/SampleXPS/QualityLogicMinBar/mb06.xps b/print/SampleXPS/QualityLogicMinBar/mb06.xps deleted file mode 100644 index 39b38a71..00000000 Binary files a/print/SampleXPS/QualityLogicMinBar/mb06.xps and /dev/null differ diff --git a/print/SampleXPS/QualityLogicMinBar/mb07.xps b/print/SampleXPS/QualityLogicMinBar/mb07.xps deleted file mode 100644 index c844d85f..00000000 Binary files a/print/SampleXPS/QualityLogicMinBar/mb07.xps and /dev/null differ diff --git a/print/SampleXPS/QualityLogicMinBar/mb08.xps b/print/SampleXPS/QualityLogicMinBar/mb08.xps deleted file mode 100644 index 2b2146f1..00000000 Binary files a/print/SampleXPS/QualityLogicMinBar/mb08.xps and /dev/null differ diff --git a/print/SampleXPS/QualityLogicMinBar/mb09.xps b/print/SampleXPS/QualityLogicMinBar/mb09.xps deleted file mode 100644 index 12470ceb..00000000 Binary files a/print/SampleXPS/QualityLogicMinBar/mb09.xps and /dev/null differ diff --git a/print/SampleXPS/README.md b/print/SampleXPS/README.md deleted file mode 100644 index 795694d2..00000000 --- a/print/SampleXPS/README.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -page_type: sample -description: "Contains a set of documents that exercise a variety of features of the XML Paper Specification." -languages: -- cpp -products: -- windows -- windows-wdk ---- - -# XPS Documents Print Sample - -This sample is a set of documents that were generated from a variety of sources, including those generated from the Windows Presentation Foundation in the .NET Framework, from Office 2007, and from the Microsoft XPS Document Writer (MXDW). The set of documents also includes documents that were either hand-built from scratch or hand-modified from another source. They have been included to provide you with a few documents that exercise a variety of features of the XML Paper Specification. - -In addition, a few high-quality documents have been provided in the Showcase directory to highlight some of the XPS advantages in terms of screen-to-print fidelity. There are also some documents that are intended to fail by violating at least one conformance rule. These are in the ConformanceViolations directory. For information about XPS in Windows, see [XPS Printing Features](https://docs.microsoft.com/windows-hardware/drivers/print/xps-printing-features). diff --git a/print/SampleXPS/SampleXPS.sln b/print/SampleXPS/SampleXPS.sln deleted file mode 100644 index 52802ac5..00000000 --- a/print/SampleXPS/SampleXPS.sln +++ /dev/null @@ -1,34 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26430.16 -MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BlankProject", "BlankProjSrc\BlankProject.vcxproj", "{58038762-96ED-45A6-A3FF-C5898C7D1618}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM64 = Debug|ARM64 - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|ARM64 = Release|ARM64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {58038762-96ED-45A6-A3FF-C5898C7D1618}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {58038762-96ED-45A6-A3FF-C5898C7D1618}.Debug|ARM64.Build.0 = Debug|ARM64 - {58038762-96ED-45A6-A3FF-C5898C7D1618}.Debug|Win32.ActiveCfg = Debug|Win32 - {58038762-96ED-45A6-A3FF-C5898C7D1618}.Debug|Win32.Build.0 = Debug|Win32 - {58038762-96ED-45A6-A3FF-C5898C7D1618}.Debug|x64.ActiveCfg = Debug|x64 - {58038762-96ED-45A6-A3FF-C5898C7D1618}.Debug|x64.Build.0 = Debug|x64 - {58038762-96ED-45A6-A3FF-C5898C7D1618}.Release|ARM64.ActiveCfg = Release|ARM64 - {58038762-96ED-45A6-A3FF-C5898C7D1618}.Release|ARM64.Build.0 = Release|ARM64 - {58038762-96ED-45A6-A3FF-C5898C7D1618}.Release|Win32.ActiveCfg = Release|Win32 - {58038762-96ED-45A6-A3FF-C5898C7D1618}.Release|Win32.Build.0 = Release|Win32 - {58038762-96ED-45A6-A3FF-C5898C7D1618}.Release|x64.ActiveCfg = Release|x64 - {58038762-96ED-45A6-A3FF-C5898C7D1618}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/print/SampleXPS/XPSTestFiles_EndUserLicenseAgreement.txt b/print/SampleXPS/XPSTestFiles_EndUserLicenseAgreement.txt deleted file mode 100644 index 2e90e5d7..00000000 --- a/print/SampleXPS/XPSTestFiles_EndUserLicenseAgreement.txt +++ /dev/null @@ -1,7 +0,0 @@ -END-USER LICENSE AGREEMENT -IMPORTANTREAD CAREFULLY: This Microsoft End-User License Agreement (EULA) is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation (Microsoft) for Test Files owned by Microsoft and identified below. By installing, copying, or otherwise using the Test Files, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, you may not install or use the Test Files. - -Microsoft owns a library of sample XML Paper Specification (XPS) files, which Microsoft created for testing features of the XPS format (the Test Files). The Test Files are protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. This is a license, not a sale, of the Test Files. -1. GRANT OF LICENSE. Microsoft grants to you as an individual, a personal, nonexclusive, and limited license to make and use copies of the Test Files on any number of computers residing on your premises for the sole purpose of developing and testing your software and/or hardware products. These license rights are conditioned on your compliance with the license restrictions and requirements described below. -2. TERMINATION. Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. -3. DISCLAIMER OF WARRANTIES. To the maximum extent permitted by applicable law, Microsoft provides the Test Files AS IS AND WITH ALL FAULTS, and hereby disclaim all warranties and conditions, either express, implied or statutory, including, but not limited to, any (if any) implied warranties or conditions of merchantability, of fitness for a particular purpose, of lack of viruses, of accuracy or completeness of responses, of results, and of lack of negligence or lack of workmanlike effort, all with regard to the Test Files. ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT, WITH REGARD TO THE TEST FILES. THE ENTIRE RISK AS TO THE QUALITY OF OR ARISING OUT OF USE OR PERFORMANCE OF THE SAMPLE CODE, IF ANY, REMAINS WITH YOU. diff --git a/print/SimplePipelineFilter/FilterSample.def b/print/SimplePipelineFilter/FilterSample.def deleted file mode 100644 index f6a38ef5..00000000 --- a/print/SimplePipelineFilter/FilterSample.def +++ /dev/null @@ -1,8 +0,0 @@ -LIBRARY "FilterSample.DLL" - -EXPORTS - DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE - - - diff --git a/print/SimplePipelineFilter/FilterSample.rc b/print/SimplePipelineFilter/FilterSample.rc deleted file mode 100644 index caf78af0..00000000 --- a/print/SimplePipelineFilter/FilterSample.rc +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT2_UNKNOWN -#define VER_FILEDESCRIPTION_STR "Print Pipeline WDK Filter Sample" -#define VER_INTERNALNAME_STR "WdkPipelineFilter.dll" -#define VER_ORIGINALFILENAME_STR "WdkPipelineFilter.dll" - -#include "common.ver" diff --git a/print/SimplePipelineFilter/README.md b/print/SimplePipelineFilter/README.md deleted file mode 100644 index b3a1567c..00000000 --- a/print/SimplePipelineFilter/README.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -page_type: sample -description: "This sample shows how to use the print pipeline's filter interfaces." -languages: -- cpp -products: -- windows -- windows-wdk ---- - -# Print Pipeline Simple Filter - -The printing system supports a print filter pipeline. The pipeline is run when a print job is consumed by the print spooler and sent to the device. - -This sample shows how to use the print pipeline's filter interfaces. - -The filters in the print pipeline consume a certain data type and produce a certain data type. This information is specified in the pipeline configuration file on a per printer driver basis. - -The WDK print filter sample contains two filter samples: one that consumes and produces XPS data type, and the other one consumes and produces opaque byte stream. For more information, see [XPS Printer Driver (XPSDrv)](https://docs.microsoft.com/windows-hardware/drivers/print/xpsdrv-printer-driver). diff --git a/print/SimplePipelineFilter/SimplePipelineFilter.sln b/print/SimplePipelineFilter/SimplePipelineFilter.sln deleted file mode 100644 index fb7b4926..00000000 --- a/print/SimplePipelineFilter/SimplePipelineFilter.sln +++ /dev/null @@ -1,34 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26430.16 -MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WdkPipelineFilter", "WdkPipelineFilter.vcxproj", "{80A8ADEB-D954-428E-8809-7308A4F007EF}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM64 = Debug|ARM64 - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|ARM64 = Release|ARM64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {80A8ADEB-D954-428E-8809-7308A4F007EF}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {80A8ADEB-D954-428E-8809-7308A4F007EF}.Debug|ARM64.Build.0 = Debug|ARM64 - {80A8ADEB-D954-428E-8809-7308A4F007EF}.Debug|Win32.ActiveCfg = Debug|Win32 - {80A8ADEB-D954-428E-8809-7308A4F007EF}.Debug|Win32.Build.0 = Debug|Win32 - {80A8ADEB-D954-428E-8809-7308A4F007EF}.Debug|x64.ActiveCfg = Debug|x64 - {80A8ADEB-D954-428E-8809-7308A4F007EF}.Debug|x64.Build.0 = Debug|x64 - {80A8ADEB-D954-428E-8809-7308A4F007EF}.Release|ARM64.ActiveCfg = Release|ARM64 - {80A8ADEB-D954-428E-8809-7308A4F007EF}.Release|ARM64.Build.0 = Release|ARM64 - {80A8ADEB-D954-428E-8809-7308A4F007EF}.Release|Win32.ActiveCfg = Release|Win32 - {80A8ADEB-D954-428E-8809-7308A4F007EF}.Release|Win32.Build.0 = Release|Win32 - {80A8ADEB-D954-428E-8809-7308A4F007EF}.Release|x64.ActiveCfg = Release|x64 - {80A8ADEB-D954-428E-8809-7308A4F007EF}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/print/SimplePipelineFilter/StreamFilter.cxx b/print/SimplePipelineFilter/StreamFilter.cxx deleted file mode 100644 index a03aafe0..00000000 --- a/print/SimplePipelineFilter/StreamFilter.cxx +++ /dev/null @@ -1,263 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// This source code is intended only as a supplement to Microsoft -// Development Tools and/or on-line documentation. See these other -// materials for detailed information regarding Microsoft code samples. -// -// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY -// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. -// -// Abstract: -// WDK print filter sample. -// This is the C file for the stream filter sample. -// -//---------------------------------------------------------------------------- - -#include "precomp.hxx" -#include "main.hxx" -#include "StreamFilter.tmh" -#include "StreamFilter.hxx" - -#include "winddiui.h" -#include "compstui.h" -#include "printoem.h" - -#include "initguid.h" -#include "prcomoem.h" - -_Analysis_mode_(_Analysis_code_type_user_driver_) - -// -// 5f5460d2-b313-44ca-82e4-37f83d793999 - generate a guid, do not use this one in your code -// -const GUID StreamFilterGuid = {0x5f5460d2, 0xb313, 0x44ca, {0x82, 0xe4, 0x37, 0xf8, 0x3d, 0x79, 0x39, 0x99}}; - -const GUID& -StreamFilter:: -FilterClsid( - void - ) -{ - return StreamFilterGuid; -} - -StreamFilter:: -StreamFilter() : - m_bShutdown(false), - m_cRef(1) -{ -} - -// -// IUnknown methods -// -__override -STDMETHODIMP -StreamFilter:: -QueryInterface( - _In_ REFIID riid, - _Out_ void **ppv - ) -{ - HRESULT hRes = E_POINTER; - - if (ppv) - { - hRes = E_NOINTERFACE; - - *ppv = NULL; - - if (riid == IID_IPrintPipelineFilter) - { - *ppv = static_cast(this); - } - else if (riid == IID_IUnknown) - { - *ppv = static_cast(this); - } - - if (*ppv) - { - AddRef(); - - hRes = S_OK; - } - } - - return hRes; -} - -__override -STDMETHODIMP_(ULONG) -StreamFilter:: -AddRef( - void - ) -{ - return InterlockedIncrement(&m_cRef); -} - -__override -STDMETHODIMP_(ULONG) -StreamFilter:: -Release( - void - ) -{ - ULONG cRefCount = InterlockedDecrement(&m_cRef); - - if (cRefCount) - { - return cRefCount; - } - - delete this; - - return 0; -} - -// -// IPrintPipelineFilter -// -__override -STDMETHODIMP -StreamFilter:: -ShutdownOperation( - void - ) -{ - m_bShutdown = true; - - return S_OK; -} - -__override -STDMETHODIMP -StreamFilter:: -InitializeFilter( - _In_ IInterFilterCommunicator *pIFilterCommunicator, - _In_ IPrintPipelinePropertyBag *pIPropertyBag, - _In_ IPrintPipelineManagerControl *pIPipelineControl - ) -{ - HRESULT hr = S_OK; - VARIANT varHelper; - PCSTR *pFeatures = NULL; - DWORD dwFeatures = 0; - Tools::SmartPtr pHelper; - - VariantInit(&varHelper); - - // - // StreamAccessSequential, IID_IPrintReadStream - // - hr = pIFilterCommunicator->RequestReader(reinterpret_cast(&m_pIRead)); - - if (SUCCEEDED(hr)) - { - // - // StreamAccessSequential, StreamModify, IID_IPrintWriteStream - // - hr = pIFilterCommunicator->RequestWriter(reinterpret_cast(&m_pIWrite)); - } - - if (SUCCEEDED(hr)) - { - m_pIPipelineControl = pIPipelineControl; - } - - // - // This shows how to use the helper interface to read information - // from a UnidrvUI based configuration module. - // - - if (SUCCEEDED(hr)) - { - hr = pIPropertyBag->GetProperty(L"IPrintCoreHelper", &varHelper); - } - - if (SUCCEEDED(hr) && V_UNKNOWN(&varHelper)) - { - hr = (V_UNKNOWN(&varHelper))->QueryInterface(IID_IPrintCoreHelper, (VOID**)(&pHelper)); - } - - // - // No need to release buffers provided by the helper. Their - // lifetime matches that of the helper. - // - if (SUCCEEDED(hr) && pHelper) - { - hr = pHelper->EnumFeatures(&pFeatures, &dwFeatures); - } - - if (SUCCEEDED(hr) && dwFeatures > 0) - { - for (DWORD i = 0; i < dwFeatures; i++) - { - DoTraceMessage(WS_TRACE, L"StreamFilter::InitializeFilter: Feature found: %s", pFeatures[i]); - } - } - - VariantClear(&varHelper); - - return hr; -} - -__override -STDMETHODIMP -StreamFilter:: -StartOperation( - void - ) -{ - HRESULT hr = S_OK; - Tools::SmartPtr pIErrorInfo; - DWORD cbRead; - BYTE *pReadBuf; - BOOL bEof = FALSE; - - pReadBuf = new BYTE[kBufferSize]; - - if (!pReadBuf) - { - hr = E_OUTOFMEMORY; - } - - while (SUCCEEDED(hr) && !bEof && !m_bShutdown) - { - hr = m_pIRead->ReadBytes(pReadBuf, kBufferSize, &cbRead, &bEof); - - if (SUCCEEDED(hr) && cbRead) - { - ULONG cbWritten; - - hr = m_pIWrite->WriteBytes(pReadBuf, cbRead, &cbWritten); - - if (SUCCEEDED(hr)) - { - DoTraceMessage(WS_TRACE, "StreamFilter::StartOperation read and wrote %u bytes", cbRead); - } - } - } - - m_pIWrite->Close(); - - if (FAILED(hr)) - { - m_pIPipelineControl->RequestShutdown(hr, pIErrorInfo); - } - - if (m_pIPipelineControl) - { - m_pIPipelineControl->FilterFinished(); - } - - delete [] pReadBuf; - - return hr; -} - - diff --git a/print/SimplePipelineFilter/StreamFilter.hxx b/print/SimplePipelineFilter/StreamFilter.hxx deleted file mode 100644 index c23f5fb2..00000000 --- a/print/SimplePipelineFilter/StreamFilter.hxx +++ /dev/null @@ -1,99 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// This source code is intended only as a supplement to Microsoft -// Development Tools and/or on-line documentation. See these other -// materials for detailed information regarding Microsoft code samples. -// -// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY -// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. -// -// Abstract: -// WDK print filter sample. -// This is the header file for the stream filter sample. -// -//---------------------------------------------------------------------------- - -#ifndef _STREAM_FILTER_SAMPLE_HXX_ -#define _STREAM_FILTER_SAMPLE_HXX_ - -class StreamFilter : - public IPrintPipelineFilter, - private DllLockManager -{ -public: - - StreamFilter(); - - // - // IUnknown methods - // - __override - STDMETHODIMP - QueryInterface( - _In_ REFIID riid, - _Out_ void **ppv - ); - - __override - STDMETHODIMP_(ULONG) - AddRef( - void - ); - - __override - STDMETHODIMP_(ULONG) - Release( - void - ); - - // - // IPrintPipelineFilter - // - __override - STDMETHODIMP - ShutdownOperation( - void - ); - - __override - STDMETHODIMP - InitializeFilter( - _In_ IInterFilterCommunicator *pINegotiation, - _In_ IPrintPipelinePropertyBag *pIPropertyBag, - _In_ IPrintPipelineManagerControl *pIPipelineControl - ); - - __override - STDMETHODIMP - StartOperation( - void - ); - - // - // Other methods - // - static - const GUID& - FilterClsid( - void - ); - -private: - - enum - { - kBufferSize = 0x10000 - }; - - Tools::SmartPtr m_pIRead; - Tools::SmartPtr m_pIWrite; - Tools::SmartPtr m_pIPipelineControl; - Tools::SmartPtr m_pProgressReport; - bool m_bShutdown; - LONG m_cRef; -}; - -#endif // _STREAM_FILTER_SAMPLE_HXX_ diff --git a/print/SimplePipelineFilter/WdkPipelineFilter.vcxproj b/print/SimplePipelineFilter/WdkPipelineFilter.vcxproj deleted file mode 100644 index cfbb05f1..00000000 --- a/print/SimplePipelineFilter/WdkPipelineFilter.vcxproj +++ /dev/null @@ -1,407 +0,0 @@ - - - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {80A8ADEB-D954-428E-8809-7308A4F007EF} - $(MSBuildProjectName) - Debug - Win32 - {57FB75E7-A506-4E55-82FE-E7EB9DF22861} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - true - ;%(AdditionalIncludeDirectories) - precomp.hxx - Use - $(IntDir)\precomp.hxx.pch - - - true - ;%(AdditionalIncludeDirectories) - precomp.hxx - Use - $(IntDir)\precomp.hxx.pch - - - true - ;%(AdditionalIncludeDirectories) - precomp.hxx - Use - $(IntDir)\precomp.hxx.pch - - - true - - - - WdkPipelineFilter - - - WdkPipelineFilter - - - WdkPipelineFilter - - - WdkPipelineFilter - - - WdkPipelineFilter - - - WdkPipelineFilter - - - - %(AdditionalDependencies);user32.lib;kernel32.lib;oleaut32.lib;ole32.lib;uuid.lib;advapi32.lib - - - - - %(AdditionalDependencies);user32.lib;kernel32.lib;oleaut32.lib;ole32.lib;uuid.lib;advapi32.lib - - - - - %(AdditionalDependencies);user32.lib;kernel32.lib;oleaut32.lib;ole32.lib;uuid.lib;advapi32.lib - - - - - %(AdditionalDependencies);user32.lib;kernel32.lib;oleaut32.lib;ole32.lib;uuid.lib;advapi32.lib - - - - - %(AdditionalDependencies);user32.lib;kernel32.lib;oleaut32.lib;ole32.lib;uuid.lib;advapi32.lib - - - - - %(AdditionalDependencies);user32.lib;kernel32.lib;oleaut32.lib;ole32.lib;uuid.lib;advapi32.lib - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - MultiThreaded - MultiThreadedDebug - true - Level4 - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - - - MultiThreaded - MultiThreadedDebug - true - Level4 - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - - - MultiThreaded - MultiThreadedDebug - true - Level4 - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - - - MultiThreaded - MultiThreadedDebug - true - Level4 - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - - - MultiThreaded - MultiThreadedDebug - true - Level4 - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - - - MultiThreaded - MultiThreadedDebug - true - Level4 - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - - - %(AdditionalOptions) /ignore:4070 - FilterSample.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - FilterSample.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - FilterSample.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - FilterSample.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - FilterSample.def - - - - - - - - - %(AdditionalOptions) /ignore:4070 - FilterSample.def - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.hxx - Create - $(IntDir)\precomp.hxx.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/SimplePipelineFilter/WdkPipelineFilter.vcxproj.Filters b/print/SimplePipelineFilter/WdkPipelineFilter.vcxproj.Filters deleted file mode 100644 index 278a2bc6..00000000 --- a/print/SimplePipelineFilter/WdkPipelineFilter.vcxproj.Filters +++ /dev/null @@ -1,91 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {E2F5222E-16C8-4A9F-810F-C8FDBA80C0AB} - - - h;hpp;hxx;hm;inl;inc;xsd - {E4866573-4690-40FB-9605-867A9A7433FA} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {A0672880-4BAF-4978-99DA-3AB202EF3F3A} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - Header Files - - - - - - - - - - Source Files - - - \ No newline at end of file diff --git a/print/SimplePipelineFilter/XpsFilter.cxx b/print/SimplePipelineFilter/XpsFilter.cxx deleted file mode 100644 index fe4945d0..00000000 --- a/print/SimplePipelineFilter/XpsFilter.cxx +++ /dev/null @@ -1,785 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// This source code is intended only as a supplement to Microsoft -// Development Tools and/or on-line documentation. See these other -// materials for detailed information regarding Microsoft code samples. -// -// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY -// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. -// -// Abstract: -// WDK print filter sample. -// This is the C file for the stream filter sample. -// -//---------------------------------------------------------------------------- - -#include "precomp.hxx" -#include "main.hxx" -#include "XpsFilter.tmh" -#include "XpsFilter.hxx" - -_Analysis_mode_(_Analysis_code_type_user_driver_) - -// -// 8267d291-6ddd-4972-a94e-3ce88149a1fa - generate a guid, do not use this one in your code -// -const GUID ClsidXpsFilter = {0x8267d291, 0x6ddd, 0x4972, {0xa9, 0x4e, 0x3c, 0xe8, 0x81, 0x49, 0xa1, 0xfa}}; - -const GUID& -XpsFilter:: -FilterClsid( - void - ) -{ - return ClsidXpsFilter; -} - -#define COUNTOF(x) (sizeof(x)/sizeof(*x)) - -HRESULT -GetLastErrorAsHResult( - void - ) -{ - DWORD dwError = GetLastError(); - - return HRESULT_FROM_WIN32(dwError); -} - -HRESULT -ProcessTicket( - _In_ IPartPrintTicket *pIPrintTicket - ) -{ - Tools::SmartBSTR bstr; - - HRESULT hRes = pIPrintTicket->GetUri(&bstr); - - if (SUCCEEDED(hRes)) - { - Tools::SmartPtr pIStream; - - hRes = pIPrintTicket->GetStream(&pIStream); - - if (SUCCEEDED(hRes)) - { - ULONG cbRead = 0; - BOOL bEof = FALSE; - - DoTraceMessage(WS_TRACE, "ProcessTicket print ticket follows."); - - do - { - BYTE buf[200] = {0}; - - // - // Save one byte to ensure null termination - // - if (SUCCEEDED(hRes = pIStream->ReadBytes(buf, COUNTOF(buf) - 1, &cbRead, &bEof)) && cbRead) - { - // - // use PT data - // - DoTraceMessage(WS_TRACE, "%s", reinterpret_cast(buf)); - } - } - while (!bEof && cbRead && SUCCEEDED(hRes)); - } - } - - return hRes; -} - -HRESULT -AddFontToPage( - _In_ IPartFont *pNewFont, - _In_ IPrintWriteStream *pFontStream, - _In_ IFixedPage *pNewPage - ) -{ - WCHAR szFont[MAX_PATH]; - HRESULT hRes = S_OK; - - if (!GetWindowsDirectory(szFont, MAX_PATH)) - { - hRes = GetLastErrorAsHResult(); - } - - if (SUCCEEDED(hRes)) - { - hRes = StringCchCat(szFont, MAX_PATH, L"\\fonts\\verdana.TTF"); - } - - if (SUCCEEDED(hRes)) - { - HANDLE hFile = CreateFile(szFont, - GENERIC_READ, - FILE_SHARE_READ, - NULL, - OPEN_EXISTING, - 0, - NULL); - - if (hFile != INVALID_HANDLE_VALUE) - { - BYTE buf[400]; - ULONG cbBuf = 400; - ULONG cbRead, cbWritten; - - do - { - if (ReadFile(hFile, buf, cbBuf, &cbRead, NULL)) - { - hRes = pFontStream->WriteBytes(buf, cbRead, &cbWritten); - } - else - { - hRes = GetLastErrorAsHResult(); - } - } - while (SUCCEEDED(hRes) && cbRead); - - CloseHandle(hFile); - } - else - { - hRes = GetLastErrorAsHResult(); - } - - pFontStream->Close(); - } - - if (SUCCEEDED(hRes)) - { - hRes = pNewPage->SetPagePart(pNewFont); - } - - return hRes; -} - -HRESULT -AddTextToPage( - _In_ PCWSTR pszReferencedFont, - _In_ IPrintWriteStream *pPageMarkupStream - ) -{ - HRESULT hRes; - ULONG cb; - CHAR buf[500]; - - // - // Mark up for page generated on the fly: "hello world" - // - CHAR sz[] = "" - "" - ""; - - // - // Insert the URI of the font we added to the document - // - hRes = StringCchPrintfA(buf, COUNTOF(buf), sz, pszReferencedFont); - - // - // Write markup for page - // - if (SUCCEEDED(hRes) && - SUCCEEDED(hRes = pPageMarkupStream->WriteBytes(buf, static_cast(strlen(buf)), &cb))) - { - pPageMarkupStream->Close(); - } - - return hRes; -} - -// -// This function reads the page content and writes it back. Can be extended -// to do useful work -// -HRESULT -ModifyContent( - _In_ IPrintReadStream *pRead, - _In_ IPrintWriteStream *pWrite - ) -{ - CHAR buf[100] = {0}; - HRESULT hRes; - ULONG cbr, cbw; - BOOL bEof = FALSE; - - do - { - hRes = pRead->ReadBytes(buf, sizeof(buf), &cbr, &bEof); - - if (SUCCEEDED(hRes) && cbr) - { - // - // do something with buffer - // - cbw = cbr; - - hRes = pWrite->WriteBytes(buf, cbr, &cbw); - } - } - while (!bEof && cbr && SUCCEEDED(hRes)); - - return hRes; -} - -HRESULT -XpsFilter:: -ProcessImagePart( - _In_ IPartImage *pIPartImage - ) -{ - Tools::SmartBSTR bstr; - - HRESULT hRes = pIPartImage->GetUri(&bstr); - - DoTraceMessage(WS_TRACE, "ProcessImagePart uri %ws", static_cast(bstr)); - - if (SUCCEEDED(hRes)) - { - Tools::SmartPtr pRead; - - if (SUCCEEDED(hRes = pIPartImage->GetStream(&pRead))) - { - // - // do something with image - // - } - } - - return hRes; -} - -// -// Non-static members -// -XpsFilter:: -XpsFilter() : - m_bShutdown(false), - m_cRef(1), - m_cIdCount(0) -{ -} - -HRESULT -XpsFilter:: -ProcessFixedPage( - _In_ void *pVoid - ) -{ - Tools::SmartPtr pIFixedPage; - - // - // XpsFilter::ProcessPart already incremented the reference count for the object. This - // function is taking ownership of the object, there is no need for another AddRef call - // (hence the Attach) - // - pIFixedPage.Attach(static_cast(pVoid)); - - HRESULT hRes; - Tools::SmartBSTR bstr; - - if (SUCCEEDED(pIFixedPage->GetUri(&bstr))) - { - DoTraceMessage(WS_TRACE, "ProcessFixedPage uri %ws", static_cast(bstr)); - } - - Tools::SmartPtr pIPrintTicket; - - hRes = pIFixedPage->GetPrintTicket(&pIPrintTicket); - - if (SUCCEEDED(hRes)) - { - hRes = ProcessTicket(pIPrintTicket); - } - else if (hRes == E_ELEMENT_NOT_FOUND) - { - // - // No ticket. Benign. - // - hRes = S_OK; - - DoTraceMessage(WS_WARNING, "ProcessFixedPage uri %ws. Page print ticket not present.", static_cast(bstr)); - } - - pIFixedPage->SetPartCompression(Compression_Small); - - // - // modify content for page, optional - // - Tools::SmartPtr pRead; - Tools::SmartPtr pWrite; - - if (SUCCEEDED(hRes = pIFixedPage->GetStream(&pRead)) && - SUCCEEDED(hRes = pIFixedPage->GetWriteStream(&pWrite))) - { - hRes = ModifyContent(pRead, pWrite); - - pWrite->Close(); - } - - // - // Send page to next filter - // - if (SUCCEEDED(hRes)) - { - hRes = m_pReachConsumer->SendFixedPage(pIFixedPage); - } - - // - // Add a new page - // - if (SUCCEEDED(hRes)) - { - Tools::SmartPtr pNewPage; - Tools::SmartPtr pNewPageMarkupStream; - Tools::SmartPtr pNewFont; - Tools::SmartPtr pNewFontStream; - - WCHAR szName[MAX_PATH]; - - // - // Generate unique page name - // - if (SUCCEEDED(hRes = StringCchPrintf(szName, MAX_PATH, L"/pages/newaddedpage%u.xaml", m_cIdCount++))) - { - // - // Create new fixed page - // - hRes = m_pReachConsumer->GetNewEmptyPart(szName, - IID_IFixedPage, - reinterpret_cast(&pNewPage), - &pNewPageMarkupStream); - - DoTraceMessage(WS_TRACE, "ProcessFixedPage new page %ws", szName); - } - - // - // Generate unique font name, this can, of course, be optimized so we don't include - // the same font multiple times. But this code is supposed to just to show how to - // add a font - // - if (SUCCEEDED(hRes = StringCchPrintf(szName, MAX_PATH, L"/font_%u.ttf", m_cIdCount++))) - { - // - // Create new font resource - // - hRes = m_pReachConsumer->GetNewEmptyPart(szName, - IID_IPartFont, - reinterpret_cast(&pNewFont), - &pNewFontStream); - - DoTraceMessage(WS_TRACE, "ProcessFixedPage new font %ws", szName); - } - - if (SUCCEEDED(hRes) && - SUCCEEDED(hRes = AddFontToPage(pNewFont, pNewFontStream, pNewPage)) && - SUCCEEDED(hRes = AddTextToPage(szName, pNewPageMarkupStream))) - { - // - // Send page to next filter - // - hRes = m_pReachConsumer->SendFixedPage(pNewPage); - } - } - - return hRes; -} - - - -struct Pair_t -{ - typedef HRESULT (XpsFilter::*PFN)(void *); - - Pair_t(REFIID d, PFN n) : iid(d), pfn(n) {} - - REFIID iid; - PFN pfn; - -private: - - Pair_t& operator=(const Pair_t&); -}; - - -HRESULT -XpsFilter:: -ProcessPart( - _In_ IUnknown *pUnk - ) -{ - HRESULT hRes = S_OK; - - Pair_t pairs[] = - { - Pair_t(IID_IXpsDocument, &XpsFilter::ProcessXpsDoc), - Pair_t(IID_IFixedDocumentSequence, &XpsFilter::ProcessFixedDocSequence), - Pair_t(IID_IFixedDocument, &XpsFilter::ProcessFixedDoc), - Pair_t(IID_IFixedPage, &XpsFilter::ProcessFixedPage), - }; - - // - // Detect what part we got - // - for (ULONG i = 0; i < sizeof(pairs)/sizeof(*pairs); i++) - { - void *pvoid = NULL; - - if (SUCCEEDED(hRes = pUnk->QueryInterface(pairs[i].iid, &pvoid))) - { - // - // QueryInterface increments the reference count for the object it returns - // - hRes = (this->*pairs[i].pfn)(pvoid); - - break; - } - else if (hRes != E_NOINTERFACE) - { - break; - } - } - - // - // IPartDiscardControl objects may float through the pipeline. The code above does not check for IPartDiscardControl. - // So, for maximum compatibility, the filter forwards parts that it doesn't understand. - // - if (hRes == E_NOINTERFACE) - { - hRes = m_pReachConsumer->SendXpsUnknown(pUnk); - } - - return hRes; -} - -HRESULT -XpsFilter:: -ProcessXpsDoc( - _In_ void *pVoid - ) -{ - Tools::SmartPtr pIXpsDoc; - - pIXpsDoc.Attach(static_cast(pVoid)); - - DoTraceMessage(WS_TRACE, L"ProcessXpsDoc"); - - return m_pReachConsumer->SendXpsDocument(pIXpsDoc); -} - -HRESULT -XpsFilter:: -ProcessFixedDocSequence( - _In_ void *pVoid - ) -{ - Tools::SmartPtr pIFixedDocumentSequence; - - // - // XpsFilter::ProcessPart already incremented the reference count for the object. This - // function is taking ownership of the object, there is no need for another AddRef call - // (hence the Attach) - // - pIFixedDocumentSequence.Attach(static_cast(pVoid)); - - Tools::SmartBSTR bstr; - - if (SUCCEEDED(pIFixedDocumentSequence->GetUri(&bstr))) - { - DoTraceMessage(WS_TRACE, "ProcessFixedDocSequence uri %ws", static_cast(bstr)); - } - - Tools::SmartPtr pIPrintTicket; - - HRESULT hRes = pIFixedDocumentSequence->GetPrintTicket(&pIPrintTicket); - - if (SUCCEEDED(hRes)) - { - hRes = ProcessTicket(pIPrintTicket); - } - else if (hRes == E_ELEMENT_NOT_FOUND) - { - // - // No ticket. Benign. - // - hRes = S_OK; - - DoTraceMessage(WS_WARNING, "ProcessFixedDocSequence uri %ws. Page print ticket not present.", static_cast(bstr)); - } - - return m_pReachConsumer->SendFixedDocumentSequence(pIFixedDocumentSequence); -} - -HRESULT -XpsFilter:: -ProcessFixedDoc( - _In_ void *pVoid - ) -{ - Tools::SmartPtr pIFixedDocument; - - // - // XpsFilter::ProcessPart already incremented the reference count for the object. This - // function is taking ownership of the object, there is not need for another AddRef call - // (hence the Attach) - // - pIFixedDocument.Attach(static_cast(pVoid)); - - Tools::SmartBSTR bstr; - - if (SUCCEEDED(pIFixedDocument->GetUri(&bstr))) - { - DoTraceMessage(WS_TRACE, "ProcessFixedDoc uri %ws", static_cast(bstr)); - } - - Tools::SmartPtr pIPrintTicket; - - HRESULT hRes = pIFixedDocument->GetPrintTicket(&pIPrintTicket); - - if (SUCCEEDED(hRes)) - { - hRes = ProcessTicket(pIPrintTicket); - } - else if (hRes == E_ELEMENT_NOT_FOUND) - { - // - // No ticket. Benign. - // - hRes = S_OK; - - DoTraceMessage(WS_WARNING, "ProcessFixedDoc uri %ws. Page print ticket not present.", static_cast(bstr)); - } - - return m_pReachConsumer->SendFixedDocument(pIFixedDocument); -} - -// -// IPrintPipelineFilter -// -__override -STDMETHODIMP -XpsFilter:: -ShutdownOperation( - void - ) -{ - m_bShutdown = true; - - return S_OK; -} - -__override -STDMETHODIMP -XpsFilter:: -InitializeFilter( - _In_ IInterFilterCommunicator *pIfc, - _In_ IPrintPipelinePropertyBag *pIPropertyBag, - _In_ IPrintPipelineManagerControl *pIPipelineControl - ) -{ - HRESULT hRes = S_OK; - - // - // IID_IReachPackageProvider must be specified in the config file - // - hRes = pIfc->RequestReader(reinterpret_cast(&m_pReachProvider)); - - if (SUCCEEDED(hRes)) - { - // - // IID_IReachPackageConsumer must be specified in the config file - // - hRes = pIfc->RequestWriter(reinterpret_cast(&m_pReachConsumer)); - - m_pIPipelineControl = pIPipelineControl; - } - - VARIANT var, var2, var3, var4; - - VariantInit(&var); - VariantInit(&var2); - VariantInit(&var3); - VariantInit(&var4); - - if (SUCCEEDED(hRes) && - SUCCEEDED(hRes = pIPropertyBag->GetProperty(XPS_FP_PRINTER_NAME, &var)) && - SUCCEEDED(hRes = pIPropertyBag->GetProperty(XPS_FP_PRINTER_HANDLE, &var2)) && - SUCCEEDED(hRes = pIPropertyBag->GetProperty(XPS_FP_JOB_ID, &var3)) && - SUCCEEDED(hRes = pIPropertyBag->GetProperty(XPS_FP_USER_TOKEN, &var4))) - { - PWSTR pszName = var.bstrVal; - HANDLE hPrinter = var2.byref; - ULONG jobId = var3.ulVal; - HANDLE hUserSecurityToken = var4.byref; - - // - // Filter can use devmode, hPrinter and pszName. byref value should not be freed/deleted - // in any way. bstrVal must be deleted by clearing the variant. - // - - // - // Do not free any byref resource. Ex: do not call CloseHandle on the security token - // - - // - // Remove these if you use the variables. This is in order to build clean with /W4 - // - UNREFERENCED_PARAMETER(jobId); - UNREFERENCED_PARAMETER(hPrinter); - UNREFERENCED_PARAMETER(pszName); - - // - // Sample code to show how to impersonate in order to access resources on behalf of the - // user who submitted the job - // - if (SetThreadToken(NULL, hUserSecurityToken)) - { - // - // now revert back to the original security context - // - if (!SetThreadToken(NULL, NULL)) - { - hRes = GetLastErrorAsHResult(); - } - } - else - { - hRes = GetLastErrorAsHResult(); - } - } - - VariantClear(&var); - VariantClear(&var2); - VariantClear(&var3); - VariantClear(&var4); - - // - // Example of how to add and delete a property from the bag - // - var.vt = VT_I4; - var.lVal = 5; - - if (SUCCEEDED(hRes) && - SUCCEEDED(hRes = pIPropertyBag->AddProperty(L"TestProperty", &var))) - { - hRes = pIPropertyBag->DeleteProperty(L"TestProperty") ? S_OK : E_FAIL; - } - - - return hRes; -} - -__override -STDMETHODIMP -XpsFilter:: -StartOperation( - void - ) -{ - HRESULT hRes = S_OK; - - while (SUCCEEDED(hRes) && !m_bShutdown) - { - Tools::SmartPtr pUnk; - - hRes = m_pReachProvider->GetXpsPart(&pUnk); - - if (SUCCEEDED(hRes)) - { - if (!pUnk) - { - // - // End of objects - // - break; - } - - hRes = ProcessPart(pUnk); - } - } - - m_pReachConsumer->CloseSender(); - - if (FAILED(hRes)) - { -#pragma prefast(suppress:__WARNING_INVALID_PARAM_VALUE_1, "MSDN requires that pReason be NULL.") - m_pIPipelineControl->RequestShutdown(hRes, NULL); - } - - m_pIPipelineControl->FilterFinished(); - - return hRes; -} - -// -// IUnknown -// -STDMETHODIMP_(ULONG) -XpsFilter:: -AddRef( - VOID - ) -{ - return InterlockedIncrement(&m_cRef); -} - -STDMETHODIMP_(ULONG) -XpsFilter:: -Release( - VOID - ) -{ - ULONG cRefCount = InterlockedDecrement(&m_cRef); - - if (cRefCount) - { - return cRefCount; - } - - delete this; - - return 0; -} - -STDMETHODIMP -XpsFilter:: -QueryInterface( - _In_ REFIID riid, - _Out_ VOID **ppv - ) -{ - HRESULT hRes = E_POINTER; - - if (ppv) - { - hRes = E_NOINTERFACE; - - *ppv = NULL; - - if (riid == IID_IPrintPipelineFilter) - { - *ppv = static_cast(this); - } - else if (riid == IID_IUnknown) - { - *ppv = static_cast(this); - } - - if (*ppv) - { - AddRef(); - - hRes = S_OK; - } - } - - return hRes; -} - diff --git a/print/SimplePipelineFilter/XpsFilter.hxx b/print/SimplePipelineFilter/XpsFilter.hxx deleted file mode 100644 index 003650a6..00000000 --- a/print/SimplePipelineFilter/XpsFilter.hxx +++ /dev/null @@ -1,126 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// This source code is intended only as a supplement to Microsoft -// Development Tools and/or on-line documentation. See these other -// materials for detailed information regarding Microsoft code samples. -// -// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY -// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. -// -// Abstract: -// WDK print filter sample. -// This is the header file for the XPS sample. -// -//---------------------------------------------------------------------------- - -#ifndef _XPS_FILTER_SAMPLE_HXX_ -#define _XPS_FILTER_SAMPLE_HXX_ - -class XpsFilter : - public IPrintPipelineFilter, - private DllLockManager -{ -public: - - XpsFilter(); - - // - // IUnknown methods - // - __override - STDMETHODIMP - QueryInterface( - _In_ REFIID riid, - _Out_ void **ppv - ); - - __override - STDMETHODIMP_(ULONG) - AddRef( - void - ); - - __override - STDMETHODIMP_(ULONG) - Release( - void - ); - - // - // IPrintPipelineFilter - // - __override - STDMETHODIMP - ShutdownOperation( - void - ); - - __override - STDMETHODIMP - InitializeFilter( - _In_ IInterFilterCommunicator *pINegotiation, - _In_ IPrintPipelinePropertyBag *pIPropertyBag, - _In_ IPrintPipelineManagerControl *pIPipelineControl - ); - - __override - STDMETHODIMP - StartOperation( - void - ); - - // - // Other methods - // - static - const GUID& - FilterClsid( - void - ); - -private: - - HRESULT - ProcessFixedPage( - _In_ void *pVoid - ); - - HRESULT - ProcessXpsDoc( - _In_ void *pVoid - ); - - HRESULT - ProcessFixedDocSequence( - _In_ void *pVoid - ); - - HRESULT - ProcessFixedDoc( - _In_ void *pVoid - ); - - HRESULT - ProcessPart( - _In_ IUnknown *pUnk - ); - - static - HRESULT - ProcessImagePart( - _In_ IPartImage *pIPartImage - ); - - Tools::SmartPtr m_pIPipelineControl; - Tools::SmartPtr m_pReachProvider; - Tools::SmartPtr m_pReachConsumer; - bool m_bShutdown; - LONG m_cRef; - LONG m_cIdCount; -}; - -#endif // _XPS_FILTER_SAMPLE_HXX_ - diff --git a/print/SimplePipelineFilter/main.cxx b/print/SimplePipelineFilter/main.cxx deleted file mode 100644 index 180fb4c6..00000000 --- a/print/SimplePipelineFilter/main.cxx +++ /dev/null @@ -1,172 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// This source code is intended only as a supplement to Microsoft -// Development Tools and/or on-line documentation. See these other -// materials for detailed information regarding Microsoft code samples. -// -// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY -// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. -// -// Abstract: -// WDK print filter sample. This file contains the implementation for -// DllGetClassObject and DllMain -// -//---------------------------------------------------------------------------- - -#include "precomp.hxx" -#include "main.hxx" -#include "XpsFilter.hxx" -#include "StreamFilter.hxx" -#include "main.tmh" - -_Analysis_mode_(_Analysis_code_type_user_driver_) - -LONG DllLockManager::m_cGlobalRef = 0; - -HRESULT -WINAPI -DllCanUnloadNow(void) throw() -{ - return 0 == DllLockManager::GetGlobalRef() ? S_OK : S_FALSE; -} - -HRESULT -WINAPI -DllGetClassObject( - _In_ REFCLSID rclsid, - _In_ REFIID riid, - _Outptr_ PVOID *ppv - ) throw() -{ - HRESULT hRetval = E_POINTER; - - if (ppv) - { - *ppv = NULL; - - if (rclsid == XpsFilter::FilterClsid()) - { - Tools::SmartPtr pFilter; - - pFilter.Attach(new XpsFilter()); - - if (pFilter) - { - hRetval = pFilter->QueryInterface(riid, ppv); - } - else - { - hRetval = E_OUTOFMEMORY; - } - } - else if (rclsid == StreamFilter::FilterClsid()) - { - Tools::SmartPtr pFilter; - - pFilter.Attach(new StreamFilter()); - - if (pFilter) - { - hRetval = pFilter->QueryInterface(riid, ppv); - } - else - { - hRetval = E_OUTOFMEMORY; - } - } - else - { - hRetval = CLASS_E_CLASSNOTAVAILABLE; - } - } - - return hRetval; -} - -BOOL WINAPI -DllMain( - _In_ HINSTANCE hInst, - _In_ DWORD dwReason, - _In_opt_ PVOID pReserved - ) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - DisableThreadLibraryCalls(hInst); - - WPP_INIT_TRACING(L"WdkPipelineFilter"); - } - else if (dwReason == DLL_PROCESS_DETACH) - { - WPP_CLEANUP(); - } - - UNREFERENCED_PARAMETER(dwReason); - UNREFERENCED_PARAMETER(pReserved); - - return TRUE; -} - -void -WppTraceDebugOut( - _In_z_ const WCHAR *pszFmt, - ... - ) -{ - va_list pArgs; - - va_start(pArgs, pszFmt); - - WCHAR buf[MAX_PATH]; - - if (SUCCEEDED(StringCchVPrintf(buf, - MAX_PATH, - pszFmt, - pArgs)) && - SUCCEEDED(StringCchCat(buf, - MAX_PATH, - L"\n"))) - { - OutputDebugString(buf); - } - - va_end(pArgs); -} - -void -WppTraceDebugOut( - _In_z_ const CHAR *pszFmt, - ... - ) -{ - va_list pArgs; - - va_start(pArgs, pszFmt); - - CHAR buf[MAX_PATH]; - - if (SUCCEEDED(StringCchVPrintfA(buf, - MAX_PATH, - pszFmt, - pArgs)) && - SUCCEEDED(StringCchCatA(buf, - MAX_PATH, - "\n"))) - { - OutputDebugStringA(buf); - } - - va_end(pArgs); -} - - - - - - - - - diff --git a/print/SimplePipelineFilter/main.hxx b/print/SimplePipelineFilter/main.hxx deleted file mode 100644 index 88d8c052..00000000 --- a/print/SimplePipelineFilter/main.hxx +++ /dev/null @@ -1,51 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// This source code is intended only as a supplement to Microsoft -// Development Tools and/or on-line documentation. See these other -// materials for detailed information regarding Microsoft code samples. -// -// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY -// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. -// -// Abstract: -// WDK print filter sample. -// The filters need to derive from DllLockManager. Thus the filter constructor and -// destructor call the DllLockManager constructor and destructor, respectively. -// -//---------------------------------------------------------------------------- - -#ifndef _FILTER_MAIN_HXX_ -#define _FILTER_MAIN_HXX_ - -class DllLockManager -{ -public: - - DllLockManager() - { - InterlockedIncrement(&m_cGlobalRef); - } - - ~DllLockManager() - { - InterlockedDecrement(&m_cGlobalRef); - } - - static - LONG - GetGlobalRef() - { - return InterlockedCompareExchange(&m_cGlobalRef, 0, 0); - } - -private: - - static LONG m_cGlobalRef; -}; - -#endif - - diff --git a/print/SimplePipelineFilter/precomp.hxx b/print/SimplePipelineFilter/precomp.hxx deleted file mode 100644 index 4ca7012d..00000000 --- a/print/SimplePipelineFilter/precomp.hxx +++ /dev/null @@ -1,26 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// This source code is intended only as a supplement to Microsoft -// Development Tools and/or on-line documentation. See these other -// materials for detailed information regarding Microsoft code samples. -// -// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY -// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. -// -// Abstract: -// WDK print filter sample. -// This is the precompiled header file. -// -//---------------------------------------------------------------------------- - -#include -#include -#include -#include -#include "smartptr.hxx" -#include "trace.hxx" - -_Analysis_mode_(_Analysis_code_type_user_driver_) diff --git a/print/SimplePipelineFilter/precompsrc.cpp b/print/SimplePipelineFilter/precompsrc.cpp deleted file mode 100644 index 5d84a122..00000000 --- a/print/SimplePipelineFilter/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.hxx" \ No newline at end of file diff --git a/print/SimplePipelineFilter/smartptr.hxx b/print/SimplePipelineFilter/smartptr.hxx deleted file mode 100644 index 7f20c530..00000000 --- a/print/SimplePipelineFilter/smartptr.hxx +++ /dev/null @@ -1,233 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// This source code is intended only as a supplement to Microsoft -// Development Tools and/or on-line documentation. See these other -// materials for detailed information regarding Microsoft code samples. -// -// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY -// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. -// -// Abstract: -// WDK print filter sample. -// This file contains a smart pointer implementation. -// -//---------------------------------------------------------------------------- - -#ifndef __SAMPLE_SMART_PTR_HXX__ -#define __SAMPLE_SMART_PTR_HXX__ - -namespace Tools -{ - -template -inline -void -SmartAddRef( - T *pInterface - ) throw() -{ - if (pInterface) - { - pInterface->AddRef(); - } -} - -template -inline -void -SmartRelease( - T **ppInterface - ) throw() -{ - if (*ppInterface) - { - (*ppInterface)->Release(); - *ppInterface = NULL; - } -} - -template -class SmartPtr -{ -public: - - inline - SmartPtr( - void - ) throw() : m_Pointer(NULL) - { - } - - inline - SmartPtr( - _In_opt_ T *pointer - ) throw() - : m_Pointer(pointer) - { - SmartAddRef(m_Pointer); - } - - inline - SmartPtr( - _In_ const SmartPtr © - ) throw() - { - m_Pointer = copy.m_Pointer; - SmartAddRef(m_Pointer); - } - - inline - ~SmartPtr( - void - ) throw() - { - SmartRelease(&m_Pointer); - } - - inline - SmartPtr & - operator=( - _In_opt_ T *pointer - ) throw() - { - T *temp = m_Pointer; - - m_Pointer = pointer; - SmartAddRef(m_Pointer); - SmartRelease(&temp); - - return *this; - } - - inline - SmartPtr & - operator=( - _In_ const SmartPtr © - ) throw() - { - T *temp = m_Pointer; - - m_Pointer = copy.m_Pointer; - SmartAddRef(m_Pointer); - SmartRelease(&temp); - - return *this; - } - - inline - operator T *() throw() - { - return m_Pointer; - } - - inline - operator const T *() const throw() - { - return m_Pointer; - } - - inline - T ** - operator&() throw() - { - return &m_Pointer; - } - - inline - const T ** - operator&() const throw() - { - return &m_Pointer; - } - - inline - T * - operator->() throw() - { - return m_Pointer; - } - - inline - const T * - operator->( - ) const throw() - { - return m_Pointer; - } - - inline - void - Attach( - _In_opt_ T *pointer - ) throw() - { - T *temp = m_Pointer; - m_Pointer = pointer; - - SmartRelease(&temp); - } - - inline - T * - Detach( - void - ) throw() - { - T *pTemp = m_Pointer; - m_Pointer = NULL; - - return pTemp; - } - - inline - void - Clear( - void - ) throw() - { - SmartRelease(&m_Pointer); - } - -private: - - T *m_Pointer; -}; - -/////////////////////////////////////////////////////////////////////////////// - -class SmartBSTR -{ -public: - - SmartBSTR() throw() - : m_bstr (NULL) - { - } - - ~SmartBSTR() throw() - { - ::SysFreeString(m_bstr); - } - - operator BSTR() const throw() - { - return m_bstr; - } - - BSTR* - operator&() throw() - { - return &m_bstr; - } - -private: - - BSTR m_bstr; -}; - -}; // namespace tools - -#endif diff --git a/print/SimplePipelineFilter/trace.hxx b/print/SimplePipelineFilter/trace.hxx deleted file mode 100644 index 8b905c49..00000000 --- a/print/SimplePipelineFilter/trace.hxx +++ /dev/null @@ -1,51 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// This source code is intended only as a supplement to Microsoft -// Development Tools and/or on-line documentation. See these other -// materials for detailed information regarding Microsoft code samples. -// -// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY -// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. -// -// Abstract: -// WDK print filter sample. -// Declares what is needed to Event Tracing. -// -//---------------------------------------------------------------------------- - -#ifndef __WDK_SAMPLE_TRACE_HXX__ -#define __WDK_SAMPLE_TRACE_HXX__ - -// -// Generate your own guid. Feel free to add more flags, as needed. -// -#define WPP_CONTROL_GUIDS \ - WPP_DEFINE_CONTROL_GUID(WdkSample, (79ad6dce, adad, 47ae, b49e, 41bcdccf9ed8), \ - WPP_DEFINE_BIT(WS_ERROR) \ - WPP_DEFINE_BIT(WS_WARNING) \ - WPP_DEFINE_BIT(WS_TRACE) \ - ) - -void -WppTraceDebugOut( - _In_z_ const WCHAR *pszFmt, - ... - ); - -void -WppTraceDebugOut( - _In_z_ const CHAR *pszFmt, - ... - ); - -// -// For checked builds, send output to debugger rather than to file -// -#ifdef DBG -#define WPP_DEBUG(x) WppTraceDebugOut x -#endif - -#endif diff --git a/print/XPSDrvSmpl/Package/package.VcxProj b/print/XPSDrvSmpl/Package/package.VcxProj deleted file mode 100644 index cff0717f..00000000 --- a/print/XPSDrvSmpl/Package/package.VcxProj +++ /dev/null @@ -1,161 +0,0 @@ - - - - - Debug - ARM - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - {42677515-C196-4C0F-99A2-F11E2FB55BF6} - - - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} - - - {8D542B56-EB45-43B1-AAB8-417352F5BDE6} - - - {C9C14C99-103E-45CB-B1B4-2C165429E35C} - - - {0F8262C1-75D8-4A92-BCB6-37A290891708} - - - {23BA577F-B171-4CEC-92E0-49EE44564366} - - - {1893FA97-40A9-480F-BB77-279F959EAE6E} - - - {E31D1C4F-8E0D-428A-8583-5159CE690B33} - - - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A} - - - {7441D7F2-F509-4A47-9404-3EB8653AE037} - - - - WindowsKernelModeDriver10.0 - Utility - Package - true - Debug - - - - {4A7303D2-92DB-4537-A380-24D334FC24FE} - {A7EB2426-E8C0-4DB0-A077-F37FCB01D98C} - $(MSBuildProjectName) - - - Windows10 - true - - - Windows10 - false - - - Windows10 - true - - - Windows10 - true - - - Windows10 - true - - - Windows10 - false - - - Windows10 - false - - - Windows10 - false - - - - - - - - - - - DbgengRemoteDebugger - False - None - - - - - - %PathToInf% - False - False - True - - 133563 - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/Package/package.VcxProj.Filters b/print/XPSDrvSmpl/Package/package.VcxProj.Filters deleted file mode 100644 index 1ac9986d..00000000 --- a/print/XPSDrvSmpl/Package/package.VcxProj.Filters +++ /dev/null @@ -1,21 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {DEBD3DE2-918F-4EC4-BC14-22DC48643C2A} - - - h;hpp;hxx;hm;inl;inc;xsd - {FDFF8748-4F96-4902-A7A8-D371D6258627} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {15BBE04E-6C77-4886-A5A7-AE978AA52FCD} - - - inf;inv;inx;mof;mc; - {A84D9116-BBD8-4002-84A9-63115C291561} - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/README.md b/print/XPSDrvSmpl/README.md deleted file mode 100644 index f23f78ad..00000000 --- a/print/XPSDrvSmpl/README.md +++ /dev/null @@ -1,292 +0,0 @@ ---- -page_type: sample -description: "Provide a starting point for developing XPSDrv printer drivers and to illustrate the facility and potential of an XPSDrv print driver." -languages: -- cpp -products: -- windows -- windows-wdk ---- - -# XPSDrv Driver and Filter Sample - -This sample is intended to provide a starting point for developing XPSDrv printer drivers and to illustrate the facility and potential of an XPSDrv print driver. This goal is accomplished by implementing a number of real-world features within a set of XPS print pipeline filters that are configured through a configuration plug-in that supports custom UI content and PrintTicket handling. - -Windows includes a print architecture and a document format known as XPS (XML Paper Specification). Part of the new architecture is the XPSDrv print driver, which is designed to provide a flexible, extensible path to manipulate and print an XPS spool file through a series of filters. - -This sample is intended to provide a starting point for developing XPSDrv printer drivers and to illustrate the facility and potential of an XPSDrv print driver. This goal is accomplished by implementing a number of real-world features within a set of XPS print pipeline filters that are configured through a configuration plug-in that supports custom UI content and PrintTicket handling. - -The sample broadly consists of three components: a set of filters, a configuration plug-in for handling custom UI content, and a configuration plug-in for handling more advanced PrintTicket features. For more information, see [XPS Printing Features](https://docs.microsoft.com/windows-hardware/drivers/print/xps-printing-features). - -## Build the sample - -To build a driver solution using Windows Driver Kit (WDK) 10 and Visual Studio 2017, perform the following steps. - -1. Open the solution file in Visual Studio 2017. - -1. Add all non-binary files (usually located in the \\install directory of the sample) to the Package project: - - 1. In the **Solution Explorer**, expand the **package** project and right click **Driver Files** - - 1. Select **Add**, then click **Existing Item** - - 1. Navigate to the location to which you downloaded the sample, and select all the files in the **install** directory, or the equivalent set of non-binary files such as INFs, INIs, GPD, PPD files, etc. - - 1. Click **Add** - -1. Configure these files to be added into the driver package: - - 1. In the **Solution Explorer**, right click on the solution and choose **Add** > **New Project**. Choose **Driver Install Package** under Visual C++/Windows Driver/Package. - - 1. In the **Solution Explorer**, right click the **Driver Package** project and select **Properties**. - - 1. In the left pane, click **Configuration Properties** \> **Driver Install** \> **Package Files**. (If **Package Files** is not available, you may need to re-install the **Windows Driver Kit**.) - - 1. In the right pane, click **** and use the ellipsis button (...) to browse to the set of files that needs to be added to the driver package. All of the data files added in **Step 2.iii**, except the INF file, should be added. This configuration is per architecture, so this configuration must be repeated for each architecture that will be built. - - 1. Click **OK**. - -1. Add a reference to the driver package. - - 1. In the **Solution Explorer**, right click the **package** project and select **Add Reference**. - - 1. In the right pane, check the **Driver Package** created in step 3. - - 1. Click **OK**. - -1. Open the INF file and edit it to match the built output. - - 1. Open the INF file. - - 1. In the Version section, add a reference to a catalog file like this: CatalogFile=XpsDrvSmpl.cat. - - 1. In the SourceDisksFiles section, change the location of the DLL files you are building to =1. This indicates that there is no architecture specific directory in this driver. If you ship multiple architectures simultaneously, you will need to collate the driver INF manually. - -At this point, Visual Studio 2017 will be able to build a driver package and output the files to disk. In order to configure driver signing and deployment, see [Developing, Testing, and Deploying Drivers](https://docs.microsoft.com/windows-hardware/drivers/develop/). - -> [!NOTE] -> If you compile your sample driver with Microsoft Visual Studio version 10, or 11 with the \_DEBUG flag set, then you should not use CComVariant on the following two XPS Print Filter Pipeline properties: - -- XPS\_FP\_USER\_TOKEN - -- XPS\_FP\_PRINTER\_HANDLE - -There is a known issue with the current implementation of the Print Filter Pipeline, where the variant type for these two properties is set to VT\_BYREF. And as a result of this known issue, any filter binary that is compiled with the \_DEBUG flag set will experience the ATLASSERT() failure. This is because when you use the CComVariant, its destructor checks the returned value from the Clear() function, as shown: - -```cpp -~CComVariant() throw() -{ - HRESULT hr = Clear(); - ATLASSERT(SUCCEEDED(hr)); - (hr); -} -``` - -When you compile this sample driver with Visual Studio version 9, you don't experience this problem because the destructor for CComVariant doesn't perform this check on the returned value from the Clear() function. - -## Installation - -The sample has the following prerequisites: - -- Microsoft XPS Document Writer print driver and the XPS filter-pipeline infrastructure. - -- Microsoft MSXML 6.0 - -Install the driver through the **Add Printer Wizard** by selecting \\\install as the source for the driver install. - -## Design and Operation - -### Overview - -This sample can be used as a basis for implementing a driver based on the new XPS pipeline infrastructure. - -The Page Scaling filter is written by using the stream interface to attempt to demonstrate how to use the stream interface. It thus depends on a ZIP library to handle the PK archive structure. The sample does not include the code for the PK archive handling. - -Two interfaces are defined in *ipkarch.h* and *ipkfile.h* that need support from an additional PK archive handling module called pkarch.dll. Pkarch.dll is a file that is included in the [PKWare SDK](https://support.pkware.com/pages/viewpage.action?pageId=721433). If this module is not present, the page scaling filter sample will revert to merely copying the data from the read stream to the write stream. Developers who are using this sample can choose one of the following options: - -- Simplify the scaling filter to use the XPS interfaces (like the other four filters) - -- License the third-party zip library that is used in the sample - -- Modify the sample to use another ZIP library. For example, you can modify the sample to use the [Packaging API Reference](https://docs.microsoft.com/previous-versions/windows/desktop/opc/packaging-programming-reference) - -IPKArch defines an interface for initializing, controlling, and accessing the PK archive. IPKFile defines an interface that abstracts the details of a PK archive file header record from the XPS container handling. Access to the files within the archive is provided through a map between the file name and file objects that support the IPKFile interface. This allows the XPS processing code to retrieve file data by name (a convenience as the interaction between parts and relationships between parts is defined using the part name). - -### Print Pipeline Filters - -There are five filters that are split into two types: four use the XPS filter interface and one uses the stream filter interface. The XPS interface provides the filter writer with a logical view on an XPS document by presenting logical XPS document parts (XPS Document, Fixed Document Sequences, Fixed Documents, and Fixed Pages) to the filter in a known and defined order. The stream interface simply provides a stream that contains the XPS document--a zip archive. The filter writer is in this case required to handle the PK archive structure, decompression of the parts within the container, and the XPS Open Packaging conventions. - -The four filters that use the XPS interface provide support for the following: - -- The Watermark Filter is responsible for adding mark-up to Fixed Page content to express textual, bitmap, and vector-based watermarks. - -- The Booklet Filter is responsible for page re-ordering and padding page insertion to create booklets from the XPS document. Note that this filter re-uses the NUp filter to provide appropriate page transformation. - -- The NUp Filter is responsible for transforming and combining logical pages onto physical pages to provide multiple page per sheet support. - -- The Color Management Filter is responsible for constructing and applying color transforms to Fixed Page content. - -The stream interface filter provides Page Scaling support (that is, wrapping content with the appropriate transforms to scale from a source Fixed Page to the destination). - -### UI Plug-in - -The UI plug-in provides support for controlling features that are not supported by the Unidrv core UI. Three additional printer property pages are implemented that provide color management, watermarking, and general features. The UI plug-in also provides custom Devmode support for options that are not easily expressed in a GPD file (for example, the numeric values required to define custom page scaling options). - -### Print Ticket Provider Plug-in - -Unidrv provides support for mapping simple features and options from a GPD file to a Print Ticket by a "PrintSchemaKeywordMap" keyword in the GPD file. Many of the features that are supported by the sample filters require a more sophisticated mapping between the GPD description and the Print Schema definition. These features include features that are nested within features and control of numeric values. The Print Ticket provider plug-in provides this support by converting a number of GPD feature options to a single more complicated Print Ticket feature. For example, the Print Schema definition of PageScaling requires numeric values for custom page scaling options (offset and scale values) as well as a sub-feature defining the scaling offset option. This plug-in can take settings from a "flat" description of the scaling and offset alignment features in the GPD combined with custom DevMode values configured by the UI plug-in to generate an appropriate PrintTicket construct that conforms to the PrintSchema definition of PageScaling. - -The components of the XPSDrv sample enable a user or application to configure the filter pipeline to process an XPS container according to the supported filters. The XPS spool file that is passed to the filter pipeline broadly comprises two components: the document structure and page content as well as one or more Print Tickets that configure the print job at various levels. Job content will be defined either as output directly from a Windows Presentation Foundation (WPF) application or through a conversion from legacy GDI to XPS through the Microsoft XPS Document Writer (MXDW). PrintTicket settings can be controlled directly through the UI or through application settings in either DevMode or PrintTicket. - -To enable configuration of the driver, the sample uses a set of GPD files and a configuration plug-in. The configuration plug-in provides custom DevMode and custom UI support. This support enables the driver to store and configure driver specific settings that can be used as a source for configuring PrintTicket features. In order to provide the appropriate PrintTicket support, the driver makes use of a combination of the core Unidrv PrintTicket support and a PrintTicket provider plug-in to enable the generation of more sophisticated PrintTicket settings. In combination these allow an application or user to setup a PrintTicket ready for inclusion in an XPS document. - -With the PrintTicket in place and the document content supplied by either an application using WPF or a legacy application through MXDW, the filters that make up the filter pipeline for the sample driver act on the XPS document according to the settings specified in the PrintTicket. Each filter checks whether its functionality has been enabled and extracts any settings relevant to its function before processing the container appropriately. The order in which filters are applied is important to the eventual output; for example, a filter adding page content (like the watermark filter) can be placed anywhere in the pipeline, but its placement determines where the content is added. Configured to run before an NUp filter ensures page content is confined to the logical page; whereas, if it is run after an NUp filter, the watermark will be applied to the transformed pages. The filter ordering is controlled by the filter configuration file; this file is an XML document that details the order and interface type for each filter. - -### Common Filter Functionality - -Regardless of the type of interface that a filter uses to process the XPS document content, there are common requirements for all filters. These include filter initialization and shutdown and are provided as a base class from which either an XPS or stream interface filter can derive. - -### XPS Interface - -Four of the five filters make use of the XPS interface that is provided by the filter pipeline manager as XPS provider and consumer interfaces. The XPS provider interface supplies XPS parts to the filter on demand. When a part is requested from the provider, a generic interface pointer is returned. This interface is queried to identify its type: an XPS document, a Fixed Document Sequence, a Fixed Document or a Fixed Page. This functionality is common between filters that use the XPS interface and a base class XPS interface implementation (that derives from the common filter class described earlier) is provided that retrieves, identifies, and dispatches the part to the appropriate handler. When all parts have been processed, the base class calls a method to finalize the filter. To supply the filter-specific functionality, a filter derives from the base class and implements handlers for any of the part types it requires and/or the finalize method to complete its function. Additionally, the base class provides default implementations for the XPS part handlers (using these exclusively merely passes the document on through the XPS consumer interface) and a method for initializing the XPS interface. - -### Stream Interface - -One of the filters (page scaling) makes use of the stream interface that is provided by the filter pipeline manager as a read and write stream. This interface is a very basic interface that merely supplies the filter with a stream that contains the XPS document as a PK archive. To be able to use the stream interface to modify document content, the filter needs to be able to process the PK archive to retrieve all of the files contained within, decompress the data associated with these files, process the open packaging conventions (taking into account potentially interleaved data), and compress and send the data in a structure appropriate to both the open package and PK archive conventions. A class is provided that uses an XPS document processor for accessing the logical structure of the package and reporting the Fixed Page content to the filter. This class supports the necessary interfaces to initialize the IO streams, start the process of handling the data, and a default handler for processing Fixed Page content. The page scaling filter derives from this class and implements its own Fixed Page handler that is called by the XPS processor. - -### Watermark Filter - -The Watermark filter is intended to demonstrate adding presentation content to the Fixed Pages within an existing XPS container by using the XPS interface as the source of the XPS document. This added content acts as a watermark and is configured by the PrintTicket. The filter takes as input the PageWatermark public Print Schema feature with custom support for vector and bitmap watermark types and the Fixed Pages in an XPS document. This custom content is expressed as Private options to the existing PageWatermark definition. The output is the sequence of Fixed Pages and accompanying resources required for the watermark. - -The filter is configured by parsing an input PrintTicket by using DOM to extract the relevant features and options. If the functionality is enabled, the filter processes the document as required. The PrintTicket is constructed through the following algorithm to provide settings at the appropriate scope (Fixed Document Sequence, Fixed Document and Fixed Page): - -1. Validate and merge the print ticket from the FDS with the default PrintTicket converted from the default DevMode in the property bag. The resultant ticket will be the Job level ticket. - -1. Validate and merge the print ticket from the current FD with the Job level ticket from step 1. The resultant ticket will be the document level ticket. - -1. Validate and merge the print ticket from the current FP with the Doc level ticket from step 2. The resultant ticket will be the page level ticket. - -When a watermark is enabled in the PrintTicket, the filter creates a watermark of the appropriate type (text, raster, or vector). This is returned as a generic watermark interface that abstracts the watermark type from the filter. The filter then calls the watermark object to send any resources that it may require to the filter pipeline (the font for text, the bitmap for raster, and none for vector). All resources are added through a resource cache that enables the watermark object to ignore any problems with sending repeated resources (the cache checks if the resource is present and only sends it if it has not seen the resource before). With the resource in place, the filter instantiates a SAX handler passing the watermark object. The SAX handler is used to parse the Fixed Page, allowing the filter to control when it inserts the watermark into the Fixed Page; when underlay is required, the mark-up is inserted when the FixedPage start element is encountered and when overlay is required the mark-up is inserted when FixedPage end element is encountered. By passing the abstracted watermark object, the SAX handler can be re-used for any watermark as it merely requests appropriate mark-up from the watermark object and inserts it into the Fixed Page mark-up as appropriate. - -### Vector Mark-up - -XPS documents can contain a range of vector elements that contain color data that describes how the elements should be rendered on a specific device. The following elements support color data: - -- Color - -- Fill - -- Stroke - -When any of these elements are found in a fixed page, the SAX handler passes the associated color data to a color conversion object. This uses the following algorithm to convert the color: - -1. The XML mark-up is broken down into color channel values, color channel value types, color format, and any other color details contained in the color mark-up string. - -1. The resulting values are color transformed in conjunction with preferences defined in the PrintTicket. The result is a new set of color values. - -1. These new values are used to reconstructs a color reference containing the new color values. - -1. The newly constructed color reference is used in place of the original color reference, resulting in the transformed color output. - -### Bitmap Resources - -When a bitmap is referred to in a fixed page, the SAX handler passes the bitmap URI to a bitmap conversion method in the color converter object. - -The conversion process starts by creating a new color managed bitmap object that represents the bitmap along with a color profile manager. The color profile manager is initialized by the PrintTicket settings and is used to supply a suitable color transform based on those settings. - -After the color managed bitmap object is created, the object is passed to a resource caching class that manages which bitmaps are written out and ensures bitmaps are only written out once. A single bitmap can be referred to many times in an XPS container but the bitmap itself should have a color transformation applied only once and should be written out only once to avoid unnecessary processing overhead. The caching manager ensures this by creating a unique key generated from the bitmap URI and color profile that is then recorded against the URI. If the caching manager receives bitmap objects with an existing key, those bitmaps do not need re-processing and the stored URI is used merely to identify the color transformed bitmap. - -If a bitmap has not been handled yet, the caching manager calls a write data method in the color bitmap object to indicate that the bitmap should write itself out to the filter pipeline. The write process also includes the application of a color transform to the bitmap. The following steps occur to apply the transform: - -1. A stream is created to the bitmap itself and the bitmap is loaded into memory. - -1. A bitmap codec object is created that takes the bitmap and uses an appropriate codec to decompress the bitmap and present the bitmap data and values. - -1. The bitmap data is then converted by using a color transform supplied by the color profile management class. - -1. The bitmap codec object re-encodes the bitmap by using a matching codec to that used to decode the bitmap. - -1. The encoded bitmap is streamed back out to the container. - -### Booklet Filter - -The Booklet filter is intended to demonstrate how a filter can re-order the pages and add additional pages to a document to enable booklet binding using the XPS interface as the source of the XPS document. Page transformation is not applied by the filter but deferred to the NUp filter demonstrating filter re-use. The filter takes as input the JobBinding and DocumentBinding public Print Schema features (defined in the PrintTicket), and the sequence of pages in the fixed documents or fixed document sequence within the XPS document and outputs the fixed pages in an appropriate order to be printed as a booklet. Page content is not modified; however, an additional fixed page might be required to ensure the appropriate fixed page flow. - -The filter is configured by parsing an input PrintTicket by using DOM to extract the relevant features and options. If the functionality is enabled, the filter processes the document as required. Again the PrintTicket is constructed according to the algorithm that is documented in the watermark filter notes. - -The booklet filter maintains a list of references to the fixed page parts within an XPS document as they are presented to the filter. This list is used to output the correct page order and is reset and repopulated according to whether JobBinding or DocumentBinding is set. If JobBinding is enabled, all pages within the Fixed Documents that make up the Fixed Document Sequence are cached and the list is not flushed until the document has completed. If DocumentBinding is enabled, the filter caches all pages in a Fixed Document and flushes the list at the end of the Fixed Document. When the list is flushed, the pages are re-ordered and a padding page is added if the total page count is odd before being sent on to the filter pipeline. - -### NUp Filter - -The NUp filter is intended to demonstrate how a filter can transform vector mark-up within an XPS container by using the XPS interface as the source of the XPS document. The PrintTicket might contain preferences that the filter uses to apply a multi-up transformation to the containers fixed pages, resulting in a new set of pages that contain the original pages as child canvases. The filter takes as input the JobNUp, DocumentNUp, JobBinding, DocumentBinding, PageMediaSize, and PageOrientation public Print Schema features (defined in the PrintTicket) and the Fixed Pages that define the Fixed Document and Fixed Document Sequence. The output is a new sequence of Fixed Pages that contain the render-transformed source pages sent through the XPS interface to the filter pipeline. - -The filter is configured by parsing an input PrintTicket using DOM to extract the relevant features and options. If the functionality is enabled, the filter processes the document as required. Again the PrintTicket is constructed according to the algorithm that is documented in the watermark filter notes. - -Within the filter, SAX is used to parse the XPS container with each fixed page being read, amended, and inserted into a new fixed page as a canvas. The amendment of the source fixed page involves removing any wrapping mark-up that defines a fixed page and in place adding suitable mark-up to define a new canvas. The new canvas mark-up includes a transformation matrix that positions, rotates, and scales the canvas on the new fixed page. The transformation is provided by a supporting object that generates the transform according to the PrintTicket settings. Settings in the print ticket that are used include how many source pages should be stored as canvases in a single new fixed page (NUp count), the ordering of canvases on the new fixed page, and the target page size and orientation. - -New canvases are added to the new fixed page mark-up until the document contains the number of source fixed pages that are required in a single new fixed page or until there are no source pages left. When the new fixed page is full, it is written out to the pipeline and another fixed page is started ready for population with source pages. - -In addition to the NUp feature processing, the NUp filter is re-used to apply the 2-Up processing required for booklet printing. This is achieved by looking for a valid binding option in the PrintTicket and applying 2-Up as appropriate. - -## Page Scaling Filter - -The page scaling filter is intended to demonstrate how a filter can transform vector mark-up within a XPS container by using the stream interface as the source of the XPS document. The PrintTicket can contain page scaling preferences that the filter uses to amend page dimension values in each fixed page processed. - -Within the filter, SAX is used to parse the XPS container with each fixed page being read, amended, and written back out. The modification of the fixed page mark-up begins by modifying the fixed page dimensions to match the target page size specified in the print ticket for the current fixed page. Subsequently, the fixed page content is scaled to correctly fit the target scale by applying a canvas around the source content that includes a transformation matrix. The SAX handler is supported by a page scale class which manages the creation of a transformation matrix and the presentation of the matrix correctly formatted for use in the fixed page. - -## XPS Container Handling - -The stream filter is required to handle the Open Packaging conventions that are used by an XPS document. These conventions can be thought of as the document structure above that of the PK archive itself. Sources for a set of classes are provided that support processing of the XPS document in terms of the constituent files in the PK archive. This includes: - -- Initiating the document processing based on the root relationships part defined in the package. - -- Validation of the parts within the package against their content type and usage. - -- Processing of Fixed Document Sequence and all resources associated with it. - -- Processing of the Fixed Documents within the Fixed Document Sequence and all resources associated with them. - -- Processing of the Fixed Page parts with the Fixed Documents and all resources associated with them. - -- Passing Fixed Page content processing to a registered FP handler for modification. - -- Passing all parts on to a PK archive handling module with valid ordering. - -The XPS processor is not responsible for extracting or decompressing part data from the PK archive. This task is the responsibility of an additional module that implements an interface known to the XPS container handling code. - -## UI Plug-in details - -The UI Plug-in is intended to demonstrate how to extend the standard Unidrv UI to add additional property sheets and controls and to provide support for custom features that are not supported by the core Unidrv UI. Three new pages have been added that allow control of the sample filters: - -- Color--enables configuration of the color conversion filter. - -- Watermarks--enables a watermark to be selected and enable configuration of its properties for use in the watermark filter. - -- Features--includes controls to configure the page scaling, booklet, and NUp filters. In addition, the standard driver settings--duplex, intent, and page borders--can also be modified. - -Various UI control types have been implemented on these property pages to enable a user to modify settings in the driver. The UI supports the following control types: - -- Check-box - -- Combo-box - -- List-Box - -- Edit-Box - -- Edit number (with buddy up/down control) - -The settings that associated with each of these controls are stored as one the following types: - -- GPD options. These settings are defined in the sample driver GPD configuration file and are handled by the Unidrv core via the CPSUI interface. All GPD options that are managed from the UI plug-in are hidden from the standard Unidrv Treeview dialog box. -- OEM private DevMode. These settings are settings that cannot be represented in the GPD file format (for example, numerical values and strings). They are instead added to the DevMode at a private offset. - -The Unidrv UI Plug-in interface includes methods that allow additional property pages to be inserted into the drivers property sheet. In the sample, only additional document property pages are implemented because there are no device property pages required. A collection of property page objects are stored at the plug-in interface level, each of which is responsible for the three property pages (Color, Watermarks, and Features). Each property page object creates a Microsoft Windows property page from a dialog resource and handles all Windows Messages that are received through a common dialog procedure. A collection of UI control objects are stored in the property page, one for each Windows control on the page. - -When a property page receives a message for a control, it looks up the relevant control in the collection (by using the resource identifier) and calls the appropriate method in the control interface, given the Windows message. Each control object is responsible for handling its own initialization and any user input through the appropriate get and set functions. The sample get and set functions provide an interface to read and update the GPD options and OEM private DevMode. - -## PrintTicket Provider Plug-in - -The sample Print Ticket Provider plug-in is intended to demonstrate how to validate and map driver settings from a DevMode description to a Print Ticket description and back again. The driver allows configuration of custom settings through a custom user interface. These custom settings are represented as either GPD options or in the OEM private DevMode and are mapped to and from the Print Ticket using an XML schema. - -To support Print Ticket handling, the Unidrv UI Plug-in Print Ticket Provider Interface is utilized. The Unidrv UI Plug-in interface includes methods that allow mapping of DevMode to and from a Print Ticket Schema. A collection of feature conversion objects are stored at the plug-in interface level, each of which is responsible for the conversion of a specific feature (Color, Watermark, Booklet, Scaling, and NUp). Whenever the Unidrv core calls through the external interface of the plug-in to convert from DevMode to Print Ticket or Print Ticket to DevMode, the collection is iterated through calling each conversion object in turn; each then perform its own DevMode/Print Ticket mapping via the appropriate get and set functions. The sample get and set functions provide an interface to read and write the GPD options, OEM private DevMode, and Print Ticket keyword value pairs. diff --git a/print/XPSDrvSmpl/XPSDrvSmpl.sln b/print/XPSDrvSmpl/XPSDrvSmpl.sln deleted file mode 100644 index 38c60fc5..00000000 --- a/print/XPSDrvSmpl/XPSDrvSmpl.sln +++ /dev/null @@ -1,268 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27004.2005 -MinimumVisualStudioVersion = 12.0 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Package", "Package", "{5A68CA37-F621-4113-B573-8A361135203B}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debug", "Debug", "{3F637C27-BDFE-4466-838C-5FBDE4C5F2C1}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Src", "Src", "{199CBE46-0460-42FA-AB80-DD3C89310F4A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{A51E3BEB-5868-445C-8F87-AC7D05C4EE2D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ui", "Ui", "{8D891397-002B-4AF1-929E-0515D8F2F5AB}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{413B0724-5117-4BD6-99EF-D6B59859E1B3}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Filters", "Filters", "{5234E3C1-1C0C-49A6-900E-EEC5815604BA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Xdcont", "Xdcont", "{A82FAF9C-BCCE-4569-9EB2-36DA4D239DA8}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Watermark", "Watermark", "{5452CCB0-EF39-4699-A8E0-C86D595FC4DA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scaling", "Scaling", "{8C5A07F5-C9E0-430D-A908-2C1161C952ED}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Nup", "Nup", "{8B19C579-DB40-4D8B-A605-165366FAB6CD}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Color", "Color", "{D804D2D8-5ED5-42B3-A77D-1A46D3ACB727}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Booklet", "Booklet", "{3904D25E-E461-4A90-A544-E1C74A32086A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "package", "Package\package.VcxProj", "{4A7303D2-92DB-4537-A380-24D334FC24FE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xdsdbg", "src\debug\xdsdbg.vcxproj", "{E5DC3A24-691A-4F3A-B519-E4C49B2DAC98}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xdsmplcmn", "src\common\xdsmplcmn.vcxproj", "{42677515-C196-4C0F-99A2-F11E2FB55BF6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xdsmplui", "src\ui\xdsmplui.vcxproj", "{7441D7F2-F509-4A47-9404-3EB8653AE037}" - ProjectSection(ProjectDependencies) = postProject - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} = {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} - {42677515-C196-4C0F-99A2-F11E2FB55BF6} = {42677515-C196-4C0F-99A2-F11E2FB55BF6} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xdfltcmn", "src\filters\common\xdfltcmn.vcxproj", "{0F8262C1-75D8-4A92-BCB6-37A290891708}" - ProjectSection(ProjectDependencies) = postProject - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} = {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} - {42677515-C196-4C0F-99A2-F11E2FB55BF6} = {42677515-C196-4C0F-99A2-F11E2FB55BF6} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xdcont", "src\filters\xdcont\xdcont.vcxproj", "{D38B87BF-5778-4DA8-8DCE-B0F37F087D5A}" - ProjectSection(ProjectDependencies) = postProject - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} = {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} - {42677515-C196-4C0F-99A2-F11E2FB55BF6} = {42677515-C196-4C0F-99A2-F11E2FB55BF6} - {0F8262C1-75D8-4A92-BCB6-37A290891708} = {0F8262C1-75D8-4A92-BCB6-37A290891708} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xdwmark", "src\filters\watermark\xdwmark.vcxproj", "{E31D1C4F-8E0D-428A-8583-5159CE690B33}" - ProjectSection(ProjectDependencies) = postProject - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} = {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} - {42677515-C196-4C0F-99A2-F11E2FB55BF6} = {42677515-C196-4C0F-99A2-F11E2FB55BF6} - {0F8262C1-75D8-4A92-BCB6-37A290891708} = {0F8262C1-75D8-4A92-BCB6-37A290891708} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xdscale", "src\filters\scaling\xdscale.vcxproj", "{1893FA97-40A9-480F-BB77-279F959EAE6E}" - ProjectSection(ProjectDependencies) = postProject - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A} = {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A} - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} = {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} - {42677515-C196-4C0F-99A2-F11E2FB55BF6} = {42677515-C196-4C0F-99A2-F11E2FB55BF6} - {0F8262C1-75D8-4A92-BCB6-37A290891708} = {0F8262C1-75D8-4A92-BCB6-37A290891708} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xdnup", "src\filters\nup\xdnup.vcxproj", "{23BA577F-B171-4CEC-92E0-49EE44564366}" - ProjectSection(ProjectDependencies) = postProject - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} = {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} - {42677515-C196-4C0F-99A2-F11E2FB55BF6} = {42677515-C196-4C0F-99A2-F11E2FB55BF6} - {0F8262C1-75D8-4A92-BCB6-37A290891708} = {0F8262C1-75D8-4A92-BCB6-37A290891708} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XDColMan", "src\filters\color\XDColMan.vcxproj", "{C9C14C99-103E-45CB-B1B4-2C165429E35C}" - ProjectSection(ProjectDependencies) = postProject - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} = {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} - {42677515-C196-4C0F-99A2-F11E2FB55BF6} = {42677515-C196-4C0F-99A2-F11E2FB55BF6} - {0F8262C1-75D8-4A92-BCB6-37A290891708} = {0F8262C1-75D8-4A92-BCB6-37A290891708} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xdbook", "src\filters\booklet\xdbook.vcxproj", "{8D542B56-EB45-43B1-AAB8-417352F5BDE6}" - ProjectSection(ProjectDependencies) = postProject - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} = {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} - {42677515-C196-4C0F-99A2-F11E2FB55BF6} = {42677515-C196-4C0F-99A2-F11E2FB55BF6} - {0F8262C1-75D8-4A92-BCB6-37A290891708} = {0F8262C1-75D8-4A92-BCB6-37A290891708} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM64 = Debug|ARM64 - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|ARM64 = Release|ARM64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4A7303D2-92DB-4537-A380-24D334FC24FE}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {4A7303D2-92DB-4537-A380-24D334FC24FE}.Debug|ARM64.Build.0 = Debug|ARM64 - {4A7303D2-92DB-4537-A380-24D334FC24FE}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {4A7303D2-92DB-4537-A380-24D334FC24FE}.Debug|Win32.ActiveCfg = Debug|Win32 - {4A7303D2-92DB-4537-A380-24D334FC24FE}.Debug|Win32.Build.0 = Debug|Win32 - {4A7303D2-92DB-4537-A380-24D334FC24FE}.Debug|x64.ActiveCfg = Debug|x64 - {4A7303D2-92DB-4537-A380-24D334FC24FE}.Debug|x64.Build.0 = Debug|x64 - {4A7303D2-92DB-4537-A380-24D334FC24FE}.Release|ARM64.ActiveCfg = Release|ARM64 - {4A7303D2-92DB-4537-A380-24D334FC24FE}.Release|ARM64.Build.0 = Release|ARM64 - {4A7303D2-92DB-4537-A380-24D334FC24FE}.Release|ARM64.Deploy.0 = Release|ARM64 - {4A7303D2-92DB-4537-A380-24D334FC24FE}.Release|Win32.ActiveCfg = Release|Win32 - {4A7303D2-92DB-4537-A380-24D334FC24FE}.Release|Win32.Build.0 = Release|Win32 - {4A7303D2-92DB-4537-A380-24D334FC24FE}.Release|x64.ActiveCfg = Release|x64 - {4A7303D2-92DB-4537-A380-24D334FC24FE}.Release|x64.Build.0 = Release|x64 - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98}.Debug|ARM64.Build.0 = Debug|ARM64 - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98}.Debug|Win32.ActiveCfg = Debug|Win32 - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98}.Debug|Win32.Build.0 = Debug|Win32 - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98}.Debug|x64.ActiveCfg = Debug|x64 - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98}.Debug|x64.Build.0 = Debug|x64 - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98}.Release|ARM64.ActiveCfg = Release|ARM64 - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98}.Release|ARM64.Build.0 = Release|ARM64 - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98}.Release|Win32.ActiveCfg = Release|Win32 - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98}.Release|Win32.Build.0 = Release|Win32 - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98}.Release|x64.ActiveCfg = Release|x64 - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98}.Release|x64.Build.0 = Release|x64 - {42677515-C196-4C0F-99A2-F11E2FB55BF6}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {42677515-C196-4C0F-99A2-F11E2FB55BF6}.Debug|ARM64.Build.0 = Debug|ARM64 - {42677515-C196-4C0F-99A2-F11E2FB55BF6}.Debug|Win32.ActiveCfg = Debug|Win32 - {42677515-C196-4C0F-99A2-F11E2FB55BF6}.Debug|Win32.Build.0 = Debug|Win32 - {42677515-C196-4C0F-99A2-F11E2FB55BF6}.Debug|x64.ActiveCfg = Debug|x64 - {42677515-C196-4C0F-99A2-F11E2FB55BF6}.Debug|x64.Build.0 = Debug|x64 - {42677515-C196-4C0F-99A2-F11E2FB55BF6}.Release|ARM64.ActiveCfg = Release|ARM64 - {42677515-C196-4C0F-99A2-F11E2FB55BF6}.Release|ARM64.Build.0 = Release|ARM64 - {42677515-C196-4C0F-99A2-F11E2FB55BF6}.Release|Win32.ActiveCfg = Release|Win32 - {42677515-C196-4C0F-99A2-F11E2FB55BF6}.Release|Win32.Build.0 = Release|Win32 - {42677515-C196-4C0F-99A2-F11E2FB55BF6}.Release|x64.ActiveCfg = Release|x64 - {42677515-C196-4C0F-99A2-F11E2FB55BF6}.Release|x64.Build.0 = Release|x64 - {7441D7F2-F509-4A47-9404-3EB8653AE037}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {7441D7F2-F509-4A47-9404-3EB8653AE037}.Debug|ARM64.Build.0 = Debug|ARM64 - {7441D7F2-F509-4A47-9404-3EB8653AE037}.Debug|Win32.ActiveCfg = Debug|Win32 - {7441D7F2-F509-4A47-9404-3EB8653AE037}.Debug|Win32.Build.0 = Debug|Win32 - {7441D7F2-F509-4A47-9404-3EB8653AE037}.Debug|x64.ActiveCfg = Debug|x64 - {7441D7F2-F509-4A47-9404-3EB8653AE037}.Debug|x64.Build.0 = Debug|x64 - {7441D7F2-F509-4A47-9404-3EB8653AE037}.Release|ARM64.ActiveCfg = Release|ARM64 - {7441D7F2-F509-4A47-9404-3EB8653AE037}.Release|ARM64.Build.0 = Release|ARM64 - {7441D7F2-F509-4A47-9404-3EB8653AE037}.Release|Win32.ActiveCfg = Release|Win32 - {7441D7F2-F509-4A47-9404-3EB8653AE037}.Release|Win32.Build.0 = Release|Win32 - {7441D7F2-F509-4A47-9404-3EB8653AE037}.Release|x64.ActiveCfg = Release|x64 - {7441D7F2-F509-4A47-9404-3EB8653AE037}.Release|x64.Build.0 = Release|x64 - {0F8262C1-75D8-4A92-BCB6-37A290891708}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {0F8262C1-75D8-4A92-BCB6-37A290891708}.Debug|ARM64.Build.0 = Debug|ARM64 - {0F8262C1-75D8-4A92-BCB6-37A290891708}.Debug|Win32.ActiveCfg = Debug|Win32 - {0F8262C1-75D8-4A92-BCB6-37A290891708}.Debug|Win32.Build.0 = Debug|Win32 - {0F8262C1-75D8-4A92-BCB6-37A290891708}.Debug|x64.ActiveCfg = Debug|x64 - {0F8262C1-75D8-4A92-BCB6-37A290891708}.Debug|x64.Build.0 = Debug|x64 - {0F8262C1-75D8-4A92-BCB6-37A290891708}.Release|ARM64.ActiveCfg = Release|ARM64 - {0F8262C1-75D8-4A92-BCB6-37A290891708}.Release|ARM64.Build.0 = Release|ARM64 - {0F8262C1-75D8-4A92-BCB6-37A290891708}.Release|Win32.ActiveCfg = Release|Win32 - {0F8262C1-75D8-4A92-BCB6-37A290891708}.Release|Win32.Build.0 = Release|Win32 - {0F8262C1-75D8-4A92-BCB6-37A290891708}.Release|x64.ActiveCfg = Release|x64 - {0F8262C1-75D8-4A92-BCB6-37A290891708}.Release|x64.Build.0 = Release|x64 - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A}.Debug|ARM64.Build.0 = Debug|ARM64 - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A}.Debug|Win32.ActiveCfg = Debug|Win32 - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A}.Debug|Win32.Build.0 = Debug|Win32 - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A}.Debug|x64.ActiveCfg = Debug|x64 - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A}.Debug|x64.Build.0 = Debug|x64 - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A}.Release|ARM64.ActiveCfg = Release|ARM64 - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A}.Release|ARM64.Build.0 = Release|ARM64 - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A}.Release|Win32.ActiveCfg = Release|Win32 - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A}.Release|Win32.Build.0 = Release|Win32 - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A}.Release|x64.ActiveCfg = Release|x64 - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A}.Release|x64.Build.0 = Release|x64 - {E31D1C4F-8E0D-428A-8583-5159CE690B33}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {E31D1C4F-8E0D-428A-8583-5159CE690B33}.Debug|ARM64.Build.0 = Debug|ARM64 - {E31D1C4F-8E0D-428A-8583-5159CE690B33}.Debug|Win32.ActiveCfg = Debug|Win32 - {E31D1C4F-8E0D-428A-8583-5159CE690B33}.Debug|Win32.Build.0 = Debug|Win32 - {E31D1C4F-8E0D-428A-8583-5159CE690B33}.Debug|x64.ActiveCfg = Debug|x64 - {E31D1C4F-8E0D-428A-8583-5159CE690B33}.Debug|x64.Build.0 = Debug|x64 - {E31D1C4F-8E0D-428A-8583-5159CE690B33}.Release|ARM64.ActiveCfg = Release|ARM64 - {E31D1C4F-8E0D-428A-8583-5159CE690B33}.Release|ARM64.Build.0 = Release|ARM64 - {E31D1C4F-8E0D-428A-8583-5159CE690B33}.Release|Win32.ActiveCfg = Release|Win32 - {E31D1C4F-8E0D-428A-8583-5159CE690B33}.Release|Win32.Build.0 = Release|Win32 - {E31D1C4F-8E0D-428A-8583-5159CE690B33}.Release|x64.ActiveCfg = Release|x64 - {E31D1C4F-8E0D-428A-8583-5159CE690B33}.Release|x64.Build.0 = Release|x64 - {1893FA97-40A9-480F-BB77-279F959EAE6E}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {1893FA97-40A9-480F-BB77-279F959EAE6E}.Debug|ARM64.Build.0 = Debug|ARM64 - {1893FA97-40A9-480F-BB77-279F959EAE6E}.Debug|Win32.ActiveCfg = Debug|Win32 - {1893FA97-40A9-480F-BB77-279F959EAE6E}.Debug|Win32.Build.0 = Debug|Win32 - {1893FA97-40A9-480F-BB77-279F959EAE6E}.Debug|x64.ActiveCfg = Debug|x64 - {1893FA97-40A9-480F-BB77-279F959EAE6E}.Debug|x64.Build.0 = Debug|x64 - {1893FA97-40A9-480F-BB77-279F959EAE6E}.Release|ARM64.ActiveCfg = Release|ARM64 - {1893FA97-40A9-480F-BB77-279F959EAE6E}.Release|ARM64.Build.0 = Release|ARM64 - {1893FA97-40A9-480F-BB77-279F959EAE6E}.Release|Win32.ActiveCfg = Release|Win32 - {1893FA97-40A9-480F-BB77-279F959EAE6E}.Release|Win32.Build.0 = Release|Win32 - {1893FA97-40A9-480F-BB77-279F959EAE6E}.Release|x64.ActiveCfg = Release|x64 - {1893FA97-40A9-480F-BB77-279F959EAE6E}.Release|x64.Build.0 = Release|x64 - {23BA577F-B171-4CEC-92E0-49EE44564366}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {23BA577F-B171-4CEC-92E0-49EE44564366}.Debug|ARM64.Build.0 = Debug|ARM64 - {23BA577F-B171-4CEC-92E0-49EE44564366}.Debug|Win32.ActiveCfg = Debug|Win32 - {23BA577F-B171-4CEC-92E0-49EE44564366}.Debug|Win32.Build.0 = Debug|Win32 - {23BA577F-B171-4CEC-92E0-49EE44564366}.Debug|x64.ActiveCfg = Debug|x64 - {23BA577F-B171-4CEC-92E0-49EE44564366}.Debug|x64.Build.0 = Debug|x64 - {23BA577F-B171-4CEC-92E0-49EE44564366}.Release|ARM64.ActiveCfg = Release|ARM64 - {23BA577F-B171-4CEC-92E0-49EE44564366}.Release|ARM64.Build.0 = Release|ARM64 - {23BA577F-B171-4CEC-92E0-49EE44564366}.Release|Win32.ActiveCfg = Release|Win32 - {23BA577F-B171-4CEC-92E0-49EE44564366}.Release|Win32.Build.0 = Release|Win32 - {23BA577F-B171-4CEC-92E0-49EE44564366}.Release|x64.ActiveCfg = Release|x64 - {23BA577F-B171-4CEC-92E0-49EE44564366}.Release|x64.Build.0 = Release|x64 - {C9C14C99-103E-45CB-B1B4-2C165429E35C}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {C9C14C99-103E-45CB-B1B4-2C165429E35C}.Debug|ARM64.Build.0 = Debug|ARM64 - {C9C14C99-103E-45CB-B1B4-2C165429E35C}.Debug|Win32.ActiveCfg = Debug|Win32 - {C9C14C99-103E-45CB-B1B4-2C165429E35C}.Debug|Win32.Build.0 = Debug|Win32 - {C9C14C99-103E-45CB-B1B4-2C165429E35C}.Debug|x64.ActiveCfg = Debug|x64 - {C9C14C99-103E-45CB-B1B4-2C165429E35C}.Debug|x64.Build.0 = Debug|x64 - {C9C14C99-103E-45CB-B1B4-2C165429E35C}.Release|ARM64.ActiveCfg = Release|ARM64 - {C9C14C99-103E-45CB-B1B4-2C165429E35C}.Release|ARM64.Build.0 = Release|ARM64 - {C9C14C99-103E-45CB-B1B4-2C165429E35C}.Release|Win32.ActiveCfg = Release|Win32 - {C9C14C99-103E-45CB-B1B4-2C165429E35C}.Release|Win32.Build.0 = Release|Win32 - {C9C14C99-103E-45CB-B1B4-2C165429E35C}.Release|x64.ActiveCfg = Release|x64 - {C9C14C99-103E-45CB-B1B4-2C165429E35C}.Release|x64.Build.0 = Release|x64 - {8D542B56-EB45-43B1-AAB8-417352F5BDE6}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {8D542B56-EB45-43B1-AAB8-417352F5BDE6}.Debug|ARM64.Build.0 = Debug|ARM64 - {8D542B56-EB45-43B1-AAB8-417352F5BDE6}.Debug|Win32.ActiveCfg = Debug|Win32 - {8D542B56-EB45-43B1-AAB8-417352F5BDE6}.Debug|Win32.Build.0 = Debug|Win32 - {8D542B56-EB45-43B1-AAB8-417352F5BDE6}.Debug|x64.ActiveCfg = Debug|x64 - {8D542B56-EB45-43B1-AAB8-417352F5BDE6}.Debug|x64.Build.0 = Debug|x64 - {8D542B56-EB45-43B1-AAB8-417352F5BDE6}.Release|ARM64.ActiveCfg = Release|ARM64 - {8D542B56-EB45-43B1-AAB8-417352F5BDE6}.Release|ARM64.Build.0 = Release|ARM64 - {8D542B56-EB45-43B1-AAB8-417352F5BDE6}.Release|Win32.ActiveCfg = Release|Win32 - {8D542B56-EB45-43B1-AAB8-417352F5BDE6}.Release|Win32.Build.0 = Release|Win32 - {8D542B56-EB45-43B1-AAB8-417352F5BDE6}.Release|x64.ActiveCfg = Release|x64 - {8D542B56-EB45-43B1-AAB8-417352F5BDE6}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {3F637C27-BDFE-4466-838C-5FBDE4C5F2C1} = {199CBE46-0460-42FA-AB80-DD3C89310F4A} - {A51E3BEB-5868-445C-8F87-AC7D05C4EE2D} = {199CBE46-0460-42FA-AB80-DD3C89310F4A} - {8D891397-002B-4AF1-929E-0515D8F2F5AB} = {199CBE46-0460-42FA-AB80-DD3C89310F4A} - {413B0724-5117-4BD6-99EF-D6B59859E1B3} = {5234E3C1-1C0C-49A6-900E-EEC5815604BA} - {5234E3C1-1C0C-49A6-900E-EEC5815604BA} = {199CBE46-0460-42FA-AB80-DD3C89310F4A} - {A82FAF9C-BCCE-4569-9EB2-36DA4D239DA8} = {5234E3C1-1C0C-49A6-900E-EEC5815604BA} - {5452CCB0-EF39-4699-A8E0-C86D595FC4DA} = {5234E3C1-1C0C-49A6-900E-EEC5815604BA} - {8C5A07F5-C9E0-430D-A908-2C1161C952ED} = {5234E3C1-1C0C-49A6-900E-EEC5815604BA} - {8B19C579-DB40-4D8B-A605-165366FAB6CD} = {5234E3C1-1C0C-49A6-900E-EEC5815604BA} - {D804D2D8-5ED5-42B3-A77D-1A46D3ACB727} = {5234E3C1-1C0C-49A6-900E-EEC5815604BA} - {3904D25E-E461-4A90-A544-E1C74A32086A} = {5234E3C1-1C0C-49A6-900E-EEC5815604BA} - {4A7303D2-92DB-4537-A380-24D334FC24FE} = {5A68CA37-F621-4113-B573-8A361135203B} - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} = {3F637C27-BDFE-4466-838C-5FBDE4C5F2C1} - {42677515-C196-4C0F-99A2-F11E2FB55BF6} = {A51E3BEB-5868-445C-8F87-AC7D05C4EE2D} - {7441D7F2-F509-4A47-9404-3EB8653AE037} = {8D891397-002B-4AF1-929E-0515D8F2F5AB} - {0F8262C1-75D8-4A92-BCB6-37A290891708} = {413B0724-5117-4BD6-99EF-D6B59859E1B3} - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A} = {A82FAF9C-BCCE-4569-9EB2-36DA4D239DA8} - {E31D1C4F-8E0D-428A-8583-5159CE690B33} = {5452CCB0-EF39-4699-A8E0-C86D595FC4DA} - {1893FA97-40A9-480F-BB77-279F959EAE6E} = {8C5A07F5-C9E0-430D-A908-2C1161C952ED} - {23BA577F-B171-4CEC-92E0-49EE44564366} = {8B19C579-DB40-4D8B-A605-165366FAB6CD} - {C9C14C99-103E-45CB-B1B4-2C165429E35C} = {D804D2D8-5ED5-42B3-A77D-1A46D3ACB727} - {8D542B56-EB45-43B1-AAB8-417352F5BDE6} = {3904D25E-E461-4A90-A544-E1C74A32086A} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {54F58964-376A-47BC-A813-559EFB1AB281} - EndGlobalSection -EndGlobal diff --git a/print/XPSDrvSmpl/install/xdCMYKPrinter.icc b/print/XPSDrvSmpl/install/xdCMYKPrinter.icc deleted file mode 100644 index 59c55ae6..00000000 Binary files a/print/XPSDrvSmpl/install/xdCMYKPrinter.icc and /dev/null differ diff --git a/print/XPSDrvSmpl/install/xdbook.gpd b/print/XPSDrvSmpl/install/xdbook.gpd deleted file mode 100644 index 8083ec45..00000000 --- a/print/XPSDrvSmpl/install/xdbook.gpd +++ /dev/null @@ -1,87 +0,0 @@ -*% -*% Copyright (c) 2005 Microsoft Corporation -*% -*% All rights reserved. -*% -*% THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -*% ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -*% THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -*% PARTICULAR PURPOSE. -*% -*% File Name: -*% -*% xdbook.gpd -*% -*% Abstract: -*% -*% XPSDrv filter feature sample driver Booklet specific GPD settings. -*% - -*%****************************************************************************** -*% JobBindAllDocuments -*%****************************************************************************** -*Feature: JobBindAllDocuments -{ - *rcNameID: =IDS_GPD_JOBBINDING - *DefaultOption: None - - *Option: None - { - *rcNameID: =IDS_GPD_NONE - } - - *Option: BindLeft - { - *rcNameID: =IDS_GPD_LTOR - } - - *Option: BindRight - { - *rcNameID: =IDS_GPD_RTOL - } - - *Option: BindTop - { - *rcNameID: =IDS_GPD_TTOB - } - - *Option: BindBottom - { - *rcNameID: =IDS_GPD_BTOT - } -} - -*%****************************************************************************** -*% DocumentBinding -*%****************************************************************************** -*Feature: DocumentBinding -{ - *rcNameID: =IDS_GPD_DOCBIND - *DefaultOption: None - - *Option: None - { - *rcNameID: =IDS_GPD_NONE - } - - *Option: BindLeft - { - *rcNameID: =IDS_GPD_LTOR - } - - *Option: BindRight - { - *rcNameID: =IDS_GPD_RTOL - } - - *Option: BindTop - { - *rcNameID: =IDS_GPD_TTOB - } - - *Option: BindBottom - { - *rcNameID: =IDS_GPD_BTOT - } -} - diff --git a/print/XPSDrvSmpl/install/xdcolman.gpd b/print/XPSDrvSmpl/install/xdcolman.gpd deleted file mode 100644 index ea84c964..00000000 --- a/print/XPSDrvSmpl/install/xdcolman.gpd +++ /dev/null @@ -1,106 +0,0 @@ -*% -*% Copyright (c) 2005 Microsoft Corporation -*% -*% All rights reserved. -*% -*% THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -*% ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -*% THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -*% PARTICULAR PURPOSE. -*% -*% File Name: -*% -*% xdcolman.gpd -*% -*% Abstract: -*% -*% XPSDrv filter feature sample driver Color Management specific GPD settings. -*% - -*%****************************************************************************** -*% PageColorManagement -*%****************************************************************************** -*Feature: PageColorManagement -{ - *rcNameID: =IDS_GPD_PAGECOLMAN - *DefaultOption: None - *PrintSchemaKeywordMap: "PageColorManagement" - - *Option: None - { - *rcNameID: =IDS_GPD_NONE - *PrintSchemaKeywordMap: "None" - } - - *Option: Device - { - *rcNameID: =IDS_GPD_DEVICE - *PrintSchemaKeywordMap: "Device" - } - - *Option: Driver - { - *rcNameID: =IDS_GPD_DRIVER - *PrintSchemaKeywordMap: "Driver" - } - - *Option: System - { - *rcNameID: =IDS_GPD_SYSTEM - *PrintSchemaKeywordMap: "System" - } -} - -*%****************************************************************************** -*% PageSourceColorProfile -*%****************************************************************************** -*Feature: PageSourceColorProfile -{ - *rcNameID: =IDS_GPD_SRCCOLPROF - *DefaultOption: CMYK - - *Option: CMYK - { - *rcNameID: =IDS_GPD_CMYK - } - - *Option: scRGB - { - *rcNameID: =IDS_GPD_SCRGB - } -} - -*%****************************************************************************** -*% PageICMRenderingIntent -*%****************************************************************************** -*Feature: PageICMRenderingIntent -{ - *rcNameID: =IDS_GPD_PAGEICMINTENT - *DefaultOption: AbsoluteColorimetric - *PrintSchemaKeywordMap: "PageICMRenderingIntent" - - *Option: AbsoluteColorimetric - { - *rcNameID: =IDS_GPD_ABSCOLINTENT - *PrintSchemaKeywordMap: "AbsoluteColorimetric" - } - - *Option: RelativeColorimetric - { - *rcNameID: =IDS_GPD_RELCOLINTENT - *PrintSchemaKeywordMap: "RelativeColorimetric" - } - - *Option: Photographs - { - *rcNameID: =IDS_GPD_PHOTOINTENT - *PrintSchemaKeywordMap: "Photographs" - } - - *Option: BusinessGraphics - { - *rcNameID: =IDS_GPD_BIZINTENT - *PrintSchemaKeywordMap: "BusinessGraphics" - } -} - diff --git a/print/XPSDrvSmpl/install/xdnames.gpd b/print/XPSDrvSmpl/install/xdnames.gpd deleted file mode 100644 index 0a45a313..00000000 --- a/print/XPSDrvSmpl/install/xdnames.gpd +++ /dev/null @@ -1,151 +0,0 @@ -*% -*% Copyright (c) 2005 Microsoft Corporation -*% -*% All rights reserved. -*% -*% THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -*% ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -*% THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -*% PARTICULAR PURPOSE. -*% -*% File Name: -*% -*% xdnames.gpd -*% -*% Abstract: -*% -*% XPSDrv filter feature sample driver GPD resource names. -*% - -*CodePage: 1252 *% Windows 3.1 US (ANSI) code page - -*Feature: RESDLL -{ - *Name: "resource dll files" - *ConcealFromUI?: TRUE - - *Option: UniresDLL - { - *Name: "unires.dll" - } - *Option: xdsmplui - { - *Name: "xdsmplui.dll" - } -} - -*Macros: StdFeatureNames -{ - IDS_GPD_1PPS: RESDLL.xdsmplui.2000 - IDS_GPD_2PPS: RESDLL.xdsmplui.2001 - IDS_GPD_4PPS: RESDLL.xdsmplui.2002 - IDS_GPD_6PPS: RESDLL.xdsmplui.2003 - IDS_GPD_8PPS: RESDLL.xdsmplui.2004 - IDS_GPD_9PPS: RESDLL.xdsmplui.2005 - IDS_GPD_16PPS: RESDLL.xdsmplui.2006 - IDS_GPD_RES1200: RESDLL.xdsmplui.2007 - IDS_GPD_RES600: RESDLL.xdsmplui.2008 - IDS_GPD_AUTOMATIC: RESDLL.xdsmplui.2009 - IDS_GPD_BORDERED: RESDLL.xdsmplui.2010 - IDS_GPD_BORDERLESS: RESDLL.xdsmplui.2011 - IDS_GPD_BTOT: RESDLL.xdsmplui.2012 - IDS_GPD_BTOTLTOR: RESDLL.xdsmplui.2013 - IDS_GPD_BTOTRTOL: RESDLL.xdsmplui.2014 - IDS_GPD_CMYK: RESDLL.xdsmplui.2015 - IDS_GPD_COLOR: RESDLL.xdsmplui.2016 - IDS_GPD_CONFIDENTIAL: RESDLL.xdsmplui.2017 - IDS_GPD_CUSTSQUARE: RESDLL.xdsmplui.2018 - IDS_GPD_CUSTOM: RESDLL.xdsmplui.2019 - IDS_GPD_SRCCOLPROF: RESDLL.xdsmplui.2020 - IDS_GPD_DEVICE: RESDLL.xdsmplui.2021 - IDS_GPD_DOCBIND: RESDLL.xdsmplui.2022 - IDS_GPD_PAGECOLMAN: RESDLL.xdsmplui.2023 - IDS_GPD_PAGEPHOTINTENT: RESDLL.xdsmplui.2024 - IDS_GPD_DOCDUPLEX: RESDLL.xdsmplui.2025 - IDS_GPD_DOCNUP: RESDLL.xdsmplui.2026 - IDS_GPD_DOCNUPPRESENTORDER: RESDLL.xdsmplui.2027 - IDS_GPD_DRAFT: RESDLL.xdsmplui.2028 - IDS_GPD_DRIVER: RESDLL.xdsmplui.2029 - IDS_GPD_DUPLEX: RESDLL.xdsmplui.2030 - IDS_GPD_FAX: RESDLL.xdsmplui.2031 - IDS_GPD_FITBLEED: RESDLL.xdsmplui.2032 - IDS_GPD_FITCONTENT: RESDLL.xdsmplui.2033 - IDS_GPD_FITPAGE: RESDLL.xdsmplui.2034 - IDS_GPD_GLOSSY: RESDLL.xdsmplui.2035 - IDS_GPD_GRAYSCALE: RESDLL.xdsmplui.2036 - IDS_GPD_HIGH: RESDLL.xdsmplui.2037 - IDS_GPD_HORIZONTAL: RESDLL.xdsmplui.2038 - IDS_GPD_JOBBINDING: RESDLL.xdsmplui.2039 - IDS_GPD_JOBNUPPRESENTORDER: RESDLL.xdsmplui.2040 - IDS_GPD_JOBNUP: RESDLL.xdsmplui.2041 - IDS_GPD_JOBPAGEORDER: RESDLL.xdsmplui.2042 - IDS_GPD_LANDSCAPE: RESDLL.xdsmplui.2043 - IDS_GPD_LTOR: RESDLL.xdsmplui.2044 - IDS_GPD_LTORBTOT: RESDLL.xdsmplui.2045 - IDS_GPD_LTORTTOB: RESDLL.xdsmplui.2046 - IDS_GPD_MEDIATYPE: RESDLL.xdsmplui.2047 - IDS_GPD_MONO: RESDLL.xdsmplui.2048 - IDS_GPD_NONE: RESDLL.xdsmplui.2049 - IDS_GPD_NORMAL: RESDLL.xdsmplui.2050 - IDS_GPD_OFF: RESDLL.xdsmplui.2051 - IDS_GPD_ON: RESDLL.xdsmplui.2052 - IDS_GPD_ORIENATION: RESDLL.xdsmplui.2053 - IDS_GPD_OVERLAYED: RESDLL.xdsmplui.2054 - IDS_GPD_PAGEBORDER: RESDLL.xdsmplui.2055 - IDS_GPD_PAGEQUALITY: RESDLL.xdsmplui.2056 - IDS_GPD_PAGESCALING: RESDLL.xdsmplui.2057 - IDS_GPD_PAPERSOURCE: RESDLL.xdsmplui.2058 - IDS_GPD_PHOTOGRAPHIC: RESDLL.xdsmplui.2059 - IDS_GPD_PORTRAIT: RESDLL.xdsmplui.2060 - IDS_GPD_RASTERIMAGE: RESDLL.xdsmplui.2061 - IDS_GPD_RESOLUTION: RESDLL.xdsmplui.2062 - IDS_GPD_REVERSELANDSCAPE: RESDLL.xdsmplui.2063 - IDS_GPD_REVERSE: RESDLL.xdsmplui.2064 - IDS_GPD_RTOL: RESDLL.xdsmplui.2065 - IDS_GPD_RTOLBTOT: RESDLL.xdsmplui.2066 - IDS_GPD_RTOLTTOB: RESDLL.xdsmplui.2067 - IDS_GPD_SCALEPAGETOPAGE: RESDLL.xdsmplui.2068 - IDS_GPD_SCRGB: RESDLL.xdsmplui.2069 - IDS_GPD_STANDARD: RESDLL.xdsmplui.2070 - IDS_GPD_TEXT: RESDLL.xdsmplui.2071 - IDS_GPD_TTOB: RESDLL.xdsmplui.2072 - IDS_GPD_TTOBLTOR: RESDLL.xdsmplui.2073 - IDS_GPD_TTOBRTOL: RESDLL.xdsmplui.2074 - IDS_GPD_TRANSPARENCY: RESDLL.xdsmplui.2075 - IDS_GPD_TRANSPARENT: RESDLL.xdsmplui.2076 - IDS_GPD_UNDERLAYED: RESDLL.xdsmplui.2077 - IDS_GPD_UPPER: RESDLL.xdsmplui.2078 - IDS_GPD_VECTORIMAGE: RESDLL.xdsmplui.2079 - IDS_GPD_VERTICAL: RESDLL.xdsmplui.2080 - IDS_GPD_WATERMARKLAYERING: RESDLL.xdsmplui.2081 - IDS_GPD_WATERMARKTEXT: RESDLL.xdsmplui.2082 - IDS_GPD_WATERMARKTYPE: RESDLL.xdsmplui.2083 - IDS_GPD_WATERMARKBITMAP: RESDLL.xdsmplui.2084 - IDS_GPD_WATERMARKGRAPHIC: RESDLL.xdsmplui.2087 - IDS_GPD_BEST: RESDLL.xdsmplui.2090 - IDS_GPD_PAGEICMINTENT: RESDLL.xdsmplui.2091 - IDS_GPD_ABSCOLINTENT: RESDLL.xdsmplui.2092 - IDS_GPD_RELCOLINTENT: RESDLL.xdsmplui.2093 - IDS_GPD_PHOTOINTENT: RESDLL.xdsmplui.2094 - IDS_GPD_BIZINTENT: RESDLL.xdsmplui.2095 - IDS_GPD_SYSTEM: RESDLL.xdsmplui.2096 - IDS_GPD_WATERMARKTEXTCOLOR: RESDLL.xdsmplui.2097 - IDS_GPD_RED: RESDLL.xdsmplui.2098 - IDS_GPD_GREEN: RESDLL.xdsmplui.2099 - IDS_GPD_BLUE: RESDLL.xdsmplui.2100 - IDS_GPD_MAGENTA: RESDLL.xdsmplui.2101 - IDS_GPD_CYAN: RESDLL.xdsmplui.2102 - IDS_GPD_YELLOW: RESDLL.xdsmplui.2103 - IDS_GPD_BLACK: RESDLL.xdsmplui.2104 - IDS_GPD_SCALE_ALIGN: RESDLL.xdsmplui.2105 - IDS_GPD_SCALE_ALIGN_BC: RESDLL.xdsmplui.2106 - IDS_GPD_SCALE_ALIGN_BL: RESDLL.xdsmplui.2107 - IDS_GPD_SCALE_ALIGN_BR: RESDLL.xdsmplui.2108 - IDS_GPD_SCALE_ALIGN_CC: RESDLL.xdsmplui.2109 - IDS_GPD_SCALE_ALIGN_LC: RESDLL.xdsmplui.2110 - IDS_GPD_SCALE_ALIGN_CR: RESDLL.xdsmplui.2111 - IDS_GPD_SCALE_ALIGN_CT: RESDLL.xdsmplui.2112 - IDS_GPD_SCALE_ALIGN_TL: RESDLL.xdsmplui.2113 - IDS_GPD_SCALE_ALIGN_TR: RESDLL.xdsmplui.2114 -} - diff --git a/print/XPSDrvSmpl/install/xdnup.gpd b/print/XPSDrvSmpl/install/xdnup.gpd deleted file mode 100644 index 2f846dae..00000000 --- a/print/XPSDrvSmpl/install/xdnup.gpd +++ /dev/null @@ -1,207 +0,0 @@ -*% -*% Copyright (c) 2005 Microsoft Corporation -*% -*% All rights reserved. -*% -*% THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -*% ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -*% THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -*% PARTICULAR PURPOSE. -*% -*% File Name: -*% -*% xdnup.gpd -*% -*% Abstract: -*% -*% XPSDrv filter feature sample driver NUp specific GPD settings. -*% - -*%****************************************************************************** -*% JobNUpAllDocumentsContiguously -*%****************************************************************************** -*Feature: JobNUpAllDocumentsContiguously -{ - *rcNameID: =IDS_GPD_JOBNUP - *DefaultOption: 1 - *PrintSchemaKeywordMap: "JobNUpAllDocumentsContiguously" - - *Option: 1 - { - *rcNameID: =IDS_GPD_1PPS - } - - *Option: 2 - { - *rcNameID: =IDS_GPD_2PPS - } - - *Option: 4 - { - *rcNameID: =IDS_GPD_4PPS - } - - *Option: 6 - { - *rcNameID: =IDS_GPD_6PPS - } - - *Option: 8 - { - *rcNameID: =IDS_GPD_8PPS - } - - *Option: 9 - { - *rcNameID: =IDS_GPD_9PPS - } - - *Option: 16 - { - *rcNameID: =IDS_GPD_16PPS - } -} - -*%****************************************************************************** -*% JobNUpContiguouslyPresentationOrder -*%****************************************************************************** -*Feature: JobNUpContiguouslyPresentationOrder -{ - *rcNameID: =IDS_GPD_JOBNUPPRESENTORDER - *DefaultOption: RightBottom - - *Option: RightBottom - { - *rcNameID: =IDS_GPD_LTORTTOB - } - - *Option: BottomRight - { - *rcNameID: =IDS_GPD_TTOBLTOR - } - - *Option: LeftBottom - { - *rcNameID: =IDS_GPD_RTOLTTOB - } - - *Option: BottomLeft - { - *rcNameID: =IDS_GPD_TTOBRTOL - } - - *Option: RightTop - { - *rcNameID: =IDS_GPD_LTORBTOT - } - - *Option: TopRight - { - *rcNameID: =IDS_GPD_BTOTLTOR - } - - *Option: LeftTop - { - *rcNameID: =IDS_GPD_RTOLBTOT - } - - *Option: TopLeft - { - *rcNameID: =IDS_GPD_BTOTRTOL - } -} - -*%****************************************************************************** -*% DocumentNUp -*%****************************************************************************** -*Feature: DocumentNUp -{ - *rcNameID: =IDS_GPD_DOCNUP - *DefaultOption: 1 - *PrintSchemaKeywordMap: "DocumentNUp" - - *Option: 1 - { - *rcNameID: =IDS_GPD_1PPS - } - - *Option: 2 - { - *rcNameID: =IDS_GPD_2PPS - } - - *Option: 4 - { - *rcNameID: =IDS_GPD_4PPS - } - - *Option: 6 - { - *rcNameID: =IDS_GPD_6PPS - } - - *Option: 8 - { - *rcNameID: =IDS_GPD_8PPS - } - - *Option: 9 - { - *rcNameID: =IDS_GPD_9PPS - } - - *Option: 16 - { - *rcNameID: =IDS_GPD_16PPS - } -} - -*%****************************************************************************** -*% DocumentNUpPresentationOrder -*%****************************************************************************** -*Feature: DocumentNUpPresentationOrder -{ - *rcNameID: =IDS_GPD_DOCNUPPRESENTORDER - *DefaultOption: RightBottom - - *Option: RightBottom - { - *rcNameID: =IDS_GPD_LTORTTOB - } - - *Option: BottomRight - { - *rcNameID: =IDS_GPD_TTOBLTOR - } - - *Option: LeftBottom - { - *rcNameID: =IDS_GPD_RTOLTTOB - } - - *Option: BottomLeft - { - *rcNameID: =IDS_GPD_TTOBRTOL - } - - *Option: RightTop - { - *rcNameID: =IDS_GPD_LTORBTOT - } - - *Option: TopRight - { - *rcNameID: =IDS_GPD_BTOTLTOR - } - - *Option: LeftTop - { - *rcNameID: =IDS_GPD_RTOLBTOT - } - - *Option: TopLeft - { - *rcNameID: =IDS_GPD_BTOTRTOL - } -} - diff --git a/print/XPSDrvSmpl/install/xdpgscl.gpd b/print/XPSDrvSmpl/install/xdpgscl.gpd deleted file mode 100644 index bacef11c..00000000 --- a/print/XPSDrvSmpl/install/xdpgscl.gpd +++ /dev/null @@ -1,117 +0,0 @@ -*% -*% Copyright (c) 2005 Microsoft Corporation -*% -*% All rights reserved. -*% -*% THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -*% ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -*% THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -*% PARTICULAR PURPOSE. -*% -*% File Name: -*% -*% xdpgscl.gpd -*% -*% Abstract: -*% -*% XPSDrv filter feature sample driver page scaling specific GPD settings. -*% - -*%****************************************************************************** -*% PageScaling -*%****************************************************************************** -*Feature: PageScaling -{ - *rcNameID: =IDS_GPD_PAGESCALING - *DefaultOption: None - - *Option: None - { - *rcNameID: =IDS_GPD_NONE - } - - *Option: Custom - { - *rcNameID: =IDS_GPD_CUSTOM - } - - *Option: CustomSquare - { - *rcNameID: =IDS_GPD_CUSTSQUARE - } - - *Option: FitApplicationBleedSizeToPageImageableSize - { - *rcNameID: =IDS_GPD_FITBLEED - } - - *Option: FitApplicationContentSizeToPageImageableSize - { - *rcNameID: =IDS_GPD_FITCONTENT - } - - *Option: FitApplicationMediaSizeToPageImageableSize - { - *rcNameID: =IDS_GPD_FITPAGE - } - - *Option: FitApplicationMediaSizeToPageMediaSize - { - *rcNameID: =IDS_GPD_SCALEPAGETOPAGE - } -} - -*%****************************************************************************** -*% ScaleOffsetAlignment -*%****************************************************************************** -*Feature: ScaleOffsetAlignment -{ - *rcNameID: =IDS_GPD_SCALE_ALIGN - *DefaultOption: Center - - *Option: BottomCenter - { - *rcNameID: =IDS_GPD_SCALE_ALIGN_BC - } - - *Option: BottomLeft - { - *rcNameID: =IDS_GPD_SCALE_ALIGN_BL - } - - *Option: BottomRight - { - *rcNameID: =IDS_GPD_SCALE_ALIGN_BR - } - - *Option: Center - { - *rcNameID: =IDS_GPD_SCALE_ALIGN_CC - } - - *Option: LeftCenter - { - *rcNameID: =IDS_GPD_SCALE_ALIGN_LC - } - - *Option: RightCenter - { - *rcNameID: =IDS_GPD_SCALE_ALIGN_CR - } - - *Option: TopCenter - { - *rcNameID: =IDS_GPD_SCALE_ALIGN_CT - } - - *Option: TopLeft - { - *rcNameID: =IDS_GPD_SCALE_ALIGN_TL - } - - *Option: TopRight - { - *rcNameID: =IDS_GPD_SCALE_ALIGN_TR - } -} - diff --git a/print/XPSDrvSmpl/install/xdsmpl-PipelineConfig.xml b/print/XPSDrvSmpl/install/xdsmpl-PipelineConfig.xml deleted file mode 100644 index b649032a..00000000 --- a/print/XPSDrvSmpl/install/xdsmpl-PipelineConfig.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/print/XPSDrvSmpl/install/xdsmpl.gpd b/print/XPSDrvSmpl/install/xdsmpl.gpd deleted file mode 100644 index 2ad72e6a..00000000 --- a/print/XPSDrvSmpl/install/xdsmpl.gpd +++ /dev/null @@ -1,467 +0,0 @@ -*% -*% Copyright (c) 2005 Microsoft Corporation -*% -*% All rights reserved. -*% -*% THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -*% ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -*% THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -*% PARTICULAR PURPOSE. -*% -*% File Name: -*% -*% xdsmpl.gpd -*% -*% Abstract: -*% -*% XPSDrv filter feature sample driver main GPD file. -*% - -*GPDFileVersion: "1.0" -*GPDSpecVersion: "1.0" -*GPDFileName: "XDSmpl.gpd" -*Include: "msxpsinc.gpd" -*Include: "StdNames.gpd" -*Include: "xdnames.gpd" -*Include: "xdwmark.gpd" -*Include: "xdbook.gpd" -*Include: "xdcolman.gpd" -*Include: "xdnup.gpd" -*Include: "xdpgscl.gpd" -*ModelName: "XPSDrv Sample Driver" -*MasterUnits: PAIR(1200, 1200) -*ResourceDLL: "unires.dll" -*PrinterType: PAGE -*MaxCopies: 1 - -*%****************************************************************************** -*% PageMediaSize - Paper Size -*%****************************************************************************** -*Feature: PaperSize -{ - *rcNameID: =PAPER_SIZE_DISPLAY - *DefaultOption: LETTER - - *Option: A3 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 9667 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(13460, 19440) - *PrintableOrigin: PAIR(284, 200) - *CursorOrigin: PAIR(284, 200) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(13628, 19368) - *PrintableOrigin: PAIR(200, 236) - *CursorOrigin: PAIR(200, 19604) - } - } - } - - *Option: A4 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4249 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9352, 13628) - *PrintableOrigin: PAIR(284, 200) - *CursorOrigin: PAIR(284, 200) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(9520, 13556) - *PrintableOrigin: PAIR(200, 236) - *CursorOrigin: PAIR(200, 13792) - } - } - } - - *Option: B4 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 6391 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(11572, 16796) - *PrintableOrigin: PAIR(284, 200) - *CursorOrigin: PAIR(284, 200) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(11740, 16724) - *PrintableOrigin: PAIR(200, 236) - *CursorOrigin: PAIR(200, 16960) - } - } - } - - *Option: B5 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 3198 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(7900, 11140) - *PrintableOrigin: PAIR(352, 300) - *CursorOrigin: PAIR(300, 100) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(7760, 11140) - *PrintableOrigin: PAIR(300, 400) - *CursorOrigin: PAIR(100, 11940) - } - } - } - - *Option: EXECUTIVE - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4109 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(8100, 11500) - *PrintableOrigin: PAIR(300, 300) - *CursorOrigin: PAIR(300, 200) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(8300, 11500) - *PrintableOrigin: PAIR(200, 300) - *CursorOrigin: PAIR(200, 12300) - } - } - } - - *Option: ENV_10 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4109 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(4348, 11000) - *PrintableOrigin: PAIR(300, 200) - *CursorOrigin: PAIR(300, 200) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(4548, 10920) - *PrintableOrigin: PAIR(200, 240) - *CursorOrigin: PAIR(200, 11160) - } - } - } - - *Option: LEGAL - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1692 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 600) - *CursorOrigin: PAIR(180, 300) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 900) - *CursorOrigin: PAIR(180, 16500) - } - } - } - - *Option: LETTER - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1028 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9500, 12500) - *PrintableOrigin: PAIR(400, 400) - *CursorOrigin: PAIR(300, 300) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(9500, 12200) - *PrintableOrigin: PAIR(450, 300) - *CursorOrigin: PAIR(200, 12900) - } - } - } - - *Option: ENV_MONARCH - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4109 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(4048, 8600) - *PrintableOrigin: PAIR(300, 200) - *CursorOrigin: PAIR(300, 200) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(4248, 8520) - *PrintableOrigin: PAIR(200, 240) - *CursorOrigin: PAIR(200, 8760) - } - } - } - - *Option: TABLOID - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4109 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(12000, 19200) - *PrintableOrigin: PAIR(400, 400) - *CursorOrigin: PAIR(400, 400) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(12000, 19200) - *PrintableOrigin: PAIR(400, 600) - *CursorOrigin: PAIR(400, 18000) - } - } - } -} - -*%****************************************************************************** -*% PageOrientation -*%****************************************************************************** -*Feature: Orientation -{ - *rcNameID: =ORIENTATION_DISPLAY - *DefaultOption: PORTRAIT - - *Option: PORTRAIT - { - *rcNameID: =PORTRAIT_DISPLAY - } - - *Option: LANDSCAPE_CC270 - { - *rcNameID: =LANDSCAPE_DISPLAY - } -} - -*%****************************************************************************** -*% PageOutputColor -*%****************************************************************************** -*Feature: ColorMode -{ - *rcNameID: =COLOR_PRINTING_MODE_DISPLAY - *DefaultOption: Color - - *Option: Mono - { - *rcNameID: =MONO_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 1 - *Color?: FALSE - } - - *Option: Grayscale - { - *rcNameID: =8BPP_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 8 - *DrvBPP: 8 - *PaletteSize: 256 - *Color?: FALSE - } - - *Option: Color - { - *rcNameID: =24BPP_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 24 - *DrvBPP: 24 - *PaletteSize: 1 - } -} - -*%****************************************************************************** -*% Resolution -*%****************************************************************************** -*Feature: Resolution -{ - *rcNameID: =RESOLUTION_DISPLAY - *DefaultOption: DPI600 - - *Option: DPI600 - { - *Name: "600 x 600 " =DOTS_PER_INCH - *DPI: PAIR(600, 600) - *TextDPI: PAIR(600, 600) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - } - - *Option: DPI1200 - { - *Name: "1200 x 1200 " =DOTS_PER_INCH - *DPI: PAIR(1200, 1200) - *TextDPI: PAIR(1200, 1200) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - } -} - -*%****************************************************************************** -*% Input Bin -*%****************************************************************************** -*Feature: InputBin -{ - *rcNameID: =PAPER_SOURCE_DISPLAY - *DefaultOption: UPPER - *ConcealFromUI?: TRUE - - *Option: UPPER - { - *rcNameID: =UPPER_TRAY_DISPLAY - } -} - -*%****************************************************************************** -*% DocumentDuplex -*%****************************************************************************** -*Feature: DocumentDuplex -{ - *rcNameID: =IDS_GPD_DOCDUPLEX - *DefaultOption: None - *PrintSchemaKeywordMap: "DocumentDuplex" - - *Option: None - { - *rcNameID: =IDS_GPD_NONE - *PrintSchemaKeywordMap: "OneSided" - } - - *Option: Horizontal - { - *rcNameID: =IDS_GPD_HORIZONTAL - *PrintSchemaKeywordMap: "TwoSidedLongEdge" - } - - *Option: Vertical - { - *rcNameID: =IDS_GPD_VERTICAL - *PrintSchemaKeywordMap: "TwoSidedShortEdge" - } -} - -*%****************************************************************************** -*% PagePhotoPrintingIntent -*%****************************************************************************** -*Feature: PagePhotoPrintingIntent -{ - *rcNameID: =IDS_GPD_PAGEPHOTINTENT - *DefaultOption: None - *PrintSchemaKeywordMap: "PagePhotoPrintingIntent" - - *Option: None - { - *rcNameID: =IDS_GPD_NONE - *PrintSchemaKeywordMap: "None" - } - - *Option: PhotoBest - { - *rcNameID: =IDS_GPD_BEST - *PrintSchemaKeywordMap: "PhotoBest" - } - - *Option: PhotoDraft - { - *rcNameID: =IDS_GPD_DRAFT - *PrintSchemaKeywordMap: "PhotoDraft" - } - - *Option: PhotoStandard - { - *rcNameID: =IDS_GPD_STANDARD - *PrintSchemaKeywordMap: "PhotoStandard" - } -} - -*%****************************************************************************** -*% PageBorderless -*%****************************************************************************** -*Feature: PageBorderless -{ - *rcNameID: =IDS_GPD_PAGEBORDER - *DefaultOption: Borderless - *PrintSchemaKeywordMap: "PageBorderless" - - *Option: None - { - *rcNameID: =IDS_GPD_BORDERED - *PrintSchemaKeywordMap: "None" - } - - *Option: Borderless - { - *rcNameID: =IDS_GPD_BORDERLESS - *PrintSchemaKeywordMap: "Borderless" - } -} - - -*%****************************************************************************** -*% Printer Memory -*%****************************************************************************** -*Feature: Memory -{ - *rcNameID: =PRINTER_MEMORY_DISPLAY - *DefaultOption: 32768KB - *Option: 16384KB - { - *Name: "16MB" - *MemoryConfigKB: PAIR(16384, 13950) - } - *Option: 32768KB - { - *Name: "32MB" - *MemoryConfigKB: PAIR(32768, 28350) - } -} - -*%****************************************************************************** -*% Cursor Commands -*%****************************************************************************** -*Command: CmdCR { *Cmd : "<0D>" } -*Command: CmdLF { *Cmd : "<0A>" } -*Command: CmdFF { *Cmd : "<0C>" } - diff --git a/print/XPSDrvSmpl/install/xdsmpl.inf b/print/XPSDrvSmpl/install/xdsmpl.inf deleted file mode 100644 index e696a264..00000000 Binary files a/print/XPSDrvSmpl/install/xdsmpl.inf and /dev/null differ diff --git a/print/XPSDrvSmpl/install/xdsmpl.ini b/print/XPSDrvSmpl/install/xdsmpl.ini deleted file mode 100644 index d9e17f2c..00000000 --- a/print/XPSDrvSmpl/install/xdsmpl.ini +++ /dev/null @@ -1,22 +0,0 @@ -; -; Copyright (c) 2005 Microsoft Corporation -; -; All rights reserved. -; -; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -; ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -; PARTICULAR PURPOSE. -; -; File Name: -; -; xdsmpl.ini -; -; Abstract: -; -; XPSDrv sample driver configuration file for UI plug-in. -; - -[OEMFiles] -OEMConfigFile1=xdsmplui.DLL - diff --git a/print/XPSDrvSmpl/install/xdwmark.gpd b/print/XPSDrvSmpl/install/xdwmark.gpd deleted file mode 100644 index cf1802d8..00000000 --- a/print/XPSDrvSmpl/install/xdwmark.gpd +++ /dev/null @@ -1,67 +0,0 @@ -*% -*% Copyright (c) 2005 Microsoft Corporation -*% -*% All rights reserved. -*% -*% THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -*% ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -*% THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -*% PARTICULAR PURPOSE. -*% -*% File Name: -*% -*% xdwmark.gpd -*% -*% Abstract: -*% -*% XPSDrv filter feature sample driver watermark specific GPD settings. -*% - -*%****************************************************************************** -*% PageWatermark -*%****************************************************************************** -*Feature: PageWatermarkType -{ - *rcNameID: =IDS_GPD_WATERMARKTYPE - *DefaultOption: None - - *Option: None - { - *rcNameID: =IDS_GPD_NONE - } - - *Option: Text - { - *rcNameID: =IDS_GPD_TEXT - } - - *Option: Raster - { - *rcNameID: =IDS_GPD_RASTERIMAGE - } - - *Option: Vector - { - *rcNameID: =IDS_GPD_VECTORIMAGE - } -} - -*%****************************************************************************** -*% PageWatermarkLayering -*%****************************************************************************** -*Feature: PageWatermarkLayering -{ - *rcNameID: =IDS_GPD_WATERMARKLAYERING - *DefaultOption: Overlay - - *Option: Overlay - { - *rcNameID: =IDS_GPD_OVERLAYED - } - - *Option: Underlay - { - *rcNameID: =IDS_GPD_UNDERLAYED - } -} - diff --git a/print/XPSDrvSmpl/install/xdwscRGB.icc b/print/XPSDrvSmpl/install/xdwscRGB.icc deleted file mode 100644 index b1e6845d..00000000 Binary files a/print/XPSDrvSmpl/install/xdwscRGB.icc and /dev/null differ diff --git a/print/XPSDrvSmpl/src/common/bkdata.h b/print/XPSDrvSmpl/src/common/bkdata.h deleted file mode 100644 index dae29cf2..00000000 --- a/print/XPSDrvSmpl/src/common/bkdata.h +++ /dev/null @@ -1,46 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bkdata.h - -Abstract: - - Booklet data structure definition. This provides a convenient description - of the PrintSchema JobBindAllDocuments and DcoumentBinding features. - ---*/ - -#pragma once - -#include "bkschema.h" - -namespace XDPrintSchema -{ - namespace Binding - { - struct BindingData - { - BindingData() : - bindFeature(JobBindAllDocuments), - bindOption(None), - bindGutter(0) - { - } - - EBinding bindFeature; - EBindingOption bindOption; - INT bindGutter; - }; - } -} - diff --git a/print/XPSDrvSmpl/src/common/bkpchndlr.cpp b/print/XPSDrvSmpl/src/common/bkpchndlr.cpp deleted file mode 100644 index 1ce57acf..00000000 --- a/print/XPSDrvSmpl/src/common/bkpchndlr.cpp +++ /dev/null @@ -1,201 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bkpchndlr.cpp - -Abstract: - - Booklet PrintCapabilities handling implementation. The booklet PC handler - is used to set booklet settings in a PrintCapabilities document. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "xdexcept.h" -#include "bkpchndlr.h" -#include "globals.h" -#include "privatedefs.h" - -using XDPrintSchema::PRINTCAPABILITIES_NAME; - -using XDPrintSchema::Binding::EBinding; -using XDPrintSchema::Binding::EBindingMin; -using XDPrintSchema::Binding::EBindingMax; -using XDPrintSchema::Binding::EBindingOption; -using XDPrintSchema::Binding::EBindingOptionMin; -using XDPrintSchema::Binding::EBindingOptionMax; -using XDPrintSchema::Binding::BIND_FEATURES; -using XDPrintSchema::Binding::BIND_OPTIONS; - -/*++ - -Routine Name: - - CBookPCHandler::CBookPCHandler - -Routine Description: - - CBookPCHandler class constructor - -Arguments: - - pPrintCapabilities - Pointer to the DOM document representation of the PrintCapabilities - -Return Value: - - None - ---*/ -CBookPCHandler::CBookPCHandler( - _In_ IXMLDOMDocument2* pPrintCapabilities - ) : - CPCHandler(pPrintCapabilities) -{ -} - -/*++ - -Routine Name: - - CBookPCHandler::~CBookPCHandler - -Routine Description: - - CBookPCHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CBookPCHandler::~CBookPCHandler() -{ -} - -/*++ - -Routine Name: - - CBookPCHandler::SetCapabilities - -Routine Description: - - This routine sets booklet capabilities in the PrintCapabilities passed to the - class constructor. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBookPCHandler::SetCapabilities( - VOID - ) -{ - HRESULT hr = S_OK; - - try - { - // - // Retrieve the PrintTicket root - // - CComPtr pPTRoot(NULL); - - CComBSTR bstrPTQuery(m_bstrFrameworkPrefix); - bstrPTQuery += PRINTCAPABILITIES_NAME; - - if (SUCCEEDED(hr = GetNode(bstrPTQuery, &pPTRoot))) - { - for (EBinding bindFeatures = EBindingMin; - bindFeatures < EBindingMax && SUCCEEDED(hr); - bindFeatures = static_cast(bindFeatures + 1)) - { - CComPtr pFeatureElement(NULL); - - if (SUCCEEDED(hr = CreateFeatureSelection(CComBSTR(BIND_FEATURES[bindFeatures]), NULL, &pFeatureElement))) - { - PTDOMElementVector optionList; - - for (EBindingOption bindOption = EBindingOptionMin; - bindOption < EBindingOptionMax && SUCCEEDED(hr); - bindOption = static_cast(bindOption + 1)) - { - // - // Create the booklet options - // - CComPtr pOptionProperty(NULL); - - if (SUCCEEDED(hr = CreateOption(CComBSTR(BIND_OPTIONS[bindOption]), NULL, &pOptionProperty))) - { - optionList.push_back(pOptionProperty); - } - } - - // - // Add the options into the booklet feature - // - PTDOMElementVector::iterator iterOptionList = optionList.begin(); - - for (;iterOptionList != optionList.end() && SUCCEEDED(hr); iterOptionList++) - { - hr = pFeatureElement->appendChild(*iterOptionList, NULL); - } - } - - if (SUCCEEDED(hr)) - { - hr = pPTRoot->appendChild(pFeatureElement, NULL); - } - } - - for (UINT cIndex = 0; cIndex < numof(bkParamDefIntegers); cIndex++) - { - CComPtr pParameterDef(NULL); - - if (SUCCEEDED(hr = CreateIntParameterDef(CComBSTR(bkParamDefIntegers[cIndex].property_name), // Paramater Name - bkParamDefIntegers[cIndex].is_public, // Is Print Schema keyword? - CComBSTR(bkParamDefIntegers[cIndex].display_name), // Display Text - bkParamDefIntegers[cIndex].default_value, // Default - bkParamDefIntegers[cIndex].min_length, // Min Length - bkParamDefIntegers[cIndex].max_length, // Max Length - bkParamDefIntegers[cIndex].multiple, // Multiple - CComBSTR(bkParamDefIntegers[cIndex].unit_type), // Unit Type - &pParameterDef))) // Parameter Def - { - hr = pPTRoot->appendChild(pParameterDef, NULL); - } - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/bkpchndlr.h b/print/XPSDrvSmpl/src/common/bkpchndlr.h deleted file mode 100644 index 46d65138..00000000 --- a/print/XPSDrvSmpl/src/common/bkpchndlr.h +++ /dev/null @@ -1,41 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bkpchndlr.h - -Abstract: - - Booklet PrintCapabilities handling definition. The booklet PC handler - is used to set booklet settings in a PrintCapabilities. - ---*/ - -#pragma once - -#include "pchndlr.h" -#include "bkdata.h" - -class CBookPCHandler : public CPCHandler -{ -public: - CBookPCHandler( - _In_ IXMLDOMDocument2* pPrintCapabilities - ); - - virtual ~CBookPCHandler(); - - HRESULT - SetCapabilities( - VOID - ); -}; diff --git a/print/XPSDrvSmpl/src/common/bkpthndlr.cpp b/print/XPSDrvSmpl/src/common/bkpthndlr.cpp deleted file mode 100644 index 46fb54b6..00000000 --- a/print/XPSDrvSmpl/src/common/bkpthndlr.cpp +++ /dev/null @@ -1,318 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bkpthndlr.cpp - -Abstract: - - Booklet PrintTicket handling implementation. The booklet PT handler - is used to extract booklet settings from a PrintTicket and populate - the booklet data structure with the retrieved settings. The class also - defines a method for setting the feature in the PrintTicket given the - data structure. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "bkpthndlr.h" - -using XDPrintSchema::PRINTTICKET_NAME; - -using XDPrintSchema::Binding::BindingData; -using XDPrintSchema::Binding::EBinding; -using XDPrintSchema::Binding::EBindingMin; -using XDPrintSchema::Binding::EBindingMax; -using XDPrintSchema::Binding::EBindingOption; -using XDPrintSchema::Binding::EBindingOptionMin; -using XDPrintSchema::Binding::EBindingOptionMax; -using XDPrintSchema::Binding::BIND_FEATURES; -using XDPrintSchema::Binding::BIND_OPTIONS; -using XDPrintSchema::Binding::BIND_PROP; -using XDPrintSchema::Binding::BIND_PROP_REF_SUFFIX; - -/*++ - -Routine Name: - - CBookPTHandler::CBookPTHandler - -Routine Description: - - CBookPTHandler class constructor - -Arguments: - - pPrintTicket - Pointer to the DOM document representation of the PrintTicket - -Return Value: - - None - ---*/ -CBookPTHandler::CBookPTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ) : - CPTHandler(pPrintTicket) -{ -} - -/*++ - -Routine Name: - - CBookPTHandler::~CBookPTHandler - -Routine Description: - - CBookPTHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CBookPTHandler::~CBookPTHandler() -{ -} - -/*++ - -Routine Name: - - CBookPTHandler::GetData - -Routine Description: - - The routine fills the data structure passed in with binding data retrieved from - the PrintTicket passed to the class constructor. - -Arguments: - - pBindData - Pointer to the binding data structure to be filled in - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - Feature not present in PrintTicket - E_* - On error - ---*/ -HRESULT -CBookPTHandler::GetData( - _Out_ BindingData* pBindData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pBindData, E_POINTER))) - { - for (EBinding bindFeature = EBindingMin; - bindFeature < EBindingMax; - bindFeature = static_cast(bindFeature + 1)) - { - CComBSTR bstrBindOption; - CComBSTR bstrFeature(BIND_FEATURES[bindFeature]); - - if (SUCCEEDED(hr = GetFeatureOption(bstrFeature, &bstrBindOption))) - { - pBindData->bindFeature = bindFeature; - - // - // Identify the option - // - for (EBindingOption bindOption = EBindingOptionMin; - bindOption < EBindingOptionMax; - bindOption = static_cast(bindOption + 1)) - { - if (bstrBindOption == BIND_OPTIONS[bindOption]) - { - pBindData->bindOption = bindOption; - break; - } - } - - // - // Get the gutter value if one exists otherwise use a default - // - if (FAILED(GetScoredPropertyValue(bstrFeature, CComBSTR(BIND_PROP), &pBindData->bindGutter))) - { - pBindData->bindGutter = 0; - } - - break; - } - else if (hr != E_ELEMENT_NOT_FOUND) - { - // - // We have an error other than the element is not present - // so we break and let the result return - // - break; - } - } - } - - // - // Validate the data - // - if (SUCCEEDED(hr)) - { - if (pBindData->bindFeature < EBindingMin || - pBindData->bindFeature >= EBindingMax || - pBindData->bindOption < EBindingOptionMin || - pBindData->bindOption >= EBindingOptionMax) - { - hr = E_FAIL; - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CBookPTHandler::SetData - -Routine Description: - - This routine sets the binding data in the PrintTicket passed to the - class constructor. - -Arguments: - - pBindData - Pointer to the binding data to be set in the PrintTicket - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBookPTHandler::SetData( - _In_ CONST BindingData* pBindData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pBindData, E_POINTER))) - { - if (pBindData->bindFeature < EBindingMin || - pBindData->bindFeature >= EBindingMax || - pBindData->bindOption < EBindingOptionMin || - pBindData->bindOption >= EBindingOptionMax) - { - hr = E_INVALIDARG; - } - } - - // - // Delete any exsting NUp settings as JobNUpAllDocumentsContiguously and DocumentNUp are mutually exclusive - // - if (SUCCEEDED(hr) && - pBindData->bindOption != XDPrintSchema::Binding::None) - { - // - // Create the following elements - // Feature and Option - // Parameter Ref and Parameter Init - // ScoredProperty - // - // Then append the scored property to the option node and the feature - // and parameter init nodes to the root PrintTicket node. Note: the - // scored poperty is created passing the parameter ref so it is already - // appended - // - CComPtr pFeature(NULL); - CComPtr pOption(NULL); - CComPtr pParamRef(NULL); - CComPtr pParamInit(NULL); - CComPtr pScoredProp(NULL); - - CComBSTR bstrFeature(BIND_FEATURES[pBindData->bindFeature]); - - if (SUCCEEDED(DeleteFeature(bstrFeature))) - { - CComBSTR bstrPropName(BIND_PROP_REF_SUFFIX); - CComBSTR bstrParamRefName(bstrFeature); - bstrParamRefName += bstrPropName; - - if (SUCCEEDED(hr = CreateFeatureOptionPair(bstrFeature, - CComBSTR(BIND_OPTIONS[pBindData->bindOption]), - &pFeature, - &pOption)) && - SUCCEEDED(hr = CreateParamRefInitPair(bstrParamRefName, pBindData->bindGutter, &pParamRef, &pParamInit)) && - SUCCEEDED(hr = CreateScoredProperty(CComBSTR(BIND_PROP), pParamRef, &pScoredProp)) && - SUCCEEDED(hr = pOption->appendChild(pScoredProp, NULL)) && - SUCCEEDED(hr = AppendToElement(CComBSTR(PRINTTICKET_NAME), pFeature))) - { - hr = AppendToElement(CComBSTR(PRINTTICKET_NAME), pParamInit); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBookPTHandler::Delete - -Routine Description: - - This routine deletes the binding feature from the PrintTicket passed to the - class constructor - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBookPTHandler::Delete( - VOID - ) -{ - HRESULT hr = S_OK; - - for (EBinding bindFeature = EBindingMin; - bindFeature < EBindingMax && SUCCEEDED(hr); - bindFeature = static_cast(bindFeature + 1)) - { - hr = DeleteFeature(CComBSTR(BIND_FEATURES[bindFeature])); - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/bkpthndlr.h b/print/XPSDrvSmpl/src/common/bkpthndlr.h deleted file mode 100644 index abd5ef9d..00000000 --- a/print/XPSDrvSmpl/src/common/bkpthndlr.h +++ /dev/null @@ -1,55 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bkpthndlr.h - -Abstract: - - Booklet PrintTicket handling definition. The booklet PT handler - is used to extract booklet settings from a PrintTicket and populate - the booklet data structure with the retrieved settings. The class also - defines a method for setting the feature in the PrintTicket given the - data structure. - ---*/ - -#pragma once - -#include "pthndlr.h" -#include "bkdata.h" - -class CBookPTHandler : public CPTHandler -{ -public: - CBookPTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ); - - virtual ~CBookPTHandler(); - - HRESULT - GetData( - _Out_ XDPrintSchema::Binding::BindingData* pBindData - ); - - HRESULT - SetData( - _In_ CONST XDPrintSchema::Binding::BindingData* pBindData - ); - - HRESULT - Delete( - VOID - ); -}; - diff --git a/print/XPSDrvSmpl/src/common/bkschema.cpp b/print/XPSDrvSmpl/src/common/bkschema.cpp deleted file mode 100644 index daa26254..00000000 --- a/print/XPSDrvSmpl/src/common/bkschema.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bkschema.cpp - -Abstract: - - Binding (booklet) PrintSchema implementation. This implements the features, - options and enumerations that describe the PrintSchema JobBindAllDocuments and - DocumentBinding features. - ---*/ - -#include "precomp.h" -#include "bkschema.h" - -LPCWSTR XDPrintSchema::Binding::BIND_FEATURES[] = { - L"JobBindAllDocuments", - L"DocumentBinding" -}; - -LPCWSTR XDPrintSchema::Binding::BIND_OPTIONS[] = { - L"Bale", - L"BindBottom", - L"BindLeft", - L"BindRight", - L"BindTop", - L"Booklet", - L"EdgeStitchBottom", - L"EdgeStitchLeft", - L"EdgeStitchRight", - L"EdgeStitchTop", - L"Fold", - L"JogOffset", - L"Trim", - L"None" -}; - -LPCWSTR XDPrintSchema::Binding::BIND_PROP = L"BindingGutter"; -LPCWSTR XDPrintSchema::Binding::BIND_PROP_REF_SUFFIX = L"Gutter"; - diff --git a/print/XPSDrvSmpl/src/common/bkschema.h b/print/XPSDrvSmpl/src/common/bkschema.h deleted file mode 100644 index bcf68df2..00000000 --- a/print/XPSDrvSmpl/src/common/bkschema.h +++ /dev/null @@ -1,77 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bkschema.h - -Abstract: - - Binding (booklet) PrintSchema definition. This defines the features, - options and enumerations that describe the PrintSchema JobBindAllDocuments and - DocumentBinding features within a XDPrintSchema::Binding namespace. - ---*/ - -#pragma once - -#include "schema.h" - -namespace XDPrintSchema -{ - // - // Binding elements described as Printschema keywords - // - namespace Binding - { - // - // Job and Document share identical options so we define two - // features within the Binding namespace. - // - enum EBinding - { - JobBindAllDocuments = 0, EBindingMin = 0, - DocumentBinding, - EBindingMax - }; - - extern LPCWSTR BIND_FEATURES[EBindingMax]; - - // - // Option names - // - enum EBindingOption - { - Bale = 0, EBindingOptionMin = 0, - BindBottom, - BindLeft, - BindRight, - BindTop, - Booklet, - EdgeStitchBottom, - EdgeStitchLeft, - EdgeStitchRight, - EdgeStitchTop, - Fold, - JogOffset, - Trim, - None, - EBindingOptionMax - }; - - extern LPCWSTR BIND_OPTIONS[EBindingOptionMax]; - - extern LPCWSTR BIND_PROP; - - extern LPCWSTR BIND_PROP_REF_SUFFIX; - } -} - diff --git a/print/XPSDrvSmpl/src/common/cmdata.h b/print/XPSDrvSmpl/src/common/cmdata.h deleted file mode 100644 index 7b2dcb7f..00000000 --- a/print/XPSDrvSmpl/src/common/cmdata.h +++ /dev/null @@ -1,42 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmdata.h - -Abstract: - - PageColorManagement data structure definition. This provides a convenient - description of the PrintSchema PageColorManagement feature. - ---*/ - -#pragma once - -#include "cmschema.h" - -namespace XDPrintSchema -{ - namespace PageColorManagement - { - struct ColorManagementData - { - ColorManagementData() : - cmOption(None) - { - } - - EPCMOption cmOption; - }; - } -} - diff --git a/print/XPSDrvSmpl/src/common/cmintentsdata.h b/print/XPSDrvSmpl/src/common/cmintentsdata.h deleted file mode 100644 index f9fa2c20..00000000 --- a/print/XPSDrvSmpl/src/common/cmintentsdata.h +++ /dev/null @@ -1,42 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmintentsdata.h - -Abstract: - - PageICMRenderingIntent data structure definition. This provides a more - convenient description of the PrintSchema PageICMRenderingIntent feature. - ---*/ - -#pragma once - -#include "cmintentsschema.h" - -namespace XDPrintSchema -{ - namespace PageICMRenderingIntent - { - struct PageICMRenderingIntentData - { - PageICMRenderingIntentData() : - cmOption(AbsoluteColorimetric) - { - } - - EICMIntentOption cmOption; - }; - } -} - diff --git a/print/XPSDrvSmpl/src/common/cmintentsschema.cpp b/print/XPSDrvSmpl/src/common/cmintentsschema.cpp deleted file mode 100644 index 1b68de7b..00000000 --- a/print/XPSDrvSmpl/src/common/cmintentsschema.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmintentsschema.cpp - -Abstract: - - PageICMRenderingIntent PrintSchema implementation. This implements the features, - options and enumerations that describe the PrintSchema PageICMRenderingIntent feature. - ---*/ - -#include "precomp.h" -#include "cmintentsschema.h" - -LPCWSTR XDPrintSchema::PageICMRenderingIntent::ICMINTENT_FEATURE = L"PageICMRenderingIntent"; - -LPCWSTR XDPrintSchema::PageICMRenderingIntent::ICMINTENT_OPTIONS[] = { - L"AbsoluteColorimetric", - L"RelativeColorimetric", - L"Photographs", - L"BusinessGraphics" -}; - diff --git a/print/XPSDrvSmpl/src/common/cmintentsschema.h b/print/XPSDrvSmpl/src/common/cmintentsschema.h deleted file mode 100644 index 73203876..00000000 --- a/print/XPSDrvSmpl/src/common/cmintentsschema.h +++ /dev/null @@ -1,55 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmintentsschema.h - -Abstract: - - PageICMRenderingIntent PrintSchema definition. This defines the features, - options and enumerations that describe the PrintSchema PageICMRenderingIntent feature - within a XDPrintSchema::PageICMRenderingIntent namespace. - ---*/ - -#pragma once - -#include "schema.h" - -namespace XDPrintSchema -{ - // - // PageColorManagementIntents elements described as Printschema keywords - // - namespace PageICMRenderingIntent - { - // - // Feature name - // - extern LPCWSTR ICMINTENT_FEATURE; - - // - // Who specified the profile to use - // - enum EICMIntentOption - { - AbsoluteColorimetric = 0, EICMIntentOptionMin = 0, - RelativeColorimetric, - Photographs, - BusinessGraphics, - EICMIntentOptionMax - }; - - extern LPCWSTR ICMINTENT_OPTIONS[EICMIntentOptionMax]; - } -} - diff --git a/print/XPSDrvSmpl/src/common/cmintpthndlr.cpp b/print/XPSDrvSmpl/src/common/cmintpthndlr.cpp deleted file mode 100644 index d23fffb6..00000000 --- a/print/XPSDrvSmpl/src/common/cmintpthndlr.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmintpthndlr.cpp - -Abstract: - - PageICMRenderingIntent PrintTicket handler implementation. Derived from - CPTHandler, this provides PageICMRenderingIntent specific Get and Set methods - acting on the PrintTicket (as a DOM document) passed. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "cmintpthndlr.h" - -using XDPrintSchema::PageICMRenderingIntent::PageICMRenderingIntentData; -using XDPrintSchema::PageICMRenderingIntent::EICMIntentOption; -using XDPrintSchema::PageICMRenderingIntent::EICMIntentOptionMin; -using XDPrintSchema::PageICMRenderingIntent::BusinessGraphics; -using XDPrintSchema::PageICMRenderingIntent::EICMIntentOptionMax; -using XDPrintSchema::PageICMRenderingIntent::ICMINTENT_FEATURE; -using XDPrintSchema::PageICMRenderingIntent::ICMINTENT_OPTIONS; - -/*++ - -Routine Name: - - CColorManageIntentsPTHandler::CColorManageIntentsPTHandler - -Routine Description: - - CColorManageIntentsPTHandler class constructor - -Arguments: - - pPrintTicket - Pointer to the DOM document representation of the PrintTicket - -Return Value: - - None - ---*/ -CColorManageIntentsPTHandler::CColorManageIntentsPTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ) : - CPTHandler(pPrintTicket) -{ -} - -/*++ - -Routine Name: - - CColorManageIntentsPTHandler::~CColorManageIntentsPTHandler - -Routine Description: - - CColorManageIntentsPTHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CColorManageIntentsPTHandler::~CColorManageIntentsPTHandler() -{ -} - -/*++ - -Routine Name: - - CColorManageIntentsPTHandler::GetData - -Routine Description: - - The routine fills the data structure passed in with color intent data retrieved - from the PrintTicket passed to the class constructor. - -Arguments: - - pCmData - Pointer to the color intent data structure to be filled in - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - Feature not present in PrintTicket - E_* - On error - ---*/ -HRESULT -CColorManageIntentsPTHandler::GetData( - _Inout_ PageICMRenderingIntentData* pCmData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pCmData, E_POINTER))) - { - CComBSTR bstrCMOption; - - if (SUCCEEDED(hr = GetFeatureOption(CComBSTR(ICMINTENT_FEATURE), &bstrCMOption))) - { - // - // Get the profile type - // - for (EICMIntentOption cmOption = EICMIntentOptionMin; - cmOption < EICMIntentOptionMax; - cmOption = static_cast(cmOption + 1)) - { - if (bstrCMOption == ICMINTENT_OPTIONS[cmOption]) - { - pCmData->cmOption = cmOption; - break; - } - } - - if (SUCCEEDED(hr)) - { - if (pCmData->cmOption < EICMIntentOptionMin || - pCmData->cmOption >= EICMIntentOptionMax) - { - hr = E_FAIL; - } - } - } - else - { - pCmData->cmOption = BusinessGraphics; - hr = S_OK; - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/cmintpthndlr.h b/print/XPSDrvSmpl/src/common/cmintpthndlr.h deleted file mode 100644 index 19e5b4bc..00000000 --- a/print/XPSDrvSmpl/src/common/cmintpthndlr.h +++ /dev/null @@ -1,43 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmintpthndlr.h - -Abstract: - - PageICMRenderingIntent PrintTicket handler definition. Derived from - CPTHandler, this provides PageICMRenderingIntent specific Get and Set methods - acting on the PrintTicket (as a DOM document) passed. - ---*/ - -#pragma once - -#include "pthndlr.h" -#include "cmintentsdata.h" - -class CColorManageIntentsPTHandler : public CPTHandler -{ -public: - CColorManageIntentsPTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ); - - virtual ~CColorManageIntentsPTHandler(); - - HRESULT - GetData( - _Inout_ XDPrintSchema::PageICMRenderingIntent::PageICMRenderingIntentData* pCmData - ); -}; - diff --git a/print/XPSDrvSmpl/src/common/cmprofiledata.h b/print/XPSDrvSmpl/src/common/cmprofiledata.h deleted file mode 100644 index 29048ea3..00000000 --- a/print/XPSDrvSmpl/src/common/cmprofiledata.h +++ /dev/null @@ -1,44 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmprofiledata.h - -Abstract: - - PageSourceColorProfileData data structure definition. This provides - a convenient description of the PrintSchema PageSourceColorProfileData - feature. - ---*/ - -#pragma once - -#include "cmprofileschema.h" - -namespace XDPrintSchema -{ - namespace PageSourceColorProfile - { - struct PageSourceColorProfileData - { - PageSourceColorProfileData() : - cmProfile(RGB) - { - } - - EProfileOption cmProfile; - CComBSTR cmProfileName; - }; - } -} - diff --git a/print/XPSDrvSmpl/src/common/cmprofileschema.cpp b/print/XPSDrvSmpl/src/common/cmprofileschema.cpp deleted file mode 100644 index 5f74fa51..00000000 --- a/print/XPSDrvSmpl/src/common/cmprofileschema.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmprofileschema.cpp - -Abstract: - - PageSourceColorProfile PrintSchema implementation. This implements the - features, options and enumerations that describe the PrintSchema - PageSourceColorProfile feature. - ---*/ - -#include "precomp.h" -#include "globals.h" -#include "privatedefs.h" -#include "cmprofileschema.h" - -LPCWSTR XDPrintSchema::PageSourceColorProfile::PROFILE_FEATURE = L"PageSourceColorProfile"; - -LPCWSTR XDPrintSchema::PageSourceColorProfile::PROFILE_OPTIONS[] = { - L"RGB", - L"CMYK" -}; - -LPCWSTR XDPrintSchema::PageSourceColorProfile::PROFILE_URI_PROP = L"SourceColorProfileURI"; -LPCWSTR XDPrintSchema::PageSourceColorProfile::PROFILE_URI_REF = L"PageSourceColorProfileURI"; - -PRIVATE_DEF_STRINGS XDPrintSchema::PageSourceColorProfile::PROFILE_PARAM_DEF = { - "PageSourceColorProfileURI", - NULL, - "xdCMYKPrinter.icc", - 0, - 65536, - "characters" -}; - - - diff --git a/print/XPSDrvSmpl/src/common/cmprofileschema.h b/print/XPSDrvSmpl/src/common/cmprofileschema.h deleted file mode 100644 index 659d42c5..00000000 --- a/print/XPSDrvSmpl/src/common/cmprofileschema.h +++ /dev/null @@ -1,60 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmintentsschema.h - -Abstract: - - PageSourceColorProfile PrintSchema definition. This defines the features, - options and enumerations that describe the PrintSchema PageSourceColorProfile - feature within a XDPrintSchema::PageSourceColorProfile namespace. - - ---*/ - -#pragma once - -#include "schema.h" -#include "globals.h" -#include "privatedefs.h" - -namespace XDPrintSchema -{ - // - // PageColorManagement elements described as Printschema keywords - // - namespace PageSourceColorProfile - { - // - // Feature name - // - extern LPCWSTR PROFILE_FEATURE; - - // - // Who specified the profile to use - // - enum EProfileOption - { - RGB = 0, EProfileOptionMin = 0, - CMYK, - EProfileOptionMax - }; - - extern LPCWSTR PROFILE_OPTIONS[EProfileOptionMax]; - - extern LPCWSTR PROFILE_URI_PROP; - extern LPCWSTR PROFILE_URI_REF; - extern PRIVATE_DEF_STRINGS PROFILE_PARAM_DEF; - } -} - diff --git a/print/XPSDrvSmpl/src/common/cmprofpchndlr.cpp b/print/XPSDrvSmpl/src/common/cmprofpchndlr.cpp deleted file mode 100644 index a8f5bb9c..00000000 --- a/print/XPSDrvSmpl/src/common/cmprofpchndlr.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/*++ - -Copyright (c) 2008 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmprofpchndlr.cpp - -Abstract: - - PageSourceColorProfile PrintCapabilities handling implementation. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "ptquerybld.h" -#include "cmprofpchndlr.h" - -using XDPrintSchema::PRINTCAPABILITIES_NAME; - -using XDPrintSchema::PageSourceColorProfile::PROFILE_FEATURE; -using XDPrintSchema::PageSourceColorProfile::PROFILE_OPTIONS; -using XDPrintSchema::PageSourceColorProfile::PROFILE_URI_PROP; -using XDPrintSchema::PageSourceColorProfile::PROFILE_URI_REF; -using XDPrintSchema::PageSourceColorProfile::PROFILE_PARAM_DEF; -using XDPrintSchema::PageSourceColorProfile::EProfileOption; -using XDPrintSchema::PageSourceColorProfile::EProfileOptionMax; -using XDPrintSchema::PageSourceColorProfile::EProfileOptionMin; -using XDPrintSchema::PageSourceColorProfile::RGB; -using XDPrintSchema::PageSourceColorProfile::CMYK; - -/*++ - -Routine Name: - - CColorManageProfilePCHandler::CColorManageProfilePCHandler - -Routine Description: - - CColorManageProfilePCHandler class constructor - -Arguments: - - pPrintCapabilities - Pointer to the DOM document representation of the PrintCapabilities - -Return Value: - - None - ---*/ -CColorManageProfilePCHandler::CColorManageProfilePCHandler( - _In_ IXMLDOMDocument2* pPrintCapabilities - ) : - CPCHandler(pPrintCapabilities) -{ -} - -/*++ - -Routine Name: - - CColorManageProfilePCHandler::~CColorManageProfilePCHandler - -Routine Description: - - CColorManageProfilePCHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CColorManageProfilePCHandler::~CColorManageProfilePCHandler() -{ -} - -/*++ - -Routine Name: - - CColorManageProfilePCHandler::SetCapabilities - -Routine Description: - - This routine sets color profile capabilities in the PrintCapabilities passed to the - class constructor. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorManageProfilePCHandler::SetCapabilities( - VOID - ) -{ - HRESULT hr = S_OK; - - try - { - // - // Retrieve the PrintTicket root - // - CComPtr pPCRoot(NULL); - CComPtr pFeatureElement(NULL); - - CComBSTR bstrPTQuery(m_bstrFrameworkPrefix); - bstrPTQuery += PRINTCAPABILITIES_NAME; - - if (SUCCEEDED(hr = GetNode(bstrPTQuery, &pPCRoot)) && - SUCCEEDED(hr = CreateFeatureSelection(CComBSTR(PROFILE_FEATURE), NULL, &pFeatureElement))) - { - for ( EProfileOption option = EProfileOptionMin; - option < EProfileOptionMax && SUCCEEDED(hr); - option = static_cast(option + 1)) - { - CComPtr pOptionElement(NULL); - CComPtr pScoredPropElement(NULL); - CComPtr pPropRefElement(NULL); - - if (SUCCEEDED(hr = CreateOption(CComBSTR(PROFILE_OPTIONS[option]), NULL, &pOptionElement)) && - SUCCEEDED(hr = CreateScoredProperty(CComBSTR(PROFILE_URI_PROP), &pScoredPropElement)) && - SUCCEEDED(hr = CreateParameterRef(CComBSTR(PROFILE_URI_REF), &pPropRefElement)) && - SUCCEEDED(hr = pScoredPropElement->appendChild(pPropRefElement, NULL)) && - SUCCEEDED(hr = pOptionElement->appendChild(pScoredPropElement, NULL))) - { - hr = pFeatureElement->appendChild(pOptionElement, NULL); - } - } - - CComPtr pParameterDef(NULL); - - if (SUCCEEDED(hr = pPCRoot->appendChild(pFeatureElement, NULL)) && - SUCCEEDED(hr = CreateStringParameterDef( CComBSTR(PROFILE_PARAM_DEF.property_name), // Paramater Name - TRUE, // Is Print Schema Keyword? - CComBSTR(PROFILE_PARAM_DEF.display_name), // Display Text - CComBSTR(PROFILE_PARAM_DEF.default_value), // Default - PROFILE_PARAM_DEF.min_length, // Min Length - PROFILE_PARAM_DEF.max_length, // Max Length - CComBSTR(PROFILE_PARAM_DEF.unit_type), // Unit Type - &pParameterDef))) // Parameter Def - { - hr = pPCRoot->appendChild(pParameterDef, NULL); - } - } - - - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - ERR_ON_HR(hr); - - return S_OK; -} diff --git a/print/XPSDrvSmpl/src/common/cmprofpchndlr.h b/print/XPSDrvSmpl/src/common/cmprofpchndlr.h deleted file mode 100644 index 059ca831..00000000 --- a/print/XPSDrvSmpl/src/common/cmprofpchndlr.h +++ /dev/null @@ -1,42 +0,0 @@ -/*++ - -Copyright (c) 2008 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmprofpthndlr.h - -Abstract: - - PageSourceColorProfile PrintCapabilities handling definition. - ---*/ - -#pragma once - -#include "pchndlr.h" -#include "cmprofiledata.h" - -class CColorManageProfilePCHandler : public CPCHandler -{ -public: - - CColorManageProfilePCHandler( - _In_ IXMLDOMDocument2* pPrintCapabilities - ); - - virtual ~CColorManageProfilePCHandler(); - - HRESULT - SetCapabilities( - VOID - ); -}; - diff --git a/print/XPSDrvSmpl/src/common/cmprofpthndlr.cpp b/print/XPSDrvSmpl/src/common/cmprofpthndlr.cpp deleted file mode 100644 index ee074fdb..00000000 --- a/print/XPSDrvSmpl/src/common/cmprofpthndlr.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmprofpthndlr.cpp - -Abstract: - - PageSourceColorProfile PrintTicket handling implementation. - The PageSourceColorProfile PT handler is used to extract - PageSourceColorProfile settings from a PrintTicket and populate - the PageSourceColorProfile data structure with the retrieved - settings. The class also defines a method for setting the feature in - the PrintTicket given the data structure. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "ptquerybld.h" -#include "cmprofpthndlr.h" - -using XDPrintSchema::SCHEMA_STRING; -using XDPrintSchema::PRINTTICKET_NAME; - -using XDPrintSchema::PageSourceColorProfile::PageSourceColorProfileData; -using XDPrintSchema::PageSourceColorProfile::EProfileOption; -using XDPrintSchema::PageSourceColorProfile::EProfileOptionMin; -using XDPrintSchema::PageSourceColorProfile::EProfileOptionMax; -using XDPrintSchema::PageSourceColorProfile::PROFILE_FEATURE; -using XDPrintSchema::PageSourceColorProfile::PROFILE_OPTIONS; -using XDPrintSchema::PageSourceColorProfile::PROFILE_URI_PROP; -using XDPrintSchema::PageSourceColorProfile::PROFILE_URI_REF; -using XDPrintSchema::PageSourceColorProfile::RGB; -using XDPrintSchema::PageSourceColorProfile::CMYK; - -/*++ - -Routine Name: - - CColorManageProfilePTHandler::CColorManageProfilePTHandler - -Routine Description: - - CColorManageProfilePTHandler class constructor - -Arguments: - - pPrintTicket - Pointer to the DOM document representation of the PrintTicket - -Return Value: - - None - ---*/ -CColorManageProfilePTHandler::CColorManageProfilePTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ) : - CPTHandler(pPrintTicket) -{ -} - -/*++ - -Routine Name: - - CColorManageProfilePTHandler::~CColorManageProfilePTHandler - -Routine Description: - - CColorManageProfilePTHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CColorManageProfilePTHandler::~CColorManageProfilePTHandler() -{ -} - -/*++ - -Routine Name: - - CColorManageProfilePTHandler::GetData - -Routine Description: - - The routine fills the data structure passed in with color profile data - retrieved from the PrintTicket passed to the class constructor. - -Arguments: - - pCmData - Pointer to the color profile data structure to be filled in - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - Feature not present in PrintTicket - E_* - On error - ---*/ -HRESULT -CColorManageProfilePTHandler::GetData( - _Inout_ PageSourceColorProfileData* pCmData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pCmData, E_POINTER))) - { - CComBSTR option; - if (SUCCEEDED(hr = GetFeatureOption(CComBSTR(PROFILE_FEATURE), &option)) && - SUCCEEDED(GetScoredPropertyValue(CComBSTR(PROFILE_FEATURE), CComBSTR(PROFILE_URI_PROP), &pCmData->cmProfileName)) - ) - { - pCmData->cmProfile = CMYK; // default to CMYK - - for (EProfileOption cmOption = EProfileOptionMin; - cmOption < EProfileOptionMax; - cmOption = static_cast(cmOption + 1)) - { - if (option == CComBSTR(PROFILE_OPTIONS[cmOption])) - { - pCmData->cmProfile = cmOption; - } - } - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CColorManageProfilePTHandler::SetData - -Routine Description: - - This routine sets the color profile data in the PrintTicket - passed to the class constructor. - -Arguments: - - pCmData - Pointer to the color profile data to be set in the PrintTicket - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorManageProfilePTHandler::SetData( - _In_ CONST PageSourceColorProfileData* pCmData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pCmData, E_POINTER))) - { - CComPtr pFeature(NULL); - CComPtr pOption(NULL); - CComPtr pUriProperty(NULL); - CComPtr pRef(NULL); - CComPtr pInit(NULL); - - - CComBSTR bstrFeature(PROFILE_FEATURE); - - if (SUCCEEDED(hr = DeleteFeature(bstrFeature)) && - SUCCEEDED(hr = CreateFeatureOptionPair(bstrFeature, CComBSTR(PROFILE_OPTIONS[pCmData->cmProfile]), &pFeature, &pOption)) && - SUCCEEDED(hr = CreateParamRefInitPair(CComBSTR(PROFILE_URI_REF), CComBSTR(SCHEMA_STRING), pCmData->cmProfileName, &pRef, &pInit)) && - SUCCEEDED(hr = CreateScoredProperty(CComBSTR(PROFILE_URI_PROP), pRef, &pUriProperty)) && - SUCCEEDED(hr = pOption->appendChild(pUriProperty, NULL)) && - SUCCEEDED(hr = AppendToElement(CComBSTR(PRINTTICKET_NAME), pInit))) - { - SUCCEEDED(hr = AppendToElement(CComBSTR(PRINTTICKET_NAME), pFeature)); - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/cmprofpthndlr.h b/print/XPSDrvSmpl/src/common/cmprofpthndlr.h deleted file mode 100644 index fb002a45..00000000 --- a/print/XPSDrvSmpl/src/common/cmprofpthndlr.h +++ /dev/null @@ -1,51 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmprofpthndlr.h - -Abstract: - - PageSourceColorProfile PrintTicket handling definition. - The PageSourceColorProfile PT handler is used to extract - PageSourceColorProfile settings from a PrintTicket and populate - the PageSourceColorProfile data structure with the retrieved - settings. The class also defines a method for setting the feature in - the PrintTicket given the data structure. - ---*/ - -#pragma once - -#include "pthndlr.h" -#include "cmprofiledata.h" - -class CColorManageProfilePTHandler : public CPTHandler -{ -public: - CColorManageProfilePTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ); - - virtual ~CColorManageProfilePTHandler(); - - HRESULT - GetData( - _Inout_ XDPrintSchema::PageSourceColorProfile::PageSourceColorProfileData* pCmData - ); - - HRESULT - SetData( - _In_ CONST XDPrintSchema::PageSourceColorProfile::PageSourceColorProfileData* pCmData - ); -}; - diff --git a/print/XPSDrvSmpl/src/common/cmpthndlr.cpp b/print/XPSDrvSmpl/src/common/cmpthndlr.cpp deleted file mode 100644 index cdd20311..00000000 --- a/print/XPSDrvSmpl/src/common/cmpthndlr.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmpthndlr.cpp - -Abstract: - - PageColorManagement PrintTicket handling implementation. The - PageColorManagement PT handler is used to extract booklet settings - from a PrintTicket and populate the PageColorManagement data - structure with the retrieved settings. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "cmpthndlr.h" - -using XDPrintSchema::PageColorManagement::ColorManagementData; -using XDPrintSchema::PageColorManagement::EPCMOption; -using XDPrintSchema::PageColorManagement::EPCMOptionMin; -using XDPrintSchema::PageColorManagement::EPCMOptionMax; -using XDPrintSchema::PageColorManagement::PCM_FEATURE; -using XDPrintSchema::PageColorManagement::PCM_OPTIONS; - -/*++ - -Routine Name: - - CColorManagePTHandler::CColorManagePTHandler - -Routine Description: - - CColorManagePTHandler class constructor - -Arguments: - - pPrintTicket - Pointer to the DOM document representation of the PrintTicket - -Return Value: - - None - ---*/ -CColorManagePTHandler::CColorManagePTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ) : - CPTHandler(pPrintTicket) -{ -} - -/*++ - -Routine Name: - - CColorManagePTHandler::~CColorManagePTHandler - -Routine Description: - - CColorManagePTHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CColorManagePTHandler::~CColorManagePTHandler() -{ -} - -/*++ - -Routine Name: - - CColorManagePTHandler::GetData - -Routine Description: - - The routine fills the data structure passed in with color management data - retrieved from the PrintTicket passed to the class constructor. - -Arguments: - - pCmData - Pointer to the color management data structure to be filled in - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - Feature not present in PrintTicket - E_* - On error - ---*/ -HRESULT -CColorManagePTHandler::GetData( - _Inout_ ColorManagementData* pCmData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pCmData, E_POINTER))) - { - CComBSTR bstrCMOption; - - // - // Check whether to use driver or device color matching - // - if (SUCCEEDED(hr = GetFeatureOption(CComBSTR(PCM_FEATURE), &bstrCMOption))) - { - for (EPCMOption cmOpt = EPCMOptionMin; - cmOpt < EPCMOptionMax; - cmOpt = static_cast(cmOpt + 1)) - { - if (bstrCMOption == PCM_OPTIONS[cmOpt]) - { - pCmData->cmOption = cmOpt; - break; - } - } - } - - // - // Validate the data - // - if (SUCCEEDED(hr)) - { - if (pCmData->cmOption < EPCMOptionMin || - pCmData->cmOption >= EPCMOptionMax) - { - hr = E_FAIL; - } - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/cmpthndlr.h b/print/XPSDrvSmpl/src/common/cmpthndlr.h deleted file mode 100644 index 17faf30e..00000000 --- a/print/XPSDrvSmpl/src/common/cmpthndlr.h +++ /dev/null @@ -1,46 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmpthndlr.h - -Abstract: - - PageColorManagement PrintTicket handling definition. The - PageColorManagement PT handler is used to extract booklet settings - from a PrintTicket and populate the PageColorManagement data - structure with the retrieved settings. The class also - defines a method for setting the feature in the PrintTicket given the - data structure. - ---*/ - -#pragma once - -#include "pthndlr.h" -#include "cmdata.h" - -class CColorManagePTHandler : public CPTHandler -{ -public: - CColorManagePTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ); - - virtual ~CColorManagePTHandler(); - - HRESULT - GetData( - _Inout_ XDPrintSchema::PageColorManagement::ColorManagementData* pCmData - ); -}; - diff --git a/print/XPSDrvSmpl/src/common/cmschema.cpp b/print/XPSDrvSmpl/src/common/cmschema.cpp deleted file mode 100644 index f047f8fa..00000000 --- a/print/XPSDrvSmpl/src/common/cmschema.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmschema.cpp - -Abstract: - - PageColorManagement PrintSchema implementation. This implements the features, - options and enumerations that describe the PrintSchema PageColorManagement feature. - ---*/ - -#include "precomp.h" -#include "cmschema.h" - -LPCWSTR XDPrintSchema::PageColorManagement::PCM_FEATURE = L"PageColorManagement"; - -LPCWSTR XDPrintSchema::PageColorManagement::PCM_OPTIONS[] = { - L"None", - L"Device", - L"Driver", - L"System" -}; - diff --git a/print/XPSDrvSmpl/src/common/cmschema.h b/print/XPSDrvSmpl/src/common/cmschema.h deleted file mode 100644 index 6f4a30a6..00000000 --- a/print/XPSDrvSmpl/src/common/cmschema.h +++ /dev/null @@ -1,55 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmschema.h - -Abstract: - - PageColorManagement PrintSchema definition. This defines the features, options - and enumerations that describe the PrintSchema PageColorManagement feature - within a XDPrintSchema::PageColorManagement namespace. - ---*/ - -#pragma once - -#include "schema.h" - -namespace XDPrintSchema -{ - // - // PageColorManagement elements described as Printschema keywords - // - namespace PageColorManagement - { - // - // Feature name - // - extern LPCWSTR PCM_FEATURE; - - // - // Option names - // - enum EPCMOption - { - None = 0, EPCMOptionMin = 0, - Device, - Driver, - System, - EPCMOptionMax - }; - - extern LPCWSTR PCM_OPTIONS[EPCMOptionMax]; - } -} - diff --git a/print/XPSDrvSmpl/src/common/globals.cpp b/print/XPSDrvSmpl/src/common/globals.cpp deleted file mode 100644 index 28cf17a5..00000000 --- a/print/XPSDrvSmpl/src/common/globals.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - globals.cpp - -Abstract: - - Stores function implementations and variable instances global to the filter - module. This is shared between all filters. - ---*/ - -#include "precomp.h" -#include - -// -// Module's Instance handle from DLLEntry of process. -// -HINSTANCE g_hInstance = NULL; - -// -// Server lock count -// -LONG g_cServerLocks = 0; - -/*++ - -Routine Name: - - GetLastErrorAsHResult - -Routine Description: - - Converts the Win32 last error to an HRESULT - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -GetLastErrorAsHResult( - void - ) -{ - DWORD error = GetLastError(); - - return HRESULT_FROM_WIN32(error); -} - -/*++ - -Routine Name: - - GetLastErrorAsHResult - -Routine Description: - - Converts a GDI status error to an HRESULT - -Arguments: - - gdiPStatus - The GDI plus status value to be converted to an HRESULT - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -GetGDIStatusErrorAsHResult( - _In_ Status gdiPStatus - ) -{ - HRESULT hr = E_FAIL; - - switch (gdiPStatus) - { - case Ok: - { - hr = S_OK; - } - break; - - case GenericError: - { - hr = E_FAIL; - } - break; - - case InvalidParameter: - { - hr = E_INVALIDARG; - } - break; - - case OutOfMemory: - { - hr = E_OUTOFMEMORY; - } - break; - - case ObjectBusy: - { - hr = E_PENDING; - } - break; - - case InsufficientBuffer: - { - hr = E_OUTOFMEMORY; - } - break; - - case NotImplemented: - { - hr = E_NOTIMPL; - } - break; - - case Win32Error: - { - hr = GetLastErrorAsHResult(); - } - break; - - case FileNotFound: - { - hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - } - break; - - case AccessDenied: - { - hr = HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED); - } - break; - - // - // Default to E_FAIL - // - case UnknownImageFormat: - case FontFamilyNotFound: - case FontStyleNotFound: - case NotTrueTypeFont: - case UnsupportedGdiplusVersion: - case GdiplusNotInitialized: - case PropertyNotFound: - case PropertyNotSupported: - case ValueOverflow: - case Aborted: - case WrongState: - default: - break; - }; - - return hr; -} - -/*++ - -Routine Name: - - IsVista - -Routine Description: - - Checks if we are running under Vista - -Arguments: - - None - -Return Value: - - TRUE if we are under Vista - FALSE otherwise - ---*/ - -BOOL -IsVista( - VOID - ) -{ - BOOL bIsVista = FALSE; - bIsVista = IsWindowsVistaOrGreater(); - return bIsVista; -} - -/*++ - -Routine Name: - - GetUniqueNumber - -Routine Description: - - Returns a unique number. - -Arguments: - - None - -Return Value: - - A unique DWORD. - ---*/ - -DWORD -GetUniqueNumber( - VOID - ) -{ - static volatile DWORD number = 0; - - return InterlockedIncrement(&number); -} diff --git a/print/XPSDrvSmpl/src/common/globals.h b/print/XPSDrvSmpl/src/common/globals.h deleted file mode 100644 index e4992c03..00000000 --- a/print/XPSDrvSmpl/src/common/globals.h +++ /dev/null @@ -1,102 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - globals.cpp - -Abstract: - - Stores function definitions, variable declerations and pre-processor macros - global to the filter module. This is shared between all filters. - ---*/ - -#pragma once - -// -// Module's Instance handle from DLLEntry of process. -// -extern HINSTANCE g_hInstance; - -// -// Server lock count -// -extern LONG g_cServerLocks; - -// -// Global defines -// -#define CB_COPY_BUFFER 0x10000 -#define MAX_UISTRING_LEN 256 -#define OEM_SIGNATURE 'XDSM' -#define OEM_VERSION 0x00000001L - -// -// Conversion functions for Microns to 1/100th of Inch (and visa versa) -// -#define HUNDREDTH_OFINCH_TO_MICRON(x) MulDiv(x, 25400, 100) -#define MICRON_TO_HUNDREDTH_OFINCH(x) MulDiv(x, 100, 25400) - -// -// Macros for checking pointers and handles. -// -#define CHECK_POINTER(p, hr) ((p) == NULL ? hr : S_OK) -#define CHECK_HANDLE(h, hr) ((h) == NULL ? hr : S_OK) - -static const FLOAT kMaxByteAsFloat = 255.0f; -static const FLOAT kMaxWordAsFloat = 65535.0f; - -static const WORD kS2Dot13Neg = 0x8000; -static const WORD kS2Dot13One = 0x2000; -static const WORD kS2Dot13Min = 0xFFFF; -static const WORD kS2Dot13Max = 0x7FFF; - -static const FLOAT k96thInchAsMicrons = 264.58f; - -// -// countof macro -// -#ifndef countof -#define countof(ary) (sizeof(ary) / sizeof((ary)[0])) -#endif - -// -// Converts the Win32 last error to an HRESULT -// -HRESULT -GetLastErrorAsHResult( - void - ); - -// -// Converts a GDI status error to an HRESULT -// -HRESULT -GetGDIStatusErrorAsHResult( - _In_ Status gdiPStatus - ); - -// -// Check if we are running under Vista -// -BOOL -IsVista( - VOID - ); - -// -// Returns a unique number -// -DWORD -GetUniqueNumber( - VOID - ); diff --git a/print/XPSDrvSmpl/src/common/nupchndlr.cpp b/print/XPSDrvSmpl/src/common/nupchndlr.cpp deleted file mode 100644 index e2374eb9..00000000 --- a/print/XPSDrvSmpl/src/common/nupchndlr.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nuppchndlr.cpp - -Abstract: - - NUp PrintCapabilities handling implementation. The NUp PC handler - is used to set NUp settings in a PrintCapabilities. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "xdexcept.h" -#include "nupchndlr.h" -#include "ptquerybld.h" - -using XDPrintSchema::NUp::NUpData; -using XDPrintSchema::NUp::ENUpFeature; -using XDPrintSchema::NUp::ENUpFeatureMin; -using XDPrintSchema::NUp::DocumentNUp; -using XDPrintSchema::NUp::JobNUpAllDocumentsContiguously; -using XDPrintSchema::NUp::ENUpFeatureMax; -using XDPrintSchema::NUp::NUP_FEATURES; -using XDPrintSchema::NUp::NUP_PROP; - -using XDPrintSchema::NUp::PresentationDirection::ENUpDirectionOption; -using XDPrintSchema::NUp::PresentationDirection::ENUpDirectionOptionMin; -using XDPrintSchema::NUp::PresentationDirection::ENUpDirectionOptionMax; -using XDPrintSchema::NUp::PresentationDirection::NUP_DIRECTION_FEATURE; -using XDPrintSchema::NUp::PresentationDirection::NUP_DIRECTION_OPTIONS; - -/*++ - -Routine Name: - - CNUpPCHandler::CNUpPCHandler - -Routine Description: - - CNUpPCHandler class constructor - -Arguments: - - pPrintCapabilities - Pointer to the DOM document representation of the PrintCapabilities - -Return Value: - - None - ---*/ -CNUpPCHandler::CNUpPCHandler( - _In_ IXMLDOMDocument2* pPrintCapabilities - ) : - CPCHandler(pPrintCapabilities) -{ -} - -/*++ - -Routine Name: - - CNUpPCHandler::~CNUpPCHandler - -Routine Description: - - CNUpPCHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CNUpPCHandler::~CNUpPCHandler() -{ -} - -/*++ - -Routine Name: - - CNUpPCHandler::SetCapabilities - -Routine Description: - - This routine sets NUp capabilities in the PrintCapabilities passed to the - class constructor. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpPCHandler::SetCapabilities( - VOID - ) -{ - HRESULT hr = S_OK; - - try - { - for (ENUpFeature nupFeatures = ENUpFeatureMin; - nupFeatures < ENUpFeatureMax && SUCCEEDED(hr); - nupFeatures = static_cast(nupFeatures + 1)) - { - // - // Find the existing NUp feature node - // - CPTQueryBuilder propertyQuery(m_bstrFrameworkPrefix); - CComPtr pFeatureNode(NULL); - CComBSTR bstrFeatureQuery; - - if (SUCCEEDED(hr = propertyQuery.AddFeature(m_bstrKeywordsPrefix, CComBSTR(NUP_FEATURES[nupFeatures]))) && - SUCCEEDED(hr = propertyQuery.GetQuery(&bstrFeatureQuery)) && - SUCCEEDED(hr = GetNode(bstrFeatureQuery, &pFeatureNode)) && - hr != S_FALSE) - { - CComPtr pPresentationFeature(NULL); - - // - // Create the presentation feature options - // - if (SUCCEEDED(hr = CreateFeature(CComBSTR(NUP_DIRECTION_FEATURE), - NULL, - &pPresentationFeature))) - { - PTDOMElementVector optionList; - - for (ENUpDirectionOption presentationOption = ENUpDirectionOptionMin; - presentationOption < ENUpDirectionOptionMax && SUCCEEDED(hr); - presentationOption = static_cast(presentationOption + 1)) - { - // - // Create the presentation options property element - // - CComPtr pOptionProperty(NULL); - - if (SUCCEEDED(hr = CreateOption(CComBSTR(NUP_DIRECTION_OPTIONS[presentationOption]), NULL, &pOptionProperty))) - { - optionList.push_back(pOptionProperty); - } - } - - // - // Add the options into the presentation feature - // - PTDOMElementVector::iterator iterOptionList = optionList.begin(); - - for (;iterOptionList != optionList.end() && SUCCEEDED(hr); iterOptionList++) - { - hr = pPresentationFeature->appendChild(*iterOptionList, NULL); - } - - // - // Add the presentation feature into the existing NUp feature - // - if (SUCCEEDED(hr)) - { - hr = pFeatureNode->appendChild(pPresentationFeature, NULL); - } - } - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/nupchndlr.h b/print/XPSDrvSmpl/src/common/nupchndlr.h deleted file mode 100644 index f829d739..00000000 --- a/print/XPSDrvSmpl/src/common/nupchndlr.h +++ /dev/null @@ -1,41 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nupchndlr.h - -Abstract: - - NUp PrintCapabilities handling definition. The NUp PC handler - is used to set NUp settings in a PrintCapabilities. - ---*/ - -#pragma once - -#include "pchndlr.h" -#include "nupdata.h" - -class CNUpPCHandler : public CPCHandler -{ -public: - CNUpPCHandler( - _In_ IXMLDOMDocument2* pPrintCapabilities - ); - - virtual ~CNUpPCHandler(); - - HRESULT - SetCapabilities( - VOID - ); -}; diff --git a/print/XPSDrvSmpl/src/common/nupdata.h b/print/XPSDrvSmpl/src/common/nupdata.h deleted file mode 100644 index bf76500a..00000000 --- a/print/XPSDrvSmpl/src/common/nupdata.h +++ /dev/null @@ -1,46 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nupdata.h - -Abstract: - - NUp data structure definition. This provides a convenient description - of the PrintSchema JobNUpAllDocumentsContiguously and DocumentNUp features. - ---*/ - -#pragma once - -#include "nupschema.h" - -namespace XDPrintSchema -{ - namespace NUp - { - struct NUpData - { - NUpData() : - nUpFeature(JobNUpAllDocumentsContiguously), - cNUp(1), - nUpPresentDir(PresentationDirection::RightBottom) - { - } - - ENUpFeature nUpFeature; - INT cNUp; - PresentationDirection::ENUpDirectionOption nUpPresentDir; - }; - } -} - diff --git a/print/XPSDrvSmpl/src/common/nupschema.cpp b/print/XPSDrvSmpl/src/common/nupschema.cpp deleted file mode 100644 index 7ae67391..00000000 --- a/print/XPSDrvSmpl/src/common/nupschema.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nupschema.cpp - -Abstract: - - NUp PrintSchema implementation. This implements the features, - options and enumerations that describe the PrintSchema JobNUpAllDocumentsContiguously - and DocumentNUp features. - ---*/ - -#include "precomp.h" -#include "nupschema.h" - -LPCWSTR XDPrintSchema::NUp::NUP_FEATURES[] = { - L"JobNUpAllDocumentsContiguously", - L"DocumentNUp" -}; - -LPCWSTR XDPrintSchema::NUp::NUP_PROP = L"PagesPerSheet"; - -LPCWSTR XDPrintSchema::NUp::PresentationDirection::NUP_DIRECTION_FEATURE = L"PresentationDirection"; - -LPCWSTR XDPrintSchema::NUp::PresentationDirection::NUP_DIRECTION_OPTIONS[] = { - L"RightBottom", - L"BottomRight", - L"LeftBottom", - L"BottomLeft", - L"RightTop", - L"TopRight", - L"LeftTop", - L"TopLeft" -}; - diff --git a/print/XPSDrvSmpl/src/common/nupschema.h b/print/XPSDrvSmpl/src/common/nupschema.h deleted file mode 100644 index 4c10451d..00000000 --- a/print/XPSDrvSmpl/src/common/nupschema.h +++ /dev/null @@ -1,77 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nupschema.h - -Abstract: - - NUp PrintSchema definition. This defines the features, options and - enumerations that describe the PrintSchema JobNUpAllDocumentsContiguously and DocumentNUp - features within a XDPrintSchema::NUp namespace. - ---*/ - -#pragma once - -#include "schema.h" - -namespace XDPrintSchema -{ - // - // NUp elements described as Printschema keywords - // - namespace NUp - { - // - // JobNUpAllDocumentsContiguously and DocumentNUp share identical options so we define two - // features within the NUp namespace. - // - enum ENUpFeature - { - JobNUpAllDocumentsContiguously = 0, ENUpFeatureMin = 0, - DocumentNUp, - ENUpFeatureMax - }; - - extern LPCWSTR NUP_FEATURES[ENUpFeatureMax]; - - extern LPCWSTR NUP_PROP; - - namespace PresentationDirection - { - // - // Feature name - // - extern LPCWSTR NUP_DIRECTION_FEATURE; - - // - // Option names - // - enum ENUpDirectionOption - { - RightBottom = 0, ENUpDirectionOptionMin = 0, - BottomRight, - LeftBottom, - BottomLeft, - RightTop, - TopRight, - LeftTop, - TopLeft, - ENUpDirectionOptionMax - }; - - extern LPCWSTR NUP_DIRECTION_OPTIONS[ENUpDirectionOptionMax]; - } - } -} - diff --git a/print/XPSDrvSmpl/src/common/nupthndlr.cpp b/print/XPSDrvSmpl/src/common/nupthndlr.cpp deleted file mode 100644 index be836bcc..00000000 --- a/print/XPSDrvSmpl/src/common/nupthndlr.cpp +++ /dev/null @@ -1,309 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nupthndlr.cpp - -Abstract: - - NUp PrintTicket handling implementation. The nup PT handler - is used to extract nup settings from a PrintTicket and populate - the nup properties class with the retrieved settings. The class also - defines a method for setting the feature in the PrintTicket given the - data structure. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "nupthndlr.h" - -using XDPrintSchema::NUp::NUpData; -using XDPrintSchema::NUp::ENUpFeature; -using XDPrintSchema::NUp::ENUpFeatureMin; -using XDPrintSchema::NUp::ENUpFeatureMax; -using XDPrintSchema::NUp::NUP_FEATURES; -using XDPrintSchema::NUp::NUP_PROP; - -using XDPrintSchema::NUp::PresentationDirection::ENUpDirectionOption; -using XDPrintSchema::NUp::PresentationDirection::ENUpDirectionOptionMin; -using XDPrintSchema::NUp::PresentationDirection::ENUpDirectionOptionMax; -using XDPrintSchema::NUp::PresentationDirection::NUP_DIRECTION_FEATURE; -using XDPrintSchema::NUp::PresentationDirection::NUP_DIRECTION_OPTIONS; - -/*++ - -Routine Name: - - CNUpPTHandler::CNUpPTHandler - -Routine Description: - - CNUpPTHandler class constructor - -Arguments: - - pPrintTicket - Pointer to the DOM document representation of the PrintTicket - -Return Value: - - None - ---*/ -CNUpPTHandler::CNUpPTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ) : - CPTHandler(pPrintTicket) -{ -} - -/*++ - -Routine Name: - - CNUpPTHandler::~CNUpPTHandler - -Routine Description: - - CNUpPTHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CNUpPTHandler::~CNUpPTHandler() -{ -} - -/*++ - -Routine Name: - - CNUpPTHandler::GetData - -Routine Description: - - The routine fills the data structure passed in with NUp data retrieved from - the PrintTicket passed to the class constructor. - -Arguments: - - pNUpData - Pointer to the NUp data structure to be filled in - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - Feature not present in PrintTicket - E_* - On error - ---*/ -HRESULT -CNUpPTHandler::GetData( - _Out_ NUpData* pNUpData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pNUpData, E_POINTER))) - { - for (ENUpFeature nUpFeature = ENUpFeatureMin; - nUpFeature < ENUpFeatureMax; - nUpFeature = static_cast(nUpFeature + 1)) - { - CComBSTR bstrPresentOption; - CComBSTR bstrFeature(NUP_FEATURES[nUpFeature]); - - if (SUCCEEDED(hr = FeaturePresent(bstrFeature, NULL)) && - SUCCEEDED(hr = GetSubFeatureOption(bstrFeature, - CComBSTR(NUP_DIRECTION_FEATURE), - &bstrPresentOption)) && - SUCCEEDED(hr = GetScoredPropertyValue(bstrFeature, CComBSTR(NUP_PROP), &pNUpData->cNUp))) - { - // - // We may be set to 1-up. If so treat as though the feature is not present - // - if (pNUpData->cNUp > 1) - { - pNUpData->nUpFeature = nUpFeature; - - // - // Convert the presentation direction string to our enumeration - // - for (ENUpDirectionOption presDir = ENUpDirectionOptionMin; - presDir < ENUpDirectionOptionMax; - presDir = static_cast(presDir + 1)) - { - if (bstrPresentOption == NUP_DIRECTION_OPTIONS[presDir]) - { - pNUpData->nUpPresentDir = presDir; - break; - } - } - - // - // We have found and initialised the feature - break out the feature loop - // - break; - } - else - { - hr = E_ELEMENT_NOT_FOUND; - } - } - else if (hr != E_ELEMENT_NOT_FOUND) - { - // - // We have an error other than the element is not present - // so we break and let the result return - // - break; - } - } - } - - // - // Validate the data - // - if (SUCCEEDED(hr)) - { - if (pNUpData->nUpFeature < ENUpFeatureMin || - pNUpData->nUpFeature >= ENUpFeatureMax || - pNUpData->nUpPresentDir < ENUpDirectionOptionMin || - pNUpData->nUpPresentDir >= ENUpDirectionOptionMax) - { - hr = E_FAIL; - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CNUpPTHandler::SetData - -Routine Description: - - This routine sets the NUp data in the PrintTicket passed to the - class constructor. Note: The GPD handles the NUp count option and - scored properties so we only have to add the presentation direction - sub-feature. - -Arguments: - - pNUpData - Pointer to the NUp data to be set in the PrintTicket - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpPTHandler::SetData( - _In_ CONST NUpData* pNUpData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pNUpData, E_POINTER))) - { - if (pNUpData->nUpFeature < ENUpFeatureMin || - pNUpData->nUpFeature >= ENUpFeatureMax || - pNUpData->nUpPresentDir < ENUpDirectionOptionMin || - pNUpData->nUpPresentDir >= ENUpDirectionOptionMax) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - // - // Check the appropriate NUp option is set in the PT - // - CComPtr pNUpFeature(NULL); - CComBSTR bstrFeature(NUP_FEATURES[pNUpData->nUpFeature]); - - if (SUCCEEDED(hr = FeaturePresent(bstrFeature, &pNUpFeature))) - { - // - // The NUp feature is present. Create the presentation direction sub-feature - // and ensure it is set in the PrintTicket. - // - CComPtr pPresDirFeature(NULL); - CComPtr pPresDirOption(NULL); - - if (SUCCEEDED(hr = DeleteFeature(CComBSTR(NUP_DIRECTION_FEATURE))) && - SUCCEEDED(hr = CreateFeatureOptionPair(CComBSTR(NUP_DIRECTION_FEATURE), - CComBSTR(NUP_DIRECTION_OPTIONS[pNUpData->nUpPresentDir]), - &pPresDirFeature, - &pPresDirOption))) - { - hr = pNUpFeature->appendChild(pPresDirFeature, NULL); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpPTHandler::Delete - -Routine Description: - - This routine deletes the NUp feature from the PrintTicket passed to the - class constructor - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpPTHandler::Delete() -{ - HRESULT hr = S_OK; - - for (ENUpFeature nUpFeature = ENUpFeatureMin; - nUpFeature < ENUpFeatureMax && SUCCEEDED(hr); - nUpFeature = static_cast(nUpFeature + 1)) - { - hr = DeleteFeature(CComBSTR(NUP_FEATURES[nUpFeature])); - } - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/common/nupthndlr.h b/print/XPSDrvSmpl/src/common/nupthndlr.h deleted file mode 100644 index eaeb22a6..00000000 --- a/print/XPSDrvSmpl/src/common/nupthndlr.h +++ /dev/null @@ -1,53 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nupthndlr.h - -Abstract: - - NUp properties class implementation. The NUp properties class - is responsible for holding and controling NUp properties. - ---*/ - -#pragma once - - -#include "pthndlr.h" -#include "nupdata.h" - -class CNUpPTHandler : public CPTHandler -{ -public: - CNUpPTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ); - - virtual ~CNUpPTHandler(); - - HRESULT - GetData( - _Out_ XDPrintSchema::NUp::NUpData* pNUpData - ); - - HRESULT - SetData( - _In_ CONST XDPrintSchema::NUp::NUpData* pNUpData - ); - - HRESULT - Delete( - VOID - ); -}; - diff --git a/print/XPSDrvSmpl/src/common/pchndlr.cpp b/print/XPSDrvSmpl/src/common/pchndlr.cpp deleted file mode 100644 index c480ac52..00000000 --- a/print/XPSDrvSmpl/src/common/pchndlr.cpp +++ /dev/null @@ -1,640 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -File Name: - - pchndlr.cpp - -Abstract: - - Base PrintCapabilities handler class implementation. This class provides common - PrintCapabilities handling functionality for any feature that requires - PrintCapabilities handling. A feature specific handler can derive from - this class to get feature unspecific XML handling functionality. - ---*/ - - -// -// Note on handling missing DOM nodes: -// -// Convert MSXML's S_FALSE to E_ELEMENT_NOT_FOUND. This allows clients to -// use the SUCCEEDED macro more effectively. -// -// E_ELEMENT_NOT_FOUND should not be propogated as an error to the -// filter pipeline or config module - treat as though the requested feature -// has not been enabled. -// - -#include "precomp.h" -#include "debug.h" -#include "xdstring.h" -#include "pchndlr.h" - -using XDPrintSchema::PRINTCAPABILITIES_NAME; -using XDPrintSchema::PARAM_DEF_ELEMENT_NAME; -using XDPrintSchema::NAME_ATTRIBUTE_NAME; -using XDPrintSchema::SCHEMA_CONDITIONAL; -using XDPrintSchema::SCHEMA_INTEGER; -using XDPrintSchema::DATATYPE_VALUE_NAME; -using XDPrintSchema::SCHEMA_QNAME; -using XDPrintSchema::DEFAULTVAL_VALUE_NAME; -using XDPrintSchema::SCHEMA_STRING; -using XDPrintSchema::MAX_VALUE_NAME; -using XDPrintSchema::MIN_VALUE_NAME; -using XDPrintSchema::MAX_LENGTH_NAME; -using XDPrintSchema::MIN_LENGTH_NAME; -using XDPrintSchema::MANDATORY_VALUE_NAME; -using XDPrintSchema::UNITTYPE_VALUE_NAME; -using XDPrintSchema::MULTIPLE_VALUE_NAME; -using XDPrintSchema::DISPLAYNAME_VALUE_NAME; -using XDPrintSchema::SCHEMA_DECIMAL; -using XDPrintSchema::FEATURE_ELEMENT_NAME; -using XDPrintSchema::PICKONE_VALUE_NAME; -using XDPrintSchema::SELECTIONTYPE_VALUE_NAME; -using XDPrintSchema::OPTION_ELEMENT_NAME; -using XDPrintSchema::PARAM_REF_ELEMENT_NAME; -using XDPrintSchema::FRAMEWORK_URI; -using XDPrintSchema::KEYWORDS_URI; - -/*++ - -Routine Name: - - CPCHandler::CPCHandler - -Routine Description: - - CPCHandler class constructor - -Arguments: - - pPrintCapabilities - Pointer to the DOM document representation of the PrintCapabilities - -Return Value: - - None - - Note: Base Class (CPSHandler) - Throws CXDException(HRESULT) on an error - ---*/ -CPCHandler::CPCHandler( - _In_ IXMLDOMDocument2 *pDOMDocument - ) : - CPSHandler(CComBSTR(PRINTCAPABILITIES_NAME), pDOMDocument) -{ -} - -/*++ - -Routine Name: - - CPCHandler::~CPCHandler - -Routine Description: - - CPCHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPCHandler::~CPCHandler() -{ -} - - -/*++ - -Routine Name: - - CPCHandler::CreateStringParameterDef - -Routine Description: - - Creates a String type ParameterDef Element. - -Arguments: - - bstrParamName - Keyword value name for the parameter - bstrDisplayName - Optional string containing a description of the parameter definition. - defaultValue - Default value of the parameter. - minLength - Minimium valid value. - maxLength - Maximium valid value. - multiple - value can be increased or decreased in multiples of. - bstrUnitType - String containing a description of the unit type of the parameter value. - ppParameterDef - Pointer to an IXMLDOMElement that recieves the new element. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPCHandler::CreateStringParameterDef( - _In_z_ CONST BSTR bstrParamName, - _In_ CONST BOOL bIsPublicKeyword, - _In_opt_z_ CONST BSTR bstrDisplayName, - _In_ CONST BSTR defaultValue, - _In_ CONST INT minLength, - _In_ CONST INT maxLength, - _In_z_ CONST BSTR bstrUnitType, - _Outptr_ IXMLDOMElement** ppParameterDef - ) -{ - HRESULT hr = S_OK; - - // - // Create the parameterDef - // - CComBSTR bstrParameter(m_bstrFrameworkPrefix); - bstrParameter += PARAM_DEF_ELEMENT_NAME; - - // - // PageWatermarkSizeWidth and PageWatermarkSizeHeight are non-standard - // parameter names so need to be accessed using a user defined namespace - // - CComBSTR bstrParameterAttrib; - if (bIsPublicKeyword) - { - hr = bstrParameterAttrib.Append(m_bstrKeywordsPrefix); - } - else - { - hr = bstrParameterAttrib.Append(m_bstrUserKeywordsPrefix); - } - - if (SUCCEEDED(hr)) - { - bstrParameterAttrib += bstrParamName; - } - - if(SUCCEEDED(hr)) - { - hr = CreateXMLElement(bstrParameter, FRAMEWORK_URI, ppParameterDef); - } - - if(SUCCEEDED(hr)) - { - if(SUCCEEDED(hr = CreateXMLAttribute(*ppParameterDef, NAME_ATTRIBUTE_NAME, NULL, bstrParameterAttrib ))) - { - CComPtr pDataTypeProp(NULL); - CComPtr pDefValProp(NULL); - CComPtr pMaxLengthProp(NULL); - CComPtr pMinLengthProp(NULL); - CComPtr pMandatoryProp(NULL); - CComPtr pUnitTypeProp(NULL); - - CComBSTR bstrMandatory(m_bstrKeywordsPrefix); - bstrMandatory += SCHEMA_CONDITIONAL; - - CStringXDW cstrMaxLength; - cstrMaxLength.Format(L"%i", maxLength); - - CStringXDW cstrMinLength; - cstrMinLength.Format(L"%i", minLength); - - CComBSTR bstrStringType(m_bstrSchemaPrefix); - bstrStringType += SCHEMA_STRING; - - if (SUCCEEDED(hr = CreateProperty(CComBSTR(DATATYPE_VALUE_NAME), CComBSTR(SCHEMA_QNAME), bstrStringType, &pDataTypeProp)) && - SUCCEEDED(hr = CreateProperty(CComBSTR(DEFAULTVAL_VALUE_NAME), CComBSTR(SCHEMA_STRING), defaultValue, &pDefValProp)) && - SUCCEEDED(hr = CreateProperty(CComBSTR(MAX_LENGTH_NAME), CComBSTR(SCHEMA_INTEGER), CComBSTR(cstrMaxLength), &pMaxLengthProp)) && - SUCCEEDED(hr = CreateProperty(CComBSTR(MIN_LENGTH_NAME), CComBSTR(SCHEMA_INTEGER), CComBSTR(cstrMinLength), &pMinLengthProp)) && - SUCCEEDED(hr = CreateProperty(CComBSTR(MANDATORY_VALUE_NAME), CComBSTR(SCHEMA_QNAME), bstrMandatory, &pMandatoryProp)) && - SUCCEEDED(hr = CreateProperty(CComBSTR(UNITTYPE_VALUE_NAME), CComBSTR(SCHEMA_STRING), bstrUnitType, &pUnitTypeProp)) && - SUCCEEDED(hr = (*ppParameterDef)->appendChild(pDataTypeProp, NULL)) && - SUCCEEDED(hr = (*ppParameterDef)->appendChild(pDefValProp, NULL)) && - SUCCEEDED(hr = (*ppParameterDef)->appendChild(pMaxLengthProp, NULL)) && - SUCCEEDED(hr = (*ppParameterDef)->appendChild(pMinLengthProp, NULL)) && - SUCCEEDED(hr = (*ppParameterDef)->appendChild(pMandatoryProp, NULL)) && - SUCCEEDED(hr = (*ppParameterDef)->appendChild(pUnitTypeProp, NULL))) - { - if (SUCCEEDED(hr) && - SysStringLen(bstrDisplayName) > 0) - { - CComPtr pDisplayProp(NULL); - - if (SUCCEEDED(hr = CreateProperty(CComBSTR(DISPLAYNAME_VALUE_NAME), CComBSTR(SCHEMA_STRING), bstrDisplayName, &pDisplayProp))) - { - hr = (*ppParameterDef)->appendChild(pDisplayProp, NULL); - } - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPCHandler::CreateIntParameterDef - -Routine Description: - - Creates a Integer type ParameterDef Element. - -Arguments: - - bstrParamName - Keyword value name for the parameter - bstrDisplayName - Optional string containing a description of the parameter definition. - defaultValue - Default value of the parameter. - minValue - Minimium valid value. - maxLength - Maximium valid value. - multiple - value can be increased or decreased in multiples of. - bstrUnitType - String containing a description of the unit type of the parameter value. - ppParameterDef - Pointer to an IXMLDOMElement that recieves the new element. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPCHandler::CreateIntParameterDef( - _In_z_ CONST BSTR bstrParamName, - _In_ CONST BOOL bIsPublicKeyword, - _In_opt_z_ CONST BSTR bstrDisplayName, - _In_ CONST INT defaultValue, - _In_ CONST INT minValue, - _In_ CONST INT maxValue, - _In_ CONST INT multiple, - _In_z_ CONST BSTR bstrUnitType, - _Outptr_ IXMLDOMElement** ppParameterDef - ) -{ - HRESULT hr = S_OK; - - // - // Create the parameterDef - // - CComBSTR bstrParameter(m_bstrFrameworkPrefix); - bstrParameter += PARAM_DEF_ELEMENT_NAME; - - CComBSTR bstrParameterAttrib; - if (bIsPublicKeyword) - { - hr = bstrParameterAttrib.Append(m_bstrKeywordsPrefix); - } - else - { - hr = bstrParameterAttrib.Append(m_bstrUserKeywordsPrefix); - } - - if (SUCCEEDED(hr)) - { - bstrParameterAttrib += bstrParamName; - } - - if(SUCCEEDED(hr)) - { - hr = CreateXMLElement(bstrParameter, FRAMEWORK_URI, ppParameterDef); - } - - if(SUCCEEDED(hr)) - { - if(SUCCEEDED(hr = CreateXMLAttribute(*ppParameterDef, NAME_ATTRIBUTE_NAME, NULL, bstrParameterAttrib ))) - { - CComPtr pDataTypeProp(NULL); - CComPtr pDefValProp(NULL); - CComPtr pMaxValueProp(NULL); - CComPtr pMinValueProp(NULL); - CComPtr pMandatoryProp(NULL); - CComPtr pUnitTypeProp(NULL); - CComPtr pMultipleProp(NULL); - - CStringXDW cstrMultiple; - cstrMultiple.Format(L"%i", multiple); - - CComBSTR bstrMandatory(m_bstrKeywordsPrefix); - bstrMandatory += SCHEMA_CONDITIONAL; - - CStringXDW cstrDefaultValue; - cstrDefaultValue.Format(L"%i", defaultValue); - - CStringXDW cstrMaxValue; - cstrMaxValue.Format(L"%i", maxValue); - - CStringXDW cstrMinValue; - cstrMinValue.Format(L"%i", minValue); - - CComBSTR bstrIntegerType(m_bstrSchemaPrefix); - bstrIntegerType += SCHEMA_INTEGER; - - if (SUCCEEDED(hr = CreateProperty(CComBSTR(DATATYPE_VALUE_NAME), CComBSTR(SCHEMA_QNAME), bstrIntegerType, &pDataTypeProp)) && - SUCCEEDED(hr = CreateProperty(CComBSTR(DEFAULTVAL_VALUE_NAME), CComBSTR(SCHEMA_INTEGER), CComBSTR(cstrDefaultValue), &pDefValProp)) && - SUCCEEDED(hr = CreateProperty(CComBSTR(MAX_VALUE_NAME), CComBSTR(SCHEMA_INTEGER), CComBSTR(cstrMaxValue), &pMaxValueProp)) && - SUCCEEDED(hr = CreateProperty(CComBSTR(MIN_VALUE_NAME), CComBSTR(SCHEMA_INTEGER), CComBSTR(cstrMinValue), &pMinValueProp)) && - SUCCEEDED(hr = CreateProperty(CComBSTR(MANDATORY_VALUE_NAME), CComBSTR(SCHEMA_QNAME), bstrMandatory, &pMandatoryProp)) && - SUCCEEDED(hr = CreateProperty(CComBSTR(UNITTYPE_VALUE_NAME), CComBSTR(SCHEMA_STRING), bstrUnitType, &pUnitTypeProp)) && - SUCCEEDED(hr = CreateProperty(CComBSTR(MULTIPLE_VALUE_NAME), CComBSTR(SCHEMA_INTEGER), CComBSTR(cstrMultiple), &pMultipleProp)) && - SUCCEEDED(hr = (*ppParameterDef)->appendChild(pDataTypeProp, NULL)) && - SUCCEEDED(hr = (*ppParameterDef)->appendChild(pDefValProp, NULL)) && - SUCCEEDED(hr = (*ppParameterDef)->appendChild(pMaxValueProp, NULL)) && - SUCCEEDED(hr = (*ppParameterDef)->appendChild(pMinValueProp, NULL)) && - SUCCEEDED(hr = (*ppParameterDef)->appendChild(pMandatoryProp, NULL)) && - SUCCEEDED(hr = (*ppParameterDef)->appendChild(pUnitTypeProp, NULL)) && - SUCCEEDED(hr = (*ppParameterDef)->appendChild(pMultipleProp, NULL))) - { - if (SysStringLen(bstrDisplayName) > 0) - { - CComPtr pDisplayProp(NULL); - - if (SUCCEEDED(hr = CreateProperty(CComBSTR(DISPLAYNAME_VALUE_NAME), CComBSTR(SCHEMA_STRING), bstrDisplayName, &pDisplayProp))) - { - hr = (*ppParameterDef)->appendChild(pDisplayProp, NULL); - } - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPCHandler::CreateFeature - -Routine Description: - - Creates a Feature Element. - -Arguments: - - bstrFeatureName - Keyword value name for the feature. - bstrDisplayName - Optional string containing a description of the feature. - ppFeatureElement - Pointer to an IXMLDOMElement that recieves the new element. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPCHandler::CreateFeature( - _In_z_ CONST BSTR bstrFeatureName, - _In_opt_z_ CONST BSTR bstrDisplayName, - _Outptr_ IXMLDOMElement** ppFeatureElement - ) -{ - HRESULT hr = S_OK; - - // - // Create the base feature node - // - CComBSTR bstrFeature(m_bstrFrameworkPrefix); - bstrFeature += FEATURE_ELEMENT_NAME; - - CComBSTR bstrFeatureAttrib(m_bstrKeywordsPrefix); - bstrFeatureAttrib += bstrFeatureName; - - if(SUCCEEDED(hr)) - { - hr = CreateXMLElement(bstrFeature, FRAMEWORK_URI, ppFeatureElement); - } - - if (SUCCEEDED(hr)) - { - hr = CreateXMLAttribute(*ppFeatureElement, NAME_ATTRIBUTE_NAME, NULL, bstrFeatureAttrib ); - } - - // - // Append the Display Name property type - // - if (SUCCEEDED(hr) && - SysStringLen(bstrDisplayName) > 0) - { - CComPtr pDisplayProp(NULL); - - if (SUCCEEDED(hr = CreateProperty(CComBSTR(DISPLAYNAME_VALUE_NAME), CComBSTR(SCHEMA_STRING), bstrDisplayName, &pDisplayProp))) - { - hr = (*ppFeatureElement)->appendChild(pDisplayProp, NULL); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPCHandler::CreateFeatureSelection - -Routine Description: - - Creates a Selection Feature Element. - -Arguments: - - bstrFeatureName - Keyword value name for the feature. - bstrDisplayName - Optional string containing a description of the feature. - ppFeatureElement - Pointer to an IXMLDOMElement that recieves the new element. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPCHandler::CreateFeatureSelection( - _In_z_ CONST BSTR bstrFeatureName, - _In_opt_z_ CONST BSTR bstrDisplayName, - _Outptr_ IXMLDOMElement** ppFeatureElement - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CreateFeature(bstrFeatureName, bstrDisplayName, ppFeatureElement))) - { - // - // Append the property type - // - CComPtr pPropertyTypeElement(NULL); - - // - // Create the keyname - // - CComBSTR bstrPickOne(m_bstrKeywordsPrefix); - bstrPickOne += PICKONE_VALUE_NAME; - - if (SUCCEEDED(hr = CreateFWProperty(CComBSTR(SELECTIONTYPE_VALUE_NAME), CComBSTR(SCHEMA_QNAME), bstrPickOne, &pPropertyTypeElement))) - { - hr = (*ppFeatureElement)->appendChild(pPropertyTypeElement, NULL); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPCHandler::CreateOption - -Routine Description: - - Creates an Option Type Element. - -Arguments: - - bstrOptionName - Keyword value name for the option. - bstrDisplayName - Optional string containing a description of the feature. - ppOptionElement - Pointer to an IXMLDOMElement that recieves the new element. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPCHandler::CreateOption( - _In_z_ CONST BSTR bstrOptionName, - _In_opt_z_ CONST BSTR bstrDisplayName, - _Outptr_ IXMLDOMElement** ppOptionElement - ) -{ - HRESULT hr = S_OK; - - // - // Create the base feature node - // - CComBSTR bstrOption(m_bstrFrameworkPrefix); - bstrOption += OPTION_ELEMENT_NAME; - - CComBSTR bstrOptionAttrib(m_bstrKeywordsPrefix); - bstrOptionAttrib += bstrOptionName; - - if(SUCCEEDED(hr)) - { - hr = CreateXMLElement(bstrOption, FRAMEWORK_URI, ppOptionElement); - } - - if (SUCCEEDED(hr)) - { - hr = CreateXMLAttribute(*ppOptionElement, NAME_ATTRIBUTE_NAME, NULL, bstrOptionAttrib ); - } - - // - // Append the Display Name property type - // - if (SUCCEEDED(hr) && - SysStringLen(bstrDisplayName) > 0) - { - CComPtr pDisplayProp(NULL); - - if (SUCCEEDED(hr = CreateProperty(CComBSTR(DISPLAYNAME_VALUE_NAME), CComBSTR(SCHEMA_STRING), bstrDisplayName, &pDisplayProp))) - { - hr = (*ppOptionElement)->appendChild(pDisplayProp, NULL); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPCHandler::CreateParameterRef - -Routine Description: - - Creates a Reference to a ParameterDef Element. - -Arguments: - - bstrParamRefName - Keyword value name for the parameter reference. - ppParamRefElement - Pointer to an IXMLDOMElement that recieves the new element. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPCHandler::CreateParameterRef( - _In_z_ CONST BSTR bstrParamRefName, - _Outptr_ IXMLDOMElement** ppParamRefElement - ) -{ - HRESULT hr = S_OK; - - // - // Create the base feature node - // - CComBSTR bstrParameterRef(m_bstrFrameworkPrefix); - bstrParameterRef += PARAM_REF_ELEMENT_NAME; - - - // - // PageWatermarkSizeWidth and PageWatermarkSizeHeight are non-standard - // parameter names so need to be accessed using a user defined namespace - // - CComBSTR bstrParamRefAttrib; - if (wcscmp(bstrParamRefName, L"PageWatermarkSizeWidth") == 0 || - wcscmp(bstrParamRefName, L"PageWatermarkSizeHeight") == 0) - { - hr = bstrParamRefAttrib.Append(m_bstrUserKeywordsPrefix); - } - else - { - hr = bstrParamRefAttrib.Append(m_bstrKeywordsPrefix); - } - - if (SUCCEEDED(hr)) - { - bstrParamRefAttrib += bstrParamRefName; - } - - // - //Create the IXMLDOMNode for ParameterRef - // - CComPtr pParameterRefNode(NULL); - - if(SUCCEEDED(hr)) - { - hr = CreateXMLElement(bstrParameterRef, FRAMEWORK_URI, ppParamRefElement); - } - - if (SUCCEEDED(hr)) - { - hr = CreateXMLAttribute(*ppParamRefElement, NAME_ATTRIBUTE_NAME, NULL, bstrParamRefAttrib ); - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/pchndlr.h b/print/XPSDrvSmpl/src/common/pchndlr.h deleted file mode 100644 index df958354..00000000 --- a/print/XPSDrvSmpl/src/common/pchndlr.h +++ /dev/null @@ -1,91 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -File Name: - - pchndlr.h - -Abstract: - - Base PrintCapabilities handler class definition. This class provides common - PrintCapabilities handling functionality for any feature that requires - PrintCapabilities handling. A feature specific handler can inherit from - this class to get feature unspecific XML handling functionality. - ---*/ - -#pragma once - -#include "schema.h" -#include "pshndlr.h" - -class CPCHandler : public CPSHandler -{ -public: - // - // Constructors and destructors - // - CPCHandler( - _In_ IXMLDOMDocument2 *pPrintCapabilities - ); - - virtual ~CPCHandler(); - -protected: - - HRESULT - CreateStringParameterDef( - _In_z_ CONST BSTR bstrParamName, - _In_ CONST BOOL bIsPublicKeyword, - _In_opt_z_ CONST BSTR bstrDisplayName, - _In_ CONST BSTR bstrDefaultValue, - _In_ CONST INT minLength, - _In_ CONST INT maxLength, - _In_z_ CONST BSTR bstrUnitType, - _Outptr_ IXMLDOMElement** ppParameterDef - ); - - HRESULT - CreateIntParameterDef( - _In_z_ CONST BSTR bstrParamName, - _In_ CONST BOOL bIsPublicKeyword, - _In_opt_z_ CONST BSTR bstrDisplayName, - _In_ CONST INT defaultValue, - _In_ CONST INT minValue, - _In_ CONST INT maxValue, - _In_ CONST INT multiple, - _In_z_ CONST BSTR bstrUnitType, - _Outptr_ IXMLDOMElement** ppParameterDef - ); - - HRESULT - CreateFeature( - _In_z_ CONST BSTR bstrFeatureName, - _In_opt_z_ CONST BSTR bstrDisplayName, - _Outptr_ IXMLDOMElement** ppFeatureElement - ); - - HRESULT - CreateOption( - _In_z_ CONST BSTR bstrOptionName, - _In_opt_z_ CONST BSTR bstrDisplayName, - _Outptr_ IXMLDOMElement** ppOptionElement - ); - - HRESULT - CreateFeatureSelection( - _In_z_ CONST BSTR bstrFeatureName, - _In_opt_z_ CONST BSTR bstrDisplayName, - _Outptr_ IXMLDOMElement** ppFeatureElement - ); - - HRESULT - CreateParameterRef( - _In_z_ CONST BSTR bstrParamRefName, - _Outptr_ IXMLDOMElement** ppParamRefElement - ); -}; - diff --git a/print/XPSDrvSmpl/src/common/pgscdata.h b/print/XPSDrvSmpl/src/common/pgscdata.h deleted file mode 100644 index 7a06ce24..00000000 --- a/print/XPSDrvSmpl/src/common/pgscdata.h +++ /dev/null @@ -1,52 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pgscdata.h - -Abstract: - - PageScaling data structure definition. This provides a convenient - description of the PrintSchema PageScaling feature. - ---*/ - -#pragma once - -#include "pgscschema.h" - -namespace XDPrintSchema -{ - namespace PageScaling - { - struct PageScalingData - { - PageScalingData() : - pgscOption(None), - offWidth(0), - offHeight(0), - scaleWidth(100), - scaleHeight(100), - offsetOption(OffsetAlignment::Center) - { - } - - EScaleOption pgscOption; - INT offWidth; - INT offHeight; - INT scaleWidth; - INT scaleHeight; - OffsetAlignment::EScaleOffsetOption offsetOption; - }; - } -} - diff --git a/print/XPSDrvSmpl/src/common/pgscpchndlr.cpp b/print/XPSDrvSmpl/src/common/pgscpchndlr.cpp deleted file mode 100644 index 12883a69..00000000 --- a/print/XPSDrvSmpl/src/common/pgscpchndlr.cpp +++ /dev/null @@ -1,349 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pgscpchndlr.cpp - -Abstract: - - Pagescale PrintCapabilities handling implementation. The pagescale PC handler - is used to set page scaling settings in a PrintCapabilities. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "pgscpchndlr.h" -#include "privatedefs.h" - -using XDPrintSchema::PRINTCAPABILITIES_NAME; - -using XDPrintSchema::PageScaling::EScaleOption; -using XDPrintSchema::PageScaling::FitBleedToImageable; -using XDPrintSchema::PageScaling::FitMediaToMedia; -using XDPrintSchema::PageScaling::Custom; -using XDPrintSchema::PageScaling::CustomSquare; -using XDPrintSchema::PageScaling::ECustomScaleProps; -using XDPrintSchema::PageScaling::ECustomScalePropsMin; -using XDPrintSchema::PageScaling::ECustomScalePropsMax; -using XDPrintSchema::PageScaling::ECustomSquareScaleProps; -using XDPrintSchema::PageScaling::ECustomSquareScalePropsMin; -using XDPrintSchema::PageScaling::ECustomSquareScalePropsMax; -using XDPrintSchema::PageScaling::SCALE_FEATURE; -using XDPrintSchema::PageScaling::SCALE_OPTIONS; -using XDPrintSchema::PageScaling::CUST_SCALE_PROPS; -using XDPrintSchema::PageScaling::CUST_SQR_SCALE_PROPS; - -using XDPrintSchema::PageScaling::OffsetAlignment::EScaleOffsetOption; -using XDPrintSchema::PageScaling::OffsetAlignment::EScaleOffsetOptionMin; -using XDPrintSchema::PageScaling::OffsetAlignment::EScaleOffsetOptionMax; -using XDPrintSchema::PageScaling::OffsetAlignment::SCALE_OFFSET_FEATURE; -using XDPrintSchema::PageScaling::OffsetAlignment::SCALE_OFFSET_OPTIONS; - -/*++ - -Routine Name: - - CPageScalingPCHandler::CPageScalingPCHandler - -Routine Description: - - CPageScalingPCHandler class constructor - -Arguments: - - pPrintCapabilities - Pointer to the DOM document representation of the PrintCapabilities - -Return Value: - - None - ---*/ -CPageScalingPCHandler::CPageScalingPCHandler( - _In_ IXMLDOMDocument2* pPrintCapabilities - ) : - CPCHandler(pPrintCapabilities) -{ -} - -/*++ - -Routine Name: - - CPageScalingPCHandler::~CPageScalingPCHandler - -Routine Description: - - CPageScalingPCHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPageScalingPCHandler::~CPageScalingPCHandler() -{ -} - -/*++ - -Routine Name: - - CPageScalingPCHandler::SetCapabilities - -Routine Description: - - This routine sets page scaling capabilities in the PrintCapabilities passed to the - class constructor. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScalingPCHandler::SetCapabilities( - VOID - ) -{ - HRESULT hr = S_OK; - - try - { - // - // Retrieve the PrintTicket root - // - CComPtr pPTRoot(NULL); - - CComBSTR bstrPTQuery(m_bstrFrameworkPrefix); - bstrPTQuery += PRINTCAPABILITIES_NAME; - - if (SUCCEEDED(hr = GetNode(bstrPTQuery, &pPTRoot))) - { - CComPtr pFeatureElement(NULL); - - if (SUCCEEDED(hr = CreateFeatureSelection(CComBSTR(SCALE_FEATURE), NULL, &pFeatureElement))) - { - CComPtr pCustomOption(NULL); - - // - // Create the Custom Options - // - if (SUCCEEDED(hr = CreateOption(CComBSTR(SCALE_OPTIONS[Custom]), NULL, &pCustomOption))) - { - PTDOMElementVector propertList; - - for (ECustomScaleProps customProps = ECustomScalePropsMin; - customProps < ECustomScalePropsMax && SUCCEEDED(hr); - customProps = static_cast(customProps + 1)) - { - CComPtr pScoredProperty(NULL); - - // - // Create the scored property list - // - if (SUCCEEDED(hr = CreateScoredProperty(CComBSTR(CUST_SCALE_PROPS[customProps]), &pScoredProperty))) - { - CComPtr pParamRef(NULL); - - // - // Construct the parameter reference elements - // - CComBSTR bstrPRefName(SCALE_FEATURE); - bstrPRefName += CUST_SCALE_PROPS[customProps]; - - if (SUCCEEDED(hr = CreateParameterRef(bstrPRefName, &pParamRef))) - { - hr = pScoredProperty->appendChild(pParamRef, NULL); - } - - propertList.push_back(pScoredProperty); - } - } - - // - // Add the properties to the custom option - // - PTDOMElementVector::iterator iterPropertList = propertList.begin(); - - for (;iterPropertList != propertList.end() && SUCCEEDED(hr); iterPropertList++) - { - hr = pCustomOption->appendChild(*iterPropertList, NULL); - } - - if (SUCCEEDED(hr)) - { - hr = pFeatureElement->appendChild(pCustomOption, NULL); - } - } - - CComPtr pCustomSquareOption(NULL); - - // - // Create the Custom Square - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CreateOption(CComBSTR(SCALE_OPTIONS[CustomSquare]), NULL, &pCustomSquareOption))) - { - PTDOMElementVector propertList; - - for (ECustomSquareScaleProps customSquareProps = ECustomSquareScalePropsMin; - customSquareProps < ECustomSquareScalePropsMax && SUCCEEDED(hr); - customSquareProps = static_cast(customSquareProps + 1)) - { - CComPtr pScoredProperty(NULL); - - // - // Create the scored property list - // - if (SUCCEEDED(hr = CreateScoredProperty(CComBSTR(CUST_SQR_SCALE_PROPS[customSquareProps]), &pScoredProperty))) - { - CComPtr pParamRef(NULL); - - // - // Construct the parameter reference elements - // - CComBSTR bstrPRefName(SCALE_FEATURE); - bstrPRefName += CUST_SQR_SCALE_PROPS[customSquareProps]; - - if (SUCCEEDED(hr = CreateParameterRef(bstrPRefName, &pParamRef))) - { - hr = pScoredProperty->appendChild(pParamRef, NULL); - } - - propertList.push_back(pScoredProperty); - } - } - - // - // Add the properties to the custom square option - // - PTDOMElementVector::iterator iterPropertList = propertList.begin(); - - for (;iterPropertList != propertList.end() && SUCCEEDED(hr); iterPropertList++) - { - hr = pCustomSquareOption->appendChild(*iterPropertList, NULL); - } - - if (SUCCEEDED(hr)) - { - hr = pFeatureElement->appendChild(pCustomSquareOption, NULL); - } - } - - // - // Create the remaining scaling options: Fit To ... - // - for (EScaleOption fitToOptions = FitBleedToImageable; - fitToOptions <= FitMediaToMedia && SUCCEEDED(hr); - fitToOptions = static_cast(fitToOptions + 1)) - { - CComPtr pFitToOption(NULL); - - // - // Create the fit to page option - // - if (SUCCEEDED(hr = CreateOption(CComBSTR(SCALE_OPTIONS[fitToOptions]), NULL, &pFitToOption))) - { - hr = pFeatureElement->appendChild(pFitToOption, NULL); - } - } - - // - // Create the offset options - // - if (SUCCEEDED(hr)) - { - CComPtr pOffsetFeature(NULL); - if (SUCCEEDED(hr = CreateFeature(CComBSTR(SCALE_OFFSET_FEATURE), - NULL, - &pOffsetFeature))) - { - PTDOMElementVector optionList; - - for (EScaleOffsetOption offsetOption = EScaleOffsetOptionMin; - offsetOption < EScaleOffsetOptionMax && SUCCEEDED(hr); - offsetOption = static_cast(offsetOption + 1)) - { - CComPtr pOptionProperty(NULL); - - if (SUCCEEDED(hr = CreateOption(CComBSTR(SCALE_OFFSET_OPTIONS[offsetOption]), NULL, &pOptionProperty))) - { - optionList.push_back(pOptionProperty); - } - } - - // - // Add the options to the offset feature - // - PTDOMElementVector::iterator iterOptionList = optionList.begin(); - - for (;iterOptionList != optionList.end() && SUCCEEDED(hr); iterOptionList++) - { - hr = pOffsetFeature->appendChild(*iterOptionList, NULL); - } - } - - if (SUCCEEDED(hr)) - { - hr = pFeatureElement->appendChild(pOffsetFeature, NULL); - } - } - - if (SUCCEEDED(hr)) - { - hr = pPTRoot->appendChild(pFeatureElement, NULL); - } - } - - for (UINT cIndex = 0; cIndex < numof(pgscParamDefIntegers); cIndex++) - { - CComPtr pParameterDef(NULL); - - if (SUCCEEDED(hr = CreateIntParameterDef(CComBSTR(pgscParamDefIntegers[cIndex].property_name), // Paramater Name - pgscParamDefIntegers[cIndex].is_public, // Is Print Schema Keyword? - CComBSTR(pgscParamDefIntegers[cIndex].display_name), // Display Text - pgscParamDefIntegers[cIndex].default_value, // Default - pgscParamDefIntegers[cIndex].min_length, // Min Length - pgscParamDefIntegers[cIndex].max_length, // Max Length - pgscParamDefIntegers[cIndex].multiple, // Multiple - CComBSTR(pgscParamDefIntegers[cIndex].unit_type), // Unit Type - &pParameterDef))) // Parameter Def - { - hr = pPTRoot->appendChild(pParameterDef, NULL); - } - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - - diff --git a/print/XPSDrvSmpl/src/common/pgscpchndlr.h b/print/XPSDrvSmpl/src/common/pgscpchndlr.h deleted file mode 100644 index 3d30583f..00000000 --- a/print/XPSDrvSmpl/src/common/pgscpchndlr.h +++ /dev/null @@ -1,41 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pgscpchndlr.h - -Abstract: - - Page Scaling PrintCapabilities handling definition. The page scaling PC handler - is used to set page scaling settings in a PrintCapabilities. - ---*/ - -#pragma once - -#include "pchndlr.h" -#include "pgscdata.h" - -class CPageScalingPCHandler : public CPCHandler -{ -public: - CPageScalingPCHandler( - _In_ IXMLDOMDocument2* pPrintCapabilities - ); - - virtual ~CPageScalingPCHandler(); - - HRESULT - SetCapabilities( - VOID - ); -}; diff --git a/print/XPSDrvSmpl/src/common/pgscpthndlr.cpp b/print/XPSDrvSmpl/src/common/pgscpthndlr.cpp deleted file mode 100644 index beffe034..00000000 --- a/print/XPSDrvSmpl/src/common/pgscpthndlr.cpp +++ /dev/null @@ -1,479 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pgscpthndlr.cpp - -Abstract: - - PageScaling PrintTicket handler implementation. Derived from CPTHandler, - this provides PageScaling specific Get and Set methods acting on the - PrintTicket (as a DOM document) passed. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "pgscpthndlr.h" - -using XDPrintSchema::PRINTTICKET_NAME; -using XDPrintSchema::NAME_ATTRIBUTE_NAME; - -using XDPrintSchema::PageScaling::PageScalingData; -using XDPrintSchema::PageScaling::EScaleOption; -using XDPrintSchema::PageScaling::EScaleOptionMin; -using XDPrintSchema::PageScaling::Custom; -using XDPrintSchema::PageScaling::CustomSquare; -using XDPrintSchema::PageScaling::FitBleedToImageable; -using XDPrintSchema::PageScaling::FitContentToImageable; -using XDPrintSchema::PageScaling::FitMediaToImageable; -using XDPrintSchema::PageScaling::FitMediaToMedia; -using XDPrintSchema::PageScaling::None; -using XDPrintSchema::PageScaling::EScaleOptionMax; -using XDPrintSchema::PageScaling::ECustomScaleProps; -using XDPrintSchema::PageScaling::ECustomScalePropsMin; -using XDPrintSchema::PageScaling::CstOffsetWidth; -using XDPrintSchema::PageScaling::CstOffsetHeight; -using XDPrintSchema::PageScaling::CstScaleWidth; -using XDPrintSchema::PageScaling::CstScaleHeight; -using XDPrintSchema::PageScaling::ECustomScalePropsMax; -using XDPrintSchema::PageScaling::ECustomSquareScaleProps; -using XDPrintSchema::PageScaling::ECustomSquareScalePropsMin; -using XDPrintSchema::PageScaling::CstSqOffsetWidth; -using XDPrintSchema::PageScaling::CstSqOffsetHeight; -using XDPrintSchema::PageScaling::CstSqScale; -using XDPrintSchema::PageScaling::ECustomSquareScalePropsMax; -using XDPrintSchema::PageScaling::SCALE_FEATURE; -using XDPrintSchema::PageScaling::SCALE_OPTIONS; -using XDPrintSchema::PageScaling::CUST_SCALE_PROPS; -using XDPrintSchema::PageScaling::CUST_SQR_SCALE_PROPS; - -using XDPrintSchema::PageScaling::OffsetAlignment::EScaleOffsetOption; -using XDPrintSchema::PageScaling::OffsetAlignment::EScaleOffsetOptionMin; -using XDPrintSchema::PageScaling::OffsetAlignment::EScaleOffsetOptionMax; -using XDPrintSchema::PageScaling::OffsetAlignment::SCALE_OFFSET_FEATURE; -using XDPrintSchema::PageScaling::OffsetAlignment::SCALE_OFFSET_OPTIONS; - -/*++ - -Routine Name: - - CPageScalingPTHandler::CPageScalingPTHandler - -Routine Description: - - CPageScalingPTHandler class constructor - -Arguments: - - pPrintTicket - Pointer to the DOM document representation of the PrintTicket - -Return Value: - - None - ---*/ -CPageScalingPTHandler::CPageScalingPTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ) : - CPTHandler(pPrintTicket) -{ -} - -/*++ - -Routine Name: - - CPageScalingPTHandler::~CPageScalingPTHandler - -Routine Description: - - CPageScalingPTHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPageScalingPTHandler::~CPageScalingPTHandler() -{ -} - -/*++ - -Routine Name: - - CPageScalingPTHandler::GetData - -Routine Description: - - The routine fills the data structure passed in with page scaling data - retrieved from the PrintTicket passed to the class constructor. - -Arguments: - - pPageScaleData - Pointer to the page scaling data structure to be filled in - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - Feature not present in PrintTicket - E_* - On error - ---*/ -HRESULT -CPageScalingPTHandler::GetData( - _Out_ PageScalingData* pPageScaleData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPageScaleData, E_POINTER))) - { - CComBSTR bstrPgScOption; - - if (SUCCEEDED(hr = GetFeatureOption(CComBSTR(SCALE_FEATURE), &bstrPgScOption))) - { - if (bstrPgScOption == SCALE_OPTIONS[Custom]) - { - pPageScaleData->pgscOption = Custom; - - if (SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(SCALE_FEATURE), - CComBSTR(CUST_SCALE_PROPS[CstOffsetWidth]), - &pPageScaleData->offWidth)) && - SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(SCALE_FEATURE), - CComBSTR(CUST_SCALE_PROPS[CstOffsetHeight]), - &pPageScaleData->offHeight)) && - SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(SCALE_FEATURE), - CComBSTR(CUST_SCALE_PROPS[CstScaleWidth]), - &pPageScaleData->scaleWidth))) - { - hr = GetScoredPropertyValue(CComBSTR(SCALE_FEATURE), - CComBSTR(CUST_SCALE_PROPS[CstScaleHeight]), - &pPageScaleData->scaleHeight); - } - } - else if (bstrPgScOption == SCALE_OPTIONS[CustomSquare]) - { - pPageScaleData->pgscOption = CustomSquare; - - if (SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(SCALE_FEATURE), - CComBSTR(CUST_SQR_SCALE_PROPS[CstSqOffsetWidth]), - &pPageScaleData->offWidth)) && - SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(SCALE_FEATURE), - CComBSTR(CUST_SQR_SCALE_PROPS[CstSqOffsetHeight]), - &pPageScaleData->offHeight)) && - SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(SCALE_FEATURE), - CComBSTR(CUST_SQR_SCALE_PROPS[CstSqScale]), - &pPageScaleData->scaleWidth))) - { - pPageScaleData->scaleHeight = pPageScaleData->scaleWidth; - } - } - else if (bstrPgScOption == SCALE_OPTIONS[None]) - { - // - // No scaling - return as if no element is present - // - hr = E_ELEMENT_NOT_FOUND; - } - else - { - // - // Identify the option - // - for (EScaleOption pgScOption = FitBleedToImageable; - pgScOption < EScaleOptionMax; - pgScOption = static_cast(pgScOption + 1)) - { - if (bstrPgScOption == SCALE_OPTIONS[pgScOption]) - { - pPageScaleData->pgscOption = pgScOption; - - // - // Get the offset alignment - // - CComBSTR bstrOffsetAlignment; - - hr = GetSubFeatureOption(CComBSTR(SCALE_FEATURE), - CComBSTR(SCALE_OFFSET_FEATURE), - &bstrOffsetAlignment); - - // - // Identify the Alignment - // - for (EScaleOffsetOption offOption = EScaleOffsetOptionMin; - offOption < EScaleOffsetOptionMax; - offOption = static_cast(offOption + 1)) - { - if (bstrOffsetAlignment == SCALE_OFFSET_OPTIONS[offOption]) - { - pPageScaleData->offsetOption = offOption; - - break; - } - } - - break; - } - } - } - } - } - - // - // Validate the data - // - if (SUCCEEDED(hr)) - { - if (pPageScaleData->pgscOption < EScaleOptionMin || - pPageScaleData->pgscOption >= EScaleOptionMax) - { - hr = E_FAIL; - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CPageScalingPTHandler::SetData - -Routine Description: - - This routine sets the page scaling data in the PrintTicket passed to the - class constructor. - -Arguments: - - pPageScaleData - Pointer to the page scale data to be set in the PrintTicket - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScalingPTHandler::SetData( - _In_ CONST PageScalingData* pPageScaleData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPageScaleData, E_POINTER))) - { - if (pPageScaleData->pgscOption < EScaleOptionMin || - pPageScaleData->pgscOption >= EScaleOptionMax || - pPageScaleData->offsetOption < EScaleOffsetOptionMin || - pPageScaleData->offsetOption >= EScaleOffsetOptionMax) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - // - // Remove any existing page scaling feature node - // - CComPtr pFeature(NULL); - CComPtr pOption(NULL); - - CComBSTR bstrFeature(SCALE_FEATURE); - CComBSTR bstrAttribName(m_bstrKeywordsPrefix); - - if (SUCCEEDED(hr = DeleteFeature(bstrFeature)) && - pPageScaleData->pgscOption != None && - SUCCEEDED(hr = CreateFeatureOptionPair(bstrFeature, &pFeature, &pOption))) - { - // - // Retrieve the PrintTicket root - // - CComPtr pPTRoot(NULL); - - CComBSTR bstrPTQuery(m_bstrFrameworkPrefix); - bstrPTQuery += PRINTTICKET_NAME; - - if (SUCCEEDED(hr = GetNode(bstrPTQuery, &pPTRoot))) - { - // - // Append the feature node to the PrintTicket root element - // - hr = pPTRoot->appendChild(pFeature, NULL); - } - - // - // Set the option value - // - bstrAttribName += SCALE_OPTIONS[pPageScaleData->pgscOption]; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CreateXMLAttribute(pOption, NAME_ATTRIBUTE_NAME, NULL, bstrAttribName ))) - { - switch (pPageScaleData->pgscOption) - { - case Custom: - { - // - // Create the width offset, height offset, width scale and height scale - // parameter ref/init pairs. Create the relevant scored properties passing the - // paramater refs. Append the scored properties to the option element and the - // paramter init values to the PrintTicket element - // - CONST INT* pValue = &pPageScaleData->offWidth; - for (ECustomScaleProps props = ECustomScalePropsMin; - props < ECustomScalePropsMax && SUCCEEDED(hr); - props = static_cast(props + 1), pValue++) - { - CComPtr pParamRef(NULL); - CComPtr pParamInit(NULL); - CComPtr pScoredProp(NULL); - - CComBSTR bstrParamRefName(SCALE_FEATURE); - bstrParamRefName += CUST_SCALE_PROPS[props]; - - if (SUCCEEDED(hr = CreateParamRefInitPair(bstrParamRefName, - *pValue, - &pParamRef,&pParamInit)) && - SUCCEEDED(hr = CreateScoredProperty(CComBSTR(CUST_SCALE_PROPS[props]), - pParamRef, - &pScoredProp)) && - SUCCEEDED(hr = pOption->appendChild(pScoredProp, NULL))) - { - hr = pPTRoot->appendChild(pParamInit, NULL); - } - } - } - break; - - case CustomSquare: - { - // - // Create the width offset, height offset and scale parameter ref/init pairs. - // Create the relevant scored properties passing the paramater refs. Append - // the scored properties to the option element and the paramter init values - // to the PrintTicket element. - // - CONST INT* pValue = &pPageScaleData->offWidth; - for (ECustomSquareScaleProps props = ECustomSquareScalePropsMin; - props < ECustomSquareScalePropsMax && SUCCEEDED(hr); - props = static_cast(props + 1), pValue++) - { - CComPtr pParamRef(NULL); - CComPtr pParamInit(NULL); - CComPtr pScoredProp(NULL); - - CComBSTR bstrParamRefName(SCALE_FEATURE); - bstrParamRefName += CUST_SQR_SCALE_PROPS[props]; - - if (SUCCEEDED(hr = CreateParamRefInitPair(bstrParamRefName, - *pValue, - &pParamRef, - &pParamInit)) && - SUCCEEDED(hr = CreateScoredProperty(CComBSTR(CUST_SQR_SCALE_PROPS[props]), - pParamRef, - &pScoredProp)) && - SUCCEEDED(hr = pOption->appendChild(pScoredProp, NULL))) - { - hr = pPTRoot->appendChild(pParamInit, NULL); - } - } - } - break; - - case FitBleedToImageable: - case FitContentToImageable: - case FitMediaToImageable: - case FitMediaToMedia: - { - // - // Create the ScaleOffsetAlignement feature and append to the option node - // - CComPtr pSubFeature(NULL); - CComPtr pSubOption(NULL); - - CComBSTR bstrOffsetFeature(SCALE_OFFSET_FEATURE); - CComBSTR bstrOffsetOption(SCALE_OFFSET_OPTIONS[pPageScaleData->offsetOption]); - - if (SUCCEEDED(hr = CreateFeatureOptionPair(bstrOffsetFeature, - bstrOffsetOption, - &pSubFeature, - &pSubOption))) - { - hr = pFeature->appendChild(pSubFeature, NULL); - } - } - break; - - case None: - default: - { - } - break; - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPageScalingPTHandler::Delete - -Routine Description: - - This routine deletes the page scaling feature from the PrintTicket passed to the - class constructor - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScalingPTHandler::Delete( - VOID - ) -{ - // - // Remove any existing page scaling feature node - // - HRESULT hr = DeleteFeature(CComBSTR(SCALE_FEATURE)); - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/pgscpthndlr.h b/print/XPSDrvSmpl/src/common/pgscpthndlr.h deleted file mode 100644 index 08c52e7d..00000000 --- a/print/XPSDrvSmpl/src/common/pgscpthndlr.h +++ /dev/null @@ -1,55 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pgscpthndlr.h - -Abstract: - - PageScaling PrintTicket handling definition. The PageScaling PT handler - is used to extract PageScaling settings from a PrintTicket and populate - the PageScaling data structure with the retrieved settings. The class also - defines a method for setting the feature in the PrintTicket given the - data structure. - ---*/ - -#pragma once - -#include "pthndlr.h" -#include "pgscdata.h" - -class CPageScalingPTHandler : public CPTHandler -{ -public: - CPageScalingPTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ); - - virtual ~CPageScalingPTHandler(); - - HRESULT - GetData( - _Out_ XDPrintSchema::PageScaling::PageScalingData* pPageScaleData - ); - - HRESULT - SetData( - _In_ CONST XDPrintSchema::PageScaling::PageScalingData* pPageScaleData - ); - - HRESULT - Delete( - void - ); -}; - diff --git a/print/XPSDrvSmpl/src/common/pgscschema.cpp b/print/XPSDrvSmpl/src/common/pgscschema.cpp deleted file mode 100644 index a8ada487..00000000 --- a/print/XPSDrvSmpl/src/common/pgscschema.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pgscschema.cpp - -Abstract: - - PageScaling PrintSchema implementation. This implements the features, - options and enumerations that describe the PrintSchema PageScaling feature. - ---*/ - -#include "precomp.h" -#include "pgscschema.h" - -LPCWSTR XDPrintSchema::PageScaling::SCALE_FEATURE = L"PageScaling"; - -LPCWSTR XDPrintSchema::PageScaling::SCALE_OPTIONS[EScaleOptionMax] = { - L"Custom", - L"CustomSquare", - L"FitApplicationBleedSizeToPageImageableSize", - L"FitApplicationContentSizeToPageImageableSize", - L"FitApplicationMediaSizeToPageImageableSize", - L"FitApplicationMediaSizeToPageMediaSize", - L"None" -}; - -LPCWSTR XDPrintSchema::PageScaling::CUST_SCALE_PROPS[] = { - L"OffsetWidth", - L"OffsetHeight", - L"ScaleWidth", - L"ScaleHeight" -}; - -LPCWSTR XDPrintSchema::PageScaling::CUST_SQR_SCALE_PROPS[] = { - L"OffsetWidth", - L"OffsetHeight", - L"Scale" -}; - -LPCWSTR XDPrintSchema::PageScaling::OffsetAlignment::SCALE_OFFSET_FEATURE = L"ScaleOffsetAlignment"; - -LPCWSTR XDPrintSchema::PageScaling::OffsetAlignment::SCALE_OFFSET_OPTIONS[] = { - L"BottomCenter", - L"BottomLeft", - L"BottomRight", - L"Center", - L"LeftCenter", - L"RightCenter", - L"TopCenter", - L"TopLeft", - L"TopRight" -}; - diff --git a/print/XPSDrvSmpl/src/common/pgscschema.h b/print/XPSDrvSmpl/src/common/pgscschema.h deleted file mode 100644 index d30c9c92..00000000 --- a/print/XPSDrvSmpl/src/common/pgscschema.h +++ /dev/null @@ -1,112 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pgscschema.h - -Abstract: - - PageScaling PrintSchema definition. This defines the features, options - and enumerations that describe the PrintSchema PageScaling feature within - a XDPrintSchema::PageScaling namespace. - ---*/ - -#pragma once - -#include "schema.h" - -namespace XDPrintSchema -{ - // - // PageScaling elements described as Printschema keywords - // - namespace PageScaling - { - // - // The feature name - // - extern LPCWSTR SCALE_FEATURE; - - // - // Option names - // - enum EScaleOption - { - Custom = 0, EScaleOptionMin = 0, - CustomSquare, - FitBleedToImageable, - FitContentToImageable, - FitMediaToImageable, - FitMediaToMedia, - None, - EScaleOptionMax - }; - - extern LPCWSTR SCALE_OPTIONS[EScaleOptionMax]; - - // - // Custom scaling properties - // - enum ECustomScaleProps - { - CstOffsetWidth = 0, ECustomScalePropsMin = 0, - CstOffsetHeight, - CstScaleWidth, - CstScaleHeight, - ECustomScalePropsMax - }; - - extern LPCWSTR CUST_SCALE_PROPS[ECustomScalePropsMax]; - - // - // Custom square scaling properties - // - enum ECustomSquareScaleProps - { - CstSqOffsetWidth = 0, ECustomSquareScalePropsMin = 0, - CstSqOffsetHeight, - CstSqScale, - ECustomSquareScalePropsMax - }; - - extern LPCWSTR CUST_SQR_SCALE_PROPS[ECustomSquareScalePropsMax]; - - namespace OffsetAlignment - { - // - // The feature name - // - extern LPCWSTR SCALE_OFFSET_FEATURE; - - // - // Option names - // - enum EScaleOffsetOption - { - BottomCenter = 0, EScaleOffsetOptionMin = 0, - BottomLeft, - BottomRight, - Center, - LeftCenter, - RightCenter, - TopCenter, - TopLeft, - TopRight, - EScaleOffsetOptionMax - }; - - extern LPCWSTR SCALE_OFFSET_OPTIONS[EScaleOffsetOptionMax]; - } - } -} - diff --git a/print/XPSDrvSmpl/src/common/pimagedata.h b/print/XPSDrvSmpl/src/common/pimagedata.h deleted file mode 100644 index fc9a36c7..00000000 --- a/print/XPSDrvSmpl/src/common/pimagedata.h +++ /dev/null @@ -1,52 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pimagedata.h - -Abstract: - - PageImageableSize data structure definition. This provides a convenient - description of the PrintSchema PageImageableSize feature. - ---*/ - -#pragma once - -#include "pimageschema.h" - -namespace XDPrintSchema -{ - namespace PageImageableSize - { - struct PageImageableData - { - PageImageableData() : - imageableSizeWidth(0), - imageableSizeHeight(0), - originWidth(0), - originHeight(0), - extentWidth(0), - extentHeight(0) - { - } - - INT imageableSizeWidth; - INT imageableSizeHeight; - INT originWidth; - INT originHeight; - INT extentWidth; - INT extentHeight; - }; - } -} - diff --git a/print/XPSDrvSmpl/src/common/pimagepthndlr.cpp b/print/XPSDrvSmpl/src/common/pimagepthndlr.cpp deleted file mode 100644 index 23013810..00000000 --- a/print/XPSDrvSmpl/src/common/pimagepthndlr.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pimagepthndlr.cpp - -Abstract: - - This class is responsible for retrieving the PageImageableSize properties from a - PrintCapabilities document. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "ptquerybld.h" -#include "pimagepthndlr.h" - -using XDPrintSchema::PageImageableSize::PageImageableData; -using XDPrintSchema::PageImageableSize::ImageableSizeWidth; -using XDPrintSchema::PageImageableSize::ImageableSizeHeight; -using XDPrintSchema::PageImageableSize::ImageableArea; -using XDPrintSchema::PageImageableSize::EPageImageablePropsMax; -using XDPrintSchema::PageImageableSize::OriginWidth; -using XDPrintSchema::PageImageableSize::OriginHeight; -using XDPrintSchema::PageImageableSize::ExtentWidth; -using XDPrintSchema::PageImageableSize::ExtentHeight; -using XDPrintSchema::PageImageableSize::PAGE_IMAGEABLE_PROPERTY; -using XDPrintSchema::PageImageableSize::PAGE_IMAGEABLE_PROPS; -using XDPrintSchema::PageImageableSize::PAGE_IMAGEABLE_PROPS_AREA; - -/*++ - -Routine Name: - - CPageImageablePCHandler::CPageImageablePCHandler - -Routine Description: - - CPageImageablePCHandler class constructor - -Arguments: - - pPrintCapabilities - Pointer to the DOM document representation of the PrintCapabilities - -Return Value: - - None - ---*/ -CPageImageablePCHandler::CPageImageablePCHandler( - _In_ IXMLDOMDocument2* pPrintCapabilities - ) : - CPCHandler(pPrintCapabilities) -{ -} - -/*++ - -Routine Name: - - CPageImageablePCHandler::~CPageImageablePCHandler - -Routine Description: - - CPageImageablePCHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPageImageablePCHandler::~CPageImageablePCHandler() -{ -} - -/*++ - -Routine Name: - - CPageImageablePCHandler::GetData - -Routine Description: - - The routine fills the data structure passed in with page imageable size - data retrieved from the PrintCapabilities passed to the class constructor. - -Arguments: - - pPageImageableData - Pointer to the page imageable size data structure to be filled in - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - Feature not present in PrintCapabilities - E_* - On error - ---*/ -HRESULT -CPageImageablePCHandler::GetData( - _Inout_ PageImageableData* pPageImageableData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPageImageableData, E_POINTER))) - { - CComBSTR bstrQuery; - CPTQueryBuilder queryImageableArea(m_bstrFrameworkPrefix); - - if (SUCCEEDED(hr = queryImageableArea.AddProperty(m_bstrKeywordsPrefix, CComBSTR(PAGE_IMAGEABLE_PROPERTY))) && - SUCCEEDED(hr = queryImageableArea.GetQuery(&bstrQuery)) && - SUCCEEDED(hr = QueryNode(bstrQuery))) - { - CPTQueryBuilder queryImageableSizeWidth(queryImageableArea); - CPTQueryBuilder queryImageableSizeHeight(queryImageableArea); - - if (SUCCEEDED(hr = queryImageableSizeWidth.AddProperty(m_bstrKeywordsPrefix, CComBSTR(PAGE_IMAGEABLE_PROPS[ImageableSizeWidth]))) && - SUCCEEDED(hr = queryImageableSizeHeight.AddProperty(m_bstrKeywordsPrefix, CComBSTR(PAGE_IMAGEABLE_PROPS[ImageableSizeHeight]))) && - SUCCEEDED(hr = queryImageableSizeWidth.GetQuery(&bstrQuery)) && - SUCCEEDED(hr = QueryNodeValue(bstrQuery, &pPageImageableData->imageableSizeWidth)) && - SUCCEEDED(hr = queryImageableSizeHeight.GetQuery(&bstrQuery)) && - SUCCEEDED(hr = QueryNodeValue(bstrQuery, &pPageImageableData->imageableSizeHeight))) - { - CPTQueryBuilder queryOriginWidth(queryImageableArea); - CPTQueryBuilder queryOriginHeight(queryImageableArea); - CPTQueryBuilder queryExtentWidth(queryImageableArea); - CPTQueryBuilder queryExtentHeight(queryImageableArea); - - if (SUCCEEDED(hr = queryOriginWidth.AddProperty(m_bstrKeywordsPrefix, CComBSTR(PAGE_IMAGEABLE_PROPS[ImageableArea]))) && - SUCCEEDED(hr = queryOriginWidth.AddProperty(m_bstrKeywordsPrefix, CComBSTR(PAGE_IMAGEABLE_PROPS_AREA[OriginWidth]))) && - SUCCEEDED(hr = queryOriginHeight.AddProperty(m_bstrKeywordsPrefix, CComBSTR(PAGE_IMAGEABLE_PROPS[ImageableArea]))) && - SUCCEEDED(hr = queryOriginHeight.AddProperty(m_bstrKeywordsPrefix, CComBSTR(PAGE_IMAGEABLE_PROPS_AREA[OriginHeight]))) && - SUCCEEDED(hr = queryExtentWidth.AddProperty(m_bstrKeywordsPrefix, CComBSTR(PAGE_IMAGEABLE_PROPS[ImageableArea]))) && - SUCCEEDED(hr = queryExtentWidth.AddProperty(m_bstrKeywordsPrefix, CComBSTR(PAGE_IMAGEABLE_PROPS_AREA[ExtentWidth]))) && - SUCCEEDED(hr = queryExtentHeight.AddProperty(m_bstrKeywordsPrefix, CComBSTR(PAGE_IMAGEABLE_PROPS[ImageableArea]))) && - SUCCEEDED(hr = queryExtentHeight.AddProperty(m_bstrKeywordsPrefix, CComBSTR(PAGE_IMAGEABLE_PROPS_AREA[ExtentHeight]))) && - SUCCEEDED(hr = queryOriginWidth.GetQuery(&bstrQuery)) && - SUCCEEDED(hr = QueryNodeValue(bstrQuery, &pPageImageableData->originWidth)) && - SUCCEEDED(hr = queryOriginHeight.GetQuery(&bstrQuery)) && - SUCCEEDED(hr = QueryNodeValue(bstrQuery, &pPageImageableData->originHeight)) && - SUCCEEDED(hr = queryExtentWidth.GetQuery(&bstrQuery)) && - SUCCEEDED(hr = QueryNodeValue(bstrQuery, &pPageImageableData->extentWidth)) && - SUCCEEDED(hr = queryExtentHeight.GetQuery(&bstrQuery))) - { - hr = QueryNodeValue(bstrQuery, &pPageImageableData->extentHeight); - } - } - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/pimagepthndlr.h b/print/XPSDrvSmpl/src/common/pimagepthndlr.h deleted file mode 100644 index 99d5025e..00000000 --- a/print/XPSDrvSmpl/src/common/pimagepthndlr.h +++ /dev/null @@ -1,42 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pimagepthndlr.h - -Abstract: - - This class is responsible for retrieving the PageImageableSize properties from a - PrintCapabilities document. - ---*/ - -#pragma once - -#include "pchndlr.h" -#include "pimagedata.h" - -class CPageImageablePCHandler : public CPCHandler -{ -public: - CPageImageablePCHandler( - _In_ IXMLDOMDocument2* pPrintCapabilities - ); - - virtual ~CPageImageablePCHandler(); - - HRESULT - GetData( - _Inout_ XDPrintSchema::PageImageableSize::PageImageableData* pPageImageableData - ); -}; - diff --git a/print/XPSDrvSmpl/src/common/pimageschema.cpp b/print/XPSDrvSmpl/src/common/pimageschema.cpp deleted file mode 100644 index bd9dd484..00000000 --- a/print/XPSDrvSmpl/src/common/pimageschema.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pimageschema.cpp - -Abstract: - - PageImageableSize PrintSchema implementation. This implements the features, - options and enumerations that describe the PrintSchema PageImageableSize feature. - ---*/ - -#include "precomp.h" -#include "pimageschema.h" - -LPCWSTR XDPrintSchema::PageImageableSize::PAGE_IMAGEABLE_PROPERTY = L"PageImageableSize"; - -LPCWSTR XDPrintSchema::PageImageableSize::PAGE_IMAGEABLE_PROPS[] = { - L"ImageableSizeWidth", - L"ImageableSizeHeight", - L"ImageableArea" -}; - -LPCWSTR XDPrintSchema::PageImageableSize::PAGE_IMAGEABLE_PROPS_AREA[] = { - L"OriginWidth", - L"OriginHeight", - L"ExtentWidth", - L"ExtentHeight" -}; - diff --git a/print/XPSDrvSmpl/src/common/pimageschema.h b/print/XPSDrvSmpl/src/common/pimageschema.h deleted file mode 100644 index 760b1d2b..00000000 --- a/print/XPSDrvSmpl/src/common/pimageschema.h +++ /dev/null @@ -1,62 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pimageschema.h - -Abstract: - - PageImageableSize PrintSchema definition. This defines the features, options - and enumerations that describe the PrintSchema PageImageableSize feature within - a XDPrintSchema::PageImageableSize namespace. - ---*/ - -#pragma once - -#include "schema.h" - -namespace XDPrintSchema -{ - // - // PageImageSize elements described as Printschema keywords - // - namespace PageImageableSize - { - // - // The property name - // - extern LPCWSTR PAGE_IMAGEABLE_PROPERTY; - - enum EPageImageableProps - { - ImageableSizeWidth = 0, EPageImageablePropsMin = 0, - ImageableSizeHeight, - ImageableArea, - EPageImageablePropsMax - }; - - extern LPCWSTR PAGE_IMAGEABLE_PROPS[EPageImageablePropsMax]; - - enum EPageImageablePropsArea - { - OriginWidth = 0, EPageImageablePropsAreaMin = 0, - OriginHeight, - ExtentWidth, - ExtentHeight, - EPageImageablePropsAreaMax - }; - - extern LPCWSTR PAGE_IMAGEABLE_PROPS_AREA[EPageImageablePropsAreaMax]; - } -} - diff --git a/print/XPSDrvSmpl/src/common/porientdata.h b/print/XPSDrvSmpl/src/common/porientdata.h deleted file mode 100644 index 4e3a181d..00000000 --- a/print/XPSDrvSmpl/src/common/porientdata.h +++ /dev/null @@ -1,42 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - porientdata.h - -Abstract: - - PageOrientation data structure definition. This provides a convenient - description of the PrintSchema PageOrientation feature. - ---*/ - -#pragma once - -#include "porientschema.h" - -namespace XDPrintSchema -{ - namespace PageOrientation - { - struct PageOrientationData - { - PageOrientationData() : - orientation(Landscape) - { - } - - EOrientationOption orientation; - }; - } -} - diff --git a/print/XPSDrvSmpl/src/common/porientpthndlr.cpp b/print/XPSDrvSmpl/src/common/porientpthndlr.cpp deleted file mode 100644 index 52e3e7ed..00000000 --- a/print/XPSDrvSmpl/src/common/porientpthndlr.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - porientpthndlr.cpp - -Abstract: - - PageOrientation PrintTicket handler implementation. Derived from CPTHandler, - this provides a PageOrientation specific Get methods acting on the passed in - PrintTicket (as a DOM document). - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "porientpthndlr.h" - -using XDPrintSchema::PageOrientation::PageOrientationData; -using XDPrintSchema::PageOrientation::EOrientationOption; -using XDPrintSchema::PageOrientation::EOrientationOptionMin; -using XDPrintSchema::PageOrientation::EOrientationOptionMax; -using XDPrintSchema::PageOrientation::ORIENTATION_FEATURE; -using XDPrintSchema::PageOrientation::ORIENTATION_OPTIONS; - -/*++ - -Routine Name: - - CPageOrientationPTHandler::CPageOrientationPTHandler - -Routine Description: - - CPageOrientationPTHandler class constructor - -Arguments: - - pPrintTicket - Pointer to the DOM document representation of the PrintTicket - -Return Value: - - None - ---*/ -CPageOrientationPTHandler::CPageOrientationPTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ) : - CPTHandler(pPrintTicket) -{ -} - -/*++ - -Routine Name: - - CPageOrientationPTHandler::~CPageOrientationPTHandler - -Routine Description: - - CPageOrientationPTHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPageOrientationPTHandler::~CPageOrientationPTHandler() -{ -} - -/*++ - -Routine Name: - - CPageOrientationPTHandler::GetData - -Routine Description: - - The routine fills the data structure passed in with page orientation data retrieved from - the PrintTicket passed to the class constructor. - -Arguments: - - pPageOrientationData - Pointer to the page orientation data structure to be filled in - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - Feature not present in PrintTicket - E_* - On error - ---*/ -HRESULT -CPageOrientationPTHandler::GetData( - _Inout_ PageOrientationData* pPageOrientationData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPageOrientationData, E_POINTER))) - { - CComBSTR bstrPOOption; - - if (SUCCEEDED(hr = GetFeatureOption(CComBSTR(ORIENTATION_FEATURE), &bstrPOOption))) - { - for (EOrientationOption poOpt = EOrientationOptionMin; - poOpt < EOrientationOptionMax; - poOpt = static_cast(poOpt + 1)) - { - if (bstrPOOption == ORIENTATION_OPTIONS[poOpt]) - { - pPageOrientationData->orientation = poOpt; - break; - } - } - } - } - - // - // Validate the data - // - if (SUCCEEDED(hr)) - { - if (pPageOrientationData->orientation < EOrientationOptionMin || - pPageOrientationData->orientation >= EOrientationOptionMax) - { - hr = E_FAIL; - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/porientpthndlr.h b/print/XPSDrvSmpl/src/common/porientpthndlr.h deleted file mode 100644 index 138bbc0c..00000000 --- a/print/XPSDrvSmpl/src/common/porientpthndlr.h +++ /dev/null @@ -1,45 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - porientpthndlr.h - -Abstract: - - PageOrientation PrintTicket handling definition. The PageOrientation PT handler - is used to extract PageOrientation settings from a PrintTicket and populate - the PageOrientation data structure with the retrieved settings. The class also - defines a method for setting the feature in the PrintTicket given the - data structure. - ---*/ - -#pragma once - -#include "pthndlr.h" -#include "porientdata.h" - -class CPageOrientationPTHandler : public CPTHandler -{ -public: - CPageOrientationPTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ); - - virtual ~CPageOrientationPTHandler(); - - HRESULT - GetData( - _Inout_ XDPrintSchema::PageOrientation::PageOrientationData* pPageOrientationData - ); -}; - diff --git a/print/XPSDrvSmpl/src/common/porientschema.cpp b/print/XPSDrvSmpl/src/common/porientschema.cpp deleted file mode 100644 index 524001c1..00000000 --- a/print/XPSDrvSmpl/src/common/porientschema.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - porientschema.cpp - -Abstract: - - PageOrientation PrintSchema implementation. This implements the features, - options and enumerations that describe the PrintSchema PageOrientation feature. - ---*/ - -#include "precomp.h" -#include "porientschema.h" - -LPCWSTR XDPrintSchema::PageOrientation::ORIENTATION_FEATURE = L"PageOrientation"; - -LPCWSTR XDPrintSchema::PageOrientation::ORIENTATION_OPTIONS[EOrientationOptionMax] = { - L"Landscape", - L"Portrait", - L"ReverseLandscape", - L"ReversePortrait" -}; - diff --git a/print/XPSDrvSmpl/src/common/porientschema.h b/print/XPSDrvSmpl/src/common/porientschema.h deleted file mode 100644 index 2fdca11c..00000000 --- a/print/XPSDrvSmpl/src/common/porientschema.h +++ /dev/null @@ -1,55 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - porientschema.h - -Abstract: - - PageOrientation PrintSchema definition. This defines the features, options - and enumerations that describe the PrintSchema PageOrientation feature within - a XDPrintSchema::PageOrientation namespace. - ---*/ - -#pragma once - -#include "schema.h" - -namespace XDPrintSchema -{ - // - // PageOrientation elements described as Printschema keywords - // - namespace PageOrientation - { - // - // The feature name - // - extern LPCWSTR ORIENTATION_FEATURE; - - // - // Paper orientation options - // - enum EOrientationOption - { - Landscape = 0, EOrientationOptionMin = 0, - Portrait, - ReverseLandscape, - ReversePortrait, - EOrientationOptionMax - }; - - extern LPCWSTR ORIENTATION_OPTIONS[EOrientationOptionMax]; - } -} - diff --git a/print/XPSDrvSmpl/src/common/precomp.h b/print/XPSDrvSmpl/src/common/precomp.h deleted file mode 100644 index d871a9fd..00000000 --- a/print/XPSDrvSmpl/src/common/precomp.h +++ /dev/null @@ -1,102 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - precomp.h - -Abstract: - - Precompiled header for all filters - ---*/ - -#pragma once - -// -// Annotate this as a usermode driver for static analysis -// -#include -_Analysis_mode_(_Analysis_code_type_user_driver_) - -// -// Standard Annotation Language include -// -#include - -// -// Windows includes -// -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif // WIN32_LEAN_AND_MEAN -#include -#include - -// -// COM includes -// -#include -#include - -// -// ATL Includes -// -#include - - -#pragma warning (push) -#pragma warning (disable:4458) -// -// GDIPlus includes -// -#include -#pragma warning (pop) - -// -// MSXML includes -// -#include - -// -// WCS Includes -// -#include - -// -// Filter pipeline includes -// -#include -#include -#include -#include - -// -// Standard library includes -// -#include -#include -#include -#include -#include - -// -// Commonly used namespaces -// -using namespace std; -using namespace Gdiplus; - -// -// String safe includes - included last to prevent build warnings -// -#include - -#include "common.ver" diff --git a/print/XPSDrvSmpl/src/common/precompsrc.cpp b/print/XPSDrvSmpl/src/common/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/XPSDrvSmpl/src/common/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/common/privatedefs.h b/print/XPSDrvSmpl/src/common/privatedefs.h deleted file mode 100644 index 0c8cb96d..00000000 --- a/print/XPSDrvSmpl/src/common/privatedefs.h +++ /dev/null @@ -1,300 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - privatedefs.h - -Abstract: - - Definitions for private PrintTicket/PrintCapabilities properties for watermark and page scaling features. - ---*/ - -#pragma once - -// -// Macro to return the number of elements in an array -// -#define numof(n) (sizeof(n) / sizeof(n[0])) - -// -// Structure definition for the Private Parameter Defs (Integer Type) -// -typedef struct _PRIVATE_DEF_INTS -{ - PCSTR property_name; - BOOL is_public; - PCSTR display_name; - INT default_value; - INT min_length; - INT max_length; - INT multiple; - PCSTR unit_type; -}PRIVATE_DEF_INTEGERS; - -// -// Structure definition for the Private Parameter Defs (String Type) -// -typedef struct _PRIVATE_DEF_STRS -{ - PCSTR property_name; - PCSTR display_name; - PCSTR default_value; - INT min_length; - INT max_length; - PCSTR unit_type; -}PRIVATE_DEF_STRINGS; - -// -// Structure definition for the Private Parameter Defs (Decimal Type) -// -typedef struct _PRIVATE_DEF_DECS -{ - PCSTR property_name; - PCSTR display_name; - REAL default_value; - REAL min_length; - REAL max_length; - REAL multiple; - PCSTR unit_type; -}PRIVATE_DEF_DECIMALS; - -// -// Table of values for private integer watermark properties. -// -CONST PRIVATE_DEF_INTEGERS wmParamDefIntegers[] = -{ - { - "PageWatermarkTextAngle", - TRUE, - NULL, - 0, - 0, - 360, - 1, - "Degrees" - }, - { - "PageWatermarkOriginWidth", - TRUE, - NULL, - 0, - -INT_MAX, - INT_MAX, - 1, - "Microns" - }, - { - "PageWatermarkOriginHeight", - TRUE, - NULL, - HUNDREDTH_OFINCH_TO_MICRON(100), - -INT_MAX, - INT_MAX, - 1, - "Microns" - }, - { - "PageWatermarkSizeWidth", - FALSE, - NULL, - HUNDREDTH_OFINCH_TO_MICRON(100), - 0, - INT_MAX, - 1, - "Microns" - }, - { - "PageWatermarkSizeHeight", - FALSE, - NULL, - HUNDREDTH_OFINCH_TO_MICRON(100), - 0, - INT_MAX, - 1, - "Microns" - }, - { - "PageWatermarkTextFontSize", - TRUE, - NULL, - 72, - 1, - INT_MAX, - 1, - "Points Per Inch" - }, - { - "PageWatermarkTextColor", - TRUE, - NULL, - (INT) 0xFFFF0000, - 0, - (INT) 0xFFFFFFFF, - 1, - "sRGB" - }, - { - "PageWatermarkTransparency", - TRUE, - NULL, - 50, - 0, - 100, - 1, - "Transparency" - }, -}; - -// -// enum lookup into above table -// -enum eWMParamDefIntegers -{ - ePageWatermarkAngle = 0, - ePageWatermarkOriginWidth, - ePageWatermarkOriginHeight, - ePageWatermarkSizeWidth, - ePageWatermarkSizeHeight, - ePageWatermarkTextFontSize, - ePageWatermarkTextColor, - ePageWatermarkTransparency, -}; - -// -// Table of values for private string watermark properties. -// -CONST PRIVATE_DEF_STRINGS wmParamDefStrings[] = -{ - { - "PageWatermarkTextText", - NULL, - "CONFIDENTIAL", - 0, - 20, - "characters" - } -}; - -// -// enum lookup into above table -// -enum eWMParamDefStrings -{ - ePageWatermarkTextText = 0 -}; - -// -// Table of values for private integer page scaling properties. -// -CONST PRIVATE_DEF_INTEGERS pgscParamDefIntegers[] = -{ - { - "PageScalingScaleWidth", - TRUE, - NULL, - 100, - 1, - 1000, - 1, - "Percent" - }, - { - "PageScalingScaleHeight", - TRUE, - NULL, - 100, - 1, - 1000, - 1, - "Percent" - }, - { - "PageScalingScale", - TRUE, - NULL, - 100, - 1, - 1000, - 1, - "Percent" - }, - { - "PageScalingOffsetWidth", - TRUE, - NULL, - 0, - -INT_MAX, - INT_MAX, - 1, - "Microns" - }, - { - "PageScalingOffsetHeight", - TRUE, - NULL, - 0, - -INT_MAX, - INT_MAX, - 1, - "Microns" - }, -}; - -// -// enum lookup into above table -// -enum ePGSCParamDefIntegers -{ - ePageScalingScaleWidth = 0, - ePageScalingScaleHeight, - ePageScalingScale, - ePageScalingOffsetWidth, - ePageScalingOffsetHeight, -}; - -// -// Table of values for private integer booklet gutter properties. -// -CONST PRIVATE_DEF_INTEGERS bkParamDefIntegers[] = -{ - { - "JobBindAllDocumentsGutter", - TRUE, - NULL, - 0, - -INT_MAX, - INT_MAX, - 0, - "Microns" - }, - { - "DocumentBindingGutter", - TRUE, - NULL, - 0, - -INT_MAX, - INT_MAX, - 0, - "Microns" - } -}; - -// -// enum lookup into above table -// -enum eBindingParamDefIntegers -{ - eJobBindAllDocumentsGutter = 0, - eDocumentBindingGutter, -}; - diff --git a/print/XPSDrvSmpl/src/common/pshndlr.cpp b/print/XPSDrvSmpl/src/common/pshndlr.cpp deleted file mode 100644 index 90acda70..00000000 --- a/print/XPSDrvSmpl/src/common/pshndlr.cpp +++ /dev/null @@ -1,1836 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -File Name: - - pshndlr.cpp - -Abstract: - - Base PrintSchema Document handler class implementation. - This class provides common PrintTicket / PrintCapabilities handling functionality. - A class can derive from this base class to get PrintTicket/PrintCapabilities - unspecific XML handling functionality. - - Note: The PrintSchema handler code is only intended to work with the sdtandard - public PrintSchema keywords. - ---*/ - - -// -// Note on handling missing DOM nodes: -// -// Convert MSXML's S_FALSE to E_ELEMENT_NOT_FOUND. This allows clients to -// use the SUCCEEDED macro more effectively. -// -// E_ELEMENT_NOT_FOUND should not be propogated as an error to the -// filter pipeline or config module - treat as though the requested feature -// has not been enabled. -// - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "pshndlr.h" - -using XDPrintSchema::FRAMEWORK_URI; -using XDPrintSchema::KEYWORDS_URI; -using XDPrintSchema::SCHEMA_INST_URI; -using XDPrintSchema::SCHEMA_DEF_URI; -using XDPrintSchema::PROPERTY_ELEMENT_NAME; -using XDPrintSchema::NAME_ATTRIBUTE_NAME; -using XDPrintSchema::VALUE_ELEMENT_NAME; -using XDPrintSchema::SCHEMA_TYPE; -using XDPrintSchema::SCORED_PROP_ELEMENT_NAME; -using XDPrintSchema::SCHEMA_STRING; -using XDPrintSchema::SCHEMA_INTEGER; -using XDPrintSchema::SCHEMA_DECIMAL; -using XDPrintSchema::PARAM_REF_ELEMENT_NAME; -using XDPrintSchema::PARAM_INIT_ELEMENT_NAME; -using XDPrintSchema::SCHEMA_INST_URI; - -static LPCWSTR szSelectNS = L"SelectionNamespaces"; -static LPCWSTR szTmpNS = L"psf"; -static LPCWSTR szNSSelection = L"xmlns:%s='%s'"; -static LPCWSTR szSelectLang = L"SelectionLanguage"; -static LPCWSTR szLangSection = L"XPath"; - -static LPCWSTR szPTRootQuery = L"//%s:%s"; - -/*++ - -Routine Name: - - CPSHandler::CPSHandler - -Routine Description: - - CPSHandler class constructor - -Arguments: - - pDOMDocument - Pointer to the DOM document representation of the PrintTicket/PrintCapabilities - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CPSHandler::CPSHandler( - _In_z_ BSTR bstrDocumentType, - _In_ IXMLDOMDocument2 *pPrintDocument - ) : - m_bstrDocumentType(bstrDocumentType), - m_pPrintDocument(pPrintDocument) -{ - ASSERTMSG(m_pPrintDocument != NULL, "NULL PrintDocument passed to PS manager.\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pPrintDocument, E_PENDING))) - { - try - { - // - // Make sure XPath selection language is set - // - if (SUCCEEDED(hr = m_pPrintDocument->setProperty(CComBSTR(szSelectLang), CComVariant(szLangSection)))) - { - // - // Construct the alias namespace string - // - CStringXDW cstrNamespaces; - cstrNamespaces.Format(szNSSelection, szTmpNS, FRAMEWORK_URI); - - // - // Specify an alias PrintSchema namespace prefix to allow us to find the real ones - // - if (SUCCEEDED(hr = m_pPrintDocument->setProperty(CComBSTR(szSelectNS), CComVariant(cstrNamespaces)))) - { - if (SUCCEEDED(hr = GetPrefixFromURI(CComBSTR(FRAMEWORK_URI), &m_bstrFrameworkPrefix)) && - SUCCEEDED(hr = GetPrefixFromURI(CComBSTR(KEYWORDS_URI), &m_bstrKeywordsPrefix)) && - SUCCEEDED(hr = GetPrefixFromURI(CComBSTR(SCHEMA_INST_URI), &m_bstrSchemaInstPrefix)) && - SUCCEEDED(hr = GetPrefixFromURI(CComBSTR(SCHEMA_DEF_URI), &m_bstrSchemaPrefix))) - { - CStringXDW cstrNSUserPrefix(L"ns0000:"); - m_bstrUserKeywordsPrefix.Empty(); - m_bstrUserKeywordsPrefix.Attach(cstrNSUserPrefix.AllocSysString()); - - // - // Restore the original namespace prefix for the PrintSchema framework - // - CComBSTR bstrOrgNamespaces; - CStringXDW cstrNSPrefix(m_bstrFrameworkPrefix); - - INT iIndex = cstrNSPrefix.Find(L":"); - if (iIndex != -1 && - cstrNSPrefix.Delete(iIndex, 1) > 0) - { - CStringXDW cstrOrgNamespaces; - cstrOrgNamespaces.Format(szNSSelection, static_cast(cstrNSPrefix), FRAMEWORK_URI); - - hr = m_pPrintDocument->setProperty(CComBSTR(szSelectNS), CComVariant(cstrOrgNamespaces)); - } - else - { - RIP("Could not create namespace prefix correctly\n"); - hr = E_FAIL; - } - } - } - else - { - ERR("Failed to set SelectionNamespaces.\n"); - } - } - else - { - RIP("Failed to set SelectionLanguage.\n"); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CPSHandler::~CPSHandler - -Routine Description: - - CPSHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPSHandler::~CPSHandler() -{ -} - -/*++ - -Routine Name: - - CPSHandler::DeleteNode - -Routine Description: - - This routine deletes the given node from the PrintDocument - -Arguments: - - pNode - Pointer to the DOM node to be deleted - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::DeleteNode( - _In_ IXMLDOMNode* pNode - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pNode, E_POINTER))) - { - CComPtr pParentNode(NULL); - CComPtr pDeletedNode(NULL); - - if (SUCCEEDED(hr = pNode->get_parentNode(&pParentNode)) && - hr != S_FALSE && - SUCCEEDED(hr = pParentNode->removeChild(pNode, &pDeletedNode)) && - pDeletedNode == NULL) - { - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::GetNode - -Routine Description: - - This routine retrieves a node given an XPath query - -Arguments: - - bstrNodeQuery - The XPath query for a node - ppNode - Pointer to an IXMLDOMNode pointer that recieves the node retrieved - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::GetNode( - _In_z_ BSTR bstrNodeQuery, - _Outptr_ IXMLDOMNode** ppNode - ) -{ - // - // We should have the PrintDocment in place - // - ASSERTMSG(m_pPrintDocument != NULL, "NULL PS detected whilst retrieving node.\n"); - - // - // Method which takes a query string and returns the first node that matches - // - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppNode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pPrintDocument, E_PENDING))) - { - *ppNode = NULL; - if (SysStringLen(bstrNodeQuery) == 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - // - // Get the node from the PrintDocument - // - hr = m_pPrintDocument->selectSingleNode(bstrNodeQuery, ppNode); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::DeletePrivateFeatures - -Routine Description: - - This routine finds and deletes features with values defined in the - private namespace passed in - -Arguments: - - bstrPrivateNS - the private namespace - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::DeletePrivateFeatures( - _In_z_ BSTR bstrPrivateNS - ) -{ - HRESULT hr = S_OK; - - if (SysStringLen(bstrPrivateNS) > 0) - { - CComBSTR bstrNSPrefix; - if (SUCCEEDED(hr = GetPrefixFromURI(bstrPrivateNS, &bstrNSPrefix))) - { - // - // Find all root feature elements in the namespace - // - CComPtr pNodeList(NULL); - - CComBSTR bstrFeatureQuery(L"//"); - bstrFeatureQuery += m_bstrFrameworkPrefix; - bstrFeatureQuery += L"Feature"; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = m_pPrintDocument->selectNodes(bstrFeatureQuery, &pNodeList)) && - SUCCEEDED(hr = pNodeList->reset())) - { - // - // Delete all the feature with name attributes using the private namespace - // - CComPtr pDeleteNode(NULL); - - while (SUCCEEDED(hr) && - SUCCEEDED(hr = pNodeList->nextNode(&pDeleteNode)) && - hr != S_FALSE) - { - CComPtr pDeleteNodeAtts(NULL); - CComPtr pNameNode(NULL); - CComVariant varNameValue; - - if (SUCCEEDED(hr = pDeleteNode->get_attributes(&pDeleteNodeAtts)) && - hr != S_FALSE && - SUCCEEDED(hr = pDeleteNodeAtts->getNamedItem(CComBSTR(L"name"), &pNameNode)) && - hr != S_FALSE && - SUCCEEDED(hr = pNameNode->get_nodeValue(&varNameValue)) && - hr != S_FALSE) - { - try - { - CStringXDW cstrNameValue(varNameValue.bstrVal); - - if (cstrNameValue.Find(bstrNSPrefix) == 0) - { - hr = DeleteNode(pDeleteNode); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - pDeleteNode = NULL; - } - } - } - } - else - { - hr = E_INVALIDARG; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::CreateProperty - -Routine Description: - - This routine creates a property element of the given name. Note: this - method only creates the property element; it is up to the caller to - set the property value - -Arguments: - - bstrPropName - The name of the property - ppPropElement - Pointer to a IXMLDOMElement pointer that recieves the newly created Property element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::CreateProperty( - _In_ CONST BSTR bstrPropName, - _Outptr_ IXMLDOMElement** ppPropElement - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppPropElement, E_POINTER))) - { - *ppPropElement = NULL; - - if (SysStringLen(bstrPropName) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - CComBSTR bstrTagName(m_bstrFrameworkPrefix); - bstrTagName += PROPERTY_ELEMENT_NAME; - - CComBSTR bstrAttribName(szTmpNS); - bstrAttribName += L":"; - bstrAttribName += bstrPropName; - - hr = CreateXMLElement(bstrTagName, FRAMEWORK_URI, ppPropElement); - - if (SUCCEEDED(hr)) - { - if (*ppPropElement != NULL) - { - hr = CreateXMLAttribute(*ppPropElement, NAME_ATTRIBUTE_NAME, NULL, bstrAttribName ); - } - else - { - hr = E_FAIL; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::CreateProperty - -Routine Description: - - This routine creates a property element of the given name. - -Arguments: - - bstrPropName - The name of the property to be created - bstrType - The type of the property value (integer, string etc.) - bstrValue - The value of the property - ppPropElement - Pointer to an IXMLDOMElement pointer that recieves the new element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::CreateProperty( - _In_ CONST BSTR bstrPropName, - _In_ CONST BSTR bstrType, - _In_ CONST BSTR bstrValue, - _Outptr_ IXMLDOMElement** ppPropElement - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppPropElement, E_POINTER))) - { - if (SysStringLen(bstrPropName) <= 0 || - SysStringLen(bstrType) <= 0 || - SysStringLen(bstrValue) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - // - // Create the scored property and value node - // - if (SUCCEEDED(hr = CreateProperty(bstrPropName, ppPropElement))) - { - CComPtr pValue(NULL); - - CComBSTR bstrValueElement(m_bstrFrameworkPrefix); - bstrValueElement += VALUE_ELEMENT_NAME; - - CComBSTR bstrTypeAttribName(m_bstrSchemaInstPrefix); - bstrTypeAttribName += SCHEMA_TYPE; - - CComBSTR bstrTypeAttribValue(m_bstrSchemaPrefix); - bstrTypeAttribValue += bstrType; - - hr = CreateXMLElement(bstrValueElement, FRAMEWORK_URI, &pValue); - - if(SUCCEEDED(hr)) - { - if (SUCCEEDED(hr = CreateXMLAttribute(pValue, bstrTypeAttribName, SCHEMA_INST_URI, bstrTypeAttribValue )) && - SUCCEEDED(hr = pValue->put_text(bstrValue))) - { - hr = (*ppPropElement)->appendChild(pValue, NULL); - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::CreateFWProperty - -Routine Description: - - This routine creates a property element of the given name. Note: this - method only creates the property element; it is up to the caller to - set the property value - -Arguments: - - bstrPropName - The name of the property - ppPropElement - Pointer to a IXMLDOMElement pointer that recieves the newly created Property element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::CreateFWProperty( - _In_ CONST BSTR bstrPropName, - _Outptr_ IXMLDOMElement** ppPropElement - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppPropElement, E_POINTER))) - { - *ppPropElement = NULL; - - if (SysStringLen(bstrPropName) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - CComBSTR bstrTagName(m_bstrFrameworkPrefix); - bstrTagName += PROPERTY_ELEMENT_NAME; - - CComBSTR bstrAttribName(m_bstrFrameworkPrefix); - bstrAttribName += bstrPropName; - - hr = CreateXMLElement(bstrTagName, FRAMEWORK_URI, ppPropElement); - - if (SUCCEEDED(hr)) - { - if (*ppPropElement != NULL) - { - hr = CreateXMLAttribute(*ppPropElement, NAME_ATTRIBUTE_NAME, NULL, bstrAttribName ); - } - else - { - hr = E_FAIL; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::CreateFWProperty - -Routine Description: - - This routine creates a property element of the given name. - -Arguments: - - bstrPropName - The name of the property to be created - bstrType - The type of the property value (integer, string etc.) - bstrValue - The value of the property - ppPropElement - Pointer to an IXMLDOMElement pointer that recieves the new element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::CreateFWProperty( - _In_ CONST BSTR bstrPropName, - _In_ CONST BSTR bstrType, - _In_ CONST BSTR bstrValue, - _Outptr_ IXMLDOMElement** ppPropElement - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppPropElement, E_POINTER))) - { - if (SysStringLen(bstrPropName) <= 0 || - SysStringLen(bstrType) <= 0 || - SysStringLen(bstrValue) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - // - // Create the scored property and value node - // - if (SUCCEEDED(hr = CreateFWProperty(bstrPropName, ppPropElement))) - { - CComPtr pValue(NULL); - - CComBSTR bstrValueElement(m_bstrFrameworkPrefix); - bstrValueElement += VALUE_ELEMENT_NAME; - - CComBSTR bstrTypeAttribName(m_bstrSchemaInstPrefix); - bstrTypeAttribName += SCHEMA_TYPE; - - CComBSTR bstrTypeAttribValue(m_bstrSchemaPrefix); - bstrTypeAttribValue += bstrType; - - hr = CreateXMLElement(bstrValueElement, FRAMEWORK_URI, &pValue); - - if(SUCCEEDED(hr)) - { - if (SUCCEEDED(hr = CreateXMLAttribute(pValue, bstrTypeAttribName, SCHEMA_INST_URI, bstrTypeAttribValue )) && - SUCCEEDED(hr = pValue->put_text(bstrValue))) - { - hr = (*ppPropElement)->appendChild(pValue, NULL); - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::CreateScoredProperty - -Routine Description: - - This routine creates a scored property. Note: this does not intialise - the scored property value - this is the responsibility of the caller - -Arguments: - - bstrPropName - The name of the property element to be created - ppScoredPropElement - Pointer to an IXMLDOMElement that recieves the new element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::CreateScoredProperty( - _In_ CONST BSTR bstrPropName, - _Outptr_ IXMLDOMElement** ppScoredPropElement - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppScoredPropElement, E_POINTER))) - { - *ppScoredPropElement = NULL; - - if (SysStringLen(bstrPropName) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - CComBSTR bstrTagName(m_bstrFrameworkPrefix); - bstrTagName += SCORED_PROP_ELEMENT_NAME; - - CComBSTR bstrAttribName(m_bstrKeywordsPrefix); - bstrAttribName += bstrPropName; - - hr = CreateXMLElement(bstrTagName, FRAMEWORK_URI, ppScoredPropElement); - - if (SUCCEEDED(hr)) - { - if (*ppScoredPropElement != NULL) - { - hr = CreateXMLAttribute(*ppScoredPropElement, NAME_ATTRIBUTE_NAME, NULL, bstrAttribName ); - } - else - { - hr = E_FAIL; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::CreateScoredProperty - -Routine Description: - - This routine creates a scored property. - -Arguments: - - bstrPropName - The name of the property element to be created - bstrType - The type of the value to be created (integer, string etc.) - bstrValue - The value to be set as a string - ppScoredPropElement - Pointer to an IXMLDOMElement that recieves the new element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::CreateScoredProperty( - _In_ CONST BSTR bstrPropName, - _In_ CONST BSTR bstrType, - _In_ CONST BSTR bstrValue, - _Outptr_ IXMLDOMElement** ppScoredPropElement - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppScoredPropElement, E_POINTER))) - { - if (SysStringLen(bstrPropName) <= 0 || - SysStringLen(bstrType) <= 0 || - SysStringLen(bstrValue) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - // - // Create the scored property and value node - // - if (SUCCEEDED(hr = CreateScoredProperty(bstrPropName, ppScoredPropElement))) - { - CComPtr pValue(NULL); - - CComBSTR bstrValueElement(m_bstrFrameworkPrefix); - bstrValueElement += VALUE_ELEMENT_NAME; - - CComBSTR bstrTypeAttribName(m_bstrSchemaInstPrefix); - bstrTypeAttribName += SCHEMA_TYPE; - - CComBSTR bstrTypeAttribValue(m_bstrSchemaPrefix); - bstrTypeAttribValue += bstrType; - - hr = CreateXMLElement(bstrValueElement, FRAMEWORK_URI, &pValue); - - if(SUCCEEDED(hr)) - { - if (SUCCEEDED(hr = CreateXMLAttribute(pValue, bstrTypeAttribName, SCHEMA_INST_URI, bstrTypeAttribValue )) && - SUCCEEDED(hr = pValue->put_text(bstrValue))) - { - hr = (*ppScoredPropElement)->appendChild(pValue, NULL); - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::CreateScoredProperty - -Routine Description: - - This routine creates a scored property of type string. - -Arguments: - - bstrPropName - The name of the property element to be created - bstrValue - The string value to be set - ppScoredPropElement - Pointer to an IXMLDOMElement that recieves the new element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::CreateScoredProperty( - _In_ CONST BSTR bstrPropName, - _In_ CONST BSTR bstrValue, - _Outptr_ IXMLDOMElement** ppScoredPropElement - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppScoredPropElement, E_POINTER))) - { - if (SysStringLen(bstrPropName) > 0 && - SysStringLen(bstrValue) > 0) - { - // - // Create the scored property and value node - // - hr = CreateScoredProperty(bstrPropName, CComBSTR(SCHEMA_STRING), bstrValue, ppScoredPropElement); - } - else - { - hr = E_INVALIDARG; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::CreateScoredProperty - -Routine Description: - - This routine creates a scored property of type INT. - -Arguments: - - bstrPropName - The name of the property element to be created - intValue - The INT value to be set - ppScoredPropElement - Pointer to an IXMLDOMElement that recieves the new element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::CreateScoredProperty( - _In_ CONST BSTR bstrPropName, - _In_ CONST INT intValue, - _Outptr_ IXMLDOMElement** ppScoredPropElement - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppScoredPropElement, E_POINTER))) - { - if (SysStringLen(bstrPropName) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - try - { - // - // Construct the value string - // - CStringXDW cstrValue; - cstrValue.Format(L"%i", intValue); - - // - // Create the scored property and value node - // - hr = CreateScoredProperty(bstrPropName, - CComBSTR(SCHEMA_INTEGER), - CComBSTR(cstrValue.AllocSysString()), - ppScoredPropElement); - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::CreateScoredProperty - -Routine Description: - - This routine creates a scored property of type REAL. - -Arguments: - - bstrPropName - The name of the property element to be created - realValue - The REAL value to be set - ppScoredPropElement - Pointer to an IXMLDOMElement that recieves the new element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::CreateScoredProperty( - _In_ CONST BSTR bstrPropName, - _In_ CONST REAL realValue, - _Outptr_ IXMLDOMElement** ppScoredPropElement - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppScoredPropElement, E_POINTER))) - { - if (SysStringLen(bstrPropName) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - try - { - // - // Construct the value string - // - CStringXDW cstrValue; - cstrValue.Format(L"%.2f", realValue); - - // - // Create the scored property and value node - // - hr = CreateScoredProperty(bstrPropName, - CComBSTR(SCHEMA_DECIMAL), - CComBSTR(cstrValue.AllocSysString()), - ppScoredPropElement); - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::QueryNode - -Routine Description: - - This routine checks for the existence of a node given the XPath - query passed in - -Arguments: - - bstrQuery - The XPath query defining the node or nodes to be located - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - If node does not exist - E_* - On error - ---*/ -HRESULT -CPSHandler::QueryNode( - _In_z_ BSTR bstrQuery - ) -{ - HRESULT hr = S_OK; - - // - // Validate input parameters - // - if (SysStringLen(bstrQuery) > 0) - { - CComPtr pNode(NULL); - - hr = GetNode(bstrQuery, &pNode); - } - else - { - hr = E_INVALIDARG; - } - - if (hr == S_FALSE) - { - hr = E_ELEMENT_NOT_FOUND; - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::QueryNodeValue - -Routine Description: - - This routine locates the node specified by the XPath query passed in and - returns the value of the "value" attribute as a string. - -Arguments: - - bstrQuery - The XPath query locating the node to retrieve the value for - pbstrOption - Pointer to a BSTR to recieve the value string - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - If node does not exist - E_* - On error - ---*/ -HRESULT -CPSHandler::QueryNodeValue( - _In_z_ BSTR bstrQuery, - _Outptr_ BSTR* pbstrValue - ) -{ - HRESULT hr = S_OK; - - // - // Validate input parameters - // - if (SUCCEEDED(hr = CHECK_POINTER(pbstrValue, E_POINTER))) - { - *pbstrValue = NULL; - - if (SysStringLen(bstrQuery) > 0) - { - hr = GetNodeValue(bstrQuery, pbstrValue); - } - else - { - hr = E_INVALIDARG; - } - } - - if (hr == S_FALSE) - { - hr = E_ELEMENT_NOT_FOUND; - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::QueryNodeValue - -Routine Description: - - This routine locates the node specified by the XPath query passed in and - returns the value of the "value" attribute as an INT. - -Arguments: - - bstrQuery - The XPath query locating the node to retrieve the value for - pValue - Pointer to an INT to recieve the value - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::QueryNodeValue( - _In_z_ BSTR bstrQuery, - _Out_ INT* pValue - ) -{ - HRESULT hr = S_OK; - - CComBSTR bstrValue; - if (SUCCEEDED(hr = CHECK_POINTER(pValue, E_POINTER))) - { - if (SysStringLen(bstrQuery) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = QueryNodeValue(bstrQuery, &bstrValue))) - { - *pValue = static_cast(_wtoi(bstrValue)); - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::QueryNodeValue - -Routine Description: - - This routine locates the node specified by the XPath query passed in and - returns the value of the "value" attribute as a REAL. - -Arguments: - - bstrQuery - The XPath query locating the node to retrieve the value for - pValue - Pointer to a REAL to recieve the value - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::QueryNodeValue( - _In_z_ BSTR bstrQuery, - _Out_ REAL* pValue - ) -{ - HRESULT hr = S_OK; - - CComBSTR bstrValue; - if (SUCCEEDED(hr = CHECK_POINTER(pValue, E_POINTER))) - { - if (SysStringLen(bstrQuery) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = QueryNodeValue(bstrQuery, &bstrValue))) - { - *pValue = static_cast(_wtof(bstrValue)); - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::GetNodeValue - -Routine Description: - - This routine retrieves the value of a node given the XPath query to the node - -Arguments: - - bstrNodeQuery - The XPath query for the node from which the value should be retrieved - pbstrValue - Pointer to ta BSTR that recieves the value of the node - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - -Note: - - The annotation for pbstrValue is intended to express that the BSTR may - be NULL when S_FALSE is returned, but not when S_OK is returned. - - In any case, when a failure HRESULT is returned, all out parameter - annotations are ignored. - ---*/ -HRESULT -CPSHandler::GetNodeValue( - _In_z_ BSTR bstrNodeQuery, - _Inout_ _At_(*pbstrValue, _Pre_maybenull_) - _When_(return == S_FALSE, _At_(*pbstrValue, _Post_maybenull_)) - _When_(return != S_FALSE, _At_(*pbstrValue, _Post_valid_)) - BSTR* pbstrValue - ) -{ - HRESULT hr = S_OK; - - CComPtr pFeatureNode(NULL); - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrValue, E_POINTER))) - { - SysFreeString(*pbstrValue); - *pbstrValue = NULL; - if (SysStringLen(bstrNodeQuery) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = GetNode(bstrNodeQuery, &pFeatureNode)) && - hr != S_FALSE) - { - // - // Scored properties can either be defined as "Value" or "ParameterRef" - // Find out which of these applies to this property and handle accordingly - // - CComBSTR bstrValue(m_bstrFrameworkPrefix); - bstrValue += VALUE_ELEMENT_NAME; - - CComBSTR bstrParamRef(m_bstrFrameworkPrefix); - bstrParamRef += PARAM_REF_ELEMENT_NAME; - - CComVariant varValue; - - CComPtr pPropertyNode(NULL); - if (SUCCEEDED(hr = pFeatureNode->selectSingleNode(bstrValue, &pPropertyNode)) && - hr != S_FALSE) - { - // - // Value node. Just retrieve the node value - // - hr = pPropertyNode->get_nodeTypedValue(&varValue); - } - else if (SUCCEEDED(hr = pFeatureNode->selectSingleNode(bstrParamRef, &pPropertyNode)) && - hr != S_FALSE) - { - // - // Property defined by parameter ref. Retrieve the name and look up the value - // from the parameter init elements - // - CComPtr pParamInitList(NULL); - CComBSTR bstrParamRefValue; - - if (SUCCEEDED(hr = GetAttributeValue(pPropertyNode, CComBSTR(NAME_ATTRIBUTE_NAME), &bstrParamRefValue)) && - hr != S_FALSE && - SUCCEEDED(hr = GetNodes(CComBSTR(PARAM_INIT_ELEMENT_NAME), &pParamInitList)) && - hr != S_FALSE) - { - CComBSTR bstrParamInit; - CComPtr pInitNode(NULL); - - hr = pParamInitList->reset(); - - while (SUCCEEDED(hr) && - hr != S_FALSE) - { - if (SUCCEEDED(hr = pParamInitList->nextNode(&pInitNode)) && hr != S_FALSE && pInitNode != NULL) - { - hr = GetAttributeValue(pInitNode, CComBSTR(NAME_ATTRIBUTE_NAME), &bstrParamInit); - if (SUCCEEDED(hr) && bstrParamInit == bstrParamRefValue) - { - hr = pInitNode->get_nodeTypedValue(&varValue); - break; - } - } - - - // - // Release the node and name before getting the next - // - pInitNode = NULL; - bstrParamInit.Empty(); - } - } - } - - if (SUCCEEDED(hr) && - hr != S_FALSE && - SysStringLen(varValue.bstrVal) > 0) - { - *pbstrValue = ::SysAllocString(varValue.bstrVal); - - if (*pbstrValue == NULL) - { - hr = E_OUTOFMEMORY; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::GetAttributeValue - -Routine Description: - - This routine retrieves the value of a named attribute as a string from a DOM node - -Arguments: - - pNode - Pointer to the DOM node to retrieve the attribute value from - bstrAttribName - The name of the attribute - pbstrResult - Pointer to a BSTR that recieves the attribute value - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::GetAttributeValue( - _In_ CONST IXMLDOMNode* pNode, - _In_z_ BSTR bstrAttribName, - _Outptr_result_maybenull_ BSTR* pbstrResult - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pNode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pbstrResult, E_POINTER))) - { - if (SysStringLen(bstrAttribName) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - *pbstrResult = NULL; - - // - // Map the associated attributes and get the string result - // - CComPtr pIXMLDOMNamedNodeMap(NULL); - CComPtr pSubNode(NULL); - - if (SUCCEEDED(hr = const_cast(pNode)->get_attributes(&pIXMLDOMNamedNodeMap)) && - hr != S_FALSE && - SUCCEEDED(hr = pIXMLDOMNamedNodeMap->getNamedItem(bstrAttribName, &pSubNode)) && - hr != S_FALSE) - { - hr = pSubNode->get_text(pbstrResult); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::GetNodes - -Routine Description: - - This routine returns a list of all the nodes in the PrintTicket with the - specified element name - -Arguments: - - ppParamInit - Pointer to an IXMLDOMNodeList pointer that recieves the node list - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::GetNodes( - _In_ BSTR bstrElementName, - _Outptr_ IXMLDOMNodeList** ppNodeList - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppNodeList, E_POINTER))) - { - if (SysStringLen(bstrElementName) > 0) - { - *ppNodeList = NULL; - - // - // Retrieve all psf:ParameterInit nodes in the PrintTicket - // - CComBSTR bstrParamInitQuery(L"//"); - bstrParamInitQuery += m_bstrFrameworkPrefix; - bstrParamInitQuery += bstrElementName; - - hr = m_pPrintDocument->selectNodes(bstrParamInitQuery, ppNodeList); - } - else - { - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::CreateScoredProperty - -Routine Description: - - This routine creates a scored property using the value node passed in. - -Arguments: - - bstrPropName - The name of the property element to be created - pValueNode - Pointer to the IXMLDOMNode that represents the scored property value - ppScoredPropElement - Pointer to an IXMLDOMElement that recieves the new element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::CreateScoredProperty( - _In_ CONST BSTR bstrPropName, - _In_ IXMLDOMNode* pValueNode, - _Outptr_ IXMLDOMElement** ppScoredPropElement - ) -{ - HRESULT hr = S_OK; - - // - // Validate parameters then create the scored property and value node - // - if (SUCCEEDED(hr = CHECK_POINTER(pValueNode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppScoredPropElement, E_POINTER))) - { - if (SysStringLen(bstrPropName) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CreateScoredProperty(bstrPropName, ppScoredPropElement))) - { - hr = (*ppScoredPropElement)->appendChild(pValueNode, NULL); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPSHandler::GetPrefixFromURI - -Routine Description: - - Obtains the Prefix associated with a Namespace URI from an XML PrintSchema Document. - -Arguments: - - bstrNamespaceURI - Namespace URI to be used in look-up. - bstrNamespacePrefix - Namespace Prefix to be returned. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPSHandler::GetPrefixFromURI( - _In_z_ BSTR bstrNamespaceURI, - _Outptr_result_maybenull_ BSTR* bstrNamespacePrefix - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(bstrNamespacePrefix, E_POINTER))) - { - if (SysStringLen(bstrNamespaceURI) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - *bstrNamespacePrefix = NULL; - - try - { - // - // Construct the Root Query string - // - CStringXDW cstrRootQuery; - cstrRootQuery.Format(szPTRootQuery, szTmpNS, static_cast(m_bstrDocumentType)); - - // - // Find the PrintSchema element so we can retrieve the private namespace prefix - // - CComPtr pPTNode(NULL); - CComPtr pPTAtts(NULL); - - if (SUCCEEDED(hr = GetNode(CComBSTR(cstrRootQuery), &pPTNode)) && - hr != S_FALSE && - SUCCEEDED(hr = pPTNode->get_attributes(&pPTAtts)) && - SUCCEEDED(hr = pPTAtts->reset())) - { - // - // Iterate over all attributes and match the node value against - // the namespace URI - // - BOOL bMatched = FALSE; - CComPtr pAttNode(NULL); - - while (SUCCEEDED(hr) && - !bMatched && - SUCCEEDED(hr = pPTAtts->nextNode(&pAttNode)) && - hr != S_FALSE) - { - CComVariant varValue; - - if (SUCCEEDED(hr = pAttNode->get_nodeValue(&varValue))) - { - if (CComBSTR(varValue.bstrVal) == bstrNamespaceURI) - { - bMatched = TRUE; - } - } - - if (!bMatched) - { - // - // No match - free the attribute node before retrieving the next - // - pAttNode = NULL; - } - } - - if (SUCCEEDED(hr) && - bMatched) - { - // - // If we match then get the node name and strip xmlns: to derive - // the private namespace prefix - // - CStringXDW cstrNSPrefix; - CComBSTR bstrNodeName; - - if (SUCCEEDED(hr = pAttNode->get_nodeName(&bstrNodeName))) - { - cstrNSPrefix = bstrNodeName; - CStringXDW cstrXMLNS(L"xmlns:"); - - if (cstrNSPrefix.Find(cstrXMLNS) != 0 || - cstrNSPrefix.Delete(0, cstrXMLNS.GetLength()) <= 0) - { - ERR("Could not create private namespace prefix correctly\n"); - - hr = E_FAIL; - } - else - { - cstrNSPrefix += L":"; - - SysFreeString(*bstrNamespacePrefix); - *bstrNamespacePrefix = cstrNSPrefix.AllocSysString(); - } - } - } - } - else - { - ERR("Failed to find the PC root element.\n"); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -HRESULT -CPSHandler::CreateXMLAttribute( - _Inout_ IXMLDOMElement *pTarget, - _In_ PCWSTR pszName, - _In_opt_ PCWSTR pszTargetURI, - _In_ PCWSTR pszValue - ) -/*++ - -Routine Description: - - This routine adds a new attribute to the given XML element. The URI - parameter must be present, but may be an empty string. - - If this routine fails, the document being constructed should be - considered invalid, and be thrown out in its entirity. - - The newly created attribute will be appended to the list of attributes on the element - -Arguments: - - pTarget - the element to which the attribute is to be added - pszName - the name of the attribtue - pszTargetURI - the URI in which the attribute should reside - pszValue - the value to put in the attribute - -Returns: - - S_OK on success, else - E_* on failure - ---*/ -{ - HRESULT hr = S_OK; - CComPtr pCurrentAttr; - CComPtr pCurrentNode; - - if( !( pTarget && pszName && pszValue ) ) - { - hr = E_INVALIDARG; - } - - if(SUCCEEDED(hr)) - { - VARIANT type; - VariantInit( &type ); - V_VT(&type) = VT_I4; - V_I4(&type) = NODE_ATTRIBUTE; - - hr = m_pPrintDocument->createNode(type, const_cast(pszName), const_cast(pszTargetURI), &pCurrentNode); - - VariantClear( &type ); - } - - if( SUCCEEDED(hr) ) - { - hr = pCurrentNode->QueryInterface( IID_IXMLDOMAttribute, (void**)&pCurrentAttr ); - } - - if( SUCCEEDED(hr) ) - { - VARIANT attrVal; - BSTR bstrValue = SysAllocString(pszValue); - - if( bstrValue ) - { - VariantInit(&attrVal); - V_VT(&attrVal) = VT_BSTR; - V_BSTR(&attrVal) = bstrValue; - hr = pCurrentAttr->put_value(attrVal); - - if( SUCCEEDED(hr) ) - { - hr = VariantClear(&attrVal); - } - else - { - VariantClear(&attrVal); - } - } - else - { - hr = E_OUTOFMEMORY; - } - } - - if( SUCCEEDED(hr) ) - { - hr = pTarget->setAttributeNode( pCurrentAttr, NULL ); - } - - return hr; -} - -HRESULT -CPSHandler::CreateXMLElement( - _In_ PCWSTR pszName, - _In_ PCWSTR pszTargetURI, - _Out_opt_ IXMLDOMElement **ppEl - ) -/*++ - -Routine Description: - - Create a new DOM element using the given QName and URI. Implemented using DOMDocument->CreateNode. - -Arguments: - - pszName - The QName of the element to be created - pszTargetUri - The namespace in which the created element lives. The - caller does not have control over the prefix... just the URI - ppEl - If the caller needs a pointer to the newly created node, this should - be a non-null - -Return Value: - - S_OK on success, - E_* on failure. Common values that would be expected - include E_OUTOFMEMORY, and E_INVALIDARG. - ---*/ -{ - HRESULT hr = S_OK; - CComPtr pCurrentNode; - - if( !( pszName && pszTargetURI ) ) - { - hr = E_INVALIDARG; - } - - if(SUCCEEDED(hr)) - { - VARIANT type; - VariantInit( &type ); - V_VT(&type) = VT_I4; - V_I4(&type) = NODE_ELEMENT; - hr = m_pPrintDocument->createNode( type, const_cast(pszName), const_cast(pszTargetURI), &pCurrentNode ); - VariantClear( &type ); - } - - // - // Only give the client back the new value element if we succeed. - // - if( SUCCEEDED(hr) && ppEl ) - { - hr = pCurrentNode->QueryInterface( IID_IXMLDOMElement, (void**)ppEl ); - } - - return hr; -} diff --git a/print/XPSDrvSmpl/src/common/pshndlr.h b/print/XPSDrvSmpl/src/common/pshndlr.h deleted file mode 100644 index 22d76863..00000000 --- a/print/XPSDrvSmpl/src/common/pshndlr.h +++ /dev/null @@ -1,218 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -File Name: - - pshndlr.h - -Abstract: - - Base PrintSchema Document handler class definition. - This class provides common PrintTicket / PrintCapabilities handling functionality. - A class can derive from this base class to get PrintTicket/PrintCapabilities - unspecific XML handling functionality. - - Note: The PrintSchema handler code is only intended to work with the sdtandard - public PrintSchema keywords. - ---*/ - -#pragma once - -#include "schema.h" - -typedef vector< CComPtr > PTDOMElementVector; - -class CPSHandler -{ -public: - // - // Constructors and destructors - // - CPSHandler( - _In_z_ BSTR bstrDocumentType, - _In_ IXMLDOMDocument2 *pPrintDocument - ); - - virtual ~CPSHandler(); - -public: - HRESULT - DeleteNode( - _In_ IXMLDOMNode* pNode - ); - - HRESULT - DeletePrivateFeatures( - _In_z_ BSTR bstrPrivateNS - ); - -protected: - HRESULT - QueryNode( - _In_z_ BSTR bstrQuery - ); - - HRESULT - QueryNodeValue( - _In_z_ BSTR bstrQuery, - _Outptr_ BSTR* pbstrValue - ); - - HRESULT - QueryNodeValue( - _In_z_ BSTR bstrQuery, - _Out_ REAL* pValue - ); - - HRESULT - QueryNodeValue( - _In_z_ BSTR bstrQuery, - _Out_ INT* pValue - ); - - HRESULT - GetNodeValue( - _In_z_ BSTR bstrNodeQuery, - _Inout_ _At_(*pbstrValue, _Pre_maybenull_) - _When_(return == S_FALSE, _At_(*pbstrValue, _Post_maybenull_)) - _When_(return != S_FALSE, _At_(*pbstrValue, _Post_valid_)) - BSTR* pbstrValue - ); - - HRESULT - GetAttributeValue( - _In_ CONST IXMLDOMNode* pNode, - _In_z_ BSTR bstrAttribName, - _Outptr_result_maybenull_ BSTR* pbstrResult - ); - - HRESULT - GetNodes( - _In_ BSTR bstrElementName, - _Outptr_ IXMLDOMNodeList** ppNodeList - ); - - HRESULT - CreateProperty( - _In_ CONST BSTR bstrPropName, - _Outptr_ IXMLDOMElement** ppPropElement - ); - - HRESULT - CreateProperty( - _In_ CONST BSTR bstrPropName, - _In_ CONST BSTR bstrType, - _In_ CONST BSTR bstrValue, - _Outptr_ IXMLDOMElement** ppPropElement - ); - - HRESULT - CreateFWProperty( - _In_ CONST BSTR bstrPropName, - _Outptr_ IXMLDOMElement** ppPropElement - ); - - HRESULT - CreateFWProperty( - _In_ CONST BSTR bstrPropName, - _In_ CONST BSTR bstrType, - _In_ CONST BSTR bstrValue, - _Outptr_ IXMLDOMElement** ppPropElement - ); - - HRESULT - CreateScoredProperty( - _In_ CONST BSTR bstrPropName, - _Outptr_ IXMLDOMElement** ppScoredPropElement - ); - - HRESULT - CreateScoredProperty( - _In_ CONST BSTR bstrPropName, - _In_ CONST BSTR bstrType, - _In_ CONST BSTR bstrValue, - _Outptr_ IXMLDOMElement** ppScoredPropElement - ); - - HRESULT - CreateScoredProperty( - _In_ CONST BSTR bstrPropName, - _In_ CONST BSTR bstrValue, - _Outptr_ IXMLDOMElement** ppScoredPropElement - ); - - HRESULT - CreateScoredProperty( - _In_ CONST BSTR bstrPropName, - _In_ CONST INT intValue, - _Outptr_ IXMLDOMElement** ppScoredPropElement - ); - - HRESULT - CreateScoredProperty( - _In_ CONST BSTR bstrPropName, - _In_ CONST REAL realValue, - _Outptr_ IXMLDOMElement** ppScoredPropElement - ); - - HRESULT - CreateScoredProperty( - _In_ CONST BSTR bstrPropName, - _In_ IXMLDOMNode* pValueNode, - _Outptr_ IXMLDOMElement** ppScoredPropElement - ); - - HRESULT - GetNode( - _In_z_ BSTR bstrNodeQuery, - _Outptr_ IXMLDOMNode** ppNode - ); - - HRESULT - CreateXMLAttribute( - _Inout_ IXMLDOMElement *pTarget, - _In_ PCWSTR pszName, - _In_opt_ PCWSTR pszTargetURI, - _In_ PCWSTR pszValue - ); - - HRESULT - CreateXMLElement( - _In_ PCWSTR pszName, - _In_ PCWSTR pszTargetURI, - _Out_opt_ IXMLDOMElement **ppEl - ); - -private: - - HRESULT - GetPrefixFromURI( - _In_z_ BSTR bstrNSURI, - _Outptr_result_maybenull_ BSTR* bstrNSPrefix - ); - -protected: - // - // Document and Type - // - CComPtr m_pPrintDocument; - CComBSTR m_bstrDocumentType; - - // - // W3 namespace prefixes - // - CComBSTR m_bstrSchemaPrefix; - CComBSTR m_bstrSchemaInstPrefix; - - // - // Namespace abbreviations - // - CComBSTR m_bstrFrameworkPrefix; - CComBSTR m_bstrKeywordsPrefix; - CComBSTR m_bstrUserKeywordsPrefix; -}; - diff --git a/print/XPSDrvSmpl/src/common/psizedata.h b/print/XPSDrvSmpl/src/common/psizedata.h deleted file mode 100644 index aad375a4..00000000 --- a/print/XPSDrvSmpl/src/common/psizedata.h +++ /dev/null @@ -1,44 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - psizedata.h - -Abstract: - - PageMediaSize data structure definition. This provides a convenient - description of the PrintSchema PageMediaSize feature. - ---*/ - -#pragma once - -#include "psizeschema.h" - -namespace XDPrintSchema -{ - namespace PageMediaSize - { - struct PageMediaSizeData - { - PageMediaSizeData() : - pageWidth(215900), - pageHeight(279400) - { - } - - INT pageWidth; - INT pageHeight; - }; - } -} - diff --git a/print/XPSDrvSmpl/src/common/psizepthndlr.cpp b/print/XPSDrvSmpl/src/common/psizepthndlr.cpp deleted file mode 100644 index 893c16df..00000000 --- a/print/XPSDrvSmpl/src/common/psizepthndlr.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - psizepthndlr.cpp - -Abstract: - - PageMediaSize PrintTicket handler implementation. Derived from CPTHandler, - this provides PageMediaSize specific Get method acting on the passed in - PrintTicket (as a DOM document). - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "psizepthndlr.h" - -using XDPrintSchema::PageMediaSize::PageMediaSizeData; -using XDPrintSchema::PageMediaSize::MediaSizeHeight; -using XDPrintSchema::PageMediaSize::MediaSizeWidth; -using XDPrintSchema::PageMediaSize::PAGESIZE_FEATURE; -using XDPrintSchema::PageMediaSize::PAGESIZE_PROPS; - -/*++ - -Routine Name: - - CPageSizePTHandler::CPageSizePTHandler - -Routine Description: - - CPageSizePTHandler class constructor - -Arguments: - - pPrintTicket - Pointer to the DOM document representation of the PrintTicket - -Return Value: - - None - ---*/ -CPageSizePTHandler::CPageSizePTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ) : - CPTHandler(pPrintTicket) -{ -} - -/*++ - -Routine Name: - - CPageSizePTHandler::~CPageSizePTHandler - -Routine Description: - - CPageSizePTHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPageSizePTHandler::~CPageSizePTHandler() -{ -} - -/*++ - -Routine Name: - - CPageSizePTHandler::GetData - -Routine Description: - - The routine fills the data structure passed in with page size data retrieved from - the PrintTicket passed to the class constructor. - -Arguments: - - pPageMediaSizeData - Pointer to the page size data structure to be filled in - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - Feature not present in PrintTicket - E_* - On error - ---*/ -HRESULT -CPageSizePTHandler::GetData( - _Out_ PageMediaSizeData* pPageMediaSizeData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPageMediaSizeData, E_POINTER))) - { - CComBSTR bstrPageSizeOption; - - // - // We don't actually need the pages size option name, just the dimensions - // - if (SUCCEEDED(hr = GetFeatureOption(CComBSTR(PAGESIZE_FEATURE), &bstrPageSizeOption)) && - SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(PAGESIZE_FEATURE), - CComBSTR(PAGESIZE_PROPS[MediaSizeWidth]), - &pPageMediaSizeData->pageWidth))) - { - hr = GetScoredPropertyValue(CComBSTR(PAGESIZE_FEATURE), - CComBSTR(PAGESIZE_PROPS[MediaSizeHeight]), - &pPageMediaSizeData->pageHeight); - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/psizepthndlr.h b/print/XPSDrvSmpl/src/common/psizepthndlr.h deleted file mode 100644 index 68e77fdb..00000000 --- a/print/XPSDrvSmpl/src/common/psizepthndlr.h +++ /dev/null @@ -1,45 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - psizepthndlr.h - -Abstract: - - PageMediaSize PrintTicket handling definition. The PageMediaSize PT handler - is used to extract PageMediaSize settings from a PrintTicket and populate - the PageMediaSize data structure with the retrieved settings. The class also - defines a method for setting the feature in the PrintTicket given the - data structure. - ---*/ - -#pragma once - -#include "pthndlr.h" -#include "psizedata.h" - -class CPageSizePTHandler : public CPTHandler -{ -public: - CPageSizePTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ); - - virtual ~CPageSizePTHandler(); - - HRESULT - GetData( - _Out_ XDPrintSchema::PageMediaSize::PageMediaSizeData* pPageMediaSizeData - ); -}; - diff --git a/print/XPSDrvSmpl/src/common/psizeschema.cpp b/print/XPSDrvSmpl/src/common/psizeschema.cpp deleted file mode 100644 index 448ccb2c..00000000 --- a/print/XPSDrvSmpl/src/common/psizeschema.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - psizeschema.cpp - -Abstract: - - PageMediaSize PrintSchema implementation. This implements the features, - options and enumerations that describe the PrintSchema PageMediaSize feature. - ---*/ - -#include "precomp.h" -#include "psizeschema.h" - -LPCWSTR XDPrintSchema::PageMediaSize::PAGESIZE_FEATURE = L"PageMediaSize"; - -LPCWSTR XDPrintSchema::PageMediaSize::PAGESIZE_PROPS[] = { - L"MediaSizeWidth", - L"MediaSizeHeight" -}; - diff --git a/print/XPSDrvSmpl/src/common/psizeschema.h b/print/XPSDrvSmpl/src/common/psizeschema.h deleted file mode 100644 index 253846c7..00000000 --- a/print/XPSDrvSmpl/src/common/psizeschema.h +++ /dev/null @@ -1,55 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - psizeschema.h - -Abstract: - - PageMediaSize PrintSchema definition. This defines the features, options - and enumerations that describe the PrintSchema PageMediaSize feature within - a XDPrintSchema::PageMediaSize namespace. - ---*/ - -#pragma once - -#include "schema.h" - -namespace XDPrintSchema -{ - // - // PageMediaSize elements described as Printschema keywords - // - namespace PageMediaSize - { - // - // The feature name - // - extern LPCWSTR PAGESIZE_FEATURE; - - // - // We don't actually ever use the page size option names so they are - // omitted for brevity as there are many of them. - // - - enum EPageSizeProps - { - MediaSizeWidth = 0, EPageSizePropsMin = 0, - MediaSizeHeight, - EPageSizePropsMax - }; - - extern LPCWSTR PAGESIZE_PROPS[EPageSizePropsMax]; - } -} - diff --git a/print/XPSDrvSmpl/src/common/pthndlr.cpp b/print/XPSDrvSmpl/src/common/pthndlr.cpp deleted file mode 100644 index 61158c1f..00000000 --- a/print/XPSDrvSmpl/src/common/pthndlr.cpp +++ /dev/null @@ -1,1385 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -File Name: - - pthndlr.cpp - -Abstract: - - Base PrintTicket handler class implementation. This class provides common - PrintTicket handling functionality for any filter that requires print - ticket handling. A feature specific handler can derive from - this class to get feature unspecific XML handling functionality. - ---*/ - - -// -// Note on handling missing DOM nodes: -// -// Convert MSXML's S_FALSE to E_ELEMENT_NOT_FOUND. This allows clients to -// use the SUCCEEDED macro more effectively. -// -// E_ELEMENT_NOT_FOUND should not be propogated as an error to the -// filter pipeline or config module - treat as though the requested feature -// has not been enabled. -// - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "pthndlr.h" -#include "ptquerybld.h" - -using XDPrintSchema::PRINTTICKET_NAME; -using XDPrintSchema::PARAM_INIT_ELEMENT_NAME; -using XDPrintSchema::PARAM_REF_ELEMENT_NAME; -using XDPrintSchema::NAME_ATTRIBUTE_NAME; -using XDPrintSchema::VALUE_ELEMENT_NAME; -using XDPrintSchema::SCHEMA_TYPE; -using XDPrintSchema::SCHEMA_INTEGER; -using XDPrintSchema::FEATURE_ELEMENT_NAME; -using XDPrintSchema::OPTION_ELEMENT_NAME; -using XDPrintSchema::FRAMEWORK_URI; -using XDPrintSchema::SCHEMA_INST_URI; - -/*++ - -Routine Name: - - CPTHandler::CPTHandler - -Routine Description: - - CPTHandler class constructor - -Arguments: - - pPrintTicket - Pointer to the DOM document representation of the PrintTicket - -Return Value: - - None - - Note: Base Class (CPSHandler) - Throws CXDException(HRESULT) on an error - ---*/ -CPTHandler::CPTHandler( - _In_ IXMLDOMDocument2 *pDOMDocument - ) : - CPSHandler(CComBSTR(PRINTTICKET_NAME), pDOMDocument) -{ -} - -/*++ - -Routine Name: - - CPTHandler::~CPTHandler - -Routine Description: - - CPTHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPTHandler::~CPTHandler() -{ -} - -/*++ - -Routine Name: - - CPTHandler::DeleteFeature - -Routine Description: - - This routine finds and deletes the named feature - -Arguments: - - bstrFeature - the feature name to be deleted - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTHandler::DeleteFeature( - _In_z_ BSTR bstrFeature - ) -{ - HRESULT hr = S_OK; - - if (SysStringLen(bstrFeature) > 0) - { - // - // Find the feature node - // - CPTQueryBuilder propertyQuery(m_bstrFrameworkPrefix); - CComBSTR bstrQuery; - - CComPtr pFeatureNode(NULL); - - if (SUCCEEDED(hr = propertyQuery.AddFeature(m_bstrKeywordsPrefix, bstrFeature)) && - SUCCEEDED(hr = propertyQuery.GetQuery(&bstrQuery))) - { - // - // Keep querying and deleting till all instances of the feature are - // removed - generally this should be a single instance - // - while (SUCCEEDED(hr) && - SUCCEEDED(hr = GetNode(bstrQuery, &pFeatureNode)) && - hr != S_FALSE) - { - // - // Delete the feature node and all children, then locate and delete - // all orphaned parameter init nodes - // - if (SUCCEEDED(hr = DeleteNode(pFeatureNode))) - { - // - // We need to delete all orphaned paramater init elements. Construct a - // list of parameter ref nodes and parameter init nodes and delete parameter - // init nodes that do not have a corresponding reference. - // - CComPtr pInitList(NULL); - CComPtr pRefList(NULL); - - if (SUCCEEDED(hr = GetNodes(CComBSTR(PARAM_INIT_ELEMENT_NAME), &pInitList)) && - hr != S_FALSE && - SUCCEEDED(hr = GetNodes(CComBSTR(PARAM_REF_ELEMENT_NAME), &pRefList)) && - hr != S_FALSE) - { - hr = DeleteParamInitOrphans(pRefList, pInitList); - } - } - - // - // Release the feature node for the next pass - // - pFeatureNode = NULL; - } - } - } - else - { - hr = E_INVALIDARG; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::DeleteParamInitOrphans - -Routine Description: - - When a feature is deleted it may orphan a set of parameter init nodes. - This routine takes a list of parameter init nodes and a list of parameter - ref nodes and deletes the init nodes with no corresponding ref node. - -Arguments: - - pRefList - pointer to a node list containined the ref nodes - pInitList - pointer to a node list containined the init nodes - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTHandler::DeleteParamInitOrphans( - _In_ IXMLDOMNodeList* pRefList, - _Inout_ IXMLDOMNodeList* pInitList - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pRefList, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pInitList, E_POINTER))) - { - LONG cRefNodes = 0; - - if (SUCCEEDED(hr = pRefList->get_length(&cRefNodes)) && - cRefNodes == 0) - { - // - // There are no ref nodes - delete all init nodes - // - hr = DeleteNodeList(pInitList); - } - else - { - // - // Iterate over init list and search for a corresponding ref node - // - LONG cInitNodes = 0; - hr = pInitList->get_length(&cInitNodes); - - for (LONG cInitNode = 0; cInitNode < cInitNodes && SUCCEEDED(hr); cInitNode++) - { - CComPtr pInitNode(NULL); - CComBSTR bstrInitName; - - if (SUCCEEDED(hr = pInitList->get_item(cInitNode, &pInitNode)) && - hr != S_FALSE && - SUCCEEDED(hr = GetAttributeValue(pInitNode, - CComBSTR(NAME_ATTRIBUTE_NAME), - &bstrInitName)) && - hr != S_FALSE && - SUCCEEDED(hr = pRefList->reset())) - { - // - // Iterate over the ref list tring to match - // - BOOL bMatched = FALSE; - - for (LONG cRefNode = 0; cRefNode < cRefNodes && SUCCEEDED(hr) && !bMatched; cRefNode++) - { - CComPtr pRefNode(NULL); - CComBSTR bstrRefName; - if (SUCCEEDED(hr = pRefList->get_item(cRefNode, &pRefNode)) && - hr != S_FALSE && - SUCCEEDED(hr = GetAttributeValue(pRefNode, - CComBSTR(NAME_ATTRIBUTE_NAME), - &bstrRefName)) && - hr != S_FALSE) - { - if (bstrRefName == bstrInitName) - { - bMatched = TRUE; - } - } - } - - if (!bMatched) - { - // - // There were no matches - delete the init node - // - hr = DeleteNode(pInitNode); - } - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CPTHandler::DeleteNodeList - -Routine Description: - - This routine deletes all nodes in a node list - -Arguments: - - pNodeList - the node list containing the nodes to be deleted - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTHandler::DeleteNodeList( - _Inout_ IXMLDOMNodeList* pNodeList - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pNodeList, E_POINTER))) - { - LONG cNodes = 0; - - hr = pNodeList->get_length(&cNodes); - - for (LONG cNode = 0; cNode < cNodes && SUCCEEDED(hr); cNode++) - { - CComPtr pNode(NULL); - if (SUCCEEDED(hr = pNodeList->get_item(cNode, &pNode)) && - hr != S_FALSE) - { - hr = DeleteNode(pNode); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::DeleteProperty - -Routine Description: - - This routine finds and deletes the named property - -Arguments: - - bstrProperty - the property name to be deleted - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTHandler::DeleteProperty( - _In_z_ BSTR bstrProperty - ) -{ - HRESULT hr = S_OK; - - if (SysStringLen(bstrProperty) > 0) - { - // - // Find the property node - // - CPTQueryBuilder propertyQuery(m_bstrFrameworkPrefix); - CComBSTR bstrQuery; - - CComPtr pPropertyNode(NULL); - - if (SUCCEEDED(hr = propertyQuery.AddProperty(m_bstrFrameworkPrefix, bstrProperty)) && - SUCCEEDED(hr = propertyQuery.GetQuery(&bstrQuery)) && - SUCCEEDED(hr = GetNode(bstrQuery, &pPropertyNode)) && - hr != S_FALSE) - { - // - // Delete the property node and all children - // - hr = DeleteNode(pPropertyNode); - } - } - else - { - hr = E_INVALIDARG; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::QueryNodeOption - -Routine Description: - - This routine locates the node specified by the XPath query passed in and - returns the value of the "name" attribute as a string. The PrintSchema - keyword prefix is stripped from the result. - -Arguments: - - bstrQuery - The XPath query locating the node to retrieve the value for - pbstrOption - Pointer to a BSTR to recieve the option string - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - If node does not exist - E_* - On error - ---*/ -HRESULT -CPTHandler::QueryNodeOption( - _In_z_ BSTR bstrQuery, - _Outptr_result_maybenull_z_ BSTR* pbstrOption - ) -{ - HRESULT hr = S_OK; - - // - // Validate input parameters - // - if (SUCCEEDED(hr = CHECK_POINTER(pbstrOption, E_POINTER))) - { - *pbstrOption = NULL; - - if (SysStringLen(bstrQuery) <= 0) - { - hr = E_INVALIDARG; - } - } - - // - // Given a bare PrintSchema query, retrieve the selected option - // - if (SUCCEEDED(hr)) - { - CComPtr pQueryNode(NULL); - - if (SUCCEEDED(hr = GetNode(bstrQuery, &pQueryNode)) && - hr != S_FALSE && - SUCCEEDED(hr = GetAttributeValue(pQueryNode, CComBSTR(NAME_ATTRIBUTE_NAME), pbstrOption)) && - hr != S_FALSE) - { - hr = StripKeywordNamespace(pbstrOption); - } - } - - if (hr == S_FALSE) - { - hr = E_ELEMENT_NOT_FOUND; - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::FeaturePresent - -Routine Description: - - This routine checks if the named feature is present in the PrintTicket - and optionally returns that node - -Arguments: - - bstrFeature - The feature name to be located - ppFeatureNode - optional paramter that recieves the node - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - If node does not exist - E_* - On error - ---*/ -HRESULT -CPTHandler::FeaturePresent( - _In_z_ BSTR bstrFeature, - _Outptr_opt_ IXMLDOMNode** ppFeatureNode - ) -{ - HRESULT hr = S_OK; - - // - // Validate input parameters - // - if (SysStringLen(bstrFeature) > 0) - { - // - // Find the feature node - // - CPTQueryBuilder propertyQuery(m_bstrFrameworkPrefix); - CComBSTR bstrQuery; - - CComPtr pFeatureNode(NULL); - - if (SUCCEEDED(hr = propertyQuery.AddFeature(m_bstrKeywordsPrefix, bstrFeature)) && - SUCCEEDED(hr = propertyQuery.GetQuery(&bstrQuery))) - { - if (ppFeatureNode == NULL) - { - hr = GetNode(bstrQuery, &pFeatureNode); - } - else - { - hr = GetNode(bstrQuery, ppFeatureNode); - } - } - } - else - { - hr = E_INVALIDARG; - } - - if (hr == S_FALSE) - { - hr = E_ELEMENT_NOT_FOUND; - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::GetFeatureOption - -Routine Description: - - This routine retrieves the option set for the named feature passed in. - -Arguments: - - bstrFeature - The feature name to retrieve the option for - pbstrOption - Pointer to a BSTR to recieve the option - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - If node does not exist - E_* - On error - ---*/ -HRESULT -CPTHandler::GetFeatureOption( - _In_z_ BSTR bstrFeature, - _Outptr_result_maybenull_z_ BSTR* pbstrOption - ) -{ - HRESULT hr = S_OK; - - // - // Validate input parameters - // - if (SUCCEEDED(hr = CHECK_POINTER(pbstrOption, E_POINTER))) - { - if (SysStringLen(bstrFeature) <= 0) - { - hr = E_INVALIDARG; - } - } - - // - // Given a bare PrintSchema feature name, retrieve the selected option - // - if (SUCCEEDED(hr)) - { - // - // Find the feature option node - // - CPTQueryBuilder propertyQuery(m_bstrFrameworkPrefix); - CComBSTR bstrQuery; - - CComPtr pOptionNode(NULL); - - if (SUCCEEDED(hr = propertyQuery.AddFeature(m_bstrKeywordsPrefix, bstrFeature)) && - SUCCEEDED(hr = propertyQuery.AddOption(m_bstrKeywordsPrefix)) && - SUCCEEDED(hr = propertyQuery.GetQuery(&bstrQuery)) && - SUCCEEDED(hr = GetNode(bstrQuery, &pOptionNode)) && - hr != S_FALSE) - { - // - // If this is a shorthand option then the option is stored in the "name" attribute - // - hr = GetAttributeValue(pOptionNode, CComBSTR(NAME_ATTRIBUTE_NAME), pbstrOption); - - if (hr == S_FALSE) - { - // - // This might be a longhand option in which case the node we have retrieved - // is pointing at a scored property the value of which is the option - // - CComVariant varValue; - if (SUCCEEDED(hr = pOptionNode->get_nodeTypedValue(&varValue)) && - hr != S_FALSE) - { - *pbstrOption = ::SysAllocString(varValue.bstrVal); - - if (*pbstrOption == NULL) - { - hr = E_OUTOFMEMORY; - } - } - } - - if (SUCCEEDED(hr) && - hr != S_FALSE) - { - hr = StripKeywordNamespace(pbstrOption); - } - } - } - - if (hr == S_FALSE) - { - hr = E_ELEMENT_NOT_FOUND; - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::GetSubFeatureOption - -Routine Description: - - This routine retrieves the current option for a sub feature. The routine - finds the named parent feature, then the sub-feature and retrieves the - option that is set. - -Arguments: - - bstrParentFeature - The parent feature name - bstrFeature - The sub-feature name - pbstrOption - Pointer to a BSTR to recieve the option - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - If node does not exist - E_* - On error - ---*/ -HRESULT -CPTHandler::GetSubFeatureOption( - _In_z_ BSTR bstrParentFeature, - _In_z_ BSTR bstrFeature, - _Outptr_result_maybenull_z_ BSTR* pbstrOption - ) -{ - HRESULT hr = S_OK; - - // - // Validate input parameters - // - if (SUCCEEDED(hr = CHECK_POINTER(pbstrOption, E_POINTER))) - { - *pbstrOption = NULL; - - if (SysStringLen(bstrFeature) <= 0 || - SysStringLen(bstrParentFeature) <= 0) - { - hr = E_INVALIDARG; - } - } - - // - // Given a bare PrintSchema feature name, retrieve the selected option - // - if (SUCCEEDED(hr)) - { - // - // Find the sub feature option node - // - CPTQueryBuilder propertyQuery(m_bstrFrameworkPrefix); - CComBSTR bstrQuery; - - CComPtr pFeatureNode(NULL); - - if (SUCCEEDED(hr = propertyQuery.AddFeature(m_bstrKeywordsPrefix, bstrParentFeature)) && - SUCCEEDED(hr = propertyQuery.AddFeature(m_bstrKeywordsPrefix, bstrFeature)) && - SUCCEEDED(hr = propertyQuery.AddOption(m_bstrKeywordsPrefix)) && - SUCCEEDED(hr = propertyQuery.GetQuery(&bstrQuery)) && - SUCCEEDED(hr = GetNode(bstrQuery, &pFeatureNode)) && - hr != S_FALSE && - SUCCEEDED(hr = GetAttributeValue(pFeatureNode, CComBSTR(NAME_ATTRIBUTE_NAME), pbstrOption)) && - hr != S_FALSE) - { - hr = StripKeywordNamespace(pbstrOption); - } - } - - if (hr == S_FALSE) - { - hr = E_ELEMENT_NOT_FOUND; - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::GetScoredPropertyValue - -Routine Description: - - This routine retrieves the scored property value as a string for a given feature. - -Arguments: - - bstrParentFeature - The parent feature name - bstrProperty - The scored property name - pbstrValue - Pointer to a BSTR to recieve the scored property value - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTHandler::GetScoredPropertyValue( - _In_z_ BSTR bstrParentFeature, - _In_z_ BSTR bstrProperty, - _Outptr_result_maybenull_ BSTR* pbstrValue - ) -{ - HRESULT hr = S_OK; - - // - // Validate input parameters - // - if (SUCCEEDED(hr = CHECK_POINTER(pbstrValue, E_POINTER))) - { - *pbstrValue = NULL; - - if (SysStringLen(bstrProperty) <= 0 || - SysStringLen(bstrParentFeature) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - // - // Get the scored property value - // - CPTQueryBuilder propertyQuery(m_bstrFrameworkPrefix); - CComBSTR bstrQuery; - - if (SUCCEEDED(hr = propertyQuery.AddFeature(m_bstrKeywordsPrefix, bstrParentFeature)) && - SUCCEEDED(hr = propertyQuery.AddScoredProperty(m_bstrKeywordsPrefix, bstrProperty)) && - SUCCEEDED(hr = propertyQuery.GetQuery(&bstrQuery))) - { - hr = GetNodeValue(bstrQuery, pbstrValue); - } - } - - if (hr == S_FALSE) - { - hr = E_ELEMENT_NOT_FOUND; - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::GetScoredPropertyValue - -Routine Description: - - This routine retrieves the integer value of a scored property from a named - feature - -Arguments: - - bstrParentFeature - The name of the parent feature - bstrProperty - The name of the scored property to retrieve the value of - pValue - Pointer to an INT that recieves the property value - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTHandler::GetScoredPropertyValue( - _In_z_ BSTR bstrParentFeature, - _In_z_ BSTR bstrProperty, - _Out_ INT* pValue - ) -{ - HRESULT hr = S_OK; - - CComBSTR bstrValue; - if (SUCCEEDED(hr = CHECK_POINTER(pValue, E_POINTER))) - { - if (SysStringLen(bstrParentFeature) <= 0 || - SysStringLen(bstrProperty) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = GetScoredPropertyValue(bstrParentFeature, bstrProperty, &bstrValue))) - { - *pValue = static_cast(_wtoi(bstrValue)); - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::GetScoredPropertyValue - -Routine Description: - - This routine retrieves the REAL value of a scored property from a named - feature - -Arguments: - - bstrParentFeature - The name of the parent feature - bstrProperty - The name of the scored property to retrieve the value of - pValue - Pointer to a REAL that recieves the property value - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTHandler::GetScoredPropertyValue( - _In_z_ BSTR bstrParentFeature, - _In_z_ BSTR bstrProperty, - _Out_ REAL* pValue - ) -{ - HRESULT hr = S_OK; - - CComBSTR bstrValue; - if (SUCCEEDED(hr = CHECK_POINTER(pValue, E_POINTER))) - { - if (SysStringLen(bstrParentFeature) <= 0 || - SysStringLen(bstrProperty) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = GetScoredPropertyValue(bstrParentFeature, bstrProperty, &bstrValue))) - { - *pValue = static_cast(_wtof(bstrValue)); - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::StripKeywordNamespace - -Routine Description: - - This routine strips the PrintSchema keyword namespace prefix from a value - -Arguments: - - pbstrValue - Pointer to the value string to have the prefix stripped - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTHandler::StripKeywordNamespace( - _Inout_ BSTR* pbstrValue - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrValue, E_POINTER))) - { - if (SysStringLen(*pbstrValue) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - try - { - CStringXDW cstrStrippedName(*pbstrValue); - - INT cchStringStart = cstrStrippedName.Find(m_bstrKeywordsPrefix); - size_t cchKWPrefix = 0; - if (cchStringStart != -1 && - SUCCEEDED(hr = StringCchLength(m_bstrKeywordsPrefix, STRSAFE_MAX_CCH, &cchKWPrefix))) - { - cstrStrippedName.Delete(cchStringStart, static_cast(cchKWPrefix)); - SysFreeString(*pbstrValue); - *pbstrValue = cstrStrippedName.AllocSysString(); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::CreateParamRefInitPair - -Routine Description: - - This routine create a pair of DOM elements corresponding to the ParameterRef and - the ParameterInit that describe a ScoredProperty value. - -Arguments: - - bstrParam - The name of the property - bstrType - The type of the value (string, integer etc.) - bstrValue - The value of the property - ppParamRef - Pointer to a IXMLDOMElement pointer that recives the new ParameterRef - ppParamInit - Pointer to a IXMLDOMElement pointer that recives the new ParameterInit - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTHandler::CreateParamRefInitPair( - _In_ CONST BSTR bstrParam, - _In_ CONST BSTR bstrType, - _In_ CONST BSTR bstrValue, - _Outptr_ IXMLDOMElement** ppParamRef, - _Outptr_ IXMLDOMElement** ppParamInit - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppParamRef, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppParamInit, E_POINTER))) - { - *ppParamRef = NULL; - *ppParamInit = NULL; - - if (SysStringLen(bstrParam) <= 0 || - SysStringLen(bstrType) <= 0 || - SysStringLen(bstrValue) <= 0) - { - hr = E_INVALIDARG; - } - } - - CComPtr pParamInit(NULL); - CComPtr pParamRef(NULL); - - if (SUCCEEDED(hr)) - { - CComBSTR bstrPRefName; - if (wcscmp(bstrParam, L"PageWatermarkSizeWidth") == 0 || - wcscmp(bstrParam, L"PageWatermarkSizeHeight") == 0) - { - bstrPRefName += m_bstrUserKeywordsPrefix; - } - else - { - bstrPRefName += m_bstrKeywordsPrefix; - } - - bstrPRefName += bstrParam; - - // - // Create the parameter ref element - // - CComBSTR bstrTagName(m_bstrFrameworkPrefix); - bstrTagName += PARAM_REF_ELEMENT_NAME; - - if(SUCCEEDED(hr)) - { - hr = CreateXMLElement(bstrTagName, FRAMEWORK_URI, &pParamRef); - } - - if (SUCCEEDED(hr)) - { - hr = CreateXMLAttribute(pParamRef, NAME_ATTRIBUTE_NAME, NULL, bstrPRefName ); - } - - // - // Create the parameter init element - // - bstrTagName.Empty(); - bstrTagName += m_bstrFrameworkPrefix; - bstrTagName += PARAM_INIT_ELEMENT_NAME; - - if(SUCCEEDED(hr)) - { - hr = CreateXMLElement(bstrTagName, FRAMEWORK_URI, &pParamInit); - } - - if (SUCCEEDED(hr)) - { - hr = CreateXMLAttribute(pParamInit, NAME_ATTRIBUTE_NAME, NULL, bstrPRefName ); - } - - // - // Create the parameter init value and add to the parameter init element - // - CComPtr pValue(NULL); - - bstrTagName.Empty(); - bstrTagName += m_bstrFrameworkPrefix; - bstrTagName += VALUE_ELEMENT_NAME; - - CComBSTR bstrAttrib(m_bstrSchemaInstPrefix); - bstrAttrib += SCHEMA_TYPE; - - CComBSTR bstrAttribValue(m_bstrSchemaPrefix); - bstrAttribValue += bstrType; - - if(SUCCEEDED(hr)) - { - hr = CreateXMLElement(bstrTagName, FRAMEWORK_URI, &pValue); - } - - if (SUCCEEDED(hr)) - { - if( SUCCEEDED(hr = CreateXMLAttribute(pValue, bstrAttrib, SCHEMA_INST_URI, bstrAttribValue )) && - SUCCEEDED(hr = pValue->put_text(bstrValue))) - { - hr = pParamInit->appendChild(pValue, NULL); - } - } - } - - if (SUCCEEDED(hr)) - { - // - // Assign the outgoing element pointers - detach from CComPtr to release ownership - // - *ppParamRef = pParamRef.Detach(); - *ppParamInit = pParamInit.Detach(); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::CreateParamRefInitPair - -Routine Description: - - This routine create a pair of DOM elements corresponding to the ParameterRef and - the ParameterInit that describe a ScoredProperty value. This overload is INT specific - -Arguments: - - bstrParam - The name of the property - intValue - The integer value of the scored property - ppParamRef - Pointer to a IXMLDOMElement pointer that recives the new ParameterRef - ppParamInit - Pointer to a IXMLDOMElement pointer that recives the new ParameterInit - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTHandler::CreateParamRefInitPair( - _In_ CONST BSTR bstrParam, - _In_ CONST INT intValue, - _Outptr_ IXMLDOMElement** ppParamRef, - _Outptr_ IXMLDOMElement** ppParamInit - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppParamRef, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppParamInit, E_POINTER))) - { - if (SysStringLen(bstrParam) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - try - { - CStringXDW cstrValue; - cstrValue.Format(L"%i", intValue); - - hr = CreateParamRefInitPair(bstrParam, - CComBSTR(SCHEMA_INTEGER), - CComBSTR(cstrValue.AllocSysString()), - ppParamRef, - ppParamInit); - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::CreateFeatureOptionPair - -Routine Description: - - This routine create a pair of DOM elements corresponding to Feature and Option. - Note this method does not intialise the option element, it merely creates an Option - node appended to the Feature element. It is up to the caller to set the option value. - -Arguments: - - bstrFeatureName - The name of the feature - ppFeatureElement - Pointer to a IXMLDOMElement pointer that recives the new Feature - ppOptionElement - Pointer to a IXMLDOMElement pointer that recives the new Option - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTHandler::CreateFeatureOptionPair( - _In_ CONST BSTR bstrFeatureName, - _Outptr_ IXMLDOMElement** ppFeatureElement, - _Outptr_ IXMLDOMElement** ppOptionElement - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppFeatureElement, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppOptionElement, E_POINTER))) - { - *ppFeatureElement = NULL; - *ppOptionElement = NULL; - - if (SysStringLen(bstrFeatureName) <= 0) - { - hr = E_INVALIDARG; - } - } - else - { - hr = E_POINTER; - } - - if (SUCCEEDED(hr)) - { - CComBSTR bstrFeature(m_bstrFrameworkPrefix); - bstrFeature += FEATURE_ELEMENT_NAME; - - CComBSTR bstrAttribName(m_bstrKeywordsPrefix); - bstrAttribName += bstrFeatureName; - - CComBSTR bstrOption(m_bstrFrameworkPrefix); - bstrOption += OPTION_ELEMENT_NAME; - - if(SUCCEEDED(hr)) - { - hr = CreateXMLElement(bstrFeature, FRAMEWORK_URI, ppFeatureElement); - } - - if(SUCCEEDED(hr)) - { - hr = CreateXMLElement(bstrOption, FRAMEWORK_URI, ppOptionElement); - } - - if(SUCCEEDED(hr)) - { - if (SUCCEEDED(hr = CreateXMLAttribute(*ppFeatureElement, NAME_ATTRIBUTE_NAME, NULL, bstrAttribName ))) - { - hr = (*ppFeatureElement)->appendChild(*ppOptionElement, NULL); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::CreateFeatureOptionPair - -Routine Description: - - This routine create a pair of DOM elements corresponding to Feature and Option. - -Arguments: - - bstrFeatureName - The name of the feature - bstrOptionName - The name of the option - ppFeatureElement - Pointer to a IXMLDOMElement pointer that recives the new Feature - ppOptionElement - Pointer to a IXMLDOMElement pointer that recives the new Option - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTHandler::CreateFeatureOptionPair( - _In_ CONST BSTR bstrFeatureName, - _In_ CONST BSTR bstrOptionName, - _Outptr_ IXMLDOMElement** ppFeatureElement, - _Outptr_ IXMLDOMElement** ppOptionElement - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppFeatureElement, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppOptionElement, E_POINTER))) - { - if (SysStringLen(bstrFeatureName) <= 0 || - SysStringLen(bstrOptionName) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - if (SUCCEEDED(hr = CreateFeatureOptionPair(bstrFeatureName, ppFeatureElement, ppOptionElement))) - { - // - // Set the option name attribute - // - CComBSTR bstrAttribValue(m_bstrKeywordsPrefix); - bstrAttribValue += bstrOptionName; - - hr = CreateXMLAttribute(*ppOptionElement, NAME_ATTRIBUTE_NAME, NULL, bstrAttribValue ); - - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTHandler::AppendToElement - -Routine Description: - - This routine uses the passed element name to locate the node to which - it will append the DOM node passed in. - -Arguments: - - bstrElementName - The name of the element to append to - pAppendNode - The node to append - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTHandler::AppendToElement( - _In_ CONST BSTR bstrElementName, - _In_ IXMLDOMNode* pAppendNode - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pAppendNode, E_POINTER))) - { - if (SysStringLen(bstrElementName) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - CComPtr pNode(NULL); - - CComBSTR bstrQuery(m_bstrFrameworkPrefix); - bstrQuery += bstrElementName; - - if (SUCCEEDED(hr = GetNode(bstrQuery, &pNode))) - { - hr = pNode->appendChild(pAppendNode, NULL); - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/pthndlr.h b/print/XPSDrvSmpl/src/common/pthndlr.h deleted file mode 100644 index e8bd8a08..00000000 --- a/print/XPSDrvSmpl/src/common/pthndlr.h +++ /dev/null @@ -1,178 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -File Name: - - pthndlr.h - -Abstract: - - Base PrintTicket handler class definition. This class provides common - PrintTicket handling functionality for any filter that requires print - ticket handling. A filter can from this class to get feature unspecific - XML handling functionality. - ---*/ - -#pragma once - -#include "schema.h" -#include "pshndlr.h" - -class CPTHandler : public CPSHandler -{ -public: - // - // Constructors and destructors - // - CPTHandler( - _In_ IXMLDOMDocument2 *pPrintTicket - ); - - virtual ~CPTHandler(); - -public: - HRESULT - DeleteFeature( - _In_z_ BSTR bstrFeature - ); - - HRESULT - DeleteProperty( - _In_z_ BSTR bstrProperty - ); - -protected: - HRESULT - QueryNodeOption( - _In_z_ BSTR bstrQuery, - _Outptr_result_maybenull_z_ BSTR* pbstrOption - ); - - HRESULT - FeaturePresent( - _In_z_ BSTR bstrFeature, - _Outptr_opt_ IXMLDOMNode** ppFeatureNode = NULL - ); - - HRESULT - GetFeatureOption( - _In_z_ BSTR bstrFeature, - _Outptr_result_maybenull_z_ BSTR* pbstrOption - ); - - HRESULT - GetSubFeatureOption( - _In_z_ BSTR bstrParentFeature, - _In_z_ BSTR bstrFeature, - _Outptr_result_maybenull_z_ BSTR* pbstrOption - ); - - HRESULT - GetScoredPropertyValue( - _In_z_ BSTR bstrParentFeature, - _In_z_ BSTR bstrProperty, - _Outptr_result_maybenull_ BSTR* pbstrValue - ); - - HRESULT - GetScoredPropertyValue( - _In_z_ BSTR bstrParentFeature, - _In_z_ BSTR bstrProperty, - _Out_ INT* pValue - ); - - HRESULT - GetScoredPropertyValue( - _In_z_ BSTR bstrParentFeature, - _In_z_ BSTR bstrProperty, - _Out_ REAL* pValue - ); - - HRESULT - SetFeatureOption( - _In_z_ BSTR bstrFeature, - _In_z_ BSTR bstrOption - ); - - HRESULT - SetSubFeatureOption( - _In_z_ BSTR bstrParentFeature, - _In_z_ BSTR bstrFeature, - _In_z_ BSTR bstrOption - ); - - HRESULT - SetPropertyAsValue( - _In_z_ BSTR bstrFeature, - _In_z_ BSTR bstrProperty, - _In_z_ BSTR bstrValue - ); - - HRESULT - SetPropertyAsParameterRef( - _In_z_ BSTR bstrFeature, - _In_z_ BSTR bstrProperty, - _In_z_ BSTR bstrParameterRef, - _In_z_ BSTR bstrValue - ); - - HRESULT - CreateParamRefInitPair( - _In_ CONST BSTR bstrParam, - _In_ CONST BSTR bstrType, - _In_ CONST BSTR bstrValue, - _Outptr_ IXMLDOMElement** ppParamRef, - _Outptr_ IXMLDOMElement** ppParamInit - ); - - HRESULT - CreateParamRefInitPair( - _In_ CONST BSTR bstrParam, - _In_ CONST INT intValue, - _Outptr_ IXMLDOMElement** ppParamRef, - _Outptr_ IXMLDOMElement** ppParamInit - ); - - HRESULT - CreateFeatureOptionPair( - _In_ CONST BSTR bstrFeatureName, - _Outptr_ IXMLDOMElement** ppFeatureElement, - _Outptr_ IXMLDOMElement** ppOptionElement - ); - - HRESULT - CreateFeatureOptionPair( - _In_ CONST BSTR bstrFeatureName, - _In_ CONST BSTR bstrOptionName, - _Outptr_ IXMLDOMElement** ppFeatureElement, - _Outptr_ IXMLDOMElement** ppOptionElement - ); - - HRESULT - AppendToElement( - _In_ CONST BSTR bstrElementName, - _In_ IXMLDOMNode* pAppendNode - ); - -private: - HRESULT - StripKeywordNamespace( - _Inout_ BSTR* pbstrValue - ); - - HRESULT - DeleteNodeList( - _Inout_ IXMLDOMNodeList* pNodeList - ); - - HRESULT - DeleteParamInitOrphans( - _In_ IXMLDOMNodeList* pRefList, - _Inout_ IXMLDOMNodeList* pInitList - ); -}; - diff --git a/print/XPSDrvSmpl/src/common/ptquerybld.cpp b/print/XPSDrvSmpl/src/common/ptquerybld.cpp deleted file mode 100644 index cc7faa8a..00000000 --- a/print/XPSDrvSmpl/src/common/ptquerybld.cpp +++ /dev/null @@ -1,516 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - ptquerybld.cpp - -Abstract: - - PrintTicket XPath query builder implementation. The CPTQueryBuilder class - provides a means of constructing PrintTicket specific XPath queries for - retrieving nodes from within the DOM document describing the PrintTicket. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "ptquerybld.h" - -// -// XML PrintTicket Query Builder Format Strings -// -static PCWSTR szPTQFeature = L"//%sFeature[@name = \"%s\"]"; -static PCWSTR szPTQProperty = L"//%sProperty[@name = \"%s\"]"; -static PCWSTR szPTQScoredProperty = L"//%sScoredProperty[@name = \"%s\"]"; -static PCWSTR szPTQParamRef = L"//%sParameterRef[@name = \"%s\"]"; -static PCWSTR szPTQOptionSH = L"/%sOption"; -static PCWSTR szPTQOptionLH = L"/%sScoredProperty[@name = \"%sOptionName\"]/%sValue"; -static PCWSTR szPTQOrNodes = L" | "; - -/*++ - -Routine Name: - - CPTQueryBuilder::CPTQueryBuilder - -Routine Description: - - CPTQueryBuilder class default constructor - -Arguments: - - bstrFrameworkNS - PrintTicket framework namespace prefix - -Return Value: - - None - ---*/ -CPTQueryBuilder::CPTQueryBuilder( - _In_z_ BSTR bstrFrameworkNS - ) : - m_bstrFrameworkNS(bstrFrameworkNS) -{ -} - -/*++ - -Routine Name: - - CPTQueryBuilder::CPTQueryBuilder - -Routine Description: - - CPTQueryBuilder class constructor - -Arguments: - - bstrFrameworkNS - PrintTicket framework namespace prefix - bstrQuery - String containing base query to use on construction. - -Return Value: - - None - ---*/ -CPTQueryBuilder::CPTQueryBuilder( - _In_z_ BSTR bstrFrameworkNS, - _In_z_ BSTR bstrQuery - ) : - m_bstrFrameworkNS(bstrFrameworkNS), - m_bstrQuery(bstrQuery) -{ -} - -/*++ - -Routine Name: - - CPTQueryBuilder::~CPTQueryBuilder - -Routine Description: - - CPTQueryBuilder class destructor. - -Arguments: - - None - -Return Value: - - None - ---*/ -CPTQueryBuilder::~CPTQueryBuilder( - ) -{ -} - -/*++ - -Routine Name: - - CPTQueryBuilder::Clear - -Routine Description: - - Clears the current query string. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTQueryBuilder::Clear( - VOID - ) -{ - m_bstrQuery.Empty(); - - return S_OK; -} - -/*++ - -Routine Name: - - CPTQueryBuilder::GetQuery - -Routine Description: - - Makes a copy of the current query string and returns it to the caller. - -Arguments: - - bstrQuery - Address of a pointer that will be modified to point to a string - that is filled out with a copy of the current query. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTQueryBuilder::GetQuery( - _Inout_ _At_(*pbstrQuery, _Pre_maybenull_ _Post_valid_) BSTR* pbstrQuery - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrQuery, E_POINTER))) - { - SysFreeString(*pbstrQuery); - hr = m_bstrQuery.CopyTo(pbstrQuery); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTQueryBuilder::AddFeature - -Routine Description: - - Appends a feature query to the query builder class. - -Arguments: - - bstrKeywordNS - Optional parameter defining the keyword namespace to prefix. - bstrFeature - Pointer to a string defining the feature name to be appended. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTQueryBuilder::AddFeature( - _In_opt_z_ BSTR bstrKeywordNS, - _In_z_ BSTR bstrFeature - ) -{ - HRESULT hr = S_OK; - - if (m_bstrFrameworkNS.Length() > 0) - { - try - { - CComBSTR bstrKeyword; - - if (SysStringLen(bstrKeywordNS) > 0) - { - hr = bstrKeyword.Append(bstrKeywordNS); - } - - if (SUCCEEDED(hr)) - { - hr = bstrKeyword.Append(bstrFeature); - } - - if (SUCCEEDED(hr)) - { - CStringXDW cstrFeatureQuery; - cstrFeatureQuery.Format(szPTQFeature, static_cast(m_bstrFrameworkNS), static_cast(bstrKeyword)); - - hr = m_bstrQuery.Append(cstrFeatureQuery); - } - } - catch (CXDException& e) - { - hr = e; - } - } - else - { - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTQueryBuilder::AddProperty - -Routine Description: - - Appends a property query to the query builder class. - -Arguments: - - bstrKeywordNS - Optional parameter defining the keyword namespace to prefix. - bstrProperty - Pointer to a string defining the property name to be appended. - - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTQueryBuilder::AddProperty( - _In_opt_z_ BSTR bstrKeywordNS, - _In_z_ BSTR bstrProperty - ) -{ - HRESULT hr = S_OK; - - if (m_bstrFrameworkNS.Length() > 0) - { - try - { - CComBSTR bstrKeyword; - - if (SysStringLen(bstrKeywordNS) > 0) - { - hr = bstrKeyword.Append(bstrKeywordNS); - } - - if (SUCCEEDED(hr)) - { - hr = bstrKeyword.Append(bstrProperty); - } - - if (SUCCEEDED(hr)) - { - CStringXDW cstrPropertyQuery; - cstrPropertyQuery.Format(szPTQProperty, static_cast(m_bstrFrameworkNS), static_cast(bstrKeyword)); - - hr = m_bstrQuery.Append(cstrPropertyQuery); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTQueryBuilder::AddScoredProperty - -Routine Description: - - Appends a scored property query to the query builder class. - -Arguments: - - bstrKeywordNS - Optional parameter defining the keyword namespace to prefix. - bstrScoredProperty - Pointer to a string defining the scored property name to be appended. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTQueryBuilder::AddScoredProperty( - _In_opt_z_ BSTR bstrKeywordNS, - _In_z_ BSTR bstrScoredProperty - ) -{ - HRESULT hr = S_OK; - - if (m_bstrFrameworkNS.Length() > 0) - { - try - { - CComBSTR bstrKeyword; - - if (SysStringLen(bstrKeywordNS) > 0) - { - hr = bstrKeyword.Append(bstrKeywordNS); - } - - if (SUCCEEDED(hr)) - { - hr = bstrKeyword.Append(bstrScoredProperty); - } - - if (SUCCEEDED(hr)) - { - CStringXDW cstrScoredPropertyQuery; - cstrScoredPropertyQuery.Format(szPTQScoredProperty, static_cast(m_bstrFrameworkNS), static_cast(bstrKeyword)); - - hr = m_bstrQuery.Append(cstrScoredPropertyQuery); - } - } - catch (CXDException& e) - { - hr = e; - } - } - else - { - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTQueryBuilder::AddScoredProperty - -Routine Description: - - Appends a Parameter Reference query to the query builder class. - -Arguments: - - bstrKeywordNS - Optional parameter defining the keyword namespace to prefix. - bstrScoredProperty - Pointer to a string defining the scored property name to be appended. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTQueryBuilder::AddParamRef( - _In_opt_z_ BSTR bstrKeywordNS, - _In_z_ BSTR bstrParameterRef - ) -{ - HRESULT hr = S_OK; - - if (m_bstrFrameworkNS.Length() > 0) - { - try - { - CComBSTR bstrKeyword; - - if (SysStringLen(bstrKeywordNS) > 0) - { - hr = bstrKeyword.Append(bstrKeywordNS); - } - - if (SUCCEEDED(hr)) - { - hr = bstrKeyword.Append(bstrParameterRef); - } - - if (SUCCEEDED(hr)) - { - CStringXDW cstrParamRefQuery; - cstrParamRefQuery.Format(szPTQParamRef, static_cast(m_bstrFrameworkNS), static_cast(bstrKeyword)); - - hr = m_bstrQuery.Append(cstrParamRefQuery); - } - } - catch (CXDException& e) - { - hr = e; - } - } - else - { - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTQueryBuilder::AddOption - -Routine Description: - - Appends the option query to the query builder class. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTQueryBuilder::AddOption( - _In_opt_z_ BSTR bstrKeywordNS - ) -{ - HRESULT hr = S_OK; - - if (m_bstrFrameworkNS.Length() > 0) - { - try - { - CStringXDW cstrQueryRoot(m_bstrQuery); - CStringXDW cstrOptionQuery; - cstrOptionQuery.Format(szPTQOptionSH, static_cast(m_bstrFrameworkNS)); - - if (SUCCEEDED(hr = m_bstrQuery.Append(cstrOptionQuery)) && - SUCCEEDED(hr = m_bstrQuery.Append(szPTQOrNodes)) && - SUCCEEDED(hr = m_bstrQuery.Append(cstrQueryRoot))) - { - cstrOptionQuery.Format(szPTQOptionLH, static_cast(m_bstrFrameworkNS), - static_cast(bstrKeywordNS), static_cast(m_bstrFrameworkNS)); - hr = m_bstrQuery.Append(cstrOptionQuery); - } - } - catch (CXDException& e) - { - hr = e; - } - } - else - { - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/common/ptquerybld.h b/print/XPSDrvSmpl/src/common/ptquerybld.h deleted file mode 100644 index a82172ea..00000000 --- a/print/XPSDrvSmpl/src/common/ptquerybld.h +++ /dev/null @@ -1,84 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - ptquerybld.h - -Abstract: - - PrintTicket XPath query builder definition. The CPTQueryBuilder class - provides a means of constructing PrintTicket specific XPath queries for - retrieving nodes from within the DOM document describing the PrintTicket. - ---*/ - -#pragma once - -class CPTQueryBuilder -{ -public: - CPTQueryBuilder( - _In_z_ BSTR bstrFrameworkNS - ); - - CPTQueryBuilder( - _In_z_ BSTR bstrFrameworkNS, - _In_z_ BSTR bstrQuery - ); - - virtual ~CPTQueryBuilder(); - - HRESULT - Clear( - VOID - ); - - HRESULT - GetQuery( - _Inout_ _At_(*pbstrQuery, _Pre_maybenull_ _Post_valid_) BSTR* pbstrQuery - ); - - HRESULT - AddFeature( - _In_opt_z_ BSTR bstrKeywordNS, - _In_z_ BSTR bstrPropertyName - ); - - HRESULT - AddProperty( - _In_opt_z_ BSTR bstrKeywordNS, - _In_z_ BSTR bstrPropertyName - ); - - HRESULT - AddScoredProperty( - _In_opt_z_ BSTR bstrKeywordNS, - _In_z_ BSTR bstrPropertyName - ); - - HRESULT - AddParamRef( - _In_opt_z_ BSTR bstrKeywordNS, - _In_z_ BSTR bstrParameterRef - ); - - HRESULT - AddOption( - _In_opt_z_ BSTR bstrKeywordNS - ); - -private: - CComBSTR m_bstrQuery; - - CComBSTR m_bstrFrameworkNS; -}; - diff --git a/print/XPSDrvSmpl/src/common/schema.cpp b/print/XPSDrvSmpl/src/common/schema.cpp deleted file mode 100644 index ce2aa2c2..00000000 --- a/print/XPSDrvSmpl/src/common/schema.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - schema.cpp - -Abstract: - - PrintSchema implementation. This provides the definition of keywords common - to all features within the PrintSchema. - ---*/ - -#include "precomp.h" -#include "schema.h" - -LPCWSTR XDPrintSchema::SCHEMA_INST_URI = - L"http://www.w3.org/2001/XMLSchema-instance"; - -LPCWSTR XDPrintSchema::SCHEMA_DEF_URI = - L"http://www.w3.org/2001/XMLSchema"; - -LPCWSTR XDPrintSchema::SCHEMA_TYPE = L"type"; -LPCWSTR XDPrintSchema::SCHEMA_INTEGER = L"integer"; -LPCWSTR XDPrintSchema::SCHEMA_DECIMAL = L"decimal"; -LPCWSTR XDPrintSchema::SCHEMA_STRING = L"string"; -LPCWSTR XDPrintSchema::SCHEMA_QNAME = L"QName"; -LPCWSTR XDPrintSchema::SCHEMA_CONDITIONAL = L"Conditional"; - -LPCWSTR XDPrintSchema::FRAMEWORK_URI = - L"http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework"; - -LPCWSTR XDPrintSchema::KEYWORDS_URI = - L"http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords"; - -LPCWSTR XDPrintSchema::FEATURE_ELEMENT_NAME = L"Feature"; -LPCWSTR XDPrintSchema::OPTION_ELEMENT_NAME = L"Option"; -LPCWSTR XDPrintSchema::PARAM_INIT_ELEMENT_NAME = L"ParameterInit"; -LPCWSTR XDPrintSchema::PARAM_REF_ELEMENT_NAME = L"ParameterRef"; -LPCWSTR XDPrintSchema::PARAM_DEF_ELEMENT_NAME = L"ParameterDef"; -LPCWSTR XDPrintSchema::SCORED_PROP_ELEMENT_NAME = L"ScoredProperty"; -LPCWSTR XDPrintSchema::PROPERTY_ELEMENT_NAME = L"Property"; -LPCWSTR XDPrintSchema::VALUE_ELEMENT_NAME = L"Value"; -LPCWSTR XDPrintSchema::NAME_ATTRIBUTE_NAME = L"name"; - - -LPCWSTR XDPrintSchema::PICKONE_VALUE_NAME = L"PickOne"; -LPCWSTR XDPrintSchema::SELECTIONTYPE_VALUE_NAME = L"SelectionType"; -LPCWSTR XDPrintSchema::DATATYPE_VALUE_NAME = L"DataType"; -LPCWSTR XDPrintSchema::DEFAULTVAL_VALUE_NAME = L"DefaultValue"; -LPCWSTR XDPrintSchema::MAX_VALUE_NAME = L"MaxValue"; -LPCWSTR XDPrintSchema::MIN_VALUE_NAME = L"MinValue"; -LPCWSTR XDPrintSchema::MAX_LENGTH_NAME = L"MaxLength"; -LPCWSTR XDPrintSchema::MIN_LENGTH_NAME = L"MinLength"; -LPCWSTR XDPrintSchema::MULTIPLE_VALUE_NAME = L"Multiple"; -LPCWSTR XDPrintSchema::MANDATORY_VALUE_NAME = L"Mandatory"; -LPCWSTR XDPrintSchema::UNITTYPE_VALUE_NAME = L"UnitType"; -LPCWSTR XDPrintSchema::DISPLAYNAME_VALUE_NAME = L"DisplayName"; - -LPCWSTR XDPrintSchema::PRINTTICKET_NAME = L"PrintTicket"; -LPCWSTR XDPrintSchema::PRINTCAPABILITIES_NAME = L"PrintCapabilities"; diff --git a/print/XPSDrvSmpl/src/common/schema.h b/print/XPSDrvSmpl/src/common/schema.h deleted file mode 100644 index 540de949..00000000 --- a/print/XPSDrvSmpl/src/common/schema.h +++ /dev/null @@ -1,94 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - schema.h - -Abstract: - - PrintSchema definition. This provides the definition of keywords common - to all features within the PrintSchema. The description is placed within a - XDPrintSchema namespace. - ---*/ - -#pragma once - -enum EPrintschemaVersion -{ - PRINTSCHEMA_VERSION_NUMBER = 1 -}; - -namespace XDPrintSchema -{ - // - // W3 namespaces - // - extern LPCWSTR SCHEMA_INST_URI; - extern LPCWSTR SCHEMA_DEF_URI; - - // - // W3 type prefixes - // - extern LPCWSTR SCHEMA_TYPE; - extern LPCWSTR SCHEMA_INTEGER; - extern LPCWSTR SCHEMA_DECIMAL; - extern LPCWSTR SCHEMA_STRING; - extern LPCWSTR SCHEMA_QNAME; - extern LPCWSTR SCHEMA_CONDITIONAL; - - // - // Namespaces - // - extern LPCWSTR FRAMEWORK_URI; - extern LPCWSTR KEYWORDS_URI; - - // - // Element and attribute types defined in Printschema framework - // - extern LPCWSTR FEATURE_ELEMENT_NAME; - extern LPCWSTR OPTION_ELEMENT_NAME; - extern LPCWSTR PARAM_INIT_ELEMENT_NAME; - extern LPCWSTR PARAM_REF_ELEMENT_NAME; - extern LPCWSTR PARAM_DEF_ELEMENT_NAME; - extern LPCWSTR SCORED_PROP_ELEMENT_NAME; - extern LPCWSTR VALUE_ELEMENT_NAME; - extern LPCWSTR NAME_ATTRIBUTE_NAME; - extern LPCWSTR PROPERTY_ELEMENT_NAME; - - // - // Value types defined in the PrintSchema Keywords - // - extern LPCWSTR PICKONE_VALUE_NAME; - extern LPCWSTR SELECTIONTYPE_VALUE_NAME; - extern LPCWSTR DATATYPE_VALUE_NAME; - extern LPCWSTR DEFAULTVAL_VALUE_NAME; - extern LPCWSTR MAX_VALUE_NAME; - extern LPCWSTR MIN_VALUE_NAME; - extern LPCWSTR MAX_LENGTH_NAME; - extern LPCWSTR MIN_LENGTH_NAME; - extern LPCWSTR MULTIPLE_VALUE_NAME; - extern LPCWSTR MANDATORY_VALUE_NAME; - extern LPCWSTR UNITTYPE_VALUE_NAME; - extern LPCWSTR DISPLAYNAME_VALUE_NAME; - - // - // Root PrintTicket element - // - extern LPCWSTR PRINTTICKET_NAME; - - // - // Root PrintCapabilities element - // - extern LPCWSTR PRINTCAPABILITIES_NAME; -} - diff --git a/print/XPSDrvSmpl/src/common/wmdata.h b/print/XPSDrvSmpl/src/common/wmdata.h deleted file mode 100644 index effe32a5..00000000 --- a/print/XPSDrvSmpl/src/common/wmdata.h +++ /dev/null @@ -1,71 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmdata.h - -Abstract: - - PageWatermark data structure definition. This provides a convenient - description of the PrintSchema PageWatermark feature. - ---*/ - -#pragma once - -#include "wmschema.h" - -namespace XDPrintSchema -{ - namespace PageWatermark - { - struct WMTextData - { - WMTextData() : - bstrFontColor(L"#FFFFFF"), - fontSize(12), - bstrText(L"Undefined") - { - } - - CComBSTR bstrFontColor; - INT fontSize; - CComBSTR bstrText; - }; - - struct WatermarkData - { - WatermarkData() : - type(TextWatermark), - widthOrigin(0), - heightOrigin(0), - widthExtent(215900), - heightExtent(279400), - transparency(0), - angle(0), - layering(Layering::Overlay) - { - } - - EWatermarkOption type; - INT widthOrigin; - INT heightOrigin; - INT widthExtent; - INT heightExtent; - INT transparency; - INT angle; - WMTextData txtData; - Layering::ELayeringOption layering; - }; - } -} - diff --git a/print/XPSDrvSmpl/src/common/wmpchndlr.cpp b/print/XPSDrvSmpl/src/common/wmpchndlr.cpp deleted file mode 100644 index bab943b8..00000000 --- a/print/XPSDrvSmpl/src/common/wmpchndlr.cpp +++ /dev/null @@ -1,555 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmpchndlr.cpp - -Abstract: - - Page watermark PrintCapabilities handling implementation. The watermark PC handler - is used to set Page Watermark settings in a PrintCapabilities. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "xdexcept.h" -#include "wmpchndlr.h" -#include "privatedefs.h" - -using XDPrintSchema::PRINTCAPABILITIES_NAME; - -using XDPrintSchema::PageWatermark::TextWatermark; -using XDPrintSchema::PageWatermark::BitmapWatermark; -using XDPrintSchema::PageWatermark::VectorWatermark; -using XDPrintSchema::PageWatermark::ECommonWatermarkProps; -using XDPrintSchema::PageWatermark::ECommonWatermarkPropsMin; -using XDPrintSchema::PageWatermark::ECommonWatermarkPropsMax; -using XDPrintSchema::PageWatermark::ETextWatermarkProps; -using XDPrintSchema::PageWatermark::ETextWatermarkPropsMin; -using XDPrintSchema::PageWatermark::ETextWatermarkPropsMax; -using XDPrintSchema::PageWatermark::EVectBmpWatermarkProps; -using XDPrintSchema::PageWatermark::EVectBmpWatermarkPropsMin; -using XDPrintSchema::PageWatermark::EVectBmpWatermarkPropsMax; -using XDPrintSchema::PageWatermark::WATERMARK_FEATURE; -using XDPrintSchema::PageWatermark::WATERMARK_OPTIONS; -using XDPrintSchema::PageWatermark::CMN_WATERMARK_PROPS; -using XDPrintSchema::PageWatermark::TXT_WATERMARK_PROPS; -using XDPrintSchema::PageWatermark::VECTBMP_WATERMARK_PROPS; - -using XDPrintSchema::PageWatermark::Layering::ELayeringOption; -using XDPrintSchema::PageWatermark::Layering::ELayeringOptionMin; -using XDPrintSchema::PageWatermark::Layering::ELayeringOptionMax; -using XDPrintSchema::PageWatermark::Layering::LAYERING_FEATURE; -using XDPrintSchema::PageWatermark::Layering::LAYERING_OPTIONS; - -/*++ - -Routine Name: - - CWMPCHandler::CWMPCHandler - -Routine Description: - - CWMPCHandler class constructor - -Arguments: - - pPrintCapabilities - Pointer to the DOM document representation of the PrintCapabilities - -Return Value: - - None - ---*/ -CWMPCHandler::CWMPCHandler( - _In_ IXMLDOMDocument2* pPrintCapabilities - ) : - CPCHandler(pPrintCapabilities) -{ -} - -/*++ - -Routine Name: - - CWMPCHandler::~CWMPCHandler - -Routine Description: - - CWMPCHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CWMPCHandler::~CWMPCHandler() -{ -} - -/*++ - -Routine Name: - - CWMPCHandler::SetCapabilities - -Routine Description: - - This routine sets watermark capabilities in the PrintCapabilities passed to the - class constructor. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPCHandler::SetCapabilities( - VOID - ) -{ - HRESULT hr = S_OK; - - try - { - // - // Retrieve the PrintTicket root - // - CComPtr pPTRoot(NULL); - - CComBSTR bstrPTQuery(m_bstrFrameworkPrefix); - bstrPTQuery += PRINTCAPABILITIES_NAME; - - if (SUCCEEDED(hr = GetNode(bstrPTQuery, &pPTRoot))) - { - CComPtr pFeatureElement(NULL); - - if (SUCCEEDED(hr = CreateFeatureSelection(CComBSTR(WATERMARK_FEATURE), NULL, &pFeatureElement))) - { - CComPtr pTextOption(NULL); - - // - // Create the Text Watermark Options - // - if (SUCCEEDED(hr = CreateOption(CComBSTR(WATERMARK_OPTIONS[TextWatermark]), NULL, &pTextOption))) - { - PTDOMElementVector propertList; - - // - // Create the common scored property list - // - for (ECommonWatermarkProps cmnProps = ECommonWatermarkPropsMin; - cmnProps < ECommonWatermarkPropsMax && SUCCEEDED(hr); - cmnProps = static_cast(cmnProps + 1)) - { - CComPtr pScoredProperty(NULL); - - if (SUCCEEDED(hr = CreateScoredProperty(CComBSTR(CMN_WATERMARK_PROPS[cmnProps]), &pScoredProperty))) - { - CComPtr pParamRef(NULL); - - // - // Construct the parameter reference elements - // - CComBSTR bstrPRefName(WATERMARK_FEATURE); - - if (wcscmp(CMN_WATERMARK_PROPS[cmnProps], L"Angle") == 0) - { - hr = bstrPRefName.Append(L"Text"); - } - - bstrPRefName += CMN_WATERMARK_PROPS[cmnProps]; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CreateParameterRef(bstrPRefName, &pParamRef))) - { - hr = pScoredProperty->appendChild(pParamRef, NULL); - } - - propertList.push_back(pScoredProperty); - } - } - - // - // Create the text specific scored property list - // - for (ETextWatermarkProps txtProps = ETextWatermarkPropsMin; - txtProps < ETextWatermarkPropsMax && SUCCEEDED(hr); - txtProps = static_cast(txtProps + 1)) - { - CComPtr pScoredProperty(NULL); - - if (SUCCEEDED(hr = CreateScoredProperty(CComBSTR(TXT_WATERMARK_PROPS[txtProps]), &pScoredProperty))) - { - CComPtr pParamRef(NULL); - - // - // Construct the parameter reference elements - // - CComBSTR bstrPRefName(WATERMARK_FEATURE); - bstrPRefName += TXT_WATERMARK_PROPS[txtProps]; - - if (SUCCEEDED(hr = CreateParameterRef(bstrPRefName, &pParamRef))) - { - hr = pScoredProperty->appendChild(pParamRef, NULL); - } - - propertList.push_back(pScoredProperty); - } - } - - // - // Add the properties to the text option - // - PTDOMElementVector::iterator iterPropertList = propertList.begin(); - - for (;iterPropertList != propertList.end() && SUCCEEDED(hr); iterPropertList++) - { - hr = pTextOption->appendChild(*iterPropertList, NULL); - } - - if (SUCCEEDED(hr)) - { - hr = pFeatureElement->appendChild(pTextOption, NULL); - } - } - - CComPtr pVectorOption(NULL); - - // - // Create the Vector Watermark Options - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CreateOption(CComBSTR(WATERMARK_OPTIONS[VectorWatermark]), NULL, &pVectorOption))) - { - PTDOMElementVector propertList; - - // - // Create the common scored property list - // - for (ECommonWatermarkProps cmnProps = ECommonWatermarkPropsMin; - cmnProps < ECommonWatermarkPropsMax && SUCCEEDED(hr); - cmnProps = static_cast(cmnProps + 1)) - { - CComPtr pScoredProperty(NULL); - - if (SUCCEEDED(hr = CreateScoredProperty(CComBSTR(CMN_WATERMARK_PROPS[cmnProps]), &pScoredProperty))) - { - CComPtr pParamRef(NULL); - - // - // Construct the parameter reference elements - // - CComBSTR bstrPRefName(WATERMARK_FEATURE); - - if (wcscmp(CMN_WATERMARK_PROPS[cmnProps], L"Angle") == 0) - { - bstrPRefName += WATERMARK_OPTIONS[TextWatermark]; - } - - bstrPRefName += CMN_WATERMARK_PROPS[cmnProps]; - - if (SUCCEEDED(hr = CreateParameterRef(bstrPRefName, &pParamRef))) - { - hr = pScoredProperty->appendChild(pParamRef, NULL); - } - - propertList.push_back(pScoredProperty); - } - } - - // - // Create the vector specific property list - // - for (EVectBmpWatermarkProps vectProps = EVectBmpWatermarkPropsMin; - vectProps < EVectBmpWatermarkPropsMax && SUCCEEDED(hr); - vectProps = static_cast(vectProps + 1)) - { - // - // Create the scored property element - // - CComPtr pScoredProperty(NULL); - - if (SUCCEEDED(hr = CreateScoredProperty(CComBSTR(VECTBMP_WATERMARK_PROPS[vectProps]), &pScoredProperty))) - { - CComPtr pParamRef(NULL); - - // - // Construct the parameter reference elements - // - CComBSTR bstrPRefName(WATERMARK_FEATURE); - bstrPRefName += VECTBMP_WATERMARK_PROPS[vectProps]; - - if (SUCCEEDED(hr = CreateParameterRef(bstrPRefName, &pParamRef))) - { - hr = pScoredProperty->appendChild(pParamRef, NULL); - } - - propertList.push_back(pScoredProperty); - } - } - - // - // Add the properties to the vector option - // - PTDOMElementVector::iterator iterPropertList = propertList.begin(); - - for (;iterPropertList != propertList.end() && SUCCEEDED(hr); iterPropertList++) - { - hr = pVectorOption->appendChild(*iterPropertList, NULL); - } - - if (SUCCEEDED(hr)) - { - hr = pFeatureElement->appendChild(pVectorOption, NULL); - } - } - - CComPtr pBitmapOption(NULL); - - // - // Create the Bitmap Watermark Options - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CreateOption(CComBSTR(WATERMARK_OPTIONS[BitmapWatermark]), NULL, &pBitmapOption))) - { - PTDOMElementVector propertList; - - // - // Create the common scored property list - // - for (ECommonWatermarkProps cmnProps = ECommonWatermarkPropsMin; - cmnProps < ECommonWatermarkPropsMax && SUCCEEDED(hr); - cmnProps = static_cast(cmnProps + 1)) - { - CComPtr pScoredProperty(NULL); - - if (SUCCEEDED(hr = CreateScoredProperty(CComBSTR(CMN_WATERMARK_PROPS[cmnProps]), &pScoredProperty))) - { - CComPtr pParamRef(NULL); - - // - // Construct the parameter reference elements - // - CComBSTR bstrPRefName(WATERMARK_FEATURE); - - if (wcscmp(CMN_WATERMARK_PROPS[cmnProps], L"Angle") == 0) - { - hr = bstrPRefName.Append(L"Text"); - } - - bstrPRefName += CMN_WATERMARK_PROPS[cmnProps]; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CreateParameterRef(bstrPRefName, &pParamRef))) - { - hr = pScoredProperty->appendChild(pParamRef, NULL); - } - - propertList.push_back(pScoredProperty); - } - } - - // - // Create the bitmap specific property list - // - for (EVectBmpWatermarkProps bmpProps = EVectBmpWatermarkPropsMin; - bmpProps < EVectBmpWatermarkPropsMax && SUCCEEDED(hr); - bmpProps = static_cast(bmpProps + 1)) - { - // - // Create the scored property element - // - CComPtr pScoredProperty(NULL); - - if (SUCCEEDED(hr = CreateScoredProperty(CComBSTR(VECTBMP_WATERMARK_PROPS[bmpProps]), &pScoredProperty))) - { - CComPtr pParamRef(NULL); - - // - // Construct the parameter reference elements - // - CComBSTR bstrPRefName(WATERMARK_FEATURE); - bstrPRefName += VECTBMP_WATERMARK_PROPS[bmpProps]; - - if (SUCCEEDED(hr = CreateParameterRef(bstrPRefName, &pParamRef))) - { - hr = pScoredProperty->appendChild(pParamRef, NULL); - } - - propertList.push_back(pScoredProperty); - } - } - - // - // Add the properties to the bitmap option - // - PTDOMElementVector::iterator iterPropertList = propertList.begin(); - - for (;iterPropertList != propertList.end() && SUCCEEDED(hr); iterPropertList++) - { - hr = pBitmapOption->appendChild(*iterPropertList, NULL); - } - - if (SUCCEEDED(hr)) - { - hr = pFeatureElement->appendChild(pBitmapOption, NULL); - } - } - - CComPtr pLayeringFeature(NULL); - - // - // Create the layering feature options - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CreateFeature(CComBSTR(LAYERING_FEATURE), NULL, &pLayeringFeature))) - { - PTDOMElementVector optionList; - - // - // Create the layering option list - // - for (ELayeringOption wmLayering = ELayeringOptionMin; - wmLayering < ELayeringOptionMax && SUCCEEDED(hr); - wmLayering = static_cast(wmLayering + 1)) - { - CComPtr pOptionProperty(NULL); - - if (SUCCEEDED(hr = CreateOption(CComBSTR(LAYERING_OPTIONS[wmLayering]), NULL, &pOptionProperty))) - { - optionList.push_back(pOptionProperty); - } - } - - // - // Add the options to the layering feature - // - PTDOMElementVector::iterator iterOptionList = optionList.begin(); - - for (;iterOptionList != optionList.end() && SUCCEEDED(hr); iterOptionList++) - { - hr = pLayeringFeature->appendChild(*iterOptionList, NULL); - } - - if (SUCCEEDED(hr)) - { - hr = pFeatureElement->appendChild(pLayeringFeature, NULL); - } - } - - if (SUCCEEDED(hr)) - { - hr = pPTRoot->appendChild(pFeatureElement, NULL); - } - } - - // - // Create the integer parameter defs - // - for (UINT cIndex = 0; SUCCEEDED(hr) && cIndex < numof(wmParamDefIntegers); cIndex++) - { - CComPtr pParameterDef(NULL); - - // - // PageWatermarkTextColor has no associated multiple value - // - INT multiple; - if (wcscmp(CComBSTR(wmParamDefIntegers[cIndex].property_name), L"PageWatermarkTextColor") == 0) - { - // - // convert integer representation into a string parameter in the - // PrintCapabilities. This is a special case because it's treated - // as an int in the DEVMODE & a string in the PrintTicket - // - CComBSTR bstrDefault(L"#AARRGGBB"); - hr = StringCchPrintf(bstrDefault, SysStringLen(bstrDefault)+1, TEXT("#%.8X"), wmParamDefIntegers[cIndex].default_value); - - if (SUCCEEDED(hr)) - { - hr = CreateStringParameterDef(CComBSTR(wmParamDefIntegers[cIndex].property_name), // Paramater Name - TRUE, // Is Print Schema keyword? - CComBSTR(wmParamDefIntegers[cIndex].display_name), // Display Text - bstrDefault, // Default - 9, // Min Length: - // table contains min value, which is different - 9, // Max Length: - // table contains min value, which is different - CComBSTR(wmParamDefIntegers[cIndex].unit_type), // Unit Type - &pParameterDef); // Parameter Def - } - } - else - { - multiple = wmParamDefIntegers[cIndex].multiple; - - hr = CreateIntParameterDef(CComBSTR(wmParamDefIntegers[cIndex].property_name), // Paramater Name - wmParamDefIntegers[cIndex].is_public, // Is Print Schema keyword? - CComBSTR(wmParamDefIntegers[cIndex].display_name), // Display Text - wmParamDefIntegers[cIndex].default_value, // Default - wmParamDefIntegers[cIndex].min_length, // Min value - wmParamDefIntegers[cIndex].max_length, // Max value - multiple, // Multiple - CComBSTR(wmParamDefIntegers[cIndex].unit_type), // Unit Type - &pParameterDef); // Parameter Def - } - - if (SUCCEEDED(hr)) - { - hr = pPTRoot->appendChild(pParameterDef, NULL); - } - } - - // - // Create the string parameter defs - // - for (UINT cIndex = 0; SUCCEEDED(hr) && cIndex < numof(wmParamDefStrings); cIndex++) - { - CComPtr pParameterDef(NULL); - - if (SUCCEEDED(hr = CreateStringParameterDef(CComBSTR(wmParamDefStrings[cIndex].property_name), // Paramater Name - TRUE, // Is Print Schema keyword? - CComBSTR(wmParamDefStrings[cIndex].display_name), // Display Text - CComBSTR(wmParamDefStrings[cIndex].default_value), // Default - wmParamDefStrings[cIndex].min_length, // Min Length - wmParamDefStrings[cIndex].max_length, // Max Length - CComBSTR(wmParamDefStrings[cIndex].unit_type), // Unit Type - &pParameterDef))) // Parameter Def - { - hr = pPTRoot->appendChild(pParameterDef, NULL); - } - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/wmpchndlr.h b/print/XPSDrvSmpl/src/common/wmpchndlr.h deleted file mode 100644 index 2ffcaada..00000000 --- a/print/XPSDrvSmpl/src/common/wmpchndlr.h +++ /dev/null @@ -1,41 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmpchndlr.h - -Abstract: - - Page Watermark PrintCapabilities handling definition. The booklet PC handler - is used to set booklet settings in a PrintCapabilities. - ---*/ - -#pragma once - -#include "pchndlr.h" -#include "wmdata.h" - -class CWMPCHandler : public CPCHandler -{ -public: - CWMPCHandler( - _In_ IXMLDOMDocument2* pPrintCapabilities - ); - - virtual ~CWMPCHandler(); - - HRESULT - SetCapabilities( - VOID - ); -}; diff --git a/print/XPSDrvSmpl/src/common/wmpthndlr.cpp b/print/XPSDrvSmpl/src/common/wmpthndlr.cpp deleted file mode 100644 index 49792d6a..00000000 --- a/print/XPSDrvSmpl/src/common/wmpthndlr.cpp +++ /dev/null @@ -1,1167 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmpthndlr.cpp - -Abstract: - - PageWatermark PrintTicket handler implementation. Derived from CPTHandler, - this provides PageWatermark specific Get and Set methods acting on the - PrintTicket passed (as a DOM document). - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "wmpthndlr.h" - -using XDPrintSchema::PRINTTICKET_NAME; -using XDPrintSchema::NAME_ATTRIBUTE_NAME; -using XDPrintSchema::SCHEMA_DECIMAL; -using XDPrintSchema::SCHEMA_INTEGER; -using XDPrintSchema::SCHEMA_STRING; - -using XDPrintSchema::PageWatermark::WatermarkData; - -using XDPrintSchema::PageWatermark::EWatermarkOption; -using XDPrintSchema::PageWatermark::EWatermarkOptionMin; -using XDPrintSchema::PageWatermark::NoWatermark; -using XDPrintSchema::PageWatermark::TextWatermark; -using XDPrintSchema::PageWatermark::BitmapWatermark; -using XDPrintSchema::PageWatermark::VectorWatermark; -using XDPrintSchema::PageWatermark::EWatermarkOptionMax; - -using XDPrintSchema::PageWatermark::ECommonWatermarkProps; -using XDPrintSchema::PageWatermark::ECommonWatermarkPropsMin; -using XDPrintSchema::PageWatermark::WidthOrigin; -using XDPrintSchema::PageWatermark::HeightOrigin; -using XDPrintSchema::PageWatermark::Transparency; -using XDPrintSchema::PageWatermark::Angle; -using XDPrintSchema::PageWatermark::ECommonWatermarkPropsMax; - -using XDPrintSchema::PageWatermark::ETextWatermarkProps; -using XDPrintSchema::PageWatermark::ETextWatermarkPropsMin; -using XDPrintSchema::PageWatermark::FontColor; -using XDPrintSchema::PageWatermark::FontSize; -using XDPrintSchema::PageWatermark::Text; -using XDPrintSchema::PageWatermark::ETextWatermarkPropsMax; - -using XDPrintSchema::PageWatermark::EVectBmpWatermarkProps; -using XDPrintSchema::PageWatermark::EVectBmpWatermarkPropsMin; -using XDPrintSchema::PageWatermark::WidthExtent; -using XDPrintSchema::PageWatermark::HeightExtent; -using XDPrintSchema::PageWatermark::EVectBmpWatermarkPropsMax; - -using XDPrintSchema::PageWatermark::WATERMARK_FEATURE; -using XDPrintSchema::PageWatermark::WATERMARK_OPTIONS; -using XDPrintSchema::PageWatermark::CMN_WATERMARK_PROPS; -using XDPrintSchema::PageWatermark::TXT_WATERMARK_PROPS; -using XDPrintSchema::PageWatermark::VECTBMP_WATERMARK_PROPS; - -using XDPrintSchema::PageWatermark::Layering::ELayeringOption; - -using XDPrintSchema::PageWatermark::Layering::ELayeringOptionMin; -using XDPrintSchema::PageWatermark::Layering::Overlay; -using XDPrintSchema::PageWatermark::Layering::Underlay; -using XDPrintSchema::PageWatermark::Layering::ELayeringOptionMax; - -using XDPrintSchema::PageWatermark::Layering::LAYERING_FEATURE; -using XDPrintSchema::PageWatermark::Layering::LAYERING_OPTIONS; - -/*++ - -Routine Name: - - CWMPTHandler::CWMPTHandler - -Routine Description: - - CWMPTHandler class constructor - -Arguments: - - pPrintTicket - Pointer to the DOM document representation of the PrintTicket - -Return Value: - - None - ---*/ -CWMPTHandler::CWMPTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ) : - CPTHandler(pPrintTicket) -{ -} - -/*++ - -Routine Name: - - CWMPTHandler::~CWMPTHandler - -Routine Description: - - CWMPTHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CWMPTHandler::~CWMPTHandler() -{ -} - -/*++ - -Routine Name: - - CWMPTHandler::GetData - -Routine Description: - - The routine fills the data structure passed in with watermark data retrieved from - the PrintTicket passed to the class constructor. - -Arguments: - - pWmData - Pointer to the watermark data structure to be filled in - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - Feature not present in PrintTicket - E_* - On error - ---*/ -HRESULT -CWMPTHandler::GetData( - _Out_ WatermarkData* pWmData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pWmData, E_POINTER))) - { - CComBSTR bstrWMOption; - CComBSTR bstrLayerOption; - - if (SUCCEEDED(hr = GetFeatureOption(CComBSTR(WATERMARK_FEATURE), &bstrWMOption)) && - SUCCEEDED(hr = GetSubFeatureOption(CComBSTR(WATERMARK_FEATURE), - CComBSTR(LAYERING_FEATURE), - &bstrLayerOption)) && - SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(WATERMARK_FEATURE), - CComBSTR(CMN_WATERMARK_PROPS[WidthOrigin]), - &pWmData->widthOrigin)) && - SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(WATERMARK_FEATURE), - CComBSTR(CMN_WATERMARK_PROPS[HeightOrigin]), - &pWmData->heightOrigin)) && - SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(WATERMARK_FEATURE), - CComBSTR(CMN_WATERMARK_PROPS[Transparency]), - &pWmData->transparency)) && - SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(WATERMARK_FEATURE), - CComBSTR(CMN_WATERMARK_PROPS[Angle]), - &pWmData->angle))) - { - if (bstrWMOption == WATERMARK_OPTIONS[BitmapWatermark]) - { - pWmData->type = BitmapWatermark; - - if (SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(WATERMARK_FEATURE), - CComBSTR(VECTBMP_WATERMARK_PROPS[WidthExtent]), - &pWmData->widthExtent))) - { - hr = GetScoredPropertyValue(CComBSTR(WATERMARK_FEATURE), - CComBSTR(VECTBMP_WATERMARK_PROPS[HeightExtent]), - &pWmData->heightExtent); - } - - } - else if (bstrWMOption == WATERMARK_OPTIONS[TextWatermark]) - { - pWmData->type = TextWatermark; - if (SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(WATERMARK_FEATURE), - CComBSTR(TXT_WATERMARK_PROPS[FontColor]), - &pWmData->txtData.bstrFontColor)) && - SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(WATERMARK_FEATURE), - CComBSTR(TXT_WATERMARK_PROPS[FontSize]), - &pWmData->txtData.fontSize))) - { - hr = GetScoredPropertyValue(CComBSTR(WATERMARK_FEATURE), - CComBSTR(TXT_WATERMARK_PROPS[Text]), - &pWmData->txtData.bstrText); - } - } - else if (bstrWMOption == WATERMARK_OPTIONS[VectorWatermark]) - { - pWmData->type = VectorWatermark; - - if (SUCCEEDED(hr = GetScoredPropertyValue(CComBSTR(WATERMARK_FEATURE), - CComBSTR(VECTBMP_WATERMARK_PROPS[WidthExtent]), - &pWmData->widthExtent))) - { - hr = GetScoredPropertyValue(CComBSTR(WATERMARK_FEATURE), - CComBSTR(VECTBMP_WATERMARK_PROPS[HeightExtent]), - &pWmData->heightExtent); - } - } - else - { - hr = E_FAIL; - } - - if (SUCCEEDED(hr)) - { - if (bstrLayerOption == LAYERING_OPTIONS[Underlay]) - { - pWmData->layering = Underlay; - } - else if (bstrLayerOption == LAYERING_OPTIONS[Overlay]) - { - pWmData->layering = Overlay; - } - else - { - hr = E_FAIL; - } - } - } - - if (hr == E_ELEMENT_NOT_FOUND) - { - pWmData->type = NoWatermark; - } - } - - // - // Validate the data - // - if (SUCCEEDED(hr)) - { - if (pWmData->type < EWatermarkOptionMin || - pWmData->type >= EWatermarkOptionMax || - pWmData->layering < ELayeringOptionMin || - pWmData->layering >= ELayeringOptionMax) - { - hr = E_FAIL; - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CWMPTHandler::SetData - -Routine Description: - - This routine sets the watermark data in the PrintTicket passed to the - class constructor. - -Arguments: - - pWmData - Pointer to the watermark data to be set in the PrintTicket - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTHandler::SetData( - _In_ CONST WatermarkData* pWmData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pWmData, E_POINTER))) - { - try - { - // - // Remove any existing watermark feature node - // - if (SUCCEEDED(hr = Delete()) && - pWmData->type != NoWatermark) - { - // - // Construct the appropriate watermark element - // - CComPtr pWMDataElem(NULL); - PTDOMElementVector paramInitList; - - switch (pWmData->type) - { - case TextWatermark: - { - hr = CreateTextWMElements(pWmData, &pWMDataElem, ¶mInitList); - } - break; - - case BitmapWatermark: - { - hr = CreateBitmapWMElements(pWmData, &pWMDataElem, ¶mInitList); - } - break; - - case VectorWatermark: - { - hr = CreateVectorWMElements(pWmData, &pWMDataElem, ¶mInitList); - } - break; - - default: - { - hr = E_FAIL; - } - break; - } - - // - // Insert the watermark and paramater init nodes - // - CComPtr pPTRoot(NULL); - - CComBSTR bstrPTQuery(m_bstrFrameworkPrefix); - bstrPTQuery += PRINTTICKET_NAME; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = GetNode(bstrPTQuery, &pPTRoot))) - { - hr = pPTRoot->appendChild(pWMDataElem, NULL); - - PTDOMElementVector::iterator iterParamInit = paramInitList.begin(); - - for (;iterParamInit != paramInitList.end() && SUCCEEDED(hr); iterParamInit++) - { - hr = pPTRoot->appendChild(*iterParamInit, NULL); - } - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTHandler::Delete - -Routine Description: - - This routine deletes the watermark feature from the PrintTicket passed to the - class constructor - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTHandler::Delete( - VOID - ) -{ - // - // Remove any existing watermark feature node - // - HRESULT hr = DeleteFeature(CComBSTR(WATERMARK_FEATURE)); - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTHandler::CreateCommonWMElements - -Routine Description: - - This routine creates all the DOM elements common to all Watermark types. Note that - this routine also returns the option element seperately (so the caller can specify the - watermark type) and a list of the ParameterInit elements (so the caller can append them - to the root PrintTicket element) - -Arguments: - - pWmData - Pointer to the watermark data structure - ppWMDataElem - Pointer to an IXMLDOMElement pointer that recieves feature element - ppOptionElem - Pointer to an IXMLDOMElement pointer that recieves option element - pParamInitList - Pointer to a vector of DOM element pointers that recieves the parameter init elements - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTHandler::CreateCommonWMElements( - _In_ CONST WatermarkData* pWmData, - _Outptr_ IXMLDOMElement** ppWMDataElem, - _Outptr_ IXMLDOMElement** ppOptionElem, - _Out_ PTDOMElementVector* pParamInitList - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pWmData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppWMDataElem, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppOptionElem, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pParamInitList, E_POINTER))) - { - *ppWMDataElem = NULL; - - if (pWmData->layering < ELayeringOptionMin || - pWmData->layering >= ELayeringOptionMax) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - // - // Create the feature option pair - CreateFeatureOptionPair does not - // set the option name, this is done in the calling function - // - if (SUCCEEDED(hr = CreateFeatureOptionPair(CComBSTR(WATERMARK_FEATURE), ppWMDataElem, ppOptionElem))) - { - // - // Over all common properties, create and insert the element - // - for (ECommonWatermarkProps cmnProps = ECommonWatermarkPropsMin; - cmnProps < ECommonWatermarkPropsMax && SUCCEEDED(hr); - cmnProps = static_cast(cmnProps + 1)) - { - // - // Create the scored property element - // - CComPtr pScoredProperty(NULL); - - if (SUCCEEDED(hr = CreateScoredProperty(CComBSTR(CMN_WATERMARK_PROPS[cmnProps]), &pScoredProperty))) - { - // - // Construct the param ref and param init elements - // - CComBSTR bstrPRefName(WATERMARK_FEATURE); - - if (wcscmp(CMN_WATERMARK_PROPS[cmnProps], L"Angle") == 0) - { - bstrPRefName += L"Text"; - } - - bstrPRefName += CMN_WATERMARK_PROPS[cmnProps]; - - CComPtr pParamRef(NULL); - CComPtr pParamInit(NULL); - - CComBSTR bstrType; - CComBSTR bstrValue; - - if (SUCCEEDED(hr = GetCmnPropTypeAndValue(pWmData, cmnProps, &bstrType, &bstrValue)) && - SUCCEEDED(hr = CreateParamRefInitPair(bstrPRefName, bstrType, bstrValue, &pParamRef, &pParamInit))) - { - // - // Append the parameter ref element to the scored property, append the - // scored property to the option element and add the parameter init - // element to the vector - // - CComPtr pPRInserted(NULL); - CComPtr pSPInserted(NULL); - - if (SUCCEEDED(hr = pScoredProperty->appendChild(pParamRef, &pPRInserted)) && - SUCCEEDED(hr = (*ppOptionElem)->appendChild(pScoredProperty, &pSPInserted))) - { - try - { - pParamInitList->push_back(pParamInit); - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - } - } - } - } - - // - // Create the layering feature - // - CComPtr pLayeringElement(NULL); - CComPtr pLayeringOptionElement(NULL); - - CComBSTR bstrAttribName(m_bstrKeywordsPrefix); - bstrAttribName += LAYERING_OPTIONS[pWmData->layering]; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CreateFeatureOptionPair(CComBSTR(LAYERING_FEATURE), - CComBSTR(LAYERING_OPTIONS[pWmData->layering]), - &pLayeringElement, - &pLayeringOptionElement))) - { - // - // Append the layering feature to the watermark feature node - // - hr = (*ppWMDataElem)->appendChild(pLayeringElement, NULL); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTHandler::CreateCommonVectBmpWMElements - -Routine Description: - - This routine creates all the DOM elements common to all the vector and bitmap Watermark types. - -Arguments: - - pWmData - Pointer to the watermark data structure - pOptionElem - Pointer to an IXMLDOMElement to append the elements to - pParamInitList - Pointer to a vector of DOM element pointers that recieves the parameter init elements - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTHandler::CreateCommonVectBmpWMElements( - _In_ CONST WatermarkData* pWmData, - _In_ IXMLDOMElement* pOptionElem, - _Out_ PTDOMElementVector* pParamInitList - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pWmData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pOptionElem, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pParamInitList, E_POINTER))) - { - // - // Over all common properties, create and insert the element - // - for (EVectBmpWatermarkProps vectBmpProps = EVectBmpWatermarkPropsMin; - vectBmpProps < EVectBmpWatermarkPropsMax && SUCCEEDED(hr); - vectBmpProps = static_cast(vectBmpProps + 1)) - { - // - // Create the scored property element - // - CComPtr pScoredProperty(NULL); - - if (SUCCEEDED(hr = CreateScoredProperty(CComBSTR(VECTBMP_WATERMARK_PROPS[vectBmpProps]), &pScoredProperty))) - { - // - // Construct the param ref and param init elements - // - CComBSTR bstrPRefName(WATERMARK_FEATURE); - bstrPRefName += VECTBMP_WATERMARK_PROPS[vectBmpProps]; - - CComPtr pParamRef(NULL); - CComPtr pParamInit(NULL); - - CComBSTR bstrType; - CComBSTR bstrValue; - - if (SUCCEEDED(hr = GetCmnVectBmpPropTypeAndValue(pWmData, vectBmpProps, &bstrType, &bstrValue)) && - SUCCEEDED(hr = CreateParamRefInitPair(bstrPRefName, bstrType, bstrValue, &pParamRef, &pParamInit))) - { - // - // Append the parameter ref element to the scored property, append the - // scored property to the option element and add the parameter init - // element to the vector - // - CComPtr pPRInserted(NULL); - CComPtr pSPInserted(NULL); - - if (SUCCEEDED(hr = pScoredProperty->appendChild(pParamRef, &pPRInserted)) && - SUCCEEDED(hr = pOptionElem->appendChild(pScoredProperty, &pSPInserted))) - { - try - { - pParamInitList->push_back(pParamInit); - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTHandler::CreateTextWMElements - -Routine Description: - - This routine creates a text watermark feature in the PrintTicket - -Arguments: - - pWmData - Pointer to the watermark data structure - ppWMDataElem - Pointer to an IXMLDOMElement pointer that recieves feature element - pParamInitList - P:ointer to a vector of DOM element pointers that recieves the parameter init elements - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTHandler::CreateTextWMElements( - _In_ CONST WatermarkData* pWmData, - _Outptr_ IXMLDOMElement** ppWMDataElem, - _Out_ PTDOMElementVector* pParamInitList - ) -{ - HRESULT hr = S_OK; - - CComPtr pOptionElem(NULL); - - if (SUCCEEDED(hr = CHECK_POINTER(pWmData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppWMDataElem, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pParamInitList, E_POINTER)) && - SUCCEEDED(hr = CreateCommonWMElements(pWmData, ppWMDataElem, &pOptionElem, pParamInitList))) - { - // - // Set the option node name attribute - // - CComBSTR bstrAttribName(m_bstrKeywordsPrefix); - bstrAttribName += WATERMARK_OPTIONS[TextWatermark]; - - hr = CreateXMLAttribute(pOptionElem, NAME_ATTRIBUTE_NAME, NULL, bstrAttribName ); - } - - // - // Write out the text specific options - // - if (SUCCEEDED(hr)) - { - for (ETextWatermarkProps txtProps = ETextWatermarkPropsMin; - txtProps < ETextWatermarkPropsMax && SUCCEEDED(hr); - txtProps = static_cast(txtProps + 1)) - { - // - // Create the scored property element - // - CComPtr pScoredProperty(NULL); - - if (SUCCEEDED(hr = CreateScoredProperty(CComBSTR(TXT_WATERMARK_PROPS[txtProps]), &pScoredProperty))) - { - // - // Construct the param ref and param init elements - // - CComBSTR bstrPRefName(WATERMARK_FEATURE); - bstrPRefName += TXT_WATERMARK_PROPS[txtProps]; - - CComPtr pParamRef(NULL); - CComPtr pParamInit(NULL); - - CComBSTR bstrType; - CComBSTR bstrValue; - - if (SUCCEEDED(hr = GetTxtPropTypeAndValue(pWmData, txtProps, &bstrType, &bstrValue)) && - SUCCEEDED(hr = CreateParamRefInitPair(bstrPRefName, bstrType, bstrValue, &pParamRef, &pParamInit))) - { - // - // Append the parameter ref element to the scored property, append the - // scored property to the option element and add the parameter init - // element to the param init list - // - CComPtr pPRInserted(NULL); - CComPtr pSPInserted(NULL); - - if (SUCCEEDED(hr = pScoredProperty->appendChild(pParamRef, &pPRInserted)) && - SUCCEEDED(hr = pOptionElem->appendChild(pScoredProperty, &pSPInserted))) - { - try - { - pParamInitList->push_back(pParamInit); - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTHandler::CreateBitmapWMElements - -Routine Description: - - This routine creates a bitmap watermark feature in the PrintTicket - -Arguments: - - pWmData - Pointer to the watermark data structure - ppWMDataElem - Pointer to an IXMLDOMElement pointer that recieves feature element - pParamInitList - P:ointer to a vector of DOM element pointers that recieves the parameter init elements - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTHandler::CreateBitmapWMElements( - _In_ CONST WatermarkData* pWmData, - _Outptr_ IXMLDOMElement** ppWMDataElem, - _Out_ PTDOMElementVector* pParamInitList - ) -{ - HRESULT hr = S_OK; - - CComPtr pOptionElem(NULL); - - if (SUCCEEDED(hr = CHECK_POINTER(pWmData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppWMDataElem, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pParamInitList, E_POINTER)) && - SUCCEEDED(hr = CreateCommonWMElements(pWmData, ppWMDataElem, &pOptionElem, pParamInitList)) && - SUCCEEDED(hr = CreateCommonVectBmpWMElements(pWmData, pOptionElem, pParamInitList))) - { - // - // Set the option node name attribute - // - CComBSTR bstrAttribName(m_bstrKeywordsPrefix); - bstrAttribName += WATERMARK_OPTIONS[BitmapWatermark]; - - hr = CreateXMLAttribute(pOptionElem, NAME_ATTRIBUTE_NAME, NULL, bstrAttribName ); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTHandler::CreateVectorWMElements - -Routine Description: - - This routine creates a vector watermark feature in the PrintTicket - -Arguments: - - pWmData - Pointer to the watermark data structure - ppWMDataElem - Pointer to an IXMLDOMElement pointer that recieves feature element - pParamInitList - P:ointer to a vector of DOM element pointers that recieves the parameter init elements - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTHandler::CreateVectorWMElements( - _In_ CONST WatermarkData* pWmData, - _Outptr_ IXMLDOMElement** ppWMDataElem, - _Out_ PTDOMElementVector* pParamInitList - ) -{ - HRESULT hr = S_OK; - - CComPtr pOptionElem(NULL); - - if (SUCCEEDED(hr = CHECK_POINTER(pWmData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppWMDataElem, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pParamInitList, E_POINTER)) && - SUCCEEDED(hr = CreateCommonWMElements(pWmData, ppWMDataElem, &pOptionElem, pParamInitList)) && - SUCCEEDED(hr = CreateCommonVectBmpWMElements(pWmData, pOptionElem, pParamInitList))) - { - // - // Set the option node name attribute - // - CComBSTR bstrAttribName(m_bstrKeywordsPrefix); - bstrAttribName += WATERMARK_OPTIONS[VectorWatermark]; - - hr = CreateXMLAttribute(pOptionElem, NAME_ATTRIBUTE_NAME, NULL, bstrAttribName ); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTHandler::GetCmnPropTypeAndValue - -Routine Description: - - This routine initalises the type and value strings for a given common watermark property - -Arguments: - - pWmData - Pointer to a watermark data structure with the watermark settings - cmnProps - The watermark setting to retrieve the type and value for - pbstrType - Pointer to a BSTR that recieves the type of the value - pbstrValue - Pointer to a BSTR that recieves the value as a string - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTHandler::GetCmnPropTypeAndValue( - _In_ CONST WatermarkData* pWmData, - _In_ CONST ECommonWatermarkProps cmnProps, - _Outptr_ BSTR* pbstrType, - _Outptr_ BSTR* pbstrValue - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pWmData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pbstrType, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pbstrValue, E_POINTER))) - { - if (cmnProps < ECommonWatermarkPropsMin || - cmnProps >= ECommonWatermarkPropsMax) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - try - { - CStringXDW cstrType; - CStringXDW cstrValue; - - switch (cmnProps) - { - case WidthOrigin: - { - cstrType = SCHEMA_INTEGER; - cstrValue.Format(L"%i", pWmData->widthOrigin); - } - break; - - case HeightOrigin: - { - cstrType = SCHEMA_INTEGER; - cstrValue.Format(L"%i", pWmData->heightOrigin); - } - break; - - case Transparency: - { - cstrType = SCHEMA_INTEGER; - cstrValue.Format(L"%i", pWmData->transparency); - } - break; - - case Angle: - { - cstrType = SCHEMA_INTEGER; - cstrValue.Format(L"%i", pWmData->angle); - } - break; - - default: - { - hr = E_FAIL; - ERR("Unknown common watermark property\n"); - } - break; - } - - if (SUCCEEDED(hr)) - { - *pbstrType = cstrType.AllocSysString(); - *pbstrValue = cstrValue.AllocSysString(); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTHandler::GetCmnVectBmpPropTypeAndValue - -Routine Description: - - This routine initalises the type and value strings for a common vector and bitmap - watermark properties - -Arguments: - - pWmData - Pointer to a watermark data structure with the watermark settings - cmnProps - The setting to retrieve the type and value for - pbstrType - Pointer to a BSTR that recieves the type of the value - pbstrValue - Pointer to a BSTR that recieves the value as a string - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTHandler::GetCmnVectBmpPropTypeAndValue( - _In_ CONST WatermarkData* pWmData, - _In_ CONST EVectBmpWatermarkProps cmnProps, - _Outptr_ BSTR* pbstrType, - _Outptr_ BSTR* pbstrValue - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pWmData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pbstrType, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pbstrValue, E_POINTER))) - { - if (cmnProps < EVectBmpWatermarkPropsMin || - cmnProps >= EVectBmpWatermarkPropsMax) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - try - { - CStringXDW cstrType; - CStringXDW cstrValue; - - switch (cmnProps) - { - case WidthExtent: - { - cstrType = SCHEMA_INTEGER; - cstrValue.Format(L"%i", pWmData->widthExtent); - } - break; - - case HeightExtent: - { - cstrType = SCHEMA_INTEGER; - cstrValue.Format(L"%i", pWmData->heightExtent); - } - break; - - default: - { - hr = E_FAIL; - ERR("Unknown common watermark property\n"); - } - break; - } - - if (SUCCEEDED(hr)) - { - *pbstrType = cstrType.AllocSysString(); - *pbstrValue = cstrValue.AllocSysString(); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTHandler::GetTxtPropTypeAndValue - -Routine Description: - - This routine initalises the type and value strings for a given text watermark property - -Arguments: - - pWmData - Pointer to a watermark data structure with the watermark settings - txtProps - The text watermark setting to retrieve the type and value for - pbstrType - Pointer to a BSTR that recieves the type of the value - pbstrValue - Pointer to a BSTR that recieves the value as a string - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTHandler::GetTxtPropTypeAndValue( - _In_ CONST WatermarkData* pWmData, - _In_ CONST ETextWatermarkProps txtProps, - _Outptr_ BSTR* pbstrType, - _Outptr_ BSTR* pbstrValue - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pWmData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pbstrType, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pbstrValue, E_POINTER))) - { - if (txtProps < ETextWatermarkPropsMin || - txtProps >= ETextWatermarkPropsMax) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - try - { - CStringXDW cstrType; - CStringXDW cstrValue; - - switch (txtProps) - { - case FontColor: - { - cstrType = SCHEMA_STRING; - cstrValue.Format(L"%s", static_cast(pWmData->txtData.bstrFontColor)); - } - break; - - case FontSize: - { - cstrType = SCHEMA_INTEGER; - cstrValue.Format(L"%i", pWmData->txtData.fontSize); - } - break; - - case Text: - { - cstrType = SCHEMA_STRING; - cstrValue.Format(L"%s", static_cast(pWmData->txtData.bstrText)); - } - break; - - default: - { - hr = E_FAIL; - ERR("Unknown text watermark property\n"); - } - break; - } - - if (SUCCEEDED(hr)) - { - *pbstrType = cstrType.AllocSysString(); - *pbstrValue = cstrValue.AllocSysString(); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/wmpthndlr.h b/print/XPSDrvSmpl/src/common/wmpthndlr.h deleted file mode 100644 index 0cfd24e8..00000000 --- a/print/XPSDrvSmpl/src/common/wmpthndlr.h +++ /dev/null @@ -1,116 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmpthnlr.h - -Abstract: - - PageWatermark PrintTicket handling definition. The watermark PT handler - is used to extract watermark settings from a PrintTicket and populate - the watermark properties class with the retrieved settings. The class also - defines a method for setting the feature in the PrintTicket given the - data structure. - ---*/ - -#pragma once - -#include "pthndlr.h" -#include "wmdata.h" - -class CWMPTHandler : public CPTHandler -{ -public: - CWMPTHandler( - _In_ IXMLDOMDocument2* pPrintTicket - ); - - virtual ~CWMPTHandler(); - - HRESULT - GetData( - _Out_ XDPrintSchema::PageWatermark::WatermarkData* pWmData - ); - - HRESULT - SetData( - _In_ CONST XDPrintSchema::PageWatermark::WatermarkData* pWmData - ); - - HRESULT - Delete( - VOID - ); - -private: - HRESULT - CreateCommonWMElements( - _In_ CONST XDPrintSchema::PageWatermark::WatermarkData* pWmData, - _Outptr_ IXMLDOMElement** ppWMDataElem, - _Outptr_ IXMLDOMElement** ppOptionElem, - _Out_ PTDOMElementVector* pParamInitList - ); - - HRESULT - CreateCommonVectBmpWMElements( - _In_ CONST XDPrintSchema::PageWatermark::WatermarkData* pWmData, - _In_ IXMLDOMElement* pOptionElem, - _Out_ PTDOMElementVector* pParamInitList - ); - - HRESULT - CreateTextWMElements( - _In_ CONST XDPrintSchema::PageWatermark::WatermarkData* pWmData, - _Outptr_ IXMLDOMElement** ppWMDataElem, - _Out_ PTDOMElementVector* pParamInitList - ); - - HRESULT - CreateBitmapWMElements( - _In_ CONST XDPrintSchema::PageWatermark::WatermarkData* pWmData, - _Outptr_ IXMLDOMElement** ppWMDataElem, - _Out_ PTDOMElementVector* pParamInitList - ); - - HRESULT - CreateVectorWMElements( - _In_ CONST XDPrintSchema::PageWatermark::WatermarkData* pWmData, - _Outptr_ IXMLDOMElement** ppWMDataElem, - _Out_ PTDOMElementVector* pParamInitList - ); - - HRESULT - GetCmnPropTypeAndValue( - _In_ CONST XDPrintSchema::PageWatermark::WatermarkData* pWmData, - _In_ CONST XDPrintSchema::PageWatermark::ECommonWatermarkProps cmnProps, - _Outptr_ BSTR* pbstrType, - _Outptr_ BSTR* pbstrValue - ); - - HRESULT - GetCmnVectBmpPropTypeAndValue( - _In_ CONST XDPrintSchema::PageWatermark::WatermarkData* pWmData, - _In_ CONST XDPrintSchema::PageWatermark::EVectBmpWatermarkProps cmnProps, - _Outptr_ BSTR* pbstrType, - _Outptr_ BSTR* pbstrValue - ); - - HRESULT - GetTxtPropTypeAndValue( - _In_ CONST XDPrintSchema::PageWatermark::WatermarkData* pWmData, - _In_ CONST XDPrintSchema::PageWatermark::ETextWatermarkProps txtProps, - _Outptr_ BSTR* pbstrType, - _Outptr_ BSTR* pbstrValue - ); -}; - diff --git a/print/XPSDrvSmpl/src/common/wmschema.cpp b/print/XPSDrvSmpl/src/common/wmschema.cpp deleted file mode 100644 index 286e33db..00000000 --- a/print/XPSDrvSmpl/src/common/wmschema.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmschema.cpp - -Abstract: - - PageWatermark PrintSchema implementation. This implements the features, - options and enumerations that describe the PrintSchema PageWatermark feature. - ---*/ - -#include "precomp.h" -#include "wmschema.h" - -LPCWSTR XDPrintSchema::PageWatermark::WATERMARK_FEATURE = L"PageWatermark"; - -LPCWSTR XDPrintSchema::PageWatermark::WATERMARK_OPTIONS[] = { - L"None", - L"Text", - L"BitmapGraphic", - L"VectorGraphic" -}; - -LPCWSTR XDPrintSchema::PageWatermark::CMN_WATERMARK_PROPS[] = { - L"OriginWidth", - L"OriginHeight", - L"Transparency", - L"Angle" -}; - -LPCWSTR XDPrintSchema::PageWatermark::TXT_WATERMARK_PROPS[] = { - L"TextColor", - L"TextFontSize", - L"TextText" -}; - -LPCWSTR XDPrintSchema::PageWatermark::VECTBMP_WATERMARK_PROPS[] = { - L"SizeWidth", - L"SizeHeight" -}; - -LPCWSTR XDPrintSchema::PageWatermark::Layering::LAYERING_FEATURE = L"Layering"; - -LPCWSTR XDPrintSchema::PageWatermark::Layering::LAYERING_OPTIONS[] = { - L"Underlay", - L"Overlay" -}; - - diff --git a/print/XPSDrvSmpl/src/common/wmschema.h b/print/XPSDrvSmpl/src/common/wmschema.h deleted file mode 100644 index 734a99df..00000000 --- a/print/XPSDrvSmpl/src/common/wmschema.h +++ /dev/null @@ -1,114 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmschema.h - -Abstract: - - PageWatermark PrintSchema definition. This defines the features, options - and enumerations that describe the PrintSchema PageWatermark feature within - a XDPrintSchema::PageWatermark namespace. - ---*/ - -#pragma once - -#include "schema.h" - -namespace XDPrintSchema -{ - // - // PageWatermark elements described as Printschema keywords - // - namespace PageWatermark - { - // - // Feature name - // - extern LPCWSTR WATERMARK_FEATURE; - - // - // Option names - // - enum EWatermarkOption - { - NoWatermark = 0, EWatermarkOptionMin = 0, - TextWatermark, - BitmapWatermark, - VectorWatermark, - EWatermarkOptionMax - }; - - extern LPCWSTR WATERMARK_OPTIONS[EWatermarkOptionMax]; - - // - // Common watermark properties - // - enum ECommonWatermarkProps - { - WidthOrigin = 0, ECommonWatermarkPropsMin = 0, - HeightOrigin, - Transparency, - Angle, - ECommonWatermarkPropsMax - }; - - extern LPCWSTR CMN_WATERMARK_PROPS[ECommonWatermarkPropsMax]; - - // - // Text watermark properties - // - enum ETextWatermarkProps - { - FontColor = 0, ETextWatermarkPropsMin = 0, - FontSize, - Text, - ETextWatermarkPropsMax - }; - - extern LPCWSTR TXT_WATERMARK_PROPS[ETextWatermarkPropsMax]; - - // - // Vector / Bitmap common properties - // - enum EVectBmpWatermarkProps - { - WidthExtent = 0, EVectBmpWatermarkPropsMin = 0, - HeightExtent, - EVectBmpWatermarkPropsMax - }; - - extern LPCWSTR VECTBMP_WATERMARK_PROPS[EVectBmpWatermarkPropsMax]; - - // - // Layering sub feature - // - namespace Layering - { - extern LPCWSTR LAYERING_FEATURE; - - // - // Layering options - // - enum ELayeringOption - { - Underlay = 0, ELayeringOptionMin = 0, - Overlay, - ELayeringOptionMax - }; - - extern LPCWSTR LAYERING_OPTIONS[ELayeringOptionMax]; - } - } -} - diff --git a/print/XPSDrvSmpl/src/common/workbuff.cpp b/print/XPSDrvSmpl/src/common/workbuff.cpp deleted file mode 100644 index efa5fcc8..00000000 --- a/print/XPSDrvSmpl/src/common/workbuff.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - workbuff.cpp - -Abstract: - - CWorkingBuffer class implementation. This class provides a means of working - with a local buffer by defining a simple interface that allows the retrieval - of a buffer of an appropriate size, handling reallocation as necessary. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "workbuff.h" - -/*++ - -Routine Name: - - CWorkingBuffer::CWorkingBuffer - -Routine Description: - - CWorkingBuffer class constructor - -Arguments: - - None - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CWorkingBuffer::CWorkingBuffer() : - m_pBuffer(NULL), - m_cbSize(CB_COPY_BUFFER) -{ - m_pBuffer = HeapAlloc(GetProcessHeap(), 0, m_cbSize); - - if (m_pBuffer == NULL) - { - m_cbSize = 0; - throw CXDException(E_OUTOFMEMORY); - } -} - -/*++ - -Routine Name: - - CWorkingBuffer::~CWorkingBuffer - -Routine Description: - - CWorkingBuffer class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CWorkingBuffer::~CWorkingBuffer() -{ - if (m_pBuffer != NULL) - { - HeapFree(GetProcessHeap(), 0, m_pBuffer); - m_pBuffer = NULL; - m_cbSize = 0; - } -} - -/*++ - -Routine Name: - - CWorkingBuffer::GetBuffer - -Routine Description: - - This routine returns a pointer to a buffer of at least the requested size. If the internal - buffer is not large enough it will be resized accordingly. - -Arguments: - - cbSize - Requested size of the buffer - ppBuffer - Pointer to a VOID pointer that recieves the buffer - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWorkingBuffer::GetBuffer( - _In_ CONST ULONGLONG cbSize, - _Outptr_result_bytebuffer_(cbSize) PVOID* ppBuffer - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppBuffer, E_POINTER))) - { - *ppBuffer = NULL; - - if (cbSize == 0) - { - hr = E_INVALIDARG; - } - - if (m_cbSize == 0) - { - // - // We have no existing buffer - we should have one - // - hr = E_FAIL; - } - } - - if (SUCCEEDED(hr)) - { - if (m_cbSize >= cbSize) - { - *ppBuffer = m_pBuffer; - } - else - { - // - // Double the buffer size till it is greater than the requested size - // - SIZE_T cbNewSize = m_cbSize; - while (cbNewSize < cbSize) - { - cbNewSize *= 2; - }; - - _Analysis_assume_(cbNewSize >= 1); - - // - // Reallocate the buffer - // - PVOID pNewBuffer = HeapReAlloc(GetProcessHeap(), 0, m_pBuffer, cbNewSize); - - if (pNewBuffer != NULL) - { - m_cbSize = cbNewSize; - m_pBuffer = pNewBuffer; - *ppBuffer = m_pBuffer; - } - else - { - hr = E_OUTOFMEMORY; - } - } - } - - ERR_ON_HR(hr); - return hr; -}; - -/*++ - -Routine Name: - - CWorkingBuffer::GetBufferAt - -Routine Description: - - This routine returns a pointer into the internal buffer at the requested offset. This will - not grow the size of the buffer. - -Arguments: - - cbOffset - Offset into the internal buffer - cbSize - Size of the requested buffer - ppBuffer - Pointer to a VOID pointer that recieves the buffer - -Return Value: - - HRESULT - S_OK - On success - HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) - If the internal buffer is not large enough - E_* - On error - ---*/ -HRESULT -CWorkingBuffer::GetBufferAt( - _In_ ULONG cbOffset, - _In_ CONST ULONGLONG cbSize, - _Outptr_result_bytebuffer_(cbSize) PVOID* ppBuffer - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppBuffer, E_POINTER))) - { - *ppBuffer = NULL; - - if (cbSize + cbOffset < m_cbSize) - { - *ppBuffer = reinterpret_cast(m_pBuffer) + cbOffset; - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/common/workbuff.h b/print/XPSDrvSmpl/src/common/workbuff.h deleted file mode 100644 index 263e97d3..00000000 --- a/print/XPSDrvSmpl/src/common/workbuff.h +++ /dev/null @@ -1,51 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - workbuff.h - -Abstract: - - CWorkingBuffer class definition. This class provides a means of working - with a local buffer by defining a simple interface that allows the retrieval - of a buffer of an appropriate size, handling reallocation as necessary. - ---*/ - -#pragma once - -class CWorkingBuffer -{ -public: - CWorkingBuffer(); - - virtual ~CWorkingBuffer(); - - HRESULT - GetBuffer( - _In_ CONST ULONGLONG cbSize, - _Outptr_result_bytebuffer_(cbSize) PVOID* ppBuffer - ); - - HRESULT - GetBufferAt( - _In_ ULONG cbOffset, - _In_ CONST ULONGLONG cbSize, - _Outptr_result_bytebuffer_(cbSize) PVOID* ppBuffer - ); - -private: - _Field_size_bytes_(m_cbSize) PVOID m_pBuffer; - - SIZE_T m_cbSize; -}; - diff --git a/print/XPSDrvSmpl/src/common/xdsmplcmn.vcxproj b/print/XPSDrvSmpl/src/common/xdsmplcmn.vcxproj deleted file mode 100644 index 7cd9846d..00000000 --- a/print/XPSDrvSmpl/src/common/xdsmplcmn.vcxproj +++ /dev/null @@ -1,593 +0,0 @@ - - - - - Debug - ARM - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {42677515-C196-4C0F-99A2-F11E2FB55BF6} - $(MSBuildProjectName) - false - true - Debug - Win32 - {D1077168-B333-455C-93E8-E83066110321} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - true - Level4 - Sync - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - true - Level4 - Sync - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - true - Level4 - Sync - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - true - Level4 - Sync - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - true - Level4 - Sync - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - true - Level4 - Sync - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - true - Level4 - Sync - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - true - Level4 - Sync - MultiThreaded - MultiThreadedDebug - - - %(AdditionalIncludeDirectories);.\;.\..\inc;.\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - xdsmplcmn - - - xdsmplcmn - - - xdsmplcmn - - - xdsmplcmn - - - xdsmplcmn - - - xdsmplcmn - - - xdsmplcmn - - - xdsmplcmn - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/common/xdsmplcmn.vcxproj.Filters b/print/XPSDrvSmpl/src/common/xdsmplcmn.vcxproj.Filters deleted file mode 100644 index b9b2d859..00000000 --- a/print/XPSDrvSmpl/src/common/xdsmplcmn.vcxproj.Filters +++ /dev/null @@ -1,2230 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {75E1F153-C8D9-48CA-BE6B-826ECD1DB3AD} - - - h;hpp;hxx;hm;inl;inc;xsd - {C230151A-AC0B-49BB-801B-E64449458C5F} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {DAF0D217-1F43-40AB-871C-801F743FDFC9} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/debug/debug.cpp b/print/XPSDrvSmpl/src/debug/debug.cpp deleted file mode 100644 index 330a4a1d..00000000 --- a/print/XPSDrvSmpl/src/debug/debug.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - debug.cpp - -Abstract: - - Debug implementations. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "xdstring.h" - -/*++ - -Routine Name: - - RealDebugMessage - -Routine Description: - - This routine takes a debug message and va_list and outputs the message via OutputDebugString - -Arguments: - - dwSize - Maximum size of the debug message in number of characters - pszMessage - The debug message string - arglist - The arg list for the debug message string - -Return Value: - - BOOL - TRUE - On success - FALSE - On error - ---*/ -BOOL -RealDebugMessage( - _In_ DWORD dwSize, - _In_ PCSTR pszMessage, - va_list arglist - ) -{ - HRESULT hr = S_OK; - PSTR pszMsgBuf; - - if (NULL == pszMessage || - 0 == dwSize) - { - hr = E_INVALIDARG; - } - - if (SUCCEEDED(hr)) - { - // - // Allocate memory for message buffer. - // - pszMsgBuf = new(std::nothrow) CHAR[dwSize + 1]; - - if (NULL != pszMsgBuf) - { - // - // Pass the variable parameters to wvsprintf to be formated. - // - hr = StringCbVPrintfA(pszMsgBuf, (dwSize + 1) * sizeof(CHAR), pszMessage, arglist); - - // - // Dump string to debug output. - // - OutputDebugStringA(pszMsgBuf); - - // - // Clean up. - // - delete[] pszMsgBuf; - pszMsgBuf = NULL; - } - else - { - hr = E_OUTOFMEMORY; - } - } - - return SUCCEEDED(hr); -} - -/*++ - -Routine Name: - - DbgPrint - -Routine Description: - - This routine takes a format string and arguments and outputs as a debug string - -Arguments: - - pszFormatString - Format string for the debug message - ... - argument list - -Return Value: - - BOOL - TRUE - On success - FALSE - On error - ---*/ -BOOL -DbgPrint( - _In_ PCSTR pszFormatString, - ... - ) -{ - BOOL bResult; - va_list VAList; - - // - // Pass the variable parameters to RealDebugMessage to be processed. - // - va_start(VAList, pszFormatString); - bResult = RealDebugMessage(0x8000, pszFormatString, VAList); - va_end(VAList); - - return bResult; -} - -/*++ - -Routine Name: - - DbgDOMDoc - -Routine Description: - - This routine outputs an XML DOM document to the debug output stream - -Arguments: - - pszMessage - Debug message - pDomDoc - DOM document to be output - -Return Value: - - None. - ---*/ -VOID -DbgDOMDoc( - _In_ PCSTR pszMessage, - _In_ IXMLDOMDocument2* pDomDoc - ) -{ - try - { - CComBSTR xml; - - if (pDomDoc != NULL && - SUCCEEDED(pDomDoc->get_xml(&xml))) - { - CStringXDA ansi(xml); - - if (pszMessage != NULL) - { - DbgPrint("%s%s\n", pszMessage, ansi.GetBuffer()); - } - else - { - DbgPrint("%s\n", ansi.GetBuffer()); - } - } - } - catch (CXDException&) - { - } -} - diff --git a/print/XPSDrvSmpl/src/debug/debug.h b/print/XPSDrvSmpl/src/debug/debug.h deleted file mode 100644 index ddfdc038..00000000 --- a/print/XPSDrvSmpl/src/debug/debug.h +++ /dev/null @@ -1,186 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdsdbg.h - -Abstract: - - Debug definitions. - ---*/ - -#pragma once - -// -// These macros are used for debugging purposes. They expand -// to white spaces on a free build. Here is a brief description -// of what they do and how they are used: -// -// giDebugLevel -// Global variable which set the current debug level to control -// the amount of debug messages emitted. -// -// VERBOSE(msg) -// Display a message if the current debug level is <= DBG_VERBOSE. -// -// TERSE(msg) -// Display a message if the current debug level is <= DBG_TERSE. -// -// WARNING(msg) -// Display a message if the current debug level is <= DBG_WARNING. -// The message format is: WRN filename (linenumber): message -// -// ERR(msg) -// Similiar to WARNING macro above - displays a message -// if the current debug level is <= DBG_ERROR. -// -// ASSERT(cond) -// Verify a condition is true. If not, force a breakpoint. -// -// ASSERTMSG(cond, msg) -// Verify a condition is true. If not, display a message and -// force a breakpoint. -// -// RIP(msg) -// Display a message and force a breakpoint. -// -// Usage: -// These macros require extra parantheses for the msg argument -// example, ASSERTMSG(x > 0, ("x is less than 0\n")); -// WARNING(("App passed NULL pointer, ignoring...\n")); -// - -#pragma once - -#define DBG_VERBOSE 1 -#define DBG_TERSE 2 -#define DBG_WARNING 3 -#define DBG_ERROR 4 -#define DBG_RIP 5 - -BOOL -RealDebugMessage( - _In_ DWORD dwSize, - _In_ PCSTR pszMessage, - va_list arglist - ); - -BOOL -DbgPrint( - _In_ PCSTR pszFormatString, - ... - ); - -VOID -DbgDOMDoc( - _In_ PCSTR pszMessage, - _In_ IXMLDOMDocument2* pDomDoc - ); - -#if DBG - -#ifndef MAX_DEBUG_LEVEL -#define MAX_DEBUG_LEVEL DBG_VERBOSE -#endif - -#define DBGMSG(level, prefix, msg) { \ - INT dbgLevel = level; \ - if (MAX_DEBUG_LEVEL <= (dbgLevel)) { \ - DbgPrint("%s %s (%d): ", prefix, __FILE__, __LINE__); \ - DbgPrint(msg); \ - } \ - } - -#define DBGMSG_ON_HR(level, prefix, hr) { \ - INT dbgLevel = level; \ - HRESULT hres = hr; \ - if (MAX_DEBUG_LEVEL <= (dbgLevel) && FAILED(hres)) { \ - DbgPrint("%s %s (%d): Call failed with HRESULT = 0x%x\n", prefix, __FILE__, __LINE__, hr); \ - } \ - } - -#define DBGMSG_ON_HR_EXC(level, prefix, hr, hr_exc) { \ - INT dbgLevel = level; \ - HRESULT hres = hr; \ - if (MAX_DEBUG_LEVEL <= (dbgLevel) && FAILED(hres) && hres != hr_exc) { \ - DbgPrint("%s %s (%d): Call failed with HRESULT = 0x%x\n", prefix, __FILE__, __LINE__, hr); \ - } \ - } - -#define DBGPRINT(level, msg) { \ - INT dbgLevel = level; \ - if (MAX_DEBUG_LEVEL <= (dbgLevel)) { \ - DbgPrint(msg); \ - } \ - } - -#define DBGXML(msg, pDomDoc) { \ - INT dbgLevel = DBG_VERBOSE; \ - if (MAX_DEBUG_LEVEL <= dbgLevel) { \ - DbgDOMDoc(msg, pDomDoc); \ - } \ - } - -#define VERBOSE(msg) DBGPRINT(DBG_VERBOSE, msg) -#define TERSE(msg) DBGPRINT(DBG_TERSE, msg) -#define WARNING(msg) DBGMSG(DBG_WARNING, "WRN", msg) -#define ERR(msg) DBGMSG(DBG_ERROR, "ERR", msg) -#define ERR_ON_HR(hr) DBGMSG_ON_HR(DBG_ERROR, "ERR", hr) -#define ERR_ON_HR_EXC(hr, hr_exc) DBGMSG_ON_HR_EXC(DBG_ERROR, "ERR", hr, hr_exc) - -#define ASSERT(cond) { \ - if (! (cond)) { \ - RIP(("\n")); \ - } \ - } - -#define ASSERTMSG(cond, msg) { \ - if (!(cond)) { \ - RIP(msg); \ - } \ - } - -#define RIP(msg) { \ - DBGMSG(DBG_RIP, "RIP", msg); \ - DebugBreak(); \ - } - -#define DBG_ONLY(p) p - -#else // !DBG - -#define VERBOSE(msg) -#define TERSE(msg) -#define WARNING(msg) -#define ERR(msg) -#define ERR_ON_HR(hr) -#define ERR_ON_HR_EXC(hr, hr_exc) - -#define ASSERT(cond) - -#define ASSERTMSG(cond, msg) - -#define RIP(msg) - -#define DBG_ONLY(p) - -#define DBGMSG(level, prefix, msg) - -#define DBGMSG_ON_HR(level, prefix, hr) - -#define DBGPRINT(level, msg) - -#define DBGXML(msg, pDomDoc) - -#endif - diff --git a/print/XPSDrvSmpl/src/debug/precomp.h b/print/XPSDrvSmpl/src/debug/precomp.h deleted file mode 100644 index fe380958..00000000 --- a/print/XPSDrvSmpl/src/debug/precomp.h +++ /dev/null @@ -1,67 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - precomp.h - -Abstract: - - Precompiled header. - ---*/ - -#pragma once - -// -// Annotate this as a usermode driver for static analysis -// -#include -_Analysis_mode_(_Analysis_code_type_user_driver_) - -// -// Standard Annotation Language include -// -#include - -// -// Windows includes -// -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif // WIN32_LEAN_AND_MEAN -#include - -// -// COM includes -// -#include -#include - -// -// ATL Includes -// -#include - -// -// STL Includes -// -#include - -// -// MSXML includes -// -#include - -#include - -#include "common.ver" - diff --git a/print/XPSDrvSmpl/src/debug/precompsrc.cpp b/print/XPSDrvSmpl/src/debug/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/XPSDrvSmpl/src/debug/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/debug/xdsdbg.vcxproj b/print/XPSDrvSmpl/src/debug/xdsdbg.vcxproj deleted file mode 100644 index d719c20a..00000000 --- a/print/XPSDrvSmpl/src/debug/xdsdbg.vcxproj +++ /dev/null @@ -1,343 +0,0 @@ - - - - - Debug - ARM - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {E5DC3A24-691A-4F3A-B519-E4C49B2DAC98} - $(MSBuildProjectName) - false - true - Debug - Win32 - {53D0D9CF-F293-45DB-8027-4C68A5747835} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - xdsdbg - - - xdsdbg - - - xdsdbg - - - xdsdbg - - - xdsdbg - - - xdsdbg - - - xdsdbg - - - xdsdbg - - - - MultiThreaded - MultiThreadedDebug - Sync - true - Level4 - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - - - MultiThreaded - MultiThreadedDebug - Sync - true - Level4 - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - - - MultiThreaded - MultiThreadedDebug - Sync - true - Level4 - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - - - MultiThreaded - MultiThreadedDebug - Sync - true - Level4 - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - - - MultiThreaded - MultiThreadedDebug - Sync - true - Level4 - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - - - MultiThreaded - MultiThreadedDebug - Sync - true - Level4 - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - - - MultiThreaded - MultiThreadedDebug - Sync - true - Level4 - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - - - MultiThreaded - MultiThreadedDebug - Sync - true - Level4 - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(AdditionalIncludeDirectories);.\;.\..\inc;$(DDK_INC_PATH) - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/debug/xdsdbg.vcxproj.Filters b/print/XPSDrvSmpl/src/debug/xdsdbg.vcxproj.Filters deleted file mode 100644 index def7a023..00000000 --- a/print/XPSDrvSmpl/src/debug/xdsdbg.vcxproj.Filters +++ /dev/null @@ -1,33 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {D63DDF6B-528A-4350-B9BD-5781172E99A7} - - - h;hpp;hxx;hm;inl;inc;xsd - {BA0B6D06-BD16-42D4-94AD-1E321724C320} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {684F91A3-B169-45E2-BD6B-FE8D8524326C} - - - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/booklet/bkflt.cpp b/print/XPSDrvSmpl/src/filters/booklet/bkflt.cpp deleted file mode 100644 index 67a4d867..00000000 --- a/print/XPSDrvSmpl/src/filters/booklet/bkflt.cpp +++ /dev/null @@ -1,591 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bkflt.cpp - -Abstract: - - Booklet filter implementation. This class derives from the Xps filter - class and implements the necessary part handlers to support booklet - printing. The booklet filter is responsible for re-ordering pages and re-uses - the NUp filter to provide 2-up and offset support. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "pthndlr.h" -#include "bkflt.h" -#include "bksax.h" -#include "bkpthndlr.h" - -using XDPrintSchema::Binding::BindingData; - -/*++ - -Routine Name: - - CBookletFilter::CBookletFilter - -Routine Description: - - Default constructor for the booklet filter which initialises the - filter to sensible default values - -Arguments: - - None - -Return Value: - - None - ---*/ -CBookletFilter::CBookletFilter() : - m_bSendAllDocs(TRUE), - m_bookScope(CBkPTProperties::None) -{ -} - -/*++ - -Routine Name: - - CBookletFilter::~CBookletFilter - -Routine Description: - - Default destructor for the booklet filter - -Arguments: - - None - -Return Value: - - None - ---*/ -CBookletFilter::~CBookletFilter() -{ -} - -/*++ - -Routine Name: - - CNUpFilter::ProcessPart - -Routine Description: - - Method for processing each fixed document sequence part in a container - -Arguments: - - pFDS - Pointer to the fixed document sequence to process - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBookletFilter::ProcessPart( - _Inout_ IFixedDocumentSequence* pFDS - ) -{ - VERBOSE("Processing Fixed Document Sequence part with booklet filter handler\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFDS, E_POINTER))) - { - // - // Get the PT manager to return the FixedDocumentSequence ticket. - // - IXMLDOMDocument2* pPT = NULL; - if (SUCCEEDED(hr = m_ptManager.SetTicket(pFDS)) && - SUCCEEDED(hr = m_ptManager.GetTicket(kPTJobScope, &pPT))) - { - // - // Set the binding scope from the PrintTicket - // - hr = SetBindingScope(pPT); - } - } - - if (SUCCEEDED(hr)) - { - hr = m_pXDWriter->SendFixedDocumentSequence(pFDS); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBookletFilter::ProcessPart - -Routine Description: - - Method for processing each fixed document part in a container - -Arguments: - - pFD - Pointer to the fixed document to process - -Return Value: - - HRESULT - S_OK - On success - S_FALSE - When not enabled in the PT - E_* - On error - ---*/ -HRESULT -CBookletFilter::ProcessPart( - _Inout_ IFixedDocument* pFD - ) -{ - VERBOSE("Processing Fixed Document part with booklet filter handler\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFD, E_POINTER)) && - SUCCEEDED(hr = m_ptManager.SetTicket(pFD))) - { - // - // If we are in a JobBook session we want to maintain the current - // JobBook settings - // - if (m_bookScope != CBkPTProperties::Job) - { - // - // Flush any outstanding pages in case we have just completed a - // DocNUp sequence - // - hr = FlushCache(); - - // - // Get the PT manager to return the FixedDocument ticket. - // - IXMLDOMDocument2* pPT = NULL; - if (SUCCEEDED(hr) && - SUCCEEDED(hr = m_ptManager.GetTicket(kPTDocumentScope, &pPT))) - { - // - // Set the binding scope from the PrintTicket - // - hr = SetBindingScope(pPT); - } - } - } - - if (SUCCEEDED(hr) && - m_bSendAllDocs) - { - hr = m_pXDWriter->SendFixedDocument(pFD); - - // - // If we are JobBindAllDocuments we only ever send one doc - now we have - // sent the first document we can test to see if we need to send all of them - // - if (m_bookScope == CBkPTProperties::Job) - { - m_bSendAllDocs = FALSE; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBookletFilter::ProcessPart - -Routine Description: - - Method for processing each fixed page part in a container - -Arguments: - - pFP - Pointer to the fixed page to process - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBookletFilter::ProcessPart( - _Inout_ IFixedPage* pFP - ) -{ - ASSERTMSG(m_pXDWriter != NULL, "XD writer is not initialised.\n"); - - VERBOSE("Processing Fixed Page with booklet filter handler\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFP, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pXDWriter, E_PENDING))) - { - // - // Check if we are processing a booklet job - // - if (m_bookScope != CBkPTProperties::None) - { - // - // Cache pages for reordering - // - try - { - m_cacheFP.push_back(pFP); - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - else - { - hr = m_pXDWriter->SendFixedPage(pFP); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBookletFilter::Finalize - -Routine Description: - - Method to flush the cache of pages as the last action of the filter - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBookletFilter::Finalize( - VOID - ) -{ - // - // Just flush the cache of pages - // - return FlushCache(); -} - -/*++ - -Routine Name: - - CBookletFilter::FlushCache - -Routine Description: - - Method to send the cached collection of pages in the correct order back - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBookletFilter::FlushCache( - VOID - ) -{ - HRESULT hr = S_OK; - - if (m_pXDWriter == NULL) - { - hr = E_PENDING; - } - - size_t cPages = m_cacheFP.size(); - - if (SUCCEEDED(hr) && - cPages > 0 && - m_bookScope != CBkPTProperties::None) - { - // - // We may need to add a pad page if the page count is odd - // - CComPtr pNewFP(NULL); - if (cPages%2 == 1 && - SUCCEEDED(hr = CreatePadPage(&pNewFP))) - { - // - // We successfully created our pad page; add it to the cache - // - try - { - m_cacheFP.push_back(pNewFP); - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - cPages++; - } - - if (SUCCEEDED(hr)) - { - try - { - // - // Re-order pages in the cache - // - map reorderedPages; - size_t newIndex = 0; - size_t pageIndex = 0; - for (pageIndex = 0; pageIndex < cPages/2; pageIndex++) - { - reorderedPages[newIndex] = m_cacheFP[pageIndex]; - newIndex += 2; - } - - newIndex = cPages - 1; - for (pageIndex = cPages/2; pageIndex < cPages; pageIndex++) - { - reorderedPages[newIndex] = m_cacheFP[pageIndex]; - newIndex -= 2; - } - - // - // Write out reordered pages - // - for (pageIndex = 0; pageIndex < cPages && SUCCEEDED(hr); pageIndex++) - { - hr = m_pXDWriter->SendFixedPage(reorderedPages[pageIndex]); - } - - // - // Clean out the cache - // - m_cacheFP.clear(); - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBookletFilter::CreatePadPage - -Routine Description: - - Method to create a pad page which is required for odd page counts to - ensure pages are correctly ordered for presentation as a booklet - -Arguments: - - ppNewPage - Pointer to a pointer to the newly created fixed page - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBookletFilter::CreatePadPage( - _Outptr_ IFixedPage** ppNewPage - ) -{ - HRESULT hr = S_OK; - - // - // Validate parameters and members before proceeding - // - if (SUCCEEDED(hr = CHECK_POINTER(ppNewPage, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pXDWriter, E_PENDING))) - { - *ppNewPage = NULL; - PCWSTR pszPageName = NULL; - - try - { - // - // Create a unique name for the pad page for this print session - // - CStringXDW szNewPageName; - szNewPageName.Format(L"/Pad_page_%u.xaml", GetUniqueNumber()); - pszPageName = szNewPageName.GetBuffer(); - - // - // Create a new empty page and retrieve a writer. Also get a - // reader from the first page so we can copy the FixedPage root - // element. This ensures the page sizes match. - // - CComPtr pWriter(NULL); - CComPtr pSaxRdr(NULL); - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = m_pXDWriter->GetNewEmptyPart(pszPageName, - IID_IFixedPage, - reinterpret_cast(ppNewPage), - &pWriter)) && - SUCCEEDED(hr = pSaxRdr.CoCreateInstance(CLSID_SAXXMLReader60))) - { - // - // We use a simple SAX handler which copies only the root - // element and discards all other content. - // - CBkSaxHandler bkSaxHndlr(pWriter); - CComPtr pReader(NULL); - - IFixedPage* pFP = NULL; - - pFP = m_cacheFP[0]; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = pSaxRdr->putContentHandler(&bkSaxHndlr)) && - SUCCEEDED(hr = pFP->GetStream(&pReader))) - { - CComPtr pReadStreamToSeq(NULL); - - pReadStreamToSeq.Attach(new(std::nothrow) pfp::PrintReadStreamToSeqStream(pReader)); - - if (SUCCEEDED(hr = CHECK_POINTER(pReadStreamToSeq, E_OUTOFMEMORY))) - { - hr = pSaxRdr->parse(CComVariant(static_cast(pReadStreamToSeq))); - } - } - - pWriter->Close(); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBookletFilter::SetBindingScope - -Routine Description: - - Method to retrieve the binding scope from a PrintTicket - -Arguments: - - pPT - Pointer to the PrintTicket to retrieve the scope from - -Return Value: - - HRESULT - S_OK - On success - S_FALSE - Booklet settings not present in the PT - E_* - On error - ---*/ -HRESULT -CBookletFilter::SetBindingScope( - _In_ IXMLDOMDocument2* pPT - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPT, E_POINTER))) - { - try - { - BindingData bindingData; - CBookPTHandler bkPTHandler(pPT); - - // - // Retrieve the booklet properties from the ticket via the handler - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = bkPTHandler.GetData(&bindingData))) - { - CBkPTProperties bookletPTProps(bindingData); - - // - // Retrieve the booklet scope - // - hr = bookletPTProps.GetScope(&m_bookScope); - } - else if (hr == E_ELEMENT_NOT_FOUND) - { - // - // Booklet PT settings are not present - reset hr to S_FALSE and proceed - // - hr = S_FALSE; - } - } - catch (CXDException& e) - { - hr = e; - } - } - - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/booklet/bkflt.h b/print/XPSDrvSmpl/src/filters/booklet/bkflt.h deleted file mode 100644 index 52f72378..00000000 --- a/print/XPSDrvSmpl/src/filters/booklet/bkflt.h +++ /dev/null @@ -1,80 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bkflt.h - -Abstract: - - Booklet filter class definition. This class derives from the Xps filter - class and implements the necessary part handlers to support booklet - printing. The booklet filter is responsible for re-ordering pages and re-uses - the NUp filter to provide 2-up and offset support. - ---*/ - -#pragma once - -#include "xdrchflt.h" -#include "bkprps.h" - -class CBookletFilter : public CXDXpsFilter -{ -public: - CBookletFilter(); - - virtual ~CBookletFilter(); - -private: - HRESULT - ProcessPart( - _Inout_ IFixedDocumentSequence* pFDS - ); - - HRESULT - ProcessPart( - _Inout_ IFixedDocument* pFD - ); - - HRESULT - ProcessPart( - _Inout_ IFixedPage* pFP - ); - - HRESULT - Finalize( - VOID - ); - - HRESULT - FlushCache( - VOID - ); - - HRESULT - CreatePadPage( - _Outptr_ IFixedPage** ppNewPage - ); - - HRESULT - SetBindingScope( - _In_ IXMLDOMDocument2* pPT - ); - -private: - vector > m_cacheFP; - - BOOL m_bSendAllDocs; - - CBkPTProperties::EBookletScope m_bookScope; -}; - diff --git a/print/XPSDrvSmpl/src/filters/booklet/bkflt.rc b/print/XPSDrvSmpl/src/filters/booklet/bkflt.rc deleted file mode 100644 index 4834b059..00000000 --- a/print/XPSDrvSmpl/src/filters/booklet/bkflt.rc +++ /dev/null @@ -1,43 +0,0 @@ -// -// Copyright (c) 2005 Microsoft Corporation -// -// All rights reserved. -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// File Name: -// -// bkflt.rc -// -// Abstract: -// -// Booklet filter resource file. -// -// - -#include -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT2_UNKNOWN -#define VER_FILEDESCRIPTION_STR "XPSDrv Sample Booklet Filter" -#define VER_INTERNALNAME_STR "PrintFeatureFilters" - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#endif // English (U.S.) resources - -///////////////////////////////////////////////////////////////////////////// - -#include "common.ver" - diff --git a/print/XPSDrvSmpl/src/filters/booklet/bkprps.cpp b/print/XPSDrvSmpl/src/filters/booklet/bkprps.cpp deleted file mode 100644 index dce58de0..00000000 --- a/print/XPSDrvSmpl/src/filters/booklet/bkprps.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bkprps.cpp - -Abstract: - - Booklet properties class implementation. The booklet properties class - is responsible for interpreting booklet data appropriate to the booklet - filter. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "bkprps.h" - -using XDPrintSchema::Binding::BindingData; -using XDPrintSchema::Binding::JobBindAllDocuments; -using XDPrintSchema::Binding::None; - -/*++ - -Routine Name: - - CBkPTProperties::CBkPTProperties - -Routine Description: - - Default constructor for the booklet PrintTicket properties class which - sets the internal binding setting to the setting supplied - -Arguments: - - bindingData - Structure containing the booklet binding settings - from the PrintTicket - -Return Value: - - None - ---*/ -CBkPTProperties::CBkPTProperties( - _In_ CONST BindingData& bindingData - ) : - m_bindData(bindingData) -{ -} - -/*++ - -Routine Name: - - CBkPTProperties::~CBkPTProperties - -Routine Description: - - Default destructor for the CBkPTProperties class - -Arguments: - - None - -Return Value: - - None - ---*/ -CBkPTProperties::~CBkPTProperties() -{ -} - -/*++ - -Routine Name: - - CBkPTProperties::GetScope - -Routine Description: - - Method to return the booklet scope which can be either none, job wide or document wide - -Arguments: - - pBkScope - Booklet printing scope which can be None, Job wide or Document - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBkPTProperties::GetScope( - _Out_ EBookletScope* pBkScope - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pBkScope, E_POINTER))) - { - *pBkScope = CBkPTProperties::None; - - if (m_bindData.bindOption != None) - { - *pBkScope = m_bindData.bindFeature == JobBindAllDocuments ? CBkPTProperties::Job : CBkPTProperties::Document; - } - } - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/filters/booklet/bkprps.h b/print/XPSDrvSmpl/src/filters/booklet/bkprps.h deleted file mode 100644 index 38d17c26..00000000 --- a/print/XPSDrvSmpl/src/filters/booklet/bkprps.h +++ /dev/null @@ -1,52 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bkprps.h - -Abstract: - - Booklet properties class definition. The booklet properties class - is responsible for holding and controling booklet properties. - ---*/ - -#pragma once - -#include "bkdata.h" - -class CBkPTProperties -{ -public: - enum EBookletScope - { - None = 0, - Job, - Document - }; - -public: - CBkPTProperties( - _In_ CONST XDPrintSchema::Binding::BindingData& bindingData - ); - - virtual ~CBkPTProperties(); - - HRESULT - GetScope( - _Out_ EBookletScope* pBkScope - ); - -private: - XDPrintSchema::Binding::BindingData m_bindData; -}; - diff --git a/print/XPSDrvSmpl/src/filters/booklet/bksax.cpp b/print/XPSDrvSmpl/src/filters/booklet/bksax.cpp deleted file mode 100644 index 8582e72c..00000000 --- a/print/XPSDrvSmpl/src/filters/booklet/bksax.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bksax.cpp - -Abstract: - - Booklet filter SAX handler implementation. The booklet SAX handler derives - from the default SAX handler and implements the necesary SAX interfaces to - process fixed page mark-up for booklet printing. - For documents with odd page counts, we add a blank padding page so that the - 2-Up behaves correctly. All that is required of the handler is to retrieve - the fixed page open tag and write this out. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "bksax.h" - -/*++ - -Routine Name: - - CBkSaxHandler::CBkSaxHandler - -Routine Description: - - Contructor for the booklet filters SAX handler which registers - internally the writer for sending new markup out to - -Arguments: - - pWriter - Pointer to a write stream which receives markup - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CBkSaxHandler::CBkSaxHandler( - _In_ IPrintWriteStream* pWriter - ) : - m_pWriter(pWriter) -{ - ASSERTMSG(m_pWriter != NULL, "NULL writer passed to booklet SAX handler.\n"); - - HRESULT hr = S_OK; - if (FAILED(hr = CHECK_POINTER(m_pWriter, E_POINTER))) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CBkSaxHandler::~CBkSaxHandler - -Routine Description: - - Default destructor for the booklet filters SAX handler - -Arguments: - - None - -Return Value: - - None - ---*/ -CBkSaxHandler::~CBkSaxHandler() -{ -} - -/*++ - -Routine Name: - - CBkSaxHandler::startElement - -Routine Description: - - SAX handler method which handles each start element for the XML markup - -Arguments: - - pwchQName - Pointer to a string containing the element name - cchQName - Count of the number of characters in the element name - pAttributes - Pointer to the attribute list for the supplied element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CBkSaxHandler::startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ) -{ - HRESULT hr = S_OK; - CStringXDW cstrOut; - CComBSTR bstrElement; - - hr = bstrElement.Append(pwchQName, cchQName); - - // - // All we are doing is copying the fixed page root into the new - // document to ensure the same page size - // - INT cAttributes = 0; - if (SUCCEEDED(hr) && - bstrElement == L"FixedPage" && - SUCCEEDED(hr = pAttributes->getLength(&cAttributes))) - { - try - { - cstrOut.Append(L"<"); - cstrOut.Append(bstrElement); - } - catch (CXDException& e) - { - hr = e; - } - - // - // For all attributes - // - for (INT cIndex = 0; cIndex < cAttributes && SUCCEEDED(hr); cIndex++) - { - PCWSTR pszAttUri = NULL; - INT cchAttUri = 0; - PCWSTR pszAttName = NULL; - INT cchAttName = 0; - PCWSTR pszAttQName = NULL; - INT cchAttQName = 0; - PCWSTR pszAttValue = NULL; - INT cchAttValue = 0; - - // - // Get the attribute data ready to write out - // - if (SUCCEEDED(hr = pAttributes->getName(cIndex, - &pszAttUri, - &cchAttUri, - &pszAttName, - &cchAttName, - &pszAttQName, - &cchAttQName)) && - SUCCEEDED(hr = pAttributes->getValue(cIndex, &pszAttValue, &cchAttValue))) - { - try - { - CComBSTR bstrAttName(cchAttQName, pszAttQName); - CComBSTR bstrAttValue(cchAttValue, pszAttValue); - - // - // Delimit attributes with a space - // - cstrOut.Append(L" "); - - // - // Reconstruct the attribute and write back to - // the fixed page - // - cstrOut.Append(bstrAttName); - cstrOut.Append(L"=\""); - - // - // If this is a UnicodeString we may need to escape entities - // - if (bstrAttName == L"UnicodeString") - { - hr = EscapeEntity(&bstrAttValue); - } - - cstrOut.Append(bstrAttValue); - cstrOut.Append(L"\""); - } - catch (CXDException& e) - { - hr = e; - } - } - } - - // - // Close the fixed page tag - // - if (SUCCEEDED(hr)) - { - try - { - cstrOut.Append(L"/>"); - } - catch (CXDException& e) - { - hr = e; - } - } - - // - // Write out the empty page - // - if (SUCCEEDED(hr)) - { - hr = WriteToPrintStream(&cstrOut, m_pWriter); - } - } - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CBkSaxHandler::startDocument - -Routine Description: - - SAX handler method which handles the start document call to ensure - the xml version is correctly set - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CBkSaxHandler::startDocument( - void - ) -{ - HRESULT hr = S_OK; - - try - { - if (SUCCEEDED(hr = CHECK_POINTER(m_pWriter, E_FAIL))) - { - CStringXDW cstrOut(L""); - hr = WriteToPrintStream(&cstrOut, m_pWriter); - } - } - catch (CXDException& e) - { - hr = e; - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/booklet/bksax.h b/print/XPSDrvSmpl/src/filters/booklet/bksax.h deleted file mode 100644 index 7a0826b4..00000000 --- a/print/XPSDrvSmpl/src/filters/booklet/bksax.h +++ /dev/null @@ -1,59 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bksax.cpp - -Abstract: - - Booklet filter SAX handler definition. The booklet SAX handler derives - from the default SAX handler and implements the necesary SAX interfaces to - process fixed page mark-up for booklet printing. - For documents with odd page counts, we add a blank padding page so that the - 2-Up behaves correctly. All that is required of the handler is to retrieve - the fixed page open tag and write this out. - ---*/ - -#pragma once - -#include "saxhndlr.h" - -class CBkSaxHandler : public CSaxHandler -{ -public: - CBkSaxHandler( - _In_ IPrintWriteStream* pWriter - ); - - virtual ~CBkSaxHandler(); - - HRESULT STDMETHODCALLTYPE - startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ); - - HRESULT STDMETHODCALLTYPE - startDocument( - void - ); - -private: - CComPtr m_pWriter; -}; - diff --git a/print/XPSDrvSmpl/src/filters/booklet/dllentry.cpp b/print/XPSDrvSmpl/src/filters/booklet/dllentry.cpp deleted file mode 100644 index 6d6c97b9..00000000 --- a/print/XPSDrvSmpl/src/filters/booklet/dllentry.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - dllentry.cpp - -Abstract: - - Implementation of the booklet filter dllentry points. Dllmain only - stores the instance handle. DllGetClassObject calls on to a generic - get class factory template function. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "clasfact.h" -#include "bkflt.h" -#include "xdexcept.h" - -/*++ - -Routine Name: - - DllMain - -Routine Description: - - Entry point to the booklet filter which is called when a new process is started - -Arguments: - - hInst - Handle to the DLL - wReason - Specifies a flag indicating why the DLL entry-point function is being called - -Return Value: - - TRUE - ---*/ -BOOL WINAPI -DllMain( - _In_ HINSTANCE hInst, - _In_ WORD wReason, - _In_opt_ LPVOID - ) -{ - switch (wReason) - { - case DLL_PROCESS_ATTACH: - { - g_hInstance = hInst; - } - break; - } - - return TRUE; -} - -/*++ - -Routine Name: - - DllCanUnloadNow - -Routine Description: - - Method which reports whether the DLL is in use to allow the caller to unload - the DLL safely - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - Dll can unload - S_FALSE - Dll can't unload - ---*/ -STDAPI -DllCanUnloadNow() -{ - if (g_cServerLocks == 0) - { - return S_OK ; - } - else - { - return S_FALSE; - } -} - -/*++ - -Routine Name: - - DllGetClassObject - -Routine Description: - - Method to return the current class object - -Arguments: - - rclsid - CLSID that will associate the correct data and code - riid - Reference to the identifier of the interface that the caller is to use to communicate with the class object - ppv - Address of pointer variable that receives the interface pointer requested in riid - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - CLASS_E_CLASSNOTAVAILABLE - On unsupported class - ---*/ -STDAPI -DllGetClassObject( - _In_ REFCLSID rclsid, - _In_ REFIID riid, - _Outptr_ LPVOID FAR* ppv - ) -{ - // - // 87AFE626-06CC-4672-A2C1-1B7CF12CBEDD - // - CLSID bookletCLSID = {0x87AFE626, 0x06CC, 0x4672, {0xA2, 0xC1, 0x1B, 0x7C, 0xF1, 0x2C, 0xBE, 0xDD}}; - - return GetFilterClassFactory(rclsid, riid, bookletCLSID, ppv); -} - diff --git a/print/XPSDrvSmpl/src/filters/booklet/precompsrc.cpp b/print/XPSDrvSmpl/src/filters/booklet/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/XPSDrvSmpl/src/filters/booklet/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/booklet/xdbook.def b/print/XPSDrvSmpl/src/filters/booklet/xdbook.def deleted file mode 100644 index ad3c7eda..00000000 --- a/print/XPSDrvSmpl/src/filters/booklet/xdbook.def +++ /dev/null @@ -1,26 +0,0 @@ -; -; Copyright (c) 2005 Microsoft Corporation -; -; All rights reserved. -; -; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -; ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -; PARTICULAR PURPOSE. -; -; File Name: -; -; xdbook.def -; -; Abstract: -; -; Booklet filter module definition file -; - -LIBRARY XDBook - -EXPORTS - DllMain - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - diff --git a/print/XPSDrvSmpl/src/filters/booklet/xdbook.vcxproj b/print/XPSDrvSmpl/src/filters/booklet/xdbook.vcxproj deleted file mode 100644 index be4eedd5..00000000 --- a/print/XPSDrvSmpl/src/filters/booklet/xdbook.vcxproj +++ /dev/null @@ -1,540 +0,0 @@ - - - - - Debug - ARM - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {8D542B56-EB45-43B1-AAB8-417352F5BDE6} - $(MSBuildProjectName) - false - true - Debug - Win32 - {A382BFF2-1BDB-408F-9E26-D62594210A87} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - xdbook - - - xdbook - - - xdbook - - - xdbook - - - xdbook - - - xdbook - - - xdbook - - - xdbook - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - - - - xdbook.def - - - - - xdbook.def - - - - - xdbook.def - - - - - xdbook.def - - - - - xdbook.def - - - - - xdbook.def - - - - - xdbook.def - - - - - xdbook.def - - - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/booklet/xdbook.vcxproj.Filters b/print/XPSDrvSmpl/src/filters/booklet/xdbook.vcxproj.Filters deleted file mode 100644 index 3f281a6c..00000000 --- a/print/XPSDrvSmpl/src/filters/booklet/xdbook.vcxproj.Filters +++ /dev/null @@ -1,65 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {27EE07C8-4A3B-416F-9266-E7701F9FB1DB} - - - h;hpp;hxx;hm;inl;inc;xsd - {6811EDBB-9803-4589-BAAE-09AD34EC922A} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {68346DB5-5823-45D6-8621-B9323A164F62} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - - - Header Files - - - - - Header Files - - - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/color/XDColMan.def b/print/XPSDrvSmpl/src/filters/color/XDColMan.def deleted file mode 100644 index 1e85c9f1..00000000 --- a/print/XPSDrvSmpl/src/filters/color/XDColMan.def +++ /dev/null @@ -1,26 +0,0 @@ -; -; Copyright (c) 2005 Microsoft Corporation -; -; All rights reserved. -; -; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -; ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -; PARTICULAR PURPOSE. -; -; File Name: -; -; xdwmark.def -; -; Abstract: -; -; Watermark filter module definition file -; - -LIBRARY XDColMan - -EXPORTS - DllMain - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - diff --git a/print/XPSDrvSmpl/src/filters/color/XDColMan.vcxproj b/print/XPSDrvSmpl/src/filters/color/XDColMan.vcxproj deleted file mode 100644 index aa6176fc..00000000 --- a/print/XPSDrvSmpl/src/filters/color/XDColMan.vcxproj +++ /dev/null @@ -1,614 +0,0 @@ - - - - - Debug - ARM - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {C9C14C99-103E-45CB-B1B4-2C165429E35C} - $(MSBuildProjectName) - false - true - Debug - Win32 - {78463D57-E549-447C-A846-B9301DBB2BC9} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - XDColMan - - - XDColMan - - - XDColMan - - - XDColMan - - - XDColMan - - - XDColMan - - - XDColMan - - - XDColMan - - - - %(AdditionalDependencies);mscms.lib;windowscodecs.lib - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalDependencies);mscms.lib;windowscodecs.lib - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalDependencies);mscms.lib;windowscodecs.lib - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalDependencies);mscms.lib;windowscodecs.lib - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalDependencies);mscms.lib;windowscodecs.lib - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalDependencies);mscms.lib;windowscodecs.lib - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalDependencies);mscms.lib;windowscodecs.lib - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalDependencies);mscms.lib;windowscodecs.lib - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - - - - XDColMan.def - - - - - XDColMan.def - - - - - XDColMan.def - - - - - XDColMan.def - - - - - XDColMan.def - - - - - XDColMan.def - - - - - XDColMan.def - - - - - XDColMan.def - - - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/color/XDColMan.vcxproj.Filters b/print/XPSDrvSmpl/src/filters/color/XDColMan.vcxproj.Filters deleted file mode 100644 index 4602c7b8..00000000 --- a/print/XPSDrvSmpl/src/filters/color/XDColMan.vcxproj.Filters +++ /dev/null @@ -1,329 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {D821B726-E809-40D7-B964-B46198856820} - - - h;hpp;hxx;hm;inl;inc;xsd - {25073272-3E9F-4F45-B3A7-805E2F15B111} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {2EAE715D-4338-4A62-8F12-EC400CFF4D18} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - - - Header Files - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/color/bmpconv.cpp b/print/XPSDrvSmpl/src/filters/color/bmpconv.cpp deleted file mode 100644 index 8c6bd347..00000000 --- a/print/XPSDrvSmpl/src/filters/color/bmpconv.cpp +++ /dev/null @@ -1,1187 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bmpconv.cpp - -Abstract: - - WIC bitmap conversion class implementation. This class provides a wrapper to a bitmap - stream that uses WIC to access bitmap data and provide conversion functionality. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "bmpconv.h" - -/*++ - -Routine Name: - - CBmpConverter::CBmpConverter - -Routine Description: - - CBmpConverter default constructor - -Arguments: - - None - -Return Value: - - None - Throws an exception on error. - ---*/ -CBmpConverter::CBmpConverter() : - m_pImagingFactory(NULL), - m_pBitmap(NULL), - m_pColorContext(NULL), - m_pCurrentLock(NULL), - m_ePixelFormat(kWICPixelFormatDontCare) -{ - // - // Make sure we have an imaging factory to work with - // - HRESULT hr = CreateImagingFactory(); - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CBmpConverter::CBmpConverter - -Routine Description: - - CBmpConverter constructor - -Arguments: - - ePixFormat - Bitmap pixel format - cWidth - Bitmap width - cHeight - Bitmap height - dpiX - Bitmap horizontal resolution - dpiY - Bitmap vertical resolution - -Return Value: - - None - Throws an exception on error. - ---*/ -CBmpConverter::CBmpConverter( - _In_ CONST EWICPixelFormat& ePixFormat, - _In_ CONST UINT& cWidth, - _In_ CONST UINT& cHeight, - _In_ CONST DOUBLE& dpiX, - _In_ CONST DOUBLE& dpiY - ) : - m_pImagingFactory(NULL), - m_pBitmap(NULL), - m_pColorContext(NULL), - m_pCurrentLock(NULL), - m_ePixelFormat(ePixFormat) -{ - HRESULT hr = S_OK; - - // - // Make sure we have an imaging factory to work with... - // - if (SUCCEEDED(hr = CreateImagingFactory())) - { - // - // ...and that the underlying bitmap is created and intialized. - // - hr = Initialize(m_ePixelFormat, cWidth, cHeight, dpiX, dpiY); - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CBmpConverter::CBmpConverter - -Routine Description: - - CBmpConverter constructor - -Arguments: - - pStream - Stream containing the bitmap container data - -Return Value: - - None - Throws an exception on error. - ---*/ -CBmpConverter::CBmpConverter( - _In_ IStream* pStream - ) : - m_pImagingFactory(NULL), - m_pBitmap(NULL), - m_pColorContext(NULL), - m_pCurrentLock(NULL), - m_ePixelFormat(kWICPixelFormatDontCare) -{ - HRESULT hr = S_OK; - - // - // Make sure we have an imaging factory to work with... - // - if (SUCCEEDED(hr = CreateImagingFactory())) - { - // - // ...and that the underlying bitmap is created and intialized from the input stream. - // - hr = Initialize(pStream); - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CBmpConverter::CBmpConverter - -Routine Description: - - CBmpConverter constructor - -Arguments: - - converter - Converter class to construct from - -Return Value: - - None - Throws an exception on error. - ---*/ -CBmpConverter::CBmpConverter( - _In_ CONST CBmpConverter& converter - ) : - m_pImagingFactory(converter.m_pImagingFactory), - m_pBitmap(converter.m_pBitmap), - m_pColorContext(converter.m_pColorContext), - m_pCurrentLock(converter.m_pCurrentLock), - m_ePixelFormat(converter.m_ePixelFormat) -{ - ASSERTMSG(m_pCurrentLock == NULL, "Copying locked bitmap can lead to a deadlock when writing out the bitmap.\n"); -} - -/*++ - -Routine Name: - - CBmpConverter::~CBmpConverter - -Routine Description: - - CBmpConverter destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CBmpConverter::~CBmpConverter() -{ -} - -/*++ - -Routine Name: - - CBmpConverter::Initialize - -Routine Description: - - Initializes the bitmap given format, dimensions and resolution - -Arguments: - - ePixFormat - Bitmap pixel format - cWidth - Bitmap width - cHeight - Bitmap height - dpiX - Bitmap horizontal resolution - dpiY - Bitmap vertical resolution - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBmpConverter::Initialize( - _In_ CONST EWICPixelFormat& ePixFormat, - _In_ CONST UINT& cWidth, - _In_ CONST UINT& cHeight, - _In_ CONST DOUBLE& dpiX, - _In_ CONST DOUBLE& dpiY - ) -{ - HRESULT hr = S_OK; - - if (ePixFormat <= kWICPixelFormatMin || - ePixFormat >= kWICPixelFormatMax || - cWidth == 0 || - cHeight == 0 || - dpiX <= 0 || - dpiY <= 0) - { - hr = E_INVALIDARG; - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(m_pImagingFactory, E_PENDING))) - { - // - // Create the bitmap - // - m_pBitmap = NULL; - m_ePixelFormat = ePixFormat; - if (SUCCEEDED(hr = m_pImagingFactory->CreateBitmap(cWidth, - cHeight, - g_lutPixFrmtGuid[m_ePixelFormat], - WICBitmapCacheOnLoad, - &m_pBitmap)) && - SUCCEEDED(hr = CHECK_POINTER(m_pBitmap, E_FAIL))) - { - // - // Make sure the resolution is preserved - this can lead to strange scaling - // in an XPS document if the resoution changes - // - hr = m_pBitmap->SetResolution(dpiX, dpiY); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBmpConverter::Initialize - -Routine Description: - - Initializes the bitmap from a stream containing the container information - -Arguments: - - pStream - Streamed container information - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBmpConverter::Initialize( - _In_ IStream* pStream - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pStream, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pImagingFactory, E_PENDING))) - { - CComPtr pDecoder(NULL); - CComPtr pBitmapSrcFrame(NULL); - LARGE_INTEGER cbMoveFromStart = {0}; - - // - // Ensure we have released any current color contexts - // - m_pColorContext = NULL; - - // - // Create a decoder from the input stream and retrieve the first frame. Create a color context - // to recieve any potential embedded color profiles. - // - if (SUCCEEDED(hr = pStream->Seek(cbMoveFromStart, STREAM_SEEK_SET, NULL)) && - SUCCEEDED(hr = m_pImagingFactory->CreateDecoderFromStream(pStream, NULL, WICDecodeMetadataCacheOnDemand, &pDecoder)) && - SUCCEEDED(hr = CHECK_POINTER(pDecoder, E_FAIL)) && - SUCCEEDED(hr = pDecoder->GetFrame(0, &pBitmapSrcFrame)) && - SUCCEEDED(hr = CHECK_POINTER(pDecoder, E_FAIL)) && - SUCCEEDED(hr = m_pImagingFactory->CreateColorContext(&m_pColorContext)) && - SUCCEEDED(hr = CHECK_POINTER(m_pColorContext, E_FAIL))) - { - // - // Check for an embedded color context - // - UINT cColContexts = 0; - if (SUCCEEDED(hr = pBitmapSrcFrame->GetColorContexts(1, &(m_pColorContext.p), &cColContexts))) - { - // - // If there are no color contexts, ensure the color context is released - // - if (cColContexts == 0) - { - m_pColorContext = NULL; - } - - hr = Initialize(pBitmapSrcFrame); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBmpConverter::Initialize - -Routine Description: - - Intializes the bitmap from a WIC bitmap source - -Arguments: - - pSource - pointer to the WIC bitmap source interface to intialize from - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBmpConverter::Initialize( - _In_ IWICBitmapSource* pSource - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pSource, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pImagingFactory, E_PENDING))) - { - // - // Make sure we have released any current bitmaps - // - m_pBitmap = NULL; - - // - // Create the bitmap from the source and set the pixel format enumeration from the GUID - // - WICPixelFormatGUID guidPixFormat; - if (SUCCEEDED(hr = m_pImagingFactory->CreateBitmapFromSource(pSource, WICBitmapCacheOnDemand, &m_pBitmap)) && - SUCCEEDED(hr = CHECK_POINTER(m_pBitmap, E_FAIL)) && - SUCCEEDED(hr = m_pBitmap->GetPixelFormat(&guidPixFormat))) - { - hr = PixelFormatFromGUID(guidPixFormat, &m_ePixelFormat); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBmpConverter::Write - -Routine Description: - - Writes the bitmap to a stream using the requested container format - -Arguments: - - guidContainerFormat - Requested container format to write out - pStream - The destination stream to write to - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBmpConverter::Write( - _In_ REFGUID guidContainerFormat, - _Inout_ IStream* pStream - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pStream, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pBitmap, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pImagingFactory, E_PENDING))) - { - CComPtr pEncoder(NULL); - CComPtr pFrame(NULL); - CComPtr pPropertyBag(NULL); - - UINT srcWidth = 0; - UINT srcHeight = 0; - - DOUBLE xRes = 0.0; - DOUBLE yRes = 0.0; - - WICPixelFormatGUID srcFormat; - - // - // Create the appropriate encoder, set the stream to recieve the data and retrieve a frame. - // Initialize the frame from the current bitmap data. - // - if (SUCCEEDED(hr = m_pImagingFactory->CreateEncoder(guidContainerFormat, NULL, &pEncoder)) && - SUCCEEDED(hr = pEncoder->Initialize(pStream, WICBitmapEncoderNoCache)) && - SUCCEEDED(hr = pEncoder->CreateNewFrame(&pFrame, &pPropertyBag)) && - SUCCEEDED(hr = CHECK_POINTER(pFrame, E_FAIL)) && - SUCCEEDED(hr = CHECK_POINTER(pPropertyBag, E_FAIL)) && - SUCCEEDED(hr = pFrame->Initialize(pPropertyBag)) && - SUCCEEDED(hr = m_pBitmap->GetSize(&srcWidth, &srcHeight)) && - SUCCEEDED(hr = m_pBitmap->GetResolution(&xRes, &yRes)) && - SUCCEEDED(hr = m_pBitmap->GetPixelFormat(&srcFormat))) - { - WICRect sizeSrc = {0}; - sizeSrc.Width = static_cast(srcWidth); - sizeSrc.Height = static_cast(srcHeight); - - if (SUCCEEDED(hr = pFrame->SetSize(srcWidth, srcHeight)) && - SUCCEEDED(hr = pFrame->SetResolution(xRes, yRes)) && - SUCCEEDED(hr = pFrame->SetPixelFormat(&srcFormat))) - { - if (HasColorContext()) - { - hr = pFrame->SetColorContexts(1, &m_pColorContext.p); - } - - if (SUCCEEDED(hr)) - { - // - // Write the bitmap data to the frame. - // - hr = pFrame->WriteSource(m_pBitmap, &sizeSrc); - } - } - } - - // - // Commit the frame and the encoder - this sets the bitmap data and encodes the - // bitmap into a container - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = pFrame->Commit())) - { - hr = pEncoder->Commit(); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBmpConverter::Convert - -Routine Description: - - Uses WIC to convert from the current pixel format to the requested pixel format - -Arguments: - - ePixFormat - the requested pixel format - pbCanConvert - variable that recieves whether the conversion is possible - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBmpConverter::Convert( - _In_ EWICPixelFormat ePixFormat, - _Out_ BOOL* pbCanConvert - ) -{ - HRESULT hr = S_OK; - - if (ePixFormat > kWICPixelFormatDontCare && - ePixFormat < kWICPixelFormatMax) - { - if (SUCCEEDED(hr = CHECK_POINTER(pbCanConvert, E_POINTER))) - { - *pbCanConvert = TRUE; - } - } - else - { - hr = E_INVALIDARG; - } - - // - // If the requested format differs from the original we need to do some work. - // - if (SUCCEEDED(hr) && - ePixFormat != m_ePixelFormat) - { - CComPtr pConverter(NULL); - - WICPixelFormatGUID dstFormat = g_lutPixFrmtGuid[ePixFormat]; - WICPixelFormatGUID srcFormat; - - // - // Retrieve a format converter, intialize from the current bitmap the use the converter - // to reset the bitmap to the appropriate type. - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(m_pImagingFactory, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pBitmap, E_PENDING)) && - SUCCEEDED(hr = m_pImagingFactory->CreateFormatConverter(&pConverter)) && - SUCCEEDED(hr = CHECK_POINTER(pConverter, E_FAIL)) && - SUCCEEDED(hr = m_pBitmap->GetPixelFormat(&srcFormat)) && - SUCCEEDED(hr = pConverter->CanConvert(srcFormat, dstFormat, pbCanConvert)) && - *pbCanConvert && - SUCCEEDED(hr = pConverter->Initialize(m_pBitmap, dstFormat, WICBitmapDitherTypeNone, NULL, 0.0f, WICBitmapPaletteTypeCustom))) - { - hr = Initialize(pConverter); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBmpConverter::LockSurface - -Routine Description: - - Locks the requested rectangle for reading and writing of the pixel data directly - -Arguments: - - prcLock - The rectangle area of the bitmap to lock - bReadOnly - Is this a read only lock - pcbStride - Pointer to variable that recieves the stride between scanlines - pcWidth - Pointer to variable that recieves the bitmap pixel width - pcHeight - Pointer to variable that recieves the bitmap pixel height - pcbData - Pointer to variable that recieves the size of the pixel data buffer - ppbData - Pointer to a BYTE pointer that recieves the data pointer - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBmpConverter::LockSurface( - _In_ WICRect* prcLock, - _In_ CONST BOOL& bReadOnly, - _Out_ UINT* pcbStride, - _Out_ UINT* pcWidth, - _Out_ UINT* pcHeight, - _Inout_ UINT* pcbData, - _Outptr_result_bytebuffer_maybenull_(*pcbData) - PBYTE* ppbData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pBitmap, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pImagingFactory, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(prcLock, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcbStride, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcWidth, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcHeight, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcbData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppbData, E_POINTER))) - { - *pcbStride = 0; - *pcWidth = 0; - *pcHeight = 0; - *pcbData = 0; - *ppbData = NULL; - - // - // Free any current locks and acquire a new one. Get the stride, size and data from the lock. - // - m_pCurrentLock = NULL; - if (SUCCEEDED(hr) && - SUCCEEDED(hr = m_pBitmap->Lock(prcLock, bReadOnly ? WICBitmapLockRead : WICBitmapLockWrite, &m_pCurrentLock)) && - SUCCEEDED(hr = CHECK_POINTER(m_pCurrentLock, E_FAIL)) && - SUCCEEDED(hr = m_pCurrentLock->GetStride(pcbStride)) && - SUCCEEDED(hr = m_pCurrentLock->GetSize(pcWidth, pcHeight))) - { - hr = m_pCurrentLock->GetDataPointer(pcbData, ppbData); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBmpConverter::UnlockSurface - -Routine Description: - - Unlocks any current lock on the bitmap surface - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBmpConverter::UnlockSurface( - VOID - ) -{ - m_pCurrentLock = NULL; - - return S_OK; -} - -/*++ - -Routine Name: - - CBmpConverter::GetColorContext - -Routine Description: - - Retrieves any color context associated with the bitmap - -Arguments: - - ppColorContext - Pointer to a color context interface pointer to recieve the context - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - On no context present - E_* - On error - ---*/ -HRESULT -CBmpConverter::GetColorContext( - _Outptr_ IWICColorContext** ppColorContext - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppColorContext, E_POINTER))) - { - *ppColorContext = NULL; - - if (HasColorContext()) - { - *ppColorContext = m_pColorContext; - } - else - { - hr = E_ELEMENT_NOT_FOUND; - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CBmpConverter::HasAlphaChannel - -Routine Description: - - Indicates if the bitmap has an alpha channel - -Arguments: - - None - -Return Value: - - TRUE - The bitmap has an alpha channel - FALSE - There is no alpha channel - ---*/ -BOOL -CBmpConverter::HasAlphaChannel( - VOID - ) CONST -{ - BOOL bHasAlpha = FALSE; - - switch (m_ePixelFormat) - { - case kWICPixelFormat32bppBGRA: - case kWICPixelFormat32bppPBGRA: - case kWICPixelFormat64bppRGBA: - case kWICPixelFormat64bppPRGBA: - case kWICPixelFormat128bppRGBAFloat: - case kWICPixelFormat128bppPRGBAFloat: - case kWICPixelFormat64bppRGBAFixedPoint: - case kWICPixelFormat128bppRGBAFixedPoint: - case kWICPixelFormat64bppRGBAHalf: - case kWICPixelFormat40bppCMYKAlpha: - case kWICPixelFormat80bppCMYKAlpha: - case kWICPixelFormat32bpp3ChannelsAlpha: - case kWICPixelFormat40bpp4ChannelsAlpha: - case kWICPixelFormat48bpp5ChannelsAlpha: - case kWICPixelFormat56bpp6ChannelsAlpha: - case kWICPixelFormat64bpp7ChannelsAlpha: - case kWICPixelFormat72bpp8ChannelsAlpha: - case kWICPixelFormat64bpp3ChannelsAlpha: - case kWICPixelFormat80bpp4ChannelsAlpha: - case kWICPixelFormat96bpp5ChannelsAlpha: - case kWICPixelFormat112bpp6ChannelsAlpha: - case kWICPixelFormat128bpp7ChannelsAlpha: - case kWICPixelFormat144bpp8ChannelsAlpha: - { - bHasAlpha = TRUE; - } - break; - - default: - { - } - break; - } - - return bHasAlpha; -} - -/*++ - -Routine Name: - - CBmpConverter::HasColorContext - -Routine Description: - - Indicates whether the bitmap has a color context - -Arguments: - - None - -Return Value: - - TRUE - The bitmap has a color context - FALSE - There is no color context associated with the bitmap - ---*/ -BOOL -CBmpConverter::HasColorContext( - VOID - ) CONST -{ - return m_pColorContext != NULL; -} - -/*++ - -Routine Name: - - CBmpConverter::HasColorProfile - -Routine Description: - - Indicates whether the color context (if present) contains a color profile - -Arguments: - - None - -Return Value: - - TRUE - There is a color context and it contains a color profile - FALSE - There is either no color context or the context does not contain a color profile - ---*/ -BOOL -CBmpConverter::HasColorProfile( - VOID - ) CONST -{ - BOOL bHasProfile = FALSE; - - if (HasColorContext()) - { - WICColorContextType wicContextType = WICColorContextUninitialized; - if (m_pColorContext != NULL && - SUCCEEDED(m_pColorContext->GetType(&wicContextType))) - { - bHasProfile = wicContextType == WICColorContextProfile; - } - } - - return bHasProfile; -} - -/*++ - -Routine Name: - - CBmpConverter::GetPixelFormat - -Routine Description: - - Retrieves the underlying pixel format - -Arguments: - - None - -Return Value: - - Enumerated value identifying the current pixel format of the bitmap - ---*/ -EWICPixelFormat -CBmpConverter::GetPixelFormat( - VOID - ) -{ - return m_ePixelFormat; -} - -/*++ - -Routine Name: - - CBmpConverter::GetSize - -Routine Description: - - Retrieves the dimensions of the bitmap - -Arguments: - - pcWidth - Pointer to a variable that recieves the pixel width - pcHeight - Pointer to a variable that recieves the pixel height - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBmpConverter::GetSize( - _Out_ UINT* pcWidth, - _Out_ UINT* pcHeight - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pBitmap, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pImagingFactory, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(pcWidth, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcHeight, E_POINTER))) - { - *pcWidth = 0; - *pcHeight = 0; - - hr = m_pBitmap->GetSize(pcWidth, pcHeight); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBmpConverter::GetResolution - -Routine Description: - - Retrieves the resolution of the underlying bitmap - -Arguments: - - pDpiX - Pointer to a variable that recieves the horizontal resolution - pDpiY - Pointer to a variable that recieves the vertical resolution - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBmpConverter::GetResolution( - _Out_ DOUBLE* pDpiX, - _Out_ DOUBLE* pDpiY - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pBitmap, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pImagingFactory, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(pDpiX, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDpiY, E_POINTER))) - { - *pDpiX = 0.0; - *pDpiY = 0.0; - - hr = m_pBitmap->GetResolution(pDpiX, pDpiY); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBmpConverter::SetProfile - -Routine Description: - - This method sets creates a color context based of the supplied profile filename and - associates that cotext with the bitmap - -Arguments: - - szProfile - The profile filename - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBmpConverter::SetProfile( - _In_z_ LPWSTR szProfile - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(szProfile, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pImagingFactory, E_PENDING))) - { - m_pColorContext = NULL; - if (SUCCEEDED(hr = m_pImagingFactory->CreateColorContext(&m_pColorContext))) - { - hr = m_pColorContext->InitializeFromFilename(szProfile); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBmpConverter::operator= - -Routine Description: - - Assignment operator - -Arguments: - - converter - Instance of a CBmpConverter to be assigned to - -Return Value: - - Reference to the newly assigned CBmpConverter instance - ---*/ -CBmpConverter& -CBmpConverter::operator=( - _In_ CONST CBmpConverter& converter - ) -{ - // - // Assign all the member pointers. The COM pointer takes care of reference counting. - // - m_pImagingFactory = converter.m_pImagingFactory; - m_pBitmap = converter.m_pBitmap; - m_pColorContext = converter.m_pColorContext; - m_pCurrentLock = converter.m_pCurrentLock; - m_ePixelFormat = converter.m_ePixelFormat; - - ASSERTMSG(m_pCurrentLock == NULL, "Copying locked bitmap can lead to a deadlock.\n"); - - return *this; -} - -/*++ - -Routine Name: - - CBmpConverter::CreateImagingFactory - -Routine Description: - - Creates the WIC imaging factory - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBmpConverter::CreateImagingFactory( - VOID - ) -{ - m_pImagingFactory = NULL; - HRESULT hr = m_pImagingFactory.CoCreateInstance(CLSID_WICImagingFactory); - if (SUCCEEDED(hr)) - { - hr = CHECK_POINTER(m_pImagingFactory, E_FAIL); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBmpConverter::PixelFormatFromGUID - -Routine Description: - - Converts the WIC pixel format GUID to the matching pixel format enumeration - -Arguments: - - pixelFormat - GUID defining the pixel format - pPixFormat - Pointer to the pixel format to be set - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBmpConverter::PixelFormatFromGUID( - _In_ REFGUID pixelFormat, - _Out_ EWICPixelFormat* pPixFormat - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPixFormat, E_POINTER))) - { - *pPixFormat = kWICPixelFormatDontCare; - BOOL bFound = 0; - - // - // Loop all the potential formats - // - for (UINT cFormat = 0; - cFormat < kWICPixelFormatMax; - cFormat++) - { - // - // Try to match the guid - // - if (pixelFormat == g_lutPixFrmtGuid[cFormat]) - { - // - // The index provides the corresponding pixel format enumerated value - // - bFound = TRUE; - *pPixFormat = static_cast(cFormat); - break; - } - } - - if (!bFound) - { - RIP("Could not match format GUID\n"); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/color/bmpconv.h b/print/XPSDrvSmpl/src/filters/color/bmpconv.h deleted file mode 100644 index 5bed56b4..00000000 --- a/print/XPSDrvSmpl/src/filters/color/bmpconv.h +++ /dev/null @@ -1,168 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bmpconv.h - -Abstract: - - WIC bitmap conversion class definition. This class provides a wrapper to a bitmap - stream that uses WIC to access bitmap data and provide conversion functionality. - ---*/ - -#pragma once - -#include "bmpdata.h" - -class CBmpConverter -{ -public: - CBmpConverter(); - - CBmpConverter( - _In_ CONST EWICPixelFormat& ePixFormat, - _In_ CONST UINT& cWidth, - _In_ CONST UINT& cHeight, - _In_ CONST DOUBLE& dpiX, - _In_ CONST DOUBLE& dpiY - ); - - CBmpConverter( - _In_ IStream* pStream - ); - - CBmpConverter( - _In_ CONST CBmpConverter& converter - ); - - virtual ~CBmpConverter(); - - HRESULT - Initialize( - _In_ CONST EWICPixelFormat& ePixFormat, - _In_ CONST UINT& cWidth, - _In_ CONST UINT& cHeight, - _In_ CONST DOUBLE& dpiX, - _In_ CONST DOUBLE& dpiY - ); - - HRESULT - Initialize( - _In_ IStream* pStream - ); - - HRESULT - Initialize( - _In_ IWICBitmapSource* pSource - ); - - HRESULT - Write( - _In_ REFGUID guidContainerFormat, - _Inout_ IStream* pStream - ); - - HRESULT - Convert( - _In_ EWICPixelFormat ePixFormat, - _Out_ BOOL* pbCanConvert - ); - - HRESULT - LockSurface( - _In_ WICRect* prcLock, - _In_ CONST BOOL& bReadOnly, - _Out_ UINT* pcbStride, - _Out_ UINT* pcWidth, - _Out_ UINT* pcHeight, - _Inout_ UINT* pcbData, - _Outptr_result_bytebuffer_maybenull_(*pcbData) - PBYTE* ppbData - ); - - HRESULT - UnlockSurface( - VOID - ); - - HRESULT - GetColorContext( - _Outptr_ IWICColorContext** ppColorContext - ); - - BOOL - HasAlphaChannel( - VOID - ) CONST; - - BOOL - HasColorContext( - VOID - ) CONST; - - BOOL - HasColorProfile( - VOID - ) CONST; - - EWICPixelFormat - GetPixelFormat( - VOID - ); - - HRESULT - GetSize( - _Out_ UINT* pcWidth, - _Out_ UINT* pcHeight - ); - - HRESULT - GetResolution( - _Out_ DOUBLE* pDpiX, - _Out_ DOUBLE* pDpiY - ); - - HRESULT - SetProfile( - _In_z_ LPWSTR szProfile - ); - - CBmpConverter& - operator=( - _In_ CONST CBmpConverter& converter - ); - -private: - HRESULT - CreateImagingFactory( - VOID - ); - - HRESULT - PixelFormatFromGUID( - _In_ REFGUID pixelFormat, - _Out_ EWICPixelFormat* pPixFormat - ); - -protected: - CComPtr m_pImagingFactory; - - CComPtr m_pBitmap; - - CComPtr m_pColorContext; - - CComPtr m_pCurrentLock; - - EWICPixelFormat m_ePixelFormat; -}; - diff --git a/print/XPSDrvSmpl/src/filters/color/bmpdata.cpp b/print/XPSDrvSmpl/src/filters/color/bmpdata.cpp deleted file mode 100644 index b4df4d02..00000000 --- a/print/XPSDrvSmpl/src/filters/color/bmpdata.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bmpdata.cpp - -Abstract: - - This file supplies various look-up tables for use in converting and color matching - input bitmaps via WCS/ICM and WIC - ---*/ - -#include "precomp.h" -#include "globals.h" -#include "bmpdata.h" - -/* -Look up table between WIC pixel format enumeration and WIC pixel format GUID -*/ -CONST WICPixelFormatGUID g_lutPixFrmtGuid[kWICPixelFormatMax] = { - GUID_WICPixelFormatDontCare, - GUID_WICPixelFormat1bppIndexed, - GUID_WICPixelFormat2bppIndexed, - GUID_WICPixelFormat4bppIndexed, - GUID_WICPixelFormat8bppIndexed, - GUID_WICPixelFormatBlackWhite, - GUID_WICPixelFormat2bppGray, - GUID_WICPixelFormat4bppGray, - GUID_WICPixelFormat8bppGray, - GUID_WICPixelFormat16bppBGR555, - GUID_WICPixelFormat16bppBGR565, - GUID_WICPixelFormat16bppGray, - GUID_WICPixelFormat24bppBGR, - GUID_WICPixelFormat24bppRGB, - GUID_WICPixelFormat32bppBGR, - GUID_WICPixelFormat32bppBGRA, - GUID_WICPixelFormat32bppPBGRA, - GUID_WICPixelFormat32bppGrayFloat, - GUID_WICPixelFormat48bppRGBFixedPoint, - GUID_WICPixelFormat16bppGrayFixedPoint, - GUID_WICPixelFormat32bppBGR101010, - GUID_WICPixelFormat48bppRGB, - GUID_WICPixelFormat64bppRGBA, - GUID_WICPixelFormat64bppPRGBA, - GUID_WICPixelFormat96bppRGBFixedPoint, - GUID_WICPixelFormat128bppRGBAFloat, - GUID_WICPixelFormat128bppPRGBAFloat, - GUID_WICPixelFormat128bppRGBFloat, - GUID_WICPixelFormat32bppCMYK, - GUID_WICPixelFormat64bppRGBAFixedPoint, - GUID_WICPixelFormat64bppRGBFixedPoint, - GUID_WICPixelFormat128bppRGBAFixedPoint, - GUID_WICPixelFormat128bppRGBFixedPoint, - GUID_WICPixelFormat64bppRGBAHalf, - GUID_WICPixelFormat64bppRGBHalf, - GUID_WICPixelFormat48bppRGBHalf, - GUID_WICPixelFormat32bppRGBE, - GUID_WICPixelFormat16bppGrayHalf, - GUID_WICPixelFormat32bppGrayFixedPoint, - GUID_WICPixelFormat64bppCMYK, - GUID_WICPixelFormat24bpp3Channels, - GUID_WICPixelFormat32bpp4Channels, - GUID_WICPixelFormat40bpp5Channels, - GUID_WICPixelFormat48bpp6Channels, - GUID_WICPixelFormat56bpp7Channels, - GUID_WICPixelFormat64bpp8Channels, - GUID_WICPixelFormat48bpp3Channels, - GUID_WICPixelFormat64bpp4Channels, - GUID_WICPixelFormat80bpp5Channels, - GUID_WICPixelFormat96bpp6Channels, - GUID_WICPixelFormat112bpp7Channels, - GUID_WICPixelFormat128bpp8Channels, - GUID_WICPixelFormat40bppCMYKAlpha, - GUID_WICPixelFormat80bppCMYKAlpha, - GUID_WICPixelFormat32bpp3ChannelsAlpha, - GUID_WICPixelFormat40bpp4ChannelsAlpha, - GUID_WICPixelFormat48bpp5ChannelsAlpha, - GUID_WICPixelFormat56bpp6ChannelsAlpha, - GUID_WICPixelFormat64bpp7ChannelsAlpha, - GUID_WICPixelFormat72bpp8ChannelsAlpha, - GUID_WICPixelFormat64bpp3ChannelsAlpha, - GUID_WICPixelFormat80bpp4ChannelsAlpha, - GUID_WICPixelFormat96bpp5ChannelsAlpha, - GUID_WICPixelFormat112bpp6ChannelsAlpha, - GUID_WICPixelFormat128bpp7ChannelsAlpha, - GUID_WICPixelFormat144bpp8ChannelsAlpha -}; - -/* -Look-up table between WICPixelFormat enumeration and conversion information - -The aim of this table is to assist us in transforming the input WCS data into a format acceptable -to WCS/ICM TranslateBitmapBits call. The sort of problems this aims to resolve are: - - 1. The lack of S7DOT24FIXED format support in WCS/ICM. - 2. The lack of half format support in WCS/ICM. - 3. The lack of support for > 8bpc in WCS/ICM for channel counts > 4 - -The table is used in the following way: - - 1. Look-up the most appropriate WIC pixel format for color conversion by indexing into - the table using the matching WIC pixel format enumeration then using WIC to convert - to this format. - 2. Identify the matching BMFORMAT enumeration to process with WCS/ICM - 3. Identify where we need to process alpha data seperately and using an intermediate - transform buffer to pass to ICM/WCS where necessary - -Additionally the table also provides useful look-up information for use when processing -intermediate transform buffers: channel count, alpha channel placement and color data type. - -*/ -CONST WICToBMFORMAT g_lutWICToBMFormat[kWICPixelFormatMax] = { - {kWICPixelFormat24bppRGB, kBM_RGBTRIPLETS, FALSE, 3, 0, COLOR_BYTE}, // kWICPixelFormatDontCare - {kWICPixelFormat24bppRGB, kBM_RGBTRIPLETS, FALSE, 3, 0, COLOR_BYTE}, // kWICPixelFormat1bppIndexed - {kWICPixelFormat24bppRGB, kBM_RGBTRIPLETS, FALSE, 3, 0, COLOR_BYTE}, // kWICPixelFormat2bppIndexed - {kWICPixelFormat24bppRGB, kBM_RGBTRIPLETS, FALSE, 3, 0, COLOR_BYTE}, // kWICPixelFormat4bppIndexed - {kWICPixelFormat24bppRGB, kBM_RGBTRIPLETS, FALSE, 3, 0, COLOR_BYTE}, // kWICPixelFormat8bppIndexed - {kWICPixelFormat8bppGray, kBM_GRAY, FALSE, 1, 0, COLOR_BYTE}, // kWICPixelFormatBlackWhite - {kWICPixelFormat8bppGray, kBM_GRAY, FALSE, 1, 0, COLOR_BYTE}, // kWICPixelFormat2bppGray - {kWICPixelFormat8bppGray, kBM_GRAY, FALSE, 1, 0, COLOR_BYTE}, // kWICPixelFormat4bppGray - {kWICPixelFormat8bppGray, kBM_GRAY, FALSE, 1, 0, COLOR_BYTE}, // kWICPixelFormat8bppGray - {kWICPixelFormat24bppRGB, kBM_RGBTRIPLETS, FALSE, 3, 0, COLOR_BYTE}, // kWICPixelFormat16bppBGR555 - {kWICPixelFormat24bppRGB, kBM_RGBTRIPLETS, FALSE, 3, 0, COLOR_BYTE}, // kWICPixelFormat16bppBGR565 - {kWICPixelFormat16bppGray, kBM_16b_GRAY, FALSE, 1, 0, COLOR_WORD}, // kWICPixelFormat16bppGray - {kWICPixelFormat24bppBGR, kBM_BGRTRIPLETS, FALSE, 3, 0, COLOR_BYTE}, // kWICPixelFormat24bppBGR - {kWICPixelFormat24bppRGB, kBM_RGBTRIPLETS, FALSE, 3, 0, COLOR_BYTE}, // kWICPixelFormat24bppRGB - {kWICPixelFormat24bppBGR, kBM_BGRTRIPLETS, FALSE, 3, 0, COLOR_BYTE}, // kWICPixelFormat32bppBGR - {kWICPixelFormat32bppBGRA, kBM_xRGBQUADS, FALSE, 4, 3, COLOR_BYTE}, // kWICPixelFormat32bppBGRA - {kWICPixelFormat32bppPBGRA, kBM_xRGBQUADS, FALSE, 4, 3, COLOR_BYTE}, // kWICPixelFormat32bppPBGRA - {kWICPixelFormat16bppGray, kBM_16b_GRAY, FALSE, 1, 0, COLOR_WORD}, // kWICPixelFormat32bppGrayFloat - {kWICPixelFormat48bppRGBFixedPoint, kBM_S2DOT13FIXED_scRGB, FALSE, 3, 0, COLOR_S2DOT13FIXED}, // kWICPixelFormat48bppRGBFixedPoint - {kWICPixelFormat16bppGray, kBM_16b_GRAY, FALSE, 1, 0, COLOR_WORD}, // kWICPixelFormat16bppGrayFixedPoint - {kWICPixelFormat48bppRGB, kBM_16b_RGB, FALSE, 3, 0, COLOR_WORD}, // kWICPixelFormat32bppBGR101010 - {kWICPixelFormat48bppRGB, kBM_16b_RGB, FALSE, 3, 0, COLOR_WORD}, // kWICPixelFormat48bppRGB - {kWICPixelFormat64bppRGBA, kBM_16b_RGB, TRUE, 4, 3, COLOR_WORD}, // kWICPixelFormat64bppRGBA - {kWICPixelFormat64bppPRGBA, kBM_16b_RGB, TRUE, 4, 3, COLOR_WORD}, // kWICPixelFormat64bppPRGBA - {kWICPixelFormat128bppRGBFloat, kBM_32b_scRGB, TRUE, 4, 0, COLOR_FLOAT}, // kWICPixelFormat96bppRGBFixedPoint - {kWICPixelFormat128bppRGBAFloat, kBM_32b_scARGB, FALSE, 4, 3, COLOR_FLOAT}, // kWICPixelFormat128bppRGBAFloat - {kWICPixelFormat128bppPRGBAFloat, kBM_32b_scARGB, FALSE, 4, 3, COLOR_FLOAT}, // kWICPixelFormat128bppPRGBAFloat - {kWICPixelFormat128bppRGBFloat, kBM_32b_scARGB, FALSE, 4, 0, COLOR_FLOAT}, // kWICPixelFormat128bppRGBFloat - {kWICPixelFormat32bppCMYK, kBM_CMYKQUADS, FALSE, 4, 0, COLOR_BYTE}, // kWICPixelFormat32bppCMYK - {kWICPixelFormat64bppRGBAFixedPoint, kBM_S2DOT13FIXED_scARGB, FALSE, 4, 3, COLOR_S2DOT13FIXED}, // kWICPixelFormat64bppRGBAFixedPoint - {kWICPixelFormat64bppRGBFixedPoint, kBM_S2DOT13FIXED_scARGB, FALSE, 4, 0, COLOR_S2DOT13FIXED}, // kWICPixelFormat64bppRGBFixedPoint - {kWICPixelFormat128bppRGBAFloat, kBM_32b_scARGB, FALSE, 4, 3, COLOR_FLOAT}, // kWICPixelFormat128bppRGBAFixedPoint - {kWICPixelFormat128bppRGBAFloat, kBM_32b_scARGB, FALSE, 4, 0, COLOR_FLOAT}, // kWICPixelFormat128bppRGBFixedPoint - {kWICPixelFormat128bppRGBAFloat, kBM_32b_scARGB, FALSE, 4, 3, COLOR_FLOAT}, // kWICPixelFormat64bppRGBAHalf - {kWICPixelFormat128bppRGBAFloat, kBM_32b_scARGB, FALSE, 4, 0, COLOR_FLOAT}, // kWICPixelFormat64bppRGBHalf - {kWICPixelFormat128bppRGBAFloat, kBM_32b_scARGB, FALSE, 4, 0, COLOR_FLOAT}, // kWICPixelFormat48bppRGBHalf - {kWICPixelFormat128bppRGBAFloat, kBM_32b_scARGB, FALSE, 4, 3, COLOR_FLOAT}, // kWICPixelFormat32bppRGBE - {kWICPixelFormat16bppGray, kBM_16b_GRAY, FALSE, 1, 0, COLOR_WORD}, // kWICPixelFormat16bppGrayHalf - {kWICPixelFormat16bppGray, kBM_16b_GRAY, FALSE, 1, 0, COLOR_WORD}, // kWICPixelFormat32bppGrayFixedPoint - {kWICPixelFormat32bpp4Channels, kBM_CMYKQUADS, FALSE, 4, 0, COLOR_BYTE}, // kWICPixelFormat64bppCMYK - {kWICPixelFormat24bpp3Channels, kBM_RGBTRIPLETS, FALSE, 3, 0, COLOR_BYTE}, // kWICPixelFormat24bpp3Channels - {kWICPixelFormat32bpp4Channels, kBM_CMYKQUADS, FALSE, 4, 0, COLOR_BYTE}, // kWICPixelFormat32bpp4Channels - {kWICPixelFormat40bpp5Channels, kBM_5CHANNEL, FALSE, 5, 0, COLOR_BYTE}, // kWICPixelFormat40bpp5Channels - {kWICPixelFormat48bpp6Channels, kBM_6CHANNEL, FALSE, 6, 0, COLOR_BYTE}, // kWICPixelFormat48bpp6Channels - {kWICPixelFormat56bpp7Channels, kBM_7CHANNEL, FALSE, 7, 0, COLOR_BYTE}, // kWICPixelFormat56bpp7Channels - {kWICPixelFormat64bpp8Channels, kBM_8CHANNEL, FALSE, 8, 0, COLOR_BYTE}, // kWICPixelFormat64bpp8Channels - {kWICPixelFormat24bpp3Channels, kBM_RGBTRIPLETS, FALSE, 3, 0, COLOR_BYTE}, // kWICPixelFormat48bpp3Channels - {kWICPixelFormat32bpp4Channels, kBM_CMYKQUADS, FALSE, 4, 0, COLOR_BYTE}, // kWICPixelFormat64bpp4Channels - {kWICPixelFormat40bpp5Channels, kBM_5CHANNEL, FALSE, 5, 0, COLOR_BYTE}, // kWICPixelFormat80bpp5Channels - {kWICPixelFormat48bpp6Channels, kBM_6CHANNEL, FALSE, 6, 0, COLOR_BYTE}, // kWICPixelFormat96bpp6Channels - {kWICPixelFormat56bpp7Channels, kBM_7CHANNEL, FALSE, 7, 0, COLOR_BYTE}, // kWICPixelFormat112bpp7Channels - {kWICPixelFormat64bpp8Channels, kBM_8CHANNEL, FALSE, 8, 0, COLOR_BYTE}, // kWICPixelFormat128bpp8Channels - {kWICPixelFormat40bppCMYKAlpha, kBM_CMYKQUADS, TRUE, 5, 4, COLOR_BYTE}, // kWICPixelFormat40bppCMYKAlpha - {kWICPixelFormat40bppCMYKAlpha, kBM_CMYKQUADS, TRUE, 5, 4, COLOR_BYTE}, // kWICPixelFormat80bppCMYKAlpha - {kWICPixelFormat32bpp3ChannelsAlpha, kBM_RGBTRIPLETS, TRUE, 4, 3, COLOR_BYTE}, // kWICPixelFormat32bpp3ChannelsAlpha - {kWICPixelFormat40bpp4ChannelsAlpha, kBM_CMYKQUADS, TRUE, 5, 4, COLOR_BYTE}, // kWICPixelFormat40bpp4ChannelsAlpha - {kWICPixelFormat48bpp5ChannelsAlpha, kBM_5CHANNEL, TRUE, 6, 5, COLOR_BYTE}, // kWICPixelFormat48bpp5ChannelsAlpha - {kWICPixelFormat56bpp6ChannelsAlpha, kBM_6CHANNEL, TRUE, 7, 6, COLOR_BYTE}, // kWICPixelFormat56bpp6ChannelsAlpha - {kWICPixelFormat64bpp7ChannelsAlpha, kBM_7CHANNEL, TRUE, 8, 7, COLOR_BYTE}, // kWICPixelFormat64bpp7ChannelsAlpha - {kWICPixelFormat72bpp8ChannelsAlpha, kBM_8CHANNEL, TRUE, 9, 8, COLOR_BYTE}, // kWICPixelFormat72bpp8ChannelsAlpha - {kWICPixelFormat32bpp3ChannelsAlpha, kBM_RGBTRIPLETS, TRUE, 4, 3, COLOR_BYTE}, // kWICPixelFormat64bpp3ChannelsAlpha - {kWICPixelFormat40bpp4ChannelsAlpha, kBM_CMYKQUADS, TRUE, 5, 4, COLOR_BYTE}, // kWICPixelFormat80bpp4ChannelsAlpha - {kWICPixelFormat48bpp5ChannelsAlpha, kBM_5CHANNEL, TRUE, 6, 5, COLOR_BYTE}, // kWICPixelFormat96bpp5ChannelsAlpha - {kWICPixelFormat56bpp6ChannelsAlpha, kBM_6CHANNEL, TRUE, 7, 6, COLOR_BYTE}, // kWICPixelFormat112bpp6ChannelsAlpha - {kWICPixelFormat64bpp7ChannelsAlpha, kBM_7CHANNEL, TRUE, 8, 7, COLOR_BYTE}, // kWICPixelFormat128bpp7ChannelsAlpha - {kWICPixelFormat72bpp8ChannelsAlpha, kBM_8CHANNEL, TRUE, 9, 8, COLOR_BYTE}, // kWICPixelFormat144bpp8ChannelsAlpha -}; - -/* -Look up table between color data type and data type size -*/ -CONST size_t g_lutColorDataSize[] = -{ - 0, // Packing as enumeration starts from 1 - sizeof(BYTE), // COLOR_BYTE =1 - sizeof(WORD), // COLOR_WORD - sizeof(FLOAT), // COLOR_FLOAT - sizeof(WORD), // COLOR_S2DOT13FIXED -}; - -/* -Define a color type that is not valid for WCS - we use this to distinguish -BMFORMATs that do not have a corresponding WCS color type -*/ -#define COLOR_INVALID 0 - -/* -Look up between local BMFORMAT enumeration providing the underlying enumeration -value and the corresponding pixel data size -*/ -CONST BMFormatData g_lutBMFormatData[kICMPixelFormatMax] = { - {BM_x555RGB, 3, static_cast(COLOR_INVALID)}, - {BM_x555XYZ, 3, static_cast(COLOR_INVALID)}, - {BM_x555Yxy, 3, static_cast(COLOR_INVALID)}, - {BM_x555Lab, 3, static_cast(COLOR_INVALID)}, - {BM_x555G3CH, 3, static_cast(COLOR_INVALID)}, - {BM_RGBTRIPLETS, 3, COLOR_BYTE}, - {BM_BGRTRIPLETS, 3, COLOR_BYTE}, - {BM_XYZTRIPLETS, 3, COLOR_BYTE}, - {BM_YxyTRIPLETS, 3, COLOR_BYTE}, - {BM_LabTRIPLETS, 3, COLOR_BYTE}, - {BM_G3CHTRIPLETS, 3, COLOR_BYTE}, - {BM_5CHANNEL, 5, COLOR_BYTE}, - {BM_6CHANNEL, 6, COLOR_BYTE}, - {BM_7CHANNEL, 7, COLOR_BYTE}, - {BM_8CHANNEL, 8, COLOR_BYTE}, - {BM_GRAY, 1, COLOR_BYTE}, - {BM_xRGBQUADS, 4, COLOR_BYTE}, - {BM_xBGRQUADS, 4, COLOR_BYTE}, - {BM_xG3CHQUADS, 4, COLOR_BYTE}, - {BM_KYMCQUADS, 4, COLOR_BYTE}, - {BM_CMYKQUADS, 4, COLOR_BYTE}, - {BM_10b_RGB, 4, COLOR_BYTE}, - {BM_10b_XYZ, 4, COLOR_BYTE}, - {BM_10b_Yxy, 4, COLOR_BYTE}, - {BM_10b_Lab, 4, COLOR_BYTE}, - {BM_10b_G3CH, 4, COLOR_BYTE}, - {BM_NAMED_INDEX, 4, COLOR_BYTE}, - {BM_16b_RGB, 3, COLOR_WORD}, - {BM_16b_XYZ, 3, COLOR_WORD}, - {BM_16b_Yxy, 3, COLOR_WORD}, - {BM_16b_Lab, 3, COLOR_WORD}, - {BM_16b_G3CH, 3, COLOR_WORD}, - {BM_16b_GRAY, 3, COLOR_WORD}, - {BM_565RGB, 3, COLOR_WORD}, - {BM_32b_scRGB, 3, COLOR_FLOAT}, - {BM_32b_scARGB, 4, COLOR_FLOAT}, - {BM_S2DOT13FIXED_scRGB, 3, COLOR_S2DOT13FIXED}, - {BM_S2DOT13FIXED_scARGB, 4, COLOR_S2DOT13FIXED}, -}; - diff --git a/print/XPSDrvSmpl/src/filters/color/bmpdata.h b/print/XPSDrvSmpl/src/filters/color/bmpdata.h deleted file mode 100644 index 225b7745..00000000 --- a/print/XPSDrvSmpl/src/filters/color/bmpdata.h +++ /dev/null @@ -1,768 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bmpdata.h - -Abstract: - - This file supplies definitions for various look-up tables for use in converting and - color matching input bitmaps via WCS/ICM and WIC - ---*/ - -#pragma once - -// -// Macros to limit maximum buffer size allocations -// -#define MAX_COLDATATYPE_SIZE sizeof(FLOAT) -#define MAX_COLCHANNEL_COUNT 9 // 8 channel plus alpha -#define MAX_PIXELWIDTH_COUNT SIZE_MAX/MAX_COLDATATYPE_SIZE/MAX_COLCHANNEL_COUNT - - -/* -Enumeration for all WIC pixel formats -*/ -enum EWICPixelFormat -{ - kWICPixelFormatDontCare = 0, kWICPixelFormatMin = 0, - kWICPixelFormat1bppIndexed, - kWICPixelFormat2bppIndexed, - kWICPixelFormat4bppIndexed, - kWICPixelFormat8bppIndexed, - kWICPixelFormatBlackWhite, - kWICPixelFormat2bppGray, - kWICPixelFormat4bppGray, - kWICPixelFormat8bppGray, - kWICPixelFormat16bppBGR555, - kWICPixelFormat16bppBGR565, - kWICPixelFormat16bppGray, - kWICPixelFormat24bppBGR, - kWICPixelFormat24bppRGB, - kWICPixelFormat32bppBGR, - kWICPixelFormat32bppBGRA, - kWICPixelFormat32bppPBGRA, - kWICPixelFormat32bppGrayFloat, - kWICPixelFormat48bppRGBFixedPoint, - kWICPixelFormat16bppGrayFixedPoint, - kWICPixelFormat32bppBGR101010, - kWICPixelFormat48bppRGB, - kWICPixelFormat64bppRGBA, - kWICPixelFormat64bppPRGBA, - kWICPixelFormat96bppRGBFixedPoint, - kWICPixelFormat128bppRGBAFloat, - kWICPixelFormat128bppPRGBAFloat, - kWICPixelFormat128bppRGBFloat, - kWICPixelFormat32bppCMYK, - kWICPixelFormat64bppRGBAFixedPoint, - kWICPixelFormat64bppRGBFixedPoint, - kWICPixelFormat128bppRGBAFixedPoint, - kWICPixelFormat128bppRGBFixedPoint, - kWICPixelFormat64bppRGBAHalf, - kWICPixelFormat64bppRGBHalf, - kWICPixelFormat48bppRGBHalf, - kWICPixelFormat32bppRGBE, - kWICPixelFormat16bppGrayHalf, - kWICPixelFormat32bppGrayFixedPoint, - kWICPixelFormat64bppCMYK, - kWICPixelFormat24bpp3Channels, - kWICPixelFormat32bpp4Channels, - kWICPixelFormat40bpp5Channels, - kWICPixelFormat48bpp6Channels, - kWICPixelFormat56bpp7Channels, - kWICPixelFormat64bpp8Channels, - kWICPixelFormat48bpp3Channels, - kWICPixelFormat64bpp4Channels, - kWICPixelFormat80bpp5Channels, - kWICPixelFormat96bpp6Channels, - kWICPixelFormat112bpp7Channels, - kWICPixelFormat128bpp8Channels, - kWICPixelFormat40bppCMYKAlpha, - kWICPixelFormat80bppCMYKAlpha, - kWICPixelFormat32bpp3ChannelsAlpha, - kWICPixelFormat40bpp4ChannelsAlpha, - kWICPixelFormat48bpp5ChannelsAlpha, - kWICPixelFormat56bpp6ChannelsAlpha, - kWICPixelFormat64bpp7ChannelsAlpha, - kWICPixelFormat72bpp8ChannelsAlpha, - kWICPixelFormat64bpp3ChannelsAlpha, - kWICPixelFormat80bpp4ChannelsAlpha, - kWICPixelFormat96bpp5ChannelsAlpha, - kWICPixelFormat112bpp6ChannelsAlpha, - kWICPixelFormat128bpp7ChannelsAlpha, - kWICPixelFormat144bpp8ChannelsAlpha, - kWICPixelFormatMax -}; - -/* -ICM/WCS BMFORMAT enumeration indexed from 0 for use as a look-up into -a BMFORMAT data structure array -*/ -enum EICMPixelFormat -{ - kBM_x555RGB = 0, kICMPixelFormatMin = 0, - kBM_x555XYZ, - kBM_x555Yxy, - kBM_x555Lab, - kBM_x555G3CH, - kBM_RGBTRIPLETS, - kBM_BGRTRIPLETS, - kBM_XYZTRIPLETS, - kBM_YxyTRIPLETS, - kBM_LabTRIPLETS, - kBM_G3CHTRIPLETS, - kBM_5CHANNEL, - kBM_6CHANNEL, - kBM_7CHANNEL, - kBM_8CHANNEL, - kBM_GRAY, - kBM_xRGBQUADS, - kBM_xBGRQUADS, - kBM_xG3CHQUADS, - kBM_KYMCQUADS, - kBM_CMYKQUADS, - kBM_10b_RGB, - kBM_10b_XYZ, - kBM_10b_Yxy, - kBM_10b_Lab, - kBM_10b_G3CH, - kBM_NAMED_INDEX, - kBM_16b_RGB, - kBM_16b_XYZ, - kBM_16b_Yxy, - kBM_16b_Lab, - kBM_16b_G3CH, - kBM_16b_GRAY, - kBM_565RGB, - kBM_32b_scRGB, - kBM_32b_scARGB, - kBM_S2DOT13FIXED_scRGB, - kBM_S2DOT13FIXED_scARGB, - kICMPixelFormatMax -}; - -/* -This structure is used to store information for converting and processing a particular -WIC format. The structure forms the basis of a look-up table between a source WIC pixel -format and the following items: - The format to convert to before processing - - This converts to a form consumable by ICM/WCS. - The corresponding BMFORMAT enumeration - - This lets us lookup the data type to pass to TranslateBitmapBits. - Whether we need an intermediate buffer to process alpha data - The alpha channel in WIC pixel formats do not match ICM/WCS compatible - formats. Under these circumstances we need to copy the bitmap data, translate - and apply back to the WIC bitmap. - The count of channels and the channel width - This allows us to lookup the offset required when copying intermediate data to - the WIC bitmap. - The offset to the alpha channel (we actually store the COLORDATATYPE and lookup the size) - When copying alpha data we need to know where to retrieve the alpha channel from and - where to copy it to in a given scanline. - -With this data, handling intermediate buffer data follows the following algorithm: - - If no intermediate buffer is required - The locked WIC pixel data can be converted in situ - Otherwise - Color data handling - From the begining of the WIC buffer and the intermediate buffer - Copy the intermediate buffer pixel width into the locked WIC scanline - Move the WIC pixel pointer on by the WIC pixel width - Move the intermediate buffer pointer on by the BMFORMAT pixel width - Repeat till no scanline data left to process - Alpha data handling - From the begining of the source and destination WIC buffers - Offset the source to the alpha channel - Offset the destination to the alpha channel - Convert the source to format to the destination - Copy the alpha data to the destination - Move the source WIC pixel pointer on by the WIC pixel width - Move the destination WIC pixel pointer on by the WIC pixel width - Repeat till no alpha data left to process - -*/ -struct WICToBMFORMAT -{ - EWICPixelFormat m_pixFormTarget; - EICMPixelFormat m_bmFormTarget; - BOOL m_bNeedsScanBuffer; - UINT m_cChannels; - UINT m_cAlphaOffset; - COLORDATATYPE m_colDataType; -}; - -/* -Structure providing information about BMFORMAT data for use as a lookup against -the local BMFORMAT enumeration -*/ -struct BMFormatData -{ - BMFORMAT m_bmFormat; - UINT m_cChannels; - COLORDATATYPE m_colDataType; -}; - -extern CONST WICPixelFormatGUID g_lutPixFrmtGuid[kWICPixelFormatMax]; -extern CONST WICToBMFORMAT g_lutWICToBMFormat[kWICPixelFormatMax]; -extern CONST size_t g_lutColorDataSize[]; -extern CONST BMFormatData g_lutBMFormatData[kICMPixelFormatMax]; - -struct S2DOT13FIXED -{ - WORD val; -}; -typedef S2DOT13FIXED* PS2DOT13FIXED; - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts BYTE to BYTE - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ BYTE& dst, - _In_ BYTE src - ) -{ - dst = src; -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts WORD to BYTE - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ BYTE& dst, - _In_ WORD src - ) -{ - dst = static_cast((static_cast(src) + 0x7F) >> 8); -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts FLOAT to BYTE - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ BYTE& dst, - _In_ FLOAT src - ) -{ - if (src < 0.0f) - { - dst = 0x00; - } - else if (src > 1.0f) - { - dst = 0xFF; - } - else - { - dst = static_cast(src * kMaxByteAsFloat); - } -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts S2DOT13FIXED to BYTE - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ BYTE& dst, - _In_ S2DOT13FIXED src - ) -{ - if (src.val & kS2Dot13Neg) - { - dst = 0x00; - } - else if (src.val > kS2Dot13One) - { - dst = 0xFF; - } - else - { - dst = static_cast(MulDiv(src.val, 0xFF, kS2Dot13One)); - } -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts BYTE to WORD - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ WORD& dst, - _In_ BYTE src - ) -{ - dst = (src << 8) | src; -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts WORD to WORD - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ WORD& dst, - _In_ WORD src - ) -{ - dst = src; -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts FLOAT to WORD - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ WORD& dst, - _In_ FLOAT src - ) -{ - if (src < 0.0f) - { - dst = 0x0000; - } - else if (src > 1.0f) - { - dst = 0xFFFF; - } - else - { - dst = static_cast(src * kMaxWordAsFloat); - } -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts S2DOT13FIXED to WORD - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ WORD& dst, - _In_ S2DOT13FIXED src - ) -{ - if (src.val & kS2Dot13Neg) - { - dst = 0x0000; - } - else if (src.val > kS2Dot13One) - { - dst = 0xFFFF; - } - else - { - dst = static_cast(MulDiv(src.val, 0xFFFF, kS2Dot13One)); - } -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts BYTE to FLOAT - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ FLOAT& dst, - _In_ BYTE src - ) -{ - dst = src/kMaxByteAsFloat; -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts WORD to FLOAT - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ FLOAT& dst, - _In_ WORD src - ) -{ - dst = src/kMaxWordAsFloat; -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts FLOAT to FLOAT - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ FLOAT& dst, - _In_ FLOAT src - ) -{ - dst = src; -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts S2DOT13FIXED to FLOAT - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ FLOAT& dst, - _In_ S2DOT13FIXED src - ) -{ - if (src.val & kS2Dot13Neg) - { - dst = -static_cast(src.val^kS2Dot13Neg)/kS2Dot13One; - } - else - { - dst = static_cast(src.val)/kS2Dot13One; - } -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts BYTE to S2DOT13FIXED - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ S2DOT13FIXED& dst, - _In_ BYTE src - ) -{ - dst.val = static_cast(MulDiv(kS2Dot13One, src, 0xFF)); -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts WORD to S2DOT13FIXED - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ S2DOT13FIXED& dst, - _In_ WORD src - ) -{ - dst.val = static_cast(MulDiv(kS2Dot13One, src, 0xFFFF)); -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts FLOAT to S2DOT13FIXED - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ S2DOT13FIXED& dst, - _In_ FLOAT src - ) -{ - if (src < -4.0f) - { - dst.val = kS2Dot13Min; - } - else if (src > 4.0f) - { - dst.val = kS2Dot13Max; - } - else - { - dst.val = static_cast(src * kS2Dot13One); - } -} - -/*++ - -Routine Name: - - ConvertCopy - -Routine Description: - - Inline function that converts a src channel data type to a destination - of another type. This overload converts S2DOT13FIXED to S2DOT13FIXED - -Arguments: - - dst - Destination value to be set - src - Source value - -Return Value: - - None - ---*/ -inline VOID -ConvertCopy( - _Out_ S2DOT13FIXED& dst, - _In_ S2DOT13FIXED src - ) -{ - dst = src; -} - diff --git a/print/XPSDrvSmpl/src/filters/color/cmflt.cpp b/print/XPSDrvSmpl/src/filters/color/cmflt.cpp deleted file mode 100644 index 303cef2a..00000000 --- a/print/XPSDrvSmpl/src/filters/color/cmflt.cpp +++ /dev/null @@ -1,264 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmflt.cpp - -Abstract: - - Color management filter implementation. This class derives from the Xps filter - class and implements the necessary part handlers to support color management. - The color management filter is responsible for adding and removing resources to - and from the XPS document and putting the appropriate mark-up onto pages when applying - a color transform. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "pthndlr.h" -#include "cmflt.h" -#include "cmsax.h" -#include "colconv.h" -#include "cmpthndlr.h" -#include "cmintpthndlr.h" -#include "cmprofpthndlr.h" - -using XDPrintSchema::PageColorManagement::ColorManagementData; -using XDPrintSchema::PageColorManagement::Driver; - -using XDPrintSchema::PageSourceColorProfile::PageSourceColorProfileData; - -using XDPrintSchema::PageICMRenderingIntent::PageICMRenderingIntentData; - -/*++ - -Routine Name: - - CColorManageFilter::CColorManageFilter - -Routine Description: - - Default constructor for the color management filter which ensures GDI plus is correctly running - -Arguments: - - None - -Return Value: - - None - ---*/ -CColorManageFilter::CColorManageFilter() -{ -} - -/*++ - -Routine Name: - - CColorManageFilter::~CColorManageFilter - -Routine Description: - - Default destructor for the color management filter - -Arguments: - - None - -Return Value: - - None - ---*/ -CColorManageFilter::~CColorManageFilter() -{ -} - -/*++ - -Routine Name: - - CColorManageFilter::ProcessPart - -Routine Description: - - Method for processing each fixed page part in a container - -Arguments: - - pFP - Pointer to the fixed page to process - -Return Value: - - HRESULT - S_OK - On success - S_FALSE - When not enabled in the PT - E_* - On error - ---*/ -HRESULT -CColorManageFilter::ProcessPart( - _Inout_ IFixedPage* pFP - ) -{ - VERBOSE("Processing Fixed Page part with color management handler\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFP, E_POINTER))) - { - // - // Get the PT manager to return the correct ticket. Use a regular pointer - // to retrieve the ticket and assign to the smart pointer to increment - // ref count (we don't want our smart pointer to release the PT before - // the PT manager is finished with it) - // - IXMLDOMDocument2* pPT = NULL; - if (SUCCEEDED(hr = m_ptManager.SetTicket(pFP)) && - SUCCEEDED(hr = m_ptManager.GetTicket(kPTPageScope, &pPT))) - { - try - { - // - // Get data from PT handler and test if we are color matching - // - ColorManagementData cmData; - CColorManagePTHandler cmPTHandler(pPT); - - PageSourceColorProfileData cmProfData; - CColorManageProfilePTHandler profPTHandler(pPT); - - PageICMRenderingIntentData cmIntData; - CColorManageIntentsPTHandler ptIntentsHandler(pPT); - - CComVariant varName; - - if (SUCCEEDED(hr = m_pPrintPropertyBag->GetProperty(XPS_FP_PRINTER_NAME, &varName)) && - SUCCEEDED(hr = cmPTHandler.GetData(&cmData)) && - SUCCEEDED(hr = profPTHandler.GetData(&cmProfData))) - { - hr = ptIntentsHandler.GetData(&cmIntData); - } - - if (SUCCEEDED(hr) && - cmData.cmOption == Driver && - cmProfData.cmProfileName.Length() > 0) - { - // - // Retrieve the writer from the fixed page - // - CComPtr pWriter(NULL); - - // - // Create a map of the resources that need to be cleaned up after the page - // has been processed. These are bitmaps that have been replaced with color - // matched equivalents and any icc profiles that have been consumed while - // color matching. - // - ResDeleteMap resDel; - - if (SUCCEEDED(hr = pFP->GetWriteStream(&pWriter))) - { - // - // Set-up the SAX reader and begin parsing the mark-up - // - CComPtr pSaxRdr(NULL); - CComPtr pReader(NULL); - - // - // Create a profile manager which handles working with the selected profile - // - CProfileManager profManager(varName.bstrVal, cmProfData, cmIntData, pFP); - - // - // Create two color converter objects which coordinate color transforms for - // bitmaps and color mark-up strings - // - CBitmapColorConverter cmBmpConverter(m_pXDWriter, pFP, &m_resCache, &profManager, &resDel); - CColorRefConverter cmRefConverter(m_pXDWriter, pFP, &m_resCache, &profManager, &resDel); - CResourceDictionaryConverter cmDictConverter(m_pXDWriter, - pFP, - &m_resCache, - &profManager, - &resDel, - &cmBmpConverter, - &cmRefConverter); - - // - // Create a SAX handler to parse the markup in the fixed page - // - CCMSaxHandler cmSaxHndlr(pWriter, &cmBmpConverter, &cmRefConverter, &cmDictConverter); - - if (SUCCEEDED(hr = pSaxRdr.CoCreateInstance(CLSID_SAXXMLReader60)) && - SUCCEEDED(hr = pSaxRdr->putContentHandler(&cmSaxHndlr)) && - SUCCEEDED(hr = pFP->GetStream(&pReader))) - { - CComPtr pReadStreamToSeq(NULL); - - pReadStreamToSeq.Attach(new(std::nothrow) pfp::PrintReadStreamToSeqStream(pReader)); - - if (SUCCEEDED(hr = CHECK_POINTER(pReadStreamToSeq, E_OUTOFMEMORY))) - { - hr = pSaxRdr->parse(CComVariant(static_cast(pReadStreamToSeq))); - } - } - - pWriter->Close(); - } - - if (SUCCEEDED(hr)) - { - // - // We have parsed the entire page - it should be safe to delete - // all unrequired resources - // - ResDeleteMap::const_iterator iterRes = resDel.begin(); - - for (;iterRes != resDel.end(); iterRes++) - { - hr = pFP->DeleteResource(iterRes->first); - } - } - } - else if (hr == E_ELEMENT_NOT_FOUND) - { - hr = S_FALSE; - } - } - catch (CXDException& e) - { - hr = e; - } - catch (...) - { - hr = E_FAIL; - } - } - } - - if (SUCCEEDED(hr)) - { - // - // We can send the fixed page - // - hr = m_pXDWriter->SendFixedPage(pFP); - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/color/cmflt.h b/print/XPSDrvSmpl/src/filters/color/cmflt.h deleted file mode 100644 index 02c44853..00000000 --- a/print/XPSDrvSmpl/src/filters/color/cmflt.h +++ /dev/null @@ -1,51 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmflt.h - -Abstract: - - Implementation of the color management filter which handles page parts from the - XPS document container. - ---*/ - -#pragma once - -#include "xdrchflt.h" -#include "ptmanage.h" - -typedef map ResDeleteMap; - -class CColorManageFilter : public CXDXpsFilter -{ -public: - CColorManageFilter(); - - virtual ~CColorManageFilter(); - -private: - virtual HRESULT - ProcessPart( - _Inout_ IFixedPage* pFP - ); - -private: - - // - // Create a resource cache object to manage the storage of bitmaps and - // color profiles in the container - // - CFileResourceCache m_resCache; -}; - diff --git a/print/XPSDrvSmpl/src/filters/color/cmflt.rc b/print/XPSDrvSmpl/src/filters/color/cmflt.rc deleted file mode 100644 index 19ae3e89..00000000 --- a/print/XPSDrvSmpl/src/filters/color/cmflt.rc +++ /dev/null @@ -1,43 +0,0 @@ -// -// Copyright (c) 2005 Microsoft Corporation -// -// All rights reserved. -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// File Name: -// -// cmflt.rc -// -// Abstract: -// -// Color filter resource file. -// -// - -#include -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT2_UNKNOWN -#define VER_FILEDESCRIPTION_STR "XPSDrv Sample Color Filter" -#define VER_INTERNALNAME_STR "PrintFeatureFilters" - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#endif // English (U.S.) resources - -///////////////////////////////////////////////////////////////////////////// - -#include "common.ver" - diff --git a/print/XPSDrvSmpl/src/filters/color/cmimg.cpp b/print/XPSDrvSmpl/src/filters/color/cmimg.cpp deleted file mode 100644 index 6c312629..00000000 --- a/print/XPSDrvSmpl/src/filters/color/cmimg.cpp +++ /dev/null @@ -1,856 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmimg.cpp - -Abstract: - - Color managed image implementation. The CColorManagedImage class is responsible - for managing the image resource for a stored bitmap. This implements - the IResWriter interface so that the font can be added to the resource - cache. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "cmimg.h" -#include "streamcnv.h" - -using XDPrintSchema::PageSourceColorProfile::EProfileOption; -using XDPrintSchema::PageSourceColorProfile::RGB; -using XDPrintSchema::PageSourceColorProfile::CMYK; - -/*++ - -Routine Name: - - CColorManagedImage::CColorManagedImage - -Routine Description: - - Constructor for the CColorManagedImage class which registers internally the - supplied resource URI and a pointer to the profile manager which will supply - suitable color transforms to apply to that resource - -Arguments: - - bstrResURI - String containing the URI to the resource to be handled - pProfManager - Pointer to a profile manager which will supply suitable - transforms to apply to the supplied resource - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CColorManagedImage::CColorManagedImage( - _In_ BSTR bstrResURI, - _In_ CProfileManager* pProfManager, - _In_ IFixedPage* pFixedPage, - _In_ ResDeleteMap* pResDel - ) : - m_pProfManager(pProfManager), - m_pFixedPage(pFixedPage), - m_bstrSrcProfileURI(NULL), - m_pResDel(pResDel) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pProfManager, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pFixedPage, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pResDel, E_POINTER))) - { - if (SysStringLen(bstrResURI) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - CComBSTR bstrAttribute(bstrResURI); - - if (bstrAttribute.Length() == 0) - { - hr = E_INVALIDARG; - } - else - { - try - { - // - // Process the mark-up looking for the bitmap URI and any associated profiles - // - CStringXDW cstrAttribute(bstrResURI); - CStringXDW cstrColConvBMP(L"{ColorConvertedBitmap "); - - cstrAttribute.Trim(); - INT cchFind = cstrAttribute.Find(cstrColConvBMP); - - if (cchFind == -1) - { - // - // The mark-up is the bitmap URI - // - cstrAttribute.Trim(); - m_bstrBitmapURI.Empty(); - m_bstrBitmapURI.Attach(cstrAttribute.AllocSysString()); - } - else - { - // - // The mark-up is specifying a profile associated with the image. - // Extract the path and set this in the profile manager. The markup takes - // the form "{ColorConvertedBitmap image.ext profile.icc}". - // - - // - // Delete leading string "{ColorConvertedBitmap " and the trailing "}" - // - cstrAttribute.Delete(0, cstrColConvBMP.GetLength()); - cstrAttribute.Delete(cstrAttribute.GetLength() - 1, 1); - cstrAttribute.Trim(); - - // - // Find the seperating space - // - cchFind = cstrAttribute.Find(L" "); - - // - // Construct the bitmap URI - // - m_bstrBitmapURI.Empty(); - m_bstrBitmapURI.Attach(cstrAttribute.Left(cchFind).AllocSysString()); - - // - // Delete the bitmap URI and space leaving the profile URI - // - cstrAttribute.Delete(0, cchFind+1); - - m_bstrSrcProfileURI.Empty(); - m_bstrSrcProfileURI.Attach(cstrAttribute.AllocSysString()); - } - } - catch (CXDException& e) - { - hr = e; - } - } - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CColorManagedImage::~CColorManagedImage - -Routine Description: - - Default destructor for the CColorManagedImage class - -Arguments: - - None - -Return Value: - - None - ---*/ -CColorManagedImage::~CColorManagedImage() -{ -} - -/*++ - -Routine Name: - - CColorManagedImage::WriteData - -Routine Description: - - This method handles the decoding of a bitmap, the colour - translation applied to the bitmap and the re-encoding of the bitmap - -Arguments: - - pStream - Pointer to a stream to write the resource out to - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorManagedImage::WriteData( - _In_ IPartBase* pResource, - _In_ IPrintWriteStream* pStream - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pResource, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pStream, E_POINTER))) - { - try - { - CComPtr pRead(NULL); - CComPtr pImagePart(NULL); - CComPtr pImageStream(NULL); - - // - // Load the bitmap into memory and create a stream to read the bitmap from - // - if (SUCCEEDED(hr = m_pFixedPage->GetPagePart(m_bstrBitmapURI, &pRead)) && - SUCCEEDED(hr = pRead.QueryInterface(&pImagePart)) && - SUCCEEDED(hr = pImagePart->GetStream(&pImageStream))) - { - BOOL bApplyTransform = FALSE; - CComPtr pInputImageStream(NULL); - - EWICPixelFormat eDstPixFormat = kWICPixelFormatDontCare; - UINT cDstWidth = 0; - UINT cDstHeight = 0; - DOUBLE dpiDstX = 0.0; - DOUBLE dpiDstY = 0.0; - - EProfileOption eProfileOption = RGB; - - // - // Set up the source and destination bitmaps so they are ready for use by TranslateBitmapBits - // - pInputImageStream.Attach(new(std::nothrow) CPrintReadStreamToIStream(pImageStream)); - if (SUCCEEDED(hr = CHECK_POINTER(pInputImageStream, E_OUTOFMEMORY)) && - SUCCEEDED(hr = m_srcBmp.Initialize(pInputImageStream)) && - SUCCEEDED(hr = m_srcBmp.GetSize(&cDstWidth, &cDstHeight)) && - SUCCEEDED(hr = m_srcBmp.GetResolution(&dpiDstX, &dpiDstY)) && - SUCCEEDED(hr = m_pProfManager->GetProfileOption(&eProfileOption))) - { - // - // The destination bitmap format can be one of: - // - // kWICPixelFormat128bppRGBFloat - scRGB output - // kWICPixelFormat128bppRGBAFloat - scRGB output with a source alpha channel - // kWICPixelFormat64bppCMYK - CMYK output - // kWICPixelFormat80bppCMYKAlpha - CMYK output with a source alpha channel - // - BOOL bScRGBOut = FALSE; - switch (eProfileOption) - { - case RGB: - { - eDstPixFormat = m_srcBmp.HasAlphaChannel() ? kWICPixelFormat128bppRGBAFloat : kWICPixelFormat128bppRGBFloat; - bScRGBOut = TRUE; - } - break; - - case CMYK: - { - eDstPixFormat = m_srcBmp.HasAlphaChannel() ? kWICPixelFormat40bppCMYKAlpha : kWICPixelFormat32bppCMYK; - } - break; - - default: - { - RIP("Unrecognised destination profile option.\n"); - - hr = E_FAIL; - } - break; - } - - if (SUCCEEDED(hr)) - { - // - // If the input is scRGB and the output is scRGB just pass through the bitmap - // Note: This should be optimised we do not write out a new bitmap but use the original - // - if (eDstPixFormat == m_srcBmp.GetPixelFormat() && - bScRGBOut) - { - m_dstBmp = m_srcBmp; - } - else if (SUCCEEDED(hr = m_dstBmp.Initialize(eDstPixFormat, cDstWidth, cDstHeight, dpiDstX, dpiDstY))) - { - bApplyTransform = TRUE; - } - } - } - - // - // Process the source and destination bitmaps a scanline at a time if the output image - // is still not set - // - if (SUCCEEDED(hr) && - bApplyTransform) - { - // - // Create scanline iterator objects from the source and destination bitmaps - // - CScanIterator srcIter(m_srcBmp, NULL); - CScanIterator dstIter(m_dstBmp, NULL); - - // - // Initialize the iterators, set the source profile and transform the scanlines - // - if (SUCCEEDED(hr = srcIter.Initialize(TRUE)) && - SUCCEEDED(hr = dstIter.Initialize(FALSE)) && - SUCCEEDED(hr = SetSrcProfile(&srcIter)) && - SUCCEEDED(hr = TransformScanLines(&srcIter, &dstIter))) - { - // - // CMYK output requires an embedded profile - // - CComBSTR bstrProfile; - if (eProfileOption == CMYK && - SUCCEEDED(hr = m_pProfManager->GetDstProfileName(&bstrProfile))) - { - hr = dstIter.SetProfile(bstrProfile); - } - } - - if (SUCCEEDED(hr)) - { - m_dstBmp = dstIter; - } - - // - // If there's a problem loading a suitable source profile, just pass - // the bitmap through unmodified - // - if (hr == HRESULT_FROM_WIN32(ERROR_PROFILE_NOT_FOUND)) - { - bApplyTransform = FALSE; - m_dstBmp = m_srcBmp; - hr = S_OK; - } - } - - if (SUCCEEDED(hr)) - { - // - // Create a write stream to accept the converted bitmap, fill from the output bitmap - // and write to the output stream (after ensuring the stream is pointing to the start). - // - CComPtr pOutputImageStream(NULL); - - LARGE_INTEGER cbMoveFromStart = {0}; - - PBYTE pBuff = new(std::nothrow) BYTE[CB_COPY_BUFFER]; - - if (SUCCEEDED(hr = CHECK_POINTER(pBuff, E_OUTOFMEMORY)) && - SUCCEEDED(hr = CreateStreamOnHGlobal(NULL, TRUE, &pOutputImageStream)) && - SUCCEEDED(hr = m_dstBmp.Write(GUID_ContainerFormatWmp, pOutputImageStream)) && - SUCCEEDED(hr = pOutputImageStream->Seek(cbMoveFromStart, STREAM_SEEK_SET, NULL))) - { - ULONG cbRead = 0; - ULONG cbWritten = 0; - - while (SUCCEEDED(hr) && - SUCCEEDED(hr = pOutputImageStream->Read(pBuff, CB_COPY_BUFFER, &cbRead)) && - cbRead > 0) - { - hr = pStream->WriteBytes(pBuff, cbRead, &cbWritten); - ASSERTMSG(cbRead == cbWritten, "Failed to write all data.\n"); - } - } - - if (pBuff != NULL) - { - delete[] pBuff; - pBuff = NULL; - } - } - - // - // Set the content type of the image part - // - CComQIPtr pImage = pResource; - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(pImage, E_NOINTERFACE))) - { - hr = pImage->SetImageContent(CComBSTR(L"image/vnd.ms-photo")); - } - - // - // If all is well mark the replaced bitmap and profile for deletion - // - if (SUCCEEDED(hr)) - { - (*m_pResDel)[m_bstrBitmapURI.m_str] = TRUE; - - if (m_bstrSrcProfileURI.Length() > 0) - { - (*m_pResDel)[m_bstrSrcProfileURI.m_str] = TRUE; - } - } - } - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorManagedImage::GetKeyName - -Routine Description: - - Method to obtain a unique key for the resource being handled - -Arguments: - - pbstrKeyName - Pointer to a string to hold the generated key - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorManagedImage::GetKeyName( - _Outptr_ BSTR* pbstrKeyName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrKeyName, E_POINTER))) - { - if (m_bstrBitmapURI.Length() > 0) - { - *pbstrKeyName = NULL; - - // - // The full URI to the bitmap resource concatenated with any associated - // profile is a suitable key - // - try - { - CStringXDW cstrKey(m_bstrBitmapURI); - cstrKey += m_bstrSrcProfileURI; - - *pbstrKeyName = cstrKey.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - else - { - hr = E_PENDING; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorManagedImage::GetResURI - -Routine Description: - - Method to obtain the URI of the resource being handled - -Arguments: - - pbstrResURI - Pointer to a string to hold the resource URI - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorManagedImage::GetResURI( - _Outptr_ BSTR* pbstrResURI - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrResURI, E_POINTER))) - { - *pbstrResURI = NULL; - - if (m_bstrBitmapURI.Length() > 0) - { - try - { - // - // Create a URI from the original bitmap URI and the current tick count - // - CStringXDW cstrFileName(m_bstrBitmapURI); - CStringXDW cstrFileExt(PathFindExtension(cstrFileName)); - - INT indFileExt = cstrFileName.Find(cstrFileExt); - - if (indFileExt > -1) - { - cstrFileName.Delete(indFileExt, cstrFileExt.GetLength()); - } - - // - // Create a unique name for the bitmap for this print session - // - CStringXDW cstrURI; - cstrURI.Format(L"%s_%u.wdp", static_cast(cstrFileName), GetUniqueNumber()); - - SysFreeString(*pbstrResURI); - *pbstrResURI = cstrURI.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - else - { - hr = E_PENDING; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorManagedImage::SetSrcProfile - -Routine Description: - - Method to set the source color profile given a particular source bitmap - -Arguments: - - pSrcBmp - Pointer to the source bitmap - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorManagedImage::SetSrcProfile( - _In_ CBmpConverter* pSrcBmp - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pSrcBmp, E_POINTER))) - { - // - // Update the source profile based on the source bitmap. The source profile - // is set according to the following rules: - // - // If the profile is specified in the ImageSource mark-up - // Use the profile in the container - // Else If the profile is embeded - // Use the embedded profile - // Else - // If the profile is RGB <= 16 bpc - // Use sRGB profile as source - // Else if the profile is RGB > 16 bpc - // Use scRGB profile as source - // Else if the profile is CMYK - // Use SWOP profile as source - // - if (m_bstrSrcProfileURI.Length() > 0) - { - // - // The mark-up references a profile in the XPS document - get the profile manager - // to extract it and set as the source profile - // - hr = m_pProfManager->SetSrcProfileFromContainer(m_bstrSrcProfileURI); - } - else if (pSrcBmp->HasColorProfile()) - { - IWICColorContext* pSrcContext = NULL; - - UINT cbBuffer = 0; - PBYTE pBuffer = NULL; - UINT cbActual = 0; - - // - // We have a profile embedded in the bitmap - extract and set as the source profile - // - if (SUCCEEDED(hr = pSrcBmp->GetColorContext(&pSrcContext)) && - SUCCEEDED(hr = pSrcContext->GetProfileBytes(cbBuffer, pBuffer, &cbActual))) - { - if (cbActual > 0) - { - pBuffer = new(std::nothrow) BYTE[cbActual]; - cbBuffer = cbActual; - - // - // The annotation on IWICColorContext::GetProfileBytes requires that the buffer - // be initialized. - // - - if (SUCCEEDED(hr = CHECK_POINTER(pBuffer, E_OUTOFMEMORY))) - { - ::memset(pBuffer, 0, cbBuffer); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = pSrcContext->GetProfileBytes(cbBuffer, pBuffer, &cbActual))) - { - // - // Set the source profile in the profile manager. Note: in this instance the profile name is - // no used to load the profile, merely to cache the profile. The bitmap URI uniquely idenitifies - // the bitmap and hence the embedded profile and is appropriate as a cache name - // - hr = m_pProfManager->SetSrcProfileFromBuffer(m_bstrBitmapURI, pBuffer, cbBuffer); - } - - if (pBuffer != NULL) - { - delete[] pBuffer; - pBuffer = NULL; - } - } - else - { - RIP("Zero length profile.\n"); - hr = E_FAIL; - } - } - } - else - { - // - // Deduce the source profile from the source bitmap format - // - switch (pSrcBmp->GetPixelFormat()) - { - case kWICPixelFormatDontCare: - case kWICPixelFormat1bppIndexed: - case kWICPixelFormat2bppIndexed: - case kWICPixelFormat4bppIndexed: - case kWICPixelFormat8bppIndexed: - case kWICPixelFormatBlackWhite: - case kWICPixelFormat2bppGray: - case kWICPixelFormat4bppGray: - case kWICPixelFormat8bppGray: - case kWICPixelFormat16bppBGR555: - case kWICPixelFormat16bppBGR565: - case kWICPixelFormat16bppGray: - case kWICPixelFormat24bppBGR: - case kWICPixelFormat24bppRGB: - case kWICPixelFormat32bppBGR: - case kWICPixelFormat32bppBGRA: - case kWICPixelFormat32bppPBGRA: - case kWICPixelFormat32bppBGR101010: - case kWICPixelFormat48bppRGB: - case kWICPixelFormat64bppRGBA: - case kWICPixelFormat64bppPRGBA: - { - hr = m_pProfManager->SetSrcProfileFromColDir(L"sRGB Color Space Profile.icm"); - } - break; - - case kWICPixelFormat48bppRGBFixedPoint: - case kWICPixelFormat96bppRGBFixedPoint: - case kWICPixelFormat128bppRGBAFloat: - case kWICPixelFormat128bppPRGBAFloat: - case kWICPixelFormat128bppRGBFloat: - case kWICPixelFormat64bppRGBAFixedPoint: - case kWICPixelFormat64bppRGBFixedPoint: - case kWICPixelFormat128bppRGBAFixedPoint: - case kWICPixelFormat128bppRGBFixedPoint: - case kWICPixelFormat64bppRGBAHalf: - case kWICPixelFormat64bppRGBHalf: - case kWICPixelFormat48bppRGBHalf: - case kWICPixelFormat32bppRGBE: - case kWICPixelFormat16bppGrayHalf: - case kWICPixelFormat32bppGrayFloat: - case kWICPixelFormat32bppGrayFixedPoint: - case kWICPixelFormat16bppGrayFixedPoint: - { - hr = m_pProfManager->SetSrcProfileFromColDir(L"xdwscRGB.icc"); - } - break; - - case kWICPixelFormat32bppCMYK: - case kWICPixelFormat64bppCMYK: - case kWICPixelFormat40bppCMYKAlpha: - case kWICPixelFormat80bppCMYKAlpha: - { - hr = m_pProfManager->SetSrcProfileFromColDir(L"xdCMYKPrinter.icc"); - } - break; - - default: - { - RIP("No acceptable default profile.\n"); - - hr = HRESULT_FROM_WIN32(ERROR_PROFILE_NOT_FOUND); - } - break; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CColorManagedImage::TransformScanLines - -Routine Description: - - Given source and destination scanline iterators, this method applies the - requiresite color transform - -Arguments: - - pSrcScans - Pointer to the source scanline iterator - pDstScans - Pointer to the destination scanline iterator - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorManagedImage::TransformScanLines( - _In_ CScanIterator* pSrcScans, - _In_ CScanIterator* pDstScans - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pSrcScans, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDstScans, E_POINTER))) - { - try - { - // - // Apply the transform - // - HTRANSFORM hTransform = NULL; - BOOL bCanUseWCS = FALSE; - - if (SUCCEEDED(hr = m_pProfManager->GetColorTransform(&hTransform, &bCanUseWCS))) - { - PBYTE pDstData = NULL; - BMFORMAT bmSrcFormat; - UINT cSrcWidth = 0; - UINT cSrcHeight = 0; - UINT cbSrcStride = 0; - - PBYTE pSrcData = NULL; - BMFORMAT bmDstFormat; - UINT cDstWidth = 0; - UINT cDstHeight = 0; - UINT cbDstStride = 0; - - // - // While the source andd destination have scanlines remaining to process... - // - while (!pDstScans->Finished() && - !pSrcScans->Finished() && - SUCCEEDED(hr)) - { - // - // ...retrieve the scan buffers (these may have been processed to remove alpha data)... - // - if (SUCCEEDED(hr = pSrcScans->GetScanBuffer(&pSrcData, &bmSrcFormat, &cSrcWidth, &cSrcHeight, &cbSrcStride)) && - SUCCEEDED(hr = pDstScans->GetScanBuffer(&pDstData, &bmDstFormat, &cDstWidth, &cDstHeight, &cbDstStride))) - { - // - // ...translate the scanline data... - // - if (TranslateBitmapBits(hTransform, - pSrcData, - bmSrcFormat, - cSrcWidth, - cSrcHeight, - cbSrcStride, - pDstData, - bmDstFormat, - cbDstStride, - NULL, - 0)) - { - // - // ...and commit the data to the destination bitmap before incrementing to the next scanline. - // - hr = pDstScans->Commit(*pSrcScans); - (*pSrcScans)++; - (*pDstScans)++; - } - else - { - RIP("Translate bitmap bits failed.\n"); - hr = GetLastErrorAsHResult(); - } - } - } - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/color/cmimg.h b/print/XPSDrvSmpl/src/filters/color/cmimg.h deleted file mode 100644 index 397c3678..00000000 --- a/print/XPSDrvSmpl/src/filters/color/cmimg.h +++ /dev/null @@ -1,87 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmimg.h - -Abstract: - - Color management image definition. The CColorManagedImage class is responsible - for managing the image resources used in a container. This implements - the IResWriter interface so that the font can be added to the resource - cache. - ---*/ - -#pragma once - -#include "rescache.h" -#include "profman.h" -#include "scaniter.h" -#include "cmflt.h" - -class CColorManagedImage : public IResWriter -{ -public: - CColorManagedImage( - _In_ BSTR bstrResURI, - _In_ CProfileManager* pProfManager, - _In_ IFixedPage* pFixedPage, - _In_ ResDeleteMap* pResDel - ); - - ~CColorManagedImage(); - - HRESULT - WriteData( - _In_ IPartBase* pResource, - _In_ IPrintWriteStream* pStream - ); - - HRESULT - GetKeyName( - _Outptr_ BSTR* pbstrKeyName - ); - - HRESULT - GetResURI( - _Outptr_ BSTR* pbstrResURI - ); - -private: - HRESULT - SetSrcProfile( - _In_ CBmpConverter* pScanIter - ); - - HRESULT - TransformScanLines( - _In_ CScanIterator* pSrcScans, - _In_ CScanIterator* pDstScans - ); - -private: - CComBSTR m_bstrBitmapURI; - - CComBSTR m_bstrSrcProfileURI; - - CProfileManager* m_pProfManager; - - CBmpConverter m_srcBmp; - - CBmpConverter m_dstBmp; - - CComPtr m_pFixedPage; - - ResDeleteMap* m_pResDel; -}; - diff --git a/print/XPSDrvSmpl/src/filters/color/cmsax.cpp b/print/XPSDrvSmpl/src/filters/color/cmsax.cpp deleted file mode 100644 index f5db86dd..00000000 --- a/print/XPSDrvSmpl/src/filters/color/cmsax.cpp +++ /dev/null @@ -1,440 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmsax.cpp - -Abstract: - - Color managed image SAX handler implementation. The CCMSaxHandler class is responsible - for handling the XML markup in the container. - - Note regarding opacity masks: Ideally we would like to avoid color matching whilst - within an opacity mask element as only the alpha channel is of interest. This is - complicated however by the fact that the opacity mask resources my be re-used as - rendering resources. Ideally we would color match opacity mask elements only when - the resources are shared with other rendering operations. This is difficult to - achieve with SAX however as we do not know a priori if the resource is shared or - the resource is going to be shared. - Currently we are performing unnecessary color matching when an opacity mask is - encountered. We could alternatively ensure opacity mask resources are preserved and - other render sources are modified and written as new resources. The trade off is - reduced speed performance against added resource handling complexity and XPS - content bloat. This implementation takes the first option which trades processing time - against the amount of data written to the container and resource handling complexity. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "cmsax.h" - -/*++ - -Routine Name: - - CCMSaxHandler::CCMSaxHandler - -Routine Description: - - Contructor for the color management filters SAX handler. - The constructor registers a writer for sending new markup out to and a color - converter object which handles any color conversion work for those markup - elements containing color data. - -Arguments: - - pWriter - Pointer to a write stream which receives markup - pConverter - Pointer to a color converter object which handles any - color conversion work for elements containing color data - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CCMSaxHandler::CCMSaxHandler( - _In_ IPrintWriteStream* pWriter, - _In_ CBitmapColorConverter* pBmpConverter, - _In_ CColorRefConverter* pRefConverter, - _In_opt_ CResourceDictionaryConverter* pDictConverter - ) : - m_pWriter(pWriter), - m_bOpenTag(FALSE), - m_pBmpConv(pBmpConverter), - m_pRefConv(pRefConverter), - m_pDictConv(pDictConverter) -{ - ASSERTMSG(m_pWriter != NULL, "NULL writer passed to color SAX handler.\n"); - ASSERTMSG(m_pBmpConv != NULL, "NULL bitmap color converter passed to color SAX handler.\n"); - ASSERTMSG(m_pRefConv != NULL, "NULL color ref converter passed to color SAX handler.\n"); - - HRESULT hr = S_OK; - if (FAILED(hr = CHECK_POINTER(m_pWriter, E_POINTER)) || - FAILED(hr = CHECK_POINTER(m_pBmpConv, E_POINTER)) || - FAILED(hr = CHECK_POINTER(m_pRefConv, E_POINTER))) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CCMSaxHandler::~CCMSaxHandler - -Routine Description: - - Default destructor for the color management filters SAX handler - -Arguments: - - None - -Return Value: - - None - ---*/ -CCMSaxHandler::~CCMSaxHandler() -{ - m_bstrOpenElement.Empty(); -} - -/*++ - -Routine Name: - - CCMSaxHandler::startElement - -Routine Description: - - SAX handler method which handles each start element for the XML markup. - -Arguments: - - pwchQName - Pointer to a string containing the element name - cchQName - Count of the number of characters in the element name - pAttributes - Pointer to the attribute list for the supplied element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CCMSaxHandler::startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pwchQName, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pAttributes, E_POINTER))) - { - if (cchQName < 1) - { - hr = E_INVALIDARG; - } - } - - CStringXDW cstrOut; - if (SUCCEEDED(hr)) - { - try - { - CComBSTR bstrElement(cchQName, pwchQName); - - // - // Check if we need to close an opened tag - // - if (m_bOpenTag) - { - cstrOut.Append(L">"); - } - - // - // Store the opened element name so we can handle nested elements - // - m_bstrOpenElement = bstrElement; - - // - // Create output element - // - cstrOut.Append(L"<"); - cstrOut.Append(bstrElement); - - // - // We opened a tag - // - m_bOpenTag = TRUE; - - // - // Find the number of attributes and enumerate over all of them - // - INT cAttributes = 0; - if (SUCCEEDED(hr = pAttributes->getLength(&cAttributes))) - { - for (INT cIndex = 0; cIndex < cAttributes; cIndex++) - { - PCWSTR pszAttUri = NULL; - INT cchAttUri = 0; - PCWSTR pszAttName = NULL; - INT cchAttName = 0; - PCWSTR pszAttQName = NULL; - INT cchAttQName = 0; - PCWSTR pszAttValue = NULL; - INT cchAttValue = 0; - - // - // Get the attribute data ready to write out - // - if (SUCCEEDED(hr = pAttributes->getName(cIndex, - &pszAttUri, - &cchAttUri, - &pszAttName, - &cchAttName, - &pszAttQName, - &cchAttQName))) - { - if (SUCCEEDED(pAttributes->getValue(cIndex, &pszAttValue, &cchAttValue))) - { - CComBSTR bstrAttName(cchAttQName, pszAttQName); - CComBSTR bstrAttValue(cchAttValue, pszAttValue); - - if (bstrElement == L"ResourceDictionary" && - bstrAttName == L"Source") - { - // - // Convert remote resource dictionary - // - if (SUCCEEDED(hr = CHECK_POINTER(m_pDictConv, E_FAIL))) - { - hr = m_pDictConv->Convert(&bstrAttValue); - } - } - else - { - // - // Find all color refs and image sources. - // - if (bstrAttName == L"Color" || - bstrAttName == L"Fill" || - bstrAttName == L"Stroke" ) - { - // - // Process the value passing the colorref - // - hr = m_pRefConv->Convert(&bstrAttValue); - } - else if (bstrAttName == L"ImageSource") - { - // - // Process the value passing the URI - // - hr = m_pBmpConv->Convert(&bstrAttValue); - } - } - - // - // Delimit attributes with a space - // - cstrOut.Append(L" "); - - // - // Reconstruct the attribute and write back to - // the fixed page - // - cstrOut.Append(bstrAttName); - cstrOut.Append(L"=\""); - - // - // If this is a UnicodeString we may need to escape entities - // - if (bstrAttName == L"UnicodeString") - { - hr = EscapeEntity(&bstrAttValue); - } - - cstrOut.Append(bstrAttValue); - cstrOut.Append(L"\""); - } - } - } - } - } - catch (CXDException& e) - { - hr = e; - } - } - - if (SUCCEEDED(hr)) - { - hr = WriteToPrintStream(&cstrOut, m_pWriter); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CCMSaxHandler::endElement - -Routine Description: - - SAX handler method which handles each end element for the XML markup - -Arguments: - - pwchQName - Pointer to a string containing the element name - cchQName - Count of the number of characters in the element name - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CCMSaxHandler::endElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pwchQName, E_POINTER))) - { - if (cchQName < 1) - { - hr = E_INVALIDARG; - } - } - - CStringXDW cstrClose; - if (SUCCEEDED(hr)) - { - try - { - CComBSTR bstrElement(cchQName, pwchQName); - - // - // If this is a root element with child nodes, the open - // element will not match the last startElement. In this case - // we need to add an appropriate closing tag - // - if (bstrElement == m_bstrOpenElement) - { - // - // Names match so just add a closing bracket - // - // We might have closed the tag when writing a new element - // - if (m_bOpenTag) - { - cstrClose.Append(L"/>"); - } - } - else - { - // - // Add a clossing tag - // - cstrClose.Append(L""); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - if (SUCCEEDED(hr)) - { - hr = WriteToPrintStream(&cstrClose, m_pWriter); - } - - m_bOpenTag = FALSE; - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CCMSaxHandler::startDocument - -Routine Description: - - SAX handler method which handles the start document call to ensure - the xml version is correctly set - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CCMSaxHandler::startDocument( - void - ) -{ - HRESULT hr = S_OK; - - try - { - if (SUCCEEDED(hr = CHECK_POINTER(m_pWriter, E_FAIL))) - { - CStringXDW cstrOut(L""); - hr = WriteToPrintStream(&cstrOut, m_pWriter); - } - } - catch (CXDException& e) - { - hr = e; - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/color/cmsax.h b/print/XPSDrvSmpl/src/filters/color/cmsax.h deleted file mode 100644 index dc09f9d0..00000000 --- a/print/XPSDrvSmpl/src/filters/color/cmsax.h +++ /dev/null @@ -1,80 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cmsax.h - -Abstract: - - Color management sax handler definition. The color management SAX handler - is responsible for parsing the FixedPage mark-up for and vector objects - or bitmaps which contain color data and altering the mark-up where appropriate. - ---*/ - -#pragma once - -#include "saxhndlr.h" -#include "colconv.h" - -class CCMSaxHandler : public CSaxHandler -{ -public: - CCMSaxHandler( - _In_ IPrintWriteStream* pWriter, - _In_ CBitmapColorConverter* pBmpConverter, - _In_ CColorRefConverter* pRefConverter, - _In_opt_ CResourceDictionaryConverter* pDictConverter - ); - - virtual ~CCMSaxHandler(); - - virtual HRESULT STDMETHODCALLTYPE - startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ); - - virtual HRESULT STDMETHODCALLTYPE - endElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName - ); - - HRESULT STDMETHODCALLTYPE - startDocument( - void - ); - -private: - CComPtr m_pWriter; - - CComBSTR m_bstrOpenElement; - - BOOL m_bOpenTag; - - CColorConverter* m_pBmpConv; - - CColorConverter* m_pRefConv; - - CColorConverter* m_pDictConv; -}; - diff --git a/print/XPSDrvSmpl/src/filters/color/colchan.cpp b/print/XPSDrvSmpl/src/filters/color/colchan.cpp deleted file mode 100644 index 2d98334f..00000000 --- a/print/XPSDrvSmpl/src/filters/color/colchan.cpp +++ /dev/null @@ -1,1883 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - colchan.cpp - -Abstract: - - Color channel class implementation. The color channel class is responsible for maintaining - simple single color multiple channel data intialised from color references in the XPS markup. - It provides methods for intialization, access and conversion of the data. - - Note regarding color formats: The CColorChannelData class is only used in the filter for - processing color references in mark-up. As such we only ever see 8 bit per channel sRGB and - floating point scRGB and n-channel colors and we only ever need convert to 16 bpc for - down-level scRGB conversion. If the CColorChannelData is ever used when fixed point input - or other output types are required then these formats need support added (see E_NOTIMPL - return values). - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "colchan.h" - -#define MAX_CHANNEL_COUNT 9 // 1 alpha channel and 8 color channels -#define MAX_CHANNEL_SIZE sizeof(FLOAT) - -DWORD g_cbChannelType[] = { - sizeof(BYTE), // COLOR_BYTE - sizeof(WORD), // COLOR_WORD - sizeof(FLOAT), // COLOR_FLOAT - sizeof(WORD) // COLOR_S2DOT13FIXED -}; - - -/*++ - -Routine Name: - - CColorChannelData::CColorChannelData - -Routine Description: - - CColorChannelData default constructor - -Arguments: - - None - -Return Value: - - None - Throws an exception on failure. - ---*/ -CColorChannelData::CColorChannelData() : - m_cChannels(0), - m_channelType(COLOR_BYTE), - m_pChannelData(NULL), - m_cbChannelData(0), - m_dataType(sRGB) -{ - if (FAILED(AllocateChannelBuffers(&m_cbChannelData, &m_pChannelData))) - { - throw CXDException(E_OUTOFMEMORY); - } -} - -/*++ - -Routine Name: - - CColorChannelData::~CColorChannelData - -Routine Description: - - CColorChannelData destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CColorChannelData::~CColorChannelData() -{ - FreeChannelBuffers(); -} - -/*++ - -Routine Name: - - CColorChannelData::AddChannelData - -Routine Description: - - Template method for adding channel data. This allows any of the available color - channel data types to be added to the channel data buffer - -Arguments: - - channelValue - Value for the channel to be added - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -template -HRESULT -CColorChannelData::AddChannelData( - _In_ CONST _T& channelValue - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = ValidateDataSize<_T>())) - { - if (m_cChannels < MAX_CHANNEL_COUNT) - { - _T* pChannelData = reinterpret_cast<_T*>(m_pChannelData); - pChannelData[m_cChannels] = channelValue; - m_cChannels++; - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::GetChannelCount - -Routine Description: - - Retrieves the current number of channels defining the color. - -Arguments: - - pcChannels - Pointer to a variable that recieves the count of channels - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::GetChannelCount( - _Out_ DWORD* pcChannels - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pcChannels, E_POINTER))) - { - *pcChannels = m_cChannels; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::GetChannelCountNoAlpha - -Routine Description: - - Retrieves the number of channels less the alpha channel if present - -Arguments: - - pcChannels - Pointer to a variable that recieves the count of non-alpha channels - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::GetChannelCountNoAlpha( - _Out_ DWORD* pcChannels - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = GetChannelCount(pcChannels))) - { - if (HasAlpha()) - { - (*pcChannels)--; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::GetChannelType - -Routine Description: - - Retrieves the COLORDATATYPE for the channel data - -Arguments: - - pChannelType - Pointer to a COLORDATATYPE variable that recieves the type - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::GetChannelType( - _Out_ COLORDATATYPE* pChannelType - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pChannelType, E_POINTER))) - { - *pChannelType = m_channelType; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::ResetChannelType - -Routine Description: - - Resets the underlying channel data type to the requested type - -Arguments: - - channelType - The channel data type to reset to - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::ResetChannelType( - _In_ CONST COLORDATATYPE& channelType - ) -{ - m_channelType = channelType; - m_cChannels = 0; - - return S_OK; -} - -/*++ - -Routine Name: - - CColorChannelData::GetChannelData - -Routine Description: - - Retrieves the buffer and count of bytes of the channel data - -Arguments: - - pcbDataSize - Pointer to variable that recieves the count of bytes in the buffer - ppData - Pointer to a BYTE pointer that recieves the buffer - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::GetChannelData( - _Out_ DWORD* pcbDataSize, - _Out_ - _When_(*pcbDataSize > 0, _At_(*ppData, _Post_ _Readable_bytes_(*pcbDataSize))) - _When_(*pcbDataSize == 0, _At_(*ppData, _Post_ _Maybenull_)) - PVOID* ppData - ) -{ - HRESULT hr = S_OK; - - DWORD cbDataTypeSize = 0; - if (SUCCEEDED(hr = CHECK_POINTER(pcbDataSize, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppData, E_POINTER)) && - SUCCEEDED(hr = GetChannelSizeFromType(m_channelType, &cbDataTypeSize))) - { - *ppData = NULL; - *pcbDataSize = 0; - - if (m_cbChannelData >= m_cChannels * cbDataTypeSize) - { - if (m_cChannels > 0) - { - *pcbDataSize = m_cChannels * cbDataTypeSize; - *ppData = m_pChannelData; - } - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::GetChannelDataNoAlpha - -Routine Description: - - Retrieves the buffer and count of bytes of the channel data excluding the - alpha channel if present - -Arguments: - - pcbDataSize - Pointer to variable that recieves the count of bytes in the buffer - ppData - Pointer to a BYTE pointer that recieves the buffer - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::GetChannelDataNoAlpha( - _Out_ DWORD* pcbDataSize, - _Out_ - _When_(*pcbDataSize > 0, _At_(*ppData, _Post_ _Readable_bytes_(*pcbDataSize))) - _When_(*pcbDataSize == 0, _At_(*ppData, _Post_ _Maybenull_)) - PVOID* ppData - ) -{ - HRESULT hr = S_OK; - - DWORD cbData = 0; - PBYTE pData = NULL; - - if (SUCCEEDED(hr = CHECK_POINTER(pcbDataSize, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppData, E_POINTER)) && - SUCCEEDED(hr = GetChannelData(&cbData, reinterpret_cast(&pData)))) - { - *pcbDataSize = cbData; - *ppData = pData; - - if (HasAlpha()) - { - DWORD cbChannelSize = 0; - if (SUCCEEDED(hr = GetChannelSizeFromType(m_channelType, &cbChannelSize))) - { - if (cbData >= cbChannelSize) - { - *pcbDataSize = cbData - cbChannelSize; - *ppData = pData + cbChannelSize; - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::ClampChannelValues - -Routine Description: - - Template method that recieves the minimum and maximum value for a channel - and applies this to all channels defining the color - -Arguments: - - min - Minimum channel value - max - Maximum channel value - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -template -HRESULT -CColorChannelData::ClampChannelValues( - _In_ CONST _T& min, - _In_ CONST _T& max - ) -{ - HRESULT hr = S_OK; - - // - // Validate the data size against the current type - // - if (SUCCEEDED(hr = ValidateDataSize<_T>())) - { - _T* pData = reinterpret_cast<_T*>(m_pChannelData); - for (DWORD cChannel = 0; cChannel < m_cChannels; cChannel++, pData++) - { - if (*pData < min) - { - *pData = min; - } - else if (*pData > max) - { - *pData = max; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::InitializeChannelData - -Routine Description: - - Initializes the channel data according to the type, count of channels and a default value - -Arguments: - - channelType - The required channel data format - dataType - The required data type - cChannels - The count of channels defining the color - channelValue - The intial value for all channels - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -template -HRESULT -CColorChannelData::InitializeChannelData( - _In_ CONST COLORDATATYPE& channelType, - _In_ CONST EColorDataType& dataType, - _In_ CONST DWORD& cChannels, - _In_ CONST _T& channelValue - ) -{ - HRESULT hr = S_OK; - - // - // Validate the data size against the current type - // - if (SUCCEEDED(hr = ResetChannelType(channelType)) && - SUCCEEDED(hr = ValidateDataSize<_T>())) - { - if (cChannels <= MAX_CHANNEL_COUNT) - { - m_dataType = dataType; - m_cChannels = cChannels; - _T* pChannelData = reinterpret_cast<_T*>(m_pChannelData); - - for (DWORD cChannel = 0; cChannel < m_cChannels; cChannel++, pChannelData++) - { - *pChannelData = channelValue; - } - } - else - { - hr = E_INVALIDARG; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::SetColorDataType - -Routine Description: - - Sets the color data type - -Arguments: - - dataType - The color data type - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::SetColorDataType( - _In_ CONST EColorDataType& dataType - ) -{ - m_dataType = dataType; - - return S_OK; -} - -/*++ - -Routine Name: - - CColorChannelData::GetColorDataType - -Routine Description: - - Retrieves the current color data type - -Arguments: - - pDataType - Pointer to a variable to recieve the color data type - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::GetColorDataType( - _Out_ EColorDataType* pDataType - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDataType, E_POINTER))) - { - *pDataType = m_dataType; - } - - return S_OK; -} - -/*++ - -Routine Name: - - CColorChannelData::HasAlpha - -Routine Description: - - Indicates if the color channel data includes an alpha channel - -Arguments: - - None - -Return Value: - - TRUE - An alpha channel is present - FALSE - There is no alpha channel - ---*/ -BOOL -CColorChannelData::HasAlpha( - VOID - ) -{ - // - // If the source or destination is n-channel, or if either sRGB or scRGB have 4 channels, - // we have an alpha channel - // - return m_dataType == nChannel || m_cChannels == 4; -} - -/*++ - -Routine Name: - - CColorChannelData::GetAlphaChannelSize - -Routine Description: - - Retrieves the count of bytes of the alpha channel - -Arguments: - - pcbAlphaChannel - pointer to a variable that recieves the count of bytes of the alpha channel - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::GetAlphaChannelSize( - _Out_ DWORD* pcbAlphaChan - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pcbAlphaChan, E_POINTER))) - { - *pcbAlphaChan = 0; - if (HasAlpha()) - { - hr = GetChannelSizeFromType(m_channelType, pcbAlphaChan); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::InitializeAlphaChannel - -Routine Description: - - Initialize the alpha channel based off a source color channel data object - -Arguments: - - pSrcChannelData - Pointer to a source color data channel object - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::InitializeAlphaChannel( - _In_ CColorChannelData* pSrcChannelData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pSrcChannelData, E_POINTER))) - { - if (HasAlpha()) - { - FLOAT alpha = 1.0f; - if (SUCCEEDED(hr) && - pSrcChannelData->HasAlpha() && - SUCCEEDED(hr = pSrcChannelData->GetAlphaAsFloat(&alpha))) - { - // - // Ensure alpha lies between 0.0 and 1.0 - // - if (alpha < 0.0) - { - alpha = 0.0; - } - else if (alpha > 1.0) - { - alpha = 1.0; - } - } - - switch (m_channelType) - { - case COLOR_BYTE: - { - *m_pChannelData = static_cast(alpha * kMaxByteAsFloat); - } - break; - - case COLOR_WORD: - { - *reinterpret_cast(m_pChannelData) = static_cast(alpha * kMaxWordAsFloat); - } - break; - - case COLOR_FLOAT: - { - *reinterpret_cast(m_pChannelData) = alpha; - } - break; - - case COLOR_S2DOT13FIXED: - { - hr = E_NOTIMPL; - } - break; - - default: - { - RIP("Unrecognised channel data format.\n"); - hr = E_FAIL; - } - break; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::GetColor - -Routine Description: - - Retrieves a COLOR object based of the channel data - -Arguments: - - pColor - Pointer to a color structure to be filled in - pType - Pointer to storage to accept the color type - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::GetColor( - _Out_ PCOLOR pColor, - _Out_ COLORTYPE* pType - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pColor, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pType, E_POINTER))) - { - if (m_cChannels == 0) - { - hr = E_PENDING; - } - } - - DWORD cChannels = 0; - if (SUCCEEDED(hr) && - SUCCEEDED(hr = GetChannelCountNoAlpha(&cChannels))) - { - if (cChannels <= 4) - { - hr = ColorToWord(reinterpret_cast(pColor), static_cast(sizeof(COLOR))); - } - else if (cChannels <= 8) - { - hr = ColorToByte(reinterpret_cast(pColor), static_cast(sizeof(COLOR))); - } - else - { - hr = E_FAIL; - } - - if (SUCCEEDED(hr)) - { - if (m_dataType == sRGB || - m_dataType == scRGB) - { - *pType = COLOR_RGB; - } - else if (m_dataType == nChannel) - { - *pType = static_cast(cChannels + 3); - } - else - { - RIP("Unrecognised data type.\n"); - - hr = E_FAIL; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::SetColor - -Routine Description: - - Sets the channel data based on a COLOR structure - -Arguments: - - pColor - Pointer to a color structure to set the channel data from - type - The color type described by the color structure - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::SetColor( - _In_ COLOR* pColor, - _In_ CONST COLORTYPE& type - ) -{ - HRESULT hr = S_OK; - - DWORD cChannels = 0; - DWORD cbData = 0; - PBYTE pData = NULL; - - if (SUCCEEDED(hr = CHECK_POINTER(pColor, E_POINTER)) && - SUCCEEDED(hr = GetChannelCountNoAlpha(&cChannels)) && - SUCCEEDED(hr = GetChannelDataNoAlpha(&cbData, reinterpret_cast(&pData)))) - { - DWORD cSrcChannels = 0; - - switch (type) - { - case COLOR_RGB: - { - if (m_dataType == sRGB || - m_dataType == scRGB) - { - cSrcChannels = 3; - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); - } - } - break; - - case COLOR_3_CHANNEL: - case COLOR_CMYK: - case COLOR_5_CHANNEL: - case COLOR_6_CHANNEL: - case COLOR_7_CHANNEL: - case COLOR_8_CHANNEL: - { - if (m_dataType == nChannel) - { - cSrcChannels = static_cast(type - 3); - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); - } - } - break; - - case COLOR_GRAY: - case COLOR_XYZ: - case COLOR_Yxy: - case COLOR_Lab: - case COLOR_NAMED: - { - hr = E_NOTIMPL; - } - break; - - default: - { - RIP("Unrecognised color type\n"); - hr = E_FAIL; - } - break; - } - - if (SUCCEEDED(hr)) - { - if (cChannels == cSrcChannels) - { - if (cSrcChannels <= 4) - { - hr = ColorFromWord(reinterpret_cast(pColor), sizeof(COLOR)); - } - else if (cSrcChannels <= 8) - { - hr = ColorFromByte(reinterpret_cast(pColor), sizeof(COLOR)); - } - else - { - RIP("Invalid channel count\n"); - hr = E_FAIL; - } - } - else - { - RIP("Miss-match between source channel count and current channel count\n"); - hr = E_FAIL; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::ColorToByte - -Routine Description: - - Converts the channel data to a 8 bpc COLOR type - -Arguments: - - pDstData - Pointer to the data to be set - cbDstData - Size of the destination buffer - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::ColorToByte( - _Out_writes_bytes_(cbDstData) PBYTE pDstData, - _In_ CONST UINT cbDstData - ) -{ - HRESULT hr = S_OK; - - DWORD cChannels = 0; - DWORD cbData = 0; - PBYTE pData = NULL; - - if (SUCCEEDED(hr = CHECK_POINTER(pDstData, E_POINTER)) && - SUCCEEDED(hr = GetChannelCountNoAlpha(&cChannels)) && - SUCCEEDED(hr = GetChannelDataNoAlpha(&cbData, reinterpret_cast(&pData)))) - { - ZeroMemory(pDstData, cbDstData); - - if (cbDstData < cChannels) - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - - if (SUCCEEDED(hr) && - cbData == 0 && - cChannels != 0) - { - hr = E_UNEXPECTED; - } - - if (SUCCEEDED(hr)) - { - if (cbDstData > 0) - { - switch (m_channelType) - { - case COLOR_BYTE: - { - if (cbDstData >= cbData) - { - // - // Just copy all channels after alpha into the buffer - // - CopyMemory(pDstData, pData, cbData); - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - break; - - case COLOR_WORD: - { - if (cbDstData >= cChannels * sizeof(BYTE) && - cbData >= cChannels * sizeof(WORD)) - { - PWORD pSrcData = reinterpret_cast(pData); - - for (UINT cCurrChan = 0; - cCurrChan < cChannels; - cCurrChan++) - { - _Analysis_assume_(cCurrChan < cbDstData); - - pDstData[cCurrChan] = static_cast(MulDiv(pSrcData[cCurrChan], 0xFF, 0xFFFF)); - } - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - break; - - case COLOR_FLOAT: - { - // - // Make sure the float data runs between 0.0 and 1.0 for nChannel and sRGB and is - // truncated and scaled as follows for scRGB: - // - // 1. Truncate the input color to between -2.0 and +2.0 - // 2. Offset the value by +2.0 to put it into the 0.0 to 4.0 range - // 3. Scale the value down by 4.0 to put it into the range 0.0 to 1.0 - // 4. Set the 16 bit value according to the channel value from 0x00 - // for 0.0 to 0xFF for 1.0 - // - if (cbDstData >= cChannels * sizeof(BYTE) && - cbData >= cChannels * sizeof(FLOAT)) - { - PFLOAT pSrcData = reinterpret_cast(pData); - - if (m_dataType == scRGB) - { - for (UINT cCurrChan = 0; - cCurrChan < cChannels; - cCurrChan++) - { - _Analysis_assume_(cCurrChan < cbDstData); - - FLOAT channelValue = pSrcData[cCurrChan]; - channelValue = channelValue < -2.0f ? -2.0f : channelValue; - channelValue = channelValue > 2.0f ? 2.0f : channelValue; - channelValue += 2.0f; - channelValue /= 4.0f; - pDstData[cCurrChan] = static_cast(channelValue * kMaxByteAsFloat); - } - } - else - { - if (SUCCEEDED(hr = ClampChannelValues(0.0f, 1.0f))) - { - for (UINT cCurrChan = 0; - cCurrChan < cChannels; - cCurrChan++) - { - _Analysis_assume_(cCurrChan < cbDstData); - - pDstData[cCurrChan] = static_cast(pSrcData[cCurrChan] * kMaxByteAsFloat); - } - } - } - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - break; - - case COLOR_S2DOT13FIXED: - { - hr = E_NOTIMPL; - } - break; - - default: - { - RIP("Unrecognised color type\n"); - hr = E_FAIL; - } - break; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::ColorToWord - -Routine Description: - - Converts the channel data to a 16 bpc COLOR type - -Arguments: - - pDstData - Pointer to the data to be set - cbDstData - Size of the destination buffer - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::ColorToWord( - _Out_writes_bytes_(cbDstData) PWORD pDstData, - _In_ CONST UINT cbDstData - ) -{ - HRESULT hr = S_OK; - - DWORD cChannels = 0; - DWORD cbData = 0; - PBYTE pData = NULL; - - if (SUCCEEDED(hr = CHECK_POINTER(pDstData, E_POINTER)) && - SUCCEEDED(hr = GetChannelCountNoAlpha(&cChannels)) && - SUCCEEDED(hr = GetChannelDataNoAlpha(&cbData, reinterpret_cast(&pData)))) - { - ZeroMemory(pDstData, cbDstData); - - if (cbDstData / sizeof(WORD) < cChannels) - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - - if (SUCCEEDED(hr) && - cbData == 0 && - cChannels != 0) - { - hr = E_UNEXPECTED; - } - - if (SUCCEEDED(hr)) - { - if (cbDstData > 0) - { - switch (m_channelType) - { - case COLOR_BYTE: - { - if (cbDstData >= cChannels * sizeof(WORD) && - cbData >= cChannels * sizeof(BYTE)) - { - for (UINT cCurrChan = 0; - cCurrChan < cChannels; - cCurrChan++) - { - _Analysis_assume_((cCurrChan + 1) * sizeof(WORD) <= cbDstData); - - pDstData[cCurrChan] = static_cast(MulDiv(pData[cCurrChan], 0xFFFF, 0xFF)); - } - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - break; - - case COLOR_WORD: - { - if (cbDstData - cbData > 0) - { - // - // Just copy all channels after alpha into the COLOR structure - // - CopyMemory(pDstData, pData, cbData); - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - break; - - case COLOR_FLOAT: - { - // - // Make sure the float data runs between 0.0 and 1.0 for nChannel and sRGB and is - // truncated and scaled as follows for scRGB: - // - // 1. Truncate the input color to between -2.0 and +2.0 - // 2. Offset the value by +2.0 to put it into the 0.0 to 4.0 range - // 3. Scale the value by 4.0 to put it into the range 0.0 to 1.0 - // 4. Set the 16 bit value according to the channel value from 0x0000 - // for 0.0 to 0xFFFF for 1.0 - // - if (cbDstData >= cChannels * sizeof(WORD) && - cbData >= cChannels * sizeof(FLOAT)) - { - PFLOAT pSrcData = reinterpret_cast(pData); - - if (m_dataType == scRGB) - { - for (UINT cCurrChan = 0; - cCurrChan < cChannels; - cCurrChan++) - { - _Analysis_assume_((cCurrChan + 1) * sizeof(WORD) <= cbDstData); - - FLOAT channelValue = pSrcData[cCurrChan]; - channelValue = channelValue < -2.0f ? -2.0f : channelValue; - channelValue = channelValue > 2.0f ? 2.0f : channelValue; - channelValue += 2.0f; - channelValue /= 4.0f; - pDstData[cCurrChan] = static_cast(channelValue * kMaxWordAsFloat); - } - } - else - { - if (SUCCEEDED(hr = ClampChannelValues(0.0f, 1.0f))) - { - for (UINT cCurrChan = 0; - cCurrChan < cChannels; - cCurrChan++) - { - _Analysis_assume_((cCurrChan + 1) * sizeof(WORD) <= cbDstData); - - pDstData[cCurrChan] = static_cast(pSrcData[cCurrChan] * kMaxWordAsFloat); - } - } - } - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - break; - - case COLOR_S2DOT13FIXED: - { - hr = E_NOTIMPL; - } - break; - - default: - { - RIP("Unrecognised color type\n"); - hr = E_FAIL; - } - break; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CColorChannelData::ColorFromByte - -Routine Description: - - Uses an 8 bpc COLOR structure to set the channel data - -Arguments: - - pSrcData - Pointer to the source COLOR data - cbSrcData - Size of the source buffer in bytes - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::ColorFromByte( - _In_reads_bytes_(cbSrcData) PBYTE pSrcData, - _In_ CONST UINT& cbSrcData - ) -{ - HRESULT hr = S_OK; - - DWORD cChannels = 0; - DWORD cbData = 0; - PBYTE pData = NULL; - - if (SUCCEEDED(hr = CHECK_POINTER(pSrcData, E_POINTER)) && - SUCCEEDED(hr = GetChannelCountNoAlpha(&cChannels)) && - SUCCEEDED(hr = GetChannelDataNoAlpha(&cbData, reinterpret_cast(&pData)))) - { - if (cbData == 0 && - cChannels != 0) - { - hr = E_UNEXPECTED; - } - } - - if (SUCCEEDED(hr)) - { - ZeroMemory(pData, cbData); - - if (cbSrcData > 0) - { - switch (m_channelType) - { - case COLOR_BYTE: - { - if (cbData >= cChannels * sizeof(BYTE) && - cbSrcData >= cChannels * sizeof(BYTE)) - { - // - // Just copy src to dst - // - CopyMemory(pData, pSrcData, cChannels * sizeof(BYTE)); - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - break; - - case COLOR_WORD: - { - if (cbData >= cChannels * sizeof(WORD) && - cbSrcData >= cChannels * sizeof(BYTE)) - { - PWORD pDstData = reinterpret_cast(pData); - - for (UINT cCurrChan = 0; - cCurrChan < cChannels; - cCurrChan++) - { - _Analysis_assume_(cCurrChan < cbSrcData); - - pDstData[cCurrChan] = static_cast(MulDiv(pSrcData[cCurrChan], 0xFFFF, 0xFF)); - } - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - break; - - case COLOR_FLOAT: - { - // - // Make sure the float data is scaled to 0.0 and 1.0 for nChannel and sRGB and is - // scaled as follows for scRGB: - // - // 1. Convert the WORD value from 0x00 - 0xFF to 0.0f - 1.0f - // 1. Scale the value up by 4.0 to put it into the range 0.0 to 2.0 - // 2. Offset the value by -2.0 to put it into the -2.0 to 2.0 range - // - if (cbData >= cChannels * sizeof(FLOAT) && - cbSrcData >= cChannels * sizeof(BYTE)) - { - PFLOAT pDstData = reinterpret_cast(pData); - - if (m_dataType == scRGB) - { - for (UINT cCurrChan = 0; - cCurrChan < cChannels; - cCurrChan++) - { - _Analysis_assume_(cCurrChan < cbSrcData); - - pDstData[cCurrChan] = ((static_cast(pSrcData[cCurrChan])*4.0f)/kMaxByteAsFloat) - 2.0f; - } - } - else - { - for (UINT cCurrChan = 0; - cCurrChan < cChannels; - cCurrChan++) - { - _Analysis_assume_(cCurrChan < cbSrcData); - - pDstData[cCurrChan] = static_cast(pSrcData[cCurrChan])/kMaxByteAsFloat; - } - } - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - break; - - case COLOR_S2DOT13FIXED: - { - hr = E_NOTIMPL; - } - break; - - default: - { - RIP("Unrecognised color type\n"); - hr = E_FAIL; - } - break; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::ColorFromWord - -Routine Description: - - Uses an 16 bpc COLOR structure to set the channel data - -Arguments: - - pSrcData - Pointer to the source COLOR data - cbSrcData - Size of the source buffer in bytes - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::ColorFromWord( - _In_reads_bytes_(cbSrcData) PWORD pSrcData, - _In_ CONST UINT& cbSrcData - ) -{ - HRESULT hr = S_OK; - - DWORD cChannels = 0; - DWORD cbData = 0; - PBYTE pData = NULL; - - if (SUCCEEDED(hr = CHECK_POINTER(pSrcData, E_POINTER)) && - SUCCEEDED(hr = GetChannelCountNoAlpha(&cChannels)) && - SUCCEEDED(hr = GetChannelDataNoAlpha(&cbData, reinterpret_cast(&pData)))) - { - if (cbData == 0 && - cChannels != 0) - { - hr = E_UNEXPECTED; - } - } - - if (SUCCEEDED(hr)) - { - ZeroMemory(pData, cbData); - - if (cbSrcData > 0) - { - switch (m_channelType) - { - case COLOR_BYTE: - { - if (cbData >= cChannels * sizeof(BYTE) && - cbSrcData >= cChannels * sizeof(WORD)) - { - for (UINT cCurrChan = 0; - cCurrChan < cChannels; - cCurrChan++) - { - _Analysis_assume_((cCurrChan + 1) * sizeof(WORD) < cbSrcData); - - pData[cCurrChan] = static_cast(MulDiv(pSrcData[cCurrChan], 0xFF, 0xFFFF)); - } - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - break; - - case COLOR_WORD: - { - if (cbData >= cChannels * sizeof(WORD) && - cbSrcData >= cChannels * sizeof(WORD)) - { - // - // Just copy src to dst - // - CopyMemory(pData, pSrcData, cChannels * sizeof(WORD)); - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - break; - - case COLOR_FLOAT: - { - // - // Make sure the float data is scaled to 0.0 and 1.0 for nChannel and sRGB and is - // scaled as follows for scRGB: - // - // 1. Convert the WORD value from 0x0000 - 0xFFFF to 0.0f - 1.0f - // 1. Scale the value up by 4.0 to put it into the range 0.0 to 2.0 - // 2. Offset the value by -2.0 to put it into the -2.0 to 2.0 range - // - if (cbData >= cChannels * sizeof(FLOAT) && - cbSrcData >= cChannels * sizeof(WORD)) - { - PFLOAT pDstData = reinterpret_cast(pData); - - if (m_dataType == scRGB) - { - for (UINT cCurrChan = 0; - cCurrChan < cChannels; - cCurrChan++) - { - _Analysis_assume_((cCurrChan + 1) * sizeof(WORD) < cbSrcData); - - pDstData[cCurrChan] = ((static_cast(pSrcData[cCurrChan])*4.0f)/kMaxWordAsFloat) - 2.0f; - } - } - else - { - for (UINT cCurrChan = 0; - cCurrChan < cChannels; - cCurrChan++) - { - _Analysis_assume_((cCurrChan + 1) * sizeof(WORD) < cbSrcData); - - pDstData[cCurrChan] = static_cast(pSrcData[cCurrChan])/kMaxWordAsFloat; - } - } - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - break; - - case COLOR_S2DOT13FIXED: - { - hr = E_NOTIMPL; - } - break; - - default: - { - RIP("Unrecognised color type\n"); - hr = E_FAIL; - } - break; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::GetChannelSizeFromType - -Routine Description: - - Retrieves the channel data size from the channel data type - -Arguments: - - channelType - The color channel data type - pcbChannelSize - Pointer to storage to recieve the channel data size - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::GetChannelSizeFromType( - _In_ CONST COLORDATATYPE& channelType, - _Out_ DWORD* pcbChannelSize - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pcbChannelSize, E_POINTER))) - { - if (channelType < COLOR_BYTE || - channelType > COLOR_S2DOT13FIXED) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - *pcbChannelSize = g_cbChannelType[channelType - 1]; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::ValidateDataSize - -Routine Description: - - Template method that validates the data size given the current channel data type - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -template -HRESULT -CColorChannelData::ValidateDataSize( - VOID - ) -{ - HRESULT hr = S_OK; - - DWORD cbDataSize = 0; - if (SUCCEEDED(hr = GetChannelSizeFromType(m_channelType, &cbDataSize))) - { - // - // Make sure the data being added matches the data type in size - // - if (sizeof(_T) != cbDataSize) - { - hr = E_INVALIDARG; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::AllocateChannelBuffers - -Routine Description: - - Allocates the channel data buffer - -Arguments: - - pcbBuffer - Pointer to variable that recieves the allocated buffer size - ppBuffer - Pointer to a pointer that recieves the buffer address - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::AllocateChannelBuffers( - _Out_ UINT* pcbBuffer, - _Outptr_result_bytebuffer_(*pcbBuffer) _At_buffer_(*ppBuffer, _Iter_, *pcbBuffer, _Post_invalid_) - PBYTE* ppBuffer - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pcbBuffer, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppBuffer, E_POINTER))) - { - // - // Allocate a buffer for the channel data MAX_CHANNEL_COUNT x MAX_CHANNEL_SIZE - // This guarantees we have enough storage for the maximum n-channel support - // in WCS - // - *pcbBuffer = MAX_CHANNEL_COUNT*MAX_CHANNEL_SIZE; - *ppBuffer = new(std::nothrow) BYTE[*pcbBuffer]; - - if (*ppBuffer == NULL) - { - *pcbBuffer = 0; - hr = E_OUTOFMEMORY; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorChannelData::FreeChannelBuffers - -Routine Description: - - Releases channel buffer - -Arguments: - - None - -Return Value: - - None - ---*/ -VOID -CColorChannelData::FreeChannelBuffers( - VOID - ) -{ - if (m_pChannelData != NULL) - { - delete[] m_pChannelData; - m_pChannelData = NULL; - } - m_cbChannelData = 0; -} - -/*++ - -Routine Name: - - CColorChannelData::GetAlphaAsFloat - -Routine Description: - - Retrieves the alpha value of the channel data as a float - -Arguments: - - pAlpha - Pointer to a float that recieves the alpha value - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorChannelData::GetAlphaAsFloat( - _Out_ PFLOAT pAlpha - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pAlpha, E_POINTER))) - { - *pAlpha = 0.0f; - - if (HasAlpha()) - { - switch (m_channelType) - { - case COLOR_BYTE: - { - *pAlpha = static_cast(*m_pChannelData)/kMaxByteAsFloat; - } - break; - - case COLOR_WORD: - { - *pAlpha = static_cast(*reinterpret_cast(m_pChannelData))/kMaxWordAsFloat; - } - break; - - case COLOR_FLOAT: - { - *pAlpha = *reinterpret_cast(m_pChannelData); - } - break; - - case COLOR_S2DOT13FIXED: - { - hr = E_NOTIMPL; - } - break; - - default: - { - RIP("Unrecognised channel data format.\n"); - hr = E_FAIL; - } - break; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/color/colchan.h b/print/XPSDrvSmpl/src/filters/color/colchan.h deleted file mode 100644 index 393261a8..00000000 --- a/print/XPSDrvSmpl/src/filters/color/colchan.h +++ /dev/null @@ -1,289 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - colchan.h - -Abstract: - - Color channel class definition. The color channel class is responsible for maintaining - simple single color multiple channel data intialised from color references in the XPS markup. - It provides methods for intialization, access and conversion of the data. - ---*/ - -#pragma once - -enum EColorDataType -{ - sRGB = 0, - scRGB, - nChannel -}; - -class CColorChannelData -{ -public: - CColorChannelData(); - - ~CColorChannelData(); - - template - HRESULT - AddChannelData( - _In_ CONST _T& channelValue - ); - - HRESULT - GetChannelCount( - _Out_ DWORD* pcChannels - ); - - HRESULT - GetChannelCountNoAlpha( - _Out_ DWORD* pcChannels - ); - - HRESULT - GetChannelType( - _Out_ COLORDATATYPE* pChannelType - ); - - HRESULT - ResetChannelType( - _In_ CONST COLORDATATYPE& channelType - ); - - HRESULT - GetChannelData( - _Out_ DWORD* pcbDataSize, - _Out_ - _When_(*pcbDataSize > 0, _At_(*ppData, _Post_ _Readable_bytes_(*pcbDataSize))) - _When_(*pcbDataSize == 0, _At_(*ppData, _Post_ _Maybenull_)) - PVOID* ppData - ); - - HRESULT - GetChannelDataNoAlpha( - _Out_ DWORD* pcbDataSize, - _Out_ - _When_(*pcbDataSize > 0, _At_(*ppData, _Post_ _Readable_bytes_(*pcbDataSize))) - _When_(*pcbDataSize == 0, _At_(*ppData, _Post_ _Maybenull_)) - PVOID* ppData - ); - - template - HRESULT - ClampChannelValues( - _In_ CONST _T& min, - _In_ CONST _T& max - ); - - template - HRESULT - InitializeChannelData( - _In_ CONST COLORDATATYPE& channelType, - _In_ CONST EColorDataType& dataType, - _In_ CONST DWORD& cChannels, - _In_ CONST _T& channelValue - ); - - HRESULT - SetColorDataType( - _In_ CONST EColorDataType& dataType - ); - - HRESULT - GetColorDataType( - _Out_ EColorDataType* pDataType - ); - - BOOL - HasAlpha( - VOID - ); - - HRESULT - InitializeAlphaChannel( - _In_ CColorChannelData* pSrcChannelData - ); - - HRESULT - GetColor( - _Out_ PCOLOR pColor, - _Out_ COLORTYPE* pType - ); - - HRESULT - SetColor( - _In_ COLOR* pColor, - _In_ CONST COLORTYPE& type - ); - -private: - HRESULT - GetChannelSizeFromType( - _In_ CONST COLORDATATYPE& channelType, - _Out_ DWORD* pcbChannelSize - ); - - template - HRESULT - ValidateDataSize( - VOID - ); - - HRESULT - AllocateChannelBuffers( - _Out_ UINT* pcbBuffer, - _Outptr_result_bytebuffer_(*pcbBuffer) _At_buffer_(*ppBuffer, _Iter_, *pcbBuffer, _Post_invalid_) - PBYTE* ppBuffer - ); - - VOID - FreeChannelBuffers( - VOID - ); - - HRESULT - GetAlphaAsFloat( - _Out_ PFLOAT pAlpha - ); - - HRESULT - ColorToByte( - _Out_writes_bytes_(cbDstData) PBYTE pDstData, - _In_ CONST UINT cbDstData - ); - - HRESULT - ColorToWord( - _Out_writes_bytes_(cbDstData) PWORD pDstData, - _In_ CONST UINT cbDstData - ); - - HRESULT - ColorFromByte( - _In_reads_bytes_(cbSrcData) PBYTE pSrcData, - _In_ CONST UINT& cbSrcData - ); - - HRESULT - ColorFromWord( - _In_reads_bytes_(cbSrcData) PWORD pSrcData, - _In_ CONST UINT& cbSrcData - ); - - HRESULT - GetAlphaChannelSize( - _Out_ DWORD* pcbAlphaChan - ); - -private: - DWORD m_cChannels; - - COLORDATATYPE m_channelType; - - PBYTE m_pChannelData; - - UINT m_cbChannelData; - - EColorDataType m_dataType; -}; - -// -// Explicitly instantiate the template functions for BYTE, WORD and FLOAT -// -template -HRESULT -CColorChannelData::AddChannelData( - _In_ CONST BYTE& channelValue - ); - -template -HRESULT -CColorChannelData::ClampChannelValues( - _In_ CONST BYTE& min, - _In_ CONST BYTE& max - ); - -template -HRESULT -CColorChannelData::InitializeChannelData( - _In_ CONST COLORDATATYPE& channelType, - _In_ CONST EColorDataType& dataType, - _In_ CONST DWORD& cChannels, - _In_ CONST BYTE& channelValue - ); - -template -HRESULT -CColorChannelData::ValidateDataSize( - VOID - ); - -template -HRESULT -CColorChannelData::AddChannelData( - _In_ CONST WORD& channelValue - ); - -template -HRESULT -CColorChannelData::ClampChannelValues( - _In_ CONST WORD& min, - _In_ CONST WORD& max - ); - -template -HRESULT -CColorChannelData::InitializeChannelData( - _In_ CONST COLORDATATYPE& channelType, - _In_ CONST EColorDataType& dataType, - _In_ CONST DWORD& cChannels, - _In_ CONST WORD& channelValue - ); - -template -HRESULT -CColorChannelData::ValidateDataSize( - VOID - ); - -template -HRESULT -CColorChannelData::AddChannelData( - _In_ CONST FLOAT& channelValue - ); - -template -HRESULT -CColorChannelData::ClampChannelValues( - _In_ CONST FLOAT& min, - _In_ CONST FLOAT& max - ); - -template -HRESULT -CColorChannelData::InitializeChannelData( - _In_ CONST COLORDATATYPE& channelType, - _In_ CONST EColorDataType& dataType, - _In_ CONST DWORD& cChannels, - _In_ CONST FLOAT& channelValue - ); - -template -HRESULT -CColorChannelData::ValidateDataSize( - VOID - ); - diff --git a/print/XPSDrvSmpl/src/filters/color/colconv.cpp b/print/XPSDrvSmpl/src/filters/color/colconv.cpp deleted file mode 100644 index 13804f5e..00000000 --- a/print/XPSDrvSmpl/src/filters/color/colconv.cpp +++ /dev/null @@ -1,1138 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - colconv.cpp - -Abstract: - - Color conversion manager implementation. The CColorConverter class is responsible - for coordinating the handling of the color conversion process. - - Note regarding transform caching: The color filter provides caching for the last - transform. This aids performance as quite some time can be consumed creating a - transform. The filter may however suffer if source content color profiles are rapidly - switched (e.g. alternating sRGB and scRGB mark-up). This could be mitigated by increasing - the number cached transforms beyond one. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "colconv.h" -#include "cmimg.h" -#include "dictionary.h" - -using XDPrintSchema::PageSourceColorProfile::EProfileOption; -using XDPrintSchema::PageSourceColorProfile::RGB; -using XDPrintSchema::PageSourceColorProfile::CMYK; - -using XDPrintSchema::PageICMRenderingIntent::AbsoluteColorimetric; -using XDPrintSchema::PageICMRenderingIntent::RelativeColorimetric; -using XDPrintSchema::PageICMRenderingIntent::Photographs; -using XDPrintSchema::PageICMRenderingIntent::BusinessGraphics; - -COLORTYPE g_nChannelMap[] = { - COLOR_3_CHANNEL, - COLOR_CMYK, - COLOR_5_CHANNEL, - COLOR_6_CHANNEL, - COLOR_7_CHANNEL, - COLOR_8_CHANNEL -}; - -/*++ - -Routine Name: - - CColorConverter::CColorConverter - -Routine Description: - - Constructor for the base CColorConverter class. Provides common functionality - between the bitmap and color ref converter classes - -Arguments: - - pXpsConsumer - Pointer to the XPS consumer interface. Used to write out resources - pFixedPage - Pointer to the FixedPage interface. Resource cache uses this when writing - pResCache - Pointer to the resource cache. - pProfManager - Pointer to a profile manager for supplying a suitable color profile - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CColorConverter::CColorConverter( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ CFileResourceCache* pResCache, - _In_ CProfileManager* pProfManager, - _In_ ResDeleteMap* pResDel - ) : - m_pXpsConsumer(pXpsConsumer), - m_pFixedPage(pFixedPage), - m_pProfManager(pProfManager), - m_pResCache(pResCache), - m_pResDel(pResDel) -{ - HRESULT hr = S_OK; - - if (FAILED(hr = CHECK_POINTER(m_pXpsConsumer, E_POINTER)) || - FAILED(hr = CHECK_POINTER(m_pFixedPage, E_POINTER)) || - FAILED(hr = CHECK_POINTER(m_pProfManager, E_POINTER)) || - FAILED(hr = CHECK_POINTER(m_pResCache, E_POINTER)) || - FAILED(hr = CHECK_POINTER(m_pResDel, E_POINTER))) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CColorConverter::~CColorConverter - -Routine Description: - - Default destructor for the CColorConverter class - -Arguments: - - None - -Return Value: - - None - ---*/ -CColorConverter::~CColorConverter() -{ -} - -/*++ - -Routine Name: - - CBitmapColorConverter::CBitmapColorConverter - -Routine Description: - - Constructor for the CBitmapColorConverter class - -Arguments: - - pXpsConsumer - Pointer to the XPS consumer interface. Used to write out resources - pFixedPage - Pointer to the FixedPage interface. Resource cache uses this when writing - pResCache - Pointer to the resource cache. - pProfManager - Pointer to a profile manager for supplying a suitable color profile - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CBitmapColorConverter::CBitmapColorConverter( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ CFileResourceCache* pResCache, - _In_ CProfileManager* pProfManager, - _In_ ResDeleteMap* pResDel - ) : - CColorConverter(pXpsConsumer, pFixedPage, pResCache, pProfManager, pResDel) -{ -} - -/*++ - -Routine Name: - - CBitmapColorConverter::~CBitmapColorConverter - -Routine Description: - - Destructor for the CBitmapColorConverter class - -Arguments: - - None - -Return Value: - - None - ---*/ -CBitmapColorConverter::~CBitmapColorConverter() -{ -} - -/*++ - -Routine Name: - - CColorConverter::ConvertBitmap - -Routine Description: - - Method which performs the color conversion process to a bitmap resource and sets - the resource URI to contain the URI of the converted bitmap resource - -Arguments: - - pbstrBmpURI - Pointer to a string containing the bitmap resource path and name - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBitmapColorConverter::Convert( - _Inout_ BSTR* pbstrBmpURI - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrBmpURI, E_POINTER))) - { - try - { - // - // Create a color managed image object - // - CColorManagedImage bmpColManaged(*pbstrBmpURI, m_pProfManager, m_pFixedPage, m_pResDel); - - // - // Write out the cached bitmap and get a keyname for the written bitmap - // - CComBSTR bstrKey; - if (SUCCEEDED(hr = m_pResCache->WriteResource(m_pXpsConsumer, m_pFixedPage, &bmpColManaged)) && - SUCCEEDED(hr = bmpColManaged.GetKeyName(&bstrKey))) - { - hr = m_pResCache->GetURI(bstrKey, pbstrBmpURI); - - ASSERTMSG(SUCCEEDED(hr), "Failed to process image"); - } - } - catch (CXDException& e) - { - hr = e; - } - } - else - { - hr = E_POINTER; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorRefConverter::CColorRefConverter - -Routine Description: - - Constructor for the base CColorRefConverter class which handles parsing and - conversion of a color string within XPS mark-up - -Arguments: - - pXpsConsumer - Pointer to the XPS consumer interface. Used to write out resources - pFixedPage - Pointer to the FixedPage interface. Resource cache uses this when writing - pResCache - Pointer to the resource cache. - pProfManager - Pointer to a profile manager for supplying a suitable color profile - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CColorRefConverter::CColorRefConverter( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ CFileResourceCache* pResCache, - _In_ CProfileManager* pProfManager, - _In_ ResDeleteMap* pResDel - ) : - CColorConverter(pXpsConsumer, pFixedPage, pResCache, pProfManager, pResDel) -{ -} - -/*++ - -Routine Name: - - CColorRefConverter::~CColorRefConverter - -Routine Description: - - Destructor for the CColorRefConverter class - -Arguments: - - None - -Return Value: - - None - ---*/ -CColorRefConverter::~CColorRefConverter() -{ -} - -/*++ - -Routine Name: - - CColorRefConverter::ConvertColor - -Routine Description: - - Method which performs the color conversion process to an XPS color ref element - -Arguments: - - pbstrColorRef - Pointer to a string containing the color data to be converted - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorRefConverter::Convert( - _Inout_ BSTR* pbstrColorRef - ) -{ - HRESULT hr = S_OK; - - BOOL bIsResourceReference = FALSE; - if (SUCCEEDED(hr = CHECK_POINTER(pbstrColorRef, E_POINTER)) && - SUCCEEDED(hr = ParseColorString(*pbstrColorRef, &m_srcData, &bIsResourceReference)) && - !bIsResourceReference) - { - // - // If the source and destination types are the same (e.g. scRGB in and scRGB out) - // we need go no further - simply return the existing string. This does not apply - // to nChannel as ContextColors specify their own profile and we cannot prove that - // this matches our output. The color space for sRGB and scRGB are implicit however. - // - EColorDataType srcType = sRGB; - EColorDataType dstType = sRGB; - if (SUCCEEDED(hr = InitDstChannels(&m_srcData, &m_dstData)) && - SUCCEEDED(hr = m_srcData.GetColorDataType(&srcType)) && - SUCCEEDED(hr = m_dstData.GetColorDataType(&dstType))) - { - if (dstType == nChannel || - dstType != srcType) - { - if (SUCCEEDED(hr = TransformColor(&m_srcData, &m_dstData))) - { - hr = CreateColorString(&m_dstData, pbstrColorRef); - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorRefConverter::InitDstChannels - -Routine Description: - - Initialise the destination color channel data based on the destination color - profile - -Arguments: - - pChannelDataDst - Pointer to a color channel data object to be intialised - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorRefConverter::InitDstChannels( - _In_ CColorChannelData* pChannelDataSrc, - _Inout_ CColorChannelData* pChannelDataDst - ) -{ - HRESULT hr = S_OK; - - EProfileOption profileType = RGB; - if (SUCCEEDED(hr = CHECK_POINTER(pChannelDataSrc, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pChannelDataDst, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pProfManager, E_FAIL)) && - SUCCEEDED(hr = m_pProfManager->GetDstProfileType(&profileType))) - { - // - // Initialize the channel data based on the destination color profile - // settings: - // RGB = 3 channel with no src alpha - // 4 channel with src alpha - // CMYK = 5 channel (nChannel always has an alpha channel) - // - // The color type is based off the OS. XP does not have access to WCS - // and therefore floating point formats are converted to 16 bits per channel - // - // The conversion process for downlevel handling depends on the source format. - // If we are color matching for scRGB we convert the floating point value as - // follows: - // - // 1. Truncate the input color to between -2.0 and +2.0 - // 2. Offset the value by +2.0 to put it into the 0.0 to 4.0 range - // 3. Scale the value by 4.0 to put it into the range 0.0 to 1.0 - // 4. Set the 16 bit value according to the channel value from 0x0000 - // for 0.0 to 0xFFFF for 1.0 - // 5. Call TranslateColors passing the 16 bit value - // 6. Reverse steps 1 - 4 to retrieve the floating point value - // - // If we are color matching for context colors we apply the following conversion - // - // 1. Truncate the input color to between 0.0 and +1.0 - // 2. Set the 16 bit value according to the channel value from 0x0000 - // for 0.0 to 0xFFFF for 1.0 - // 3. Call TranslateColors passing the 16 bit value - // 4. Reverse steps 1 - 2 to retrieve the floating point value - // - // Note: We do not modify the gamma during the scRGB conversion process as this will - // be applied by WCS/ICM as the gamma is encapsulated by the relevant ICC - // profile. i.e. The gamma is maintained linear as that is what the transform - // is expecting. - // - COLORDATATYPE colorDataType = COLOR_FLOAT; - EColorDataType dataType = sRGB; - - DWORD cChannels = 0; - if (profileType == RGB) - { - dataType = scRGB; - cChannels = 3; - if (pChannelDataSrc->HasAlpha()) - { - cChannels++; - } - } - else if (profileType == CMYK) - { - dataType = nChannel; - cChannels = 5; - } - else - { - RIP("Unsupported color channel format\n"); - hr = E_FAIL; - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = pChannelDataDst->InitializeChannelData(colorDataType, dataType, cChannels, 0.0f))) - { - hr = pChannelDataDst->InitializeAlphaChannel(pChannelDataSrc); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorRefConverter::GetFloatChannelData - -Routine Description: - - Method which converts a comma delimited set of floating point values - defining color channels into floating point values in a list - -Arguments: - - szColorRef - The srting containing the comma seperated color values - pChannelData - Pointer to the color channels object - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorRefConverter::GetFloatChannelData( - _In_ LPCWSTR szColorRef, - _Inout_ CColorChannelData* pChannelData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pChannelData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(szColorRef, E_POINTER)) && - SUCCEEDED(hr = pChannelData->ResetChannelType(COLOR_FLOAT))) - { - try - { - CStringXDW cstrColorRef(szColorRef); - cstrColorRef.Trim(); - cstrColorRef.MakeLower(); - - INT cTokenIndex = 0; - INT cChars = cstrColorRef.GetLength(); - while (SUCCEEDED(hr) && - cTokenIndex < cChars && - cTokenIndex != -1) - { - CStringXDW cstrChannel(cstrColorRef.Tokenize(L",", cTokenIndex)); - hr = pChannelData->AddChannelData(static_cast(_wtof(cstrChannel))); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorRefConverter::SetFloatChannelData - -Routine Description: - - Method which converts channel data object into a comma delimited set of - floating point values - -Arguments: - - pChannelData - Pointer to the color channel data - pcstrChannelData - Pointer to the color string to be populated - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorRefConverter::SetFloatChannelData( - _In_ CColorChannelData* pChannelData, - _Inout_ CStringXDW* pcstrChannelData - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pChannelData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcstrChannelData, E_POINTER))) - { - try - { - // - // Over all channels, write out comma seperated float values - // - DWORD cbData = 0; - PFLOAT pData = NULL; - DWORD cChanCount = 0; - if (SUCCEEDED(hr = pChannelData->GetChannelData(&cbData, reinterpret_cast(&pData))) && - SUCCEEDED(hr = pChannelData->GetChannelCount(&cChanCount))) - { - if (cChanCount == 0) - { - hr = E_FAIL; - } - - if (SUCCEEDED(hr) && - cbData >= cChanCount * sizeof(FLOAT)) - { - CStringXDW cstrChannel; - cstrChannel.Format(L"%f", pData[0]); - pcstrChannelData->Append(cstrChannel); - for (DWORD cChan = 1; cChan < cChanCount; cChan++) - { - cstrChannel.Format(L",%f", pData[cChan]); - pcstrChannelData->Append(cstrChannel); - } - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorRefConverter::ParseColorString - -Routine Description: - - Method which converts a XML formatted color string into useable color data - -Arguments: - - bstrColorRef - The color ref string to be parsed - pChannelData - Pointer to the color channel data object to be populated - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorRefConverter::ParseColorString( - _In_ BSTR bstrColorRef, - _Inout_ CColorChannelData* pChannelData, - _Out_ BOOL* pbIsResourceReference - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pChannelData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pbIsResourceReference, E_POINTER))) - { - *pbIsResourceReference = FALSE; - - if (SysStringLen(bstrColorRef) <= 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - try - { - CStringXDW cstrColRef(bstrColorRef); - cstrColRef.Trim(); - - if (0 == cstrColRef.Find(L"sc#")) - { - // - // Strip the "sc#" prefix ready to parse the floating point channels - // - cstrColRef.Delete(0, 3); - - // - // Set the src profile to xdwscRGB.icc - this is an ICC profile with - // the system wcsRGB profile embedded so should work down-level - // Set the color data type and retrieve the channel data - // - if (SUCCEEDED(hr = m_pProfManager->SetSrcProfileFromColDir(L"xdwscRGB.icc")) && - SUCCEEDED(hr = pChannelData->ResetChannelType(COLOR_FLOAT)) && - SUCCEEDED(hr = pChannelData->SetColorDataType(scRGB))) - { - hr = GetFloatChannelData(cstrColRef, pChannelData); - } - } - else if (0 == cstrColRef.Find(L"ContextColor")) - { - // - // Context colors always have an associated profile - retrieve - // this and set it in the profile manager - // - cstrColRef.Delete(0, countof(L"ContextColor ")); - cstrColRef.Trim(); - CStringXDW cstrProfile(cstrColRef.Left(cstrColRef.Find(L" "))); - cstrColRef.Delete(0, cstrProfile.GetLength()); - - // - // Set the source profile ready to create the transform, retrieve the channel data - // and clamp between 0.0 and 1.0. - // - if (SUCCEEDED(hr = m_pProfManager->SetSrcProfileFromContainer(cstrProfile.GetBuffer())) && - SUCCEEDED(hr = pChannelData->ResetChannelType(COLOR_FLOAT)) && - SUCCEEDED(hr = pChannelData->SetColorDataType(nChannel)) && - SUCCEEDED(hr = GetFloatChannelData(cstrColRef, pChannelData)) && - SUCCEEDED(hr = pChannelData->ClampChannelValues(0.0f, 1.0f))) - { - // - // Mark the color profile for deletion - // - (*m_pResDel)[cstrProfile] = TRUE; - } - } - else if (0 == cstrColRef.Find(L"#")) - { - // - // Delete the # symbol so we are just left with the RGB values - // - cstrColRef.Delete(0, 1); - - // - // Set the source profile to sRGB rather than assume the default is set to - // sRGB. - // - if (SUCCEEDED(hr = m_pProfManager->SetSrcProfileFromColDir(L"sRGB Color Space Profile.icm")) && - SUCCEEDED(hr = pChannelData->ResetChannelType(COLOR_BYTE)) && - SUCCEEDED(hr = pChannelData->SetColorDataType(sRGB))) - { - while (SUCCEEDED(hr) && - cstrColRef.GetLength() > 0) - { - // - // Add the channel data - // - hr = pChannelData->AddChannelData(static_cast(wcstol(cstrColRef.Left(2), NULL, 16))); - - // - // Delete the channel from the color ref string - // - cstrColRef.Delete(0, 2); - } - } - } - else if (0 == cstrColRef.Find(L"{StaticResource")) - { - *pbIsResourceReference = TRUE; - } - else - { - // - // Unrecognised type - // - RIP("Unrecognised color syntax."); - hr = E_FAIL; - } - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorRefConverter::TransformColor - -Routine Description: - - Method which applies a color transform to a set of color data - -Arguments: - - pSrcData - Pointer to the source color channel data - pDstData - Pointer to the destination color channel data - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorRefConverter::TransformColor( - _In_ CColorChannelData* pSrcData, - _Inout_ CColorChannelData* pDstData - ) -{ - HRESULT hr = S_OK; - - HTRANSFORM hColorTrans = NULL; - - BOOL bUseWCS = FALSE; - - if (SUCCEEDED(hr = CHECK_POINTER(pSrcData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDstData, E_POINTER)) && - SUCCEEDED(hr = m_pProfManager->GetColorTransform(&hColorTrans, &bUseWCS))) - { - if (bUseWCS) - { - DWORD cSrcChan = 0; - DWORD cDstChan = 0; - - COLORDATATYPE srcDataType = COLOR_FLOAT; - COLORDATATYPE dstDataType = COLOR_FLOAT; - - DWORD cbSrcChan = 0; - DWORD cbDstChan = 0; - - PBYTE pSrcBuff = NULL; - PBYTE pDstBuff = NULL; - - if (SUCCEEDED(hr = CHECK_POINTER(hColorTrans, E_HANDLE)) && - SUCCEEDED(hr = pSrcData->GetChannelCountNoAlpha(&cSrcChan)) && - SUCCEEDED(hr = pSrcData->GetChannelType(&srcDataType)) && - SUCCEEDED(hr = pSrcData->GetChannelDataNoAlpha(&cbSrcChan, reinterpret_cast(&pSrcBuff))) && - SUCCEEDED(hr = pDstData->GetChannelCountNoAlpha(&cDstChan)) && - SUCCEEDED(hr = pDstData->GetChannelType(&dstDataType)) && - SUCCEEDED(hr = pDstData->GetChannelDataNoAlpha(&cbDstChan, reinterpret_cast(&pDstBuff)))) - { - if (cbDstChan > 0) - { - if (!WcsTranslateColorsXD(hColorTrans, - 1, - cSrcChan, - srcDataType, - cbSrcChan, - pSrcBuff, - cDstChan, - dstDataType, - cbDstChan, - pDstBuff)) - { - hr = GetLastErrorAsHResult(); - } - } - else - { - hr = E_FAIL; - } - } - } - else - { - COLOR srcColor; - COLOR dstColor; - - COLORTYPE srcType; - COLORTYPE dstType; - - if (SUCCEEDED(hr = pSrcData->GetColor(&srcColor, &srcType)) && - SUCCEEDED(hr = pDstData->GetColor(&dstColor, &dstType))) - { - if (TranslateColors(hColorTrans, - &srcColor, - 1, - srcType, - &dstColor, - dstType)) - { - hr = pDstData->SetColor(&dstColor, dstType); - } - else - { - hr = GetLastErrorAsHResult(); - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorRefConverter::CreateColorString - -Routine Description: - - Method which creates a XML formatted string descripting a transformed set of colors - -Arguments: - - pDstData - Pointer to destination color channel data - pbstrColorRef - Pointer to a string to contain the XML formatted color data - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorRefConverter::CreateColorString( - _In_ CColorChannelData* pDstData, - _Inout_ BSTR* pbstrColorRef - ) -{ - CComBSTR bstrTmpHolder; - - HRESULT hr = S_OK; - - EColorDataType colDataType = sRGB; - if (SUCCEEDED(hr = CHECK_POINTER(pDstData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pbstrColorRef, E_POINTER)) && - SUCCEEDED(hr = pDstData->GetColorDataType(&colDataType))) - { - try - { - CStringXDW cstrChannelData; - - if (colDataType == scRGB) - { - // - // scRGB - // - cstrChannelData += L"sc#"; - hr = SetFloatChannelData(pDstData, &cstrChannelData); - } - else if (colDataType == nChannel) - { - // - // CMYK - // - cstrChannelData += L"ContextColor "; - - // - // Add the ICC profile and retrieve the URI - // - CComBSTR bstrKey; - CComBSTR bstrICCURI; - if (SUCCEEDED(hr = m_pResCache->WriteResource(m_pXpsConsumer, m_pFixedPage, m_pProfManager)) && - SUCCEEDED(hr = m_pProfManager->GetKeyName(&bstrKey)) && - SUCCEEDED(hr = m_pResCache->GetURI(bstrKey, &bstrICCURI))) - { - // - // Append the URI and a space - // - cstrChannelData += bstrICCURI; - cstrChannelData += L" "; - - hr = SetFloatChannelData(pDstData, &cstrChannelData); - } - } - else if (colDataType == sRGB) - { - // - // sRGB - // - cstrChannelData += L"#"; - - // - // Over all channels, write out hex byte values - // - DWORD cbData = 0; - PBYTE pData = NULL; - DWORD cChanCount = 0; - if (SUCCEEDED(hr = pDstData->GetChannelData(&cbData, reinterpret_cast(&pData))) && - SUCCEEDED(hr = pDstData->GetChannelCount(&cChanCount))) - { - if (cbData >= cChanCount * sizeof(BYTE)) - { - for (DWORD cChan = 0; cChan < cChanCount; cChan++) - { - _Analysis_assume_(cChan < cbData); - - CStringXDW cstrChannel; - cstrChannel.Format(L"%02x", pData[cChan]); - cstrChannelData.Append(cstrChannel); - } - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - } - else - { - RIP("Invalid color type\n"); - hr = E_FAIL; - } - - if (SUCCEEDED(hr)) - { - SysFreeString(*pbstrColorRef); - *pbstrColorRef = cstrChannelData.AllocSysString(); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CResourceDictionaryConverter::CResourceDictionaryConverter - -Routine Description: - - CResourceDictionaryConverter constructir - -Arguments: - - pXpsConsumer - Pointer to the XPS consumer interface - pFixedPage - Pointer to the fixed page interface - pResCache - Pointer to the resource cache - pProfManager - Pointer to the color profile manager - pResDel - Pointer to the list of resources to delete from the page - pBmpConv - Pointer to the bitmap conversion class - pRefConv - Pointer to the color reference conversion class - -Return Value: - - None - Throws an exception on error. - ---*/ -CResourceDictionaryConverter::CResourceDictionaryConverter( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ CFileResourceCache* pResCache, - _In_ CProfileManager* pProfManager, - _In_ ResDeleteMap* pResDel, - _In_ CBitmapColorConverter* pBmpConv, - _In_ CColorRefConverter* pRefConv - ) : - CColorConverter(pXpsConsumer, pFixedPage, pResCache, pProfManager, pResDel), - m_pBmpConv(pBmpConv), - m_pRefConv(pRefConv) -{ - if (m_pBmpConv == NULL || - m_pRefConv == NULL) - { - throw CXDException(E_POINTER); - } -} - -/*++ - -Routine Name: - - CResourceDictionaryConverter::~CResourceDictionaryConverter - -Routine Description: - - CResourceDictionaryConverter destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CResourceDictionaryConverter::~CResourceDictionaryConverter() -{ -} - -/*++ - -Routine Name: - - CResourceDictionaryConverter::Convert - -Routine Description: - - Applies color conversion on a remote resource dictionary. This is achieved - by creating a color SAX parser passing a stream based off the resource - -Arguments: - - pbstrDictionaryURI - The remote dictionary URI - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CResourceDictionaryConverter::Convert( - _Inout_ BSTR* pbstrDictionaryURI - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrDictionaryURI, E_POINTER))) - { - try - { - CStringXDW cstrOriginalURI(*pbstrDictionaryURI); - - // - // Create a color managed dictionary object and pass to the cache manager - // - CRemoteDictionary newDictionary(m_pFixedPage, m_pBmpConv, m_pRefConv, *pbstrDictionaryURI); - - CComBSTR bstrKey; - if (SUCCEEDED(hr = m_pResCache->WriteResource(m_pXpsConsumer, m_pFixedPage, &newDictionary)) && - SUCCEEDED(hr = newDictionary.GetKeyName(&bstrKey)) && - SUCCEEDED(hr = m_pResCache->GetURI(bstrKey, pbstrDictionaryURI))) - { - (*m_pResDel)[cstrOriginalURI] = TRUE; - } - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/color/colconv.h b/print/XPSDrvSmpl/src/filters/color/colconv.h deleted file mode 100644 index a658df7f..00000000 --- a/print/XPSDrvSmpl/src/filters/color/colconv.h +++ /dev/null @@ -1,167 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - colconv.h - -Abstract: - - Color conversion class definition. The CColorConverter class is responsible - for managing the color conversion process for vector objects and bitmaps. - ---*/ - -#pragma once - -#include "colchan.h" -#include "rescache.h" -#include "profman.h" -#include "wcsapiconv.h" -#include "cmflt.h" - -class CColorConverter -{ -public: - CColorConverter( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ CFileResourceCache* pResCache, - _In_ CProfileManager* pProfManager, - _In_ ResDeleteMap* pResDel - ); - - virtual ~CColorConverter(); - - virtual HRESULT - Convert( - _Inout_ BSTR* pbstr - ) = 0; - -protected: - CComPtr m_pXpsConsumer; - - CComPtr m_pFixedPage; - - CProfileManager* m_pProfManager; - - CFileResourceCache* m_pResCache; - - ResDeleteMap* m_pResDel; -}; - -class CBitmapColorConverter : public CColorConverter -{ -public: - CBitmapColorConverter( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ CFileResourceCache* pResCache, - _In_ CProfileManager* pProfManager, - _In_ ResDeleteMap* pResDel - ); - - virtual ~CBitmapColorConverter(); - - HRESULT - Convert( - _Inout_ BSTR* pbstrBmpURI - ); -}; - -class CColorRefConverter : public CColorConverter -{ -public: - CColorRefConverter( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ CFileResourceCache* pResCache, - _In_ CProfileManager* pProfManager, - _In_ ResDeleteMap* pResDel - ); - - virtual ~CColorRefConverter(); - - HRESULT - Convert( - _Inout_ BSTR* pbstrColorRef - ); - -private: - HRESULT - InitDstChannels( - _In_ CColorChannelData* pChannelDataSrc, - _Inout_ CColorChannelData* pChannelDataDst - ); - - HRESULT - GetFloatChannelData( - _In_ LPCWSTR szColorRef, - _Inout_ CColorChannelData* pChannelData - ); - - HRESULT - SetFloatChannelData( - _In_ CColorChannelData* pChannelData, - _Inout_ CStringXDW* pcstrChannelData - ); - - HRESULT - ParseColorString( - _In_ BSTR bstrColorRef, - _Inout_ CColorChannelData* pChannelData, - _Out_ BOOL* pbIsResourceReference - ); - - HRESULT - TransformColor( - _In_ CColorChannelData* pSrcData, - _Inout_ CColorChannelData* pDstData - ); - - HRESULT - CreateColorString( - _In_ CColorChannelData* pDstData, - _Inout_ BSTR* pbstrColorRef - ); - -private: - CColorChannelData m_srcData; - - CColorChannelData m_dstData; -}; - -class CResourceDictionaryConverter : public CColorConverter -{ -public: - CResourceDictionaryConverter( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ CFileResourceCache* pResCache, - _In_ CProfileManager* pProfManager, - _In_ ResDeleteMap* pResDel, - _In_ CBitmapColorConverter* pBmpConv, - _In_ CColorRefConverter* pRefConv - ); - - virtual ~CResourceDictionaryConverter(); - - HRESULT - Convert( - _Inout_ BSTR* pbstrDictionaryURI - ); - -private: - CBitmapColorConverter* m_pBmpConv; - - CColorRefConverter* m_pRefConv; -}; - diff --git a/print/XPSDrvSmpl/src/filters/color/dictionary.cpp b/print/XPSDrvSmpl/src/filters/color/dictionary.cpp deleted file mode 100644 index efd15760..00000000 --- a/print/XPSDrvSmpl/src/filters/color/dictionary.cpp +++ /dev/null @@ -1,289 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - dict.cpp - -Abstract: - - Dictionary class implementation. The CRemoteDictionary class is responsible - for representing a single dictionay including managing any color - transforms in that dictionary and writing the dictionary out. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "dictionary.h" -#include "cmsax.h" - -/*++ - -Routine Name: - - CRemoteDictionary::CRemoteDictionary - -Routine Description: - - Constructor for the CRemoteDictionary class which registers the URI to the resource - being represented and pointers to suitable color transformation objects - for use with color elements within that resource - -Arguments: - - bstrResURI - String containing the URI to the resource to be handled - pBmpConverter - Pointer to a bitmap color conversion object - pRefConverter - Pointer to a vector color conversion object - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CRemoteDictionary::CRemoteDictionary( - _In_ IFixedPage* pFixedPage, - _In_ CBitmapColorConverter* pBmpConverter, - _In_ CColorRefConverter* pRefConverter, - _In_ BSTR bstrResURI - ) : - m_pFixedPage(pFixedPage), - m_pBmpConverter(pBmpConverter), - m_pRefConverter(pRefConverter), - m_bstrDictionaryURI(bstrResURI) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pFixedPage, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pRefConverter, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pBmpConverter, E_POINTER))) - { - if (m_bstrDictionaryURI.Length() == 0) - { - hr = E_INVALIDARG; - } - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CRemoteDictionary::~CRemoteDictionary - -Routine Description: - - Destructor for the CRemoteDictionary class - -Arguments: - - None - -Return Value: - - None - ---*/ -CRemoteDictionary::~CRemoteDictionary() -{ -} - -/*++ - -Routine Name: - - CRemoteDictionary::WriteData - -Routine Description: - - This method handles the parsing of a new dictionary and - the writing out the new dictionary - -Arguments: - - pWriter - Pointer to a stream to write the resource out to - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CRemoteDictionary::WriteData( - _In_ IPartBase* pResource, - _In_ IPrintWriteStream* pWriter - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pResource, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pWriter, E_POINTER))) - { - try - { - CComPtr pRead(NULL); - CComPtr pResDictPart(NULL); - CComPtr pReader(NULL); - - if (SUCCEEDED(hr = m_pFixedPage->GetPagePart(m_bstrDictionaryURI, &pRead)) && - SUCCEEDED(hr = pRead->QueryInterface(&pResDictPart)) && - SUCCEEDED(hr = pResDictPart->GetStream(&pReader))) - { - // - // Create a SAX handler to parse the markup in the fixed page - // - CCMSaxHandler cmSaxHndlr(pWriter, m_pBmpConverter, m_pRefConverter, NULL); - - // - // Set-up the SAX reader and begin parsing the mark-up - // - CComPtr pSaxRdr(NULL); - - if (SUCCEEDED(hr = pSaxRdr.CoCreateInstance(CLSID_SAXXMLReader60)) && - SUCCEEDED(hr = pSaxRdr->putContentHandler(&cmSaxHndlr))) - { - CComPtr pReadStreamToSeq(NULL); - - pReadStreamToSeq.Attach(new(std::nothrow) pfp::PrintReadStreamToSeqStream(pReader)); - - if (SUCCEEDED(hr = CHECK_POINTER(pReadStreamToSeq, E_OUTOFMEMORY))) - { - hr = pSaxRdr->parse(CComVariant(static_cast(pReadStreamToSeq))); - } - } - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CRemoteDictionary::GetKeyName - -Routine Description: - - Method to obtain a unique key for the resource being handled - -Arguments: - - pbstrKeyName - Pointer to a string to hold the generated key - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CRemoteDictionary::GetKeyName( - _Outptr_ BSTR* pbstrKeyName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrKeyName, E_POINTER))) - { - if (m_bstrDictionaryURI.Length() > 0) - { - *pbstrKeyName = NULL; - - // - // The full URI to the resource is a suitable key - // - if (SUCCEEDED(hr = m_bstrDictionaryURI.CopyTo(pbstrKeyName)) && - !*pbstrKeyName) - { - hr = E_OUTOFMEMORY; - } - } - else - { - hr = E_PENDING; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CRemoteDictionary::GetResURI - -Routine Description: - - Method to obtain the URI of the resource being handled - -Arguments: - - pbstrResURI - Pointer to a string to hold the resource URI - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CRemoteDictionary::GetResURI( - _Outptr_ BSTR* pbstrResURI - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrResURI, E_POINTER))) - { - *pbstrResURI = NULL; - - try - { - // - // Create a unique name for the dictionary for this print session - // - CStringXDW cstrURI; - cstrURI.Format(L"%s_%u.dict", static_cast(m_bstrDictionaryURI), GetUniqueNumber()); - - *pbstrResURI = cstrURI.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/color/dictionary.h b/print/XPSDrvSmpl/src/filters/color/dictionary.h deleted file mode 100644 index 42e4e974..00000000 --- a/print/XPSDrvSmpl/src/filters/color/dictionary.h +++ /dev/null @@ -1,65 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - dict.h - -Abstract: - - Dictionary class definition. The CRemoteDictionary class is responsible - for representing a single dictionay including managing any color - transforms in that dictionary and writing the dictionary out. - ---*/ - -#pragma once - -#include "colconv.h" - -class CRemoteDictionary : public IResWriter -{ -public: - CRemoteDictionary( - _In_ IFixedPage* pFixedPage, - _In_ CBitmapColorConverter* pBmpConverter, - _In_ CColorRefConverter* pRefConverter, - _In_ BSTR bstrResURI - ); - - ~CRemoteDictionary(); - - HRESULT - WriteData( - _In_ IPartBase* pResource, - _In_ IPrintWriteStream* pStream - ); - - HRESULT - GetKeyName( - _Outptr_ BSTR* pbstrKeyName - ); - - HRESULT - GetResURI( - _Outptr_ BSTR* pbstrResURI - ); - -private: - CComBSTR m_bstrDictionaryURI; - - CBitmapColorConverter* m_pBmpConverter; - - CColorRefConverter* m_pRefConverter; - - CComPtr m_pFixedPage; -}; - diff --git a/print/XPSDrvSmpl/src/filters/color/dllentry.cpp b/print/XPSDrvSmpl/src/filters/color/dllentry.cpp deleted file mode 100644 index fff45c12..00000000 --- a/print/XPSDrvSmpl/src/filters/color/dllentry.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - dllentry.cpp - -Abstract: - - Implementation of the color management filter dllentry points. Dllmain only - stores the instance handle. DllGetClassObject calls on to a generic - get class factory template function. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "clasfact.h" -#include "cmflt.h" -#include "xdexcept.h" -#include "xdstring.h" - -/*++ - -Routine Name: - - DllMain - -Routine Description: - - Entry point to the color management filter which is called when a new process is started - -Arguments: - - hInst - Handle to the DLL - wReason - Specifies a flag indicating why the DLL entry-point function is being called - -Return Value: - - TRUE - ---*/ -BOOL WINAPI -DllMain( - _In_ HINSTANCE hInst, - _In_ WORD wReason, - _In_opt_ LPVOID - ) -{ - switch (wReason) - { - case DLL_PROCESS_ATTACH: - { - g_hInstance = hInst; - } - break; - } - - return TRUE; -} - -/*++ - -Routine Name: - - DllCanUnloadNow - -Routine Description: - - Method which reports whether the DLL is in use to allow the caller to unload - the DLL safely - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - Dll can unload - S_FALSE - Dll can't unload - ---*/ -STDAPI -DllCanUnloadNow() -{ - if (g_cServerLocks == 0) - { - return S_OK ; - } - else - { - return S_FALSE; - } -} - -/*++ - -Routine Name: - - DllGetClassObject - -Routine Description: - - Method to return the current class object - -Arguments: - - rclsid - CLSID that will associate the correct data and code - riid - Reference to the identifier of the interface that the caller is to use to communicate with the class object - ppv - Address of pointer variable that receives the interface pointer requested in riid - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - CLASS_E_CLASSNOTAVAILABLE - On unsupported class - ---*/ -STDAPI -DllGetClassObject( - _In_ REFCLSID rclsid, - _In_ REFIID riid, - _Outptr_ LPVOID FAR* ppv - ) -{ - // - // 21934A6D-EA30-480a-8DAD-C8045807F737 - // - CLSID colorCLSID = {0x21934A6D, 0xEA30, 0x480a, {0x8D, 0xAD, 0xC8, 0x04, 0x58, 0x07, 0xF7, 0x37}}; - - return GetFilterClassFactory(rclsid, riid, colorCLSID, ppv); -} - diff --git a/print/XPSDrvSmpl/src/filters/color/precompsrc.cpp b/print/XPSDrvSmpl/src/filters/color/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/XPSDrvSmpl/src/filters/color/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/color/profile.cpp b/print/XPSDrvSmpl/src/filters/color/profile.cpp deleted file mode 100644 index e3a8368c..00000000 --- a/print/XPSDrvSmpl/src/filters/color/profile.cpp +++ /dev/null @@ -1,709 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - profile.cpp - -Abstract: - - Profile class implementation. The profile class is responsible for loading and maintaining - colo profile resources. The class provides methods for loading profiles from filename or - URI and is responsible for limited caching based off the file name and the (WCS)OpenProfile - options. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "profile.h" -#include "wcsapiconv.h" - -DWORD g_tagWCSProfile = 'MS00'; - -/*++ - -Routine Name: - - CProfile::CProfile - -Routine Description: - - CProfile constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CProfile::CProfile() : - m_hProfile(NULL), - m_dwDesiredAccess(PROFILE_READ), - m_dwShareMode(FILE_SHARE_READ), - m_dwCreationMode(OPEN_EXISTING), - m_dwWCSFlags(0) -{ -} - -/*++ - -Routine Name: - - CProfile::~CProfile - -Routine Description: - - CProfile destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CProfile::~CProfile() -{ - FreeProfile(); -} - -/*++ - -Routine Name: - - CProfile::SetProfile - -Routine Description: - - Sets the current profile from the fixed page using the specified resoure URI - -Arguments: - - pFP - Pointer to the fixed page interface - szURI - URI to the ICC profile to load - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfile::SetProfile( - _In_ IFixedPage* pFP, - _In_ LPCWSTR szURI - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFP, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(szURI, E_POINTER))) - { - try - { - CStringXDW cstrKey; - - if (SUCCEEDED(hr = CreateProfileKey(szURI, NULL, NULL, &cstrKey)) && - (m_hProfile == NULL || - m_cstrProfileKey != cstrKey)) - { - FreeProfile(); - - // - // Get the read stream for the URI - // - CComPtr pPart(NULL); - CComPtr pProfilePart(NULL); - CComPtr pRead(NULL); - CComBSTR bstrProfileURI(szURI); - - ULONGLONG cbEnd = 0; - - // - // Get the profile part and a read stream. Seek to the end to find the - // size of the profile data - // - if (SUCCEEDED(hr = pFP->GetPagePart(bstrProfileURI, &pPart)) && - SUCCEEDED(hr = pPart.QueryInterface(&pProfilePart)) && - SUCCEEDED(hr = pProfilePart->GetStream(&pRead)) && - SUCCEEDED(hr = pRead->Seek(0, STREAM_SEEK_END, &cbEnd))) - { - // - // Allocate the buffer and copy - // - UINT cbProfileData = static_cast(cbEnd); - PBYTE pProfileData = new(std::nothrow) BYTE[cbProfileData]; - - ULONG cbRead; - BOOL bEOF = FALSE; - if (SUCCEEDED(hr = CHECK_POINTER(pProfileData, E_OUTOFMEMORY)) && - SUCCEEDED(hr = pRead->Seek(0, STREAM_SEEK_SET, &cbEnd)) && - SUCCEEDED(hr = pRead->ReadBytes(pProfileData, cbProfileData, &cbRead, &bEOF))) - { - if (cbProfileData != cbRead) - { - RIP("Failed to read all profile data\n"); - - hr = E_FAIL; - } - } - - // - // Create the transform from the buffer - // - if (SUCCEEDED(hr)) - { - PROFILE profile = { - PROFILE_MEMBUFFER, - pProfileData, - cbProfileData - }; - - if (SUCCEEDED(hr = OpenProfile(&profile, &m_hProfile))) - { - m_cstrProfileKey = cstrKey; - } - } - - if (pProfileData != NULL) - { - delete[] pProfileData; - pProfileData = NULL; - } - } - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfile::SetProfile - -Routine Description: - - Sets a profile from the specified file name - -Arguments: - - szFileName - File name of the profile to open - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfile::SetProfile( - _In_ LPCWSTR szFileName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(szFileName, E_POINTER))) - { - try - { - CStringXDW cstrKey; - - if (SUCCEEDED(hr = CreateProfileKey(szFileName, NULL, NULL, &cstrKey)) && - (m_hProfile == NULL || - m_cstrProfileKey != cstrKey)) - { - FreeProfile(); - - CStringXDW profileFileName(szFileName); - PROFILE profile = { - PROFILE_FILENAME, - profileFileName.GetBuffer(), - profileFileName.GetLength() * sizeof(WCHAR) - }; - - if (SUCCEEDED(hr = OpenProfile(&profile, &m_hProfile))) - { - m_cstrProfileKey = cstrKey; - } - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfile::SetProfile - -Routine Description: - - Sets a color profile from memory - -Arguments: - - szProfile - Name of the profile. This is used for caching puproses - pBuffer - Buffer containing the profile data - cbBuffer - Size of the buffer - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfile::SetProfile( - _In_ LPWSTR szProfile, - _In_reads_bytes_(cbBuffer) PBYTE pBuffer, - _In_ UINT cbBuffer - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(szProfile, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pBuffer, E_POINTER))) - { - try - { - CStringXDW cstrKey; - - if (SUCCEEDED(hr = CreateProfileKey(szProfile, NULL, NULL, &cstrKey)) && - (m_hProfile == NULL || - m_cstrProfileKey != cstrKey)) - { - FreeProfile(); - - PROFILE profile = { - PROFILE_MEMBUFFER, - pBuffer, - cbBuffer - }; - - if (SUCCEEDED(hr = OpenProfile(&profile, &m_hProfile))) - { - m_cstrProfileKey = cstrKey; - } - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfile::GetProfileHandle - -Routine Description: - - Retrieves the current profile handle - -Arguments: - - phProfile - Pointer to a HPROFILE that accepts the current profile handle - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfile::GetProfileHandle( - _Out_ HPROFILE* phProfile - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(phProfile, E_POINTER))) - { - *phProfile = NULL; - if (SUCCEEDED(hr = CHECK_HANDLE(m_hProfile, E_PENDING))) - { - *phProfile = m_hProfile; - } - } - - ERR_ON_HR_EXC(hr, E_PENDING); - return hr; -} - -/*++ - -Routine Name: - - CProfile::IsWCSCompatible - -Routine Description: - - Checks if the current profile is suitable for use with WCS - -Arguments: - - pbWCSCompat - Pointer to BOOL the accepts the result - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfile::IsWCSCompatible( - _Out_ BOOL* pbWCSCompat - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbWCSCompat, E_POINTER)) && - SUCCEEDED(hr = CHECK_HANDLE(m_hProfile, E_PENDING))) - { - // - // Assume true as the GetColorProfileHeader documentation states: "This function - // does not support Windows Color System (WCS) profiles CAMP, DMP, and GMMP.", therefore - // if the profile is loaded and it is not ICC (i.e. no header) it should be WCS compatible - // - *pbWCSCompat = TRUE; - - PROFILEHEADER profileHeader = {0}; - if (GetColorProfileHeader(m_hProfile, &profileHeader)) - { - if (profileHeader.phClass == CLASS_LINK || - profileHeader.phClass == CLASS_NAMED) - { - *pbWCSCompat = FALSE; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CProfile::GetProfileKey - -Routine Description: - - Retrieves a key identifying the current profile. This is composed of the profile name - and the options used to create the profile - -Arguments: - - pcstrProfileKey - Pointer to a CStringXDW object that recieves the key - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfile::GetProfileKey( - _Out_ CStringXDW* pcstrProfileKey - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pcstrProfileKey, E_POINTER))) - { - try - { - *pcstrProfileKey = m_cstrProfileKey; - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfile::operator== - -Routine Description: - - CProfile equality operator - -Arguments: - - cstrProfileKey - the key to compare against - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -BOOL -CProfile::operator==( - _In_ CONST CStringXDW& cstrProfileKey - ) CONST -{ - BOOL bEqual = TRUE; - - try - { - if (m_cstrProfileKey != cstrProfileKey) - { - bEqual = FALSE; - } - } - catch (CXDException&) - { - bEqual = FALSE; - } - - return bEqual; -} - -/*++ - -Routine Name: - - CProfile::operator!= - -Routine Description: - - CProfile inequality operator - -Arguments: - - cstrProfileKey - profile key to compare against - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -BOOL -CProfile::operator!=( - _In_ CONST CStringXDW& cstrProfileKey - ) CONST -{ - return !operator==(cstrProfileKey); -} - -/*++ - -Routine Name: - - CProfile::FreeProfile - -Routine Description: - - Frees the current profile - -Arguments: - - None - -Return Value: - - None - ---*/ -VOID -CProfile::FreeProfile( - VOID - ) -{ - try - { - m_cstrProfileKey.Empty(); - } - catch (CXDException&) - { - } - - if (m_hProfile != NULL) - { - CloseColorProfile(m_hProfile); - m_hProfile = NULL; - } -} - -/*++ - -Routine Name: - - CProfile::OpenProfile - -Routine Description: - - Opens the current profile based off the current OS. Vista uses WCSOpenProfile while - earlier Windows use OpenProfile - -Arguments: - - pProfile - Pointer to the profile structure used to open the profile - phProfile - Pointer to a HPROFILE to recieve the opened profile handle - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfile::OpenProfile( - _In_ PROFILE* pProfile, - _Out_ HPROFILE* phProfile - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pProfile, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(phProfile, E_POINTER))) - { - // - // Get a handle to the color profile using WCS in Vista or the XP API in earlier operating systems - // - if (IsVista()) - { - *phProfile = WcsOpenColorProfileXD(pProfile, NULL, NULL, m_dwDesiredAccess, m_dwShareMode, m_dwCreationMode, m_dwWCSFlags); - } - else - { - *phProfile = OpenColorProfile(pProfile, m_dwDesiredAccess, m_dwShareMode, m_dwCreationMode); - } - - if (FAILED(CHECK_POINTER(*phProfile, E_POINTER))) - { - hr = GetLastErrorAsHResult(); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfile::CreateProfileKey - -Routine Description: - - Creates a profile key based on the possible profile names used to construct the - profile and the settings used to open the profile - -Arguments: - - - pszCDMP - Device model profile name - pszCAMP - Color adjustment model profile name - pszGMMP - Gamut model profile name - pcstrKey - Pointer to a CStringXDW that recieves the key - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfile::CreateProfileKey( - _In_ LPCWSTR pszCDMP, - _In_opt_ LPCWSTR pszCAMP, - _In_opt_ LPCWSTR pszGMMP, - _Out_ CStringXDW* pcstrKey - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pszCDMP, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcstrKey, E_POINTER))) - { - try - { - pcstrKey->Empty(); - pcstrKey->Append(pszCDMP); - - if (pszCAMP != NULL) - { - pcstrKey->Append(pszCAMP); - } - - if (pszGMMP != NULL) - { - pcstrKey->Append(pszGMMP); - } - - CStringXDW cstrOpenOptions; - cstrOpenOptions.Format(L"%x%x%x%x", m_dwDesiredAccess, m_dwShareMode, m_dwCreationMode, m_dwWCSFlags); - - pcstrKey->Append(cstrOpenOptions); - pcstrKey->MakeLower(); - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/color/profile.h b/print/XPSDrvSmpl/src/filters/color/profile.h deleted file mode 100644 index 46fa46fa..00000000 --- a/print/XPSDrvSmpl/src/filters/color/profile.h +++ /dev/null @@ -1,124 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - profile.h - -Abstract: - - Profile class definition. The profile class is responsible for loading and maintaining - colo profile resources. The class provides methods for loading profiles from filename or - URI and is responsible for limited caching based off the file name and the (WCS)OpenProfile - options. - ---*/ - -#pragma once - -class CProfile -{ -public: - CProfile(); - - ~CProfile(); - - HRESULT - SetProfile( - _In_ IFixedPage* pFP, - _In_ LPCWSTR szURI - ); - - HRESULT - SetProfile( - _In_ LPCWSTR szURI - ); - - HRESULT - SetProfile( - _In_ LPWSTR szProfile, - _In_reads_bytes_(cbBuffer) PBYTE pBuffer, - _In_ UINT cbBuffer - ); - - HRESULT - GetProfileHandle( - _Out_ HPROFILE* phProfile - ); - - HRESULT - IsWCSCompatible( - _Out_ BOOL* pbWCSCompat - ); - - HRESULT - GetProfileKey( - _Out_ CStringXDW* pcstrProfileURI - ); - - BOOL - operator==( - _In_ CONST CStringXDW& cstrProfileKey - ) CONST; - - BOOL - operator!=( - _In_ CONST CStringXDW& cstrProfileKey - ) CONST; - -private: - HRESULT - CreateProfileBuffer( - VOID - ); - - VOID - FreeProfile( - VOID - ); - - HRESULT - OpenProfile( - _In_ PROFILE* pProfile, - _Out_ HPROFILE* phProfile - ); - - HRESULT - CreateProfileKey( - _In_ LPCWSTR pszCDMP, - _In_opt_ LPCWSTR pszCAMP, - _In_opt_ LPCWSTR pszGMMP, - _Out_ CStringXDW* pcstrKey - ); - -private: - HPROFILE m_hProfile; - - DWORD m_dwDesiredAccess; - - DWORD m_dwShareMode; - - DWORD m_dwCreationMode; - - DWORD m_dwWCSFlags; - - // - // We define a key for a profile as the URI(s) plus any options used when - // creating the profile. This allows anything that uses this profile in - // combination with other profiles to identify the constituents of the - // transform and hence cache that transform without needing to store the - // profile handles. - // - // Note: Do not cache against the handle as handles can be re-used - // - CStringXDW m_cstrProfileKey; -}; - diff --git a/print/XPSDrvSmpl/src/filters/color/profman.cpp b/print/XPSDrvSmpl/src/filters/color/profman.cpp deleted file mode 100644 index 16ee9dc2..00000000 --- a/print/XPSDrvSmpl/src/filters/color/profman.cpp +++ /dev/null @@ -1,818 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - profman.cpp - -Abstract: - - Color profile class implementation. The CProfileManager class represents - a color profile and provides a transform from the system default profile - to the supplied profile. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "profman.h" - -using XDPrintSchema::PageSourceColorProfile::PageSourceColorProfileData; -using XDPrintSchema::PageSourceColorProfile::EProfileOption; -using XDPrintSchema::PageSourceColorProfile::RGB; -using XDPrintSchema::PageSourceColorProfile::CMYK; - -using XDPrintSchema::PageICMRenderingIntent::PageICMRenderingIntentData; -using XDPrintSchema::PageICMRenderingIntent::AbsoluteColorimetric; -using XDPrintSchema::PageICMRenderingIntent::RelativeColorimetric; -using XDPrintSchema::PageICMRenderingIntent::Photographs; -using XDPrintSchema::PageICMRenderingIntent::BusinessGraphics; - - -/*++ - -Routine Name: - - CProfileManager::CProfileManager - -Routine Description: - - Constructor for the CProfileManager class which records internally the device name, - color profile structure, color intents data and initialises the CProfileManager - ready to supply suitable color transforms - -Arguments: - - pszDeviceName - Pointer to a string containing the device name - cmProfData - Structure containing color profile settings from the PrintTicket - cmIntData - Structure containing color intents settings from the PrintTicket - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CProfileManager::CProfileManager( - _In_ LPCWSTR pszDeviceName, - _In_ PageSourceColorProfileData cmProfData, - _In_ PageICMRenderingIntentData cmIntData, - _In_ IFixedPage* pFP - ) : - m_strDeviceName(pszDeviceName), - m_cmProfData(cmProfData), - m_cmIntData(cmIntData), - m_pFixedPage(pFP) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pszDeviceName, E_POINTER)) || - SUCCEEDED(hr = CHECK_POINTER(m_pFixedPage, E_POINTER))) - { - if(m_strDeviceName.GetLength() <= 0) - { - hr = E_INVALIDARG; - } - } - - if (FAILED(hr)) - { - throw CXDException(E_INVALIDARG); - } -} - -/*++ - -Routine Name: - - CProfileManager::~CProfileManager - -Routine Description: - - Default destructor for the CProfileManager class which performs and clean up - -Arguments: - - None - -Return Value: - - None - ---*/ -CProfileManager::~CProfileManager() -{ -} - -/*++ - -Routine Name: - - CProfileManager::GetColorTransform - -Routine Description: - - Method which supplies a color transform based on the settings in the PrintTicket - -Arguments: - - phColorTrans - Pointer to a color transform handle which will contain - a transform based off the settings in the PrintTicket - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfileManager::GetColorTransform( - _Out_ HTRANSFORM* phColorTrans, - _Out_ BOOL* pbUseWCS - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbUseWCS, E_POINTER)) && - SUCCEEDED(hr = CHECK_HANDLE(phColorTrans, E_POINTER)) && - SUCCEEDED(hr = m_dstProfile.SetProfile(m_cmProfData.cmProfileName))) - { - *pbUseWCS = IsVista(); - - try - { - // - // Construct and populate a profile list for the transform object - // - ProfileList profileList; - - // - // Check the source profile has been set. GetProfileHandle will return an error - // if it has not been. - // - HPROFILE hProfile = NULL; - if (SUCCEEDED(hr = m_srcProfile.GetProfileHandle(&hProfile))) - { - profileList.push_back(&m_srcProfile); - profileList.push_back(&m_dstProfile); - - // - // Map the PrintTicket intents option to the ICM option - // - DWORD intents = INTENT_ABSOLUTE_COLORIMETRIC; - switch (m_cmIntData.cmOption) - { - case AbsoluteColorimetric: - { - intents = INTENT_ABSOLUTE_COLORIMETRIC; - } - break; - - case RelativeColorimetric: - { - intents = INTENT_RELATIVE_COLORIMETRIC; - } - break; - - case Photographs: - { - intents = INTENT_PERCEPTUAL; - } - break; - - case BusinessGraphics: - default: - { - intents = INTENT_SATURATION; - } - break; - } - - DWORD flRender = BEST_MODE; - - // - // Check if the source and destination profiles are compatible with WCS - // - if (*pbUseWCS && - SUCCEEDED(hr = m_srcProfile.IsWCSCompatible(pbUseWCS))) - { - if (*pbUseWCS) - { - hr = m_dstProfile.IsWCSCompatible(pbUseWCS); - } - } - - if (SUCCEEDED(hr) && - *pbUseWCS) - { - // - // Everything is in place for using WCS - // - flRender |= WCS_ALWAYS; - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = m_colorTrans.CreateTransform(&profileList, intents, flRender))) - { - hr = m_colorTrans.GetTransformHandle(phColorTrans); - } - } - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfileManager::GetDstProfileType - -Routine Description: - - Method to return the color profile type as read from the PrintTicket - -Arguments: - - pType - Pointer to the profile type to be filled in - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfileManager::GetDstProfileType( - _Out_ EProfileOption* pType - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pType, E_POINTER))) - { - *pType = m_cmProfData.cmProfile; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfileManager::GetDstProfileName - -Routine Description: - - Method which returns the systems default colour profile name - -Arguments: - - pbstrProfileName - Pointer to string to hold the profile name - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfileManager::GetDstProfileName( - _Inout_ BSTR* pbstrProfileName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrProfileName, E_POINTER))) - { - try - { - CStringXDW cstrURI; - - if (m_cmProfData.cmProfile == RGB || - m_cmProfData.cmProfile == CMYK) - { - if (SUCCEEDED(hr = GetColDir(&cstrURI))) - { - cstrURI += L"\\"; - cstrURI += m_cmProfData.cmProfileName; - } - } - else - { - hr = E_NOTIMPL; - } - SysFreeString(*pbstrProfileName); - *pbstrProfileName = cstrURI.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfileManager::SetSrcProfileFromContainer - -Routine Description: - - Method which sets the source colour profile from a profile within the - XPS container - -Arguments: - - pszProfileURI - Pointer to string holding the profile URI - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfileManager::SetSrcProfileFromContainer( - _In_ LPWSTR szProfileURI - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(szProfileURI, E_POINTER))) - { - hr = m_srcProfile.SetProfile(m_pFixedPage, szProfileURI); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfileManager::SetSrcProfileFromColDir - -Routine Description: - - Method which sets the source colour profile from the color directory - -Arguments: - - pszProfile - Pointer to string holding the profile name - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfileManager::SetSrcProfileFromColDir( - _In_ LPWSTR szProfile - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(szProfile, E_POINTER))) - { - hr = SetProfileFromColDir(&m_srcProfile, szProfile); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfileManager::SetSrcProfileFromBuffer - -Routine Description: - - Method which sets the source colour profile from a buffer - -Arguments: - - pszProfile - Pointer to string holding the profile name - pBuffer - Pointer to buffer holding the profile data - cbBuffer - Count of bytes in the profile buffer - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfileManager::SetSrcProfileFromBuffer( - _In_ LPWSTR szProfile, - _In_reads_bytes_(cbBuffer) PBYTE pBuffer, - _In_ UINT cbBuffer - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(szProfile, E_POINTER)) || - SUCCEEDED(hr = CHECK_POINTER(pBuffer, E_POINTER))) - { - hr = m_srcProfile.SetProfile(szProfile, pBuffer, cbBuffer); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfileManager::GetProfileOption - -Routine Description: - - This method retrieves the profile option set in the PrintTicket - -Arguments: - - pProfileOption - Pointer to a profile option enumeration type to recieve the option - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfileManager::GetProfileOption( - _Out_ EProfileOption* pProfileOption - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pProfileOption, E_POINTER))) - { - *pProfileOption = m_cmProfData.cmProfile; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfileManager::WriteData - -Routine Description: - - This method handles writing the destination profile to the container - -Arguments: - - pStream - Pointer to a stream to write the resource out to - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfileManager::WriteData( - _In_ IPartBase* pResource, - _In_ IPrintWriteStream* pStream - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pResource, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pStream, E_POINTER))) - { - HANDLE hFile = INVALID_HANDLE_VALUE; - - // - // Open the destination profile file from disk. We could use the - // handle however we do not know whether we will get the ICC or DMP. - // - CComBSTR bstrProfile; - if (SUCCEEDED(hr = GetDstProfileName(&bstrProfile))) - { - hFile = CreateFile(bstrProfile, - GENERIC_READ, - FILE_SHARE_READ, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (hFile == INVALID_HANDLE_VALUE) - { - hr = GetLastErrorAsHResult(); - } - } - - if (SUCCEEDED(hr)) - { - // - // Write profile data to stream - // - PBYTE pBuff = new(std::nothrow) BYTE[CB_COPY_BUFFER]; - hr = CHECK_POINTER(pBuff, E_OUTOFMEMORY); - - DWORD cbRead = 0; - - while (SUCCEEDED(hr)) - { - if (ReadFile(hFile, pBuff, CB_COPY_BUFFER, &cbRead, NULL)) - { - if (cbRead > 0) - { - ULONG cbWritten = 0; - hr = pStream->WriteBytes(reinterpret_cast(pBuff), cbRead, &cbWritten); - - if (cbRead != cbWritten) - { - RIP("Failed to write all profile data.\n"); - - hr = E_FAIL; - } - } - else - { - break; - } - } - else - { - hr = GetLastErrorAsHResult(); - } - } - - delete[] pBuff; - pBuff = NULL; - } - - if (hFile != INVALID_HANDLE_VALUE) - { - CloseHandle(hFile); - hFile = INVALID_HANDLE_VALUE; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfileManager::GetKeyName - -Routine Description: - - Method to obtain a unique key for the resource being handled - -Arguments: - - pbstrKeyName - Pointer to a string to hold the generated key - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfileManager::GetKeyName( - _Inout_ _At_(*pbstrKeyName, _Pre_maybenull_ _Post_valid_) BSTR* pbstrKeyName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrKeyName, E_POINTER))) - { - SysFreeString(*pbstrKeyName); - - if (SUCCEEDED(hr = m_cmProfData.cmProfileName.CopyTo(pbstrKeyName)) && - !*pbstrKeyName) - { - hr = E_OUTOFMEMORY; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfileManager::GetResURI - -Routine Description: - - Method to obtain the URI of the resource being handled - -Arguments: - - pbstrResURI - Pointer to a string to hold the resource URI - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfileManager::GetResURI( - _Outptr_ BSTR* pbstrResURI - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrResURI, E_POINTER))) - { - try - { - CStringXDW cstrFileName(m_cmProfData.cmProfileName); - CStringXDW cstrFileExt(PathFindExtension(cstrFileName)); - - INT indFileExt = cstrFileName.Find(cstrFileExt); - - if (indFileExt > -1) - { - cstrFileName.Delete(indFileExt, cstrFileExt.GetLength()); - } - - // - // Create a unique name for the profile for this print session - // - CStringXDW cstrURI; - cstrURI.Format(L"/%s_%u%s", static_cast(cstrFileName), GetUniqueNumber(), static_cast(cstrFileExt)); - - *pbstrResURI = cstrURI.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfileManager::SetProfileFromColDir - -Routine Description: - - Set the named profile from the color directory. The method appends the specified - file name to the color directory path and instructs the profile class to open the - profile - -Arguments: - - pProfile - Pointer to the profile class that actually opens the profile - szProfile - The profile file name - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfileManager::SetProfileFromColDir( - _In_ CProfile* pProfile, - _In_ LPWSTR szProfile - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pProfile, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(szProfile, E_POINTER))) - { - try - { - CStringXDW cstrProfile; - - if (SUCCEEDED(hr = GetColDir(&cstrProfile))) - { - cstrProfile += L"\\"; - cstrProfile += szProfile; - - hr = pProfile->SetProfile(cstrProfile.GetBuffer()); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CProfileManager::GetColDir - -Routine Description: - - Retrieves the color directory path - -Arguments: - - pcstrColDir - Pointer to a string class that accepts the color directory path - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CProfileManager::GetColDir( - _Out_ CStringXDW* pcstrColDir - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pcstrColDir, E_POINTER))) - { - try - { - pcstrColDir->Empty(); - DWORD cbColDir = 0; - if (!GetColorDirectory(NULL, NULL, &cbColDir)) - { - pcstrColDir->Preallocate(cbColDir/sizeof(WCHAR)); - if (!GetColorDirectory(NULL, pcstrColDir->GetBuffer(), &cbColDir)) - { - hr = GetLastErrorAsHResult(); - } - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/color/profman.h b/print/XPSDrvSmpl/src/filters/color/profman.h deleted file mode 100644 index 4246a0c2..00000000 --- a/print/XPSDrvSmpl/src/filters/color/profman.h +++ /dev/null @@ -1,126 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - profman.h - -Abstract: - - Color profile manager definition. The CProfileManager class is responsible - for managing the color profile set in the driver. - ---*/ - -#pragma once - -#include "cmprofiledata.h" -#include "cmintentsdata.h" -#include "rescache.h" -#include "transform.h" - -class CProfileManager : public IResWriter -{ -public: - CProfileManager( - _In_ LPCWSTR pszDeviceName, - _In_ XDPrintSchema::PageSourceColorProfile::PageSourceColorProfileData cmProfData, - _In_ XDPrintSchema::PageICMRenderingIntent::PageICMRenderingIntentData cmIntData, - _In_ IFixedPage* pFP - ); - - virtual ~CProfileManager(); - - HRESULT - GetColorTransform( - _Out_ HTRANSFORM* phColorTrans, - _Out_ BOOL* pbUseWCS - ); - - HRESULT - GetDstProfileType( - _Out_ XDPrintSchema::PageSourceColorProfile::EProfileOption* pType - ); - - HRESULT - GetDstProfileName( - _Inout_ BSTR* pbstrProfileName - ); - - HRESULT - SetSrcProfileFromContainer( - _In_ LPWSTR szProfileURI - ); - - HRESULT - SetSrcProfileFromColDir( - _In_ LPWSTR szProfile - ); - - HRESULT - SetSrcProfileFromBuffer( - _In_ LPWSTR szProfile, - _In_reads_bytes_(cbBuffer) PBYTE pBuffer, - _In_ UINT cbBuffer - ); - - HRESULT - GetProfileOption( - _Out_ XDPrintSchema::PageSourceColorProfile::EProfileOption* pProfileOption - ); - - // - // IResWriter interface - // - HRESULT - WriteData( - _In_ IPartBase* pResource, - _In_ IPrintWriteStream* pStream - ); - - HRESULT - GetKeyName( - _Inout_ _At_(*pbstrKeyName, _Pre_maybenull_ _Post_valid_) BSTR* pbstrKeyName - ); - - HRESULT - GetResURI( - _Outptr_ BSTR* pbstrResURI - ); - -private: - HRESULT - SetProfileFromColDir( - _In_ CProfile* pProfile, - _In_ LPWSTR szProfile - ); - - HRESULT - GetColDir( - _Out_ CStringXDW* pcstrColDir - ); - -private: - CStringXDW m_strDeviceName; - - XDPrintSchema::PageSourceColorProfile::PageSourceColorProfileData m_cmProfData; - - XDPrintSchema::PageICMRenderingIntent::PageICMRenderingIntentData m_cmIntData; - - CProfile m_srcProfile; - - CProfile m_dstProfile; - - CTransform m_colorTrans; - - CComPtr m_pFixedPage; -}; - diff --git a/print/XPSDrvSmpl/src/filters/color/scaniter.cpp b/print/XPSDrvSmpl/src/filters/color/scaniter.cpp deleted file mode 100644 index 541554ab..00000000 --- a/print/XPSDrvSmpl/src/filters/color/scaniter.cpp +++ /dev/null @@ -1,604 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - scaniter.cpp - -Abstract: - - CScanIterator class implementation. The scan iterator class provides a convenient - interface for iterating over WIC data and retrieving scanline data approriate for - consumption in WCS/ICM. For example, the WIC pixel formats do not have alpha channel - positions that correspond with the WCS/ICM BMFORMAT types so this class is responsible - for presenting bitmap data without the alpha channel and for copying alpha data from - source to destination when scnaline changes are commited to the underlying WIC bitmap. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "xdexcept.h" -#include "globals.h" -#include "scaniter.h" - -/*++ - -Routine Name: - - CScanIterator::CScanIterator - -Routine Description: - - CScanIterator constructor - -Arguments: - - - bmpConv - Bitmap converter class encapsulating the underlying WIC bitmap - pRect - The rectangular area of the bitmap over which we want to iterate scanlines - -Return Value: - - None - Throws an exception on error. - ---*/ -CScanIterator::CScanIterator( - _In_ CONST CBmpConverter& bmpConv, - _In_opt_ WICRect* pRect - ) : - CBmpConverter(bmpConv), - m_bSrcLine(TRUE), - m_cbWICStride(0), - m_cWICWidth(0), - m_cWICHeight(0), - m_cbWICData(0), - m_pbWICData(NULL) -{ - HRESULT hr = S_OK; - - UINT cWidth = 0; - UINT cHeight = 0; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pBitmap, E_POINTER)) && - SUCCEEDED(hr = m_pBitmap->GetSize(&cWidth, &cHeight))) - { - if (pRect == NULL) - { - // - // We want to iterate over the entire surface - // - m_rectTotal.X = 0; - m_rectTotal.Y = 0; - m_rectTotal.Width = static_cast(cWidth); - m_rectTotal.Height = static_cast(cHeight); - } - else - { - if (pRect->X >= 0 && - pRect->Y >= 0 && - pRect->Width <= static_cast(cWidth) && - pRect->Height <= static_cast(cHeight)) - { - m_rectTotal = *pRect; - } - else - { - hr = E_INVALIDARG; - } - } - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CScanIterator::~CScanIterator - -Routine Description: - - CScanIterator destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CScanIterator::~CScanIterator() -{ - UnlockSurface(); -} - -/*++ - -Routine Name: - - CScanIterator::Initialize - -Routine Description: - - Initialize the iterator. Here we are going to: - - 1. Convert to a suitable WIC format for processing - 2. Allocate an intermediate color buffer (if required) for processing - 3. Allocate an intermediate alpha buffer (if required) for processing - 4. Reset and lock the iterator rect ready for processing - -Arguments: - - bSrcLine - true if this is a source scanline (i.e. read only) - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CScanIterator::Initialize( - _In_ CONST BOOL& bSrcLine - ) -{ - HRESULT hr = S_OK; - m_bSrcLine = bSrcLine; - - // - // Look up the pixel format to convert to so that the bitmap is appropriate - // for consumption by WCS/ICM. - // - // Note: we are not dealing with the limitations of ICM downlevel. Downlevel - // we need to convert floating and fixed point values to values appropriate - // to ICM then back again before writing out so the underlying bitmap type is - // unmodified. - // - EWICPixelFormat eConversionFormat = kWICPixelFormatDontCare; - if (m_ePixelFormat > 0 && - m_ePixelFormat < kWICPixelFormatMax) - { - eConversionFormat = g_lutWICToBMFormat[m_ePixelFormat].m_pixFormTarget; - } - else - { - RIP("Unrecognised pixel format.\n"); - hr = E_FAIL; - } - - // - // Apply the conversion if required - // - BOOL bCanConvert = FALSE; - if (eConversionFormat != m_ePixelFormat && - SUCCEEDED(hr) && - SUCCEEDED(hr = Convert(eConversionFormat, &bCanConvert))) - { - if (!bCanConvert) - { - RIP("Cannot convert to target type.\n"); - hr = E_FAIL; - } - } - - // - // Set the current iteration data ready for processing - // - if (SUCCEEDED(hr)) - { - // - // Ensure the iterator is reset to the start of the area to be processed. This - // ensures that the current rect lock is valid so that we can initialise the - // first scanline to process - // - Reset(); - - // - // Initialise the WIC <-> BM scan line converter - // - if (SUCCEEDED(hr = m_currScan.Initialize(g_lutWICToBMFormat[m_ePixelFormat]))) - { - hr = SetCurrentIterationData(); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CScanIterator::Reset - -Routine Description: - - Resets the current rect to the first scanline in the buffer. - -Arguments: - - None - -Return Value: - - None - ---*/ -VOID -CScanIterator::Reset( - VOID - ) -{ - m_rectCurrLock.X = m_rectTotal.X; - m_rectCurrLock.Y = m_rectTotal.Y; - m_rectCurrLock.Width = m_rectTotal.Width; - m_rectCurrLock.Height = 1; -} - -/*++ - -Routine Name: - - CScanIterator::operator++ - -Routine Description: - - Iterate to the next scan line. - -Arguments: - - None - -Return Value: - - Reference to this iterator - ---*/ -CScanIterator& -CScanIterator::operator++(INT) -{ - HRESULT hr = S_OK; - - m_rectCurrLock.Y++; - if (!Finished()) - { - if (FAILED(hr = SetCurrentIterationData())) - { - throw CXDException(hr); - } - } - - return *this; -} - -/*++ - -Routine Name: - - CScanIterator::GetScanBuffer - -Routine Description: - - Retrieves the scanline buffer appropriate for WCS/ICM consumption - -Arguments: - - ppData - Pointer to pointer that recieves the address of the data buffer - Note: the buffer is only valid for the lifetime of the CScanIterator object. - pBmFormat - Pointer to a BMFORMAT enumeration that recieves the format - pcWidth - Pointer to storage that recieves the pixel width - pcHeight - Pointer to storage that recieves the pixel height - pcbStride - Pointer to storage that recieves the stride - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CScanIterator::GetScanBuffer( - _Outptr_result_buffer_(*pcbStride) PBYTE* ppData, - _Out_ BMFORMAT* pBmFormat, - _Out_ UINT* pcWidth, - _Out_ UINT* pcHeight, - _Out_ UINT* pcbStride - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pBmFormat, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcWidth, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcHeight, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcbStride, E_POINTER))) - { - *ppData = NULL; - *pcWidth = 0; - *pcHeight = 1; - *pcbStride = 0; - *pBmFormat = BM_RGBTRIPLETS; - - // - // Get the data from the WIC <-> BMFORMAT scanline converter - // - hr = m_currScan.GetData(ppData, pBmFormat, pcWidth, pcbStride); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CScanIterator::Commit - -Routine Description: - - Commits the current color buffer to the surface if required and applies an optional alpha - channel passed in from a source iterator - -Arguments: - - alphaSource - Scan iterator instance with any potential alpha data to copy - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CScanIterator::Commit( - _In_ CONST CScanIterator& alphaSource - ) -{ - HRESULT hr = S_OK; - - COLORDATATYPE srcDataType = COLOR_BYTE; - COLORDATATYPE dstDataType = COLOR_BYTE; - - if (m_bSrcLine) - { - RIP("Cannot commit to readonly surface.\n"); - - hr = E_FAIL; - } - else if (alphaSource.m_ePixelFormat >= kWICPixelFormatMax || - alphaSource.m_ePixelFormat < kWICPixelFormatMin || - m_ePixelFormat >= kWICPixelFormatMax || - m_ePixelFormat < kWICPixelFormatMin) - { - RIP("Invalid pixel format.\n"); - - hr = E_FAIL; - } - else - { - srcDataType = g_lutWICToBMFormat[alphaSource.m_ePixelFormat].m_colDataType; - dstDataType = g_lutWICToBMFormat[m_ePixelFormat].m_colDataType; - - if (srcDataType > COLOR_S2DOT13FIXED || - srcDataType < COLOR_BYTE || - dstDataType > COLOR_S2DOT13FIXED || - dstDataType < COLOR_BYTE) - { - RIP("Invalid data type.\n"); - - hr = E_FAIL; - } - } - - if (SUCCEEDED(hr) && - alphaSource.HasAlphaChannel() && - HasAlphaChannel()) - { - // - // Convert and copy alpha data into destination - // - PBYTE pDst = m_pbWICData; - size_t cbDstChannel = g_lutColorDataSize[dstDataType]; - size_t cbDstAlphaOffset = g_lutWICToBMFormat[m_ePixelFormat].m_cAlphaOffset * cbDstChannel; - UINT cDstChannels = g_lutWICToBMFormat[m_ePixelFormat].m_cChannels; - - PBYTE pSrc = alphaSource.m_pbWICData; - size_t cbSrcChannel = g_lutColorDataSize[srcDataType]; - size_t cbSrcAlphaOffset = g_lutWICToBMFormat[alphaSource.m_ePixelFormat].m_cAlphaOffset * cbSrcChannel; - UINT cSrcChannels = g_lutWICToBMFormat[alphaSource.m_ePixelFormat].m_cChannels; - - if (m_cWICWidth * cDstChannels * cbDstChannel <= m_cbWICStride && - alphaSource.m_cWICWidth * cSrcChannels * cbSrcChannel <= alphaSource.m_cbWICStride) - { - // - // Move the source and destination to the first alpha channel - // - pDst += cbDstAlphaOffset; - pSrc += cbSrcAlphaOffset; - - // - // Call the appropriate convert copy function by casting the src pointer - // to the underlying data type - // - switch (srcDataType) - { - case COLOR_BYTE: - hr = ConvertCopyAlphaChannels(reinterpret_cast(pSrc), - m_cWICWidth, - cSrcChannels, - dstDataType, - pDst, - m_cWICWidth, - cDstChannels); - break; - - case COLOR_WORD: - hr = ConvertCopyAlphaChannels(reinterpret_cast(pSrc), - m_cWICWidth, - cSrcChannels, - dstDataType, - pDst, - m_cWICWidth, - cDstChannels); - break; - - case COLOR_FLOAT: - hr = ConvertCopyAlphaChannels(reinterpret_cast(pSrc), - m_cWICWidth, - cSrcChannels, - dstDataType, - pDst, - m_cWICWidth, - cDstChannels); - break; - - case COLOR_S2DOT13FIXED: - hr = ConvertCopyAlphaChannels(reinterpret_cast(pSrc), - m_cWICWidth, - cSrcChannels, - dstDataType, - pDst, - m_cWICWidth, - cDstChannels); - break; - - default: - { - RIP("Unrecognized source format.\n"); - - hr = E_FAIL; - } - break; - } - } - else - { - RIP("Insufficient buffer sizes.\n"); - - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - - // - // Commit the scanline - // - if (SUCCEEDED(hr)) - { - hr = m_currScan.Commit(m_pbWICData, m_cbWICStride); - } - - // - // Release the lock - // - UnlockSurface(); - - m_cbWICStride = 0; - m_cWICWidth = 0; - m_cWICHeight = 0; - m_cbWICData = 0; - m_pbWICData = NULL; - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CScanIterator::Finished - -Routine Description: - - We are done once all scanlines have been processed. - -Arguments: - - None - -Return Value: - - TRUE - We have iterated over all requested scanlines - FALSE - There are scanlines remaining - ---*/ -BOOL -CScanIterator::Finished( - VOID - ) -{ - return m_rectCurrLock.Y >= (m_rectTotal.Y + m_rectTotal.Height); -} - -/*++ - -Routine Name: - - CScanIterator::SetCurrentIterationData - -Routine Description: - - Sets up the current iteration data by locking the relevant area of the WIC bitmap - source and getting the WIC to BMFORMAT converter class to apply any conversion required - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CScanIterator::SetCurrentIterationData( - VOID - ) -{ - HRESULT hr = S_OK; - - m_cbWICStride = 0; - m_cWICWidth = 0; - m_cWICHeight = 0; - m_cbWICData = 0; - m_pbWICData = NULL; - - if (SUCCEEDED(hr = LockSurface(&m_rectCurrLock, - m_bSrcLine, - &m_cbWICStride, - &m_cWICWidth, - &m_cWICHeight, - &m_cbWICData, - &m_pbWICData)) && - SUCCEEDED(hr = CHECK_POINTER(m_pbWICData, E_FAIL))) - { - hr = m_currScan.SetData(m_bSrcLine, m_pbWICData, m_cbWICStride, m_cWICWidth); - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/color/scaniter.h b/print/XPSDrvSmpl/src/filters/color/scaniter.h deleted file mode 100644 index de4b725e..00000000 --- a/print/XPSDrvSmpl/src/filters/color/scaniter.h +++ /dev/null @@ -1,218 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - scaniter.h - -Abstract: - - CScanIterator class definition. The scan iterator class provides a convenient - interface for iterating over WIC data and retrieving scanline data approriate for - consumption in WCS/ICM. For example, the WIC pixel formats do not have alpha channel - positions that correspond with the WCS/ICM BMFORMAT types so this class is responsible - for presenting bitmap data without the alpha channel and for copying alpha data from - source to destination when scnaline changes are commited to the underlying WIC bitmap. - ---*/ - -#pragma once - -#include "bmpconv.h" -#include "wictobmscn.h" - -/* -Iterates through all scanlines in a bitmap creating a buffer appropriate -to color modification. These are: - - RGB channels (in that order) as byte, word, float or fixed - no alpha - CMYK channels (order as the source bitmap) as byte, word, float or fixed - no alpha - nChannel (order as the source bitmap) as byte - no alpha - -*/ -class CScanIterator : public CBmpConverter -{ -public: - CScanIterator( - _In_ CONST CBmpConverter& bmpConv, - _In_opt_ WICRect* pRect - ); - - virtual ~CScanIterator(); - - HRESULT - Initialize( - _In_ CONST BOOL& bReadOnly - ); - - VOID - Reset( - VOID - ); - - CScanIterator& - operator++( - INT - ); - - virtual HRESULT - GetScanBuffer( - _Outptr_result_buffer_(*pcbStride) PBYTE* ppData, - _Out_ BMFORMAT* pBmFormat, - _Out_ UINT* pcWidth, - _Out_ UINT* pcHeight, - _Out_ UINT* pcbStride - ); - - HRESULT - Commit( - _In_ CONST CScanIterator& cbAlphaBuffer - ); - - BOOL - Finished( - VOID - ); - -private: - HRESULT - SetCurrentIterationData( - VOID - ); - - template - HRESULT - ConvertCopyAlphaChannels( - _In_reads_(cSrcPix) _T* pSrc, - _In_ CONST UINT& cSrcPix, - _In_ CONST UINT& cSrcChan, - _Out_writes_(cDstPix) _U* pDst, - _In_ CONST UINT& cDstPix, - _In_ CONST UINT& cDstChan - ) - { - HRESULT hr = S_OK; - - if (cDstPix == cSrcPix) - { - for (UINT cCurPix = 0; - cCurPix < cDstPix; - cCurPix++, pSrc += cSrcChan, pDst += cDstChan) - { - ConvertCopy(*pDst, *pSrc); - } - } - else - { - hr = E_INVALIDARG; - } - - ERR_ON_HR(hr); - return hr; - } - - template - HRESULT - ConvertCopyAlphaChannels( - _In_reads_(cSrcPix) _T* pSrc, - _In_ CONST UINT& cSrcPix, - _In_ CONST UINT& cSrcChan, - _In_ CONST COLORDATATYPE& dstColType, - _When_(dstColType == COLOR_BYTE, _Out_writes_bytes_(cDstPix)) - _When_(dstColType == COLOR_WORD, _At_((PWORD)pDst, _Out_writes_(cDstPix))) - _When_(dstColType == COLOR_FLOAT, _At_((PFLOAT)pDst, _Out_writes_bytes_(cDstPix * sizeof(FLOAT)))) // Esp:1154 - _When_(dstColType == COLOR_S2DOT13FIXED, _At_((PS2DOT13FIXED)pDst, _Out_writes_(cDstPix))) - PBYTE pDst, - _In_ CONST UINT& cDstPix, - _In_ CONST UINT& cDstChan - ) - { - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pSrc, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDst, E_POINTER))) - { - // - // Call the appropriate convert copy function by casting the dst pointer - // to the underlying data type - // - switch (dstColType) - { - case COLOR_BYTE: - hr = ConvertCopyAlphaChannels(reinterpret_cast<_T*>(pSrc), - cSrcPix, - cSrcChan, - reinterpret_cast(pDst), - cDstPix, - cDstChan); - break; - - case COLOR_WORD: - hr = ConvertCopyAlphaChannels(reinterpret_cast<_T*>(pSrc), - cSrcPix, - cSrcChan, - reinterpret_cast(pDst), - cDstPix, - cDstChan); - break; - - case COLOR_FLOAT: - hr = ConvertCopyAlphaChannels(reinterpret_cast<_T*>(pSrc), - cSrcPix, - cSrcChan, - reinterpret_cast(pDst), - cDstPix, - cDstChan); - break; - - case COLOR_S2DOT13FIXED: - hr = ConvertCopyAlphaChannels(reinterpret_cast<_T*>(pSrc), - cSrcPix, - cSrcChan, - reinterpret_cast(pDst), - cDstPix, - cDstChan); - break; - - default: - { - RIP("Unrecognized destination format.\n"); - - hr = E_INVALIDARG; - } - break; - } - } - - ERR_ON_HR(hr); - return hr; - } - -private: - WICRect m_rectTotal; - - WICRect m_rectCurrLock; - - BOOL m_bSrcLine; - - CWICToBMFormatScan m_currScan; - - UINT m_cbWICStride; - - UINT m_cWICWidth; - - UINT m_cWICHeight; - - UINT m_cbWICData; - - PBYTE m_pbWICData; -}; - diff --git a/print/XPSDrvSmpl/src/filters/color/transform.cpp b/print/XPSDrvSmpl/src/filters/color/transform.cpp deleted file mode 100644 index adbf5b45..00000000 --- a/print/XPSDrvSmpl/src/filters/color/transform.cpp +++ /dev/null @@ -1,666 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - transform.cpp - -Abstract: - - CTransform class implementation. This class creates and manages color transforms providing - limited caching functionality based off the source profile keys. - - This file also contains a utility class for handling profile lists. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "transform.h" - -class CProfileList -{ -public: - /*++ - - Routine Name: - - CProfileList - - Routine Description: - - CProfileList constructor - - Arguments: - - pProfiles - pointer to a vector of profiles - - Return Value: - - None - Throws an exception on error. - - --*/ - CProfileList( - _In_ ProfileList* pProfiles - ) : - m_cProfiles(0), - m_phProfiles(NULL) - { - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pProfiles, E_POINTER))) - { - hr = CreateHandleBuffer(pProfiles); - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } - } - - /*++ - - Routine Name: - - ~CProfileList - - Routine Description: - - CProfileList destructor - - Arguments: - - None - - Return Value: - - None - - --*/ - ~CProfileList() - { - FreeHandleBuffer(); - } - - /*++ - - Routine Name: - - GetProfileData - - Routine Description: - - Retrieves - - Arguments: - - pphProfiles - Pointer to pointer that recieves the address of an array of profile handles - Note: the buffer is only valid for the lifetime of the CProfileList object. - pcProfiles - Pointer to storage that recieves the count of profiles in the array - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT - GetProfileData( - _When_(*pcProfiles > 0, _Outptr_result_buffer_(*pcProfiles)) - _When_(*pcProfiles == 0, _Outptr_result_maybenull_) - HPROFILE** pphProfiles, - _Out_ DWORD* pcProfiles - ) - { - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pphProfiles, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcProfiles, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_phProfiles, E_PENDING))) - { - *pphProfiles = 0; - *pcProfiles = 0; - - if (m_cProfiles > 0) - { - *pphProfiles = m_phProfiles; - *pcProfiles = m_cProfiles; - } - } - - ERR_ON_HR(hr); - return hr; - } - -private: - /*++ - - Routine Name: - - CreateHandleBuffer - - Routine Description: - - Creates the buffer that holds the profile handles - - Arguments: - - pProfiles - Pointer to the vector of CProfile objects that have the individual profile data - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT - CreateHandleBuffer( - _In_ ProfileList* pProfiles - ) - { - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pProfiles, E_POINTER))) - { - try - { - FreeHandleBuffer(); - - m_cProfiles = static_cast(pProfiles->size()); - if (m_cProfiles > 0) - { - m_phProfiles = new(std::nothrow) HPROFILE[m_cProfiles]; - - if (SUCCEEDED(hr = CHECK_POINTER(m_phProfiles, E_OUTOFMEMORY))) - { - ProfileList::iterator iterProfiles = pProfiles->begin(); - - for (UINT cProfile = 0; - SUCCEEDED(hr) && iterProfiles != pProfiles->end() && cProfile < m_cProfiles; - iterProfiles++, cProfile++) - { - hr = (*iterProfiles)->GetProfileHandle(&m_phProfiles[cProfile]); - } - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; - } - - /*++ - - Routine Name: - - FreeHandleBuffer - - Routine Description: - - Frees up the profile handle buffer - - Arguments: - - None - - Return Value: - - None - - --*/ - VOID - FreeHandleBuffer( - VOID - ) - { - if (m_phProfiles != NULL) - { - delete[] m_phProfiles; - m_phProfiles = NULL; - } - - m_cProfiles = 0; - } - -private: - HPROFILE* m_phProfiles; - - DWORD m_cProfiles; -}; - -/*++ - -Routine Name: - - CTransform::CTransform - -Routine Description: - - CTransform constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CTransform::CTransform() : - m_hColorTrans(NULL), - m_intents(INTENT_ABSOLUTE_COLORIMETRIC), - m_renderFlags(0), - m_pcstrProfileKeys(NULL), - m_cProfiles(0) -{ -} - -/*++ - -Routine Name: - - CTransform::~CTransform - -Routine Description: - - CTransform destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CTransform::~CTransform() -{ - FreeTransform(); -} - -/*++ - -Routine Name: - - CTransform::CreateTransform - -Routine Description: - - Creates the transform from a vector of CProfile objects - -Arguments: - - pProfiles - Pointer to the vector of CProfile objects that have the individual profile data - intent - Intent flags to be applied when creating transform - renderFlags - Render flags to be applied when creating transform - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CTransform::CreateTransform( - _In_ ProfileList* pProfiles, - _In_ CONST DWORD intent, - _In_ CONST DWORD renderFlags - ) -{ - HRESULT hr = S_OK; - - if (intent <= INTENT_ABSOLUTE_COLORIMETRIC) - { - BOOL bFreeTransform = FALSE; - - if (m_intents != intent) - { - m_intents = intent; - bFreeTransform = TRUE; - } - - if (m_renderFlags != renderFlags) - { - m_renderFlags = renderFlags; - bFreeTransform = TRUE; - } - - if (bFreeTransform) - { - FreeTransform(); - } - } - else - { - hr = E_INVALIDARG; - } - - BOOL bUpdate = FALSE; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(pProfiles, E_POINTER)) && - SUCCEEDED(hr = UpdateProfiles(pProfiles, &bUpdate))) - { - try - { - if (bUpdate) - { - HPROFILE* phProfiles = NULL; - DWORD cProfiles = 0; - CProfileList profileList(pProfiles); - - if (SUCCEEDED(hr = profileList.GetProfileData(&phProfiles, &cProfiles))) - { - m_hColorTrans = CreateMultiProfileTransform(phProfiles, - cProfiles, - &m_intents, - 1, - m_renderFlags, - INDEX_DONT_CARE); - - if (m_hColorTrans == NULL) - { - hr = GetLastErrorAsHResult(); - } - } - else - { - hr = E_INVALIDARG; - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CTransform::GetTransformHandle - -Routine Description: - - Retrieves the current transform handle - -Arguments: - - phTrans - Pointer to a HTRANSFORM that recieves the transform handle - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CTransform::GetTransformHandle( - _Out_ HTRANSFORM* phTrans - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(phTrans, E_POINTER))) - { - *phTrans = NULL; - - if (SUCCEEDED(hr = CHECK_HANDLE(m_hColorTrans, E_PENDING))) - { - *phTrans = m_hColorTrans; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CTransform::FreeTransform - -Routine Description: - - Free the current transform - -Arguments: - - None - -Return Value: - - None - ---*/ -VOID -CTransform::FreeTransform( - VOID - ) -{ - FreeProfileKeysBuffer(); - if (m_hColorTrans != NULL) - { - DeleteColorTransform(m_hColorTrans); - m_hColorTrans = NULL; - } -} - -/*++ - -Routine Name: - - CTransform::CreateProfileKeysBuffer - -Routine Description: - - Creates a buffer to recieve the keys to the profiles that compse the current - trnasform - -Arguments: - - cProfiles - the count of profiles that compose the transform - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CTransform::CreateProfileKeysBuffer( - _In_ CONST UINT& cProfiles - ) -{ - HRESULT hr = S_OK; - - FreeProfileKeysBuffer(); - - if (cProfiles > 0) - { - m_pcstrProfileKeys = new(std::nothrow) CStringXDW[cProfiles]; - if (SUCCEEDED(hr = CHECK_POINTER(m_pcstrProfileKeys, E_OUTOFMEMORY))) - { - m_cProfiles = cProfiles; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CTransform::FreeProfileKeysBuffer - -Routine Description: - - Frees the profile key buffer - -Arguments: - - None - -Return Value: - - None - ---*/ -VOID -CTransform::FreeProfileKeysBuffer( - VOID - ) -{ - if (m_pcstrProfileKeys != NULL) - { - delete[] m_pcstrProfileKeys; - m_pcstrProfileKeys = NULL; - } - - m_cProfiles = 0; -} - -/*++ - -Routine Name: - - CTransform::UpdateProfiles - -Routine Description: - - Updates the profile list and checks whether the transform needs to be generated - (i.e. is the current transform the same as the requested transform) - -Arguments: - - pProfiles - Pointer to the vector of CProfile objects that have the individual profile data - pbUpdate - Pointer to BOOL that recieves whether the transform requires updating - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CTransform::UpdateProfiles( - _In_ ProfileList* pProfiles, - _Out_ BOOL* pbUpdate - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pProfiles, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pbUpdate, E_POINTER))) - { - *pbUpdate = FALSE; - - try - { - // - // If we already have a transform, a list of profile keys and matching - // number of profiles, check our keys against the incoming list of profiles - // and note if we need to create a new transform - // - CStringXDW* pcstrProfileKeys = NULL; - if (m_hColorTrans != NULL && - m_pcstrProfileKeys != NULL && - m_cProfiles > 0 && - m_cProfiles == static_cast(pProfiles->size())) - { - pcstrProfileKeys = m_pcstrProfileKeys; - ProfileList::iterator iterProfiles = pProfiles->begin(); - - for (; - iterProfiles != pProfiles->end() && !*pbUpdate; - iterProfiles++) - { - if (*(*iterProfiles) != *pcstrProfileKeys++) - { - *pbUpdate = TRUE; - } - } - } - else - { - *pbUpdate = TRUE; - } - - if (*pbUpdate) - { - // - // We need to create a new transform. Free any current transform and cache the keys - // to the profiles that constitute the transform - // - FreeTransform(); - if (SUCCEEDED(hr = CreateProfileKeysBuffer(static_cast(pProfiles->size())))) - { - pcstrProfileKeys = m_pcstrProfileKeys; - ProfileList::iterator iterProfiles = pProfiles->begin(); - - for (; - SUCCEEDED(hr) && iterProfiles != pProfiles->end(); - iterProfiles++, pcstrProfileKeys++) - { - // - // If CreateProfileKeysBuffer succeeds, it fills - // in m_pcstrProfileKeys with pProfiles->size() - // elements. Hence the _Analysis_assume_. - // - _Analysis_assume_(pcstrProfileKeys != NULL); - hr = (*iterProfiles)->GetProfileKey(pcstrProfileKeys); - } - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/color/transform.h b/print/XPSDrvSmpl/src/filters/color/transform.h deleted file mode 100644 index 4d3034fd..00000000 --- a/print/XPSDrvSmpl/src/filters/color/transform.h +++ /dev/null @@ -1,83 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - transform.h - -Abstract: - - CTransform class definition. This class creates and manages color transforms providing - limited caching functionality based off the source profile keys. - - ---*/ - -#pragma once - -#include "profile.h" - -typedef vector ProfileList; - -class CTransform -{ -public: - CTransform(); - - ~CTransform(); - - HRESULT - CreateTransform( - _In_ ProfileList* pProfiles, - _In_ CONST DWORD intent, - _In_ CONST DWORD renderFlags - ); - - HRESULT - GetTransformHandle( - _Out_ HTRANSFORM* phTrans - ); - - -private: - VOID - FreeTransform( - VOID - ); - - HRESULT - CreateProfileKeysBuffer( - _In_ CONST UINT& cProfiles - ); - - VOID - FreeProfileKeysBuffer( - VOID - ); - - HRESULT - UpdateProfiles( - _In_ ProfileList* pProfiles, - _Out_ BOOL* pbUpdate - ); - -private: - HTRANSFORM m_hColorTrans; - - DWORD m_intents; - - DWORD m_renderFlags; - - CStringXDW* m_pcstrProfileKeys; - - DWORD m_cProfiles; -}; - diff --git a/print/XPSDrvSmpl/src/filters/color/wcsapiconv.cpp b/print/XPSDrvSmpl/src/filters/color/wcsapiconv.cpp deleted file mode 100644 index b53efb15..00000000 --- a/print/XPSDrvSmpl/src/filters/color/wcsapiconv.cpp +++ /dev/null @@ -1,813 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wcsapiconv.cpp - -Abstract: - - Implementation of the wrapper to the WCS API's - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "wcsapiconv.h" - -CWCSApiConv g_WCSApiConv; - -/*++ - -Routine Name: - - CWCSApiConv::CWCSApiConv - -Routine Description: - - CWCSApiConv class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CWCSApiConv::CWCSApiConv() -{ - m_dllHandle = LoadLibrary(L"mscms.dll"); - - // - // If running on Vista, record the proc address for each WCS API - // - if (m_dllHandle != NULL && - IsVista()) - { - m_WcsAssociateColorProfileWithDevice = GetProcAddress(m_dllHandle,"WcsAssociateColorProfileWithDevice"); - m_WcsDisassociateColorProfileFromDevice = GetProcAddress(m_dllHandle, "WcsDisassociateColorProfileFromDevice"); - m_WcsEnumColorProfilesSize = GetProcAddress(m_dllHandle, "WcsEnumColorProfilesSize"); - m_WcsGetDefaultColorProfileSize = GetProcAddress(m_dllHandle, "WcsGetDefaultColorProfileSize"); - m_WcsGetDefaultColorProfile = GetProcAddress(m_dllHandle, "WcsGetDefaultColorProfile"); - m_WcsSetDefaultColorProfile = GetProcAddress(m_dllHandle, "WcsSetDefaultColorProfile"); - m_WcsSetDefaultRenderingIntent = GetProcAddress(m_dllHandle, "WcsSetDefaultRenderingIntent"); - m_WcsGetUsePerUserProfiles = GetProcAddress(m_dllHandle, "WcsGetUsePerUserProfiles"); - m_WcsSetUsePerUserProfiles = GetProcAddress(m_dllHandle, "WcsSetUsePerUserProfiles"); - m_WcsTranslateColors = GetProcAddress(m_dllHandle, "WcsTranslateColors"); - m_WcsCheckColors = GetProcAddress(m_dllHandle, "WcsCheckColors"); - m_WcsOpenColorProfileA = GetProcAddress(m_dllHandle, "WcsOpenColorProfileA"); - m_WcsOpenColorProfileW = GetProcAddress(m_dllHandle, "WcsOpenColorProfileW"); - m_WcsCreateIccProfile = GetProcAddress(m_dllHandle, "WcsCreateIccProfile"); - - ASSERTMSG(m_WcsAssociateColorProfileWithDevice != NULL && - m_WcsDisassociateColorProfileFromDevice != NULL && - m_WcsEnumColorProfilesSize != NULL && - m_WcsGetDefaultColorProfileSize != NULL && - m_WcsGetDefaultColorProfile != NULL && - m_WcsSetDefaultColorProfile != NULL && - m_WcsSetDefaultRenderingIntent != NULL && - m_WcsGetUsePerUserProfiles != NULL && - m_WcsSetUsePerUserProfiles != NULL && - m_WcsTranslateColors != NULL && - m_WcsCheckColors != NULL && - m_WcsOpenColorProfileA != NULL && - m_WcsOpenColorProfileW != NULL && - m_WcsCreateIccProfile != NULL, - "Failed to load WCS APIs correctly.\n"); - } -} - -/*++ - -Routine Name: - - CWCSApiConv::~CWCSApiConv - -Routine Description: - - CWCSApiConv class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CWCSApiConv::~CWCSApiConv() -{ - FreeLibrary(m_dllHandle); -} - -/*++ - -Routine Name: - - CWCSApiConv::WcsAssociateColorProfileWithDevice - -Routine Description: - - -Arguments: - - scope - Profile management scope for this operation, which could be system wide or for current user. - - pProfileName - Points to the file name of the profile to associate. - - pDeviceName - Points to the name of the device to associate. - -Return Value: - - BOOL - If this function succeeds, the return value is TRUE. - ---*/ -BOOL -CWCSApiConv::WcsAssociateColorProfileWithDevice( - _In_ WCS_PROFILE_MANAGEMENT_SCOPE scope, - _In_ PCWSTR pProfileName, - _In_ PCWSTR pDeviceName - ) -{ - BOOL bResult = FALSE; - - if (m_WcsAssociateColorProfileWithDevice != NULL) - { - bResult = m_WcsAssociateColorProfileWithDevice.GetFunc()(scope, pProfileName, pDeviceName); - } - - return bResult; -} - -/*++ - -Routine Name: - - CWCSApiConv::WcsDisassociateColorProfileFromDevice - -Routine Description: - - -Arguments: - - scope - Profile management scope for this operation, which could be system wide or for current user. - - pProfileName - Pointer to the file name of the profile to disassociate. - - pDeviceName - Pointer to the name of the device to disassociate. - -Return Value: - - BOOL - If this function succeeds, the return value is TRUE. - ---*/ -BOOL -CWCSApiConv::WcsDisassociateColorProfileFromDevice( - _In_ WCS_PROFILE_MANAGEMENT_SCOPE scope, - _In_ PCWSTR pProfileName, - _In_ PCWSTR pDeviceName - ) -{ - BOOL bResult = FALSE; - - if (m_WcsDisassociateColorProfileFromDevice != NULL) - { - bResult = m_WcsDisassociateColorProfileFromDevice.GetFunc()(scope, pProfileName, pDeviceName); - } - - return bResult; -} - -/*++ - -Routine Name: - - CWCSApiConv::WcsEnumColorProfilesSize - -Routine Description: - - -Arguments: - - scope - management scope for this operation, which could be system wide or for current user. - - pEnumRecord - Pointer to the structure specifying the enumeration criteria. - - pdwSize - Returns the size in bytes required for the buffer to receive the set of profile names in WcsEnumColorProfiles. - -Return Value: - - BOOL - If this function succeeds, the return value is TRUE. - ---*/ -_Success_(return) -BOOL -#pragma warning(suppress: 6001 6101) // PREFast can't see through templated forwarder function call -CWCSApiConv::WcsEnumColorProfilesSize( - _In_ WCS_PROFILE_MANAGEMENT_SCOPE scope, - _In_ PENUMTYPEW pEnumRecord, - _Out_ PDWORD pdwSize - ) -{ - BOOL bResult = FALSE; - - if (m_WcsEnumColorProfilesSize != NULL) - { - bResult = m_WcsEnumColorProfilesSize.GetFunc()(scope, pEnumRecord, pdwSize); - } - - return bResult; -} - -/*++ - -Routine Name: - - CWCSApiConv::WcsGetDefaultColorProfileSize - -Routine Description: - - -Arguments: - - scope - Profile management scope for this operation, which could be system wide or for current user. - - pDeviceName - Pointer to the name of the device to get the default profile for. NULL implies device-independent default. - - cptColorProfileType - Specifies the color profile type value. - - cpstColorProfileSubType - Specifies the color profile subtype value. - - dwProfileID - Specifies the ID of the color space that the profile represents. - - pcbProfileName - the size in bytes for receiving the default profile in WcsGetDefaultColorProfile. - -Return Value: - - BOOL - If this function succeeds, the return value is TRUE. - ---*/ -_Success_(return) -BOOL -#pragma warning(suppress: 6001 6101) // PREFast can't see through templated forwarder function call -CWCSApiConv::WcsGetDefaultColorProfileSize( - _In_ WCS_PROFILE_MANAGEMENT_SCOPE scope, - _In_opt_ PCWSTR pDeviceName, - _In_ COLORPROFILETYPE cptColorProfileType, - _In_ COLORPROFILESUBTYPE cpstColorProfileSubType, - _In_ DWORD dwProfileID, - _Out_ PDWORD pcbProfileName - ) -{ - BOOL bResult = FALSE; - - if (m_WcsGetDefaultColorProfileSize != NULL) - { - bResult = m_WcsGetDefaultColorProfileSize.GetFunc()(scope, - pDeviceName, - cptColorProfileType, - cpstColorProfileSubType, - dwProfileID, - pcbProfileName); - } - - return bResult; -} - -/*++ - -Routine Name: - - CWCSApiConv::WcsGetDefaultColorProfile - -Routine Description: - - -Arguments: - - scope - Profile management scope for this operation, which could be system wide or for current user. - - pDeviceName - Pointer to the name of the device to get the default profile for. NULL implies device-independent default. - - cptColorProfileType - Specifies the color profile type value. - - cpstColorProfileSubType - Specifies the color profile subtype value. - - dwProfileID - Specifies the ID of the color space that the profile represents. - - cbProfileName - The size in bytes of the buffer pointed to by pProfileName. - - pProfileName - Pointer to the buffer in which the name of the profile is to be placed. - -Return Value: - - BOOL - If this function succeeds, the return value is TRUE. - ---*/ -#pragma warning(suppress: 6001 6054 6101) // PREFast can't see through templated forwarder function call -_Success_(return) -BOOL -CWCSApiConv::WcsGetDefaultColorProfile( - _In_ WCS_PROFILE_MANAGEMENT_SCOPE scope, - _In_opt_ PCWSTR pDeviceName, - _In_ COLORPROFILETYPE cptColorProfileType, - _In_ COLORPROFILESUBTYPE cpstColorProfileSubType, - _In_ DWORD dwProfileID, - _In_ DWORD cbProfileName, - _Out_writes_bytes_(cbProfileName) LPWSTR pProfileName - ) -{ - BOOL bResult = FALSE; - - if (m_WcsGetDefaultColorProfile != NULL) - { - bResult = m_WcsGetDefaultColorProfile.GetFunc()(scope, - pDeviceName, - cptColorProfileType, - cpstColorProfileSubType, - dwProfileID, - cbProfileName, - pProfileName); - } - - return bResult; -} - -/*++ - -Routine Name: - - CWCSApiConv::WcsSetDefaultColorProfile - -Routine Description: - - -Arguments: - - scope - Profile management scope for this operation, which could be system wide or for current user. - - pDeviceName - Pointer to the name of the device to set the default profile for. NULL implies device-independent default. - - cptColorProfileType - Specifies the color profile type value. - - cpstColorProfileSubType - Specifies the color profile subtype value. - - dwProfileID - Specifies the ID of the color space that the profile represents. - - pProfileName - Pointer to the buffer in which contains the name of the profile. - -Return Value: - - BOOL - If this function succeeds, the return value is TRUE. - ---*/ -BOOL -CWCSApiConv::WcsSetDefaultColorProfile( - _In_ WCS_PROFILE_MANAGEMENT_SCOPE scope, - _In_opt_ PCWSTR pDeviceName, - _In_ COLORPROFILETYPE cptColorProfileType, - _In_ COLORPROFILESUBTYPE cpstColorProfileSubType, - _In_ DWORD dwProfileID, - _In_opt_ LPCWSTR pProfileName - ) -{ - BOOL bResult = FALSE; - - if (m_WcsSetDefaultColorProfile != NULL) - { - bResult = m_WcsSetDefaultColorProfile.GetFunc()(scope, - pDeviceName, - cptColorProfileType, - cpstColorProfileSubType, - dwProfileID, - pProfileName); - } - - return bResult; -} - -/*++ - -Routine Name: - - CWCSApiConv::WcsSetDefaultRenderingIntent - -Routine Description: - - -Arguments: - - scope - management scope for this operation, which could be system wide or for current user. - - dwRenderingIntent - The rendering intent to set. - -Return Value: - - BOOL - If this function succeeds, the return value is TRUE. - ---*/ -BOOL -CWCSApiConv::WcsSetDefaultRenderingIntent( - _In_ WCS_PROFILE_MANAGEMENT_SCOPE scope, - _In_ DWORD dwRenderingIntent - ) -{ - BOOL bResult = FALSE; - - if (m_WcsSetDefaultRenderingIntent != NULL) - { - bResult = m_WcsSetDefaultRenderingIntent.GetFunc()(scope, dwRenderingIntent); - } - - return bResult; -} - -/*++ - -Routine Name: - - CWCSApiConv::WcsGetUsePerUserProfiles - -Routine Description: - - -Arguments: - - pDeviceName - The friendly name of the device. - - dwDeviceClass - The class of the device: CLASS_SCANNER for a capture device, - CLASS_MONITOR for a display device, or CLASS_PRINTER for a printer. - - pUsePerUserProfiles - Pointer to a location to receive the result. - This location receives TRUE if the user has chosen to use a - per-user profile association list for the specified device; otherwise FALSE. - -Return Value: - - BOOL - If this function succeeds, the return value is TRUE. - ---*/ -_Success_(return) -BOOL -#pragma warning(suppress: 6001 6101) // PREFast can't see through templated forwarder function call -CWCSApiConv::WcsGetUsePerUserProfiles( - _In_ LPCWSTR pDeviceName, - _In_ DWORD dwDeviceClass, - _Out_ PBOOL pUsePerUserProfiles - ) -{ - BOOL bResult = FALSE; - - if (m_WcsGetUsePerUserProfiles != NULL) - { - bResult = m_WcsGetUsePerUserProfiles.GetFunc()(pDeviceName, dwDeviceClass, pUsePerUserProfiles); - } - - return bResult; -} - -/*++ - -Routine Name: - - CWCSApiConv::WcsSetUsePerUserProfiles - -Routine Description: - - -Arguments: - - pDeviceName - The friendly name of the device. - - dwDeviceClass - The class of the device: CLASS_SCANNER for a capture device, - CLASS_MONITOR for a display device, or CLASS_PRINTER for a printer. - - usePerUserProfiles - TRUE is the user wishes to use a per-user profile association - list for the specified device; otherwise FALSE. - -Return Value: - - BOOL - If this function succeeds, the return value is TRUE. - ---*/ -BOOL -CWCSApiConv::WcsSetUsePerUserProfiles( - _In_ LPCWSTR pDeviceName, - _In_ DWORD dwDeviceClass, - _In_ BOOL usePerUserProfiles - ) -{ - BOOL bResult = FALSE; - - if (m_WcsSetUsePerUserProfiles != NULL) - { - bResult = m_WcsSetUsePerUserProfiles.GetFunc()(pDeviceName, dwDeviceClass, usePerUserProfiles); - } - - return bResult; -} - -/*++ - -Routine Name: - - CWCSApiConv::WcsTranslateColors - -Routine Description: - - -Arguments: - - hColorTransform - Identifies the WCS color transform to use. - - nColors - Contains the number of elements in the arrays pointed to by pInputData and pOutputData. - - nInputChannels - Contains the number of channels per element in the array pointed to by pInputData - - cdtInput - Specifies the input COLORDATATYPTE. - - cbInput - Contains buffer size of pInputData. - - pInputData - Pointer to array of input colors. - - nOutputChannels - Contains the number of channels per element in the array pointed to by pOutputData. - - cdtOutput - Specifies the output COLORDATATYPTE. - - cbOutput - Contains buffer size of pOutputData. - - pOutputData - Pointer to array of output colors. - -Return Value: - - BOOL - If this function succeeds, the return value is TRUE. - ---*/ -BOOL -CWCSApiConv::WcsTranslateColors( - _In_ HTRANSFORM hColorTransform, - _In_ DWORD nColors, - _In_ DWORD nInputChannels, - _In_ COLORDATATYPE cdtInput, - _In_ DWORD cbInput, - _In_reads_bytes_(cbInput) PVOID pInputData, - _In_ DWORD nOutputChannels, - _In_ COLORDATATYPE cdtOutput, - _In_ DWORD cbOutput, - _Out_writes_bytes_(cbOutput) PVOID pOutputData - ) -{ - BOOL bResult = FALSE; - - if (m_WcsTranslateColors != NULL) - { - bResult = m_WcsTranslateColors.GetFunc()(hColorTransform, - nColors, - nInputChannels, - cdtInput, - cbInput, - pInputData, - nOutputChannels, - cdtOutput, - cbOutput, - pOutputData); - } - - return bResult; -} - -/*++ - -Routine Name: - - CWCSApiConv::WCSCheckColors - -Routine Description: - - -Arguments: - - hColorTransform - Identifies the WCS color transform to use. - - nColors - Contains the number of elements in the arrays pointed to by pInputData and pResult. - - nInputChannels - Contains the number of channels per element in the array pointed to by pInputData - - cdtInput - Specifies the input COLORDATATYPTE. - - cbInput - Contains buffer size of pInputData. - - pInputData - Pointer to array of input colors. - - pResult - Pointer to array of nColor results of the test. - -Return Value: - - BOOL - If this function succeeds, the return value is TRUE. - ---*/ -BOOL -CWCSApiConv::WCSCheckColors( - _In_ HTRANSFORM hColorTransform, - _In_ DWORD nColors, - _In_ DWORD nInputChannels, - _In_ COLORDATATYPE cdtInput, - _In_ DWORD cbInput, - _In_reads_bytes_(cbInput) PVOID pInputData, - _Out_writes_bytes_(nColors)PBYTE pResult -) -{ - BOOL bResult = FALSE; - - if (m_WcsCheckColors != NULL) - { - bResult = m_WcsCheckColors.GetFunc()(hColorTransform, - nColors, - nInputChannels, - cdtInput, - cbInput, - pInputData, - pResult); - } - - return bResult; -} - -/*++ - -Routine Name: - - CWCSApiConv::WcsOpenColorProfileA - -Routine Description: - - -Arguments: - - pCDMPProfile - Pointer to a WCS DMP or an ICC color profile structure specifying the profile. - - pCAMPProfile - Pointer to a WCS CAMP color profile structure specifying the profile. - If this parameter is NULL, then the standard default CAMP is used. - - pGMMPProfile - Pointer to a WCS GMMP color profile structure specifying the profile. - If this parameter is NULL, then the standard default GMMP is used. - - dwDesireAccess - Specifies how to access the given profile. This parameter must take one the following constant values. - - dwShareMode - Specifies how the profile should be shared, if the profile is contained in a file. - A value of zero prevents the profile from being shared at all. - - dwCreationMode - Specifies which actions to take on the profile while opening it, if it is contained in a file. - - -Return Value: - - HPROFILE - Handle to the opened color profile - ---*/ -HPROFILE -CWCSApiConv::WcsOpenColorProfileA( - _In_ PPROFILE pCDMPProfile, - _In_opt_ PPROFILE pCAMPProfile, - _In_opt_ PPROFILE pGMMPProfile, - _In_ DWORD dwDesireAccess, - _In_ DWORD dwShareMode, - _In_ DWORD dwCreationMode, - _In_ DWORD dwFlags - ) -{ - HPROFILE hProfile = NULL; - - if (m_WcsOpenColorProfileA != NULL) - { - hProfile = m_WcsOpenColorProfileA.GetFunc()(pCDMPProfile, - pCAMPProfile, - pGMMPProfile, - dwDesireAccess, - dwShareMode, - dwCreationMode, - dwFlags); - } - - return hProfile; -} - -/*++ - -Routine Name: - - CWCSApiConv::WcsOpenColorProfileW - -Routine Description: - - -Arguments: - - pCDMPProfile - Pointer to a WCS DMP or an ICC color profile structure specifying the profile. - - pCAMPProfile - Pointer to a WCS CAMP color profile structure specifying the profile. - If this parameter is NULL, then the standard default CAMP is used. - - pGMMPProfile - Pointer to a WCS GMMP color profile structure specifying the profile. - If this parameter is NULL, then the standard default GMMP is used. - - dwDesireAccess - Specifies how to access the given profile. This parameter must take one the following constant values. - - dwShareMode - Specifies how the profile should be shared, if the profile is contained in a file. - A value of zero prevents the profile from being shared at all. - - dwCreationMode - Specifies which actions to take on the profile while opening it, if it is contained in a file. - - -Return Value: - - HPROFILE - Handle to the opened color profile - ---*/ -HPROFILE -CWCSApiConv::WcsOpenColorProfileW( - _In_ PPROFILE pCDMPProfile, - _In_opt_ PPROFILE pCAMPProfile, - _In_opt_ PPROFILE pGMMPProfile, - _In_ DWORD dwDesireAccess, - _In_ DWORD dwShareMode, - _In_ DWORD dwCreationMode, - _In_ DWORD dwFlags - ) -{ - HPROFILE hProfile = NULL; - - if (m_WcsOpenColorProfileW != NULL) - { - hProfile = m_WcsOpenColorProfileW.GetFunc()(pCDMPProfile, - pCAMPProfile, - pGMMPProfile, - dwDesireAccess, - dwShareMode, - dwCreationMode, - dwFlags); - } - - return hProfile; -} - -/*++ - -Routine Name: - - CWCSApiConv::WcsCreateIccProfile - -Routine Description: - - -Arguments: - - hWcsProfile - handle to a WCS profile which contains a combination - of a WCS DMP, and optionally a CAMP and/or GMMP. - - dwOptions - Options flag values from WCS_DEFAULT and WCS_ICCONLY - -Return Value: - - HPROFILE - Handle to the newly created color profile - ---*/ -HPROFILE -CWCSApiConv::WcsCreateIccProfile( - _In_ HPROFILE hWcsProfile, - _In_ DWORD dwOptions - ) -{ - HPROFILE hProfile = NULL; - - if (m_WcsCreateIccProfile != NULL) - { - hProfile = m_WcsCreateIccProfile.GetFunc()(hWcsProfile, dwOptions); - } - - return hProfile; -} - diff --git a/print/XPSDrvSmpl/src/filters/color/wcsapiconv.h b/print/XPSDrvSmpl/src/filters/color/wcsapiconv.h deleted file mode 100644 index 1e63cd6a..00000000 --- a/print/XPSDrvSmpl/src/filters/color/wcsapiconv.h +++ /dev/null @@ -1,280 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wcsapiconv.h - -Abstract: - - Provides a wrapper to the WCS API's - ---*/ - -#pragma once - -class CWCSApiConv; -extern CWCSApiConv g_WCSApiConv; - -typedef BOOL (CALLBACK* WCSASSOCIATECOLORPROFILEWITHDEVICE)(WCS_PROFILE_MANAGEMENT_SCOPE, PCWSTR, PCWSTR); -typedef BOOL (CALLBACK* WCSDISASSOCIATECOLORPROFILEFROMDEVICE)(WCS_PROFILE_MANAGEMENT_SCOPE, PCWSTR, PCWSTR); -typedef BOOL (CALLBACK* WCSENUMCOLORPROFILESSIZE)(WCS_PROFILE_MANAGEMENT_SCOPE, PENUMTYPEW, PDWORD); -typedef BOOL (CALLBACK* WCSGETDEFAULTCOLORPROFILESIZE)(WCS_PROFILE_MANAGEMENT_SCOPE, PCWSTR, COLORPROFILETYPE, COLORPROFILESUBTYPE, DWORD, PDWORD); -typedef BOOL (CALLBACK* WCSGETDEFAULTCOLORPROFILE)(WCS_PROFILE_MANAGEMENT_SCOPE, PCWSTR, COLORPROFILETYPE, COLORPROFILESUBTYPE, DWORD, DWORD, LPWSTR); -typedef BOOL (CALLBACK* WCSSETDEFAULTCOLORPROFILE)(WCS_PROFILE_MANAGEMENT_SCOPE, PCWSTR, COLORPROFILETYPE, COLORPROFILESUBTYPE, DWORD, LPCWSTR); -typedef BOOL (CALLBACK* WCSSETDEFAULTRENDERINGINTENT)(WCS_PROFILE_MANAGEMENT_SCOPE, DWORD); -typedef BOOL (CALLBACK* WCSGETUSEPERUSERPROFILES)(LPCWSTR, DWORD, PBOOL); -typedef BOOL (CALLBACK* WCSSETUSEPERUSERPROFILES)(LPCWSTR, DWORD, BOOL); -typedef BOOL (CALLBACK* WCSTRANSLATECOLORS)(HTRANSFORM, DWORD, DWORD, COLORDATATYPE, DWORD, PVOID, DWORD, COLORDATATYPE, DWORD, PVOID); -typedef BOOL (CALLBACK* WCSCHECKCOLORS)(HTRANSFORM, DWORD, DWORD, COLORDATATYPE, DWORD, PVOID, PBYTE); -typedef HPROFILE (CALLBACK* WCSOPENCOLORPROFILE)(PPROFILE, PPROFILE, PPROFILE, DWORD, DWORD, DWORD, DWORD); -typedef HPROFILE (CALLBACK* WCSCREATEICCPROFILE)(HPROFILE, DWORD); - -#define WcsAssociateColorProfileWithDeviceXD g_WCSApiConv.WcsAssociateColorProfileWithDevice -#define WcsDisassociateColorProfileFromDeviceXD g_WCSApiConv.WcsDisassociateColorProfileFromDevice -#define WcsEnumColorProfilesSizeXD g_WCSApiConv.WcsEnumColorProfilesSize -#define WcsGetDefaultColorProfileSizeXD g_WCSApiConv.WcsGetDefaultColorProfileSize -#define WcsGetDefaultColorProfileXD g_WCSApiConv.WcsGetDefaultColorProfile -#define WcsSetDefaultColorProfileXD g_WCSApiConv.WcsSetDefaultColorProfile -#define WcsSetDefaultRenderingIntentXD g_WCSApiConv.WcsSetDefaultRenderingIntent -#define WcsGetUsePerUserProfilesXD g_WCSApiConv.WcsGetUsePerUserProfiles -#define WcsSetUsePerUserProfilesXD g_WCSApiConv.WcsSetUsePerUserProfiles -#define WcsTranslateColorsXD g_WCSApiConv.WcsTranslateColors -#define WCSCheckColorsXD g_WCSApiConv.WCSCheckColors -#define WcsOpenColorProfileWXD g_WCSApiConv.WcsOpenColorProfileW -#define WcsOpenColorProfileAXD g_WCSApiConv.WcsOpenColorProfileA -#define WcsCreateIccProfileXD g_WCSApiConv.WcsCreateIccProfile - -#ifdef _UNICODE -#define WcsOpenColorProfileXD WcsOpenColorProfileWXD -#else -#define WcsOpenColorProfileXD WcsOpenColorProfileAXD -#endif - -template -class CEncodedFuncPtr -{ -public: - CEncodedFuncPtr() : - m_pFunc(NULL) - { - } - - ~CEncodedFuncPtr(){} - - CEncodedFuncPtr<_T>& - operator=( - _In_ FARPROC pFunc - ) - { - m_pFunc = EncodePointer(pFunc); - return *this; - } - - BOOL - operator==( - _In_opt_ PVOID pv - ) const - { - return m_pFunc == pv; - } - - BOOL - operator!=( - _In_opt_ PVOID pv - ) const - { - return !operator==(pv); - } - - _T - GetFunc( - VOID - ) - { - return reinterpret_cast<_T>(DecodePointer(m_pFunc)); - } - -private: - __field_encoded_pointer PVOID m_pFunc; -}; - -class CWCSApiConv -{ -public: - CWCSApiConv(); - - ~CWCSApiConv(); - - BOOL - WcsAssociateColorProfileWithDevice( - _In_ WCS_PROFILE_MANAGEMENT_SCOPE scope, - _In_ PCWSTR pProfileName, - _In_ PCWSTR pDeviceName - ); - - BOOL - WcsDisassociateColorProfileFromDevice( - _In_ WCS_PROFILE_MANAGEMENT_SCOPE scope, - _In_ PCWSTR pProfileName, - _In_ PCWSTR pDeviceName - ); - - _Success_(return) - BOOL - WcsEnumColorProfilesSize( - _In_ WCS_PROFILE_MANAGEMENT_SCOPE scope, - _In_ PENUMTYPEW pEnumRecord, - _Out_ PDWORD pdwSize - ); - - _Success_(return) - BOOL - WcsGetDefaultColorProfileSize( - _In_ WCS_PROFILE_MANAGEMENT_SCOPE scope, - _In_opt_ PCWSTR pDeviceName, - _In_ COLORPROFILETYPE cptColorProfileType, - _In_ COLORPROFILESUBTYPE cpstColorProfileSubType, - _In_ DWORD dwProfileID, - _Out_ PDWORD pcbProfileName - ); - - _Success_(return) - BOOL - WcsGetDefaultColorProfile( - _In_ WCS_PROFILE_MANAGEMENT_SCOPE scope, - _In_opt_ PCWSTR pDeviceName, - _In_ COLORPROFILETYPE cptColorProfileType, - _In_ COLORPROFILESUBTYPE cpstColorProfileSubType, - _In_ DWORD dwProfileID, - _In_ DWORD cbProfileName, - _Out_writes_bytes_(cbProfileName) LPWSTR pProfileName - ); - - BOOL - WcsSetDefaultColorProfile( - _In_ WCS_PROFILE_MANAGEMENT_SCOPE scope, - _In_opt_ PCWSTR pDeviceName, - _In_ COLORPROFILETYPE cptColorProfileType, - _In_ COLORPROFILESUBTYPE cpstColorProfileSubType, - _In_ DWORD dwProfileID, - _In_opt_ LPCWSTR pProfileName - ); - - BOOL - WcsSetDefaultRenderingIntent( - _In_ WCS_PROFILE_MANAGEMENT_SCOPE scope, - _In_ DWORD dwRenderingIntent - ); - - _Success_(return) - BOOL - WcsGetUsePerUserProfiles( - _In_ LPCWSTR pDeviceName, - _In_ DWORD dwDeviceClass, - _Out_ PBOOL pUsePerUserProfiles - ); - - BOOL - WcsSetUsePerUserProfiles( - _In_ LPCWSTR pDeviceName, - _In_ DWORD dwDeviceClass, - _In_ BOOL usePerUserProfiles - ); - - BOOL - WcsTranslateColors( - _In_ HTRANSFORM hColorTransform, - _In_ DWORD nColors, - _In_ DWORD nInputChannels, - _In_ COLORDATATYPE cdtInput, - _In_ DWORD cbInput, - _In_reads_bytes_(cbInput) PVOID pInputData, - _In_ DWORD nOutputChannels, - _In_ COLORDATATYPE cdtOutput, - _In_ DWORD cbOutput, - _Out_writes_bytes_(cbOutput)PVOID pOutputData - ); - - BOOL - WCSCheckColors( - _In_ HTRANSFORM hColorTransform, - _In_ DWORD nColors, - _In_ DWORD nInputChannels, - _In_ COLORDATATYPE cdtInput, - _In_ DWORD cbInput, - _In_reads_bytes_(cbInput) PVOID pInputData, - _Out_writes_bytes_(nColors)PBYTE pResult - ); - - HPROFILE WINAPI - WcsOpenColorProfileA( - _In_ PPROFILE pCDMPProfile, - _In_opt_ PPROFILE pCAMPProfile, - _In_opt_ PPROFILE pGMMPProfile, - _In_ DWORD dwDesireAccess, - _In_ DWORD dwShareMode, - _In_ DWORD dwCreationMode, - _In_ DWORD dwFlags - ); - - HPROFILE WINAPI - WcsOpenColorProfileW( - _In_ PPROFILE pCDMPProfile, - _In_opt_ PPROFILE pCAMPProfile, - _In_opt_ PPROFILE pGMMPProfile, - _In_ DWORD dwDesireAccess, - _In_ DWORD dwShareMode, - _In_ DWORD dwCreationMode, - _In_ DWORD dwFlags - ); - - HPROFILE - WcsCreateIccProfile( - _In_ HPROFILE hWcsProfile, - _In_ DWORD dwOptions - ); - -private: - HINSTANCE m_dllHandle; - - // - // WCS API - // - CEncodedFuncPtr m_WcsAssociateColorProfileWithDevice; - - CEncodedFuncPtr m_WcsDisassociateColorProfileFromDevice; - - CEncodedFuncPtr m_WcsEnumColorProfilesSize; - - CEncodedFuncPtr m_WcsGetDefaultColorProfileSize; - - CEncodedFuncPtr m_WcsGetDefaultColorProfile; - - CEncodedFuncPtr m_WcsSetDefaultColorProfile; - - CEncodedFuncPtr m_WcsSetDefaultRenderingIntent; - - CEncodedFuncPtr m_WcsGetUsePerUserProfiles; - - CEncodedFuncPtr m_WcsSetUsePerUserProfiles; - - CEncodedFuncPtr m_WcsTranslateColors; - - CEncodedFuncPtr m_WcsCheckColors; - - CEncodedFuncPtr m_WcsOpenColorProfileA; - - CEncodedFuncPtr m_WcsOpenColorProfileW; - - CEncodedFuncPtr m_WcsCreateIccProfile; -}; - diff --git a/print/XPSDrvSmpl/src/filters/color/wictobmscn.cpp b/print/XPSDrvSmpl/src/filters/color/wictobmscn.cpp deleted file mode 100644 index ca6058aa..00000000 --- a/print/XPSDrvSmpl/src/filters/color/wictobmscn.cpp +++ /dev/null @@ -1,751 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wictobmscn.cpp - -Abstract: - - WIC pixel format to BMFORMAT conversion class implementation. This class provides methods - for converting between a source WIC scanline to a target destination BMFORMAT scanline. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "wictobmscn.h" - -/*++ - -Routine Name: - - CWICToBMFormatScan::CWICToBMFormatScan - -Routine Description: - - CWICToBMFormatScan constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CWICToBMFormatScan::CWICToBMFormatScan() : - m_pScanBuffer(NULL), - m_cbScanBuffer(0), - m_cWidth(0), - m_pData(NULL), - m_cbData(0), - m_bInitialized(FALSE) -{ -} - -/*++ - -Routine Name: - - CWICToBMFormatScan::~CWICToBMFormatScan - -Routine Description: - - CWICToBMFormatScan destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CWICToBMFormatScan::~CWICToBMFormatScan() -{ - FreeScanBuffer(); -} - -/*++ - -Routine Name: - - CWICToBMFormatScan::Initialize - -Routine Description: - - Initializes the WIC to BMFORMAT transform data from the WICToBMFORMAT structure - -Arguments: - - WICToBM - Structure containing WIC pixel format to BMFORMAT conversion information - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWICToBMFormatScan::Initialize( - _In_ CONST WICToBMFORMAT& WICToBM - ) -{ - HRESULT hr = S_OK; - - m_convData = WICToBM; - - if (m_convData.m_pixFormTarget <= kWICPixelFormatMin || - m_convData.m_pixFormTarget >= kWICPixelFormatMax || - m_convData.m_bmFormTarget < kICMPixelFormatMin || - m_convData.m_bmFormTarget >= kICMPixelFormatMax) - { - hr = E_INVALIDARG; - } - - if (SUCCEEDED(hr) && - !IsVista()) - { - // - // When processing color data down-level from Vista, we cannot use fixed or float - // BMFORMAT types. In these circumstances we need to convert to a 16 bpc equivalent, - // then back again. - // - if (m_convData.m_bmFormTarget == kBM_32b_scRGB || - m_convData.m_bmFormTarget == kBM_32b_scARGB || - m_convData.m_bmFormTarget == kBM_S2DOT13FIXED_scRGB || - m_convData.m_bmFormTarget == kBM_S2DOT13FIXED_scARGB) - { - m_convData.m_bNeedsScanBuffer = TRUE; - m_convData.m_bmFormTarget = kBM_16b_RGB; - } - } - - if (SUCCEEDED(hr)) - { - m_bInitialized = TRUE; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWICToBMFormatScan::SetData - -Routine Description: - - Set the current WIC data. This method takes the WIC scanline data and - applies any necessary conversion to achieve the required BMFORMAT - -Arguments: - - bIsSrc - Indicates if this is a source scanline (i.e. is the conversion required as the scanline is input) - pWicPxData - Pointer to the WIC data - cbWicPxData - Count of bytes in the WIC data buffer - cWidth - Count of pixels inthe scanline - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWICToBMFormatScan::SetData( - _In_ CONST BOOL bIsSrc, - _In_reads_bytes_(cbWicPxData) PBYTE pWicPxData, - _In_ CONST UINT cbWicPxData, - _In_ CONST UINT cWidth - ) -{ - HRESULT hr = m_bInitialized ? S_OK : E_PENDING; - - COLORDATATYPE srcColType = COLOR_BYTE; - EICMPixelFormat eICMFormSrc = kBM_RGBTRIPLETS; - - COLORDATATYPE dstColType = COLOR_BYTE; - EICMPixelFormat eICMFormDst = kBM_RGBTRIPLETS; - - // - // Validate input - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(pWicPxData, E_POINTER))) - { - if (m_convData.m_pixFormTarget >= kWICPixelFormatMin && - m_convData.m_pixFormTarget < kWICPixelFormatMax) - { - // - // Set up the destination and source formats - // - eICMFormSrc = g_lutWICToBMFormat[m_convData.m_pixFormTarget].m_bmFormTarget; - srcColType = g_lutWICToBMFormat[m_convData.m_pixFormTarget].m_colDataType; - - if (m_convData.m_bmFormTarget < kICMPixelFormatMax && - m_convData.m_bmFormTarget >= kICMPixelFormatMin) - { - dstColType = g_lutBMFormatData[m_convData.m_bmFormTarget].m_colDataType; - eICMFormDst = m_convData.m_bmFormTarget; - } - else - { - hr = E_FAIL; - } - } - else - { - hr = E_FAIL; - } - } - - // - // Validate source and destination formats - // - if (SUCCEEDED(hr)) - { - if (eICMFormSrc < kICMPixelFormatMin || - eICMFormSrc >= kICMPixelFormatMax || - eICMFormDst < kICMPixelFormatMin || - eICMFormDst >= kICMPixelFormatMax) - { - RIP("Invalid pixel format.\n"); - - hr = E_FAIL; - } - else if (srcColType < COLOR_BYTE || - srcColType > COLOR_S2DOT13FIXED || - dstColType < COLOR_BYTE || - dstColType > COLOR_S2DOT13FIXED) - { - RIP("Invalid color data type.\n"); - - hr = E_FAIL; - } - } - - if (SUCCEEDED(hr)) - { - m_cWidth = cWidth; - if (m_convData.m_bNeedsScanBuffer) - { - // - // We need to convert in one way or another - create a buffer to - // hold the intermediate scanline data - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CreateScanBuffer(m_cWidth, - g_lutColorDataSize[dstColType], - g_lutBMFormatData[eICMFormDst].m_cChannels))) - { - if (bIsSrc) - { - // - // We need to initialise the buffer from the WIC buffer passed in. Here we - // are doing one of two things: - // - // 1. Copying data directly as we have parity between the WIC and - // ICM pixel formats - // 2. Convert from the WIC format to the ICM format and copy. - // - - // - // Set up the source and destination pointers - // - PBYTE pSrc = pWicPxData; - UINT cSrcChannels = g_lutWICToBMFormat[m_convData.m_pixFormTarget].m_cChannels; - size_t cbSrcBytesPerPixel = g_lutColorDataSize[srcColType] * cSrcChannels; - - PBYTE pDst = m_pScanBuffer; - UINT cDstChannels = g_lutBMFormatData[eICMFormDst].m_cChannels; - size_t cbDstBytesPerPixel = g_lutColorDataSize[dstColType] * cDstChannels; - - PBYTE pSrcEnd = pSrc + cbWicPxData; - PBYTE pDstEnd = pDst + m_cbScanBuffer; - - if (dstColType == m_convData.m_colDataType) - { - while (pSrc < pSrcEnd && - pDst < pDstEnd) - { - if (pSrc + cbDstBytesPerPixel < pSrcEnd) - { - CopyMemory(pDst, pSrc, cbDstBytesPerPixel); - } - pSrc += cbSrcBytesPerPixel; - pDst += cbDstBytesPerPixel; - } - } - else - { - // - // We should only ever be required to convert from floating point and fixed point - // scRGB formats to 16 bpc RGB - // - if (eICMFormDst == kBM_16b_RGB && - (eICMFormSrc == kBM_32b_scRGB || - eICMFormSrc == kBM_32b_scARGB)) - { - FLOAT* pSrcData = reinterpret_cast(pSrc); - WORD* pDstData = reinterpret_cast(pDst); - - while (pSrcData <= reinterpret_cast(pSrcEnd) - cSrcChannels && - pDstData <= reinterpret_cast(pDstEnd) - cDstChannels) - { - for (UINT cChan = 0; - cChan < cDstChannels && cChan < cSrcChannels; - cChan++) - { - // - // Note: We are only converting from FLOAT and not applying gamma modification - // as the transform should account for this given the input scRGB ICC source profile. - // - if (pSrcData[cChan] <= -2.0f) - { - pDstData[cChan] = 0; - } - else if (pSrcData[cChan] >= 2.0f) - { - pDstData[cChan] = 0xFFFF; - } - else - { - pDstData[cChan] = static_cast(kMaxWordAsFloat * (pSrcData[cChan] + 2.0) / 4.0f); - } - } - - pSrcData += cSrcChannels; - pDstData += cDstChannels; - } - } - else if (eICMFormDst == kBM_16b_RGB && - (eICMFormSrc == kBM_S2DOT13FIXED_scRGB || - eICMFormSrc == kBM_S2DOT13FIXED_scARGB)) - { - WORD* pSrcData = reinterpret_cast(pSrc); - WORD* pDstData = reinterpret_cast(pDst); - - while (pSrcData <= reinterpret_cast(pSrcEnd) - cSrcChannels && - pDstData <= reinterpret_cast(pDstEnd) - cDstChannels) - { - for (UINT cChan = 0; - cChan < cDstChannels && cChan < cSrcChannels; - cChan++) - { - // - // Note: We are only converting from S2DOT13FIXED and not applying gamma modification - // as the transform should account for this given the input scRGB ICC source profile. - // - pDstData[cChan] = pSrcData[cChan] & kS2Dot13Neg ? pSrcData[cChan] ^ 0xFFFF : pSrcData[cChan] | kS2Dot13Neg; - } - - pSrcData += cSrcChannels; - pDstData += cDstChannels; - } - } - else - { - hr = E_NOTIMPL; - } - } - } - - // - // Set the out buffer pointer and size to the copy buffer - // - if (SUCCEEDED(hr)) - { - m_pData = m_pScanBuffer; - m_cbData = m_cbScanBuffer; - } - } - } - else - { - // - // Set the out buffer pointer and size to the WIC pixel data - // - m_pData = pWicPxData; - m_cbData = cbWicPxData; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWICToBMFormatScan::Commit - -Routine Description: - - Commits the internal scanline data to the WIC data buffer - -Arguments: - - pWicPxData - Pointer to the WIC data - cbWicPxData - Count of bytes in the WIC data buffer - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWICToBMFormatScan::Commit( - _In_reads_bytes_(cbWicPxData) PBYTE pWicPxData, - _In_ CONST UINT cbWicPxData - ) -{ - HRESULT hr = m_bInitialized ? S_OK : E_PENDING; - - COLORDATATYPE srcColType = COLOR_BYTE; - EICMPixelFormat eICMFormSrc = kBM_RGBTRIPLETS; - - COLORDATATYPE dstColType = COLOR_BYTE; - EICMPixelFormat eICMFormDst = kBM_RGBTRIPLETS; - - // - // Validate input - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(pWicPxData, E_POINTER))) - { - if (m_convData.m_pixFormTarget >= kWICPixelFormatMin && - m_convData.m_pixFormTarget < kWICPixelFormatMax) - { - // - // Set up the destination and source formats - // - eICMFormDst = g_lutWICToBMFormat[m_convData.m_pixFormTarget].m_bmFormTarget; - dstColType = g_lutWICToBMFormat[m_convData.m_pixFormTarget].m_colDataType; - - if (m_convData.m_bmFormTarget < kICMPixelFormatMax && - m_convData.m_bmFormTarget >= kICMPixelFormatMin) - { - eICMFormSrc = m_convData.m_bmFormTarget; - srcColType = g_lutBMFormatData[eICMFormSrc].m_colDataType; - } - else - { - hr = E_FAIL; - } - } - else - { - hr = E_FAIL; - } - } - - // - // Validate source and destination formats - // - if (SUCCEEDED(hr)) - { - if (eICMFormSrc < kICMPixelFormatMin || - eICMFormSrc >= kICMPixelFormatMax || - eICMFormDst < kICMPixelFormatMin || - eICMFormDst >= kICMPixelFormatMax) - { - RIP("Invalid pixel format.\n"); - - hr = E_FAIL; - } - else if (srcColType < COLOR_BYTE || - srcColType > COLOR_S2DOT13FIXED || - dstColType < COLOR_BYTE || - dstColType > COLOR_S2DOT13FIXED) - { - RIP("Invalid color data type.\n"); - - hr = E_FAIL; - } - } - - if (SUCCEEDED(hr)) - { - if (pWicPxData != m_pData) - { - // - // We need to convert the scan buffer and write back into the WIC buffer - // - PBYTE pDst = pWicPxData; - UINT cDstChannels = g_lutWICToBMFormat[m_convData.m_pixFormTarget].m_cChannels; - size_t cbDstBytesPerPixel = g_lutColorDataSize[dstColType] * cDstChannels; - - PBYTE pSrc = m_pScanBuffer; - UINT cSrcChannels = g_lutBMFormatData[eICMFormSrc].m_cChannels; - size_t cbSrcBytesPerPixel = g_lutColorDataSize[srcColType] * cSrcChannels; - - PBYTE pSrcEnd = pSrc + m_cbScanBuffer; - PBYTE pDstEnd = pDst + cbWicPxData; - - if (srcColType == m_convData.m_colDataType) - { - while (pSrc < pSrcEnd && - pDst < pDstEnd) - { - if (pDst + cbSrcBytesPerPixel < pDstEnd) - { - CopyMemory(pDst, pSrc, cbSrcBytesPerPixel); - } - - pSrc += cbSrcBytesPerPixel; - pDst += cbDstBytesPerPixel; - } - } - else - { - // - // We should only ever be required to convert from 16 bpc RGB to floating point - // and fixed point scRGB formats - // - if (eICMFormSrc == kBM_16b_RGB && - (eICMFormDst == kBM_32b_scRGB || - eICMFormDst == kBM_32b_scARGB)) - { - WORD* pSrcData = reinterpret_cast(pSrc); - FLOAT* pDstData = reinterpret_cast(pDst); - UINT cAlpha = eICMFormDst == kBM_32b_scARGB ? 1 : 0; - - while (pSrcData <= reinterpret_cast(pSrcEnd) - cSrcChannels && - pDstData <= reinterpret_cast(pDstEnd) - cDstChannels) - { - pDstData += cAlpha; - - for (UINT cChan = 0; - cChan < (cDstChannels - cAlpha) && cChan < cSrcChannels; - cChan++) - { - // - // Note: We are only converting to FLOAT and not applying gamma modification - // as the transform should account for this given the input scRGB ICC source profile. - // - pDstData[cChan] = (4.0f * static_cast(pSrcData[cChan]) / kMaxWordAsFloat) - 2.0f; - } - - pSrcData += cSrcChannels; - pDstData += cDstChannels - cAlpha; - } - } - else if (eICMFormSrc == kBM_16b_RGB && - (eICMFormDst == kBM_S2DOT13FIXED_scRGB || - eICMFormDst == kBM_S2DOT13FIXED_scARGB)) - { - WORD* pSrcData = reinterpret_cast(pSrc); - WORD* pDstData = reinterpret_cast(pDst); - UINT cAlpha = eICMFormDst == kBM_S2DOT13FIXED_scARGB ? 1 : 0; - - while (pSrcData <= reinterpret_cast(pSrcEnd) - cSrcChannels && - pDstData <= reinterpret_cast(pDstEnd) - cDstChannels) - { - pDstData += cAlpha; - - for (UINT cChan = 0; - cChan < (cDstChannels - cAlpha) && cChan < cSrcChannels; - cChan++) - { - // - // Note: We are only converting to S2DOT13FIXED and not applying gamma modification - // as the transform should account for this given the input scRGB ICC source profile. - // - pDstData[cChan] = pSrcData[cChan] & kS2Dot13Neg ? - pSrcData[cChan] ^ kS2Dot13Neg : pSrcData[cChan] ^ 0xFFFF; - } - - pSrcData += cSrcChannels; - pDstData += cDstChannels - cAlpha; - } - } - else - { - hr = E_NOTIMPL; - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWICToBMFormatScan::GetData - -Routine Description: - - Retrieves the BMFORMAT buffer ready for processing - -Arguments: - - ppData - Pointer to a pointer that recieves the address of the data buffer. - Note: the buffer is only valid for the lifetime of the CWICToBMFormatScan object. - pBmFormat - Pointer to a BMFORMAT enum that recieves the type - pcWidth - Pointer to storage that recieves the pixel width - pcbStride - Pointer to storage that recieves the scanline stride - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWICToBMFormatScan::GetData( - _Outptr_result_bytebuffer_(*pcbStride) PBYTE* ppData, - _Out_ BMFORMAT* pBmFormat, - _Out_ UINT* pcWidth, - _Out_ UINT* pcbStride - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pBmFormat, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcWidth, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcbStride, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pData, E_PENDING))) - { - if (m_convData.m_bmFormTarget >= kICMPixelFormatMin && - m_convData.m_bmFormTarget < kICMPixelFormatMax) - { - *pBmFormat = g_lutBMFormatData[m_convData.m_bmFormTarget].m_bmFormat; - *pcWidth = m_cWidth; - *ppData = m_pData; - *pcbStride = static_cast(m_cbData); - } - else - { - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWICToBMFormatScan::CreateScanBuffer - -Routine Description: - - Creates the intermediate scanline buffer - -Arguments: - - cWidth - Pixel width of the scanline - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWICToBMFormatScan::CreateScanBuffer( - _In_ CONST UINT cWidth, - _In_ CONST SIZE_T cbDataType, - _In_ CONST UINT cChannels - ) -{ - HRESULT hr = S_OK; - - if (cWidth > MAX_PIXELWIDTH_COUNT || - cbDataType > MAX_COLDATATYPE_SIZE || - cChannels > MAX_COLCHANNEL_COUNT) - { - hr = E_INVALIDARG; - } - - size_t cbScanBuffer = 0; - - if (SUCCEEDED(hr)) - { - if (FAILED(SizeTMult(cWidth, cbDataType, &cbScanBuffer)) || - FAILED(SizeTMult(cbScanBuffer, cChannels, &cbScanBuffer))) - { - hr = HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW); - } - - } - - if (SUCCEEDED(hr)) - { - if (cbScanBuffer != m_cbScanBuffer) - { - FreeScanBuffer(); - m_pScanBuffer = new(std::nothrow) BYTE[cbScanBuffer]; - if (SUCCEEDED(hr = CHECK_POINTER(m_pScanBuffer, E_OUTOFMEMORY))) - { - m_cbScanBuffer = cbScanBuffer; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWICToBMFormatScan::FreeScanBuffer - -Routine Description: - - Free the intermediate scanline buffer - -Arguments: - - None - -Return Value: - - None - ---*/ -VOID -CWICToBMFormatScan::FreeScanBuffer( - VOID - ) -{ - if (m_pScanBuffer != NULL) - { - delete[] m_pScanBuffer; - m_pScanBuffer = NULL; - } - - m_cbScanBuffer = 0; -} - diff --git a/print/XPSDrvSmpl/src/filters/color/wictobmscn.h b/print/XPSDrvSmpl/src/filters/color/wictobmscn.h deleted file mode 100644 index 6ac780be..00000000 --- a/print/XPSDrvSmpl/src/filters/color/wictobmscn.h +++ /dev/null @@ -1,88 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wictobmscn.h - -Abstract: - - WIC pixel format to BMFORMAT conversion class implementation. This class provides methods - for converting between a source WIC scanline to a target destination BMFORMAT scanline. - ---*/ - -#pragma once - -#include "bmpdata.h" - -class CWICToBMFormatScan -{ -public: - CWICToBMFormatScan(); - - virtual ~CWICToBMFormatScan(); - - HRESULT - Initialize( - _In_ CONST WICToBMFORMAT& WICToBM - ); - - HRESULT - SetData( - _In_ CONST BOOL bIsSrc, - _In_reads_bytes_(cbWicPxData) PBYTE pWicPxData, - _In_ CONST UINT cbWicPxData, - _In_ CONST UINT cWidth - ); - - HRESULT - Commit( - _In_reads_bytes_(cbWicPxData) PBYTE pWicPxData, - _In_ CONST UINT cbWicPxData - ); - - HRESULT - GetData( - _Outptr_result_bytebuffer_(*pcbStride) PBYTE* ppData, - _Out_ BMFORMAT* pBmFormat, - _Out_ UINT* pcWidth, - _Out_ UINT* pcbStride - ); - -private: - HRESULT - CreateScanBuffer( - _In_ CONST UINT cWidth, - _In_ CONST SIZE_T cbDataType, - _In_ CONST UINT cChannels - ); - - VOID - FreeScanBuffer( - VOID - ); - -private: - WICToBMFORMAT m_convData; - - PBYTE m_pScanBuffer; - - size_t m_cbScanBuffer; - - UINT m_cWidth; - - PBYTE m_pData; - - size_t m_cbData; - - BOOL m_bInitialized; -}; diff --git a/print/XPSDrvSmpl/src/filters/common/clasfact.h b/print/XPSDrvSmpl/src/filters/common/clasfact.h deleted file mode 100644 index 409fc9bc..00000000 --- a/print/XPSDrvSmpl/src/filters/common/clasfact.h +++ /dev/null @@ -1,202 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - clasfact.h - -Abstract: - - This file defines a template IClassFactory implementation - to be returned by each filter's DllGetClassObject() function. - - Also, a routine to return one of these class factories so that - this code does not need to be duplicated in every filter's - DllGetClassObject(). - ---*/ - -#pragma once - -#include "cunknown.h" -#include "globals.h" - -template -class CClassFactory : public CUnknown -{ -public: - // - // Constructor and Destruction - // - CClassFactory() : - CUnknown(IID_IClassFactory) - { } - - virtual ~CClassFactory() - { } - - // - // IClassFactory methods - // - virtual HRESULT STDMETHODCALLTYPE - CreateInstance( - _In_opt_ LPUNKNOWN pUnkOuter, - _In_ REFIID riid, - _Outptr_ PVOID* ppvObject - ) - { - HRESULT hr = S_OK; - - if (ppvObject == NULL) - { - hr = E_POINTER; - goto Exit; - } - *ppvObject = NULL; - - if (pUnkOuter == NULL) - { - // - // Create Filter - // - _T* pFilter = NULL; - - try - { - pFilter = new(std::nothrow) _T; - hr = CHECK_POINTER(pFilter, E_OUTOFMEMORY); - } - catch (CXDException& e) - { - if (pFilter != NULL) - { - delete pFilter; - pFilter = NULL; - } - - hr = e; - } - catch(...) - { - hr = E_FAIL; - } - - if (SUCCEEDED(hr)) - { - // - // Get the requested interface - // - hr = pFilter->QueryInterface(riid, ppvObject) ; - - // - // Release the IUnknown pointer. If QueryInterface failed - // the Release() call will clean up - // - pFilter->Release(); - } - } - else - { - // - // Cannot aggregate - // - hr = CLASS_E_NOAGGREGATION; - } - - Exit: - ERR_ON_HR(hr); - return hr; - } - - virtual HRESULT STDMETHODCALLTYPE - LockServer( - _In_ BOOL bLock - ) - { - if (bLock) - { - InterlockedIncrement(&g_cServerLocks); - } - else - { - InterlockedDecrement(&g_cServerLocks); - } - - return S_OK; - } -}; - -template -HRESULT -GetFilterClassFactory( - _In_ REFCLSID rclsid, - _In_ REFIID riid, - _In_ REFCLSID expectedclsid, - _Out_ VOID** ppv - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppv, E_POINTER))) - { - *ppv = NULL; - - // - // Make sure the appropriate class factory is being requested - // - if (rclsid == expectedclsid) - { - CClassFactory<_T>* pFactory = NULL; - - try - { - pFactory = new(std::nothrow) CClassFactory<_T>(); - hr = CHECK_POINTER(pFactory, E_OUTOFMEMORY); - } - catch (CXDException& e) - { - if (pFactory != NULL) - { - delete pFactory; - pFactory = NULL; - } - - hr = e; - } - catch (...) - { - hr = E_FAIL; - } - - if (SUCCEEDED(hr)) - { - // - // Get the requested interface. - // - hr = pFactory->QueryInterface(riid, ppv); - - // - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - // - pFactory->Release(); - } - } - else - { - hr = CLASS_E_CLASSNOTAVAILABLE; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/common/precompsrc.cpp b/print/XPSDrvSmpl/src/filters/common/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/XPSDrvSmpl/src/filters/common/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/common/ptmanage.cpp b/print/XPSDrvSmpl/src/filters/common/ptmanage.cpp deleted file mode 100644 index fa50170f..00000000 --- a/print/XPSDrvSmpl/src/filters/common/ptmanage.cpp +++ /dev/null @@ -1,1216 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - ptmanage.cpp - -Abstract: - - PrintTicket management class implementation. This class encapsulate - PrintTicket handling algorithm defined in the XPS Document specification. - It provides a simple set and get interace for to filters and handles - merging of tickets and the use of the Win32 PrintTicket provider API. - The algorithm for determining the PrintTicket applies as follows: - - 1. Validate and merge the PrintTicket from the FDS with the default - printicket converted from the property bag. - The resultant ticket will be the Job level ticket. - - 2. Validate and merge the PrintTicket from the current FD with the Job - level ticket from step 1. The resultant ticket will be the document - level ticket. - - 3. Validate and merge the PrintTicket from the current FP with the Doc - level ticket from step 2. The resultant ticket will be the page - level ticket. - - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "ptmanage.h" -#include "streamcnv.h" - -/*++ - -Routine Name: - - CPTManager::CPTManager - -Routine Description: - - CPTManager class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPTManager::CPTManager() : - m_pDefaultPT(NULL), - m_pJobPT(NULL), - m_pDocPT(NULL), - m_pPagePT(NULL), - m_hProvider(NULL), - m_hToken(INVALID_HANDLE_VALUE) -{ -} - -/*++ - -Routine Name: - - CPTManager::~CPTManager - -Routine Description: - - CPTManager class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPTManager::~CPTManager() -{ - // - // Close the PT provider - // - CloseProvider(); -} - -/*++ - -Routine Name: - - CPTManager::Initialise - -Routine Description: - - This routine Initialises the PrintTicket manager with the default PrintTicket - and the device name. - -Arguments: - - pDefaultTicketStream - Pointer to the default user PrintTicket as an IStream - bstrPrinterName - The name of the printer - userToken - The user's security token - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::Initialise( - _In_ IPrintReadStream* pDefaultTicketStream, - _In_z_ BSTR bstrPrinterName, - _In_ HANDLE userToken - ) -{ - HRESULT hr = S_OK; - - m_hToken = userToken; - - // - // If the provider is already open close it - // - CloseProvider(); - - if (SUCCEEDED(hr = CHECK_POINTER(pDefaultTicketStream, E_POINTER))) - { - if (SysStringLen(bstrPrinterName) <= 0) - { - hr = E_INVALIDARG; - } - } - - // - // We need to impersonate the user who submitted the job - // in order to always have sufficient rights to call - // PTOpenProvider. - // - if (SUCCEEDED(hr)) - { - if (SetThreadToken(NULL, m_hToken)) - { - // - // Open the PT interface and initialise PrintTickets - // - if (SUCCEEDED(hr = PTOpenProvider(bstrPrinterName, 1, &m_hProvider))) - { - CComPtr pPTStream(NULL); - pPTStream.Attach(new(std::nothrow) CPrintReadStreamToIStream(pDefaultTicketStream)); - - if (SUCCEEDED(hr = CHECK_POINTER(pPTStream, E_OUTOFMEMORY))) - { - hr = InitialisePrintTickets(pPTStream); - } - } - - // - // Always revert back to the default security context - // - if (!SetThreadToken(NULL, NULL)) - { - // - // We couldn't revert the security context. The filter pipeline - // manager will clean up the thread when operation is complete, - // when it is determined that the security context was not - // reverted. Since there are no security implications with - // running this filter in an elevated context, we can - // continue to run. - // - } - } - else - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTManager::SetTicket - -Routine Description: - - This routine sets the Job level PrintTicket from the PrintTicket held in the - FixedDocumentSequence. If there is no PrintTicket associated with the FDS, the - default PrintTicket is used to set the Job level PrintTicket. - -Arguments: - - pFDS - Pointer to the FixedDocumentSequence interface - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::SetTicket( - _In_ CONST IFixedDocumentSequence* pFDS - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFDS, E_POINTER))) - { - CComPtr pPTRef(NULL); - - // - // If a PrintTicket is available merge it at the job level - // - if (SUCCEEDED(hr = const_cast(pFDS)->GetPrintTicket(&pPTRef))) - { - hr = MergeTicket(kPTJobScope, pPTRef); - } - else if (hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)) - { - // - // This indicates there is no print-ticket associated with - // the job. Free the tickets from this scope upward and - // reintialise the defaults - // - FreePrintTickets(kPTJobScope); - hr = UpdateDefaultPTs(kPTJobScope); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTManager::SetTicket - -Routine Description: - - This routine sets the Socument level PrintTicket from the PrintTicket held in the - FixedDocument. If there is no PrintTicket associated with the FD, the - FixedDocumentSequence PrintTicket is used to set the Docuemnt level PrintTicket. - -Arguments: - - pFD - Pointer to the FixedDocument interface - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::SetTicket( - _In_ CONST IFixedDocument* pFD - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFD, E_POINTER))) - { - CComPtr pPTRef(NULL); - - // - // If a PrintTicket is available merge it at the doc level - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = const_cast(pFD)->GetPrintTicket(&pPTRef))) - { - hr = MergeTicket(kPTDocumentScope, pPTRef); - } - else if (hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)) - { - // - // This indicates there is no print-ticket associated with - // the job. Free the tickets from this scope upward and - // reintialise the defaults - // - FreePrintTickets(kPTDocumentScope); - hr = UpdateDefaultPTs(kPTDocumentScope); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTManager::SetTicket - -Routine Description: - - This routine sets the Page level PrintTicket from the PrintTicket held in the - FixedPage. If there is no PrintTicket associated with the FP, the - FixedDocument PrintTicket is used to set the Page level PrintTicket. - -Arguments: - - pFP - Pointer to the FixedPage interface - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::SetTicket( - _In_ CONST IFixedPage* pFP - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFP, E_POINTER))) - { - CComPtr pPTRef(NULL); - - // - // If a PrintTicket is available merge it at the page level - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = const_cast(pFP)->GetPrintTicket(&pPTRef))) - { - hr = MergeTicket(kPTPageScope, pPTRef); - } - else if (hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)) - { - // - // This indicates there is no print-ticket associated with - // the job. Free the tickets from this scope upward and - // reintialise the defaults - // - FreePrintTickets(kPTPageScope); - hr = UpdateDefaultPTs(kPTPageScope); - } - } - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CPTManager::SetTicket - -Routine Description: - - Sets the PrintTicket at the specified scope given a PrintTicket defined - as a DOM document - -Arguments: - - ptScope - The scope of the PrintTicket to be set - pPT - Pointer to an IXMLDOMDocument2 interface that contains the PrintTicket to be set - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::SetTicket( - _In_ CONST EPrintTicketScope ptScope, - _In_opt_ CONST IXMLDOMDocument2* pPT - ) -{ - HRESULT hr = S_OK; - - // - // Free the tickets from this scope upward and reintialise - // from the appropriate default. This ensures we are not - // using an old PrintTicket from the same scope - // - FreePrintTickets(ptScope); - - if (SUCCEEDED(hr = UpdateDefaultPTs(ptScope))) - { - if (pPT) - { - hr = MergeTicket(ptScope, pPT); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTManager::GetTicket - -Routine Description: - - This routine retrieves the PrintTicket at the requested scope - -Arguments: - - ptScope - The scope of the PrintTicket to be retrieved - ppTicket - Pointer to an IXMLDOMDocument2 interface pointer that recieves the PrintTicket - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::GetTicket( - _In_ CONST EPrintTicketScope ptScope, - _Outptr_ IXMLDOMDocument2** ppTicket - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppTicket, E_POINTER)) && - SUCCEEDED(hr = UpdateDefaultPTs(ptScope))) - { - *ppTicket = NULL; - - switch (ptScope) - { - case kPTPageScope: - { - // - // Pointer should either be default or FP ticket but never NULL - // - ASSERTMSG(m_pPagePT != NULL, "NULL Page PrintTicket.\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pPagePT, E_PENDING))) - { - *ppTicket = m_pPagePT; - } - } - break; - - case kPTDocumentScope: - { - // - // Pointer should either be default or FD ticket but never NULL - // - ASSERTMSG(m_pDocPT != NULL, "NULL Document PrintTicket.\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pDocPT, E_PENDING))) - { - *ppTicket = m_pDocPT; - } - } - break; - - case kPTJobScope: - { - // - // Pointer should either be default or FDS ticket but never NULL - // - ASSERTMSG(m_pJobPT != NULL, "NULL Job PrintTicket.\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pJobPT, E_PENDING))) - { - *ppTicket = m_pJobPT; - } - } - break; - - default: - { - RIP("Unrecognised PT scope\n"); - - hr = E_INVALIDARG; - } - break; - } - - if (*ppTicket == NULL) - { - RIP("Failed to retrieve a valid PrintTicket\n"); - - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CPTManager::GetCapabilities - -Routine Description: - - This routine retrieves a PrintCapabilities document given a PrintTicket - -Arguments: - - pTicket - Pointer to the PrintTicket as a DOM document - pTicket - Pointer to a DOM document pointer that recieves the PrintCapabilities - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::GetCapabilities( - _In_ IXMLDOMDocument2* pTicket, - _Outptr_ IXMLDOMDocument2** ppCapabilities - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pTicket, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppCapabilities, E_POINTER))) - { - *ppCapabilities = NULL; - - CComBSTR bstrError; - CComPtr pPTIn(NULL); - CComPtr pPCOut(NULL); - CComPtr pCapabilitiesDoc(NULL); - - // - // Create the PrintCapabilities DOM document, retrieve the IStreams from the - // DOM documents and call the PT api to retrieve the capabilities document - // - if (SUCCEEDED(hr = pCapabilitiesDoc.CoCreateInstance(CLSID_DOMDocument60)) && - SUCCEEDED(hr = pTicket->QueryInterface(IID_IStream, reinterpret_cast(&pPTIn))) && - SUCCEEDED(hr = pCapabilitiesDoc->QueryInterface(IID_IStream, reinterpret_cast(&pPCOut)))) - { - if (SetThreadToken(NULL, m_hToken)) - { - if (SUCCEEDED(hr = PTGetPrintCapabilities(m_hProvider, pPTIn, pPCOut, &bstrError))) - { - LARGE_INTEGER cbMove = {0}; - if (SUCCEEDED(hr = pPCOut->Seek(cbMove, STREAM_SEEK_SET, NULL))) - { - *ppCapabilities = pCapabilitiesDoc.Detach(); - } - } - else - { - try - { - CStringXDA cstrError(bstrError); - ERR(cstrError.GetBuffer()); - } - catch (CXDException&) - { - } - } - - // - // Always revert back to the default security context - // - if (!SetThreadToken(NULL, NULL)) - { - // - // We couldn't revert the security context. The filter pipeline - // manager will clean up the thread when operation is complete, - // when it is determined that the security context was not - // reverted. Since there are no security implications with - // running this filter in an elevated context, we can - // continue to run. - // - } - } - else - { - hr = HRESULT_FROM_WIN32(GetLastError()); - - // - // If SetThreadToken fails, GetLastError will return an error - // - _Analysis_assume_(FAILED(hr)); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTManager::InitialisePrintTickets - -Routine Description: - - This routine intialises the PrintTickets at the default, job, document and page scope - using an IStream containing the default PrintTicket mark-up - -Arguments: - - pDefaultPTStream - Pointer to an IStream interface that contains the default PrintTicket data - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::InitialisePrintTickets( - _In_ IStream* pDefaultPTStream - ) -{ - ASSERTMSG(m_hProvider != NULL, "NULL PrintTicket provider interface detected.\n"); - - HRESULT hr = S_OK; - - // - // Make sure all print tickets are released - // - m_pDefaultPT = NULL; - m_pJobPT = NULL; - m_pDocPT = NULL; - m_pPagePT = NULL; - - if (SUCCEEDED(hr = CHECK_POINTER(pDefaultPTStream, E_POINTER))) - { - // - // Create the DOM documents for default PT - // - hr = SetPTFromStream(pDefaultPTStream, &m_pDefaultPT); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTManager::SetPTFromDOMDoc - -Routine Description: - - This routine copies one DOM document representation of the PrintTicket to another - -Arguments: - - pPTDOMDoc - Pointer to the source PrintTicket as a DOM document - ppDomDoc - Pointer to an IXMLDOMDOcument pointer that recieves the copied PrintTicket - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::SetPTFromDOMDoc( - _In_ IXMLDOMDocument2* pPTDOMDoc, - _Outptr_ IXMLDOMDocument2** ppDomDoc - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPTDOMDoc, E_POINTER))) - { - // - // Get the IStream from the DOM doc and pass to SetPTFromStream - // - CComPtr pStream(NULL); - if (SUCCEEDED(hr = pPTDOMDoc->QueryInterface(IID_IStream, reinterpret_cast(&pStream)))) - { - hr = SetPTFromStream(pStream, ppDomDoc); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTManager::SetPTFromStream - -Routine Description: - - This routine copies an IStream representation of the PrintTicket to a DOM document - -Arguments: - - pPTStream - Pointer to the source PrintTicket as an IStream - ppDomDoc - Pointer to an IXMLDOMDOcument pointer that recieves the copied PrintTicket - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::SetPTFromStream( - _In_ IStream* pPTStream, - _Outptr_ IXMLDOMDocument2** ppDomDoc - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPTStream, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppDomDoc, E_POINTER))) - { - *ppDomDoc = NULL; - - LARGE_INTEGER cbMoveFromStart = {0}; - CComPtr pDOMDoc(NULL); - VARIANT_BOOL fLoaded = VARIANT_FALSE; - - // - // Create the DOM document instance, seek to the start of the - // PT stream and load into the dom document - // - if (SUCCEEDED(hr = pDOMDoc.CoCreateInstance(CLSID_DOMDocument60)) && - SUCCEEDED(hr = pPTStream->Seek(cbMoveFromStart, STREAM_SEEK_SET, NULL)) && - SUCCEEDED(hr = pDOMDoc->load(CComVariant(pPTStream), &fLoaded))) - { - if (fLoaded == VARIANT_TRUE) - { - // - // Assign the outgoing element pointer - detach from CComPtr to release ownership - // - *ppDomDoc = pDOMDoc.Detach(); - } - else - { - hr = E_FAIL; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTManager::MergeTicket - -Routine Description: - - This routine merges a PrintTicket (supplied as a IPartPrintTicket pointer) into - the DOM representation of the PrintTicket at the requested scope - -Arguments: - - ptScope - The scope at which the PrintTicket is to be merged - pPTRef - Pointer to an IPartPrintTicket interface containing the PrintTicket to be merged - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::MergeTicket( - _In_ CONST EPrintTicketScope ptScope, - _In_ CONST IPartPrintTicket* pPTRef - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPTRef, E_POINTER))) - { - // - // Create a DOM document from the PT ref stream - // - CComPtr pNewPT(NULL); - CComPtr pRead(NULL); - - if (SUCCEEDED(hr = pNewPT.CoCreateInstance(CLSID_DOMDocument60)) && - SUCCEEDED(hr = const_cast(pPTRef)->GetStream(&pRead))) - { - CComPtr pReadStreamToSeq(NULL); - VARIANT_BOOL fLoaded = VARIANT_FALSE; - - pReadStreamToSeq.Attach(new(std::nothrow) pfp::PrintReadStreamToSeqStream(pRead)); - - if (SUCCEEDED(hr = CHECK_POINTER(pReadStreamToSeq, E_OUTOFMEMORY)) && - SUCCEEDED(hr = pNewPT->load(CComVariant(pReadStreamToSeq), &fLoaded))) - { - if (fLoaded == VARIANT_TRUE) - { - hr = MergeTicket(ptScope, pNewPT); - } - else - { - hr = E_FAIL; - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTManager::MergeTicket - -Routine Description: - - This routine merges a PrintTicket (supplied as a IXMLDOMDocument2 pointer) into - the DOM representation of the PrintTicket at the requested scope - -Arguments: - - ptScope - The scope at which the PrintTicket is to be merged - pPT - Pointer to an IXMLDOMDocument2 interface containing the PrintTicket to be merged - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::MergeTicket( - _In_ CONST EPrintTicketScope ptScope, - _In_ CONST IXMLDOMDocument2* pPT - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPT, E_POINTER))) - { - CComPtr pPTLevelUp(NULL); - CComPtr pResult(NULL); - - switch (ptScope) - { - case kPTJobScope: - { - pPTLevelUp = m_pDefaultPT; - } - break; - - case kPTDocumentScope: - { - pPTLevelUp = m_pJobPT; - } - break; - - case kPTPageScope: - { - pPTLevelUp = m_pDocPT; - } - break; - - default: - { - RIP("Unrecognised PT scope\n"); - - hr = E_INVALIDARG; - } - break; - } - - ASSERTMSG(pPTLevelUp != NULL, "PrintTicket at the level up has not been set (check part handler is attempting to)\n"); - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(pPTLevelUp, E_PENDING)) && - SUCCEEDED(hr = GetMergedTicket(ptScope, pPT, pPTLevelUp, &pResult))) - { - switch (ptScope) - { - case kPTJobScope: - { - m_pJobPT = pResult; - } - break; - - case kPTDocumentScope: - { - m_pDocPT = pResult; - } - break; - - case kPTPageScope: - { - m_pPagePT = pResult; - } - break; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTManager::GetMergedTicket - -Routine Description: - - This routine retrieves a merged PrintTicket at the requested scope given the base - and delta PrintTickets as IXMLDOMDocument2 interface pointers - -Arguments: - - ptScope - The scope at which the merge should take place - pDelta - The delta PrintTicket as an IXMLDOMDocument2 pointer - pBase - The base PrintTicket as an IXMLDOMDocument2 pointer - ppResult - The resulting PrintTicket after the merge has completed - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::GetMergedTicket( - _In_ CONST EPrintTicketScope ptScope, - _In_ CONST IXMLDOMDocument2* pDelta, - _In_ IXMLDOMDocument2* pBase, - _Outptr_ IXMLDOMDocument2** ppResult - ) -{ - ASSERTMSG(pDelta != NULL, "NULL PT reference part passed.\n"); - ASSERTMSG(pBase != NULL, "NULL base PT passed.\n"); - ASSERTMSG(ppResult != NULL, "NULL out PT passed.\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_HANDLE(m_hProvider, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(ppResult, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDelta, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pBase, E_POINTER))) - { - *ppResult = NULL; - } - - CComPtr pResultStream(NULL); - CComPtr pBaseStream(NULL); - CComPtr pDeltaStream(NULL); - - CComPtr pNewPT(NULL); - - // - // Create a new DOM doc based off the result ticket and - // assign to the resultant DOM doc - // - try - { - CComBSTR bstrErrorMessage; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CreateStreamOnHGlobal(NULL, TRUE, &pResultStream)) && - SUCCEEDED(hr = pBase->QueryInterface(IID_IStream, reinterpret_cast(&pBaseStream))) && - SUCCEEDED(hr = const_cast(pDelta)->QueryInterface(IID_IStream, reinterpret_cast(&pDeltaStream)))) - { - if (SetThreadToken(NULL, m_hToken)) - { - if (SUCCEEDED(hr = PTMergeAndValidatePrintTicket(m_hProvider, - pBaseStream, - pDeltaStream, - ptScope, - pResultStream, - &bstrErrorMessage))) - { - if (SUCCEEDED(hr = SetPTFromStream(pResultStream, &pNewPT))) - { - // - // Assign the outgoing element pointer - detach from CComPtr to release ownership - // - *ppResult = pNewPT.Detach(); - } - } - else - { - CStringXDA cstrMessage; - CStringXDA cstrError(bstrErrorMessage); - cstrMessage.Format("PTMergeAndValidatePrintTicket failed with message: %s\n", static_cast(cstrError)); - - ERR(cstrMessage.GetBuffer()); - } - - // - // Always revert back to the default security context - // - if (!SetThreadToken(NULL, NULL)) - { - // - // We couldn't revert the security context. The filter pipeline - // manager will clean up the thread when operation is complete, - // when it is determined that the security context was not - // reverted. Since there are no security implications with - // running this filter in an elevated context, we can - // continue to run. - // - } - } - else - { - hr = HRESULT_FROM_WIN32(GetLastError()); - - // - // If SetThreadToken fails, GetLastError will return an error - // - _Analysis_assume_(FAILED(hr)); - } - } - } - catch (CXDException& e) - { - hr = e; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTManager::CloseProvider - -Routine Description: - - This routine closes the PrintTicket provider - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::CloseProvider( - VOID - ) -{ - HRESULT hr = S_OK; - - if (m_hProvider != NULL) - { - hr = PTCloseProvider(m_hProvider); - m_hProvider = NULL; - } - - return hr; -} - -/*++ - -Routine Name: - - CPTManager::UpdateDefaultPTs - -Routine Description: - - This routine updates the default PrintTicket at a given scope. This routine updates - the Job PrintTicket with the default, the Document with the Job and the Page with the - Document if they are not set and are within the requested scope. - -Arguments: - - ptScope - The scope of the PrintTicket to update - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPTManager::UpdateDefaultPTs( - _In_ CONST EPrintTicketScope ptScope - ) -{ - HRESULT hr = S_OK; - - // - // We need at least the default ticket in place - // - ASSERTMSG(m_pDefaultPT != NULL, "The default PrintTicket is not correctly set\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pDefaultPT, E_PENDING))) - { - if (ptScope <= kPTJobScope && - m_pJobPT == NULL) - { - hr = SetPTFromDOMDoc(m_pDefaultPT, &m_pJobPT); - } - - if (SUCCEEDED(hr) && - ptScope <= kPTDocumentScope && - m_pDocPT == NULL) - { - hr = SetPTFromDOMDoc(m_pJobPT, &m_pDocPT); - } - - if (SUCCEEDED(hr) && - ptScope == kPTPageScope && - m_pPagePT == NULL) - { - hr = SetPTFromDOMDoc(m_pDocPT, &m_pPagePT); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPTManager::FreePrintTickets - -Routine Description: - - This routine releases the PrintTicket at a given scope and all PrintTickets - that depend on it. - -Arguments: - - ptScope - The scope from which the PrintTickets should be released - -Return Value: - - None - ---*/ -VOID -CPTManager::FreePrintTickets( - _In_ CONST EPrintTicketScope ptScope - ) -{ - if (ptScope >= kPTPageScope) - { - m_pPagePT = NULL; - } - - if (ptScope >= kPTDocumentScope) - { - m_pDocPT = NULL; - } - - if (ptScope >= kPTJobScope) - { - m_pJobPT = NULL; - } -} - diff --git a/print/XPSDrvSmpl/src/filters/common/ptmanage.h b/print/XPSDrvSmpl/src/filters/common/ptmanage.h deleted file mode 100644 index 1c1e3f67..00000000 --- a/print/XPSDrvSmpl/src/filters/common/ptmanage.h +++ /dev/null @@ -1,153 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - ptmanage.cpp - -Abstract: - - PrintTicket management class definition. This class encapsulate - PrintTicket handling algorithm defined in the XPS Document specification. - It provides a simple set and get interace for to filters and handles - merging of tickets and the use of the Win32 PrintTicket provider API. - The algorithm for determining the PrintTicket applies as follows: - - 1. Validate and merge the PrintTicket from the FDS with the default - printicket converted from the default devmode in the property bag. - The resultant ticket will be the Job level ticket. - - 2. Validate and merge the PrintTicket from the current FD with the Job - level ticket from step 1. The resultant ticket will be the document - level ticket. - - 3. Validate and merge the PrintTicket from the current FP with the Doc - level ticket from step 2. The resultant ticket will be the page - level ticket. - ---*/ - -#pragma once - -class CPTManager -{ -public: - CPTManager(); - - virtual ~CPTManager(); - - HRESULT - Initialise( - _In_ IPrintReadStream* pDefaultTicketStream, - _In_z_ BSTR bstrPrinterName, - _In_ HANDLE userToken - ); - - HRESULT - SetTicket( - _In_ CONST IFixedDocumentSequence* pFDS - ); - - HRESULT - SetTicket( - _In_ CONST IFixedDocument* pFD - ); - - HRESULT - SetTicket( - _In_ CONST IFixedPage* pFP - ); - - HRESULT - SetTicket( - _In_ CONST EPrintTicketScope ptScope, - _In_opt_ CONST IXMLDOMDocument2* pPT - ); - - HRESULT - GetTicket( - _In_ CONST EPrintTicketScope ptScope, - _Outptr_ IXMLDOMDocument2** ppTicket - ); - - HRESULT - GetCapabilities( - _In_ IXMLDOMDocument2* pTicket, - _Outptr_ IXMLDOMDocument2** ppCapabilities - ); - -private: - HRESULT - InitialisePrintTickets( - _In_ IStream* pDefaultPTStream - ); - - HRESULT - SetPTFromDOMDoc( - _In_ IXMLDOMDocument2* pPTDOMDoc, - _Outptr_ IXMLDOMDocument2** ppDomDoc - ); - - HRESULT - SetPTFromStream( - _In_ IStream* pPTStream, - _Outptr_ IXMLDOMDocument2** ppDomDoc - ); - - HRESULT - MergeTicket( - _In_ CONST EPrintTicketScope ptScope, - _In_ CONST IPartPrintTicket* pPTRef - ); - - HRESULT - MergeTicket( - _In_ CONST EPrintTicketScope ptScope, - _In_ CONST IXMLDOMDocument2* pPT - ); - - HRESULT - GetMergedTicket( - _In_ CONST EPrintTicketScope ptScope, - _In_ CONST IXMLDOMDocument2* pDelta, - _In_ IXMLDOMDocument2* pBase, - _Outptr_ IXMLDOMDocument2** ppResult - ); - - HRESULT - CloseProvider( - VOID - ); - - HRESULT - UpdateDefaultPTs( - _In_ CONST EPrintTicketScope ptScope - ); - - VOID - FreePrintTickets( - _In_ CONST EPrintTicketScope ptScope - ); - -private: - CComPtr m_pDefaultPT; - - CComPtr m_pJobPT; - - CComPtr m_pDocPT; - - CComPtr m_pPagePT; - - HPTPROVIDER m_hProvider; - - HANDLE m_hToken; -}; - diff --git a/print/XPSDrvSmpl/src/filters/common/rescache.cpp b/print/XPSDrvSmpl/src/filters/common/rescache.cpp deleted file mode 100644 index 32b206e2..00000000 --- a/print/XPSDrvSmpl/src/filters/common/rescache.cpp +++ /dev/null @@ -1,309 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - rescache.cpp - -Abstract: - - File resource cache implementation. Filters that need to add resources - may be required to add the same resource to numerous pages in a job. To - prevent the same resource being sent repeatedly, the file resource cache - class implements an interface that filters can use to add resources - without needing to keep track of whether they have been sent. For specific - filter functionality, a class should be created that implements a resource - writer interface. This should be able to write the resource to a stream. The - filter can then add this class to the the resource cache and it will take - care of writing the resource via the IResWriter::WriteData method if it has - not already been written. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "rescache.h" - -/*++ - -Routine Name: - - CFileResourceCache::CFileResourceCache - -Routine Description: - - CFileResourceCache class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CFileResourceCache::CFileResourceCache() -{ -} - -/*++ - -Routine Name: - - CFileResourceCache::~CFileResourceCache - -Routine Description: - - CFileResourceCache class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CFileResourceCache::~CFileResourceCache() -{ -} - -/*++ - -Routine Name: - - CFileResourceCache::WriteResource - -Routine Description: - - This template function writes a resource to a fixed page. The type - of resource is supplied as an argument to the template. The resource - data is written via the IResWriter interface passed to the method. - -Arguments: - - pXpsConsumer - The XPS consumer to create the new resource part - pFixedPage - The FixedPage to send the resource to - pResWriter - The resource writer (hides the resource type behind a generic write interface) - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -template -HRESULT -CFileResourceCache::WriteResource( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ IResWriter* pResWriter - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pXpsConsumer, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pFixedPage, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pResWriter, E_POINTER))) - { - CComBSTR bstrKeyName; - CComBSTR bstrURI; - - // - // Check if the resource has already been written - // - if (SUCCEEDED(hr = pResWriter->GetKeyName(&bstrKeyName)) && - SUCCEEDED(hr = pResWriter->GetResURI(&bstrURI))) - { - if (!Cached(bstrKeyName)) - { - // - // The resource is not cached: - // 1. Create the resource part - // 2. Write data to part - // 3. Cache URI and new part against the resource name - // - CComPtr<_T> pRes(NULL); - CComPtr pWrite(NULL); - - if (SUCCEEDED(hr = pXpsConsumer->GetNewEmptyPart(bstrURI, - __uuidof(_T), - reinterpret_cast(&pRes), - &pWrite))) - { - hr = pResWriter->WriteData(pRes, pWrite); - - pWrite->Close(); - - try - { - CComPtr pPartBase(NULL); - if (SUCCEEDED(hr) && - SUCCEEDED(hr = pRes.QueryInterface(&pPartBase))) - { - m_resMap[CComBSTR(bstrKeyName)].first = bstrURI; - m_resMap[CComBSTR(bstrKeyName)].second = pPartBase; - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - } - - // - // Set the resource so relationships are updated - // - try - { - if (SUCCEEDED(hr)) - { - hr = pFixedPage->SetPagePart(m_resMap[CComBSTR(bstrKeyName)].second); - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CFileResourceCache::GetURI - -Routine Description: - - This routine retrieves the URI to a given resource - -Arguments: - - bstrResNameIn - The name of the resource for which the URI is required - pbstrURI - Pointer to a BSTR that recieves the resource URI - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CFileResourceCache::GetURI( - _In_z_ BSTR bstrResNameIn, - _Outptr_ BSTR* pbstrURI - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrURI, E_POINTER))) - { - if (SysStringLen(bstrResNameIn) == 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - try - { - CComBSTR bstrResName(bstrResNameIn); - CComBSTR uri(m_resMap[bstrResName].first); - - if (uri.Length() > 0) - { - if (SUCCEEDED(hr = uri.CopyTo(pbstrURI)) && - !*pbstrURI) - { - hr = E_OUTOFMEMORY; - } - } - else - { - *pbstrURI = NULL; - hr = E_FAIL; - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CFileResourceCache::Cached - -Routine Description: - - This routine checks if a resource has been cached - -Arguments: - - bstrResNameIn - The name (key) of the resource - -Return Value: - - BOOL - TRUE - The resource is in the cache - FALSE - The resource is not in the cache - ---*/ -BOOL -CFileResourceCache::Cached( - _In_z_ BSTR bstrResNameIn - ) -{ - BOOL bCached = FALSE; - - try - { - CComBSTR bstrResName(bstrResNameIn); - ResCache::const_iterator resMapIter = m_resMap.begin(); - - for (;resMapIter != m_resMap.end() && !bCached; resMapIter++) - { - if (resMapIter->first == bstrResName) - { - bCached = TRUE; - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - } - - return bCached; -} - diff --git a/print/XPSDrvSmpl/src/filters/common/rescache.h b/print/XPSDrvSmpl/src/filters/common/rescache.h deleted file mode 100644 index 554e6352..00000000 --- a/print/XPSDrvSmpl/src/filters/common/rescache.h +++ /dev/null @@ -1,132 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - rescache.h - -Abstract: - - File resource cache defintion and resource writer interface defintion. - Filters that need to add resources may be required to add the same resource - to numerous pages in a job. To prevent the same resource being sent - repeatedly, the file resource cache class implements an interface that - filters can use to add resources without needing to keep track of whether - they have been sent. For specific filter functionality, a class should be - created that implements a resource writer interface. This should be able to - write the resource to a stream. The filter can then add this class to the - the resource cache and it will take care of writing the resource via the - IResWriter::WriteData method if it has not already been written. - ---*/ - -#pragma once - -// -// The resource cache needs to map a unique name against the URI used -// and the part that was added. This allows us to retrieve the URI to -// write to the mark-up and also the part to set to the page/doc/docseq -// part. -// -typedef pair > URIPartPair; -typedef map ResCache; - -class IResWriter -{ -public: - IResWriter(){} - - virtual ~IResWriter(){} - - virtual HRESULT - WriteData( - _In_ IPartBase* pResource, - _In_ IPrintWriteStream* pWriter - ) = 0; - - virtual HRESULT - GetKeyName( - _Outptr_ BSTR* pbstrKeyName - ) = 0; - - virtual HRESULT - GetResURI( - _Outptr_ BSTR* pbstrResURI - ) = 0; - -}; - -class CFileResourceCache -{ -public: - CFileResourceCache(); - - virtual ~CFileResourceCache(); - - HRESULT - GetURI( - _In_z_ BSTR bstrResName, - _Outptr_ BSTR* pbstrURI - ); - - template - HRESULT - WriteResource( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ IResWriter* pResWriter - ); - -protected: - BOOL - Cached( - _In_z_ BSTR bstrResName - ); - -private: - ResCache m_resMap; -}; - -// -// Explicitly instantiate the IPartFont, IPartImage and IPartColorProfile WriteResource template functions -// -template -HRESULT -CFileResourceCache::WriteResource( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ IResWriter* pResWriter - ); - -template -HRESULT -CFileResourceCache::WriteResource( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ IResWriter* pResWriter - ); - -template -HRESULT -CFileResourceCache::WriteResource( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ IResWriter* pResWriter - ); - -template -HRESULT -CFileResourceCache::WriteResource( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ IResWriter* pResWriter - ); - diff --git a/print/XPSDrvSmpl/src/filters/common/rescpy.cpp b/print/XPSDrvSmpl/src/filters/common/rescpy.cpp deleted file mode 100644 index 2f56349c..00000000 --- a/print/XPSDrvSmpl/src/filters/common/rescpy.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - rescpy.cpp - -Abstract: - - Page resource copy class implementation. This class stores resources - from one page and copies them to a destination. This is required when - copying page markup into a new page - without doing so any resources - referenced in the source page are lost. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "rescpy.h" - -/*++ - -Routine Name: - - CResourceCopier::CResourceCopier - -Routine Description: - - CResourceCopier class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CResourceCopier::CResourceCopier() -{ -} - -/*++ - -Routine Name: - - CResourceCopier::~CResourceCopier - -Routine Description: - - CResourceCopier class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CResourceCopier::~CResourceCopier() -{ -} - -/*++ - -Routine Name: - - CResourceCopier::CopyPageResources - -Routine Description: - - This routine takes a source page and copies all resources to a destination page. - This is required when a filter copies mark-up to a new FixedPage part else the - resources for the mark-up will be lost. - -Arguments: - - pFPSrc - Pointer to the source IFixedPage interface - pFPDst - Pointer to the destination IFixedPage interface - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CResourceCopier::CopyPageResources( - _In_ CONST IFixedPage* pFPSrc, - _Inout_ IFixedPage* pFPDst - ) -{ - HRESULT hr = S_OK; - CComPtr pXpsPartIt(NULL); - - if (SUCCEEDED(hr = CHECK_POINTER(pFPSrc, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pFPDst, E_POINTER)) && - SUCCEEDED(hr = const_cast(pFPSrc)->GetXpsPartIterator(&pXpsPartIt))) - { - pXpsPartIt->Reset(); - while (!pXpsPartIt->IsDone() && - SUCCEEDED(hr)) - { - CComBSTR bstrPartURI; - CComPtr pXPSPart(NULL); - - if (SUCCEEDED(hr = pXpsPartIt->Current(&bstrPartURI, &pXPSPart))) - { - hr = pFPDst->SetPagePart(pXPSPart); - - pXpsPartIt->Next(); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/common/rescpy.h b/print/XPSDrvSmpl/src/filters/common/rescpy.h deleted file mode 100644 index 27dde831..00000000 --- a/print/XPSDrvSmpl/src/filters/common/rescpy.h +++ /dev/null @@ -1,40 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - rescpy.h - -Abstract: - - Page resource copy class definition. This class stores resources - from one page and copies them to a destination. This is required when - copying page markup into a new page - without doing so any resources - referenced in the source page are lost. - ---*/ - -#pragma once - -class CResourceCopier -{ -public: - CResourceCopier(); - - virtual ~CResourceCopier(); - - HRESULT - CopyPageResources( - _In_ CONST IFixedPage* pFPSrc, - _Inout_ IFixedPage* pFPDst - ); -}; - diff --git a/print/XPSDrvSmpl/src/filters/common/saxhndlr.cpp b/print/XPSDrvSmpl/src/filters/common/saxhndlr.cpp deleted file mode 100644 index bca931a5..00000000 --- a/print/XPSDrvSmpl/src/filters/common/saxhndlr.cpp +++ /dev/null @@ -1,586 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - saxhndlr.cpp - -Abstract: - - Default sax handler implementation. Provides default implementations - for the ISAXContentHandler. This allows derived classes to only need - to implement the methods that are required. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "saxhndlr.h" -#include "widetoutf8.h" - -/*++ - -Routine Name: - - CSaxHandler::CSaxHandler - -Routine Description: - - CSaxHandler class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CSaxHandler::CSaxHandler() : - CUnknown(IID_ISAXContentHandler) -{ -} - -/*++ - -Routine Name: - - CSaxHandler::~CSaxHandler - -Routine Description: - - CSaxHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CSaxHandler::~CSaxHandler() -{ -} - -/*++ - -Routine Name: - - CSaxHandler::putDocumentLocator - -Routine Description: - - This routine is the default implementation for ISAXContentHandler::putDocumentLocator - -Arguments: - - Unused - -Return Value: - - HRESULT - S_OK - Always succeeds - ---*/ -HRESULT STDMETHODCALLTYPE -CSaxHandler::putDocumentLocator( - ISAXLocator * - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CSaxHandler::startDocument - -Routine Description: - - This routine is the default implementation for ISAXContentHandler::startDocument - -Arguments: - - Unused - -Return Value: - - HRESULT - S_OK - Always succeeds - ---*/ -HRESULT STDMETHODCALLTYPE -CSaxHandler::startDocument( - void - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CSaxHandler::endDocument - -Routine Description: - - This routine is the default implementation for ISAXContentHandler::endDocument - -Arguments: - - Unused - -Return Value: - - HRESULT - S_OK - Always succeeds - ---*/ -HRESULT STDMETHODCALLTYPE -CSaxHandler::endDocument( - void - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CSaxHandler::startPrefixMapping - -Routine Description: - - This routine is the default implementation for ISAXContentHandler::startPrefixMapping - -Arguments: - - Unused - -Return Value: - - HRESULT - S_OK - Always succeeds - ---*/ -HRESULT STDMETHODCALLTYPE -CSaxHandler::startPrefixMapping( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CSaxHandler::endPrefixMapping - -Routine Description: - - This routine is the default implementation for ISAXContentHandler::endPrefixMapping - -Arguments: - - Unused - -Return Value: - - HRESULT - S_OK - Always succeeds - ---*/ -HRESULT STDMETHODCALLTYPE -CSaxHandler::endPrefixMapping( - CONST wchar_t*, - INT - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CSaxHandler::startElement - -Routine Description: - - This routine is the default implementation for ISAXContentHandler::startElement - -Arguments: - - Unused - -Return Value: - - HRESULT - S_OK - Always succeeds - ---*/ -HRESULT STDMETHODCALLTYPE -CSaxHandler::startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_ ISAXAttributes* - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CSaxHandler::endElement - -Routine Description: - - This routine is the default implementation for ISAXContentHandler::endElement - -Arguments: - - Unused - -Return Value: - - HRESULT - S_OK - Always succeeds - ---*/ -HRESULT STDMETHODCALLTYPE -CSaxHandler::endElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - CONST wchar_t*, - INT - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CSaxHandler::characters - -Routine Description: - - This routine is the default implementation for ISAXContentHandler::characters - -Arguments: - - Unused - -Return Value: - - HRESULT - S_OK - Always succeeds - ---*/ -HRESULT STDMETHODCALLTYPE -CSaxHandler::characters( - CONST wchar_t*, - INT - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CSaxHandler::ignorableWhitespace - -Routine Description: - - This routine is the default implementation for ISAXContentHandler::ignorableWhitespace - -Arguments: - - Unused - -Return Value: - - HRESULT - S_OK - Always succeeds - ---*/ -HRESULT STDMETHODCALLTYPE -CSaxHandler::ignorableWhitespace( - CONST wchar_t*, - INT - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CSaxHandler::processingInstruction - -Routine Description: - - This routine is the default implementation for ISAXContentHandler::processingInstruction - -Arguments: - - Unused - -Return Value: - - HRESULT - S_OK - Always succeeds - ---*/ -HRESULT STDMETHODCALLTYPE -CSaxHandler::processingInstruction( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CSaxHandler::skippedEntity - -Routine Description: - - This routine is the default implementation for ISAXContentHandler::skippedEntity - -Arguments: - - Unused - -Return Value: - - HRESULT - S_OK - Always succeeds - ---*/ -HRESULT STDMETHODCALLTYPE -CSaxHandler::skippedEntity( - CONST wchar_t*, - INT - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CSaxHandler::WriteToPrintStream - -Routine Description: - - This routine converts a CStringXDW buffer to UTF-8 string to be - written to the write stream provided. This overload handles accepts - an IPrintWriteStream to write the data out. - -Arguments: - - pcstrOut - Pointer to the Atl CStringXDW containing the mark-up to be written - pWriter - Pointer to the print write stream to write to - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CSaxHandler::WriteToPrintStream( - _In_ CStringXDW* pcstrOut, - _In_ IPrintWriteStream* pWriter - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pcstrOut, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pWriter, E_POINTER))) - { - ULONG cbWritten = 0; - PVOID pData = NULL; - ULONG cbData = 0; - - try - { - CWideToUTF8 wideToUTF8(pcstrOut); - - if (SUCCEEDED(hr = wideToUTF8.GetBuffer(&pData, &cbData))) - { - hr = pWriter->WriteBytes(pData, cbData, &cbWritten); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CSaxHandler::WriteToPrintStream - -Routine Description: - - This routine converts a CStringXDW buffer to UTF-8 string to be - written to the write stream provided. This overload handles accepts - an ISequentialStream to write the data out. - -Arguments: - - pcstrOut - Pointer to the Atl CStringXDW containing the mark-up to be written - pWriter - Pointer to the print write stream to write to - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CSaxHandler::WriteToPrintStream( - _In_ CStringXDW* pcstrOut, - _In_ ISequentialStream* pWriter - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pcstrOut, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pWriter, E_POINTER))) - { - ULONG cbWritten = 0; - PVOID pData = NULL; - ULONG cbData = 0; - - try - { - CWideToUTF8 wideToUTF8(pcstrOut); - - if (SUCCEEDED(hr = wideToUTF8.GetBuffer(&pData, &cbData))) - { - hr = pWriter->Write(pData, cbData, &cbWritten); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - - - -/*++ - -Routine Name: - - CSaxHandler::EscapeEntity - -Routine Description: - - The UnicodeString mark-up could contain characters that need to be escaped (the - SAX handler is passed the characters and not the original escapes). - The list of characters which need to be escaped are defined in the XML standard - and may change in future revisions. - This routine takes a BSTR and replaces all instances of these characters with - their escaped versions. - -Arguments: - - pStr - Pointer to the BSTR to be converted - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CSaxHandler::EscapeEntity( - _Inout_ BSTR* pStr - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pStr, E_POINTER))) - { - try - { - if (SysStringLen(*pStr) > 0) - { - CStringXDW cstrStr(*pStr); - - cstrStr.Replace(L"&", L"&"); - cstrStr.Replace(L"<", L"<"); - cstrStr.Replace(L">", L">"); - cstrStr.Replace(L"\"", L"""); - cstrStr.Replace(L"'", L"'"); - - SysFreeString(*pStr); - *pStr = cstrStr.AllocSysString(); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/common/saxhndlr.h b/print/XPSDrvSmpl/src/filters/common/saxhndlr.h deleted file mode 100644 index 33b142e1..00000000 --- a/print/XPSDrvSmpl/src/filters/common/saxhndlr.h +++ /dev/null @@ -1,129 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - saxhndlr.h - -Abstract: - - Default sax handler definition. Provides default implementations - for the ISAXContentHandler. This allows derived classes to only need - to implement the methods that are required. - ---*/ - -#pragma once - -#include "CUnknown.h" - -class CSaxHandler : public CUnknown -{ -public: - CSaxHandler(); - - virtual ~CSaxHandler(); - - virtual HRESULT STDMETHODCALLTYPE - putDocumentLocator( - ISAXLocator * - ); - - virtual HRESULT STDMETHODCALLTYPE - startDocument( - void - ); - - virtual HRESULT STDMETHODCALLTYPE - endDocument( - void - ); - - virtual HRESULT STDMETHODCALLTYPE - startPrefixMapping( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT - ); - - virtual HRESULT STDMETHODCALLTYPE - endPrefixMapping( - CONST wchar_t*, - INT - ); - - virtual HRESULT STDMETHODCALLTYPE - startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_ ISAXAttributes* - ); - - virtual HRESULT STDMETHODCALLTYPE - endElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - CONST wchar_t*, - INT - ); - - virtual HRESULT STDMETHODCALLTYPE - characters( - CONST wchar_t*, - INT - ); - - virtual HRESULT STDMETHODCALLTYPE - ignorableWhitespace( - CONST wchar_t*, - INT - ); - - virtual HRESULT STDMETHODCALLTYPE - processingInstruction( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT - ); - - virtual HRESULT STDMETHODCALLTYPE - skippedEntity( - CONST wchar_t*, - INT - ); - -protected: - HRESULT - WriteToPrintStream( - _In_ CStringXDW* pcstrOut, - _In_ IPrintWriteStream* pWriter - ); - - HRESULT - WriteToPrintStream( - _In_ CStringXDW* pcstrOut, - _In_ ISequentialStream* pWriter - ); - - HRESULT - EscapeEntity( - _Inout_ BSTR* pStr - ); -}; - diff --git a/print/XPSDrvSmpl/src/filters/common/widetoutf8.cpp b/print/XPSDrvSmpl/src/filters/common/widetoutf8.cpp deleted file mode 100644 index 39a207a5..00000000 --- a/print/XPSDrvSmpl/src/filters/common/widetoutf8.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - widetoutf8.cpp - -Abstract: - - The CWideToUTF8 class converts a Unicode character string into the UTF-8 code page format. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "widetoutf8.h" - -/*++ - -Routine Name: - - CWideToUTF8::CWideToUTF8 - -Routine Description: - - CWideToUTF8 class constructor - -Arguments: - - pcstrWide - Unicode string to be converted to UTF8. - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CWideToUTF8::CWideToUTF8( - CStringXDW* pcstrWide - ) : - m_pcstrWide(pcstrWide), - m_pMultiByte(NULL) -{ - HRESULT hr = CHECK_POINTER(m_pcstrWide, E_POINTER); - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CWideToUTF8::~CWideToUTF8 - -Routine Description: - - CWideToUTF8 class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CWideToUTF8::~CWideToUTF8() -{ - FreeBuffer(); -} - -/*++ - -Routine Name: - - CWideToUTF8::GetBuffer - -Routine Description: - - This method retrieves a pointer to the UTF8 converted character buffer for the CWideToUTF8 object. - -Arguments: - - ppBuffer - pointer to a pointer to the buffer. - pcbBuffer - size of the buffer that was returned. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWideToUTF8::GetBuffer( - _Outptr_ PVOID* ppBuffer, - _Out_ ULONG* pcbBuffer - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppBuffer, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcbBuffer, E_POINTER))) - { - FreeBuffer(); - - try - { - INT cbMultiByte = WideCharToMultiByte(CP_UTF8, - 0, - m_pcstrWide->GetBuffer(), - m_pcstrWide->GetLength(), - NULL, - 0, - NULL, - NULL); - - if (cbMultiByte > 0) - { - m_pMultiByte = new(std::nothrow) CHAR[cbMultiByte]; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pMultiByte, E_OUTOFMEMORY))) - { - if (WideCharToMultiByte(CP_UTF8, - 0, - m_pcstrWide->GetBuffer(), - m_pcstrWide->GetLength(), - m_pMultiByte, - cbMultiByte, - NULL, - NULL) > 0) - { - *ppBuffer = m_pMultiByte; - *pcbBuffer = cbMultiByte; - } - else - { - hr = E_FAIL; - } - } - } - else - { - hr = E_FAIL; - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWideToUTF8::FreeBuffer - -Routine Description: - - Releases the memory that was allocated for the string buffer during a call to CWideToUTF8::GetBuffer. - -Arguments: - - None - -Return Value: - - None - ---*/ -VOID -CWideToUTF8::FreeBuffer() -{ - if (m_pMultiByte != NULL) - { - delete[] m_pMultiByte; - m_pMultiByte = NULL; - } -} - diff --git a/print/XPSDrvSmpl/src/filters/common/widetoutf8.h b/print/XPSDrvSmpl/src/filters/common/widetoutf8.h deleted file mode 100644 index 9bae001a..00000000 --- a/print/XPSDrvSmpl/src/filters/common/widetoutf8.h +++ /dev/null @@ -1,48 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - widetoutf8.h - -Abstract: - - The CWideToUTF8 class converts a Unicode character string into the UTF-8 code page format. - ---*/ - -#pragma once - -class CWideToUTF8 -{ -public: - CWideToUTF8( - CStringXDW* pcstrWide - ); - - virtual ~CWideToUTF8(); - - HRESULT - GetBuffer( - _Outptr_ PVOID* ppBuffer, - _Out_ ULONG* pcbBuffer - ); - -private: - VOID - FreeBuffer(); - -private: - CStringXDW* m_pcstrWide; - - PSTR m_pMultiByte; -}; - diff --git a/print/XPSDrvSmpl/src/filters/common/xdfltcmn.vcxproj b/print/XPSDrvSmpl/src/filters/common/xdfltcmn.vcxproj deleted file mode 100644 index 192dab63..00000000 --- a/print/XPSDrvSmpl/src/filters/common/xdfltcmn.vcxproj +++ /dev/null @@ -1,561 +0,0 @@ - - - - - Debug - ARM - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {0F8262C1-75D8-4A92-BCB6-37A290891708} - $(MSBuildProjectName) - false - true - Debug - Win32 - {308C4F37-78C7-4A5B-82A5-303C05764FB6} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - %(AdditionalIncludeDirectories);..\xdcont - - - - xdfltcmn - - - xdfltcmn - - - xdfltcmn - - - xdfltcmn - - - xdfltcmn - - - xdfltcmn - - - xdfltcmn - - - xdfltcmn - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/common/xdfltcmn.vcxproj.Filters b/print/XPSDrvSmpl/src/filters/common/xdfltcmn.vcxproj.Filters deleted file mode 100644 index 505d9ff4..00000000 --- a/print/XPSDrvSmpl/src/filters/common/xdfltcmn.vcxproj.Filters +++ /dev/null @@ -1,163 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {3569C0F7-AC20-44FD-9CA8-9C48594440AD} - - - h;hpp;hxx;hm;inl;inc;xsd - {1187C371-A1BD-44D6-8827-8FCC4E2D6F4B} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {CC77C845-B29A-4778-BAE1-962D34312C2A} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/common/xdrchflt.cpp b/print/XPSDrvSmpl/src/filters/common/xdrchflt.cpp deleted file mode 100644 index 6fa2b0ed..00000000 --- a/print/XPSDrvSmpl/src/filters/common/xdrchflt.cpp +++ /dev/null @@ -1,508 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdrchflt.cpp - -Abstract: - - Base Xps filter implementation. The CXDXpsFilter provides common filter - functionality for Xps filters. It provides default handlers for part - handlers that set print tickets appropriately through the PrintTicket - manager class. This allows derived classes to implement only the part - handlers that they require (for example, the watermark filter is only - interested in the fixed page, and leaves all other parts to be handled - by this class). The class implements IPrintPipelineFilter::StartOperation - which is responsible for retrieving parts from the Xps provider and - dispatching them to the relevant part handler. It is also responsible for - intialising the Xps provider and consumer. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdrchflt.h" - -/*++ - -Routine Name: - - CXDXpsFilter::CXDXpsFilter - -Routine Description: - - CXDXpsFilter class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CXDXpsFilter::CXDXpsFilter() : - m_pXDReader(NULL), - m_pXDWriter(NULL) -{ - VERBOSE("Constructing Xps filter\n"); -} - -/*++ - -Routine Name: - - CXDXpsFilter::~CXDXpsFilter - -Routine Description: - - CXDXpsFilter class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CXDXpsFilter::~CXDXpsFilter() -{ - VERBOSE("Destroying Xps filter\n"); -} - -/*++ - -Routine Name: - - CXDXpsFilter::StartOperation - -Routine Description: - - This is the XPS Doxument interface implementation of IPrintPipelineFilter::StartOperation - shared by all XPS Document filters - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDXpsFilter::StartOperation( - VOID - ) -{ - VERBOSE("Starting filter operation.\n"); - - HRESULT hr = S_OK; - BOOL bDoCoUninitialize = FALSE; - - if (SUCCEEDED(hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))) - { - bDoCoUninitialize = TRUE; - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = InitialiseXDIO()) && - SUCCEEDED(hr = InitializePrintTicketManager())) - { - CComPtr pUnk(NULL); - - while (SUCCEEDED(hr) && - SUCCEEDED(hr = m_pXDReader->GetXpsPart(&pUnk)) && - pUnk != NULL && - !m_bFilterFinished) - { - CComPtr pXD(NULL); - CComPtr pFDS(NULL); - CComPtr pFD(NULL); - CComPtr pFP(NULL); - - // - // Query interface to find the part type and pass to the - // appropriate part handler - // - if (SUCCEEDED(pUnk.QueryInterface(&pXD))) - { - hr = ProcessPart(pXD); - } - else if (SUCCEEDED(pUnk.QueryInterface(&pFDS))) - { - hr = ProcessPart(pFDS); - } - else if (SUCCEEDED(pUnk.QueryInterface(&pFD))) - { - hr = ProcessPart(pFD); - } - else if (SUCCEEDED(pUnk.QueryInterface(&pFP))) - { - hr = ProcessPart(pFP); - } - else - { - // - // Unrecognised part - send as unknown. - // - hr = m_pXDWriter->SendXpsUnknown(pUnk); - } - - // - // Must call release since pUnk is declared outside of the while loop - // - pUnk.Release(); - } - - if (SUCCEEDED(hr)) - { - // - // Call finalize letting derived classes know we have - // processed all parts - // - hr = Finalize(); - } - - // - // Close the xps package consumer - // - m_pXDWriter->CloseSender(); - } - - // - // If the filter failed make sure we shutdown the pipeline - // - if (FAILED(hr)) - { - if (m_bFilterFinished) - { - // - // Filter is already closing down so report S_OK - // - hr = S_OK; - } - else - { - // - // Request the pipeline manager shutdown the filter - // - ERR("Requesting filter shutdown\n"); - RequestShutdown(hr); - } - } - - // - // Let the filter pipe manager know the filter is finished - // - if (bDoCoUninitialize) - { - CoUninitialize(); - } - - FilterFinished(); - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDXpsFilter::ProcessPart - -Routine Description: - - This routine is the default XPS document part handler - -Arguments: - - pXD - Pointer to the IXPSDocument interface - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDXpsFilter::ProcessPart( - _Inout_ IXpsDocument* pXD - ) -{ - VERBOSE("Processing XPS Document part with default handler\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pXD, E_POINTER))) - { - hr = m_pXDWriter->SendXpsDocument(pXD); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDXpsFilter::ProcessPart - -Routine Description: - - This routine is the default fixed document sequence part handler - -Arguments: - - pFDS - Pointer to the IFixedDocumentSequence interface - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDXpsFilter::ProcessPart( - _Inout_ IFixedDocumentSequence* pFDS - ) -{ - VERBOSE("Processing Fixed Document Sequence part with default handler\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFDS, E_POINTER))) - { - // - // Default handler: Set the PT and send the doc sequence - // - if (SUCCEEDED(hr = m_ptManager.SetTicket(pFDS))) - { - hr = m_pXDWriter->SendFixedDocumentSequence(pFDS); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDXpsFilter::ProcessPart - -Routine Description: - - This routine is the default fixed document part handler - -Arguments: - - pFD - Pointer to the IFixedDocument interface - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDXpsFilter::ProcessPart( - _Inout_ IFixedDocument* pFD - ) -{ - VERBOSE("Processing Fixed Document part with default handler\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFD, E_POINTER))) - { - // - // Default handler: Set the PT and send the doc - // - if (SUCCEEDED(hr = m_ptManager.SetTicket(pFD))) - { - hr = m_pXDWriter->SendFixedDocument(pFD); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDXpsFilter::ProcessPart - -Routine Description: - - This routine is the default fixed page handler - -Arguments: - - pFP - Pointer to the IFixedPage interface - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDXpsFilter::ProcessPart( - _Inout_ IFixedPage* pFP - ) -{ - VERBOSE("Processing Fixed Page part with default handler\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFP, E_POINTER))) - { - // - // Default handler: No ticket required, just send the page - // - hr = m_pXDWriter->SendFixedPage(pFP); - } - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CXDXpsFilter::Finalize - -Routine Description: - - This method is the default finalize method called when all parts in the XPS document - have been processed - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDXpsFilter::Finalize( - VOID - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CXDXpsFilter::InitialiseXDIO - -Routine Description: - - This routine initialises the XPS producer and consumer interfaces used by - all XPS document filters - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDXpsFilter::InitialiseXDIO( - VOID - ) -{ - VERBOSE("Retrieving Xps producer and consumer.\n"); - - HRESULT hr = S_OK; - - // - // Ensure the produver and consumer are released - // - m_pXDReader = NULL; - m_pXDWriter = NULL; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pInterFltrComm, E_PENDING))) - { - // - // Get the producer and consumer from the filter communicator - // - if (SUCCEEDED(hr = m_pInterFltrComm->RequestReader(reinterpret_cast(&m_pXDReader)))) - { - hr = m_pInterFltrComm->RequestWriter(reinterpret_cast(&m_pXDWriter)); - } - - // - // If anything went wrong, ensure the produver and consumer are released - // - if (FAILED(hr)) - { - m_pXDReader = NULL; - m_pXDWriter = NULL; - } - } - - // - // Check interface is as expected. If not then it is likely that - // the wrong GUID has been defined in the filter configuration file - // - if (SUCCEEDED(hr)) - { - CComPtr pReaderCheck(NULL); - CComPtr pWriterCheck(NULL); - - if (FAILED(m_pXDReader.QueryInterface(&pReaderCheck)) || - FAILED(m_pXDWriter.QueryInterface(&pWriterCheck))) - { - RIP("Invalid reader and writer defined - check GUIDs in the filter configuration file\n"); - - // - // Request the pipeline manager shutsdown the filter - // - hr = E_FAIL; - RequestShutdown(hr); - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/common/xdrchflt.h b/print/XPSDrvSmpl/src/filters/common/xdrchflt.h deleted file mode 100644 index eeb6e4c9..00000000 --- a/print/XPSDrvSmpl/src/filters/common/xdrchflt.h +++ /dev/null @@ -1,86 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdrchflt.h - -Abstract: - - Base Xps filter definition. The CXDXpsFilter provides common filter - functionality for Xps filters. It provides default handlers for part - handlers that set print tickets appropriately through the PrintTicket - manager class. This allows derived classes to implement only the part - handlers that they require (for example, the watermark filter is only - interested in the fixed page, and leaves all other parts to be handled - by this class). The class implements IPrintPipelineFilter::StartOperation - which is responsible for retrieving parts from the Xps provider and - dispatching them to the relevant part handler. It is also responsible for - intialising the Xps provider and consumer. - ---*/ - -#pragma once - -#include "xdsmplflt.h" -#include "rescache.h" - -class CXDXpsFilter : public CXDSmplFilter -{ -public: - CXDXpsFilter(); - - virtual ~CXDXpsFilter(); - -protected: - virtual HRESULT STDMETHODCALLTYPE - StartOperation( - VOID - ); - - virtual HRESULT - ProcessPart( - _Inout_ IXpsDocument* pXD - ); - - virtual HRESULT - ProcessPart( - _Inout_ IFixedDocumentSequence* pFDS - ); - - virtual HRESULT - ProcessPart( - _Inout_ IFixedDocument* pFD - ); - - virtual HRESULT - ProcessPart( - _Inout_ IFixedPage* pFP - ); - - virtual HRESULT - Finalize( - VOID - ); - - virtual HRESULT - InitialiseXDIO( - VOID - ); - -protected: - CComPtr m_pXDReader; - - CComPtr m_pXDWriter; - - CFileResourceCache m_resCache; -}; - diff --git a/print/XPSDrvSmpl/src/filters/common/xdsmplflt.cpp b/print/XPSDrvSmpl/src/filters/common/xdsmplflt.cpp deleted file mode 100644 index cce45ac6..00000000 --- a/print/XPSDrvSmpl/src/filters/common/xdsmplflt.cpp +++ /dev/null @@ -1,319 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdsmplflt.cpp - -Abstract: - - Base filter class for stream and Xps filters. This class implements - the IPrintPipelineFilter methods common to both Xps and stream filters. - -Known Issues: - - Request shutdown does not pass an IImgErrorInfo pointer - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdsmplflt.h" - -/*++ - -Routine Name: - - CXDSmplFilter::CXDSmplFilter - -Routine Description: - - CXDSmplFilter class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CXDSmplFilter::CXDSmplFilter() : - CUnknown(IID_IPrintPipelineFilter), - m_bFilterFinished(FALSE) -{ - VERBOSE("Constructing filter\n"); -} - - -/*++ - -Routine Name: - - CXDSmplFilter::~CXDSmplFilter - -Routine Description: - - CXDSmplFilter class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CXDSmplFilter::~CXDSmplFilter() -{ - VERBOSE("Destroying filter\n"); - - // - // Make sure FilterFinished() is called - // - FilterFinished(); -} - -/*++ - -Routine Name: - - CXDSmplFilter::InitializeFilter - -Routine Description: - - This is the IPrintPipelineFilter::InitializeFilter implementation used - by all XPS document interface filters. This is called by the print filter - pipeline manager before IPrintPipelineFilter::StartOperation. - -Arguments: - - pIInterFilterCommunicator - Pointer to the inter filter communicator - pIPropertyBag - Pointer to the property bag - pIPipelineControl - Pointer to the pipeline control interface - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDSmplFilter::InitializeFilter( - _In_ IInterFilterCommunicator* pIInterFilterCommunicator, - _In_ IPrintPipelinePropertyBag* pIPropertyBag, - _In_ IPrintPipelineManagerControl* pIPipelineControl - ) -{ - VERBOSE("Initializing filter\n"); - - HRESULT hr = S_OK; - - if (FAILED(hr = CHECK_POINTER(pIInterFilterCommunicator, E_POINTER)) || - FAILED(hr = CHECK_POINTER(pIPropertyBag, E_POINTER)) || - FAILED(hr = CHECK_POINTER(pIPipelineControl, E_POINTER))) - { - RequestShutdown(hr); - } - else - { - m_pPrintPipeManager = pIPipelineControl; - m_pInterFltrComm = pIInterFilterCommunicator; - m_pPrintPropertyBag = pIPropertyBag; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDSmplFilter::ShutdownOperation - -Routine Description: - - This is the IPrintPipelineFilter::ShutdownOperation implementation used - by all XPS document interface filters. This is called by the print filter - pipeline manager when the filter is complete or an error forces the - pipeline to be shutdown - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDSmplFilter::ShutdownOperation( - VOID - ) -{ - VERBOSE("Shutting down filter\n"); - - FilterFinished(); - return S_OK; -} - -/*++ - -Routine Name: - - CXDSmplFilter::FilterFinished - -Routine Description: - - This routine is called when the filter is finished. Filter finished should - only be called once so this routine protects against multiple calls from the - same filter. - -Arguments: - - None - -Return Value: - - None - ---*/ -VOID -CXDSmplFilter::FilterFinished( - VOID - ) -{ - if (!m_bFilterFinished) - { - VERBOSE("Finishing filter\n"); - - if (m_pPrintPipeManager != NULL) - { - m_pPrintPipeManager->FilterFinished(); - m_bFilterFinished = TRUE; - } - } -} - -/*++ - -Routine Name: - - CXDSmplFilter::RequestShutdown - -Routine Description: - - This routine lets derived classes request the filter to shutdown - without having to know about the pipeline manager explicitly - -Arguments: - - hr - The HRESULT value to be passed to the pipeline managers RequestShutdown method. - -Return Value: - - None - ---*/ -VOID -CXDSmplFilter::RequestShutdown( - _In_ HRESULT hr - ) -{ - VERBOSE("Requesting shutdown\n"); - - if (m_pPrintPipeManager != NULL) - { -#pragma prefast(suppress:__WARNING_INVALID_PARAM_VALUE_1, "MSDN requires that pReason be NULL.") - m_pPrintPipeManager->RequestShutdown(hr, NULL); - } -} - -/*++ - -Routine Name: - - CXDSmplFilter::InitializePrintTicketManager - -Routine Description: - - This routine initializes the PrintTicket manager with the default devmode - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDSmplFilter::InitializePrintTicketManager( - VOID - ) -{ - ASSERTMSG(m_pPrintPropertyBag != NULL, "NULL property bag pointer\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pPrintPropertyBag, E_PENDING))) - { - // - // Get the printer name and user PrintTicket from the property bag - // - CComVariant varName; - CComVariant varPTReadStreamFactory; - - // - // Avoid CComVariant if getting the XPS_FP_USER_TOKEN property. - // Please refer to http://go.microsoft.com/fwlink/?LinkID=255534 for detailed information. - // - VARIANT varUserToken; - VariantInit(&varUserToken); - - if (SUCCEEDED(hr = m_pPrintPropertyBag->GetProperty(XPS_FP_USER_PRINT_TICKET, &varPTReadStreamFactory)) && - SUCCEEDED(hr = m_pPrintPropertyBag->GetProperty(XPS_FP_PRINTER_NAME, &varName)) && - SUCCEEDED(hr = m_pPrintPropertyBag->GetProperty(XPS_FP_USER_TOKEN, &varUserToken))) - { - // - // Retrieve the PrintReadStream for the user PrintTicket - // - CComPtr pUnk(varPTReadStreamFactory.punkVal); - CComPtr pPrintReadStreamFactory(NULL); - CComPtr pPrintReadStream(NULL); - if (SUCCEEDED(hr = pUnk.QueryInterface(&pPrintReadStreamFactory)) && - SUCCEEDED(hr = pPrintReadStreamFactory->GetStream(&pPrintReadStream))) - { - // - // Initialise the PT manager with the user PrintTicket and device name - // - hr = m_ptManager.Initialise(pPrintReadStream, varName.bstrVal, varUserToken.byref); - } - } - - VariantClear(&varUserToken); - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/common/xdsmplflt.h b/print/XPSDrvSmpl/src/filters/common/xdsmplflt.h deleted file mode 100644 index b4903b4e..00000000 --- a/print/XPSDrvSmpl/src/filters/common/xdsmplflt.h +++ /dev/null @@ -1,77 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdsmplflt.h - -Abstract: - - Base filter class for stream and Xps filters. This class implements - the IPrintPipelineFilter methods common to both Xps and stream filters. - ---*/ - -#pragma once - -#include "cunknown.h" -#include "ptmanage.h" - -class CXDSmplFilter : public CUnknown -{ -public: - CXDSmplFilter(); - - virtual ~CXDSmplFilter(); - - // - // IImgPipelineFilter methods - // - virtual HRESULT STDMETHODCALLTYPE - InitializeFilter( - _In_ IInterFilterCommunicator* pINegotiation, - _In_ IPrintPipelinePropertyBag* pIPropertyBag, - _In_ IPrintPipelineManagerControl* pIPipelineControl - ); - - virtual HRESULT STDMETHODCALLTYPE - ShutdownOperation( - VOID - ); - -protected: - VOID - FilterFinished( - VOID - ); - - VOID - RequestShutdown( - _In_ HRESULT hr - ); - - HRESULT - InitializePrintTicketManager( - VOID - ); - -protected: - CComPtr m_pInterFltrComm; - - CComPtr m_pPrintPipeManager; - - CComPtr m_pPrintPropertyBag; - - CPTManager m_ptManager; - - BOOL m_bFilterFinished; -}; - diff --git a/print/XPSDrvSmpl/src/filters/common/xdstrmflt.cpp b/print/XPSDrvSmpl/src/filters/common/xdstrmflt.cpp deleted file mode 100644 index da8d6a5e..00000000 --- a/print/XPSDrvSmpl/src/filters/common/xdstrmflt.cpp +++ /dev/null @@ -1,351 +0,0 @@ -/*++ - -Copyright (C) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdstrmflt.cpp - -Abstract: - - Base stream filter implementation. This provides stream interface specific - functionality general to all filters that use the stream interface to process - fixed pages. The class is responsible copying data from reader to writer in the - absence of the PK archive handling module, for a default fixed page processing - function (filters should implement their own to manipulate fixed page markup) - and for initialising the stream reader and writer. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstrmflt.h" - -/*++ - -Routine Name: - - CXDStreamFilter::CXDStreamFilter - -Routine Description: - - CXDStreamFilter class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CXDStreamFilter::CXDStreamFilter() : - m_pStreamReader(NULL), - m_pStreamWriter(NULL) -{ - VERBOSE("Constructing stream filter\n"); -} - -/*++ - -Routine Name: - - CXDStreamFilter::~CXDStreamFilter - -Routine Description: - - CXDStreamFilter clsas destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CXDStreamFilter::~CXDStreamFilter() -{ - VERBOSE("Destroying stream filter\n"); -} - -/*++ - -Routine Name: - - CXDStreamFilter::StartOperation - -Routine Description: - - This is the stream interface implementation of IPrintPipelineFilter::StartOperation - shared by all stream interface filters - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CXDStreamFilter::StartOperation( - VOID - ) -{ - VERBOSE("Starting stream filter operation.\n"); - - HRESULT hr = S_OK; - BOOL bDoCoUninitialize = FALSE; - - if (SUCCEEDED(hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))) - { - bDoCoUninitialize = TRUE; - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = InitialiseStreamIO()) && - SUCCEEDED(hr = InitializePrintTicketManager())) - { - try - { - CXPSProcessor* pXpsProcessor = new(std::nothrow) CXPSProcessor(m_pStreamReader, m_pStreamWriter, this, m_pPrintPropertyBag, &m_ptManager); - - if (SUCCEEDED(hr = CHECK_POINTER(pXpsProcessor, E_OUTOFMEMORY))) - { - hr = pXpsProcessor->Start(); - } - - if (pXpsProcessor != NULL) - { - delete pXpsProcessor; - pXpsProcessor = NULL; - } - } - catch (CXDException& e) - { - hr = e; - } - catch (...) - { - hr = E_FAIL; - } - - if (hr == E_NOINTERFACE) - { - // - // The PK archive handler is missing - just pass the data on - // - - if (SUCCEEDED(hr = CHECK_POINTER(m_pStreamReader, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pStreamWriter, E_POINTER))) - { - ULONG cbRead = 0; - BOOL bEOF = FALSE; - - PBYTE pBuff = new(std::nothrow) BYTE[CB_COPY_BUFFER]; - - if (SUCCEEDED(hr = CHECK_POINTER(pBuff, E_OUTOFMEMORY))) - { - do - { - if (SUCCEEDED(hr = m_pStreamReader->ReadBytes(pBuff, CB_COPY_BUFFER, &cbRead, &bEOF))) - { - ULONG cbWritten = 0; - hr = m_pStreamWriter->WriteBytes(pBuff, cbRead, &cbWritten); - } - } - while (SUCCEEDED(hr) && - !bEOF && - cbRead > 0); - - delete[] pBuff; - pBuff = NULL; - } - } - } - } - - if (m_pStreamWriter) - { - m_pStreamWriter->Close(); - } - - // - // If the filter failed make sure we shutdown the pipeline - // - if (FAILED(hr)) - { - if (m_bFilterFinished) - { - // - // Filter is already closing down so report S_OK - // - hr = S_OK; - } - else - { - // - // Request the pipeline manager shutdown the filter - // - ERR("Requesting filter shutdown\n"); - RequestShutdown(hr); - } - } - - // - // Let the filter pipe manager know the filter is finished - // - if (bDoCoUninitialize) - { - CoUninitialize(); - } - - FilterFinished(); - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDStreamFilter::ProcessFixedPage - -Routine Description: - - This routine is the default implemenation of the fixed page processor called by - the XPS processor object. - -Arguments: - - pFPPT - Pointer to the fixed page PrintTicket - pPageReadStream - Pointer to the page read stream - pPageWriteStream - Pointer to the page write stream - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDStreamFilter::ProcessFixedPage( - _In_ IXMLDOMDocument2* pFPPT, - _In_ ISequentialStream* pPageReadStream, - _In_ ISequentialStream* pPageWriteStream - ) -{ - VERBOSE("Processing stream fixed page with default handler\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFPPT, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPageReadStream, E_POINTER))) - { - hr = CHECK_POINTER(pPageWriteStream, E_POINTER); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDStreamFilter::InitialiseStreamIO - -Routine Description: - - This routine initialises the print stream read and write interfaces used by - all stream filters - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDStreamFilter::InitialiseStreamIO( - VOID - ) -{ - VERBOSE("Retrieving stream reader and writer.\n"); - - HRESULT hr = S_OK; - - // - // Make sure the reader and writer are released - // - m_pStreamReader = NULL; - m_pStreamWriter = NULL; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pInterFltrComm, E_PENDING))) - { - // - // Get the reader and writer from the filter communicator - // - if (SUCCEEDED(hr = m_pInterFltrComm->RequestReader(reinterpret_cast(&m_pStreamReader)))) - { - hr = m_pInterFltrComm->RequestWriter(reinterpret_cast(&m_pStreamWriter)); - } - - // - // If anything went wrong, make sure the reader and writer - // have been released - // - if (FAILED(hr)) - { - m_pStreamReader = NULL; - m_pStreamWriter = NULL; - } - } - - // - // Check interface is as expected. If not then it is likely that - // the wrong GUID has been defined in the filter configuration file - // - if (SUCCEEDED(hr)) - { - CComPtr pReaderCheck(NULL); - CComPtr pWriterCheck(NULL); - - if (FAILED(m_pStreamReader.QueryInterface(&pReaderCheck)) || - FAILED(m_pStreamWriter.QueryInterface(&pWriterCheck))) - { - RIP("Invalid reader and writer defined - check GUIDs in the filter configuration file\n"); - - // - // Request the pipeline manager shutsdown the filter - // - hr = E_FAIL; - RequestShutdown(hr); - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/common/xdstrmflt.h b/print/XPSDrvSmpl/src/filters/common/xdstrmflt.h deleted file mode 100644 index 64489672..00000000 --- a/print/XPSDrvSmpl/src/filters/common/xdstrmflt.h +++ /dev/null @@ -1,63 +0,0 @@ -/*++ - -Copyright (C) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdstrmflt.h - -Abstract: - - Base stream filter definition. This provides stream interface specific - functionality general to all filters that use the stream interface to process - fixed pages. The class is responsible copying data from reader to writer in the - absence of the PK archive handling module, for a default fixed page processing - function (filters should implement their own to manipulate fixed page markup) - and for initialising the stream reader and writer. - ---*/ - -#pragma once - -#include "xdsmplflt.h" -#include "ptmanage.h" -#include "xpsproc.h" - -class CXDStreamFilter : public CXDSmplFilter, public IFixedPageProcessor -{ -public: - CXDStreamFilter(); - - virtual ~CXDStreamFilter(); - -protected: - virtual HRESULT STDMETHODCALLTYPE - StartOperation( - VOID - ); - - virtual HRESULT - ProcessFixedPage( - _In_ IXMLDOMDocument2* pFPPT, - _In_ ISequentialStream* pPageReadStream, - _In_ ISequentialStream* pPageWriteStream - ); - - HRESULT - InitialiseStreamIO( - VOID - ); - -protected: - CComPtr m_pStreamReader; - - CComPtr m_pStreamWriter; -}; - diff --git a/print/XPSDrvSmpl/src/filters/nup/dllentry.cpp b/print/XPSDrvSmpl/src/filters/nup/dllentry.cpp deleted file mode 100644 index 271afaaa..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/dllentry.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - dllentry.cpp - -Abstract: - - Implementation of the NUp filter dllentry points. Dllmain only - stores the instance handle. DllGetClassObject calls on to a generic - get class factory template function. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "clasfact.h" -#include "nupflt.h" -#include "xdexcept.h" - -/*++ - -Routine Name: - - DllMain - -Routine Description: - - Entry point to the NUp filter which is called when a new process is started - -Arguments: - - hInst - Handle to the DLL - wReason - Specifies a flag indicating why the DLL entry-point function is being called - -Return Value: - - TRUE - ---*/ -BOOL WINAPI -DllMain( - _In_ HINSTANCE hInst, - _In_ WORD wReason, - _In_opt_ LPVOID - ) -{ - switch (wReason) - { - case DLL_PROCESS_ATTACH: - { - g_hInstance = hInst; - } - break; - } - - return TRUE; -} - - -/*++ - -Routine Name: - - DllCanUnloadNow - -Routine Description: - - Method which reports whether the DLL is in use to allow the caller to unload - the DLL safely - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - Dll can unload - S_FALSE - Dll can't unload - ---*/ -STDAPI -DllCanUnloadNow() -{ - if (g_cServerLocks == 0) - { - return S_OK ; - } - else - { - return S_FALSE; - } -} - -/*++ - -Routine Name: - - DllGetClassObject - -Routine Description: - - Method to return the current class object - -Arguments: - - rclsid - CLSID that will associate the correct data and code - riid - Reference to the identifier of the interface that the caller is to use to communicate with the class object - ppv - Address of pointer variable that receives the interface pointer requested in riid - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - CLASS_E_CLASSNOTAVAILABLE - On unsupported class - ---*/ -STDAPI -DllGetClassObject( - _In_ REFCLSID rclsid, - _In_ REFIID riid, - _Outptr_ LPVOID FAR* ppv - ) -{ - // - // 6B105794-3140-40ca-A94F-624AE00AC9E8 - // - CLSID nupCLSID = {0x6B105794, 0x3140, 0x40ca, {0xA9, 0x4F, 0x62, 0x4A, 0xE0, 0x0A, 0xC9, 0xE8}}; - - return GetFilterClassFactory(rclsid, riid, nupCLSID, ppv); -} - diff --git a/print/XPSDrvSmpl/src/filters/nup/nupflt.cpp b/print/XPSDrvSmpl/src/filters/nup/nupflt.cpp deleted file mode 100644 index b226ecc7..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/nupflt.cpp +++ /dev/null @@ -1,476 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nupflt.cpp - -Abstract: - - NUp filter implementation. This class derives from the Xps filter class - and implements the necessary part handlers to support NUp printing. The - NUp filter is responsible for applying page transformations appropriate - to the NUp option selected. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "nupflt.h" -#include "nupsax.h" -#include "nupthndlr.h" -#include "bkpthndlr.h" -#include "psizepthndlr.h" -#include "porientpthndlr.h" - - -using XDPrintSchema::NUp::NUpData; - -using XDPrintSchema::Binding::BindingData; - -using XDPrintSchema::PageMediaSize::PageMediaSizeData; - -using XDPrintSchema::PageOrientation::PageOrientationData; - -/*++ - -Routine Name: - - CNUpFilter::CNUpFilter - -Routine Description: - - Default constructor for the nup filter which ensures GDI plus is correctly running - and initialises the CNUpFilter variables to sensible defaults - -Arguments: - - None - -Return Value: - - None - ---*/ -CNUpFilter::CNUpFilter() : - m_bSendAllDocs(TRUE), - m_pNUpPage(NULL), - m_nupScope(CNUpPTProperties::None) -{ - ASSERTMSG(m_gdiPlus.GetGDIPlusStartStatus() == Ok, "GDI plus is not correctly initialized.\n"); -} - -/*++ - -Routine Name: - - CNUpFilter::~CNUpFilter - -Routine Description: - - Default destructor for the color management filter - -Arguments: - - None - -Return Value: - - None - ---*/ -CNUpFilter::~CNUpFilter() -{ - DeleteNUpPage(); -} - -/*++ - -Routine Name: - - CNUpFilter::ProcessPart - -Routine Description: - - Method for processing each fixed document sequence part in a container - -Arguments: - - pFDS - Pointer to the fixed document sequence to process - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpFilter::ProcessPart( - _Inout_ IFixedDocumentSequence* pFDS - ) -{ - VERBOSE("Processing Fixed Document Sequence part with NUpFilter handler\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFDS, E_POINTER))) - { - // - // Get the PT manager to return the correct ticket. - // - IXMLDOMDocument2* pPT = NULL; - if (SUCCEEDED(hr = m_ptManager.SetTicket(pFDS)) && - SUCCEEDED(hr = m_ptManager.GetTicket(kPTJobScope, &pPT))) - { - hr = CreateNUpPage(pPT); - } - } - - if (SUCCEEDED(hr)) - { - hr = m_pXDWriter->SendFixedDocumentSequence(pFDS); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpFilter::ProcessPart - -Routine Description: - - Method for processing each fixed document part in a container - -Arguments: - - pFD - Pointer to the fixed document to process - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpFilter::ProcessPart( - _Inout_ IFixedDocument* pFD - ) -{ - VERBOSE("Processing Fixed Document part with NUpFilter handler\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFD, E_POINTER)) && - SUCCEEDED(hr = m_ptManager.SetTicket(pFD))) - { - // - // If we are in a JobNUpAllDocumentsContiguously session we want to maintain the current - // JobNUpAllDocumentsContiguously settings so keep the current NUp page object - // - if (m_nupScope != CNUpPTProperties::Job) - { - // - // Get the PT manager to return the correct ticket. - // - IXMLDOMDocument2* pPT = NULL; - if (SUCCEEDED(hr = m_ptManager.GetTicket(kPTDocumentScope, &pPT))) - { - hr = CreateNUpPage(pPT); - } - } - } - - if (SUCCEEDED(hr) && - m_bSendAllDocs) - { - hr = m_pXDWriter->SendFixedDocument(pFD); - - // - // If we are JobNUpAllDocumentsContiguously we only ever send one doc - now we have - // sent the first document we can test to see if we need to - // send all of them - // - if (m_nupScope == CNUpPTProperties::Job) - { - m_bSendAllDocs = FALSE; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpFilter::ProcessPart - -Routine Description: - - Method for processing each fixed page part in a container - -Arguments: - - pFP - Pointer to the fixed page to process - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpFilter::ProcessPart( - _Inout_ IFixedPage* pFP - ) -{ - VERBOSE("Processing Fixed Page part with NUpFilter handler\n"); - - ASSERTMSG(m_pXDWriter != NULL, "NULL consumer pointer\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFP, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pXDWriter, E_PENDING))) - { - if (m_pNUpPage != NULL) - { - // - // Add this pages contents to our NUp page - // - hr = m_pNUpPage->AddPageContent(m_pXDWriter, pFP); - } - else - { - // - // Just write out the fixed page - // - hr = m_pXDWriter->SendFixedPage(pFP); - } - } - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CNUpFilter::Finalize - -Routine Description: - - Method to close any pages which are still open as the last action of the filter - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpFilter::Finalize( - VOID - ) -{ - ASSERTMSG(m_pXDWriter != NULL, "NULL consumer pointer\n"); - - HRESULT hr = S_OK; - - if (m_pNUpPage != NULL) - { - // - // Close any open pages - we are done - // - hr = m_pNUpPage->ClosePage(m_pXDWriter); - DeleteNUpPage(); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpFilter::DeleteNUpPage - -Routine Description: - - Method to delete the current CNUpPage object - -Arguments: - - None - -Return Value: - - None - ---*/ -VOID -CNUpFilter::DeleteNUpPage( - VOID - ) -{ - if (m_pNUpPage != NULL) - { - delete m_pNUpPage; - m_pNUpPage = NULL; - } -} - -/*++ - -Routine Name: - - CNUpFilter::CreateNUpPage - -Routine Description: - - Method to create a new nup page based on the settings specified in the PrintTicket - -Arguments: - - pPT - Pointer to the PrintTicket containing the nup driver settings - -Return Value: - - HRESULT - S_OK - On success - S_FALSE - When not enabled in the PT - E_* - On error - ---*/ -HRESULT -CNUpFilter::CreateNUpPage( - _In_ IXMLDOMDocument2* pPT - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPT, E_POINTER))) - { - - try - { - // - // Retrieve the NUp, Booklet, PageMediaSize and PageOrientation data from the PT - // - NUpData nUpData; - BindingData bindingData; - PageMediaSizeData pageMediaSizeData; - PageOrientationData pageOrientData; - - CNUpPTHandler nUpPTHandler(pPT); - CBookPTHandler bkPTHandler(pPT); - CPageSizePTHandler pageSizePTHandler(pPT); - CPageOrientationPTHandler pageOrientPTHandler(pPT); - - // - // Try the booklet data first - // - if (FAILED(hr = bkPTHandler.GetData(&bindingData))) - { - // - // If booklet is not present try NUp settings - // - if (hr == E_ELEMENT_NOT_FOUND) - { - hr = nUpPTHandler.GetData(&nUpData); - } - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = pageSizePTHandler.GetData(&pageMediaSizeData)) && - SUCCEEDED(hr = pageOrientPTHandler.GetData(&pageOrientData))) - { - CNUpPTProperties nUpProps(nUpData, bindingData, pageMediaSizeData, pageOrientData); - - UINT cNUp = 1; - if (SUCCEEDED(hr = nUpProps.GetScope(&m_nupScope)) && - SUCCEEDED(hr = nUpProps.GetCount(&cNUp)) && - m_nupScope != CNUpPTProperties::None && - cNUp > 1) - { - if (m_pNUpPage == NULL) - { - // - // Create a new NUp page - // - m_pNUpPage = new(std::nothrow) CNUpPage(&nUpProps, &m_resCopier); - - hr = CHECK_POINTER(m_pNUpPage, E_OUTOFMEMORY); - } - else if (m_nupScope == CNUpPTProperties::Document) - { - // - // Second or subsequent Document NUp session - close the page and set - // the new properties - // - if (SUCCEEDED(hr = m_pNUpPage->ClosePage(m_pXDWriter))) - { - hr = m_pNUpPage->SetProperties(&nUpProps); - } - } - } - else - { - // - // NUp is not set - Fail the request so the page is closed and deleted - // - hr = E_ELEMENT_NOT_FOUND; - } - } - } - catch (CXDException& e) - { - hr = e; - } - } - - if (hr == E_ELEMENT_NOT_FOUND) - { - // - // The relevant features are not present in the print ticket or contain unsupported values. - // Close and delete the NUp page if it is currently open and do not propogate the fail status. - // - hr = S_FALSE; - - if (m_pNUpPage != NULL) - { - hr = m_pNUpPage->ClosePage(m_pXDWriter); - } - - DeleteNUpPage(); - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/nup/nupflt.h b/print/XPSDrvSmpl/src/filters/nup/nupflt.h deleted file mode 100644 index 814d8021..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/nupflt.h +++ /dev/null @@ -1,88 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nupflt.h - -Abstract: - - NUp filter definition. This class derives from the Xps filter - class and implements the necessary part handlers to support booklet - printing. The nup filter is responsible for applyinh page transofmations - appropriate to the NUp option selected. - -Known Issues: - - The filter uses PageMediaSize and not PageImageableSize to calculate the - canvas bounds - - The filter does not yet handle booklet offsets (gutter etc.) - ---*/ - -#pragma once - -#include "xdrchflt.h" -#include "nuppage.h" -#include "gdip.h" - -class CNUpFilter : public CXDXpsFilter -{ -public: - CNUpFilter(); - - virtual ~CNUpFilter(); - -private: - - virtual HRESULT - ProcessPart( - _Inout_ IFixedDocumentSequence* pFDS - ); - - virtual HRESULT - ProcessPart( - _Inout_ IFixedDocument* pFD - ); - - virtual HRESULT - ProcessPart( - _Inout_ IFixedPage* pFP - ); - - HRESULT - Finalize( - VOID - ); - - VOID - DeleteNUpPage( - VOID - ); - - HRESULT - CreateNUpPage( - _In_ IXMLDOMDocument2* pPT - ); - -protected: - GDIPlus m_gdiPlus; - - CNUpPage* m_pNUpPage; - - BOOL m_bSendAllDocs; - - CNUpPTProperties::ENUpScope m_nupScope; - - CResourceCopier m_resCopier; -}; - diff --git a/print/XPSDrvSmpl/src/filters/nup/nupflt.rc b/print/XPSDrvSmpl/src/filters/nup/nupflt.rc deleted file mode 100644 index f88d267c..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/nupflt.rc +++ /dev/null @@ -1,43 +0,0 @@ -// -// Copyright (c) 2005 Microsoft Corporation -// -// All rights reserved. -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// File Name: -// -// nupflt.rc -// -// Abstract: -// -// NUp filter resource file. -// -// - -#include -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT2_UNKNOWN -#define VER_FILEDESCRIPTION_STR "XPSDrv Sample NUp Filter" -#define VER_INTERNALNAME_STR "PrintFeatureFilters" - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#endif // English (U.S.) resources - -///////////////////////////////////////////////////////////////////////////// - -#include "common.ver" - diff --git a/print/XPSDrvSmpl/src/filters/nup/nuppage.cpp b/print/XPSDrvSmpl/src/filters/nup/nuppage.cpp deleted file mode 100644 index f814d21a..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/nuppage.cpp +++ /dev/null @@ -1,581 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nuppage.cpp - -Abstract: - - NUp page implementation. This class is responsible for maintaining - the current NUp page. The public interface defines methods for adding - fixed page content and closing the current page. When a page is added, - the class uses a SAX handler to strip the FixedPage tags from the - source page, apply a canvas with a transformation and add it to the - current NUp page. When the page is full it is closed and sent and a new - NUp page is created. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "nuppage.h" -#include "nupsax.h" -#include "widetoutf8.h" - -static CONST PCWSTR pszOpenFPTag = L""; - -/*++ - -Routine Name: - - CNUpPage::CNUpPage - -Routine Description: - - Constructor for the CNUpPage class which initialises itself to sensible values - and creates a new page transformation - -Arguments: - - pNUpProps - Pointer to class containing nup settings from the PrintTicket - pResCopier - Pointer to page resource copy class used for copying markup between pages - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CNUpPage::CNUpPage( - _In_ CNUpPTProperties* pNUpProps, - _In_ CResourceCopier* pResCopier - ) : - m_pNUpProps(NULL), - m_pNUpTransform(NULL), - m_pWriter(NULL), - m_pFixedPage(NULL), - m_cCurrPageIndex(0), - m_cNUp(1), - m_pResCopier(pResCopier) -{ - HRESULT hr = S_OK; - ASSERTMSG(m_pResCopier != NULL, "Invalid resource copier\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(pNUpProps, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pResCopier, E_POINTER))) - { - try - { - m_pNUpProps = new(std::nothrow) CNUpPTProperties(*pNUpProps); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pNUpProps, E_OUTOFMEMORY))) - { - m_pNUpTransform = new(std::nothrow) CNUpTransform(m_pNUpProps); - - hr = CHECK_POINTER(m_pNUpTransform, E_OUTOFMEMORY); - } - - if (SUCCEEDED(hr)) - { - hr = m_pNUpProps->GetCount(&m_cNUp); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - if (FAILED(hr)) - { - if (m_pNUpProps != NULL) - { - delete m_pNUpProps; - m_pNUpProps = NULL; - } - - if (m_pNUpTransform != NULL) - { - delete m_pNUpTransform; - m_pNUpTransform = NULL; - } - - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CNUpPage::~CNUpPage - -Routine Description: - - Default destructor for the CNUpPage class - -Arguments: - - None - -Return Value: - - None - ---*/ -CNUpPage::~CNUpPage() -{ - DeleteProperties(); - DeleteTransform(); - - ASSERTMSG(m_pWriter == NULL, "Destroying NUp page with open page writer\n"); - ASSERTMSG(m_pFixedPage == NULL, "Destroying NUp page with open fixed page\n"); -} - -/*++ - -Routine Name: - - CNUpPage::AddPageContent - -Routine Description: - - Method to write out fixed page with a transformation matrix - -Arguments: - - pWriter - Pointer to a writer which the transformed fixed page will be sent to - pFP - Pointer to the fixed page to be transformed and written out - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpPage::AddPageContent( - _In_ IXpsDocumentConsumer* pWriter, - _In_ IFixedPage* pFP - ) -{ - ASSERTMSG(m_pNUpTransform != NULL, "NULL transform object\n"); - ASSERTMSG(m_pNUpProps != NULL, "NULL NUp properties object\n"); - - HRESULT hr = S_OK; - - SizeF sizePage; - if (SUCCEEDED(hr = CHECK_POINTER(pWriter, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pFP, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pNUpProps, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pNUpTransform, E_PENDING)) && - SUCCEEDED(hr = m_pNUpProps->GetPageSize(&sizePage)) && - m_pFixedPage == NULL) - { - hr = CreateNewPage(pWriter, sizePage); - } - - if (SUCCEEDED(hr)) - { - // - // Create a SAX reader to parse the mark-up write out the page - // content - // - CComPtr pSaxRdr(NULL); - if (SUCCEEDED(hr) && - SUCCEEDED(hr = pSaxRdr.CoCreateInstance(CLSID_SAXXMLReader60))) - { - try - { - m_pNUpTransform->SetCurrentPage(m_cCurrPageIndex); - - // - // Create our NUp sax handler - // - CNUpSaxHandler nupSaxHndlr(m_pWriter, m_pResCopier, m_pNUpTransform); - - // - // Set-up the SAX reader and begin parsing the mark-up - // - CComPtr pReader(NULL); - if (SUCCEEDED(hr = pSaxRdr->putContentHandler(&nupSaxHndlr)) && - SUCCEEDED(hr = pFP->GetStream(&pReader))) - { - CComPtr pReadStreamToSeq(NULL); - - pReadStreamToSeq.Attach(new(std::nothrow) pfp::PrintReadStreamToSeqStream(pReader)); - - if (SUCCEEDED(hr = CHECK_POINTER(pReadStreamToSeq, E_OUTOFMEMORY))) - { - hr = pSaxRdr->parse(CComVariant(static_cast(pReadStreamToSeq))); - } - } - } - catch (CXDException& e) - { - hr = e; - } - } - - // - // Copy resources - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(m_pResCopier, E_PENDING))) - { - hr = m_pResCopier->CopyPageResources(pFP, m_pFixedPage); - } - - m_cCurrPageIndex++; - } - - if (SUCCEEDED(hr)) - { - // - // Check if we need to close the page - // - if (m_cCurrPageIndex == m_cNUp) - { - hr = ClosePage(pWriter); - m_cCurrPageIndex = 0; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpPage::ClosePage - -Routine Description: - - Method to close an open fixed page including the addition of any required markup - -Arguments: - - pWriter - Pointer to a writer which receives the closing markup - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpPage::ClosePage( - _In_ IXpsDocumentConsumer* pWriter - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pWriter, E_POINTER))) - { - // - // Add closing page mark-up, close the current page writer - // - if (m_pWriter != NULL) - { - try - { - CStringXDW cstrCloseFP(L""); - hr = WriteToPrintStream(&cstrCloseFP, m_pWriter); - } - catch (CXDException& e) - { - hr = e; - } - - ASSERTMSG(SUCCEEDED(hr), "Failed to write fixed page closing tag\n"); - - m_pWriter->Close(); - } - - // - // Send the current page - // - if (m_pFixedPage != NULL) - { - hr = pWriter->SendFixedPage(m_pFixedPage); - } - - ASSERTMSG(SUCCEEDED(hr), "Failed to send page\n"); - } - - // - // Release the writer and the fixed page - // - m_pWriter = NULL; - m_pFixedPage = NULL; - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpPage::SetProperties - -Routine Description: - - Method to set the nup properties at a start of a new run of pages - -Arguments: - - pNUpProps - Pointer to an object containing nup settings from the PrintTicket - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpPage::SetProperties( - _In_ CNUpPTProperties* pNUpProps - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pNUpProps, E_POINTER))) - { - DeleteProperties(); - DeleteTransform(); - - m_pNUpProps = new(std::nothrow) CNUpPTProperties(*pNUpProps); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pNUpProps, E_OUTOFMEMORY))) - { - m_pNUpTransform = new(std::nothrow) CNUpTransform(m_pNUpProps); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pNUpTransform, E_OUTOFMEMORY))) - { - hr = m_pNUpProps->GetCount(&m_cNUp); - m_cCurrPageIndex = 0; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpPage::CreateNewPage - -Routine Description: - - Method to create a new fixed page to contain the original pages as canvas' - -Arguments: - - pWriter - Pointer to a writer which the new fixed page will be sent to - sizePage - Size of the new page - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpPage::CreateNewPage( - _In_ IXpsDocumentConsumer* pWriter, - _In_ SizeF sizePage - ) -{ - HRESULT hr = S_OK; - - CComBSTR bstrPageURI; - - if (SUCCEEDED(hr = CHECK_POINTER(pWriter, E_POINTER))) - { - // - // Create a unique page URI - // - try - { - // - // Create a unique name for the NUp page for this print session - // - CStringXDW cstrPageURI; - cstrPageURI.Format(L"/NUpPage_%u.xml", GetUniqueNumber()); - bstrPageURI.Empty(); - bstrPageURI.Attach(cstrPageURI.AllocSysString()); - } - catch (CXDException& e) - { - hr = e; - } - } - - // - // Close any open pages, create the new page and retrieve the page writer - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = ClosePage(pWriter)) && - SUCCEEDED(hr = pWriter->GetNewEmptyPart(bstrPageURI, - __uuidof(IFixedPage), - reinterpret_cast(&m_pFixedPage), - &m_pWriter))) - { - // - // Construct the opening FixedPage tag - // - try - { - CStringXDW cstrOpenFP; - cstrOpenFP.Format(pszOpenFPTag, sizePage.Width, sizePage.Height); - hr = WriteToPrintStream(&cstrOpenFP, m_pWriter); - } - catch (CXDException& e) - { - hr = e; - } - - ASSERTMSG(SUCCEEDED(hr), "Failed to write fixed page opening tag\n"); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpPage::DeleteProperties - -Routine Description: - - Method to delete the current nup properties object - -Arguments: - - None - -Return Value: - - None - ---*/ -VOID -CNUpPage::DeleteProperties( - VOID - ) -{ - if (m_pNUpProps != NULL) - { - delete m_pNUpProps; - m_pNUpProps = NULL; - } -} - -/*++ - -Routine Name: - - CNUpPage::DeleteTransform - -Routine Description: - - Method to delete the current nup transform object - -Arguments: - - None - -Return Value: - - None - ---*/ -VOID -CNUpPage::DeleteTransform( - VOID - ) -{ - delete m_pNUpTransform; - m_pNUpTransform = NULL; -} - - -/*++ - -Routine Name: - - CNUpPage::WriteToPrintStream - -Routine Description: - - This routine converts a CStringXDW buffer to UTF-8 string to be - written to the write stream provided - -Arguments: - - pcstrOut - Pointer to the Atl CStringXDW containing the mark-up to be written - pWriter - Pointer to the print write stream to write to - -Return Value: - - HRESULT - S_OK - Always succeeds - ---*/ -HRESULT -CNUpPage::WriteToPrintStream( - _In_ CStringXDW* pcstrOut, - _In_ IPrintWriteStream* pWriter - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pcstrOut, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pWriter, E_POINTER))) - { - ULONG cbWritten = 0; - PVOID pData = NULL; - ULONG cbData = 0; - - try - { - CWideToUTF8 wideToUTF8(pcstrOut); - - if (SUCCEEDED(hr = wideToUTF8.GetBuffer(&pData, &cbData))) - { - hr = pWriter->WriteBytes(pData, cbData, &cbWritten); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/nup/nuppage.h b/print/XPSDrvSmpl/src/filters/nup/nuppage.h deleted file mode 100644 index 545c5114..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/nuppage.h +++ /dev/null @@ -1,107 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nuppage.h - -Abstract: - - NUp page definition. This class is responsible for maintaining - the current NUp page. The public interface defines methods for adding - fixed page content and closing the current page. When a page is added, - the class uses a SAX handler to strip the FixedPage tags from the - source page, apply a canvas with a transformation and add it to the - current NUp page. When the page is full it is closed and sent and a new - NUp page is created. - ---*/ - -#pragma once - -#include "rescpy.h" -#include "xdstring.h" -#include "nupxform.h" - -class CNUpPage -{ -public: - CNUpPage( - _In_ CNUpPTProperties* pNUpProps, - _In_ CResourceCopier* pResCopier - ); - - virtual ~CNUpPage(); - - HRESULT - AddPageContent( - _In_ IXpsDocumentConsumer* pWriter, - _In_ IFixedPage* pFP - ); - - HRESULT - ClosePage( - _In_ IXpsDocumentConsumer* pWriter - ); - - HRESULT - SetProperties( - _In_ CNUpPTProperties* pNUpProps - ); - -private: - HRESULT - CreateNewPage( - _In_ IXpsDocumentConsumer* pWriter, - _In_ SizeF sizePage - ); - - HRESULT - CopyResources( - _In_ IFixedPage* pFPSrc, - _Inout_ IFixedPage* pFPDst - ); - - VOID - DeleteProperties( - VOID - ); - - VOID - DeleteTransform( - VOID - ); - - HRESULT - WriteToPrintStream( - _In_ CStringXDW* pcstrOut, - _In_ IPrintWriteStream* pWriter - ); - -private: - CComPtr m_pWriter; - - CComPtr m_pFixedPage; - - // - // Current page index (i.e. 0 - 5 for 6 Up) - // - UINT m_cCurrPageIndex; - - UINT m_cNUp; - - CNUpTransform* m_pNUpTransform; - - CNUpPTProperties* m_pNUpProps; - - CResourceCopier* m_pResCopier; -}; - diff --git a/print/XPSDrvSmpl/src/filters/nup/nupsax.cpp b/print/XPSDrvSmpl/src/filters/nup/nupsax.cpp deleted file mode 100644 index 6c92730c..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/nupsax.cpp +++ /dev/null @@ -1,522 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nupsax.xpp - -Abstract: - - NUp SAX handler implementation. The class derives from the default SAX handler - and implements only the necessary SAX APIs to process the mark-up. The - handler is responsible for copying page mark-up to a writer, removing - the fixed page opening and closing tags. It is also responsible for - identifying resources that need to be copied from the source page to - the NUp page. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "nupsax.h" - -// -// We will need to preserve namespaces defined by the source fixed page into each canvas, -// e.g. xmlns:x="http://schemas.microsoft.com/xps/2005/06/resourcedictionary-key". To do -// this we will create and populate a vector of namespaces to add to the canvas wrappning -// the source fixed page. -// -typedef pair AttribValuePair; -typedef vector NamespaceVector; - -/*++ - -Routine Name: - - CNUpSaxHandler::CNUpSaxHandler - -Routine Description: - - Contructor for the nup filters SAX handler which registers - internally the writer for sending new markup out to and a - resource copier which copies markup between pages - -Arguments: - - pWriter - Pointer to a write stream which receives markup - pResCopier - Pointer to a resource markup copier object which - copies markup between pages - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CNUpSaxHandler::CNUpSaxHandler( - _In_ IPrintWriteStream* pWriter, - _In_ CResourceCopier* pResCopier, - _In_ CNUpTransform* pNUpTransform - ) : - m_pWriter(pWriter), - m_bOpenTag(FALSE), - m_pResCopier(pResCopier), - m_pNUpTransform(pNUpTransform) -{ - ASSERTMSG(m_pWriter != NULL, "NULL writer passed to NUp SAX handler.\n"); - ASSERTMSG(m_pResCopier != NULL, "NULL resource copier passed to NUp SAX handler.\n"); - ASSERTMSG(m_pNUpTransform != NULL, "NULL NUp Transform object passed to NUp SAX handler.\n"); - - HRESULT hr = S_OK; - if (FAILED(hr = CHECK_POINTER(m_pWriter, E_PENDING)) || - FAILED(hr = CHECK_POINTER(m_pResCopier, E_PENDING)) || - FAILED(hr = CHECK_POINTER(m_pNUpTransform, E_PENDING))) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CNUpSaxHandler::~CNUpSaxHandler - -Routine Description: - - Default destructor for the nup filters SAX handler - -Arguments: - - None - -Return Value: - - None - ---*/ -CNUpSaxHandler::~CNUpSaxHandler() -{ - m_bstrOpenElement.Empty(); -} - -/*++ - -Routine Name: - - CNUpSaxHandler::startElement - -Routine Description: - - SAX handler method which handles each start element for the XML markup - -Arguments: - - pwchQName - Pointer to a string containing the element name - cchQName - Count of the number of characters in the element name - pAttributes - Pointer to the attribute list for the supplied element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CNUpSaxHandler::startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ) -{ - HRESULT hr = S_OK; - CStringXDW cstrOut; - - // - // If this is the fixed page we need the width and height retrieved - // - BOOL bIsFixedPage = FALSE; - - try - { - CComBSTR bstrElement(cchQName, pwchQName); - - bIsFixedPage = (bstrElement == L"FixedPage"); - - // - // The resource dictionary is now canvas wide - // - if (bstrElement == L"FixedPage.Resources") - { - bstrElement = L"Canvas.Resources"; - } - - // - // Check if we need to close an opened tag - // - if (m_bOpenTag) - { - cstrOut.Append(L">"); - } - - // - // Store the opened element name so we can handle nested elements - // - m_bstrOpenElement = bstrElement; - } - catch (CXDException& e) - { - hr = e; - } - - if (SUCCEEDED(hr)) - { - // - // If this is the fixed page we do not write the tag - // - if (!bIsFixedPage) - { - // - // Write out element - // - try - { - cstrOut.Append(L"<"); - cstrOut.Append(m_bstrOpenElement); - } - catch (CXDException& e) - { - hr = e; - } - - // - // We opened a tag - // - m_bOpenTag = TRUE; - } - - SizeF sizePage(0.0f, 0.0f); - - // - // Record additional namespaces defined by the fixed page - // - NamespaceVector fpNamespaces; - - // - // Find the number of attributes and enumerate over all of them - // - INT cAttributes = 0; - if (SUCCEEDED(hr) && - SUCCEEDED(hr = pAttributes->getLength(&cAttributes))) - { - for (INT cIndex = 0; cIndex < cAttributes && SUCCEEDED(hr); cIndex++) - { - PCWSTR pszAttUri = NULL; - INT cchAttUri = 0; - PCWSTR pszAttName = NULL; - INT cchAttName = 0; - PCWSTR pszAttQName = NULL; - INT cchAttQName = 0; - PCWSTR pszAttValue = NULL; - INT cchAttValue = 0; - - // - // Get the attribute data ready to write out - // - if (SUCCEEDED(hr = pAttributes->getName(cIndex, - &pszAttUri, - &cchAttUri, - &pszAttName, - &cchAttName, - &pszAttQName, - &cchAttQName))) - { - if (SUCCEEDED(pAttributes->getValue(cIndex, &pszAttValue, &cchAttValue))) - { - try - { - CComBSTR bstrAttName(cchAttQName, pszAttQName); - CComBSTR bstrAttValue(cchAttValue, pszAttValue); - - if (bIsFixedPage) - { - // - // Extract the page Width and Height values - // - CStringXDW cstrAttName(bstrAttName); - if (cstrAttName == L"Width") - { - sizePage.Width = static_cast(_wtof(bstrAttValue)); - - if (sizePage.Width < 1.f) - { - // - // According to the Xps Specification, - // FixedPage Width must be >= 1.0 - // - hr = E_FAIL; - } - } - else if (cstrAttName == L"Height") - { - sizePage.Height = static_cast(_wtof(bstrAttValue)); - - if (sizePage.Height < 1.f) - { - // - // According to the Xps Specification, - // FixedPage Height must be >= 1.0 - // - hr = E_FAIL; - } - } - else if (cstrAttName.Find(L"xmlns:") == 0) - { - // - // We have an additional namespace - add to the vector to be applied to the canvas element - // - fpNamespaces.push_back(AttribValuePair(cstrAttName, CStringXDW(bstrAttValue))); - } - } - else - { - // - // Delimit attributes with a space - // - cstrOut.Append(L" "); - - // - // Reconstruct the attribute and write back to - // the fixed page - // - cstrOut.Append(bstrAttName); - cstrOut.Append(L"=\""); - - // - // If this is a UnicodeString we may need to escape entities - // - if (bstrAttName == L"UnicodeString") - { - hr = EscapeEntity(&bstrAttValue); - } - - cstrOut.Append(bstrAttValue); - cstrOut.Append(L"\""); - } - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - } - } - } - - if (SUCCEEDED(hr) && - bIsFixedPage) - { - // - // Write the canvas out - // - try - { - // - // Get the page transform for the current page - // - CComBSTR bstrMatrix; - Matrix matrixTransform; - - if (SUCCEEDED(hr = m_pNUpTransform->GetPageTransform(sizePage, &matrixTransform)) && - SUCCEEDED(hr = m_pNUpTransform->MatrixToXML(&matrixTransform, &bstrMatrix))) - { - - // - // Create a clipping region which is the size of the logical page - // - CStringXDW strClip; - - strClip.Format(L"M 0,0 L %.2f,0 L %.2f,%.2f L 0, %.2f Z", - sizePage.Width, - sizePage.Width, - sizePage.Height, - sizePage.Height); - - cstrOut.Format(L"(bstrMatrix), - static_cast(strClip)); - - // - // Add additional namespaces from the FixedPage - // - for (NamespaceVector::const_iterator iterNamespaces = fpNamespaces.begin(); - iterNamespaces != fpNamespaces.end(); - iterNamespaces++) - { - cstrOut += L" "; - cstrOut += (*iterNamespaces).first; - cstrOut += L"=\""; - cstrOut += (*iterNamespaces).second; - cstrOut += L"\""; - } - - cstrOut += L">"; - } - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - ASSERTMSG(SUCCEEDED(hr), "Failed to write canvas\n"); - } - - if (SUCCEEDED(hr)) - { - hr = WriteToPrintStream(&cstrOut, m_pWriter); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpSaxHandler::endElement - -Routine Description: - - SAX handler method which handles each end element for the XML markup - -Arguments: - - pwchQName - Pointer to a string containing the element name - cchQName - Count of the number of characters in the element name - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CNUpSaxHandler::endElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName - ) -{ - HRESULT hr = S_OK; - CStringXDW cstrClose; - BOOL bCloseTag = FALSE; - - try - { - CComBSTR bstrElement(cchQName, pwchQName); - - // - // The resource dictionary is now canvas wide - // - if (bstrElement == L"FixedPage.Resources") - { - bstrElement = L"Canvas.Resources"; - } - - // - // Ignore close fixed page tag - // - if (bstrElement != L"FixedPage") - { - bCloseTag = TRUE; - - // - // If this is a root element with child nodes, the open - // element will not match the last startElement. In this case - // we need to add an appropriate closing tag - // - if (bstrElement == m_bstrOpenElement && !!m_bOpenTag) - { - // - // Names match so just add a closing bracket - // - // We might have closed the tag when writing the watermark XML - // - cstrClose.Append(L"/>"); - } - else - { - // - // Add a closing tag - // - cstrClose.Append(L""); - } - - m_bOpenTag = FALSE; - } - else - { - // - // Close the canvas - // - try - { - bCloseTag = TRUE; - cstrClose.Append(L""); - } - catch (CXDException& e) - { - hr = e; - } - - ASSERTMSG(SUCCEEDED(hr), "Failed to write canvas\n"); - } - } - catch (CXDException& e) - { - hr = e; - } - - if (SUCCEEDED(hr) && - bCloseTag) - { - hr = WriteToPrintStream(&cstrClose, m_pWriter); - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/nup/nupsax.h b/print/XPSDrvSmpl/src/filters/nup/nupsax.h deleted file mode 100644 index 8b78cfd8..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/nupsax.h +++ /dev/null @@ -1,76 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nupsax.h - -Abstract: - - NUp SAX handler definition. The class derives from the default SAX handler - and implements only the necessary SAX APIs to process the mark-up. The - handler is responsible for copying page mark-up to a writer, removing - the fixed page opening and closing tags. It is also responsible for - identifying resources that need to be copied from the source page to - the NUp page. - ---*/ - -#pragma once - -#include "saxhndlr.h" -#include "rescpy.h" -#include "nupxform.h" - -class CNUpSaxHandler : public CSaxHandler -{ -public: - CNUpSaxHandler( - _In_ IPrintWriteStream* pWriter, - _In_ CResourceCopier* pResCopier, - _In_ CNUpTransform* pNUpTransform - ); - - virtual ~CNUpSaxHandler(); - - virtual HRESULT STDMETHODCALLTYPE - startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ); - - virtual HRESULT STDMETHODCALLTYPE - endElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName - ); - -private: - CComPtr m_pWriter; - - CComBSTR m_bstrOpenElement; - - BOOL m_bOpenTag; - - CResourceCopier* m_pResCopier; - - CNUpTransform* m_pNUpTransform; -}; - diff --git a/print/XPSDrvSmpl/src/filters/nup/nuptprps.cpp b/print/XPSDrvSmpl/src/filters/nup/nuptprps.cpp deleted file mode 100644 index 0783f0ce..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/nuptprps.cpp +++ /dev/null @@ -1,449 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nuptprps.cpp - -Abstract: - - NUp properties class implementation. The NUp properties class is - responsible for interpreting NUp, Binding, PageMediaSize and - PageOrientation data for the NUp filter. Binding data is required - as the NUp filter is responsible for applying two up for booklet - processing. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "nuptprps.h" - -using XDPrintSchema::NUp::NUpData; -using XDPrintSchema::NUp::JobNUpAllDocumentsContiguously; - -using XDPrintSchema::NUp::PresentationDirection::ENUpDirectionOption; -using XDPrintSchema::NUp::PresentationDirection::LeftBottom; -using XDPrintSchema::NUp::PresentationDirection::TopLeft; -using XDPrintSchema::NUp::PresentationDirection::BottomLeft; -using XDPrintSchema::NUp::PresentationDirection::RightBottom; - -using XDPrintSchema::Binding::BindingData; -using XDPrintSchema::Binding::EBindingOption; -using XDPrintSchema::Binding::None; -using XDPrintSchema::Binding::BindLeft; -using XDPrintSchema::Binding::BindRight; -using XDPrintSchema::Binding::BindTop; -using XDPrintSchema::Binding::BindBottom; -using XDPrintSchema::Binding::JobBindAllDocuments; -using XDPrintSchema::Binding::EdgeStitchLeft; -using XDPrintSchema::Binding::EdgeStitchRight; -using XDPrintSchema::Binding::EdgeStitchTop; -using XDPrintSchema::Binding::EdgeStitchBottom; - -using XDPrintSchema::PageMediaSize::PageMediaSizeData; - -using XDPrintSchema::PageOrientation::PageOrientationData; -using XDPrintSchema::PageOrientation::EOrientationOption; - -/*++ - -Routine Name: - - CNUpPTProperties::CNUpPTProperties - -Routine Description: - - Constructor for the CNUpPTProperties class which - initialises members to sensible default values - -Arguments: - - nupData - Structure containing nup settings from the PrintTicket - bindingData - Structure containing nup binding settings from the PrintTicket - pageMediaSizeData - Structure containing nup page media size settings from the PrintTicket - pageOrientData - Structure containing nup page orientation settings from the PrintTicket - -Return Value: - - None - ---*/ -CNUpPTProperties::CNUpPTProperties( - _In_ CONST NUpData& nupData, - _In_ CONST BindingData& bindingData, - _In_ CONST PageMediaSizeData& pageMediaSizeData, - _In_ CONST PageOrientationData& pageOrientData - ) : - m_nupData(nupData), - m_bindingData(bindingData), - m_pageMediaSizeData(pageMediaSizeData), - m_pageOrientData(pageOrientData) -{ -} - -/*++ - -Routine Name: - - CNUpPTProperties::~CNUpPTProperties - -Routine Description: - - Default destructor for the CNUpPTProperties class - -Arguments: - - None - -Return Value: - - None - ---*/ -CNUpPTProperties::~CNUpPTProperties() -{ -} - -/*++ - -Routine Name: - - CNUpPTProperties::GetCount - -Routine Description: - - Method to get the nup count. For booklet printing this will always be set to two - -Arguments: - - pcNUpPages - Integer value which will contain the nup count - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpPTProperties::GetCount( - _Out_ UINT* pcNUpPages - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pcNUpPages, E_POINTER))) - { - *pcNUpPages = m_nupData.cNUp; - - if (m_bindingData.bindOption != XDPrintSchema::Binding::None) - { - *pcNUpPages = 2; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpPTProperties::GetPresentationDirection - -Routine Description: - - Method to get the nup presentation direction - -Arguments: - - pPresentationDirection - Enumeration value which is set to the current - presentation direction - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpPTProperties::GetPresentationDirection( - _Out_ ENUpDirectionOption* pPresentationDirection - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPresentationDirection, E_POINTER))) - { - *pPresentationDirection = m_nupData.nUpPresentDir; - - if (m_bindingData.bindOption != XDPrintSchema::Binding::None) - { - hr = PresentDirFromBindOption(pPresentationDirection); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpPTProperties::GetScope - -Routine Description: - - Method to get the nup scope which can be either - document wide or job wide. - -Arguments: - - pNUpScope - Enumeration value which will be set to the - current scope of nup. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpPTProperties::GetScope( - _In_ ENUpScope* pNUpScope - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pNUpScope, E_POINTER))) - { - *pNUpScope = CNUpPTProperties::None; - - if (m_bindingData.bindOption != XDPrintSchema::Binding::None) - { - *pNUpScope = m_bindingData.bindFeature == JobBindAllDocuments ? Job : Document; - } - else if (m_nupData.cNUp > 1) - { - *pNUpScope = m_nupData.nUpFeature == JobNUpAllDocumentsContiguously ? Job : Document; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpPTProperties::GetPageSize - -Routine Description: - - Method to get the nup page media size - -Arguments: - - pSizePage - Value which will be set to the nup page media size - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpPTProperties::GetPageSize( - _Out_ SizeF* pSizePage - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pSizePage, E_POINTER))) - { - // - // Convert microns to 96th of an inch. - // - pSizePage->Width = static_cast(m_pageMediaSizeData.pageWidth)/k96thInchAsMicrons; - pSizePage->Height = static_cast(m_pageMediaSizeData.pageHeight)/k96thInchAsMicrons; - - if (pSizePage->Width <= 0.0f || - pSizePage->Height <= 0.0f) - { - // - // The page media size is incorrect - // - ERR("Could not acquire a valid media page size\n"); - - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpPTProperties::GetPageOrientation - -Routine Description: - - Method to get the nup page orientation which can be either landscape or portrait - -Arguments: - - pPageOrientation - Enumeration value which will be set to either landscape or portrait - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpPTProperties::GetPageOrientation( - _In_ EOrientationOption* pPageOrientation - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPageOrientation, E_POINTER))) - { - *pPageOrientation = m_pageOrientData.orientation; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpPTProperties::PresentDirFromBindOption - -Routine Description: - - Method to obtain a presentation direction from the current binding setting - -Arguments: - - pPresentationDirection - Enumeration value which will be set to a presentation direction - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpPTProperties::PresentDirFromBindOption( - _Out_ ENUpDirectionOption* pPresentationDirection - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPresentationDirection, E_POINTER))) - { - switch (m_bindingData.bindOption) - { - case BindRight: - case EdgeStitchRight: - { - *pPresentationDirection = LeftBottom; - } - break; - - case BindBottom: - case EdgeStitchBottom: - { - // - // Vertical direction takes precidence over horizontal direction - // - *pPresentationDirection = TopLeft; - } - break; - - case BindTop: - case EdgeStitchTop: - { - // - // Vertical direction takes precidence over horizontal direction - // - *pPresentationDirection = BottomLeft; - } - break; - - // - // Everything else is RightBottom - // - default: - { - *pPresentationDirection = RightBottom; - } - break; - } - } - - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpPTProperties::GetBindingOption - -Routine Description: - - Method to obtain the binding direction - -Arguments: - - pBindingOption - Enumeration value which will be set to a binding direction - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpPTProperties::GetBindingOption( - _Out_ EBindingOption* pBindingOption - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pBindingOption, E_POINTER))) - { - *pBindingOption = m_bindingData.bindOption; - } - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/filters/nup/nuptprps.h b/print/XPSDrvSmpl/src/filters/nup/nuptprps.h deleted file mode 100644 index 2d53082a..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/nuptprps.h +++ /dev/null @@ -1,97 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nuptprps.cpp - -Abstract: - - NUp properties class definition. The NUp properties class is - responsible for holding and controling NUp properties. - ---*/ - -#pragma once - -#include "nupdata.h" -#include "bkdata.h" -#include "psizedata.h" -#include "porientdata.h" - -class CNUpPTProperties -{ -public: - enum ENUpScope - { - None = 0, - Job, - Document - }; - -public: - CNUpPTProperties( - _In_ CONST XDPrintSchema::NUp::NUpData& nupData, - _In_ CONST XDPrintSchema::Binding::BindingData& bindingData, - _In_ CONST XDPrintSchema::PageMediaSize::PageMediaSizeData& pageMediaSizeData, - _In_ CONST XDPrintSchema::PageOrientation::PageOrientationData& pageOrientData - ); - - virtual ~CNUpPTProperties(); - - HRESULT - GetCount( - _Out_ UINT* pcNUpPages - ); - - HRESULT - GetPresentationDirection( - _Out_ XDPrintSchema::NUp::PresentationDirection::ENUpDirectionOption* pPresentationDirection - ); - - HRESULT - GetScope( - _In_ ENUpScope* pNUpScope - ); - - HRESULT - GetPageSize( - _Out_ SizeF* pSizePage - ); - - HRESULT - GetPageOrientation( - _In_ XDPrintSchema::PageOrientation::EOrientationOption* pPageOrientation - ); - - HRESULT - GetBindingOption( - _Out_ XDPrintSchema::Binding::EBindingOption* pBindingOption - ); - -private: - CNUpPTProperties& operator = (CONST CNUpPTProperties&); - - HRESULT - PresentDirFromBindOption( - _Out_ XDPrintSchema::NUp::PresentationDirection::ENUpDirectionOption* pPresentationDirection - ); - -private: - CONST XDPrintSchema::NUp::NUpData m_nupData; - - CONST XDPrintSchema::Binding::BindingData m_bindingData; - - CONST XDPrintSchema::PageMediaSize::PageMediaSizeData m_pageMediaSizeData; - - CONST XDPrintSchema::PageOrientation::PageOrientationData m_pageOrientData; -}; - diff --git a/print/XPSDrvSmpl/src/filters/nup/nupxform.cpp b/print/XPSDrvSmpl/src/filters/nup/nupxform.cpp deleted file mode 100644 index a79ff819..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/nupxform.cpp +++ /dev/null @@ -1,623 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nupxform.cpp - -Abstract: - - NUp transform implementation. The NUp transform class is responsible - for calculating the appropriate matrix transform for a given page in - an NUp sequence. - -Known Issues: - - The NUp implementation does not yet account for reverse orientations - (ReverseLandscape and ReversePortrait). - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "nupxform.h" - -using XDPrintSchema::NUp::NUpData; -using XDPrintSchema::NUp::JobNUpAllDocumentsContiguously; - -using XDPrintSchema::NUp::PresentationDirection::ENUpDirectionOption; -using XDPrintSchema::NUp::PresentationDirection::ENUpDirectionOptionMin; -using XDPrintSchema::NUp::PresentationDirection::RightBottom; -using XDPrintSchema::NUp::PresentationDirection::BottomRight; -using XDPrintSchema::NUp::PresentationDirection::LeftBottom; -using XDPrintSchema::NUp::PresentationDirection::BottomLeft; -using XDPrintSchema::NUp::PresentationDirection::RightTop; -using XDPrintSchema::NUp::PresentationDirection::TopRight; -using XDPrintSchema::NUp::PresentationDirection::LeftTop; -using XDPrintSchema::NUp::PresentationDirection::TopLeft; -using XDPrintSchema::NUp::PresentationDirection::ENUpDirectionOptionMax; - -using XDPrintSchema::Binding::EBindingOption; -using XDPrintSchema::Binding::None; -using XDPrintSchema::Binding::BindTop; -using XDPrintSchema::Binding::BindBottom; - -using XDPrintSchema::PageOrientation::EOrientationOption; -using XDPrintSchema::PageOrientation::Landscape; -using XDPrintSchema::PageOrientation::ReverseLandscape; -using XDPrintSchema::PageOrientation::Portrait; - -static CONST REAL kLetterWidth96thsInch = 816.0f; -static CONST REAL kLetterHeight96thsInch = 1056.0f; - -/*++ - -Routine Name: - - CNUpTransform::CNUpTransform - -Routine Description: - - Constructor for the CNUpTransform class which initialises members - to sensible values based on the supplied PrintTicket object - -Arguments: - - pNUpPTProps - PrintTicket properties object used for initialising the - CNUpTransform object - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CNUpTransform::CNUpTransform( - _In_ CNUpPTProperties* pNUpPTProps - ) : - m_bRotatePage(FALSE), - m_cCurrPageIndex(0) -{ - ASSERTMSG(pNUpPTProps != NULL, "NULL PrintTicket passed to page transform handler\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pNUpPTProps, E_POINTER))) - { - if (SUCCEEDED(hr) && - FAILED(hr = pNUpPTProps->GetCount(&m_CanvasCount))) - { - m_CanvasCount = 1; - ERR("Failed to retrieve NUp count\n"); - } - - if (SUCCEEDED(hr) && - FAILED(hr = pNUpPTProps->GetPresentationDirection(&m_NUpPresentDirection))) - { - m_NUpPresentDirection = RightBottom; - ERR("Failed to retrieve NUp order\n"); - } - - if (SUCCEEDED(hr) && - FAILED(hr = pNUpPTProps->GetPageSize(&m_sizeTargetPage))) - { - m_sizeTargetPage.Width = kLetterWidth96thsInch; - m_sizeTargetPage.Height = kLetterHeight96thsInch; - ERR("Failed to retrieve target page size\n"); - } - - EOrientationOption pgOrient = Portrait; - if (SUCCEEDED(hr) && - FAILED(hr = pNUpPTProps->GetPageOrientation(&pgOrient))) - { - ERR("Failed to retrieve target page orientation\n"); - } - - // - // Initialise canvas count - // - switch (m_CanvasCount) - { - case 1: - { - m_CanvasXCount = 1; - m_CanvasYCount = 1; - } - break; - - case 2: - { - m_CanvasXCount = 1; - m_CanvasYCount = 2; - m_bRotatePage = TRUE; - - // - // Booklet printing is treated as a special case of 2Up. - // Unlike regular 2Up which always rotates pages, booklet - // only requires pages to be rotated when binding left to right - // or right to left. - // - EBindingOption bindingOption; - if(SUCCEEDED(hr = pNUpPTProps->GetBindingOption(&bindingOption))) - { - if(bindingOption == BindBottom || - bindingOption == BindTop) - { - m_bRotatePage = FALSE; - } - - if (pgOrient == Landscape) - { - m_CanvasXCount = 2; - m_CanvasYCount = 1; - } - } - } - break; - - case 4: - { - m_CanvasXCount = 2; - m_CanvasYCount = 2; - } - break; - - case 6: - { - m_CanvasXCount = 2; - m_CanvasYCount = 3; - m_bRotatePage = TRUE; - } - break; - - case 8: - { - m_CanvasXCount = 2; - m_CanvasYCount = 4; - m_bRotatePage = TRUE; - } - break; - - case 9: - { - m_CanvasXCount = 3; - m_CanvasYCount = 3; - } - break; - - case 16: - { - m_CanvasXCount = 4; - m_CanvasYCount = 4; - } - break; - - default: - { - m_CanvasXCount = 1; - m_CanvasYCount = 1; - } - break; - } - - if (pgOrient == Landscape || - pgOrient == ReverseLandscape) - { - INT countSwap = m_CanvasXCount; - m_CanvasXCount = m_CanvasYCount; - m_CanvasYCount = countSwap; - } - } - - if (SUCCEEDED(hr)) - { - hr = InitTransformMap(); - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - - -/*++ - -Routine Name: - - CNUpTransform::~CNUpTransform - -Routine Description: - - Default destructor for the CNUpTransform class - -Arguments: - - None - -Return Value: - - None - ---*/ -CNUpTransform::~CNUpTransform() -{ -} - -/*++ - -Routine Name: - - CNUpTransform::SetCurrentPage - -Routine Description: - - Sets the page member of the object - -Arguments: - - cPage - Current page count around the nup page count. - -Return Value: - - None - ---*/ -VOID -CNUpTransform::SetCurrentPage( - _In_ UINT cPage - ) -{ - m_cCurrPageIndex = cPage; -} - -/*++ - -Routine Name: - - CNUpTransform::GetPageTransform - -Routine Description: - - Method for obtaining a page transformation matrix based on the count of the - current canvas and the dimensions of the source and target pages - -Arguments: - - sizePage - Size of the source page being transformed - pTransform - Pointer to the resulting transformation matrix - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpTransform::GetPageTransform( - _In_ SizeF sizePage, - _Out_ Matrix* pTransform - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pTransform, E_POINTER))) - { - SizeF sizeCanvas(m_sizeTargetPage.Width / m_CanvasXCount, m_sizeTargetPage.Height / m_CanvasYCount); - PointF canvasCentre(sizeCanvas.Width/2.0f, sizeCanvas.Height/2.0f); - PointF pageCentre(sizePage.Width/2.0f, sizePage.Height/2.0f); - - REAL scaleX = 1.0f; - REAL scaleY = 1.0f; - if (m_bRotatePage) - { - // - // Calculate the dimension scale accounting for page rotation - // - scaleX = sizeCanvas.Width / sizePage.Height; - scaleY = sizeCanvas.Height / sizePage.Width; - - // - // Apply the rotation - // - pTransform->Rotate(90.0f, MatrixOrderAppend); - } - else - { - // - // Calculate the dimension scale - // - scaleX = sizeCanvas.Width / sizePage.Width; - scaleY = sizeCanvas.Height / sizePage.Height; - } - - // - // The minimum scale of x and y gurantees both - // dimensions fit the target - // - REAL scale = min(scaleX, scaleY); - - // - // Apply the scaling factor - // - pTransform->Scale(scale, scale, MatrixOrderAppend); - - // - // Find the new page centre - // - pTransform->TransformPoints(&pageCentre, 1); - - // - // Apply a translate to the canvas - // - UINT cPage = 0; - BOOL bDone = FALSE; - - for (UINT cIndexY = 0; cIndexY < m_CanvasYCount && !bDone; cIndexY++) - { - for (UINT cIndexX = 0; cIndexX < m_CanvasXCount && !bDone; cIndexX++) - { - if (m_pageNumVect[cPage] == m_cCurrPageIndex) - { - // - // Offset multipliers from loop indices - // - REAL yMult = static_cast(cIndexY); - REAL xMult = static_cast(cIndexX); - - // - // Use a matrix to find the centre of the translated canvas - // - Matrix canvasXForm; - - // - // Translate canvas to destination - // - canvasXForm.Translate(sizeCanvas.Width * xMult, sizeCanvas.Height * yMult, MatrixOrderAppend); - - // - // Apply the canvas transform to the canvas centre - // - canvasXForm.TransformPoints(&canvasCentre, 1); - - bDone = TRUE; - } - cPage++; - } - } - - // - // Calculate the offset of the centre of page to the centre - // of the canvas and apply the translation - // - PointF offset(canvasCentre - pageCentre); - pTransform->Translate(offset.X, offset.Y, MatrixOrderAppend); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpTransform::MatrixToXML - -Routine Description: - - Method to create xml markup representing a transformation matrix - -Arguments: - - pMatrix - Pointer to a transformation matrix to convert to markup - pbstrMatrixXForm - Pointer to a string to contain the matrix markup - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpTransform::MatrixToXML( - _In_ CONST Matrix* pMatrix, - _Outptr_ BSTR* pbstrMatrixXForm - ) -{ - // - // Construct the matric mark-up from a GDI+ matrix - // - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrMatrixXForm, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pMatrix, E_POINTER))) - { - *pbstrMatrixXForm = NULL; - REAL matElems[6]; - - if (Ok == pMatrix->GetElements(matElems)) - { - CStringXDW cstrMatrix; - - try - { - cstrMatrix.Format(L"%.2f,%.2f,%.2f,%.2f,%.2f,%.2f", - matElems[0], - matElems[1], - matElems[2], - matElems[3], - matElems[4], - matElems[5]); - - *pbstrMatrixXForm = cstrMatrix.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - else - { - *pbstrMatrixXForm = NULL; - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpTransform::InitTransformMap - -Routine Description: - - Method to initialise the map of transforms which depends - on the nup page count and presentation direction - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpTransform::InitTransformMap( - VOID - ) -{ - HRESULT hr = S_OK; - - // - // Populate the map of page numbers. - // The transforms are calculated left to right, top to bottom on - // the physical page so rather than special case each presentation - // order, we simply apply the same transform in the same order but - // to a different ordering of pages - // - try - { - // - // Certain NUp page counts cause a rotation to be applied to the page. - // When this occurs, the presentation order should also be rotated. - // - ENUpDirectionOption rotatedOrder[ENUpDirectionOptionMax] = { - BottomLeft, - LeftBottom, - TopLeft, - LeftTop, - BottomRight, - RightBottom, - TopRight, - RightTop - }; - - if (m_bRotatePage) - { - if (m_NUpPresentDirection >= ENUpDirectionOptionMin && - m_NUpPresentDirection < ENUpDirectionOptionMax) - { - m_NUpPresentDirection = rotatedOrder[m_NUpPresentDirection]; - } - else - { - ERR("Invalid presentation direction.\n"); - - hr = E_FAIL; - } - } - - if (SUCCEEDED(hr)) - { - m_pageNumVect.clear(); - for (UINT cIndexY = 0; cIndexY < m_CanvasYCount; cIndexY++) - { - for (UINT cIndexX = 0; cIndexX < m_CanvasXCount; cIndexX++) - { - switch (m_NUpPresentDirection) - { - case RightTop: - { - m_pageNumVect.push_back((m_CanvasXCount * (m_CanvasYCount-1)) - (m_CanvasXCount * cIndexY) + cIndexX); - } - break; - - case LeftBottom: - { - m_pageNumVect.push_back(cIndexY * m_CanvasXCount + (m_CanvasXCount - cIndexX) - 1); - } - break; - - case LeftTop: - { - m_pageNumVect.push_back((m_CanvasXCount * m_CanvasYCount) - cIndexX - (cIndexY*m_CanvasXCount) - 1); - } - break; - - case BottomRight: - { - m_pageNumVect.push_back(m_CanvasYCount * cIndexX + cIndexY); - } - break; - - case TopRight: - { - m_pageNumVect.push_back((m_CanvasYCount - 1 - cIndexY) + (cIndexX * m_CanvasYCount)); - } - break; - - case BottomLeft: - { - m_pageNumVect.push_back(m_CanvasYCount * (m_CanvasXCount - 1 - cIndexX) + cIndexY); - } - break; - - case TopLeft: - { - m_pageNumVect.push_back(((m_CanvasXCount-cIndexX) * m_CanvasYCount) - 1 - cIndexY); - } - break; - - case RightBottom: - default: - { - m_pageNumVect.push_back(cIndexY * m_CanvasXCount + cIndexX); - } - break; - } - } - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/nup/nupxform.h b/print/XPSDrvSmpl/src/filters/nup/nupxform.h deleted file mode 100644 index a752730f..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/nupxform.h +++ /dev/null @@ -1,101 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nupxform.h - -Abstract: - - NUp transform definition. The NUp transform class is responsible - for calculating the appropriate matrix transform for a given page in - an NUp sequence. - ---*/ - -#pragma once - -#include "nuptprps.h" - -class CNUpTransform -{ -public: - CNUpTransform( - _In_ CNUpPTProperties* pNUpPTProps - ); - - virtual ~CNUpTransform(); - - VOID - SetCurrentPage( - _In_ UINT cPage - ); - - HRESULT - GetPageTransform( - _In_ SizeF sizePage, - _Out_ Matrix* pTransform - ); - - HRESULT - MatrixToXML( - _In_ CONST Matrix* pMatrix, - _Outptr_ BSTR* pbstrMatrixXForm - ); - -private: - HRESULT - InitTransformMap( - VOID - ); - -private: - // - // Nup count - // - UINT m_CanvasCount; - - // - // Current Nup index - // - UINT m_cCurrPageIndex; - - // - // Presentation order - // - XDPrintSchema::NUp::PresentationDirection::ENUpDirectionOption m_NUpPresentDirection; - - // - // Target page size - // - SizeF m_sizeTargetPage; - - // - // Nup count across - // - UINT m_CanvasXCount; - - // - // Nup count down - // - UINT m_CanvasYCount; - - // - // Vector of page maps - // - vector m_pageNumVect; - - // - // We need to handle page rotation for 2, 6 and 8 up - // - BOOL m_bRotatePage; -}; - diff --git a/print/XPSDrvSmpl/src/filters/nup/precompsrc.cpp b/print/XPSDrvSmpl/src/filters/nup/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/nup/xdnup.def b/print/XPSDrvSmpl/src/filters/nup/xdnup.def deleted file mode 100644 index 349aaaa6..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/xdnup.def +++ /dev/null @@ -1,26 +0,0 @@ -; -; Copyright (c) 2005 Microsoft Corporation -; -; All rights reserved. -; -; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -; ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -; PARTICULAR PURPOSE. -; -; File Name: -; -; xdnup.def -; -; Abstract: -; -; NUp filter module definition file -; - -LIBRARY XDNup - -EXPORTS - DllMain - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - diff --git a/print/XPSDrvSmpl/src/filters/nup/xdnup.vcxproj b/print/XPSDrvSmpl/src/filters/nup/xdnup.vcxproj deleted file mode 100644 index 9c42026c..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/xdnup.vcxproj +++ /dev/null @@ -1,552 +0,0 @@ - - - - - Debug - ARM - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {23BA577F-B171-4CEC-92E0-49EE44564366} - $(MSBuildProjectName) - false - true - Debug - Win32 - {5C442B00-0FF4-48AA-9CD8-A0C589B6E6B9} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - xdnup - - - xdnup - - - xdnup - - - xdnup - - - xdnup - - - xdnup - - - xdnup - - - xdnup - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - - - - xdnup.def - - - - - xdnup.def - - - - - xdnup.def - - - - - xdnup.def - - - - - xdnup.def - - - - - xdnup.def - - - - - xdnup.def - - - - - xdnup.def - - - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/nup/xdnup.vcxproj.Filters b/print/XPSDrvSmpl/src/filters/nup/xdnup.vcxproj.Filters deleted file mode 100644 index 5cf3c9d5..00000000 --- a/print/XPSDrvSmpl/src/filters/nup/xdnup.vcxproj.Filters +++ /dev/null @@ -1,95 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {56E5007B-AD73-4A1E-B8F2-57AC3F2BCBB4} - - - h;hpp;hxx;hm;inl;inc;xsd - {C21FF91C-053E-46A7-AFD9-4F9E238380BE} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {B20F8D0B-1C7C-4058-9CC7-30742279D85E} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/precomp.h b/print/XPSDrvSmpl/src/filters/precomp.h deleted file mode 100644 index 68292995..00000000 --- a/print/XPSDrvSmpl/src/filters/precomp.h +++ /dev/null @@ -1,110 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - precomp.h - -Abstract: - - Precompiled header for all filters - ---*/ - -#pragma once - -// -// Annotate this as a usermode driver for static analysis -// -#include -_Analysis_mode_(_Analysis_code_type_user_driver_) - -// -// Standard Annotation Language include -// -#include - -// -// Windows includes -// -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif // WIN32_LEAN_AND_MEAN -#include -#include - -// -// COM includes -// -#include -#include - -// -// Standard library includes -// -#include -#include -#pragma warning(push) -#pragma warning(disable : 4018) -#include -#pragma warning(pop) -#include -#include - -// -// ATL Includes -// -#include - -#pragma warning (push) -#pragma warning (disable:4458) -// -// GDIPlus includes -// -#include -#pragma warning (pop) - -// -// MSXML includes -// -#include - -// -// Filter pipeline includes -// -#include -#include -#include -#include - -// -// WCS Includes -// -#include - -// -// Windows Imaging Component -// -#include - -// -// Commonly used namespaces -// -using namespace std; -using namespace Gdiplus; - -// -// String safe includes - included last to prevent build warnings -// -#include - -#include "common.ver" - diff --git a/print/XPSDrvSmpl/src/filters/scaling/dllentry.cpp b/print/XPSDrvSmpl/src/filters/scaling/dllentry.cpp deleted file mode 100644 index 7ae94af8..00000000 --- a/print/XPSDrvSmpl/src/filters/scaling/dllentry.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - dllentry.cpp - -Abstract: - - Implementation of the page scaling filter dllentry points. Dllmain only - stores the instance handle. DllGetClassObject calls on to a generic - get class factory template function. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "clasfact.h" -#include "scaleflt.h" -#include "xdexcept.h" - -/*++ - -Routine Name: - - DllMain - -Routine Description: - - Entry point to the page scaling filter which is called when a new process is started - -Arguments: - - hInst - Handle to the DLL module. - wReason - Indicates why the DLL entry-point function is being called. - -Return Value: - - TRUE - ---*/ -BOOL WINAPI -DllMain( - _In_ HINSTANCE hInst, - _In_ WORD wReason, - _In_opt_ LPVOID - ) -{ - switch (wReason) - { - case DLL_PROCESS_ATTACH: - { - g_hInstance = hInst; - } - break; - } - - return TRUE; -} - -/*++ - -Routine Name: - - DllCanUnloadNow - -Routine Description: - - Determines whether the DLL is in use. - If not, the caller can unload the DLL from memory. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - Dll can unload - S_FALSE - Dll can't unload - ---*/ -STDAPI -DllCanUnloadNow() -{ - if (g_cServerLocks == 0) - { - return S_OK ; - } - else - { - return S_FALSE; - } -} - -/*++ - -Routine Name: - - DllGetClassObject - -Routine Description: - - Retrieves the class object for the DLL. - Called from within the CoGetClassObject function. - -Arguments: - - rclsid - CLSID that will associate the correct data and code. - riid - Reference to the identifier of the interface that the caller is to use to communicate with the class object. - ppv - Address of pointer variable that receives the interface pointer requested in riid. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - CLASS_E_CLASSNOTAVAILABLE - On unsupported class - ---*/ -STDAPI -DllGetClassObject( - _In_ REFCLSID rclsid, - _In_ REFIID riid, - _Outptr_ LPVOID FAR* ppv - ) -{ - // - // 976EDCE4-274E-482a-9773-12453BE3E7F1 - // - CLSID scalingCLSID = {0x976EDCE4, 0x274E, 0x482a, {0x97, 0x73, 0x12, 0x45, 0x3B, 0xE3, 0xE7, 0xF1}}; - - return GetFilterClassFactory(rclsid, riid, scalingCLSID, ppv); -} - diff --git a/print/XPSDrvSmpl/src/filters/scaling/pagescale.cpp b/print/XPSDrvSmpl/src/filters/scaling/pagescale.cpp deleted file mode 100644 index 7a7bc160..00000000 --- a/print/XPSDrvSmpl/src/filters/scaling/pagescale.cpp +++ /dev/null @@ -1,761 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pagescale.cpp - -Abstract: - - Page Scaling class implementation. The Page Scaling class provides - functionality required to perform page Scaling. This includes methods for converting a GDI matrix object - into the appropriate XPS matrix mark-up and intialising the matrix according to - the Page Scaling options. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "pagescale.h" - -using XDPrintSchema::PageScaling::EScaleOption; -using XDPrintSchema::PageScaling::Custom; -using XDPrintSchema::PageScaling::CustomSquare; -using XDPrintSchema::PageScaling::FitBleedToImageable; -using XDPrintSchema::PageScaling::FitContentToImageable; -using XDPrintSchema::PageScaling::FitMediaToImageable; -using XDPrintSchema::PageScaling::FitMediaToMedia; - -using XDPrintSchema::PageScaling::OffsetAlignment::EScaleOffsetOption; -using XDPrintSchema::PageScaling::OffsetAlignment::BottomCenter; -using XDPrintSchema::PageScaling::OffsetAlignment::BottomLeft; -using XDPrintSchema::PageScaling::OffsetAlignment::BottomRight; -using XDPrintSchema::PageScaling::OffsetAlignment::Center; -using XDPrintSchema::PageScaling::OffsetAlignment::LeftCenter; -using XDPrintSchema::PageScaling::OffsetAlignment::RightCenter; -using XDPrintSchema::PageScaling::OffsetAlignment::TopCenter; -using XDPrintSchema::PageScaling::OffsetAlignment::TopLeft; -using XDPrintSchema::PageScaling::OffsetAlignment::TopRight; - -/*++ - -Routine Name: - - CPageScaling::CPageScaling - -Routine Description: - - CPageScaling class constructor - -Arguments: - - pgscProps - Reference to the page scaling PrintTicket properties. - -Return Value: - - None - ---*/ -CPageScaling::CPageScaling( - _In_ CONST CPGSCPTProperties& pgscProps - ) : - m_pageDimensions(0.0f, 0.0f), - m_PGSCProps(pgscProps), - m_bAddCanvas(FALSE), - m_contentBox(0.0f, 0.0f, 0.0f, 0.0f), - m_bleedBox(0.0f, 0.0f, 0.0f, 0.0f) -{ -} - -/*++ - -Routine Name: - - CPageScaling::~CPageScaling - -Routine Description: - - CPageScaling class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPageScaling::~CPageScaling() -{ -} - -/*++ - -Routine Name: - - CPageScaling::GetFixedPageWidth - -Routine Description: - - Creates a string containing the page width in 1/96 Inch - (Not applicable to Custom Scaling options). - -Arguments: - - pbstrWidth - Address of a pointer that will be modified to point to a string - that is filled out with the fixed page width. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScaling::GetFixedPageWidth( - _Outptr_ BSTR* pbstrWidth - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrWidth, E_POINTER))) - { - try - { - SizeF targetPage; - if (SUCCEEDED(hr = m_PGSCProps.GetPageSize(&targetPage))) - { - CStringXDW cstrValue; - cstrValue.Format(L"%.2f", targetPage.Width); - *pbstrWidth = cstrValue.AllocSysString(); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPageScaling::GetFixedPageHeight - -Routine Description: - - Creates a string containing the page height in 1/96 Inch - (Not applicable to Custom Scaling options). - -Arguments: - - pbstrHeight - Address of a pointer that will be modified to point to a string - that is filled out with the fixed page height. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScaling::GetFixedPageHeight( - _Outptr_ BSTR* pbstrHeight - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrHeight, E_POINTER))) - { - try - { - SizeF targetPage; - if (SUCCEEDED(hr = m_PGSCProps.GetPageSize(&targetPage))) - { - CStringXDW cstrValue; - cstrValue.Format(L"%.2f", targetPage.Height); - *pbstrHeight = cstrValue.AllocSysString(); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPageScaling::MatrixToXML - -Routine Description: - - Creates a string representation of a Matrix class object. - The string is suitable for use in XPS markup with the 'RenderTransform' keyword. - -Arguments: - - pMatrix - Pointer to a Matrix class object. - pbstrMatrixXForm - Address of a pointer that will be modified to point to a string - that is filled out with the matrix. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScaling::MatrixToXML( - _In_ CONST Matrix* pMatrix, - _Outptr_ BSTR* pbstrMatrixXForm - ) -{ - // - // Construct the matric mark-up from a GDI+ matrix - // - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrMatrixXForm, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pMatrix, E_POINTER))) - { - REAL matElems[6]; - if (Ok == pMatrix->GetElements(matElems)) - { - try - { - CStringXDW cstrMatrix; - cstrMatrix.Format(L"%.2f,%.2f,%.2f,%.2f,%.2f,%.2f", - matElems[0], - matElems[1], - matElems[2], - matElems[3], - matElems[4], - matElems[5]); - - *pbstrMatrixXForm = cstrMatrix.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - else - { - *pbstrMatrixXForm = NULL; - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPageScaling::SetPageDimensions - -Routine Description: - - Used to set the XPS page width and height in the page scaling interface. - -Arguments: - - width - Width of the XPS fixed page in 1/96 Inch. - height - Height of the XPS fixed page in 1/96 Inch. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScaling::SetPageDimensions( - _In_ CONST REAL width, - _In_ CONST REAL height - ) -{ - m_pageDimensions.Width = width; - m_pageDimensions.Height = height; - - return S_OK; -} - -/*++ - -Routine Name: - - CPageScaling::SetBleedBox - -Routine Description: - - Used to set the XPS BleedBox in the page scaling interface. - -Arguments: - - pBleedBox - pointer to a rectangle defining the BleedBox of the XPS page in 1/96 Inch. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScaling::SetBleedBox( - _In_ RectF* pBleedBox - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pBleedBox, E_POINTER))) - { - m_bleedBox = *pBleedBox; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPageScaling::SetContentBox - -Routine Description: - - Used to set the XPS ContentBox in the page scaling interface. - -Arguments: - - pContentBox - pointer to a rectangle defining the ContentBox of the XPS page in 1/96 Inch. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScaling::SetContentBox( - _In_ RectF* pContentBox - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pContentBox, E_POINTER))) - { - m_contentBox = *pContentBox; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPageScaling::CalculateMatrix - -Routine Description: - - Calculates a matrix transform from the current page scaling properties. - -Arguments: - - pMatrix - Pointer to a Matrix class object that is modified to reflect the current transform. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScaling::CalculateMatrix( - _Inout_ Matrix* pMatrix - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pMatrix, E_POINTER))) - { - REAL xScale = 1.0f; - REAL yScale = 1.0f; - REAL widthOffset = 0.0f; - REAL heightOffset = 0.0f; - - EScaleOption pgscOption; - - if (SUCCEEDED(hr = m_PGSCProps.GetOption(&pgscOption))) - { - switch (pgscOption) - { - case Custom: - case CustomSquare: - { - // - // The PrintTicket property handler for Custom and CustomSquare - // already handle mapping of x and y. - // - if (SUCCEEDED(hr = m_PGSCProps.GetWidthScale(&xScale)) && - SUCCEEDED(hr = m_PGSCProps.GetHeightScale(&yScale)) && - SUCCEEDED(hr = m_PGSCProps.GetWidthOffset(&widthOffset))) - { - hr = m_PGSCProps.GetHeightOffset(&heightOffset); - } - } - break; - - case FitBleedToImageable: // ImageableSize <- BleedBox - case FitContentToImageable: // ImageableSize <- ContentBox - case FitMediaToImageable: // ImageableSize <- FixedPage - case FitMediaToMedia: // Mediasize <- FixedPage - { - EScaleOffsetOption offsetOption; - - if (SUCCEEDED(hr = m_PGSCProps.GetOffsetOption(&offsetOption))) - { - RectF targetPage; - RectF sourcePage; - - switch (pgscOption) - { - case FitBleedToImageable: - { - m_PGSCProps.GetImageableRect(&targetPage); - - sourcePage = m_bleedBox; - } - break; - case FitContentToImageable: - { - m_PGSCProps.GetImageableRect(&targetPage); - - sourcePage = m_contentBox; - } - break; - case FitMediaToImageable: - { - m_PGSCProps.GetImageableRect(&targetPage); - - sourcePage = RectF(0, 0, m_pageDimensions.Width, m_pageDimensions.Height); - } - break; - case FitMediaToMedia: - { - SizeF pageSize; - m_PGSCProps.GetPageSize(&pageSize); - targetPage = RectF(0, 0, pageSize.Width, pageSize.Height); - - sourcePage = RectF(0, 0, m_pageDimensions.Width, m_pageDimensions.Height); - } - break; - } - - // - // Calculate scaling factors - // - xScale = static_cast(targetPage.Width / sourcePage.Width); - yScale = static_cast(targetPage.Height / sourcePage.Height); - - // - // Best Fit, always maintain aspect ratio - // Select the smallest of the two scale factors, - // This will ensure that the image always fits on the page. - // - if (xScale < yScale) - { - yScale = xScale; - } - else - { - xScale = yScale; - } - - // - // Calculate the offset to meet the offset alignment setting - // - RectF scaledPage(xScale*sourcePage.X, yScale*sourcePage.Y, xScale*sourcePage.Width, yScale*sourcePage.Height); - switch (offsetOption) - { - case BottomCenter: - { - widthOffset = (targetPage.X + (targetPage.Width/2.0f)) - (scaledPage.X + (scaledPage.Width/2.0f)); - heightOffset = (targetPage.Y + targetPage.Height) - (scaledPage.Y + scaledPage.Height); - } - break; - case BottomLeft: - { - widthOffset = targetPage.X - scaledPage.X; - heightOffset = targetPage.Y + targetPage.Height - (scaledPage.Y + scaledPage.Height); - } - break; - case BottomRight: - { - widthOffset = (targetPage.X + targetPage.Width) - (scaledPage.X + scaledPage.Width); - heightOffset = (targetPage.Y + targetPage.Height) - (scaledPage.Y + scaledPage.Height); - } - break; - case Center: - { - widthOffset = (targetPage.X + (targetPage.Width/2.0f)) - (scaledPage.X + (scaledPage.Width/2.0f)); - heightOffset = (targetPage.Y + (targetPage.Height/2.0f)) - (scaledPage.Y + (scaledPage.Height/2.0f)); - } - break; - case LeftCenter: - { - widthOffset = targetPage.X - scaledPage.X; - heightOffset = (targetPage.Y + (targetPage.Height/2.0f)) - (scaledPage.Y + (scaledPage.Height/2.0f)); - } - break; - case RightCenter: - { - widthOffset = (targetPage.X + targetPage.Width) - (scaledPage.X + scaledPage.Width); - heightOffset = (targetPage.Y + (targetPage.Height/2.0f)) - (scaledPage.Y + (scaledPage.Height/2.0f)); - } - break; - case TopCenter: - { - widthOffset = (targetPage.X + (targetPage.Width/2.0f)) - (scaledPage.X + (scaledPage.Width/2.0f)); - heightOffset = targetPage.Y - scaledPage.Y; - } - break; - default: - case TopLeft: - { - // - // Default Top Left - // - widthOffset = targetPage.X - scaledPage.X; - heightOffset = targetPage.Y - scaledPage.Y; - } - break; - case TopRight: - { - widthOffset = (targetPage.X + targetPage.Width) - (scaledPage.X + scaledPage.Width); - heightOffset = targetPage.Y - scaledPage.Y; - } - break; - } - } - } - break; - - default: - { - // - // No Scaling required. - // - } - break; - } - } - - // - // Apply the transforms to the matrix - // - Status gdiPlusStatus = pMatrix->Scale(xScale, yScale, MatrixOrderAppend); - - if (gdiPlusStatus == Ok) - { - gdiPlusStatus = pMatrix->Translate(widthOffset, heightOffset, MatrixOrderAppend); - } - - if (gdiPlusStatus != Ok) - { - hr = GetGDIStatusErrorAsHResult(gdiPlusStatus); - } - } - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CPageScaling::CreateTransform - -Routine Description: - - Creates a string representation of the current page scaling matrix. - The string is suitable for use in XPS markup with the 'RenderTransform' keyword. - -Arguments: - - pbstrMatrixXForm - Address of a pointer that will be modified to point to a string - that is filled out with the matrix. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScaling::CreateTransform( - _Outptr_ BSTR* pbstrMatrixXForm - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrMatrixXForm, E_POINTER))) - { - *pbstrMatrixXForm = NULL; - - // - // Start with the identity matrix - // - - Matrix xForm; - - if (SUCCEEDED(hr = CalculateMatrix(&xForm))) - { - // - // Retrieve the matrix string - // - hr = MatrixToXML(&xForm, pbstrMatrixXForm); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPageScaling::GetOpenTagXML - -Routine Description: - - Creates a string that contains the open tag XPS markup required to - scale the page content. Page Scaling is achieved by wrapping the page content - in a canvas and applying a RenderTransform which reflects the current page scaling properties. - -Arguments: - - pbstrXML - Address of a pointer that will be modified to point to a string - that is filled out with the page scaling close tag XPS markup. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScaling::GetOpenTagXML( - _Outptr_ BSTR* pbstrXML - ) -{ - HRESULT hr = S_OK; - - // - // Create the Canvas with Render Transform - // - try - { - CComBSTR bstrMatrixXForm; - - if (SUCCEEDED(hr = CreateTransform(&bstrMatrixXForm))) - { - CStringXDW cstrCanvas; - cstrCanvas.Format(L"(bstrMatrixXForm)); - *pbstrXML = cstrCanvas.AllocSysString(); - } - } - catch (CXDException& e) - { - hr = e; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPageScaling::GetCloseTagXML - -Routine Description: - - Creates a string that contains the close tag XPS markup. - This is achived by closing the canvas tag. - -Arguments: - - pbstrXML - Address of a pointer that will be modified to point to a string - that is filled out with the page scaling close tag XPS markup. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScaling::GetCloseTagXML( - _Outptr_ BSTR* pbstrXML - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrXML, E_POINTER))) - { - try - { - CStringXDW cstrCanvas(L"\n"); - *pbstrXML = cstrCanvas.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/scaling/pagescale.h b/print/XPSDrvSmpl/src/filters/scaling/pagescale.h deleted file mode 100644 index 51f9be89..00000000 --- a/print/XPSDrvSmpl/src/filters/scaling/pagescale.h +++ /dev/null @@ -1,107 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - scalepage.h - -Abstract: - - Page Scaling class implementation. The Page Scaling class provides - functionality required to generate the XPS markup to perform page scaling. - This includes methods for converting a GDI matrix object - into the appropriate XPS matrix mark-up and intialising the matrix according to - the Page Scaling options. - ---*/ - -#pragma once - -#include "pgscptprop.h" - -class CPageScaling -{ -public: - CPageScaling( - _In_ CONST CPGSCPTProperties& psProps - ); - - virtual ~CPageScaling(); - - HRESULT - GetFixedPageWidth( - _Outptr_ BSTR* pbstrWidth - ); - - HRESULT - GetFixedPageHeight( - _Outptr_ BSTR* pbstrHeight - ); - - HRESULT - GetOpenTagXML( - _Outptr_ BSTR* pbstrXML - ); - - HRESULT - GetCloseTagXML( - _Outptr_ BSTR* pbstrXML - ); - - HRESULT - SetPageDimensions( - _In_ CONST REAL width, - _In_ CONST REAL height - ); - - HRESULT - SetBleedBox( - _In_ RectF* pBleedBox - ); - - HRESULT - SetContentBox( - _In_ RectF* pContentBox - ); - -private: - HRESULT - CreateTransform( - _Outptr_ BSTR* pbstrMatrixXForm - ); - - HRESULT - CalculateMatrix( - _Inout_ Matrix* pMatrix - ); - - HRESULT - MatrixToXML( - _In_ CONST Matrix* pMatrix, - _Outptr_ BSTR* pbstrMatrixXForm - ); - -private: - CComPtr m_pDOMDoc; - - CComPtr m_pCanvasElem; - - CPGSCPTProperties m_PGSCProps; - - RectF m_bleedBox; - - RectF m_contentBox; - - SizeF m_pageDimensions; - - BOOL m_bAddCanvas; -}; - diff --git a/print/XPSDrvSmpl/src/filters/scaling/pgscptprop.cpp b/print/XPSDrvSmpl/src/filters/scaling/pgscptprop.cpp deleted file mode 100644 index 9f771658..00000000 --- a/print/XPSDrvSmpl/src/filters/scaling/pgscptprop.cpp +++ /dev/null @@ -1,478 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pgscptprop.cpp - -Abstract: - - Page Scaling properties class implementation. The Page Scaling properties class - is responsible for holding and controling Page Scaling properties. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "pgscptprop.h" - -using XDPrintSchema::PageScaling::PageScalingData; -using XDPrintSchema::PageScaling::EScaleOption; -using XDPrintSchema::PageScaling::OffsetAlignment::EScaleOffsetOption; - -using XDPrintSchema::PageOrientation::PageOrientationData; -using XDPrintSchema::PageOrientation::Landscape; -using XDPrintSchema::PageOrientation::ReverseLandscape; - -using XDPrintSchema::PageMediaSize::PageMediaSizeData; - -using XDPrintSchema::PageImageableSize::PageImageableData; - -/*++ - -Routine Name: - - CPGSCPTProperties::CPGSCPTProperties - -Routine Description: - - CPGSCPTProperties class constructor - -Arguments: - - pgscData - reference to the Page Scaling data. - pSizeData - reference to the Page Size data. - pImageableData - reference to the Page Imageable Size data. - -Return Value: - - None - ---*/ -CPGSCPTProperties::CPGSCPTProperties( - _In_ CONST PageScalingData& pgscData, - _In_ CONST PageMediaSizeData& pSizeData, - _In_ CONST PageImageableData& pImageableData, - _In_ CONST PageOrientationData& pageOrientData - ) : - m_pgscData(pgscData), - m_pageMediaSizeData(pSizeData), - m_pageImageableData(pImageableData), - m_pageOrientData(pageOrientData) -{ -} - -/*++ - -Routine Name: - - CPGSCPTProperties::~CPGSCPTProperties - -Routine Description: - - CPGSCPTProperties class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPGSCPTProperties::~CPGSCPTProperties() -{ -} - -/*++ - -Routine Name: - - CPGSCPTProperties::GetOption - -Routine Description: - - Used to obtain the current page scaling option. - -Arguments: - - pOption - Pointer to the page scaling option to filled out. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPGSCPTProperties::GetOption( - _Out_ EScaleOption* pOption - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pOption, E_POINTER))) - { - *pOption = m_pgscData.pgscOption; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPGSCPTProperties::GetOffsetOption - -Routine Description: - - Used to obtain the current page scaling offset option. - -Arguments: - - pOffsetOption - Pointer to the page scaling offset option to filled out. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPGSCPTProperties::GetOffsetOption( - _Out_ EScaleOffsetOption* pOffsetOption - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pOffsetOption, E_POINTER))) - { - *pOffsetOption = m_pgscData.offsetOption; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPGSCPTProperties::GetWidthOffset - -Routine Description: - - Used to obtain the current width offset (Only applies to the custom scaling options). - Units are in 1/96 Inch. - -Arguments: - - pWidthOffset - Pointer to the width offset data to be filled out. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPGSCPTProperties::GetWidthOffset( - _Out_ REAL* pWidthOffset - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pWidthOffset, E_POINTER))) - { - *pWidthOffset = static_cast(m_pgscData.offWidth)/k96thInchAsMicrons; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPGSCPTProperties::GetHeightOffset - -Routine Description: - - Used to obtain the current height offset (Only applies to the custom scaling options). - Units are in 1/96 Inch. - -Arguments: - - pHeightOffset - Pointer to the height offset data to be filled out. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPGSCPTProperties::GetHeightOffset( - _Out_ REAL* pHeightOffset - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pHeightOffset, E_POINTER))) - { - *pHeightOffset = static_cast(m_pgscData.offHeight)/k96thInchAsMicrons; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPGSCPTProperties::GetWidthScale - -Routine Description: - - Used to obtain the current width scale percentage - (Only applies to the custom scaling options). - -Arguments: - - pWidthScale - Pointer to the width scale data to be filled out. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPGSCPTProperties::GetWidthScale( - _Out_ REAL* pWidthScale - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pWidthScale, E_POINTER))) - { - *pWidthScale = static_cast(m_pgscData.scaleWidth)/100.00f; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPGSCPTProperties::GetHeightScale - -Routine Description: - - Used to obtain the current height scale percentage - (Only applies to the custom scaling options). - -Arguments: - - pHeightScale - Pointer to the height scale data to be filled out. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPGSCPTProperties::GetHeightScale( - _Out_ REAL* pHeightScale - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pHeightScale, E_POINTER))) - { - *pHeightScale = static_cast(m_pgscData.scaleHeight)/100.00f; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPGSCPTProperties::GetPageSize - -Routine Description: - - Used to obtain the current page size. Units are in 1/96 Inch. - - Note: This returns the page dimensions accounting for the orientation and media size - expressed by the PrintTicket as PageOrientation and PageMediaSize. The PageMediaSize - expresses the dimensions using the convention that the page is oriented as portrait. - To get the dimensions for scaling we need to swap width for height when in landscape - so that we can scale the FixedPage content appropriately. - -Arguments: - - pSizePage - Pointer to the page size data to be filled out. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPGSCPTProperties::GetPageSize( - _Out_ SizeF* pSizePage - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pSizePage, E_POINTER))) - { - // - // Convert microns to 96th of an inch - // - pSizePage->Width = static_cast(m_pageMediaSizeData.pageWidth)/k96thInchAsMicrons; - pSizePage->Height = static_cast(m_pageMediaSizeData.pageHeight)/k96thInchAsMicrons; - - // - // Swap dimensions if the orientation is a landscape orientation - // - if (m_pageOrientData.orientation == Landscape || - m_pageOrientData.orientation == ReverseLandscape) - { - REAL sizeSwap = pSizePage->Width; - pSizePage->Width = pSizePage->Height; - pSizePage->Height = sizeSwap; - } - - if (pSizePage->Width <= 0.0f || - pSizePage->Height <= 0.0f) - { - // - // The page media size is incorrect - // - ERR("Could not acquire a valid media page size\n"); - - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPGSCPTProperties::GetImageableRect - -Routine Description: - - Used to obtain the current page imageable area and offset. - Units are in 1/96 Inch. - -Arguments: - - pImageableRect - Pointer to the page imageable data to be filled out. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPGSCPTProperties::GetImageableRect( - _Out_ RectF* pImageableRect - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pImageableRect, E_POINTER))) - { - pImageableRect->X = 0; - pImageableRect->Y = 0; - pImageableRect->Width = 0; - pImageableRect->Height = 0; - - // - // Get the size of the area - convert microns to 96th of an inch - // - SizeF sizeImage; - if (m_pageImageableData.imageableSizeWidth > 0 && - m_pageImageableData.imageableSizeHeight > 0) - { - sizeImage.Width = static_cast(m_pageImageableData.imageableSizeWidth)/k96thInchAsMicrons; - sizeImage.Height = static_cast(m_pageImageableData.imageableSizeHeight)/k96thInchAsMicrons; - } - else - { - // - // Page imageable size was not set - use the page media size - // - sizeImage.Width = static_cast(m_pageMediaSizeData.pageWidth)/k96thInchAsMicrons; - sizeImage.Height = static_cast(m_pageMediaSizeData.pageHeight)/k96thInchAsMicrons; - } - - // - // Get the offset of the area - convert microns to 96th of an inch - // - PointF offsetImage(static_cast(m_pageImageableData.originWidth)/k96thInchAsMicrons, - static_cast(m_pageImageableData.originHeight)/k96thInchAsMicrons); - - // - // Swap dimensions if the orientation is a landscape orientation - // - if (m_pageOrientData.orientation == Landscape || - m_pageOrientData.orientation == ReverseLandscape) - { - pImageableRect->Width = sizeImage.Height; - pImageableRect->Height = sizeImage.Width; - - pImageableRect->X = offsetImage.Y; - pImageableRect->Y = offsetImage.X; - } - else - { - pImageableRect->Width = sizeImage.Width; - pImageableRect->Height = sizeImage.Height; - - pImageableRect->X = offsetImage.X; - pImageableRect->Y = offsetImage.Y; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/scaling/pgscptprop.h b/print/XPSDrvSmpl/src/filters/scaling/pgscptprop.h deleted file mode 100644 index 99cb5328..00000000 --- a/print/XPSDrvSmpl/src/filters/scaling/pgscptprop.h +++ /dev/null @@ -1,91 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pgscptprop.h - -Abstract: - - Page Scaling properties class definition. The Page Scaling properties class - is responsible for holding and controling Page Scaling properties. - ---*/ - -#pragma once - -#include "pgscdata.h" -#include "psizedata.h" -#include "pimagedata.h" -#include "porientdata.h" - -class CPGSCPTProperties -{ -public: - CPGSCPTProperties( - _In_ CONST XDPrintSchema::PageScaling::PageScalingData& pgscData, - _In_ CONST XDPrintSchema::PageMediaSize::PageMediaSizeData& psizeData, - _In_ CONST XDPrintSchema::PageImageableSize::PageImageableData& pimageableData, - _In_ CONST XDPrintSchema::PageOrientation::PageOrientationData& pageOrientData - ); - - virtual ~CPGSCPTProperties(); - - HRESULT - GetOption( - _Out_ XDPrintSchema::PageScaling::EScaleOption* pScaleOption - ); - - HRESULT - GetWidthOffset( - _Out_ REAL* pWidthOffset - ); - - HRESULT - GetHeightOffset( - _Out_ REAL* pHeightOffset - ); - - HRESULT - GetWidthScale( - _Out_ REAL* pWidthScale - ); - - HRESULT - GetHeightScale( - _Out_ REAL* pHeightScale - ); - - HRESULT - GetOffsetOption( - _Out_ XDPrintSchema::PageScaling::OffsetAlignment::EScaleOffsetOption* pOffsetOption - ); - - HRESULT - GetPageSize( - _Out_ SizeF* pSizePage - ); - - HRESULT - GetImageableRect( - _Out_ RectF* pImageableRect - ); - -protected: - XDPrintSchema::PageScaling::PageScalingData m_pgscData; - - XDPrintSchema::PageMediaSize::PageMediaSizeData m_pageMediaSizeData; - - XDPrintSchema::PageImageableSize::PageImageableData m_pageImageableData; - - XDPrintSchema::PageOrientation::PageOrientationData m_pageOrientData; -}; - diff --git a/print/XPSDrvSmpl/src/filters/scaling/precompsrc.cpp b/print/XPSDrvSmpl/src/filters/scaling/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/XPSDrvSmpl/src/filters/scaling/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/scaling/scaleflt.cpp b/print/XPSDrvSmpl/src/filters/scaling/scaleflt.cpp deleted file mode 100644 index 1827a9a2..00000000 --- a/print/XPSDrvSmpl/src/filters/scaling/scaleflt.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - scaleflt.cpp - -Abstract: - - Page Scaling filter implementation. This class derives from the Xps filter - class and implements the necessary part handlers to support Page Scaling - printing. The Page Scaling filter is responsible for modifying the XPS document - to add the appropriate mark-up onto pages to achieve scaling. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "scaleflt.h" -#include "pagescale.h" -#include "scalesax.h" -#include "psizepthndlr.h" -#include "pimagepthndlr.h" -#include "pgscpthndlr.h" -#include "porientpthndlr.h" - -using XDPrintSchema::PageScaling::PageScalingData; -using XDPrintSchema::PageMediaSize::PageMediaSizeData; -using XDPrintSchema::PageImageableSize::PageImageableData; -using XDPrintSchema::PageOrientation::PageOrientationData; - -/*++ - -Routine Name: - - CPageScalingFilter::CPageScalingFilter - -Routine Description: - - CPageScalingFilter class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPageScalingFilter::CPageScalingFilter() -{ - ASSERTMSG(m_gdiPlus.GetGDIPlusStartStatus() == Ok, "GDI plus is not correctly initialized.\n"); -} - -/*++ - -Routine Name: - - CPageScalingFilter::~CPageScalingFilter - -Routine Description: - - CPageScalingFilter class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPageScalingFilter::~CPageScalingFilter() -{ -} - -/*++ - -Routine Name: - - CPageScalingFilter::ProcessFixedPage - -Routine Description: - - This method processes the XPS content of a page applying - any scaling required according to information in the PrintTicket. - The result is written out to a new XPS document. - -Arguments: - - pPrintTicket - Pointer to the XML PrintTicket Document that is associated with the page. - pPageReadStream - Pointer to the input stream interface for the XPS Page. - pPageWriteStream - Pointer to the output stream interface for the XPS Page. - -Return Value: - - HRESULT - S_OK - On success - HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) - When the fixed page is not to be modified - E_* - On error - ---*/ -HRESULT -CPageScalingFilter::ProcessFixedPage( - _In_ IXMLDOMDocument2* pFPPT, - _In_ ISequentialStream* pPageReadStream, - _In_ ISequentialStream* pPageWriteStream - ) -{ - VERBOSE("Processing stream fixed page with page scaling handler\n"); - - HRESULT hr = S_OK; - - CPageScaling* pPageScaling = NULL; - CComPtr pSaxRdr(NULL); - CComPtr pPrintCapabilities(NULL); - - if (SUCCEEDED(hr = m_ptManager.GetCapabilities(pFPPT, &pPrintCapabilities)) && - SUCCEEDED(hr = CHECK_POINTER(pFPPT, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPageReadStream, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPageWriteStream, E_POINTER)) && - SUCCEEDED(hr = GetPageScaling(pFPPT, pPrintCapabilities, &pPageScaling)) && - SUCCEEDED(hr = pSaxRdr.CoCreateInstance(CLSID_SAXXMLReader60))) - { - // - // Set-up the SAX reader and begin parsing the mark-up - // - CScaleSaxHandler scaleSaxHndlr(pPageWriteStream, pPageScaling); - - if (SUCCEEDED(hr = pSaxRdr->putContentHandler(&scaleSaxHndlr))) - { - hr = pSaxRdr->parse(CComVariant(pPageReadStream)); - } - } - else if (hr == E_ELEMENT_NOT_FOUND) - { - // - // No Page Scaling was found in the PrintTicket - return error not supported so - // the xps container sends the unmodified data - // - hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); - } - - // - // Clean up the Page Scaling if it was successfully created - // - if (pPageScaling != NULL) - { - delete pPageScaling; - pPageScaling = NULL; - } - - ERR_ON_HR_EXC(hr, HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED)); - return hr; -} - -/*++ - -Routine Name: - - CPageScalingFilter::GetPageScaling - -Routine Description: - - Creates and initialises an instance of the Page Scaling Interface - using the information in the PrintTicket provided. - -Arguments: - - pPrintTicket - Pointer to an XML PrintTicket Document. - pPrintCapabilities - Pointer to an XML PrintCapabilities Document. - ppPageScaling - Address of pointer that receives the Page Scaling Interface. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScalingFilter::GetPageScaling( - _In_ IXMLDOMDocument2* pPrintTicket, - _In_ IXMLDOMDocument2* pPrintCapabilities, - _Outptr_ CPageScaling** ppPageScaling - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppPageScaling, E_POINTER))) - { - *ppPageScaling = NULL; - - try - { - CPageScalingPTHandler pgscPTHandler(pPrintTicket); - CPageImageablePCHandler imagePCHandler(pPrintCapabilities); - CPageSizePTHandler sizePTHandler(pPrintTicket); - CPageOrientationPTHandler orientPTHandler(pPrintTicket); - - PageScalingData pgscData; - PageMediaSizeData sizeData; - PageImageableData imageData; - PageOrientationData orientData; - - if (SUCCEEDED(hr = pgscPTHandler.GetData(&pgscData)) && - SUCCEEDED(hr = sizePTHandler.GetData(&sizeData)) && - SUCCEEDED(hr = orientPTHandler.GetData(&orientData))) - { - hr = imagePCHandler.GetData(&imageData); - - // - // The imageable area property in a PrintTicket is an optional requirement. - // - if (hr == E_ELEMENT_NOT_FOUND) - { - hr = S_OK; - } - - if (SUCCEEDED(hr)) - { - CPGSCPTProperties pgscProperties(pgscData, sizeData, imageData, orientData); - - *ppPageScaling = new(std::nothrow) CPageScaling(pgscProperties); - - if (*ppPageScaling == NULL) - { - hr = E_OUTOFMEMORY; - } - } - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/scaling/scaleflt.h b/print/XPSDrvSmpl/src/filters/scaling/scaleflt.h deleted file mode 100644 index 2e8307c0..00000000 --- a/print/XPSDrvSmpl/src/filters/scaling/scaleflt.h +++ /dev/null @@ -1,56 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - scaleflt.h - -Abstract: - - Page Scaling filter defnition. This class derives from the Xps filter - class and implements the necessary part handlers to support Page Scaling. - The Page Scaling filter is responsible for adding mark-up to - the XPS document to allow scaling of pages. - ---*/ - -#pragma once - -#include "xdstrmflt.h" -#include "pagescale.h" -#include "gdip.h" - -class CPageScalingFilter : public CXDStreamFilter -{ -public: - CPageScalingFilter(); - - virtual ~CPageScalingFilter(); - - virtual HRESULT - ProcessFixedPage( - _In_ IXMLDOMDocument2* pFPPT, - _In_ ISequentialStream* pPageReadStream, - _In_ ISequentialStream* pPageWriteStream - ); - -private: - HRESULT - GetPageScaling( - _In_ IXMLDOMDocument2* pPrintTicket, - _In_ IXMLDOMDocument2* pPrintCapabilities, - _Outptr_ CPageScaling** ppPageScaling - ); - -private: - GDIPlus m_gdiPlus; -}; - diff --git a/print/XPSDrvSmpl/src/filters/scaling/scaleflt.rc b/print/XPSDrvSmpl/src/filters/scaling/scaleflt.rc deleted file mode 100644 index 677e6c0a..00000000 --- a/print/XPSDrvSmpl/src/filters/scaling/scaleflt.rc +++ /dev/null @@ -1,43 +0,0 @@ -// -// Copyright (c) 2005 Microsoft Corporation -// -// All rights reserved. -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// File Name: -// -// scaleflt.rc -// -// Abstract: -// -// Page Scaling filter resource file. -// -// - -#include -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT2_UNKNOWN -#define VER_FILEDESCRIPTION_STR "XPSDrv Sample Scaling Filter" -#define VER_INTERNALNAME_STR "PrintFeatureFilters" - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#endif // English (U.S.) resources - -///////////////////////////////////////////////////////////////////////////// - -#include "common.ver" - diff --git a/print/XPSDrvSmpl/src/filters/scaling/scalesax.cpp b/print/XPSDrvSmpl/src/filters/scaling/scalesax.cpp deleted file mode 100644 index 43219976..00000000 --- a/print/XPSDrvSmpl/src/filters/scaling/scalesax.cpp +++ /dev/null @@ -1,591 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - scalesax.xpp - -Abstract: - - Page Scaling SAX handler implementation. The class derives from the default SAX handler - and implements only the necessary SAX APIs to process the mark-up. The - handler is responsible for copying page mark-up to a writer, removing - the fixed page opening and closing tags. - -Known Issues: - - Need to check if all resources are required resources are being added to the - resource copying class. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "scalesax.h" - -/*++ - -Routine Name: - - CScaleSaxHandler::CScaleSaxHandler - -Routine Description: - - CScaleSaxHandler class constructor - -Arguments: - - pWriter - Pointer to the output stream interface for the XPS page markup. - pPageScaling - Pointer to the Page Scaling Interface. - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CScaleSaxHandler::CScaleSaxHandler( - _In_ ISequentialStream* pWriter, - _In_ CPageScaling* pPageScaling - ) : - m_pWriter(pWriter), - m_pPageScaling(pPageScaling), - m_bOpenTag(FALSE) -{ - ASSERTMSG(m_pWriter != NULL, "NULL writer passed to page scaling SAX handler.\n"); - ASSERTMSG(m_pPageScaling != NULL, "NULL page scaling class passed to page scaling SAX handler.\n"); - - HRESULT hr = S_OK; - if (FAILED(hr = CHECK_POINTER(m_pWriter, E_POINTER)) || - FAILED(hr = CHECK_POINTER(m_pPageScaling, E_POINTER))) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CScaleSaxHandler::~CScaleSaxHandler - -Routine Description: - - CScaleSaxHandler class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CScaleSaxHandler::~CScaleSaxHandler() -{ - m_bstrOpenElement.Empty(); -} - -/*++ - -Routine Name: - - CScaleSaxHandler::startElement - -Routine Description: - - Receives notification of the beginning of an XML element in the XPS page. - The page scaling filter parses each element, applies any changes - and writes out the resultant XPS markup. - -Arguments: - - pwchQName - The XML 1.0 qualified name (QName), with prefix, or an empty string - (if QNames are not available). - cchQName - The length of the QName. - pAttributes - The attributes attached to the element. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CScaleSaxHandler::startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ) -{ - HRESULT hr = S_OK; - CStringXDW cstrOut; - - // - // If this is the fixed page we need the width and height retrieved - // - BOOL bIsFixedPage = FALSE; - - try - { - CComBSTR bstrElement(cchQName, pwchQName); - - bIsFixedPage = (bstrElement == L"FixedPage"); - - // - // Check if we need to close an opened tag - // - if (m_bOpenTag) - { - cstrOut.Append(L">\n"); - } - - // - // Store the opened element name so we can handle nested elements - // - m_bstrOpenElement = bstrElement; - } - catch (CXDException& e) - { - hr = e; - } - - if (SUCCEEDED(hr)) - { - // - // Write out element - // - try - { - cstrOut.Append(L"<"); - cstrOut.Append(m_bstrOpenElement); - } - catch (CXDException& e) - { - hr = e; - } - - // - // We opened a tag - // - m_bOpenTag = TRUE; - - REAL widthPage(0.0f); - REAL heightPage(0.0f); - RectF bleedBox(0.0f, 0.0f, 0.0f, 0.0f); - RectF contentBox(0.0f, 0.0f, 0.0f, 0.0f); - - BOOL bBleedBoxSet = FALSE; - BOOL bContentBoxSet = FALSE; - - // - // Find the number of attributes and enumerate over all of them - // - INT cAttributes = 0; - if (SUCCEEDED(hr) && - SUCCEEDED(hr = pAttributes->getLength(&cAttributes))) - { - for (INT cIndex = 0; cIndex < cAttributes && SUCCEEDED(hr); cIndex++) - { - PCWSTR pszAttUri = NULL; - INT cchAttUri = 0; - PCWSTR pszAttName = NULL; - INT cchAttName = 0; - PCWSTR pszAttQName = NULL; - INT cchAttQName = 0; - PCWSTR pszAttValue = NULL; - INT cchAttValue = 0; - - // - // Get the attribute data ready to write out - // - if (SUCCEEDED(hr = pAttributes->getName(cIndex, - &pszAttUri, - &cchAttUri, - &pszAttName, - &cchAttName, - &pszAttQName, - &cchAttQName))) - { - if (SUCCEEDED(pAttributes->getValue(cIndex, &pszAttValue, &cchAttValue))) - { - try - { - CComBSTR bstrAttName(cchAttQName, pszAttQName); - CComBSTR bstrAttValue(cchAttValue, pszAttValue); - - // - // If this is the fixed page we want to retrieve the - // dimensions of the fixed page - take the opportunity - // to do so now while we parse the attributes - // - if (bIsFixedPage) - { - if (bstrAttName == L"Width") - { - widthPage = static_cast(_wtof(bstrAttValue)); - } - else if (bstrAttName == L"Height") - { - heightPage = static_cast(_wtof(bstrAttValue)); - } - else if (bstrAttName == L"ContentBox") - { - CStringXDW str( bstrAttValue ); - CStringXDW resToken; - INT curPos= 0; - bContentBoxSet = TRUE; - - resToken = str.Tokenize(L",",curPos); - - if (resToken != L"") - { - contentBox.X = static_cast(_wtof(resToken)); - } - - resToken = str.Tokenize(L",",curPos); - - if (resToken != L"") - { - contentBox.Y = static_cast(_wtof(resToken)); - } - - resToken = str.Tokenize(L",",curPos); - - if (resToken != L"") - { - contentBox.Width = static_cast(_wtof(resToken)); - } - - resToken = str.Tokenize(L",",curPos); - - if (resToken != L"") - { - contentBox.Height = static_cast(_wtof(resToken)); - } - } - else if (bstrAttName == L"BleedBox") - { - CStringXDW str( bstrAttValue ); - CStringXDW resToken; - INT curPos= 0; - bBleedBoxSet = TRUE; - - resToken = str.Tokenize(L",",curPos); - - if (resToken != "") - { - bleedBox.X = static_cast(_wtof(resToken)); - } - - resToken = str.Tokenize(L",",curPos); - - if (resToken != "") - { - bleedBox.Y = static_cast(_wtof(resToken)); - } - - resToken = str.Tokenize(L",",curPos); - - if (resToken != "") - { - bleedBox.Width = static_cast(_wtof(resToken)); - } - - resToken = str.Tokenize(L",",curPos); - - if (resToken != "") - { - bleedBox.Height = static_cast(_wtof(resToken)); - } - } - } - - // - // As we are applying scaling we need to remove the bleedBox and contentBox - // - if (bstrAttName != L"BleedBox" && - bstrAttName != L"ContentBox") - { - // - // Replace the Width and Height aValues with the target papersize - // - if (bstrAttName == L"Width") - { - CComBSTR bstrWidthValue; - if (SUCCEEDED(hr = m_pPageScaling->GetFixedPageWidth(&bstrWidthValue))) - { - if (bstrWidthValue.Length() > 0) - { - bstrAttValue = bstrWidthValue; - } - } - } - else if (bstrAttName == L"Height") - { - CComBSTR bstrHeightValue; - if (SUCCEEDED(hr = m_pPageScaling->GetFixedPageHeight(&bstrHeightValue))) - { - if (bstrHeightValue.Length() > 0) - { - bstrAttValue = bstrHeightValue; - } - } - } - - if (SUCCEEDED(hr)) - { - // - // Delimit attributes with a space - // - cstrOut.Append(L" "); - - // - // Reconstruct the attribute and write back to - // the fixed page - // - cstrOut.Append(bstrAttName); - cstrOut.Append(L"=\""); - - // - // If this is a UnicodeString we may need to escape entities - // - if (bstrAttName == L"UnicodeString") - { - hr = EscapeEntity(&bstrAttValue); - } - - cstrOut.Append(bstrAttValue); - cstrOut.Append(L"\""); - } - } - } - catch (CXDException& e) - { - hr = e; - } - } - } - } - } - - // - // If bleedbox hasn't been set, set it to the page dimensions - // - if (bBleedBoxSet == FALSE) - { - bleedBox.Width = widthPage; - bleedBox.Height = heightPage; - } - - // - // If contentbox hasn't been set, set it to the page dimensions - // - if (bContentBoxSet == FALSE) - { - contentBox.Width = widthPage; - contentBox.Height = heightPage; - } - - if (SUCCEEDED(hr = m_pPageScaling->SetPageDimensions(widthPage, heightPage)) && - SUCCEEDED(hr = m_pPageScaling->SetBleedBox(&bleedBox)) && - SUCCEEDED(hr = m_pPageScaling->SetContentBox(&contentBox))) - { - if (bIsFixedPage) - { - try - { - // - // Close the fixed page tag - // - cstrOut.Append(L">"); - - // - // Create and retrieve the markup for the Canvas - // - CComBSTR bstrCanvasText; - if (SUCCEEDED(hr = m_pPageScaling->GetOpenTagXML(&bstrCanvasText))) - { - // - // Insert the mark-up by writing after the opening fixed page - // remembering to close the tag first - // - cstrOut.Append(bstrCanvasText); - } - } - catch (CXDException& e) - { - hr = e; - } - } - } - - if (SUCCEEDED(hr)) - { - hr = WriteToPrintStream(&cstrOut, m_pWriter); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CScaleSaxHandler::endElement - -Routine Description: - - Receives notification of the end of an XML element in the XPS page. - The page scaling filter parses each element, applies any changes - and writes out the resultant XPS markup. - - A corresponding startElement method is invoked for every endElement method, even when the element is empty. - -Arguments: - - pwchQName - The XML 1.0 qualified name (QName), with prefix, or an empty string - (if QNames are not available). - cchQName - The length of the QName. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CScaleSaxHandler::endElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName - ) -{ - HRESULT hr = S_OK; - CStringXDW cstrClose; - BOOL bIsFixedPage = FALSE; - - try - { - CComBSTR bstrElement(cchQName, pwchQName); - - bIsFixedPage = (bstrElement == L"FixedPage"); - - // - // If this is a root element with child nodes, the open - // element will not match the last startElement. In this case - // we need to add an appropriate closing tag - // - if (bstrElement == m_bstrOpenElement) - { - // - // Names match so just add a closing bracket - // - if (m_bOpenTag) - { - cstrClose.Append(L"/>\n"); - } - } - else - { - // - // Close Canvas if previously opened. - // - if (bIsFixedPage) - { - // - // Insert the closing canvas mark-up before closing the fixed page - // - CComBSTR bstrCloseCanvasText; - if (SUCCEEDED(hr = m_pPageScaling->GetCloseTagXML(&bstrCloseCanvasText))) - { - cstrClose.Append(bstrCloseCanvasText); - } - } - - // - // Add a full closing tag - // - cstrClose.Append(L"\n"); - } - - m_bOpenTag = FALSE; - } - catch (CXDException& e) - { - hr = e; - } - - if (SUCCEEDED(hr)) - { - hr = WriteToPrintStream(&cstrClose, m_pWriter); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CScaleSaxHandler::startDocument - -Routine Description: - - This method writes out the header markup for the XPS page. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CScaleSaxHandler::startDocument() -{ - HRESULT hr = S_OK; - - try - { - CStringXDW cstrXMLVersion(L""); - hr = WriteToPrintStream(&cstrXMLVersion, m_pWriter); - } - catch (CXDException& e) - { - hr = e; - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/scaling/scalesax.h b/print/XPSDrvSmpl/src/filters/scaling/scalesax.h deleted file mode 100644 index 2e10e971..00000000 --- a/print/XPSDrvSmpl/src/filters/scaling/scalesax.h +++ /dev/null @@ -1,75 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - scalesax.h - -Abstract: - - Page Scaling SAX handler definition. The class derives from the default SAX handler - and implements only the necessary SAX APIs to process the mark-up. The - handler is responsible for copying page mark-up to a writer, removing - the fixed page opening and closing tags. - ---*/ - -#pragma once - -#include "saxhndlr.h" -#include "pagescale.h" - -class CScaleSaxHandler : public CSaxHandler -{ -public: - CScaleSaxHandler( - _In_ ISequentialStream* pWriter, - _In_ CPageScaling* pPageScaling - ); - - virtual ~CScaleSaxHandler(); - - virtual HRESULT STDMETHODCALLTYPE - startDocument( - void - ); - - virtual HRESULT STDMETHODCALLTYPE - startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ); - - virtual HRESULT STDMETHODCALLTYPE - endElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName - ); - -private: - CComPtr m_pWriter; - - CComBSTR m_bstrOpenElement; - - BOOL m_bOpenTag; - - CPageScaling* m_pPageScaling; -}; - diff --git a/print/XPSDrvSmpl/src/filters/scaling/xdscale.def b/print/XPSDrvSmpl/src/filters/scaling/xdscale.def deleted file mode 100644 index 82d0a024..00000000 --- a/print/XPSDrvSmpl/src/filters/scaling/xdscale.def +++ /dev/null @@ -1,26 +0,0 @@ -; -; Copyright (c) 2005 Microsoft Corporation -; -; All rights reserved. -; -; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -; ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -; PARTICULAR PURPOSE. -; -; File Name: -; -; xdscale.def -; -; Abstract: -; -; Page Scaling filter module definition file -; - -LIBRARY XDScale - -EXPORTS - DllMain - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - diff --git a/print/XPSDrvSmpl/src/filters/scaling/xdscale.vcxproj b/print/XPSDrvSmpl/src/filters/scaling/xdscale.vcxproj deleted file mode 100644 index a2a09897..00000000 --- a/print/XPSDrvSmpl/src/filters/scaling/xdscale.vcxproj +++ /dev/null @@ -1,578 +0,0 @@ - - - - - Debug - ARM - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {1893FA97-40A9-480F-BB77-279F959EAE6E} - $(MSBuildProjectName) - false - true - Debug - Win32 - {79E3B808-CF1F-48F7-B76D-97BFFFEFF2D5} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - xdscale - - - xdscale - - - xdscale - - - xdscale - - - xdscale - - - xdscale - - - xdscale - - - xdscale - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);.\..\xdcont\$(IntDir)\xdcont.lib - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);.\..\xdcont\$(IntDir)\xdcont.lib - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);.\..\xdcont\$(IntDir)\xdcont.lib - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);.\..\xdcont\$(IntDir)\xdcont.lib - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);.\..\xdcont\$(IntDir)\xdcont.lib - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);.\..\xdcont\$(IntDir)\xdcont.lib - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);.\..\xdcont\$(IntDir)\xdcont.lib - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\xdcont - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);.\..\xdcont\$(IntDir)\xdcont.lib - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - - - - xdscale.def - - - - - xdscale.def - - - - - xdscale.def - - - - - xdscale.def - - - - - xdscale.def - - - - - xdscale.def - - - - - xdscale.def - - - - - xdscale.def - - - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/scaling/xdscale.vcxproj.Filters b/print/XPSDrvSmpl/src/filters/scaling/xdscale.vcxproj.Filters deleted file mode 100644 index a280f042..00000000 --- a/print/XPSDrvSmpl/src/filters/scaling/xdscale.vcxproj.Filters +++ /dev/null @@ -1,79 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {B7C68E16-EA47-4D1B-8022-13F7CB1ED129} - - - h;hpp;hxx;hm;inl;inc;xsd - {406C7911-614E-48F2-A001-163ED9285D10} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {C852B60D-E874-41E7-B59F-2FBA134E0B5B} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - - - Header Files - - - - - - Header Files - - - - - - Header Files - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/watermark/Raster1.png b/print/XPSDrvSmpl/src/filters/watermark/Raster1.png deleted file mode 100644 index 4c11e3c0..00000000 Binary files a/print/XPSDrvSmpl/src/filters/watermark/Raster1.png and /dev/null differ diff --git a/print/XPSDrvSmpl/src/filters/watermark/Vector1.xps b/print/XPSDrvSmpl/src/filters/watermark/Vector1.xps deleted file mode 100644 index 8227a215..00000000 Binary files a/print/XPSDrvSmpl/src/filters/watermark/Vector1.xps and /dev/null differ diff --git a/print/XPSDrvSmpl/src/filters/watermark/dllentry.cpp b/print/XPSDrvSmpl/src/filters/watermark/dllentry.cpp deleted file mode 100644 index dc4f7974..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/dllentry.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - dllentry.cpp - -Abstract: - - Implementation of the watermark filter dllentry points. Dllmain only - stores the instance handle. DllGetClassObject calls on to a generic - get class factory template function. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "clasfact.h" -#include "wmflt.h" -#include "xdexcept.h" - -/*++ - -Routine Name: - - DllMain - -Routine Description: - - Entry point to the watermark filter which is called when a new process is started - -Arguments: - - hInst - Handle to the DLL - wReason - Specifies a flag indicating why the DLL entry-point function is being called - -Return Value: - - TRUE - ---*/ -BOOL WINAPI -DllMain( - _In_ HINSTANCE hInst, - _In_ WORD wReason, - _In_opt_ LPVOID - ) -{ - switch (wReason) - { - case DLL_PROCESS_ATTACH: - { - g_hInstance = hInst; - } - break; - } - - return TRUE; -} - -/*++ - -Routine Name: - - DllCanUnloadNow - -Routine Description: - - Method which reports whether the DLL is in use to allow the caller to unload - the DLL safely - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - Dll can unload - S_FALSE - Dll can't unload - ---*/ -STDAPI -DllCanUnloadNow() -{ - if (g_cServerLocks == 0) - { - return S_OK ; - } - else - { - return S_FALSE; - } -} - -/*++ - -Routine Name: - - DllGetClassObject - -Routine Description: - - Method to return the current class object - -Arguments: - - rclsid - CLSID that will associate the correct data and code - riid - Reference to the identifier of the interface that the caller is to use to communicate with the class object - ppv - Address of pointer variable that receives the interface pointer requested in riid - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - CLASS_E_CLASSNOTAVAILABLE - On unsupported class - ---*/ -STDAPI -DllGetClassObject( - _In_ REFCLSID rclsid, - _In_ REFIID riid, - _Outptr_ LPVOID FAR* ppv - ) -{ - // - // B8B525BF-F147-460a-B2D5-9DFB1F30D0FD - // - CLSID watermarkCLSID = {0xB8B525BF, 0xF147, 0x460a, {0xB2, 0xD5, 0x9D, 0xFB, 0x1F, 0x30, 0xD0, 0xFD}}; - - return GetFilterClassFactory(rclsid, riid, watermarkCLSID, ppv); -} - diff --git a/print/XPSDrvSmpl/src/filters/watermark/precompsrc.cpp b/print/XPSDrvSmpl/src/filters/watermark/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmbase.cpp b/print/XPSDrvSmpl/src/filters/watermark/wmbase.cpp deleted file mode 100644 index 97d15b3e..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmbase.cpp +++ /dev/null @@ -1,416 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmbase.cpp - -Abstract: - - Base watermark class implementation. The base watermark class provides - common functionality required between different watermarks (Text, RasterGraphic - and VectorGraphic. This includes methods for converting a GDI matrix object - into the appropriate XPS matrix mark-up and intialising the matrix according to - the watermark options. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "wmbase.h" - -using XDPrintSchema::PageWatermark::Layering::ELayeringOption; -using XDPrintSchema::PageWatermark::Layering::Overlay; -using XDPrintSchema::PageWatermark::Layering::Underlay; - -/*++ - -Routine Name: - - CWatermark::CWatermark - -Routine Description: - - Constructor for the base watermark class - -Arguments: - - wmProps - Watermark PrintTicket properties class - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CWatermark::CWatermark( - _In_ CONST CWMPTProperties& wmProps - ) : - m_pDOMDoc(NULL), - m_WMProps(wmProps) -{ - // - // Create the DOM document so that sub-classes have access ASAP - // - HRESULT hr = m_pDOMDoc.CoCreateInstance(CLSID_DOMDocument60); - - if (FAILED(hr)) - { - ERR("Failed to create watermark DOM document.\n"); - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CWatermark::~CWatermark - -Routine Description: - - Default destructor for the watermarks base class - -Arguments: - - None - -Return Value: - - None - ---*/ -CWatermark::~CWatermark() -{ -} - -/*++ - -Routine Name: - - CWatermark::MatrixToXML - -Routine Description: - - Method to create XML markup representing the - supplied transformation matrix - -Arguments: - - pMatrix - Pointer to the transformation matrix to convert to XML - pbstrMatrixXForm - Pointer to the string which will containg the matrix markup - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermark::MatrixToXML( - _In_ CONST Matrix* pMatrix, - _Outptr_ BSTR* pbstrMatrixXForm - ) -{ - // - // Construct the matric mark-up from a GDI+ matrix - // - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrMatrixXForm, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pMatrix, E_POINTER))) - { - REAL matElems[6]; - if (Ok == pMatrix->GetElements(matElems)) - { - try - { - CStringXDW cstrMatrix; - cstrMatrix.Format(L"%.2f,%.2f,%.2f,%.2f,%.2f,%.2f", - matElems[0], - matElems[1], - matElems[2], - matElems[3], - matElems[4], - matElems[5]); - - *pbstrMatrixXForm = cstrMatrix.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - else - { - *pbstrMatrixXForm = NULL; - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermark::GetXML - -Routine Description: - - Method to get the XML containing the watermark text - -Arguments: - - pbstrXML - Pointer to the string to hold the watermark XML text - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermark::GetXML( - _Outptr_ BSTR* pbstrXML - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrXML, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pWMElem, E_PENDING))) - { - hr = m_pWMElem->get_xml(pbstrXML); - - if (SUCCEEDED(hr)) - { - _Analysis_assume_nullterminated_(*pbstrXML); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermark::CreateWMTransform - -Routine Description: - - Method to create a transformation matrix which will scale, translate and rotate - the watermark to correctly fit onto the page. This overload perform scaling to fit - the watermark content to the requested bounds and is used when creating the bitmap - or vector watermark. - -Arguments: - - wmBounds - Rectangular area to contain the watermark - pbstrMatrixXForm - Pointer to the string to contain the watermark transformation matrix - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermark::CreateWMTransform( - _In_ RectF wmBounds, - _Outptr_ BSTR* pbstrMatrixXForm - ) -{ - ASSERTMSG(wmBounds.Width > 0, "Zero width watermark found whilst creating transform\n"); - ASSERTMSG(wmBounds.Height > 0, "Zero height watermark found whilst creating transform\n"); - - HRESULT hr = S_OK; - - if (wmBounds.Width <= 0 || wmBounds.Height <= 0) - { - hr = E_INVALIDARG; - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(pbstrMatrixXForm, E_POINTER))) - { - *pbstrMatrixXForm = NULL; - - RectF targetBounds; - REAL angle = 0; - - if (SUCCEEDED(hr = m_WMProps.GetBounds(&targetBounds)) && - SUCCEEDED(hr = m_WMProps.GetAngle(&angle))) - { - ASSERTMSG(targetBounds.Width > 0, "Zero width target found whilst creating transform\n"); - ASSERTMSG(targetBounds.Height > 0, "Zero height target found whilst creating transform\n"); - - // - // Start with the identity matrix - // - Matrix xForm; - - // - // Offset to the target bounds - // - PointF offset(targetBounds.X - wmBounds.X, targetBounds.Y - wmBounds.Y); - - // - // Apply the transforms to the matrix - // - xForm.Scale(targetBounds.Width/wmBounds.Width, targetBounds.Height/wmBounds.Height, MatrixOrderAppend); - xForm.Rotate(angle, MatrixOrderAppend); - xForm.Translate(offset.X, offset.Y, MatrixOrderAppend); - - // - // Retrieve the matrix string - // - hr = MatrixToXML(&xForm, pbstrMatrixXForm); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermark::CreateWMTransform - -Routine Description: - - Method to create a transformation matrix which will translate and rotate. This overload - does not perform any scaling to fit the watermark content and is used when creating the - text watermark. - -Arguments: - - wmOrigin - Point defining the watermark origin - pbstrMatrixXForm - Pointer to the string to contain the watermark transformation matrix - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermark::CreateWMTransform( - _In_ PointF wmOrigin, - _Outptr_ BSTR* pbstrMatrixXForm - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrMatrixXForm, E_POINTER))) - { - *pbstrMatrixXForm = NULL; - REAL angle = 0; - - if (SUCCEEDED(hr = m_WMProps.GetAngle(&angle))) - { - // - // Start with the identity matrix - // - Matrix xForm; - - // - // Apply the transforms to the matrix - // - xForm.Rotate(angle, MatrixOrderAppend); - xForm.Translate(wmOrigin.X, wmOrigin.Y, MatrixOrderAppend); - - // - // Retrieve the matrix string - // - hr = MatrixToXML(&xForm, pbstrMatrixXForm); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermark::InsertStart - -Routine Description: - - Method to check whether the watermark should be inserted at the start of the - page to create an underlay effect - -Arguments: - - None - -Return Value: - - BOOL - TRUE - The watermark mark-up needs to be inserted at the start of the fixed page - FALSE - The watermark mark-up needs to be inserted at the end of the fixed page - ---*/ -BOOL -CWatermark::InsertStart( - VOID - ) -{ - ELayeringOption wmLayering = Overlay; - - m_WMProps.GetLayering(&wmLayering); - - return wmLayering == Underlay; -} - -/*++ - -Routine Name: - - CWatermark::InsertEnd - -Routine Description: - - Method to check whether the watermark should be inserted at the - end of the page to create an overlay effect - -Arguments: - - None - -Return Value: - - BOOL - TRUE - The watermark mark-up needs to be inserted at the end of the fixed page - FALSE - The watermark mark-up needs to be inserted at the start of the fixed page - ---*/ -BOOL -CWatermark::InsertEnd( - VOID - ) -{ - return !InsertStart(); -} - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmbase.h b/print/XPSDrvSmpl/src/filters/watermark/wmbase.h deleted file mode 100644 index 9638425e..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmbase.h +++ /dev/null @@ -1,95 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmbase.h - -Abstract: - - Base watermark class implementation. The base watermark class provides - common functionality required between different watermarks (Text, RasterGraphic - and VectorGraphic. This includes methods for converting a GDI matrix object - into the appropriate XPS matrix mark-up and intialising the matrix according to - the watermark options. - ---*/ - -#pragma once - -#include "rescache.h" -#include "wmptprop.h" - -class CWatermark -{ -public: - CWatermark( - _In_ CONST CWMPTProperties& wmProps - ); - - virtual ~CWatermark(); - - virtual HRESULT - CreateXMLElement( - VOID - ) = 0; - - virtual HRESULT - AddParts( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ CFileResourceCache* pResCache - - ) = 0; - - virtual HRESULT - GetXML( - _Outptr_ BSTR* pbstrXML - ); - - virtual BOOL - InsertStart( - VOID - ); - - virtual BOOL - InsertEnd( - VOID - ); - -protected: - HRESULT - CreateWMTransform( - _In_ RectF wmBounds, - _Outptr_ BSTR* pbstrMatrixXForm - ); - - HRESULT - CreateWMTransform( - _In_ PointF wmOrigin, - _Outptr_ BSTR* pbstrMatrixXForm - ); - -private: - HRESULT - MatrixToXML( - _In_ CONST Matrix* pMatrix, - _Outptr_ BSTR* pbstrMatrixXForm - ); - -protected: - CComPtr m_pDOMDoc; - - CComPtr m_pWMElem; - - CWMPTProperties m_WMProps; -}; - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmflt.cpp b/print/XPSDrvSmpl/src/filters/watermark/wmflt.cpp deleted file mode 100644 index 13e171d4..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmflt.cpp +++ /dev/null @@ -1,340 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmflt.cpp - -Abstract: - - Watermark filter implementation. This class derives from the Xps filter - class and implements the necessary part handlers to support Watermark - printing. The Watermark filter is responsible for adding resources to - the XPS document and putting the appropriate mark-up onto pages with a - watermark. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "wmflt.h" -#include "wmtext.h" -#include "wmrast.h" -#include "wmvect.h" -#include "wmsax.h" -#include "wmpthndlr.h" -#include "wmres.h" - -using XDPrintSchema::PageWatermark::WatermarkData; -using XDPrintSchema::PageWatermark::EWatermarkOption; -using XDPrintSchema::PageWatermark::TextWatermark; -using XDPrintSchema::PageWatermark::BitmapWatermark; -using XDPrintSchema::PageWatermark::VectorWatermark; - -/*++ - -Routine Name: - - CWatermarkFilter::CWatermarkFilter - -Routine Description: - - Default constructor for the watermark filter which ensures GDI plus is correctly running - -Arguments: - - None - -Return Value: - - None - ---*/ -CWatermarkFilter::CWatermarkFilter() -{ - ASSERTMSG(m_gdiPlus.GetGDIPlusStartStatus() == Ok, "GDI plus is not correctly initialized.\n"); -} - -/*++ - -Routine Name: - - CWatermarkFilter::~CWatermarkFilter - -Routine Description: - - Default destructor for the watermark filter - -Arguments: - - None - -Return Value: - - None - ---*/ -CWatermarkFilter::~CWatermarkFilter() -{ -} - -/*++ - -Routine Name: - - CWatermarkFilter::ProcessPart - -Routine Description: - - Method for processing each fixed page part in a container - -Arguments: - - pFP - Pointer to the fixed page to process - -Return Value: - - HRESULT - S_OK - On success - S_FALSE - When not enabled in the PT - E_* - On error - ---*/ -HRESULT -CWatermarkFilter::ProcessPart( - _Inout_ IFixedPage* pFP - ) -{ - VERBOSE("Processing Fixed Page part with watermark handler\n"); - - HRESULT hr = S_OK; - CWatermark* pWatermark = NULL; - - if (SUCCEEDED(hr = CHECK_POINTER(pFP, E_POINTER))) - { - // - // Retrieve the watermark settings from the PrintTicket - // - IXMLDOMDocument2* pPT = NULL; - if (SUCCEEDED(hr = m_ptManager.SetTicket(pFP)) && - SUCCEEDED(hr = m_ptManager.GetTicket(kPTPageScope, &pPT)) && - SUCCEEDED(hr = GetWatermark(pPT, &pWatermark)) && - SUCCEEDED(hr = CHECK_POINTER(pWatermark, E_FAIL))) - { - // - // Add the resource part - // - if (SUCCEEDED(hr = pWatermark->AddParts(m_pXDWriter, pFP, &m_resCache))) - { - // - // Retrieve the writer from the fixed page - // - CComPtr pWriter(NULL); - - if (SUCCEEDED(hr = pFP->GetWriteStream(&pWriter))) - { - // - // Set-up the SAX reader and begin parsing the mark-up - // - CComPtr pSaxRdr(NULL); - CComPtr pReader(NULL); - - try - { - CWMSaxHandler wmSaxHndlr(pWriter, pWatermark); - - if (SUCCEEDED(hr = pSaxRdr.CoCreateInstance(CLSID_SAXXMLReader60)) && - SUCCEEDED(hr = pSaxRdr->putContentHandler(&wmSaxHndlr)) && - SUCCEEDED(hr = pFP->GetStream(&pReader))) - { - CComPtr pReadStreamToSeq(NULL); - - pReadStreamToSeq.Attach(new(std::nothrow) pfp::PrintReadStreamToSeqStream(pReader)); - - if (SUCCEEDED(hr = CHECK_POINTER(pReadStreamToSeq, E_OUTOFMEMORY))) - { - hr = pSaxRdr->parse(CComVariant(static_cast(pReadStreamToSeq))); - } - } - } - catch (CXDException& e) - { - hr = e; - } - - pWriter->Close(); - } - } - else if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) - { - // - // Could not find resource file - fail gracefully so we continue - // to process the document - // - ERR("Specified resource file does not exist\n"); - hr = S_FALSE; - } - else if (hr == HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED)) - { - // - // Insufficient rights to open file - fail gracefully so we continue - // to process the document - // - ERR("Insufficient rights to open resource file\n"); - hr = S_FALSE; - } - else if (hr == HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED)) - { - // - // We do not support this URI as a resource - fail gracefully so we continue - // to process the document - // - ERR("Unsupported URI to resource resource\n"); - hr = S_FALSE; - } - } - else if (hr == E_ELEMENT_NOT_FOUND) - { - // - // No watermark was found in the PrintTicket - do not propogate this error - // - hr = S_FALSE; - } - } - - // - // Clean up the watermark if it was successfully created - // - if (pWatermark != NULL) - { - delete pWatermark; - pWatermark = NULL; - } - - if (SUCCEEDED(hr)) - { - // - // We can send the fixed page - // - hr = m_pXDWriter->SendFixedPage(pFP); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkFilter::GetWatermark - -Routine Description: - - Method for obtaining the watermark PrintTicket preferences - -Arguments: - - pPrintTicket - DOM document containing the PrintTicket - ppWatermark - Pointer to object which will contain the values - read from the PrintTicket - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - When feature not present in the PT - E_* - On error - ---*/ -HRESULT -CWatermarkFilter::GetWatermark( - _In_ IXMLDOMDocument2* pPrintTicket, - _Outptr_result_maybenull_ CWatermark** ppWatermark - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppWatermark, E_POINTER))) - { - *ppWatermark = NULL; - - try - { - - CWMPTHandler wmPTHandler(pPrintTicket); - WatermarkData wmData; - - if (SUCCEEDED(hr = wmPTHandler.GetData(&wmData))) - { - CWMPTProperties wmProperties(wmData); - - EWatermarkOption wmOption; - - if (SUCCEEDED(hr = wmProperties.GetType(&wmOption))) - { - switch (wmOption) - { - case TextWatermark: - { - *ppWatermark = new(std::nothrow) CTextWatermark(wmProperties); - - if (*ppWatermark == NULL) - { - hr = E_OUTOFMEMORY; - } - } - break; - - case BitmapWatermark: - { - *ppWatermark = new(std::nothrow) CRasterWatermark(wmProperties, IDR_WM_PNG1); - - if (*ppWatermark == NULL) - { - hr = E_OUTOFMEMORY; - } - } - break; - - case VectorWatermark: - { - *ppWatermark = new(std::nothrow) CVectorWatermark(wmProperties, IDR_WM_XPS1); - - if (*ppWatermark == NULL) - { - hr = E_OUTOFMEMORY; - } - } - break; - - default: - { - hr = E_ELEMENT_NOT_FOUND; - } - break; - } - } - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmflt.h b/print/XPSDrvSmpl/src/filters/watermark/wmflt.h deleted file mode 100644 index 8fa42ca1..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmflt.h +++ /dev/null @@ -1,54 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmflt.h - -Abstract: - - Watermark filter defnition. This class derives from the Xps filter - class and implements the necessary part handlers to support Watermark - printing. The Watermark filter is responsible for adding resources to - the XPS document and putting the appropriate mark-up onto pages with a - watermark - ---*/ - -#pragma once - -#include "xdrchflt.h" -#include "wmbase.h" -#include "gdip.h" - -class CWatermarkFilter : public CXDXpsFilter -{ -public: - CWatermarkFilter(); - - virtual ~CWatermarkFilter(); - -private: - virtual HRESULT - ProcessPart( - _Inout_ IFixedPage* pFP - ); - - HRESULT - GetWatermark( - _In_ IXMLDOMDocument2* pPrintTicket, - _Outptr_result_maybenull_ CWatermark** ppWatermark - ); - -private: - GDIPlus m_gdiPlus; -}; - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmflt.rc b/print/XPSDrvSmpl/src/filters/watermark/wmflt.rc deleted file mode 100644 index 06f5485c..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmflt.rc +++ /dev/null @@ -1,54 +0,0 @@ -// -// Copyright (c) 2005 Microsoft Corporation -// -// All rights reserved. -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// File Name: -// -// wmflt.rc -// -// Abstract: -// -// Watermark filter resource file. -// -// - -#include -#include - -#include "wmres.h" - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT2_UNKNOWN -#define VER_FILEDESCRIPTION_STR "XPSDrv Sample Watermark Filter" -#define VER_INTERNALNAME_STR "PrintFeatureFilters" - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Watermark Resources -// - -IDR_WM_PNG1 RCDATA "Raster1.png" - -IDR_WM_XPS1 RCDATA "Vector1.xps" - -#endif // English (U.S.) resources - -///////////////////////////////////////////////////////////////////////////// - -#include "common.ver" - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmfont.cpp b/print/XPSDrvSmpl/src/filters/watermark/wmfont.cpp deleted file mode 100644 index 5bb49548..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmfont.cpp +++ /dev/null @@ -1,413 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmfont.cpp - -Abstract: - - Watermark font implementation. The CWatermarkFont class is responsible - for managing the font resource for a text watermark. This implements - the IResWriter interface so that the font can be added to the resource - cache. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "wmfont.h" - -using XDPrintSchema::PageWatermark::EWatermarkOption; -using XDPrintSchema::PageWatermark::TextWatermark; - -/*++ - -Routine Name: - - CWatermarkFont::CWatermarkFont - -Routine Description: - - Constructor for the CWatermarkFont font management class which - sets the member variables to sensible defaults and ensures the - current watermark which uses this font is a text based watermark - -Arguments: - - wmProps - Object containing the PrintTicket settings - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CWatermarkFont::CWatermarkFont( - _In_ CONST CWMPTProperties& wmProps - ) : - m_hDC(CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL)), - m_WMProps(wmProps), - m_hFont(NULL), - m_hOldFont(NULL), - m_bstrFaceName(L"Arial") -{ - HRESULT hr = S_OK; - - ASSERTMSG(m_hDC != NULL, "NULL DC passed.\n"); - - EWatermarkOption wmType; - - if (SUCCEEDED(hr = m_WMProps.GetType(&wmType))) - { - if (wmType == TextWatermark) - { - hr = SetFont(); - } - else - { - hr = E_INVALIDARG; - } - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CWatermarkFont::~CWatermarkFont - -Routine Description: - - Default destructor for the font management class - -Arguments: - - None - -Return Value: - - None - ---*/ -CWatermarkFont::~CWatermarkFont() -{ - UnsetFont(); - - if (SUCCEEDED(CHECK_HANDLE(m_hDC, E_PENDING))) - { - DeleteDC(m_hDC); - } -} - -/*++ - -Routine Name: - - CWatermarkFont::WriteData - -Routine Description: - - Method for writing out the font to the container - -Arguments: - - pStream - Pointer to the stream to write the font out to - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkFont::WriteData( - _In_ IPartBase* pResource, - _In_ IPrintWriteStream* pStream - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pResource, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pStream, E_POINTER))) - { - // - // Find the size of the font data - // - DWORD cbFontData = GetFontData(m_hDC, 0, 0, 0, 0); - - if (cbFontData != GDI_ERROR) - { - PBYTE pFontData = new(std::nothrow) BYTE[cbFontData]; - - if (SUCCEEDED(hr = CHECK_POINTER(pFontData, E_OUTOFMEMORY))) - { - // - // Retrieve the font data - // - if (GDI_ERROR != GetFontData(m_hDC, - 0, - 0, - reinterpret_cast(pFontData), - cbFontData)) - { - // - // SetFontOptions(Font_Obfusticate) sets the appropriate content type - // The pipeline takes care of XORing the font data with the URI GUID - // - CComQIPtr pFont = pResource; - if (SUCCEEDED(hr = CHECK_POINTER(pFont, E_NOINTERFACE)) && - SUCCEEDED(hr = pFont->SetFontOptions(Font_Obfusticate))) - { - // - // Write font data to stream - // - ULONG cbWritten = 0; - hr = pStream->WriteBytes(reinterpret_cast(pFontData), - cbFontData, - &cbWritten); - - ASSERTMSG(cbFontData == cbWritten, "Failed to write all font data.\n"); - } - } - else - { - hr = GetLastErrorAsHResult(); - } - - delete[] pFontData; - pFontData = NULL; - } - } - else - { - hr = GetLastErrorAsHResult(); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkFont::SetFont - -Routine Description: - - Method to select a font into the device context - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkFont::SetFont( - VOID - ) -{ - ASSERTMSG(m_hFont == NULL, "Non NULL font handle when setting new font. Possible resource leak.\n"); - ASSERTMSG(m_hOldFont == NULL, "Non NULL old font handle when setting new font. Possible resource leak.\n"); - - HRESULT hr = S_OK; - - INT fontSize; - - if (SUCCEEDED(hr = m_WMProps.GetFontSize(&fontSize))) - { - LOGFONTW logfont; - - logfont.lfHeight = -MulDiv(fontSize, GetDeviceCaps(m_hDC, LOGPIXELSY), 72); - logfont.lfWidth = 0; - logfont.lfEscapement = 0; - logfont.lfOrientation = 0; - logfont.lfWeight = FW_NORMAL; - logfont.lfItalic = FALSE; - logfont.lfUnderline = FALSE; - logfont.lfStrikeOut = FALSE; - logfont.lfCharSet = ANSI_CHARSET; - logfont.lfOutPrecision = OUT_TT_ONLY_PRECIS; - logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS; - logfont.lfQuality = CLEARTYPE_QUALITY; - logfont.lfPitchAndFamily = FF_DONTCARE; - - size_t cchSrc = 0; - if (SUCCEEDED(hr = StringCchLength(m_bstrFaceName, LF_FACESIZE, &cchSrc)) && - SUCCEEDED(hr = StringCchCopyN(logfont.lfFaceName, LF_FACESIZE, m_bstrFaceName, cchSrc))) - { - if (m_hFont != NULL) - { - UnsetFont(); - } - - m_hFont = CreateFontIndirect(&logfont); - - if (m_hFont != NULL) - { - m_hOldFont = SelectFont(m_hDC, m_hFont); - } - else - { - hr = GetLastErrorAsHResult(); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkFont::UnsetFont - -Routine Description: - - Method de-select a font from the current device context - -Arguments: - - None - -Return Value: - - None - ---*/ -VOID -CWatermarkFont::UnsetFont( - VOID - ) -{ - ASSERTMSG(m_hFont != NULL, "Attempting to deselect invalid font.\n"); - ASSERTMSG(m_hOldFont != NULL, "Attempting to select invalid font.\n"); - - SelectFont(m_hDC, m_hOldFont); - if (m_hFont != NULL) - { - DeleteObject(m_hFont); - m_hFont = NULL; - } -} - -/*++ - -Routine Name: - - CWatermarkFont::GetKeyName - -Routine Description: - - Method to obtain a unique key for the stored font based on the resource name - -Arguments: - - pbstrKeyName - Pointer to the string to contain the generated key name - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkFont::GetKeyName( - _Outptr_ BSTR* pbstrKeyName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrKeyName, E_POINTER))) - { - // - // The name of the resource is a suitable key - // - if (SUCCEEDED(hr = m_bstrFaceName.CopyTo(pbstrKeyName)) && - !*pbstrKeyName) - { - hr = E_OUTOFMEMORY; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkFont::GetResURI - -Routine Description: - - Method to obtain the URI to the stored font - -Arguments: - - pbstrResURI - Pointer to the string to contain the font resource URI - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkFont::GetResURI( - _Outptr_ BSTR* pbstrResURI - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrResURI, E_POINTER))) - { - *pbstrResURI = NULL; - - try - { - // - // Create an obfuscated font name using our font GUID - // - CStringXDW cstrURI(L"Resources/Fonts/78F47176-ADD7-0E49-AB3A-C59F137240AC.odttf"); - *pbstrResURI = cstrURI.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmfont.h b/print/XPSDrvSmpl/src/filters/watermark/wmfont.h deleted file mode 100644 index a7990011..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmfont.h +++ /dev/null @@ -1,82 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmfont.h - -Abstract: - - Watermark font definition. The CWatermarkFont class is responsible - for managing the font resource for a text watermark. This implements - the IResWriter interface so that the font can be added to the resource - cache. - -Known Issues: - - The watermark font does not yet use the Uniscript interface to retrieve glyph - indices. - ---*/ - -#pragma once - -#include "rescache.h" -#include "wmptprop.h" - -class CWatermarkFont : public IResWriter -{ -public: - CWatermarkFont( - _In_ CONST CWMPTProperties& wmProps - ); - - ~CWatermarkFont(); - - HRESULT - WriteData( - _In_ IPartBase* pResource, - _In_ IPrintWriteStream* pStream - ); - - HRESULT - GetKeyName( - _Outptr_ BSTR* pbstrKeyName - ); - - HRESULT - GetResURI( - _Outptr_ BSTR* pbstrResURI - ); - -private: - HRESULT - SetFont( - VOID - ); - - VOID - UnsetFont( - VOID - ); - -private: - HDC m_hDC; - - HFONT m_hFont; - - HFONT m_hOldFont; - - CComBSTR m_bstrFaceName; - - CWMPTProperties m_WMProps; -}; - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmimg.cpp b/print/XPSDrvSmpl/src/filters/watermark/wmimg.cpp deleted file mode 100644 index 38f78f4d..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmimg.cpp +++ /dev/null @@ -1,503 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmimg.cpp - -Abstract: - - Watermark image implementation. The CWatermarkImage class is responsible - for managing the image resource for a raster watermark. This implements - the IResWriter interface so that the font can be added to the resource - cache. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "wmimg.h" - -using XDPrintSchema::PageWatermark::EWatermarkOption; -using XDPrintSchema::PageWatermark::BitmapWatermark; - -/*++ - -Routine Name: - - CWatermarkImage::CWatermarkImage - -Routine Description: - - Constructor for the CWatermarkFont bitmap management class which - sets the member variables to sensible defaults and ensures the - current watermark which uses this bitmap is a bitmap based watermark - -Arguments: - - wmProps - Object containing the PrintTicket settings - resourceID - Resource ID for the watermark -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CWatermarkImage::CWatermarkImage( - _In_ CONST CWMPTProperties& wmProps, - _In_ CONST INT resourceID - ) : - m_WMProps(wmProps), - m_resourceID(resourceID), - m_pPNGData(NULL), - m_pPNGStream(NULL), - m_hPNGRes(NULL), - m_cbPNGData(0) -{ - HRESULT hr = S_OK; - - EWatermarkOption wmType; - - if (SUCCEEDED(hr = m_WMProps.GetType(&wmType))) - { - if (wmType != BitmapWatermark) - { - hr = E_INVALIDARG; - } - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CWatermarkImage::~CWatermarkImage - -Routine Description: - - Default destructor for the font management class - -Arguments: - - None - -Return Value: - - None - ---*/ -CWatermarkImage::~CWatermarkImage() -{ - if (m_hPNGRes != NULL) - { - FreeResource(m_hPNGRes); - m_hPNGRes = NULL; - } -} - -/*++ - -Routine Name: - - CWatermarkImage::GetImageDimensions - -Routine Description: - - Method to obtain the width and height for the watermark bitmap - -Arguments: - - pDimensions - Pointer to a structure which will hold the bitmap dimensions - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkImage::GetImageDimensions( - _Out_ SizeF* pDimensions - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDimensions, E_POINTER)) && - SUCCEEDED(hr = CreatePNGStream())) - { - pDimensions->Width = 0; - pDimensions->Height = 0; - - Bitmap image(m_pPNGStream); - Status gdiPStat = image.GetLastStatus(); - - if (gdiPStat == Ok) - { - pDimensions->Width = (REAL)image.GetWidth(); - pDimensions->Height = (REAL)image.GetHeight(); - - REAL horzRes = image.GetHorizontalResolution(); - REAL vertRes = image.GetVerticalResolution(); - - if (horzRes > 0 && - vertRes > 0) - { - pDimensions->Width *= 96.0f / horzRes; - pDimensions->Height *= 96.0f / vertRes; - } - } - else - { - hr = GetGDIStatusErrorAsHResult(gdiPStat); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkImage::WriteData - -Routine Description: - - Method for writing out the bitmap to the container - -Arguments: - - pStream - Pointer to the stream to write the bitmap out to - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkImage::WriteData( - _In_ IPartBase* pResource, - _In_ IPrintWriteStream* pStream - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pResource, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pStream, E_POINTER))) - { - if (SUCCEEDED(hr = LoadPNGResource())) - { - ULONG cbWritten = 0; - - hr = pStream->WriteBytes(m_pPNGData, m_cbPNGData, &cbWritten); - - ASSERTMSG(m_cbPNGData == cbWritten, "Failed to write all data.\n"); - - // - // Set the content type of the image part - // - CComQIPtr pImage = pResource; - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(pImage, E_NOINTERFACE))) - { - hr = pImage->SetImageContent(CComBSTR(L"image/png")); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkImage::GetKeyName - -Routine Description: - - Method to obtain a unique key for the stored bitmap based on the resource name - -Arguments: - - pbstrKeyName - Pointer to the string to contain the generated key name - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkImage::GetKeyName( - _Outptr_ BSTR* pbstrKeyName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrKeyName, E_POINTER))) - { - try - { - // - // The id of the resource is a suitable key - // - - CStringXDW cstrKeyName; - cstrKeyName.Format(L"%d", m_resourceID); - - *pbstrKeyName = cstrKeyName.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkImage::GetResURI - -Routine Description: - - Method to obtain the URI to the stored bitmap - -Arguments: - - pbstrResURI - Pointer to the string to contain the bitmap resource URI - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkImage::GetResURI( - _Outptr_ BSTR* pbstrResURI - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrResURI, E_POINTER))) - { - *pbstrResURI = NULL; - - try - { - // - // Create a unique name for the watermark bitmap for this print session - // - CStringXDW cstrURI; - cstrURI.Format(L"/WM_%d_%u.png", m_resourceID, GetUniqueNumber()); - - *pbstrResURI = cstrURI.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkImage::CheckResID - -Routine Description: - - Method to check that the bitmap resource exists - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkImage::CheckResID( - VOID - ) -{ - HRESULT hr = S_OK; - - HRSRC hrSrc = FindResourceEx(g_hInstance, - RT_RCDATA, - MAKEINTRESOURCE(m_resourceID), - MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); - - if (hrSrc == NULL) - { - hr = GetLastErrorAsHResult(); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkImage::CreatePNGStream - -Routine Description: - - Method to write out the PNG bitmap to the container - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkImage::CreatePNGStream( - VOID - ) -{ - HRESULT hr = S_OK; - - // - // If a stream hasn't already been created, load the PNG image resource - // and create a new stream - // - if (m_pPNGStream == NULL && - SUCCEEDED(hr = LoadPNGResource()) && - SUCCEEDED(hr = CreateStreamOnHGlobal(NULL, TRUE, &m_pPNGStream))) - { - ULONG cbWritten = 0; - - // - // Write the data to the stream - // - hr = m_pPNGStream->Write(m_pPNGData, m_cbPNGData, &cbWritten); - } - - // - // Make sure the stream is pointing back at the start of the data - // - if (SUCCEEDED(hr)) - { - LARGE_INTEGER cbMoveFromStart = {0}; - - hr = m_pPNGStream->Seek(cbMoveFromStart, STREAM_SEEK_SET, NULL); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkImage::LoadPNGResource - -Routine Description: - - Method to load the PNG bitmap resource - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkImage::LoadPNGResource( - VOID - ) -{ - HRESULT hr = S_OK; - - if (m_pPNGData == NULL) - { - HRSRC hrSrc = FindResourceEx(g_hInstance, - RT_RCDATA, - MAKEINTRESOURCE(m_resourceID), - MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); - if (hrSrc != NULL) - { - // - // Load the resource - // - m_hPNGRes = LoadResource(g_hInstance, hrSrc); - - if (m_hPNGRes != NULL) - { - // - // Retrieve the PNG data and the size of the data - // - m_pPNGData = LockResource(m_hPNGRes); - m_cbPNGData = SizeofResource(g_hInstance, hrSrc); - - if (m_pPNGData == NULL || - m_cbPNGData <= 0) - { - hr = E_FAIL; - } - } - else - { - hr = GetLastErrorAsHResult(); - } - } - else - { - hr = GetLastErrorAsHResult(); - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmimg.h b/print/XPSDrvSmpl/src/filters/watermark/wmimg.h deleted file mode 100644 index f7ab0e8c..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmimg.h +++ /dev/null @@ -1,90 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmimg.h - -Abstract: - - Watermark image definition. The CWatermarkImage class is responsible - for managing the image resource for a raster watermark. This implements - the IResWriter interface so that the font can be added to the resource - cache. - ---*/ - -#pragma once - -#include "rescache.h" -#include "wmptprop.h" - -class CWatermarkImage : public IResWriter -{ -public: - CWatermarkImage( - _In_ CONST CWMPTProperties& wmProps, - _In_ CONST INT resourceID - ); - - ~CWatermarkImage(); - - HRESULT - GetImageDimensions( - _Out_ SizeF* pDimensions - ); - - HRESULT - WriteData( - _In_ IPartBase* pResource, - _In_ IPrintWriteStream* pStream - ); - - HRESULT - GetKeyName( - _Outptr_ BSTR* pbstrKeyName - ); - - HRESULT - GetResURI( - _Outptr_ BSTR* pbstrResURI - ); - - HRESULT - CheckResID( - VOID - ); - -private: - HRESULT - CreatePNGStream( - VOID - ); - - HRESULT - LoadPNGResource( - VOID - ); - -private: - CWMPTProperties m_WMProps; - - INT m_resourceID; - - CComPtr m_pPNGStream; - - PVOID m_pPNGData; - - DWORD m_cbPNGData; - - HGLOBAL m_hPNGRes; -}; - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmptprop.cpp b/print/XPSDrvSmpl/src/filters/watermark/wmptprop.cpp deleted file mode 100644 index c8b102a1..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmptprop.cpp +++ /dev/null @@ -1,683 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmptprop.cpp - -Abstract: - - Watermark properties class implementation. The Watermark properties class - is responsible for holding and controling Watermark properties. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "wmptprop.h" - -using XDPrintSchema::PageWatermark::WatermarkData; -using XDPrintSchema::PageWatermark::EWatermarkOption; -using XDPrintSchema::PageWatermark::NoWatermark; -using XDPrintSchema::PageWatermark::TextWatermark; -using XDPrintSchema::PageWatermark::BitmapWatermark; -using XDPrintSchema::PageWatermark::VectorWatermark; -using XDPrintSchema::PageWatermark::Layering::ELayeringOption; - -/*++ - -Routine Name: - - CWMPTProperties::CWMPTProperties - -Routine Description: - - Constructor for the CWMPTProperties PrintTicket properties class - -Arguments: - - wmData - Structure containing watermark properties read from the PrintTicket - -Return Value: - - None - ---*/ -CWMPTProperties::CWMPTProperties( - _In_ CONST WatermarkData& wmData - ) : - m_wmData(wmData) -{ -} - -/*++ - -Routine Name: - - CWMPTProperties::~CWMPTProperties - -Routine Description: - - Default destructor for the CWMPTProperties class - -Arguments: - - None - -Return Value: - - None - ---*/ -CWMPTProperties::~CWMPTProperties() -{ -} - -/*++ - -Routine Name: - - CWMPTProperties::GetType - -Routine Description: - - Method to obtain the watermark type to identify as vector, text or bitmap - -Arguments: - - pType - Enumerated type to indicate the watermark type - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTProperties::GetType( - _Out_ EWatermarkOption* pType - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pType, E_POINTER))) - { - *pType = m_wmData.type; - - // - // If we are a bitmap or vector watermark and the extents are zero, report no watermark - // - if (m_wmData.type == BitmapWatermark || - m_wmData.type == VectorWatermark) - { - if (m_wmData.widthExtent == 0 || - m_wmData.heightExtent == 0) - { - *pType = NoWatermark; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTProperties::GetLayering - -Routine Description: - - Method to obtain the watermark layering type - -Arguments: - - pLayering - Enumerated type to indicate the watermark layering type - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTProperties::GetLayering( - _Out_ ELayeringOption* pLayering - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pLayering, E_POINTER))) - { - *pLayering = m_wmData.layering; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTProperties::GetBounds - -Routine Description: - - Method to obtain the watermark bounding area - -Arguments: - - pBounds - Variable which is set to the watermark bounding area - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTProperties::GetBounds( - _Out_ RectF* pBounds - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pBounds, E_POINTER))) - { - // - // Convert from microns to 96ths of an inch - // - pBounds->X = static_cast(m_wmData.widthOrigin)/k96thInchAsMicrons; - pBounds->Y = static_cast(m_wmData.heightOrigin)/k96thInchAsMicrons; - pBounds->Width = static_cast(m_wmData.widthExtent)/k96thInchAsMicrons; - pBounds->Height = static_cast(m_wmData.heightExtent)/k96thInchAsMicrons; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTProperties::GetOrigin - -Routine Description: - - Method to obtain the watermark origin - -Arguments: - - pOrigin - Variable which is set to the watermark origin - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTProperties::GetOrigin( - _Out_ PointF* pOrigin - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pOrigin, E_POINTER))) - { - // - // Convert from microns to 96ths of an inch - // - pOrigin->X = static_cast(m_wmData.widthOrigin)/k96thInchAsMicrons; - pOrigin->Y = static_cast(m_wmData.heightOrigin)/k96thInchAsMicrons; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTProperties::GetAngle - -Routine Description: - - Method to obtain the watermark angle - -Arguments: - - pAngle - Variable which is set to the watermark angle - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTProperties::GetAngle( - _Out_ REAL* pAngle - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pAngle, E_POINTER))) - { - *pAngle = static_cast(m_wmData.angle); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTProperties::GetTransparency - -Routine Description: - - Method to obtain the watermark transparency value - -Arguments: - - pTransparency - Variable which is set to the watermark transparency value - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTProperties::GetTransparency( - _Out_ INT* pTransparency - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pTransparency, E_POINTER))) - { - *pTransparency = m_wmData.transparency; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTProperties::GetOpacity - -Routine Description: - - Method to obtain the watermark opacity value - -Arguments: - - pOpacity - Variable which is set to the watermark opacity value - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTProperties::GetOpacity( - _Out_ REAL* pOpacity - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pOpacity, E_POINTER))) - { - *pOpacity = 1.0f - (m_wmData.transparency / 100.0f); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTProperties::GetTransparency - -Routine Description: - - Method to obtain the watermark transparency value as a string - -Arguments: - - pbstrTransparency - String which is set to contain the watermark transparency value - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTProperties::GetTransparency( - _Outptr_ BSTR* pbstrTransparency - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrTransparency, E_POINTER))) - { - *pbstrTransparency = NULL; - INT transparency = 0; - if (SUCCEEDED(hr = GetTransparency(&transparency))) - { - try - { - CStringXDW szTransparency; - szTransparency.Format(L"%i", transparency); - - *pbstrTransparency = szTransparency.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTProperties::GetOpacity - -Routine Description: - - Method to obtain the watermark opacity value as a string - -Arguments: - - pbstrOpacity - String which is set to contain the watermark opacity value - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTProperties::GetOpacity( - _Outptr_ BSTR* pbstrOpacity - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrOpacity, E_POINTER))) - { - *pbstrOpacity = NULL; - REAL opacity = 0; - if (SUCCEEDED(hr = GetOpacity(&opacity))) - { - try - { - CStringXDW szOpacity; - szOpacity.Format(L"%.2f", opacity); - - *pbstrOpacity = szOpacity.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTProperties::GetFontColor - -Routine Description: - - Method to obtain the watermark font color as a string - -Arguments: - - pbstrColor - String which is set to contain the watermark font color. Any BSTR - this points to will be freed. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTProperties::GetFontColor( - _Inout_ _At_(*pbstrColor, _Pre_maybenull_ _Post_valid_) BSTR* pbstrColor - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrColor, E_POINTER))) - { - SysFreeString(*pbstrColor); - *pbstrColor = NULL; - if (m_wmData.type == TextWatermark) - { - if (SUCCEEDED(hr = m_wmData.txtData.bstrFontColor.CopyTo(pbstrColor)) && - !*pbstrColor) - { - hr = E_OUTOFMEMORY; - } - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTProperties::GetText - -Routine Description: - - Method to obtain the watermark text as a string - -Arguments: - - pbstrText - String which is set to contain the watermark text - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTProperties::GetText( - _Inout_ _At_(*pbstrText, _Pre_maybenull_ _Post_valid_) BSTR* pbstrText - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrText, E_POINTER))) - { - SysFreeString(*pbstrText); - *pbstrText = NULL; - if (m_wmData.type == TextWatermark) - { - if (SUCCEEDED(hr = m_wmData.txtData.bstrText.CopyTo(pbstrText)) && - !*pbstrText) - { - hr = E_OUTOFMEMORY; - } - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTProperties::GetFontSize - -Routine Description: - - Method to obtain the watermark font size - -Arguments: - - pSize - Variable which is set to contain the watermark font size - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTProperties::GetFontSize( - _Out_ INT* pSize - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pSize, E_POINTER))) - { - if (m_wmData.type == TextWatermark) - { - *pSize = m_wmData.txtData.fontSize; - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMPTProperties::GetFontEmSize - -Routine Description: - - Method to obtain the watermark font EM size as a string - -Arguments: - - pbstrSize - String which is set to contain the watermark EM font size - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWMPTProperties::GetFontEmSize( - _Outptr_ BSTR* pbstrSize - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrSize, E_POINTER))) - { - *pbstrSize = NULL; - - if (m_wmData.type != TextWatermark) - { - hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); - } - } - - if (SUCCEEDED(hr)) - { - INT size = 0; - - if (SUCCEEDED(hr = GetFontSize(&size))) - { - // - // Convert from 72nds to 96ths of an inch - // - size = MulDiv(size, 96, 72); - - try - { - CStringXDW szFontSize; - szFontSize.Format(L"%d", size); - - *pbstrSize = szFontSize.AllocSysString(); - } - catch (CXDException& e) - { - hr = e; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmptprop.h b/print/XPSDrvSmpl/src/filters/watermark/wmptprop.h deleted file mode 100644 index eec7fed4..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmptprop.h +++ /dev/null @@ -1,103 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmptprop.h - -Abstract: - - Watermark properties class definition. The Watermark properties class - is responsible for holding and controling Watermark properties. - ---*/ - -#pragma once - -#include "wmdata.h" - -class CWMPTProperties -{ -public: - CWMPTProperties( - _In_ CONST XDPrintSchema::PageWatermark::WatermarkData& wmData - ); - - virtual ~CWMPTProperties(); - - HRESULT - GetType( - _Out_ XDPrintSchema::PageWatermark::EWatermarkOption* pType - ); - - HRESULT - GetLayering( - _Out_ XDPrintSchema::PageWatermark::Layering::ELayeringOption* pLayering - ); - - HRESULT - GetBounds( - _Out_ RectF* pBounds - ); - - HRESULT GetOrigin( - _Out_ PointF* pOrigin - ); - - HRESULT - GetAngle( - _Out_ REAL* pAngle - ); - - HRESULT - GetTransparency( - _Out_ INT* pTransparency - ); - - HRESULT - GetOpacity( - _Out_ REAL* pOpacity - ); - - HRESULT - GetTransparency( - _Outptr_ BSTR* pbstrTransparency - ); - - HRESULT - GetOpacity( - _Outptr_ BSTR* pbstrOpacity - ); - - HRESULT - GetFontColor( - _Inout_ _At_(*pbstrColor, _Pre_maybenull_ _Post_valid_) BSTR* pbstrColor - ); - - HRESULT - GetText( - _Inout_ _At_(*pbstrText, _Pre_maybenull_ _Post_valid_) BSTR* pbstrText - ); - - HRESULT - GetFontSize( - _Out_ INT* pSize - ); - - HRESULT - GetFontEmSize( - _Outptr_ BSTR* pbstrSize - ); - -protected: - XDPrintSchema::PageWatermark::WatermarkData m_wmData; -}; - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmrast.cpp b/print/XPSDrvSmpl/src/filters/watermark/wmrast.cpp deleted file mode 100644 index d83a0783..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmrast.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmrast.cpp - -Abstract: - - RasterGraphic watermark class implamentation. CRasterWatermark is the - raster implementation of the CWatermark class. This implements methods - for creating the page mark-up and adding the watermark resource to the - resource cache. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "wmrast.h" -#include "wmptprop.h" - -using XDPrintSchema::PageWatermark::EWatermarkOption; -using XDPrintSchema::PageWatermark::BitmapWatermark; - -/*++ - -Routine Name: - - CRasterWatermark::CRasterWatermark - -Routine Description: - - Constructor for the raster watermark class - -Arguments: - - wmProps - Watermark PrintTicket properties class - resourceID - Resource ID for the watermark - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CRasterWatermark::CRasterWatermark( - _In_ CONST CWMPTProperties& wmProps, - _In_ CONST INT resourceID - ) : - CWatermark(wmProps), - m_wmBMP(wmProps, resourceID) -{ - HRESULT hr = S_OK; - - EWatermarkOption wmType; - - if (SUCCEEDED(hr = m_WMProps.GetType(&wmType))) - { - if (wmType != BitmapWatermark) - { - hr = E_INVALIDARG; - } - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CRasterWatermark::~CRasterWatermark - -Routine Description: - - Default destructor for the watermarks base class - -Arguments: - - None - -Return Value: - - None - ---*/ -CRasterWatermark::~CRasterWatermark() -{ -} - -/*++ - -Routine Name: - - CRasterWatermark::CreateXMLElement - -Routine Description: - - Method to create the XML markup which describes the transform and properties used - to present the watermark correctly on the page - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CRasterWatermark::CreateXMLElement( - VOID - ) -{ - ASSERTMSG(m_pDOMDoc != NULL, "NULL DOM document detected whilst creating text watermark\n"); - ASSERTMSG(m_bstrImageURI.Length() > 0, "Invalid image URI detected whilst creating text watermark\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pDOMDoc, E_PENDING))) - { - if (m_bstrImageURI.Length() == 0) - { - hr = E_PENDING; - } - } - - // - // We need to retrieve the bitmap bounds to calculate - // the correct render transform for the watermark - // - SizeF bmpDims; - CComBSTR bstrWMOpacity; - if (SUCCEEDED(hr) && - SUCCEEDED(hr = m_wmBMP.GetImageDimensions(&bmpDims)) && - SUCCEEDED(hr = m_WMProps.GetOpacity(&bstrWMOpacity))) - { - // - // The markup will look like this (square bracketed values "[]" - // describes content): - // - // - // - // - // - // - // - CComPtr pPathFill(NULL); - CComPtr pImageBrush(NULL); - CComPtr pInsertNode(NULL); - - CStringXDW strPathData; - CStringXDW strViewbox; - CStringXDW strViewport; - - CComBSTR bstrMatrixXForm; - - // - // Create the transform and elements and add attributes - // - try - { - strPathData.Format(L"M 0,0 L 0,%.2f %.2f,%.2f %.2f,0 z", bmpDims.Height, bmpDims.Width, bmpDims.Height, bmpDims.Width); - strViewbox.Format(L"0,0,%.2f,%.2f", bmpDims.Width, bmpDims.Height); - strViewport.Format(L"0,0,%.2f,%.2f", bmpDims.Width, bmpDims.Height); - - if (SUCCEEDED(hr = CreateWMTransform(RectF(0, 0, bmpDims.Width, bmpDims.Height), &bstrMatrixXForm)) && - SUCCEEDED(hr = m_pDOMDoc->createElement(CComBSTR(L"Path"), &m_pWMElem)) && - SUCCEEDED(hr = m_pDOMDoc->createElement(CComBSTR(L"Path.Fill"), &pPathFill)) && - SUCCEEDED(hr = m_pDOMDoc->createElement(CComBSTR(L"ImageBrush"), &pImageBrush)) && - SUCCEEDED(hr = m_pWMElem->setAttribute(CComBSTR(L"RenderTransform"), CComVariant(bstrMatrixXForm))) && - SUCCEEDED(hr = m_pWMElem->setAttribute(CComBSTR(L"Data"), CComVariant(strPathData.GetBuffer()))) && - SUCCEEDED(hr = pImageBrush->setAttribute(CComBSTR(L"ImageSource"), CComVariant(m_bstrImageURI))) && - SUCCEEDED(hr = pImageBrush->setAttribute(CComBSTR(L"Opacity"), CComVariant(bstrWMOpacity))) && - SUCCEEDED(hr = pImageBrush->setAttribute(CComBSTR(L"ViewboxUnits"), CComVariant(L"Absolute"))) && - SUCCEEDED(hr = pImageBrush->setAttribute(CComBSTR(L"Viewbox"), CComVariant(strViewbox.GetBuffer()))) && - SUCCEEDED(hr = pImageBrush->setAttribute(CComBSTR(L"ViewportUnits"), CComVariant(L"Absolute"))) && - SUCCEEDED(hr = pImageBrush->setAttribute(CComBSTR(L"Viewport"), CComVariant(strViewport.GetBuffer()))) && - SUCCEEDED(hr = pPathFill->appendChild(pImageBrush, &pInsertNode)) && - SUCCEEDED(hr = m_pWMElem->appendChild(pPathFill, &pInsertNode))) - { - hr = m_pWMElem->appendChild(pPathFill, &pInsertNode); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CRasterWatermark::AddParts - -Routine Description: - - Method to add the watermark bitmap resource to the cache - -Arguments: - - pXpsConsumer - Pointer to the writer used when writing the resource back out to the pipeline - pFixedPage - Pointer to the fixed page associated with the bitmap - pResCache - Pointer to a resource cache object which manages the writing of the bitmap - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CRasterWatermark::AddParts( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ CFileResourceCache* pResCache - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pXpsConsumer, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pFixedPage, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pResCache, E_POINTER))) - { - // - // Write the font resource to the cache - // - m_bstrImageURI.Empty(); - CComBSTR bstrKey; - if (SUCCEEDED(hr = m_wmBMP.CheckResID()) && - SUCCEEDED(hr = pResCache->WriteResource(pXpsConsumer, pFixedPage, &m_wmBMP)) && - SUCCEEDED(hr = m_wmBMP.GetKeyName(&bstrKey))) - { - hr = pResCache->GetURI(bstrKey, &m_bstrImageURI); - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmrast.h b/print/XPSDrvSmpl/src/filters/watermark/wmrast.h deleted file mode 100644 index 22e17b85..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmrast.h +++ /dev/null @@ -1,58 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmrast.h - -Abstract: - - RasterGraphic watermark class definition. CRasterWatermark is the - raster implementation of the CWatermark class. This implements methods - for creating the page mark-up and adding the watermark resource to the - resource cache. - ---*/ - -#pragma once - -#include "wmbase.h" -#include "wmimg.h" -#include "wmptprop.h" - -class CRasterWatermark : public CWatermark -{ -public: - CRasterWatermark( - _In_ CONST CWMPTProperties& wmProps, - _In_ CONST INT resourceID - ); - - virtual ~CRasterWatermark(); - - virtual HRESULT - CreateXMLElement( - VOID - ); - - virtual HRESULT - AddParts( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ CFileResourceCache* pResCache - ); - -private: - CComBSTR m_bstrImageURI; - - CWatermarkImage m_wmBMP; -}; - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmres.h b/print/XPSDrvSmpl/src/filters/watermark/wmres.h deleted file mode 100644 index 0df8f4d4..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmres.h +++ /dev/null @@ -1,27 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmres.h - -Abstract: - - Warmark specific resource defines. - ---*/ - -#pragma once - -#define IDR_WM_PNG1 101 - -#define IDR_WM_XPS1 201 - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmsax.cpp b/print/XPSDrvSmpl/src/filters/watermark/wmsax.cpp deleted file mode 100644 index be165d53..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmsax.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmsax.cpp - -Abstract: - - Watermark sax handler implementation. The watermark SAX handler is - responsible for parsing the FixedPage mark-up for the page size and - adding the inserting the watermark mark-up in appropriate place. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "wmsax.h" - -/*++ - -Routine Name: - - CWMSaxHandler::CWMSaxHandler - -Routine Description: - - Contructor for the watermark filters SAX handler. - The constructor registers a writer for streaming out any markup and a watermark - handler object for generating any new watermark markup and handling related resources - -Arguments: - - pWriter - Pointer to a write stream which receives markup - pWatermark - Pointer to a watermark handler object - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CWMSaxHandler::CWMSaxHandler( - _In_ IPrintWriteStream* pWriter, - _In_ CWatermark* pWatermark - ) : - m_pWriter(pWriter), - m_watermark(pWatermark), - m_bOpenTag(FALSE) -{ - ASSERTMSG(m_pWriter != NULL, "NULL writer passed to watermark SAX handler.\n"); - ASSERTMSG(m_watermark != NULL, "NULL watermark passed to watermark SAX handler.\n"); - - HRESULT hr = S_OK; - if (FAILED(hr = CHECK_POINTER(m_pWriter, E_POINTER)) || - FAILED(hr = CHECK_POINTER(m_watermark, E_POINTER))) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CWMSaxHandler::~CWMSaxHandler - -Routine Description: - - Default destructor for the watermark filter SAX handler - -Arguments: - - None - -Return Value: - - None - ---*/ -CWMSaxHandler::~CWMSaxHandler() -{ -} - -/*++ - -Routine Name: - - CWMSaxHandler::startElement - -Routine Description: - - SAX handler method which handles each start element for the XML markup - -Arguments: - - pwchQName - Pointer to a string containing the element name - cchQName - Count of the number of characters in the element name - pAttributes - Pointer to the attribute list for the supplied element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CWMSaxHandler::startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ) -{ - HRESULT hr = S_OK; - CStringXDW cstrOut; - - try - { - // - // Check if we need to close an opened tag - // - if (m_bOpenTag) - { - cstrOut.Append(L">"); - } - - // - // Store the opened element name so we can handle nested elements - // - m_bstrOpenElement = CComBSTR(cchQName, pwchQName); - - // - // Write out element - // - cstrOut.Append(L"<"); - cstrOut.Append(m_bstrOpenElement); - } - catch (CXDException& e) - { - hr = e; - } - - // - // We opened a tag - // - m_bOpenTag = TRUE; - - // - // If this is the fixed page we need the width and height retreived - // - BOOL bIsFixedPage = (m_bstrOpenElement == L"FixedPage"); - - // - // Find the number of attributes and enumerate over all of them - // - INT cAttributes = 0; - if (SUCCEEDED(hr) && - SUCCEEDED(hr = pAttributes->getLength(&cAttributes))) - { - for (INT cIndex = 0; cIndex < cAttributes; cIndex++) - { - PCWSTR pszAttUri = NULL; - INT cchAttUri = 0; - PCWSTR pszAttName = NULL; - INT cchAttName = 0; - PCWSTR pszAttQName = NULL; - INT cchAttQName = 0; - PCWSTR pszAttValue = NULL; - INT cchAttValue = 0; - - // - // Get the attribute data ready to write out - // - if (SUCCEEDED(hr = pAttributes->getName(cIndex, - &pszAttUri, - &cchAttUri, - &pszAttName, - &cchAttName, - &pszAttQName, - &cchAttQName))) - { - if (SUCCEEDED(pAttributes->getValue(cIndex, &pszAttValue, &cchAttValue))) - { - try - { - CComBSTR bstrAttName(cchAttQName, pszAttQName); - CComBSTR bstrAttValue(cchAttValue, pszAttValue); - - // - // Delimit attributes with a space - // - cstrOut.Append(L" "); - - // - // Reconstruct the attribute and write back to - // the fixed page - // - cstrOut.Append(bstrAttName); - cstrOut.Append(L"=\""); - - // - // If this is a UnicodeString we may need to escape entities - // - if (bstrAttName == L"UnicodeString") - { - hr = EscapeEntity(&bstrAttValue); - } - - cstrOut.Append(bstrAttValue); - cstrOut.Append(L"\""); - } - catch (CXDException& e) - { - hr = e; - } - } - } - } - } - - // - // We output the mark-up here for underlaid watermarks - // - if (SUCCEEDED(hr) && - bIsFixedPage) - { - // - // If this is the fixed page element make sure we close it in case the - // page has no content. - // - try - { - cstrOut.Append(L">"); - m_bOpenTag = FALSE; - } - catch (CXDException& e) - { - hr = e; - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(m_watermark, E_PENDING))) - { - - // - // Create the watermark markup - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = m_watermark->CreateXMLElement())) - { - // - // Check if the mark-up needs to inserted at the start of the - // fixed page (underlay) - // - if (m_watermark->InsertStart()) - { - CComBSTR bstrWMText; - if (SUCCEEDED(hr = m_watermark->GetXML(&bstrWMText))) - { - // - // Insert the watermark mark-up - // - cstrOut.Append(bstrWMText); - } - } - } - } - } - - if (SUCCEEDED(hr)) - { - hr = WriteToPrintStream(&cstrOut, m_pWriter); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWMSaxHandler::endElement - -Routine Description: - - SAX handler method which handles each end element for the XML markup - -Arguments: - - pwchQName - Pointer to a string containing the element name - cchQName - Count of the number of characters in the element name - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CWMSaxHandler::endElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName - ) -{ - HRESULT hr = S_OK; - CStringXDW cstrClose; - - try - { - CComBSTR bstrElement(cchQName, pwchQName); - - if (bstrElement == L"FixedPage") - { - if (SUCCEEDED(hr = CHECK_POINTER(m_watermark, E_PENDING)) && - m_watermark->InsertEnd()) - { - CComBSTR bstrWMText; - if (SUCCEEDED(hr = m_watermark->GetXML(&bstrWMText))) - { - cstrClose.Append(bstrWMText); - } - } - } - - // - // If this element matches the current open element, use shorthand to close - // the tag - // - if (bstrElement == m_bstrOpenElement && - m_bOpenTag) - { - cstrClose.Append(L"/>"); - } - else - { - // - // Close the element - // - cstrClose.Append(L""); - } - } - catch (CXDException& e) - { - hr = e; - } - - if (SUCCEEDED(hr)) - { - hr = WriteToPrintStream(&cstrClose, m_pWriter); - } - - m_bOpenTag = FALSE; - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CWMSaxHandler::startDocument - -Routine Description: - - SAX handler method which handles the start document call to ensure - the xml version is correctly set - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CWMSaxHandler::startDocument( - void - ) -{ - HRESULT hr = S_OK; - - try - { - if (SUCCEEDED(hr = CHECK_POINTER(m_pWriter, E_FAIL))) - { - CStringXDW cstrOut(L""); - hr = WriteToPrintStream(&cstrOut, m_pWriter); - } - } - catch (CXDException& e) - { - hr = e; - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmsax.h b/print/XPSDrvSmpl/src/filters/watermark/wmsax.h deleted file mode 100644 index cd76ca9e..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmsax.h +++ /dev/null @@ -1,74 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmsax.h - -Abstract: - - Watermark sax handler definition. The watermark SAX handler is responsible for - parsing the FixedPage mark-up for the page size and inserting the watermark mark-up - in appropriate place. - ---*/ - -#pragma once - -#include "saxhndlr.h" -#include "wmtext.h" - -class CWMSaxHandler : public CSaxHandler -{ -public: - CWMSaxHandler( - _In_ IPrintWriteStream* pWriter, - _In_ CWatermark* pWatermark - ); - - virtual ~CWMSaxHandler(); - - virtual HRESULT STDMETHODCALLTYPE - startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ); - - virtual HRESULT STDMETHODCALLTYPE - endElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName - ); - - HRESULT STDMETHODCALLTYPE - startDocument( - void - ); - -private: - CComPtr m_pWriter; - - CComBSTR m_bstrOpenElement; - - BOOL m_bOpenTag; - - CWatermark* m_watermark; -}; - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmtext.cpp b/print/XPSDrvSmpl/src/filters/watermark/wmtext.cpp deleted file mode 100644 index a249648d..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmtext.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmtext.cpp - -Abstract: - - Text watermark class implamentation. CTextWatermark is the - text implementation of the CWatermark class. This implements methods - for creating the page mark-up and adding the watermark resource to the - resource cache. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "wmtext.h" -#include "wmptprop.h" -#include "rescache.h" - -using XDPrintSchema::PageWatermark::EWatermarkOption; -using XDPrintSchema::PageWatermark::TextWatermark; - -/*++ - -Routine Name: - - CTextWatermark::CTextWatermark - -Routine Description: - - Constructor for the text watermark class - -Arguments: - - wmProps - Watermark PrintTicket properties class - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CTextWatermark::CTextWatermark( - _In_ CONST CWMPTProperties& wmProps - ) : - CWatermark(wmProps), - m_wmFont(wmProps) -{ - HRESULT hr = S_OK; - - EWatermarkOption wmType; - - if (SUCCEEDED(hr = m_WMProps.GetType(&wmType))) - { - if (wmType != TextWatermark) - { - hr = E_INVALIDARG; - } - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CTextWatermark::~CTextWatermark - -Routine Description: - - Default destructor for the watermarks base class - -Arguments: - - None - -Return Value: - - None - ---*/ -CTextWatermark::~CTextWatermark() -{ -} - -/*++ - -Routine Name: - - CTextWatermark::CreateXMLElement - -Routine Description: - - Method to create the XML markup which describes the transform and properties used - to present the watermark correctly on the page - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CTextWatermark::CreateXMLElement( - VOID - ) -{ - ASSERTMSG(m_pDOMDoc != NULL, "NULL DOM document detected whilst creating text watermark\n"); - ASSERTMSG(m_bstrFontURI.Length() > 0, "Invalid font URI detected whilst creating text watermark\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pDOMDoc, E_PENDING))) - { - if (m_bstrFontURI.Length() == 0) - { - hr = E_PENDING; - } - } - - PointF stringOrigin; - - CComBSTR bstrWMText; - CComBSTR bstrWMOpacity; - CComBSTR bstrWMFontSize; - CComBSTR bstrWMFontColor; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = m_WMProps.GetText(&bstrWMText)) && - SUCCEEDED(hr = m_WMProps.GetFontColor(&bstrWMFontColor)) && - SUCCEEDED(hr = m_WMProps.GetFontEmSize(&bstrWMFontSize)) && - SUCCEEDED(hr = m_WMProps.GetOpacity(&bstrWMOpacity)) && - SUCCEEDED(hr = m_WMProps.GetOrigin(&stringOrigin))) - { - // - // The markup will look like this (square bracketed values "[]" - // describes content): - // - // - // - CComBSTR bstrMatrixXForm; - - CComBSTR bstrFontName(L"/"); - hr = bstrFontName.Append(m_bstrFontURI); - - // - // Create the transform and element and add attributes - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CreateWMTransform(stringOrigin, &bstrMatrixXForm)) && - SUCCEEDED(hr = m_pDOMDoc->createElement(CComBSTR(L"Glyphs"), &m_pWMElem)) && - SUCCEEDED(hr = m_pWMElem->setAttribute(CComBSTR(L"Fill"), CComVariant(bstrWMFontColor))) && - SUCCEEDED(hr = m_pWMElem->setAttribute(CComBSTR(L"Opacity"), CComVariant(bstrWMOpacity))) && - SUCCEEDED(hr = m_pWMElem->setAttribute(CComBSTR(L"RenderTransform"), CComVariant(bstrMatrixXForm))) && - SUCCEEDED(hr = m_pWMElem->setAttribute(CComBSTR(L"FontUri"), CComVariant(bstrFontName))) && - SUCCEEDED(hr = m_pWMElem->setAttribute(CComBSTR(L"FontRenderingEmSize"), CComVariant(bstrWMFontSize))) && - SUCCEEDED(hr = m_pWMElem->setAttribute(CComBSTR(L"OriginX"), CComVariant(L"0"))) && - SUCCEEDED(hr = m_pWMElem->setAttribute(CComBSTR(L"OriginY"), CComVariant(L"0")))) - { - hr = m_pWMElem->setAttribute(CComBSTR(L"UnicodeString"), CComVariant(bstrWMText)); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CTextWatermark::AddParts - -Routine Description: - - Method to add the watermark font resource to the cache - -Arguments: - - pXpsConsumer - Pointer to the writer used when writing the resource back out to the pipeline - pFixedPage - Pointer to the fixed page associated with the font - pResCache - Pointer to a resource cache object which manages the writing of the font - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CTextWatermark::AddParts( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ CFileResourceCache* pResCache - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pXpsConsumer, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pFixedPage, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pResCache, E_POINTER))) - { - // - // Write the font resource to the cache - // - m_bstrFontURI.Empty(); - CComBSTR bstrKey; - if (SUCCEEDED(hr = pResCache->WriteResource(pXpsConsumer, pFixedPage, &m_wmFont)) && - SUCCEEDED(hr = m_wmFont.GetKeyName(&bstrKey))) - { - hr = pResCache->GetURI(bstrKey, &m_bstrFontURI); - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmtext.h b/print/XPSDrvSmpl/src/filters/watermark/wmtext.h deleted file mode 100644 index ff439fdc..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmtext.h +++ /dev/null @@ -1,57 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmtext.h - -Abstract: - - Text watermark class definition. CTextWatermark is the - text implementation of the CWatermark class. This implements methods - for creating the page mark-up and adding the watermark resource to the - resource cache. - ---*/ - -#pragma once - -#include "wmbase.h" -#include "wmfont.h" -#include "rescache.h" - -class CTextWatermark : public CWatermark -{ -public: - CTextWatermark( - _In_ CONST CWMPTProperties& wmProps - ); - - virtual ~CTextWatermark(); - - virtual HRESULT - CreateXMLElement( - VOID - ); - - virtual HRESULT - AddParts( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ CFileResourceCache* pResCache - ); - -private: - CComBSTR m_bstrFontURI; - - CWatermarkFont m_wmFont; -}; - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmvect.cpp b/print/XPSDrvSmpl/src/filters/watermark/wmvect.cpp deleted file mode 100644 index 3c73b2ba..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmvect.cpp +++ /dev/null @@ -1,279 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmvect.cpp - -Abstract: - - VectorGraphic watermark class implamentation. CVectorWatermark is the - vecotr implementation of the CWatermark class. This implements methods - for creating the page mark-up and adding the watermark resource to the - markup. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "wmvect.h" -#include "wmptprop.h" - -using XDPrintSchema::PageWatermark::EWatermarkOption; -using XDPrintSchema::PageWatermark::VectorWatermark; - -/*++ - -Routine Name: - - CVectorWatermark::CVectorWatermark - -Routine Description: - - Constructor for the vector watermark class - -Arguments: - - wmProps - Watermark PrintTicket properties class - resourceID - Resource ID for the watermark - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CVectorWatermark::CVectorWatermark( - _In_ CONST CWMPTProperties& wmProps, - _In_ CONST INT resourceID - ) : - CWatermark(wmProps), - m_wmMarkup(wmProps, resourceID) -{ - HRESULT hr = S_OK; - - EWatermarkOption wmType; - - if (SUCCEEDED(hr = m_WMProps.GetType(&wmType))) - { - if (wmType != VectorWatermark) - { - hr = E_INVALIDARG; - } - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CVectorWatermark::~CVectorWatermark - -Routine Description: - - Default destructor for the watermarks base class - -Arguments: - - None - -Return Value: - - None - ---*/ -CVectorWatermark::~CVectorWatermark() -{ -} - -/*++ - -Routine Name: - - CVectorWatermark::CreateXMLElement - -Routine Description: - - Method to create the XML markup which describes the transform and properties used - to present the watermark correctly on the page - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CVectorWatermark::CreateXMLElement( - VOID - ) -{ - ASSERTMSG(m_pDOMDoc != NULL, "NULL DOM document detected whilst creating text watermark\n"); - - HRESULT hr = S_OK; - - // - // We need to retrieve the RAW Markup bounds to calculate - // the correct render transform for the watermark - // - SizeF markupDims; - CComBSTR bstrWMOpacity; - if (SUCCEEDED(hr = CHECK_POINTER(m_pDOMDoc, E_PENDING)) && - SUCCEEDED(hr = m_wmMarkup.GetImageDimensions(&markupDims)) && - SUCCEEDED(hr = m_WMProps.GetOpacity(&bstrWMOpacity))) - { - // - // The markup will look like this (square bracketed values "[]" - // describes content): - // - // - // - CComBSTR bstrMatrixXForm; - - if (SUCCEEDED(hr = CreateWMTransform(RectF(0, 0, markupDims.Width, markupDims.Height), &bstrMatrixXForm))) - { - try - { - CStringXDW strOpenCanvas; - strOpenCanvas.Format(L"", - static_cast(bstrWMOpacity), static_cast(bstrMatrixXForm)); - - IStream* pStream; - CComBSTR bstrContent; - - if (SUCCEEDED(hr = m_wmMarkup.GetStream(&pStream)) && - SUCCEEDED(hr = bstrContent.ReadFromStream(pStream))) - { - m_bstrMarkup.Empty(); - - if (SUCCEEDED(hr = m_bstrMarkup.Append(strOpenCanvas)) && - SUCCEEDED(hr = m_bstrMarkup.Append(bstrContent))) - { - hr = m_bstrMarkup.Append(L"\n"); - } - } - } - catch (CXDException& e) - { - hr = e; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CVectorWatermark::GetXML - -Routine Description: - - Method for copying the XML markup which describes the watermark text - -Arguments: - - pbstrXML - Pointer to the string to contain the XML vector markup. Any BSTR - this points to will be freed. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CVectorWatermark::GetXML( - _Inout_ _At_(*pbstrXML, _Pre_maybenull_ _Post_valid_) BSTR* pbstrXML - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrXML, E_POINTER))) - { - SysFreeString(*pbstrXML); - - if (m_bstrMarkup.Length() > 0) - { - if (SUCCEEDED(hr = m_bstrMarkup.CopyTo(pbstrXML)) && - !*pbstrXML) - { - hr = E_OUTOFMEMORY; - } - } - else - { - hr = E_PENDING; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CVectorWatermark::AddParts - -Routine Description: - - Method to add any required resource to the cache. - This isn't required for vector based watermarks. - -Arguments: - - pXpsConsumer - Pointer to the writer used when writing the resource back out to the pipeline - pFixedPage - Pointer to the fixed page associated with the resource - pResCache - Pointer to a resource cache object which manages the writing of the resource - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CVectorWatermark::AddParts( - _In_ IXpsDocumentConsumer*, - _In_ IFixedPage*, - _In_ CFileResourceCache* - ) -{ - // - // No Implementation required. - // - - return S_OK; -} - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmvect.h b/print/XPSDrvSmpl/src/filters/watermark/wmvect.h deleted file mode 100644 index 54b9e01c..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmvect.h +++ /dev/null @@ -1,62 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmvect.h - -Abstract: - - VectorGraphic watermark class definition. CVectorWatermark is the - Vector implementation of the CWatermark class. This implements methods - for creating the page mark-up and adding the watermark resource to fixed page. - ---*/ - -#pragma once - -#include "wmbase.h" -#include "wmxps.h" -#include "wmptprop.h" - -class CVectorWatermark : public CWatermark -{ -public: - CVectorWatermark( - _In_ CONST CWMPTProperties& wmProps, - _In_ CONST INT resourceID - ); - - virtual ~CVectorWatermark(); - - virtual HRESULT - CreateXMLElement( - VOID - ); - - virtual HRESULT - GetXML( - _Inout_ _At_(*pbstrXML, _Pre_maybenull_ _Post_valid_) BSTR* pbstrXML - ); - - virtual HRESULT - AddParts( - _In_ IXpsDocumentConsumer* pXpsConsumer, - _In_ IFixedPage* pFixedPage, - _In_ CFileResourceCache* pResCache - ); - -private: - CWatermarkMarkup m_wmMarkup; - - CComBSTR m_bstrMarkup; -}; - diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmxps.cpp b/print/XPSDrvSmpl/src/filters/watermark/wmxps.cpp deleted file mode 100644 index 82d819e8..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmxps.cpp +++ /dev/null @@ -1,291 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmxps.cpp - -Abstract: - - Watermark XPS markup class implementation. The CWatermarkMarkup class is responsible - for creating a stream that contains markup loaded from a resource. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "wmxps.h" - -using XDPrintSchema::PageWatermark::EWatermarkOption; -using XDPrintSchema::PageWatermark::VectorWatermark; - -/*++ - -Routine Name: - - CWatermarkMarkup::CWatermarkMarkup - -Routine Description: - - Constructor for the CWatermarkMarkup vector management class - which sets the member variables to sensible defaults and - ensures the current watermark is a vector based watermark - -Arguments: - - wmProps - Object containing the PrintTicket settings - resourceID - Resource ID for the watermark - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CWatermarkMarkup::CWatermarkMarkup( - _In_ CONST CWMPTProperties& wmProps, - _In_ CONST INT resourceID - ) : - m_WMProps(wmProps), - m_resourceID(resourceID) -{ - HRESULT hr = S_OK; - - EWatermarkOption wmType; - - if (SUCCEEDED(hr = m_WMProps.GetType(&wmType))) - { - if (wmType != VectorWatermark) - { - hr = E_INVALIDARG; - } - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CWatermarkMarkup::~CWatermarkMarkup - -Routine Description: - - Default destructor for the font management class - -Arguments: - - None - -Return Value: - - None - ---*/ -CWatermarkMarkup::~CWatermarkMarkup() -{ -} - -/*++ - -Routine Name: - - CWatermarkMarkup::GetImageDimensions - -Routine Description: - - Method to obtain the width and height for the watermark vector image - -Arguments: - - pDimensions - Pointer to a structure which will hold the vector image dimensions - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkMarkup::GetImageDimensions( - _Out_ SizeF* pDimensions - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDimensions, E_POINTER))) - { - // - // Currently fixed to A4 dimensions - // - pDimensions->Width = 793.76f; - pDimensions->Height = 1122.56f; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkMarkup::CreateXPSStream - -Routine Description: - - Method for writing out the vector image to the container - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkMarkup::CreateXPSStream( - VOID - ) -{ - HRESULT hr = S_OK; - - if (m_pXPSStream == NULL) - { - HRSRC hrSrc = FindResourceEx(g_hInstance, - RT_RCDATA, - MAKEINTRESOURCE(m_resourceID), - MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); - if (hrSrc != NULL) - { - // - // Load the resource - // - HGLOBAL hXPSRes = LoadResource(g_hInstance, hrSrc); - - if (hXPSRes != NULL) - { - if (SUCCEEDED(hr = CreateStreamOnHGlobal(NULL, TRUE, &m_pXPSStream))) - { - // - // Retrieve the XPS data and the size of the data - // - PVOID pXPSData = LockResource(hXPSRes); - DWORD cbXPSData = SizeofResource(g_hInstance, hrSrc); - - if (SUCCEEDED(hr = CHECK_POINTER(pXPSData, E_FAIL)) && - cbXPSData > 0) - { - ULONG cbTotalWritten = 0; - - // - // Write the size of the data to the stream. - // This is required as the stream will be read back using the CComBSTR ReadFromStream() method - // - DWORD cbXPSDataWithTerm = cbXPSData + sizeof(OLECHAR); - - if (SUCCEEDED(hr = m_pXPSStream->Write(&cbXPSDataWithTerm, sizeof(cbXPSDataWithTerm), &cbTotalWritten))) - { - // - // Write the data to the stream - // Note the XPS data content must be in Unicode format to be compatible with - // the CComBSTR ReadFromStream() method. - // - ULONG cbWritten = 0; - - if (SUCCEEDED(hr = m_pXPSStream->Write(pXPSData, cbXPSData, &cbWritten))) - { - cbTotalWritten += cbWritten; - - hr = m_pXPSStream->Write(OLESTR("\0"), sizeof(OLECHAR), &cbWritten); - cbTotalWritten += cbWritten; - } - } - } - } - - FreeResource(hXPSRes); - } - else - { - hr = GetLastErrorAsHResult(); - } - } - else - { - hr = GetLastErrorAsHResult(); - } - } - - // - // Make sure the stream is pointing back at the start of the data - // - if (SUCCEEDED(hr)) - { - LARGE_INTEGER cbMoveFromStart = {0}; - - hr = m_pXPSStream->Seek(cbMoveFromStart, - STREAM_SEEK_SET, - NULL); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkMarkup::GetStream - -Routine Description: - - Method for obtaining a stream to write the vector image out to - -Arguments: - - ppStream - Pointer to a pointer to the stream - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkMarkup::GetStream( - _Out_ IStream** ppStream - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppStream, E_POINTER)) && - SUCCEEDED(hr = CreateXPSStream())) - { - *ppStream = m_pXPSStream; - } - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmxps.h b/print/XPSDrvSmpl/src/filters/watermark/wmxps.h deleted file mode 100644 index 125edaac..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/wmxps.h +++ /dev/null @@ -1,60 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmxps.h - -Abstract: - - Watermark XPS markup class definition. The CWatermarkMarkup class is responsible - for creating a stream that contains markup loaded from a resource. - ---*/ - -#pragma once - -#include "wmptprop.h" - -class CWatermarkMarkup -{ -public: - CWatermarkMarkup( - _In_ CONST CWMPTProperties& wmProps, - _In_ CONST INT resourceID - ); - - ~CWatermarkMarkup(); - - HRESULT - GetImageDimensions( - _Out_ SizeF* pDimensions - ); - - HRESULT - GetStream( - _Out_ IStream** ppStream - ); - -private: - HRESULT - CreateXPSStream( - VOID - ); - -private: - CWMPTProperties m_WMProps; - - INT m_resourceID; - - CComPtr m_pXPSStream; -}; - diff --git a/print/XPSDrvSmpl/src/filters/watermark/xdwmark.def b/print/XPSDrvSmpl/src/filters/watermark/xdwmark.def deleted file mode 100644 index dee0a0d7..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/xdwmark.def +++ /dev/null @@ -1,26 +0,0 @@ -; -; Copyright (c) 2005 Microsoft Corporation -; -; All rights reserved. -; -; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -; ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -; PARTICULAR PURPOSE. -; -; File Name: -; -; xdwmark.def -; -; Abstract: -; -; Watermark filter module definition file -; - -LIBRARY XDWMark - -EXPORTS - DllMain - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - diff --git a/print/XPSDrvSmpl/src/filters/watermark/xdwmark.vcxproj b/print/XPSDrvSmpl/src/filters/watermark/xdwmark.vcxproj deleted file mode 100644 index 65ba86ed..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/xdwmark.vcxproj +++ /dev/null @@ -1,582 +0,0 @@ - - - - - Debug - ARM - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {E31D1C4F-8E0D-428A-8583-5159CE690B33} - $(MSBuildProjectName) - false - true - Debug - Win32 - {026C20B0-65B4-4ECC-BD89-61D7F5EC7DE8} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - xdwmark - - - xdwmark - - - xdwmark - - - xdwmark - - - xdwmark - - - xdwmark - - - xdwmark - - - xdwmark - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - - - - xdwmark.def - - - - - xdwmark.def - - - - - xdwmark.def - - - - - xdwmark.def - - - - - xdwmark.def - - - - - xdwmark.def - - - - - xdwmark.def - - - - - xdwmark.def - - - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/watermark/xdwmark.vcxproj.Filters b/print/XPSDrvSmpl/src/filters/watermark/xdwmark.vcxproj.Filters deleted file mode 100644 index 26028881..00000000 --- a/print/XPSDrvSmpl/src/filters/watermark/xdwmark.vcxproj.Filters +++ /dev/null @@ -1,233 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {D41A7413-BCDC-4F43-A05E-64E4DECEEB59} - - - h;hpp;hxx;hm;inl;inc;xsd - {D59E1E53-E90B-4BC1-87E3-0D94C8AB6D45} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {70B7C8CE-B4D3-4816-980B-2376D8B2B6F1} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - - - Header Files - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Resource Files - - - Source Files - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/xdcont/precompsrc.cpp b/print/XPSDrvSmpl/src/filters/xdcont/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xdcont.vcxproj b/print/XPSDrvSmpl/src/filters/xdcont/xdcont.vcxproj deleted file mode 100644 index e7337bf9..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xdcont.vcxproj +++ /dev/null @@ -1,473 +0,0 @@ - - - - - Debug - ARM - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {D38B87BF-5778-4DA8-8DCE-B0F37F087D5A} - $(MSBuildProjectName) - false - true - Debug - Win32 - {08C4151B-A3CA-440F-9542-0B219834C1B3} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - StaticLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - xdcont - - - xdcont - - - xdcont - - - xdcont - - - xdcont - - - xdcont - - - xdcont - - - xdcont - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - %(AdditionalIncludeDirectories);..\;..\common;..\..\inc;..\..\common;..\..\debug;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);uuid.lib;WIAGUID.lib;msxml6.lib;Kernel32.lib;ole32.lib;oleaut32.lib;prntvpt.lib;winspool.lib;gdi32.lib;gdiplus.lib;shlwapi.lib;Advapi32.lib;user32.lib;.\..\..\debug\$(IntDir)\xdsdbg.lib;.\..\..\common\$(IntDir)\xdsmplcmn.lib;.\..\..\filters\common\$(IntDir)\xdfltcmn.lib - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - %(PreprocessorDefinitions);_UNICODE;UNICODE - - - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ..;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xdcont.vcxproj.Filters b/print/XPSDrvSmpl/src/filters/xdcont/xdcont.vcxproj.Filters deleted file mode 100644 index b1aba0bd..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xdcont.vcxproj.Filters +++ /dev/null @@ -1,163 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {B192E969-B943-4CD9-AFDD-E14B61AEFA09} - - - h;hpp;hxx;hm;inl;inc;xsd - {3E626190-7767-495A-A5B3-629C0AA184CA} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {E0D34E98-7FA3-45FC-AD1E-5A41EF88FAB1} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xps.h b/print/XPSDrvSmpl/src/filters/xdcont/xps.h deleted file mode 100644 index 0b2ae4b8..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xps.h +++ /dev/null @@ -1,83 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xps.h - -Abstract: - - Enumerations and definitions used by the stream filter. - ---*/ - -#pragma once - -#include "xdstring.h" -#include "ipkfile.h" - -enum ERelsType -{ - RelsAnnotations = 0, ERelsTypeMin = 0, - RelsDigitalSignatureDefinitions, - RelsDiscardControl, - RelsDocumentStructure, - RelsPrintTicket, - RelsRequiredResource, - RelsRestrictedFont, - RelsStartPart, - RelsStoryFragments, - RelsCoreProperties, - RelsDigitalSignature, - RelsDigitalSignatureCertificate, - RelsDigitalSignatureOrigin, - RelsThumbnail, - RelsUnknown, ERelsTypeMax = RelsUnknown -}; - -typedef std::pair RelsNameType; -typedef std::vector RelsTypeList; -typedef std::map RelsMap; - -enum EContentType -{ - ContentFixedDocumentSequence = 0, EContentTypeMin = 0, - ContentFixedDocument, - ContentFixedPage, - ContentDiscardControl, - ContentDocumentStructure, - ContentFont, - ContentICCProfile, - ContentObfuscatedFont, - ContentPrintTicket, - ContentRemoteResourceDictionary, - ContentStoryFragments, - ContentJPEGImage, - ContentPNGImage, - ContentTIFFImage, - ContentWindowsMediaPhotoImage, - ContentCoreProperties, - ContentDigitalSignatureCertificate, - ContentDigitalSignatureOrigin, - ContentDigitalSignatureXMLSignature, - ContentRelationships, - ContentUnknown, EContentTypeMax = ContentUnknown -}; - -typedef std::map ContentMap; - -typedef std::vector FileList; - -typedef std::map SentList; - -typedef std::pair RecordTracker; -typedef std::vector XPSPartStack; - diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpsarch.cpp b/print/XPSDrvSmpl/src/filters/xdcont/xpsarch.cpp deleted file mode 100644 index 68800b31..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpsarch.cpp +++ /dev/null @@ -1,639 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpsarch.cpp - -Abstract: - - Implementation of the XPS archive class. This class is responsible for providing - an interface to clients that removes the potentially interleaved nature of an - XPS document. This allows clients to manipulate files using the parts full name - instead of having to worry about the semantics of interleaved parts. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "xpsarch.h" - -typedef HRESULT (*GetClassObject)(REFCLSID, REFIID, LPVOID FAR*); - -static PCSTR szPartNameFormatString = "%s/[%i].piece"; -static PCSTR szLastPartNameFormatString = "%s/[%i].last.piece"; - -// -// GUIDs for the archive handler -// -CONST GUID CLSID_PKArchiveHandler = {0x5a0f4115, 0xd4d3, 0x401e, {0x80, 0x71, 0xa4, 0x40, 0xd6, 0xd0, 0x70, 0x92}}; -CONST GUID IID_IPKArchive = {0xbdbbdf56, 0xc742, 0x4efd, {0x80, 0x75, 0xaf, 0x2c, 0x7b, 0x24, 0x7f, 0x38}}; - -/*++ - -Routine Name: - - CXPSArchive::CXPSArchive - -Routine Description: - - CXPSArchive class constructor - -Arguments: - - pReadStream - Pointer to the print read stream - pWriteStream - Pointer to the print write stream - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CXPSArchive::CXPSArchive( - _In_ IPrintReadStream* pReadStream, - _In_ IPrintWriteStream* pWriteStream - ) : - m_pWriteStream(pWriteStream), - m_pPkArchive(NULL), - m_hPkArch(NULL) -{ - HRESULT hr = S_OK; - - // - // Get the current directory to load the pk archive library - // - DWORD cchName = 0; - TCHAR* szFileName = new(std::nothrow) TCHAR[MAX_PATH]; - - if (SUCCEEDED(hr = CHECK_POINTER(szFileName, E_OUTOFMEMORY))) - { - cchName = GetModuleFileName(g_hInstance, szFileName, MAX_PATH); - - if (cchName == 0) - { - hr = GetLastErrorAsHResult(); - } - } - - if (SUCCEEDED(hr) && - cchName > 0) - { - // - // Remove the filespec - // - PathRemoveFileSpec(szFileName); - - try - { - // - // Append the PK archive DLL name - // - CStringXD cstrPath(szFileName); - cstrPath += TEXT("\\pkarch.dll"); - - // - // Try to load the PK archive DLL - // - m_hPkArch = LoadLibrary(cstrPath); - } - catch (CXDException& e) - { - hr = e; - } - } - - if (szFileName != NULL) - { - delete[] szFileName; - szFileName = NULL; - } - - if (SUCCEEDED(hr)) - { - // - // Get DllGetClassObject from the PK archive and instantiate the PK archive handler - // - if (m_hPkArch != NULL) - { - GetClassObject pfnGetClassObject = reinterpret_cast(GetProcAddress(m_hPkArch, "DllGetClassObject")); - - if (SUCCEEDED(hr = CHECK_POINTER(pfnGetClassObject, E_NOINTERFACE)) && - SUCCEEDED(hr = pfnGetClassObject(CLSID_PKArchiveHandler, IID_IPKArchive, reinterpret_cast(&m_pPkArchive)))) - { - hr = CHECK_POINTER(m_pPkArchive, E_NOINTERFACE); - } - } - else - { - hr = E_NOINTERFACE; - } - } - - // - // Initialise the IO streams - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(pReadStream, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pWriteStream, E_POINTER)) && - SUCCEEDED(hr = m_pPkArchive->SetReadStream(pReadStream)) && - SUCCEEDED(hr = m_pPkArchive->SetWriteStream(m_pWriteStream))) - { - // - // We can now process the read stream to create the file index - // - hr = m_pPkArchive->ProcessReadStream(); - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CXPSArchive::~CXPSArchive - -Routine Description: - - CXPSArchive class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CXPSArchive::~CXPSArchive() -{ - if (m_pPkArchive != NULL) - { - m_pPkArchive->Close(); - m_pPkArchive = NULL; - } - - if (m_pWriteStream != NULL) - { - m_pWriteStream->Close(); - } - - if (m_hPkArch != NULL) - { - FreeLibrary(m_hPkArch); - } -} - -/*++ - -Routine Name: - - CXPSArchive::InitialiseFile - -Routine Description: - - This routine intialises the named file ready for processing - or sending on. This entails locating all the PK archive files - that constitute the XPS part. - -Arguments: - - szFileName - The name of the part to intialise - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSArchive::InitialiseFile( - _In_z_ PCSTR szFileName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(szFileName, E_POINTER))) - { - try - { - CStringXDA cstrFileName(szFileName); - - // - // Open the file handler - if it is still in use this will fail - // - if (SUCCEEDED(hr = m_XpsFile.Open(szFileName))) - { - // - // Find the record or the parts comprising the record - // - hr = AddFile(szFileName); - } - else - { - RIP("File handler has not been closed correctly\n"); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CXPSArchive::GetFileStream - -Routine Description: - - This routine retrieves the read stream for an XPS part. - -Arguments: - - szFileName - The name of the XPS part the stream is required for - ppFileStream - Pointer to an ISequentialStream pointer that recieves the stream - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSArchive::GetFileStream( - _In_z_ PCSTR szFileName, - _Outptr_ ISequentialStream** ppFileStream - ) -{ - HRESULT hr = S_OK; - - // - // Initialise the current XPS file - // - if (SUCCEEDED(hr = CHECK_POINTER(ppFileStream, E_POINTER)) && - SUCCEEDED(hr = InitialiseFile(szFileName))) - { - // - // Query the XPS file for the file stream - // - *ppFileStream = NULL; - hr = m_XpsFile.QueryInterface(IID_ISequentialStream, reinterpret_cast(ppFileStream)); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSArchive::CloseCurrent - -Routine Description: - - This routine closes the currently opened XPS file - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSArchive::CloseCurrent( - VOID - ) -{ - return m_XpsFile.Close(); -} - -/*++ - -Routine Name: - - CXPSArchive::SendCurrentFile - -Routine Description: - - This routine sends the current initialised file and requests the - PK archive handler compresses it according to the requested method - -Arguments: - - eCompType - The requested compression type - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSArchive::SendCurrentFile( - _In_ ECompressionType eCompType - ) -{ - HRESULT hr = S_OK; - - ULONG cb = 0; - PVOID pv = NULL; - PSTR pName = NULL; - - // - // Get the data buffer and file name - // - if (SUCCEEDED(hr = m_XpsFile.GetBuffer(&pv, &cb)) && - SUCCEEDED(hr = m_XpsFile.GetFileName(&pName))) - { - hr = SendFile(pName, pv, cb, eCompType); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSArchive::SendCurrentFile - -Routine Description: - - This routine sends the current initialised file by requesting the - PK archive handler send the original constituent PK records - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSArchive::SendCurrentFile( - VOID - ) -{ - HRESULT hr = S_OK; - - XPSPartStack* pPartStack = NULL; - PSTR pName = NULL; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pPkArchive, E_NOINTERFACE)) && - SUCCEEDED(hr = m_XpsFile.GetFileParts(&pPartStack)) && - SUCCEEDED(hr = m_XpsFile.GetFileName(&pName))) - { - try - { - // - // Send all file parts on to the PK archive - // - if (!m_sentList[pName]) - { - XPSPartStack::const_iterator iterParts = pPartStack->begin(); - - for (; - iterParts != pPartStack->end() && SUCCEEDED(hr); - iterParts++) - { - hr = m_pPkArchive->SendFile(iterParts->first); - } - - if (SUCCEEDED(hr)) - { - m_sentList[pName] = TRUE; - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSArchive::SendFile - -Routine Description: - - This routine sends a file defined by it's name and constituent data. The - routine passes the name and buffer to the PK archive handler to compress - and add to the archive. - -Arguments: - - szFileName - The name of the part - pBuffer - The buffer containing the part data - cbBuffer - The size of the data buffer - eCompType - The requested compression type - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSArchive::SendFile( - _In_z_ PCSTR szFileName, - _In_reads_bytes_(cbBuffer) PVOID pBuffer, - _In_ ULONG cbBuffer, - _In_ ECompressionType eCompType - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pPkArchive, E_NOINTERFACE)) && - SUCCEEDED(hr = CHECK_POINTER(szFileName, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pBuffer, E_POINTER))) - { - if (eCompType == CompDeflated || - eCompType == CompNone) - { - try - { - // - // Get the PK archive to compress and send the file on - // - if (!m_sentList[szFileName]) - { - if (SUCCEEDED(hr = m_pPkArchive->SendFile(szFileName, pBuffer, cbBuffer, eCompType))) - { - m_sentList[szFileName] = TRUE; - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSArchive::AddFile - -Routine Description: - - This routine adds the PK file or constiuent PK files to the XPS file - ready for retrieval of the read stream. This hides the XPS piece handling - from the client which just adds the part by it's full un-interleaved name - -Arguments: - - szFileName - The name of the part - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - When part not present or badly formed in the container - E_* - On error - ---*/ -HRESULT -CXPSArchive::AddFile( - _In_z_ PCSTR szFileName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pPkArchive, E_NOINTERFACE)) && - SUCCEEDED(hr = CHECK_POINTER(szFileName, E_POINTER))) - { - // - // Find the part or parts comprising the file - // - NameIndex* pNameIndex = NULL; - - if (SUCCEEDED(hr = m_pPkArchive->GetNameIndex(&pNameIndex))) - { - try - { - NameIndex::const_iterator iterNameIndex = pNameIndex->find(szFileName); - if (iterNameIndex != pNameIndex->end()) - { - // - // There is a single part - // - hr = m_XpsFile.AddFilePart(CStringXDA(szFileName), iterNameIndex->second); - } - else - { - // - // This could be a multipart interleaved file - // - UINT cPart = 0; - do - { - CStringXDA cstrPart; - cstrPart.Format(szPartNameFormatString, szFileName, cPart); - - iterNameIndex = pNameIndex->find(cstrPart); - if (iterNameIndex != pNameIndex->end()) - { - // - // We found the next part - // - hr = m_XpsFile.AddFilePart(CStringXDA(szFileName), iterNameIndex->second); - cPart++; - } - else - { - cstrPart.Format(szLastPartNameFormatString, szFileName, cPart); - iterNameIndex = pNameIndex->find(cstrPart); - - if (iterNameIndex != pNameIndex->end()) - { - // - // We found the last part - // - hr = m_XpsFile.AddFilePart(CStringXDA(szFileName), iterNameIndex->second); - cPart++; - break; - } - else - { - // - // The element is either not well constructed (i.e. missing a piece or the last - // part) or it does not exist - // - hr = E_ELEMENT_NOT_FOUND; - } - } - } - while (SUCCEEDED(hr)); - } - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpsarch.h b/print/XPSDrvSmpl/src/filters/xdcont/xpsarch.h deleted file mode 100644 index c891faa2..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpsarch.h +++ /dev/null @@ -1,91 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpsarch.h - -Abstract: - - Definition of the XPS archive class. This class is responsible for providing - an interface to clients that removes the potentially interleaved nature of an - XPS document. This allows clients to manipulate files using the parts full name - instead of having to worry about the semantics of interleaved parts. - ---*/ - -#pragma once - -#include "ipkarch.h" -#include "xpsfiler.h" - -class CXPSArchive -{ -public: - CXPSArchive( - _In_ IPrintReadStream* pReadStream, - _In_ IPrintWriteStream* pWriteStream - ); - - virtual ~CXPSArchive(); - - HRESULT - InitialiseFile( - _In_z_ PCSTR szFileName - ); - - HRESULT - GetFileStream( - _In_z_ PCSTR szFileName, - _Outptr_ ISequentialStream** ppFileStream - ); - - HRESULT - CloseCurrent( - VOID - ); - - HRESULT - SendCurrentFile( - _In_ ECompressionType eCompType - ); - - HRESULT - SendCurrentFile( - VOID - ); - - HRESULT - SendFile( - _In_z_ PCSTR szFileName, - _In_reads_bytes_(cbBuffer) PVOID pBuffer, - _In_ ULONG cbBuffer, - _In_ ECompressionType eCompType - ); - -private: - HRESULT - AddFile( - _In_z_ PCSTR szFileName - ); - -private: - HMODULE m_hPkArch; - - CComPtr m_pPkArchive; - - CXPSReadFile m_XpsFile; - - SentList m_sentList; - - CComPtr m_pWriteStream; -}; - diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpsfd.cpp b/print/XPSDrvSmpl/src/filters/xdcont/xpsfd.cpp deleted file mode 100644 index ebe78ee5..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpsfd.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpsfd.cpp - -Abstract: - - Implementation of the XPS Fixed Document (FD) SAX handler. This class is - responsible for retrieving and storing in the correct order the Fixed Pages - that comprise the Fixed Document. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "xpsfd.h" - -static PCSTR szPageContent = "PageContent"; -static PCSTR szSource = "Source"; - -/*++ - -Routine Name: - - CFixedDocument::CFixedDocument - -Routine Description: - - CFixedDocument class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CFixedDocument::CFixedDocument() -{ -} - -/*++ - -Routine Name: - - CFixedDocument::~CFixedDocument - -Routine Description: - - CFixedDocument class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CFixedDocument::~CFixedDocument() -{ -} - -/*++ - -Routine Name: - - CFixedDocument::startElement - -Routine Description: - - This routine is the startElement method of the SAX handler. This is used - to parse the fixed document mark-up retrieving and storing the list of - fixed pages in the document - -Arguments: - - pwchNamespaceUri - Unused: Local namespace URI - cchNamespaceUri - Unused: Length of the namespace URI - pwchLocalName - Unused: Local name string - cchLocalName - Unused: Length of the local name string - pwchQName - The qualified name with prefix - cchQName - The length of the qualified name with prefix - pAttributes - Pointer to the ISAXAttributes interface containing attributes attached to the element - - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CFixedDocument::startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pwchQName, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pAttributes, E_POINTER))) - { - if (cchQName <= 0) - { - hr = E_INVALIDARG; - } - } - - try - { - CStringXDA cstrElementName(pwchQName, cchQName); - - if (cstrElementName == szPageContent) - { - INT cAttributes = 0; - - if (SUCCEEDED(hr)) - { - hr = pAttributes->getLength(&cAttributes); - } - - // - // Run over all attributes identifying the document in the sequence - // - for (INT cIndex = 0; cIndex < cAttributes && SUCCEEDED(hr); cIndex++) - { - PCWSTR pszAttUri = NULL; - INT cchAttUri = 0; - PCWSTR pszAttName = NULL; - INT cchAttName = 0; - PCWSTR pszAttQName = NULL; - INT cchAttQName = 0; - PCWSTR pszAttValue = NULL; - INT cchAttValue = 0; - - // - // Get the attribute data ready to write out - // - if (SUCCEEDED(hr = pAttributes->getName(cIndex, &pszAttUri, &cchAttUri, &pszAttName, &cchAttName, &pszAttQName, &cchAttQName)) && - SUCCEEDED(hr = pAttributes->getValue(cIndex, &pszAttValue, &cchAttValue))) - { - CStringXDA cstrAttName(pszAttQName, cchAttQName); - CStringXDA cstrAttValue(pszAttValue, cchAttValue); - - if (cstrAttName == szSource) - { - // - // Strip any leading "/" - // - if (cstrAttValue.GetAt(0) == '/') - { - cstrAttValue.Delete(0); - } - - try - { - // - // Add the fixed page to the list - // - m_FixedPageList.push_back(cstrAttValue); - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - } - } - } - } - catch (CXDException& e) - { - hr = e; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CFixedDocument::GetFixedPageList - -Routine Description: - - This routine retrieves the fixed page list constructed as the fixed document - mark-up was parsed - -Arguments: - - pFixedPageList - Pointer to the vector that recieves the fixed page list - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CFixedDocument::GetFixedPageList( - _Out_ FileList* pFixedPageList - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFixedPageList, E_POINTER))) - { - try - { - pFixedPageList->assign(m_FixedPageList.begin(), m_FixedPageList.end()); - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - return hr; -} - -/*++ - -Routine Name: - - CFixedDocument::Clear - -Routine Description: - - This routine clears the fixed page list - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CFixedDocument::Clear( - VOID - ) -{ - HRESULT hr = S_OK; - - m_FixedPageList.clear(); - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpsfd.h b/print/XPSDrvSmpl/src/filters/xdcont/xpsfd.h deleted file mode 100644 index 65888511..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpsfd.h +++ /dev/null @@ -1,60 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpsfd.h - -Abstract: - - Definition of the XPS Fixed Document (FD) SAX handler. This class is - responsible for retrieving and storing in the correct order the Fixed Pages - that comprise the Fixed Document. - ---*/ - -#pragma once - -#include "saxhndlr.h" -#include "xps.h" - -class CFixedDocument : public CSaxHandler -{ -public: - CFixedDocument(); - - virtual ~CFixedDocument(); - - virtual HRESULT STDMETHODCALLTYPE - startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ); - - HRESULT - GetFixedPageList( - _Out_ FileList* pFixedPageList - ); - - HRESULT - Clear( - VOID - ); - -private: - FileList m_FixedPageList; -}; - diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpsfds.cpp b/print/XPSDrvSmpl/src/filters/xdcont/xpsfds.cpp deleted file mode 100644 index e4eb8bc8..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpsfds.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpsfds.cpp - -Abstract: - - Implementation of the XPS Fixed Document Sequence (FDS) SAX handler. - This class is responsible for retrieving and storing in the correct - order the Fixed Documentss that comprise the Fixed Document - Sequence. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "xpsfds.h" - -static PCSTR szDocumentReference = "DocumentReference"; -static PCSTR szSource = "Source"; - -/*++ - -Routine Name: - - CFixedDocumentSequence::CFixedDocumentSequence - -Routine Description: - - CFixedDocumentSequence class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CFixedDocumentSequence::CFixedDocumentSequence() -{ -} - -/*++ - -Routine Name: - - CFixedDocumentSequence::~CFixedDocumentSequence - -Routine Description: - - CFixedDocumentSequence class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CFixedDocumentSequence::~CFixedDocumentSequence() -{ -} - -/*++ - -Routine Name: - - CFixedDocumentSequence::startElement - -Routine Description: - - This routine is the startElement method of the SAX handler. This is used - to parse the fixed document sequence mark-up retrieving and storing the list of - fixed documents in the sequence - -Arguments: - - pwchNamespaceUri - Unused: Local namespace URI - cchNamespaceUri - Unused: Length of the namespace URI - pwchLocalName - Unused: Local name string - cchLocalName - Unused: Length of the local name string - pwchQName - The qualified name with prefix - cchQName - The length of the qualified name with prefix - pAttributes - Pointer to the ISAXAttributes interface containing attributes attached to the element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CFixedDocumentSequence::startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pwchQName, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pAttributes, E_POINTER))) - { - if (cchQName <= 0) - { - hr = E_INVALIDARG; - } - } - - try - { - CStringXDA cstrElementName(pwchQName, cchQName); - - if (cstrElementName == szDocumentReference) - { - INT cAttributes = 0; - - if (SUCCEEDED(hr)) - { - hr = pAttributes->getLength(&cAttributes); - } - - // - // Run over all attributes identifying the document in the sequence - // - for (INT cIndex = 0; cIndex < cAttributes && SUCCEEDED(hr); cIndex++) - { - PCWSTR pszAttUri = NULL; - INT cchAttUri = 0; - PCWSTR pszAttName = NULL; - INT cchAttName = 0; - PCWSTR pszAttQName = NULL; - INT cchAttQName = 0; - PCWSTR pszAttValue = NULL; - INT cchAttValue = 0; - - // - // Get the attribute data ready to write out - // - if (SUCCEEDED(hr = pAttributes->getName(cIndex, &pszAttUri, &cchAttUri, &pszAttName, &cchAttName, &pszAttQName, &cchAttQName)) && - SUCCEEDED(hr = pAttributes->getValue(cIndex, &pszAttValue, &cchAttValue))) - { - CStringXDA cstrAttName(pszAttQName, cchAttQName); - CStringXDA cstrAttValue(pszAttValue, cchAttValue); - - if (cstrAttName == szSource) - { - // - // Strip any leading "/" - // - if (cstrAttValue.GetAt(0) == '/') - { - cstrAttValue.Delete(0); - } - - try - { - // - // Add the fixed document to the list - // - m_FixedDocumentList.push_back(cstrAttValue); - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - } - } - } - } - catch (CXDException& e) - { - hr = e; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CFixedDocumentSequence::GetFixedDocumentList - -Routine Description: - - This routine retrieves the fixed document list constructed as the fixed document - sequence mark-up was parsed - -Arguments: - - pFixedDocumentList - Pointer to the vector that recieves the fixed document list - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CFixedDocumentSequence::GetFixedDocumentList( - _Out_ FileList* pFixedDocumentList - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pFixedDocumentList, E_POINTER))) - { - try - { - pFixedDocumentList->assign(m_FixedDocumentList.begin(), m_FixedDocumentList.end()); - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - return hr; -} - -/*++ - -Routine Name: - - CFixedDocumentSequence::Clear - -Routine Description: - - This routine clears the fixed page list - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CFixedDocumentSequence::Clear( - VOID - ) -{ - HRESULT hr = S_OK; - - m_FixedDocumentList.clear(); - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpsfds.h b/print/XPSDrvSmpl/src/filters/xdcont/xpsfds.h deleted file mode 100644 index 78860b70..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpsfds.h +++ /dev/null @@ -1,61 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpsfds.h - -Abstract: - - Definition of the XPS Fixed Document Sequence (FDS) SAX handler. - This class is responsible for retrieving and storing in the correct - order the Fixed Documentss that comprise the Fixed Document - Sequence. - ---*/ - -#pragma once - -#include "saxhndlr.h" -#include "xps.h" - -class CFixedDocumentSequence : public CSaxHandler -{ -public: - CFixedDocumentSequence(); - - virtual ~CFixedDocumentSequence(); - - virtual HRESULT STDMETHODCALLTYPE - startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ); - - HRESULT - GetFixedDocumentList( - _Out_ FileList* pFixedDocumentList - ); - - HRESULT - Clear( - VOID - ); - -private: - FileList m_FixedDocumentList; -}; - diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpsfiler.cpp b/print/XPSDrvSmpl/src/filters/xdcont/xpsfiler.cpp deleted file mode 100644 index c8ee85cb..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpsfiler.cpp +++ /dev/null @@ -1,679 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpsfiler.cpp - -Abstract: - - Implementation of the XPS file reader class. This class implements - ISequentialStream::Read by using the IPKFile interface to supply the - client with decompressed data as requested. This allows the file to - be passed directly to a SAX or DOM handler for parsing. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "xpsfiler.h" - -/*++ - -Routine Name: - - CXPSReadFile::CXPSReadFile - -Routine Description: - - CXPSReadFile class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CXPSReadFile::CXPSReadFile() : - CUnknown(IID_ISequentialStream), - m_cbSent(0), - m_cbExtracted(0), - m_bExtractedAll(FALSE) -{ -} - -/*++ - -Routine Name: - - CXPSReadFile::~CXPSReadFile - -Routine Description: - - CXPSReadFile class denstructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CXPSReadFile::~CXPSReadFile() -{ - Close(); -} - -/*++ - -Routine Name: - - CXPSReadFile::Read - -Routine Description: - - This routine implements the ISequentialStream read interface allowing - clients to access file data without having to worry about part - interleaving or decompression. - -Arguments: - - pv - Pointer to the buffer to recieve the file data - cb - The size of the data buffer - pcbRead - Pointer to a ULONG that recieves the number of bytes read - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CXPSReadFile::Read( - _Out_writes_bytes_(cb) void* pv, - _In_ ULONG cb, - _Out_ ULONG* pcbRead - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pv, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcbRead, E_POINTER))) - { - *pcbRead = 0; - - if (cb > 0) - { - // - // Add data to our working buffer till we have enough to copy or - // we ran out of data - // - while (m_cbExtracted - m_cbSent < cb && - !m_bExtractedAll && - SUCCEEDED(hr)) - { - hr = DecompressNextFile(); - } - - // - // Copy the data into the copy buffer - // - if (SUCCEEDED(hr)) - { - hr = CopyBuffer(pv, cb, pcbRead); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSReadFile::Write - -Routine Description: - - This routine is the ISequentialStream write implementation. It is not - implemented - -Arguments: - - Unused - -Return Value: - - HRESULT - E_NOTIMPL - This method is not implemented - ---*/ -HRESULT STDMETHODCALLTYPE -CXPSReadFile::Write( - _In_reads_bytes_(cb) CONST void*, - _In_ ULONG cb, - _Out_opt_ ULONG* - ) -{ - UNREFERENCED_PARAMETER(cb); - return E_NOTIMPL; -} - -/*++ - -Routine Name: - - CXPSReadFile::Open - -Routine Description: - - This routine intialises a file ready to be read - -Arguments: - - szFileName - The name of the part to be intialised - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSReadFile::Open( - _In_ PCSTR szFileName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(szFileName, E_POINTER))) - { - try - { - if (m_partStack.empty()) - { - m_cstrFileName = szFileName; - } - else - { - RIP("The file must be closed before another is opened\n"); - - hr = E_FAIL; - } - - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSReadFile::Close - -Routine Description: - - This routine closes the currently open file - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSReadFile::Close( - VOID - ) -{ - HRESULT hr = S_OK; - - m_partStack.clear(); - m_cstrFileName.Empty(); - m_cbSent = 0; - m_cbExtracted = 0; - m_bExtractedAll = 0; - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSReadFile::GetBuffer - -Routine Description: - - This routine retrieves the current populated buffer and the count - of bytes available - -Arguments: - - ppv - Pointer to a VOID pointer that recieves the buffer - pcb - Pointer to a ULONG that recieves the size of the buffer - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSReadFile::GetBuffer( - _Outptr_result_bytebuffer_(*pcb) PVOID* ppv, - _Out_ ULONG* pcb - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppv, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcb, E_POINTER))) - { - *ppv = NULL; - *pcb = 0; - - if (!m_bExtractedAll) - { - hr = E_PENDING; - } - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = m_workFile.GetBuffer(m_cbExtracted, ppv))) - { - *pcb = static_cast(m_cbExtracted); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSReadFile::GetFileName - -Routine Description: - - This routine retrieves the file name of the currently opened file - -Arguments: - - pszFileName - Pointer to a string that recieves the filename - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSReadFile::GetFileName( - _Outptr_ PSTR* pszFileName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pszFileName, E_POINTER))) - { - try - { - if (m_cstrFileName.GetLength() > 0) - { - *pszFileName = m_cstrFileName.GetBuffer(); - } - else - { - hr = E_PENDING; - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSReadFile::AddFilePart - -Routine Description: - - This routine adds a PK file name to the stack of files that - constitute the XPS part - -Arguments: - - szFileName - The file name to add - pPkFile - The PK file to add to the stack - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSReadFile::AddFilePart( - _In_ PCSTR szFileName, - _In_ CONST IPKFile* pPkFile - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(szFileName, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPkFile, E_POINTER))) - { - try - { - if (m_cstrFileName == szFileName) - { - m_partStack.push_back(RecordTracker(pPkFile, FALSE)); - } - else - { - RIP("Filename differs from currently open file\n"); - - hr = E_FAIL; - } - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSReadFile::GetFileParts - -Routine Description: - - This routine retrieves the PK files that constitute the XPS part - -Arguments: - - ppPartStack - Pointer to an XPSPartStack pointer that recieves the part stack - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSReadFile::GetFileParts( - _Outptr_ XPSPartStack** ppPartStack - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppPartStack, E_POINTER))) - { - *ppPartStack = &m_partStack; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSReadFile::DecompressNextFile - -Routine Description: - - This routine decompresses the next compressed part in the part stack - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSReadFile::DecompressNextFile( - VOID - ) -{ - HRESULT hr = S_OK; - - // - // If there are more files to decompress - // - if (!m_bExtractedAll) - { - try - { - // - // Decompress the next unprocessed file into the working buffer - // - XPSPartStack::iterator iterXpsStack = m_partStack.begin(); - - for (;iterXpsStack != m_partStack.end(); iterXpsStack++) - { - if (!iterXpsStack->second) - { - if (SUCCEEDED(hr = Decompress(iterXpsStack->first))) - { - iterXpsStack->second = TRUE; - } - - break; - } - } - - if (iterXpsStack == m_partStack.end()) - { - // - // That was the last record - // - m_bExtractedAll = TRUE; - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - else - { - RIP("File has already been fully extracted\n"); - - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSReadFile::Decompress - -Routine Description: - - This routine uses the PK archive handler to decompress the PK file specified - -Arguments: - - pRecord - The PK file to be decompressed - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSReadFile::Decompress( - _In_ CONST IPKFile* pRecord - ) -{ - HRESULT hr = S_OK; - - ECompressionType eCompType; - ULONG cbDecompressed = 0; - - if (SUCCEEDED(hr = CHECK_POINTER(pRecord, E_POINTER)) && - SUCCEEDED(hr = pRecord->GetDecompressedSize(&cbDecompressed)) && - SUCCEEDED(hr = pRecord->GetCompressionMethod(&eCompType))) - { - if (eCompType == CompDeflated || - eCompType == CompNone) - { - PVOID pUnCompressedData = NULL; - - if (SUCCEEDED(hr = m_workFile.GetBuffer(m_cbExtracted + cbDecompressed, &pUnCompressedData))) - { - pUnCompressedData = reinterpret_cast(pUnCompressedData) + m_cbExtracted; - - if (SUCCEEDED(hr = pRecord->DecompressTo(pUnCompressedData, cbDecompressed))) - { - m_cbExtracted += cbDecompressed; - } - } - } - else - { - ERR("Unsupported compression method\n"); - - hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSReadFile::CopyBuffer - -Routine Description: - - This routine copies the decompressed data from the working buffer to - the specified buffer - -Arguments: - - pv - Pointer to the buffer to recieve the file data - cb - The size of the data buffer - pcbRead - Pointer to a ULONG that recieves the number of bytes written to the buffer - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSReadFile::CopyBuffer( - _Out_writes_bytes_(cb) void* pv, - _In_ ULONG cb, - _Out_ ULONG* pcbRead - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pv, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcbRead, E_POINTER))) - { - *pcbRead = 0; - - if (cb > 0) - { - // - // We return the smaller of the amount requested and the - // amount available - // - *pcbRead = static_cast(min(m_cbExtracted - m_cbSent, cb)); - - PVOID pData = NULL; - - if (SUCCEEDED(hr = m_workFile.GetBufferAt(static_cast(m_cbSent), static_cast(*pcbRead), &pData))) - { - CopyMemory(pv, pData, *pcbRead); - - m_cbSent += *pcbRead; - } - } - } - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpsfiler.h b/print/XPSDrvSmpl/src/filters/xdcont/xpsfiler.h deleted file mode 100644 index 03603098..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpsfiler.h +++ /dev/null @@ -1,119 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpsfiler.h - -Abstract: - - Definition of the XPS file reader class. This class implements - ISequentialStream::Read by using the IPKFile interface to supply the - client with decompressed data as requested. This allows the file to - be passed directly to a SAX or DOM handler for parsing. - ---*/ - -#pragma once - -#include "xps.h" -#include "ipkarch.h" -#include "workbuff.h" -#include "cunknown.h" - -class CXPSReadFile : public CUnknown -{ -public: - CXPSReadFile(); - - virtual ~CXPSReadFile(); - - // - // ISequentialStream members - // - HRESULT STDMETHODCALLTYPE - Read( - _Out_writes_bytes_(cb) void* pv, - _In_ ULONG cb, - _Out_ ULONG* pcbRead - ); - - HRESULT STDMETHODCALLTYPE - Write( - _In_reads_bytes_(cb) CONST void*, - _In_ ULONG cb, - _Out_opt_ ULONG* - ); - - HRESULT - Open( - _In_ PCSTR szFileName - ); - - HRESULT - Close( - VOID - ); - - HRESULT - AddFilePart( - _In_ PCSTR szFileName, - _In_ CONST IPKFile* pPkFile - ); - - HRESULT - GetFileParts( - _Outptr_ XPSPartStack** ppPartStack - ); - - HRESULT - GetBuffer( - _Outptr_result_bytebuffer_(*pcb) PVOID* ppv, - _Out_ ULONG* pcb - ); - - HRESULT - GetFileName( - _Outptr_ PSTR* pszFileName - ); - -private: - HRESULT - DecompressNextFile( - VOID - ); - - HRESULT - Decompress( - _In_ CONST IPKFile* pRecord - ); - - HRESULT - CopyBuffer( - _Out_writes_bytes_(cb) void* pv, - _In_ ULONG cb, - _Out_ ULONG* pcbRead - ); - -private: - CWorkingBuffer m_workFile; - - CStringXDA m_cstrFileName; - - XPSPartStack m_partStack; - - SIZE_T m_cbSent; - - SIZE_T m_cbExtracted; - - BOOL m_bExtractedAll; -}; - diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpsfilew.cpp b/print/XPSDrvSmpl/src/filters/xdcont/xpsfilew.cpp deleted file mode 100644 index 64decfac..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpsfilew.cpp +++ /dev/null @@ -1,291 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpsfilew.cpp - -Abstract: - - Implementation of an XPS file writer. This implements ISequentialStream::Write - and essentially wraps a buffer that recieves and stores the part information - so that in can be later compressed and written out. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xpsfilew.h" - -/*++ - -Routine Name: - - CXPSWriteFile::CXPSWriteFile - -Routine Description: - - CXPSWriteFile class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CXPSWriteFile::CXPSWriteFile() : - CUnknown(IID_ISequentialStream), - m_cbWritten(0) -{ -} - -/*++ - -Routine Name: - - CXPSWriteFile::CXPSWriteFile - -Routine Description: - - CXPSWriteFile class constructor - -Arguments: - - szFileName - The name of the file to write to - -Return Value: - - None - ---*/ -CXPSWriteFile::CXPSWriteFile( - PCSTR szFileName - ) : - CUnknown(IID_ISequentialStream), - m_cbWritten(0), - m_cstrFileName(szFileName) -{ -} - -/*++ - -Routine Name: - - CXPSWriteFile::~CXPSWriteFile - -Routine Description: - - CXPSWriteFile class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CXPSWriteFile::~CXPSWriteFile() -{ -} - -// -// ISequentialStream members -// -/*++ - -Routine Name: - - CXPSWriteFile::Read - -Routine Description: - - This is the ISequentialStream read method - this is not implemented in - the file writter - -Arguments: - - Unused - -Return Value: - - HRESULT - E_NOTIMPL - This method is not implemented - ---*/ -HRESULT STDMETHODCALLTYPE -CXPSWriteFile::Read( - _Out_writes_bytes_to_(cb, *pcbRead) void*, - _In_ ULONG cb, - _Out_opt_ ULONG* pcbRead - ) -{ - UNREFERENCED_PARAMETER(cb); - UNREFERENCED_PARAMETER(pcbRead); - return E_NOTIMPL; -} - -/*++ - -Routine Name: - - CXPSWriteFile::Write - -Routine Description: - - This routine implements the ISequentialStream wrte interface allowing - clients to write file data. - -Arguments: - - pData - Pointer to the source data - cbData - The size of the data buffer - pcbWritten - Pointer to a ULONG that recieves the number of bytes written - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CXPSWriteFile::Write( - _In_reads_bytes_(cbData) CONST void* pData, - _In_ ULONG cbData, - _Out_ ULONG* pcbWritten - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pData, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcbWritten, E_POINTER))) - { - *pcbWritten = 0; - - PBYTE pDest = NULL; - if (SUCCEEDED(hr = m_workFile.GetBuffer(m_cbWritten + cbData, reinterpret_cast(&pDest)))) - { - pDest += m_cbWritten; - - CopyMemory(pDest, pData, cbData); - - m_cbWritten += cbData; - *pcbWritten = cbData; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSWriteFile::GetBuffer - -Routine Description: - - This routine retrieves the buffer containing the file data written by - a client - -Arguments: - - ppv - Pointer to a VOID pointer that recieves the buffer - pcb - Pointer to a ULONG that recieves the size of the buffer - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSWriteFile::GetBuffer( - _Outptr_result_bytebuffer_(*pcb) PVOID* ppv, - _Out_ ULONG* pcb - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppv, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcb, E_POINTER))) - { - *ppv = NULL; - *pcb = 0; - - if (SUCCEEDED(hr = m_workFile.GetBuffer(m_cbWritten, ppv))) - { - *pcb = static_cast(m_cbWritten); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSWriteFile::GetFileName - -Routine Description: - - This routine retrieves the file name of the currently opened file - -Arguments: - - pszFileName - Pointer to a string that recieves the filename - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSWriteFile::GetFileName( - _Outptr_ PSTR* pszFileName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pszFileName, E_POINTER))) - { - try - { - if (m_cstrFileName.GetLength() > 0) - { - *pszFileName = m_cstrFileName.GetBuffer(); - } - else - { - hr = E_PENDING; - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpsfilew.h b/print/XPSDrvSmpl/src/filters/xdcont/xpsfilew.h deleted file mode 100644 index 652027b1..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpsfilew.h +++ /dev/null @@ -1,76 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpsfilew.h - -Abstract: - - Definition of an XPS file writer. This implements ISequentialStream::Write - and essentially wraps a buffer that recieves and stores the part information - so that in can be later compressed and written out. - ---*/ - -#pragma once - -#include "workbuff.h" -#include "cunknown.h" -#include "xdstring.h" - -class CXPSWriteFile : public CUnknown -{ -public: - CXPSWriteFile(); - - CXPSWriteFile( - PCSTR szFileName - ); - - virtual ~CXPSWriteFile(); - - // - // ISequentialStream members - // - HRESULT STDMETHODCALLTYPE - Read( - _Out_writes_bytes_to_(cb, *pcbRead) void*, - _In_ ULONG cb, - _Out_opt_ ULONG* pcbRead - ); - - HRESULT STDMETHODCALLTYPE - Write( - _In_reads_bytes_(cbData) CONST void* pData, - _In_ ULONG cbData, - _Out_ ULONG* pcbWritten - ); - - HRESULT - GetBuffer( - _Outptr_result_bytebuffer_(*pcb) PVOID* ppv, - _Out_ ULONG* pcb - ); - - HRESULT - GetFileName( - _Outptr_ PSTR* pszFileName - ); - -private: - CWorkingBuffer m_workFile; - - ULONG m_cbWritten; - - CStringXDA m_cstrFileName; -}; - diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpsproc.cpp b/print/XPSDrvSmpl/src/filters/xdcont/xpsproc.cpp deleted file mode 100644 index 14da1437..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpsproc.cpp +++ /dev/null @@ -1,916 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpsproc.cpp - -Abstract: - - Implementation of the XPS processor. This class is responsible for handling - the logical document and page structure of the XPS container. The class starts - with the content types part and .rels part to find the Fixed Document Sequence. - It then parses the FDS to find the Fixed Documents and finally the FDs to find - each Fixed Page. Each fixed page is then reported to a client FixedPageProcessor - to interpret the mark-up and write out modifications as required. The class is - additionally responsible for ensuring all XPS parts and accompanying resources are - sent on to the PK archive handler to be written out. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "xpsproc.h" -#include "xpsfilew.h" - -static PCSTR szContentTypes = "[Content_Types].xml"; -static PCSTR szRelsPre = "_rels/"; -static PCSTR szRelsPost = ".rels"; - -/*++ - -Routine Name: - - CXPSProcessor::CXPSProcessor - -Routine Description: - - CXPSProcessor class constructor - -Arguments: - - pReadStream - Pointer to the print read stream - pWriteStream - Pointer to the print write stream - pPageProcessor - Pointer to the page processor interface - pPropertyBag - Pointer to the filter pipeline property bag - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CXPSProcessor::CXPSProcessor( - _In_ IPrintReadStream* pReadStream, - _In_ IPrintWriteStream* pWriteStream, - _In_ IFixedPageProcessor* pPageProcessor, - _In_ IPrintPipelinePropertyBag* pPropertyBag, - _In_ CPTManager* pPtManager - ) : - m_xpsArchive(pReadStream, pWriteStream), - m_pSaxRdr(NULL), - m_pPageProcessor(pPageProcessor), - m_pPrintPropertyBag(pPropertyBag), - m_pPtManager(pPtManager) -{ - HRESULT hr = S_OK; - - CComPtr pFileReader(NULL); - - // - // Setup the SAX reader and extract the content types - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(pReadStream, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pWriteStream, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pPageProcessor, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pPtManager, E_POINTER)) && - SUCCEEDED(hr = m_pSaxRdr.CoCreateInstance(CLSID_SAXXMLReader60)) && - SUCCEEDED(hr = m_xpsArchive.GetFileStream(szContentTypes, &pFileReader)) && - SUCCEEDED(hr = m_pSaxRdr->putContentHandler(&m_contentTypes)) && - SUCCEEDED(hr = m_pSaxRdr->parse(CComVariant(pFileReader)))) - { - // - // We've got all the data we need - send it on - // - hr = m_xpsArchive.SendCurrentFile(); - } - - // - // Close the curent file ready for the next - // - m_xpsArchive.CloseCurrent(); - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CXPSProcessor::~CXPSProcessor - -Routine Description: - - CXPSProcessor class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CXPSProcessor::~CXPSProcessor() -{ -} - -/*++ - -Routine Name: - - CXPSProcessor::Start - -Routine Description: - - This routine kicks off the processing of the XPS archive struture. The - routine parses the Fixed Document Sequence mark-up to find the Fixed - Document parts, then parses the Fixed Document mark-up to find the Fixed - Page parts before passing these on to the Fixed Page processor. Additionally - the routine handles indentifying, processing and sending resources and part - relationships. Note: This limits the XPS document processing to only modifying - the fixed page data; the client is not presented the opportunity to modify any - other parts. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSProcessor::Start( - VOID - ) -{ - HRESULT hr = S_OK; - - try - { - // - // Get the start part list and iterate over all parts - // - FileList fixedDocumentSequenceParts; - if (SUCCEEDED(hr = GetFixedDocumentSequenceParts(&fixedDocumentSequenceParts))) - { - FileList::const_iterator iterFDS = fixedDocumentSequenceParts.begin(); - - for (; - iterFDS != fixedDocumentSequenceParts.end() && - SUCCEEDED(hr) && - SUCCEEDED(hr = ProcessRelsParts(*iterFDS, ContentFixedDocumentSequence)); - iterFDS++) - { - // - // Parse the start part retrieving the FD list - iterate over all FDs - // - FileList fixedDocumentParts; - if (SUCCEEDED(hr = GetFixedDocumentParts(*iterFDS, &fixedDocumentParts))) - { - FileList::const_iterator iterFD = fixedDocumentParts.begin(); - - for (; - iterFD != fixedDocumentParts.end() && - SUCCEEDED(hr) && - SUCCEEDED(hr = ProcessRelsParts(*iterFD, ContentFixedDocument)); - iterFD++) - { - // - // Parse the FD retrieving the FP list - iterate over all FPs - // - FileList fixedPageParts; - if (SUCCEEDED(hr = GetFixedPageParts(*iterFD, &fixedPageParts))) - { - FileList::const_iterator iterFP = fixedPageParts.begin(); - - for (; - iterFP != fixedPageParts.end() && - SUCCEEDED(hr) && - SUCCEEDED(hr = ProcessRelsParts(*iterFP, ContentFixedPage)); - iterFP++) - { - // - // Process the fixed page - this calls on to the IFixedPageProcessor - // interface for the client to do the work - // - hr = ProcessFixedPage(*iterFP); - } - } - } - } - } - } - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSProcessor::GetFixedDocumentSequenceParts - -Routine Description: - - This routine retrieves the Fixed Document Sequence from the root - relationships part. - -Arguments: - - pFixedDocumentSequencePartsList - List of fixed document sequences found to be populated - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSProcessor::GetFixedDocumentSequenceParts( - _Inout_ FileList* pFixedDocumentSequencePartsList - ) -{ - HRESULT hr = S_OK; - - // - // Extract the .rels part to find the start part - // - if (SUCCEEDED(hr = CHECK_POINTER(pFixedDocumentSequencePartsList, E_POINTER)) && - SUCCEEDED(hr = GetRelsForPart(""))) - { - CONST RelsTypeList* pRelsTypeList = NULL; - - hr = m_rels.GetRelsTypeList("", &pRelsTypeList); - - RelsTypeList::const_iterator iterRels = pRelsTypeList->begin(); - - for (;iterRels != pRelsTypeList->end() && SUCCEEDED(hr); iterRels++) - { - if (iterRels->second == RelsStartPart) - { - // - // We have a start part add it to the part list - // - pFixedDocumentSequencePartsList->push_back(iterRels->first); - } - else - { - // - // Send any other part on - // - if (SUCCEEDED(hr = m_xpsArchive.InitialiseFile(iterRels->first)) && - SUCCEEDED(hr = m_xpsArchive.SendCurrentFile())) - { - m_xpsArchive.CloseCurrent(); - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSProcessor::GetFixedDocumentParts - -Routine Description: - - This routine retrieves the list of fixed documents from the fixed document - sequence - -Arguments: - - szFixedDocSeq - The name of the FDS part to parse - pFixedDocumentParts - Pointer to the document list to be populated - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSProcessor::GetFixedDocumentParts( - _In_ PCSTR szFixedDocSeq, - _Out_ FileList* pFixedDocumentParts - ) -{ - HRESULT hr = S_OK; - CComPtr pFileReader(NULL); - - // - // Set up the fixed document sequence as the current file in the - // XPS archive and parse the file stream using the FDS SAX content - // handler to retrieve all fixed documents in the sequence - // - if (SUCCEEDED(hr = CHECK_POINTER(szFixedDocSeq, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pFixedDocumentParts, E_POINTER)) && - SUCCEEDED(hr = m_contentTypes.ValidateContentType(szFixedDocSeq, ContentFixedDocumentSequence)) && - SUCCEEDED(hr = m_xpsArchive.GetFileStream(szFixedDocSeq, &pFileReader)) && - SUCCEEDED(hr = m_fixedDocSeq.Clear()) && - SUCCEEDED(hr = m_pSaxRdr->putContentHandler(&m_fixedDocSeq)) && - SUCCEEDED(hr = m_pSaxRdr->parse(CComVariant(pFileReader))) && - SUCCEEDED(hr = m_fixedDocSeq.GetFixedDocumentList(pFixedDocumentParts))) - { - // - // We are done with the FDS - send it on - // - hr = m_xpsArchive.SendCurrentFile(); - } - - // - // Close the curent file ready for the next - // - m_xpsArchive.CloseCurrent(); - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSProcessor::GetFixedPageParts - -Routine Description: - - This routine retrieves the list of fixed pages from the Fixed Document - -Arguments: - - szFixedDoc - The name of the FD part to parse - pFixedPageParts - Pointer to the page list to be populated - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSProcessor::GetFixedPageParts( - _In_ PCSTR szFixedDoc, - _Out_ FileList* pFixedPageParts - ) -{ - HRESULT hr = S_OK; - CComPtr pFileReader(NULL); - - // - // Set up the fixed document as the current file in the XPS - // archive and parse the file stream using the FD SAX content - // handler to retrieve all fixed pages in the document - // - if (SUCCEEDED(hr = CHECK_POINTER(szFixedDoc, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pFixedPageParts, E_POINTER)) && - SUCCEEDED(hr = m_contentTypes.ValidateContentType(szFixedDoc, ContentFixedDocument)) && - SUCCEEDED(hr = m_xpsArchive.GetFileStream(szFixedDoc, &pFileReader)) && - SUCCEEDED(hr = m_fixedDoc.Clear()) && - SUCCEEDED(hr = m_pSaxRdr->putContentHandler(&m_fixedDoc)) && - SUCCEEDED(hr = m_pSaxRdr->parse(CComVariant(pFileReader))) && - SUCCEEDED(hr = m_fixedDoc.GetFixedPageList(pFixedPageParts))) - { - // - // We are done with the FD - send it on - // - hr = m_xpsArchive.SendCurrentFile(); - } - - // - // Close the curent file ready for the next - // - m_xpsArchive.CloseCurrent(); - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSProcessor::GetRelsForPart - -Routine Description: - - This routine retrieves and populates the rels object with the relationships - for the specified part - -Arguments: - - szPartName - The name of the part to retrieve the relationships for - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSProcessor::GetRelsForPart( - _In_ PCSTR szPartName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(szPartName, E_POINTER))) - { - try - { - CStringXDA cstrRelsPartName; - CComPtr pFileReader(NULL); - - // - // Construct the rels part from the parent part name and parse for - // relationships - // - if (SUCCEEDED(hr = MakeRelsPartName(szPartName, &cstrRelsPartName)) && - SUCCEEDED(hr = m_contentTypes.ValidateContentType(cstrRelsPartName, ContentRelationships)) && - SUCCEEDED(hr = m_xpsArchive.GetFileStream(cstrRelsPartName, &pFileReader)) && - SUCCEEDED(hr = m_pSaxRdr->putContentHandler(&m_rels)) && - SUCCEEDED(hr = m_rels.SetCurrentFileName(szPartName)) && - SUCCEEDED(hr = m_pSaxRdr->parse(CComVariant(pFileReader)))) - { - // - // We are done with the .rels part - send it on - // - hr = m_xpsArchive.SendCurrentFile(); - } - - // - // Close the curent file ready for the next - // - m_xpsArchive.CloseCurrent(); - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CXPSProcessor::MakeRelsPartName - -Routine Description: - - This routine converts a part name into the appropriate .rels name. - The rules for naming are: - rels parts are stored in a directory named _rels relative to the current part - rels parts always end in .rels - e.g. \Documents\FixedDoc.fdseq has rels part \Documents\_rels\FixedDoc.fdseq.rels - -Arguments: - - szPartName - The name of the part to be converted - pcstrRelsPartName - Pointer to a CStringXDA that recieves the new name - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSProcessor::MakeRelsPartName( - _In_ PCSTR szPartName, - _Out_ CStringXDA* pcstrRelsPartName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(szPartName, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcstrRelsPartName, E_POINTER))) - { - try - { - *pcstrRelsPartName = szPartName; - - // - // Find the slash that splits the directory and part name - // - INT cLastSlash = -1; - for (;;) - { - INT cSlash = pcstrRelsPartName->Find("/", cLastSlash + 1); - - if (cSlash != -1) - { - cLastSlash = cSlash; - } - else - { - break; - } - } - cLastSlash++; - - // - // Insert "_rels/" after the slash and append ".rels" - // - pcstrRelsPartName->Insert(cLastSlash, szRelsPre); - pcstrRelsPartName->Append(szRelsPost); - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSProcessor::ProcessRelsParts - -Routine Description: - - This routine processes the related parts for a given part - -Arguments: - - szPartName - The name of the part - eContentType - The type of the part to be processed. This must be either an FDS, FD or FP. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSProcessor::ProcessRelsParts( - _In_ PCSTR szPartName, - _In_ CONST EContentType eContentType - ) -{ - HRESULT hr = S_OK; - - BOOL bPrintTicketSent = FALSE; - - if (SUCCEEDED(hr = CHECK_POINTER(szPartName, E_POINTER))) - { - if (eContentType != ContentFixedDocumentSequence && - eContentType != ContentFixedDocument && - eContentType != ContentFixedPage) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - try - { - // - // Validate the part content type - // Get the rels and handle any print tickets - // - CONST RelsTypeList* pRelsTypeList; - if (SUCCEEDED(hr = m_contentTypes.ValidateContentType(szPartName, eContentType)) && - SUCCEEDED(hr = GetRelsForPart(szPartName)) && - SUCCEEDED(hr = m_rels.GetRelsTypeList(szPartName, &pRelsTypeList))) - { - - RelsTypeList::const_iterator iterRels = pRelsTypeList->begin(); - - for (;iterRels != pRelsTypeList->end() && SUCCEEDED(hr); iterRels++) - { - // - // Strip any leading "/" - // - CStringXDA cstrName(iterRels->first); - if (cstrName.GetAt(0) == '/') - { - cstrName.Delete(0); - } - - // - // The second of the pair in the RelsTypeList iterator is the rels type - // - switch (iterRels->second) - { - case RelsPrintTicket: - { - hr = AddPrintTicket(cstrName, eContentType); - bPrintTicketSent = TRUE; - } - break; - - case RelsAnnotations: - case RelsDigitalSignatureDefinitions: - case RelsDiscardControl: - case RelsDocumentStructure: - case RelsRequiredResource: - case RelsRestrictedFont: - case RelsStoryFragments: - case RelsCoreProperties: - case RelsDigitalSignature: - case RelsDigitalSignatureCertificate: - case RelsDigitalSignatureOrigin: - case RelsThumbnail: - { - // - // We are not interested in the content so intialise the current - // file in the XPS archive and send it on - // - if (SUCCEEDED(hr = m_xpsArchive.InitialiseFile(cstrName))) - { - hr = m_xpsArchive.SendCurrentFile(); - } - } - break; - - default: - { - ERR("Unrecognised rels part\n"); - - hr = E_FAIL; - } - break; - } - - // - // Close the current file ready for the next - // - m_xpsArchive.CloseCurrent(); - } - } - else if (hr == E_ELEMENT_NOT_FOUND) - { - // - // There is no PrintTicket - // - hr = S_OK; - } - - // - // No print ticket has been sent so just inform the print ticket - // manager that a suitable ticket needs to be set for this level - // - if (bPrintTicketSent == FALSE) - { - switch (eContentType) - { - case ContentFixedPage: - { - hr = m_pPtManager->SetTicket(kPTPageScope, NULL); - } - break; - case ContentFixedDocument: - { - hr = m_pPtManager->SetTicket(kPTDocumentScope, NULL); - } - break; - case ContentFixedDocumentSequence: - { - hr = m_pPtManager->SetTicket(kPTJobScope, NULL); - } - break; - default: - { - hr = ERROR_NOT_SUPPORTED; - } - break; - } - } - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSProcessor::AddPrintTicket - -Routine Description: - - This routine retrieves the PrintTicket information and updates the PrintTicket - manager at the appropriate scope - -Arguments: - - szPTPartName - The part name for the PrintTicket - eContentType - The type of the containing part. This must be either an FDS, FD or FP. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSProcessor::AddPrintTicket( - _In_ PCSTR szPTPartName, - _In_ CONST EContentType eContentType - ) -{ - HRESULT hr = S_OK; - - // - // Validate the parameters - // - if (SUCCEEDED(hr = CHECK_POINTER(szPTPartName, E_POINTER))) - { - if (eContentType != ContentFixedDocumentSequence && - eContentType != ContentFixedDocument && - eContentType != ContentFixedPage) - { - hr = E_INVALIDARG; - } - } - - // - // Extract the PrintTicket from the current file in the XPS archive - // and pass to the PrinTicket manager at the appropriate scope - // - CComPtr pFileReader(NULL); - CComPtr pPT(NULL); - - VARIANT_BOOL fLoaded = VARIANT_FALSE; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = m_xpsArchive.GetFileStream(szPTPartName, &pFileReader)) && - SUCCEEDED(hr = pPT.CoCreateInstance(CLSID_DOMDocument60)) && - SUCCEEDED(hr = pPT->load(CComVariant(pFileReader), &fLoaded))) - { - if (fLoaded == VARIANT_TRUE) - { - // - // Determine the scope from the parent parts content type - // - EPrintTicketScope ePTScope = kPTPageScope; - - if (eContentType == ContentFixedDocumentSequence) - { - ePTScope = kPTJobScope; - } - else if (eContentType == ContentFixedDocument) - { - ePTScope = kPTDocumentScope; - } - - if (SUCCEEDED(hr = m_pPtManager->SetTicket(ePTScope, pPT))) - { - // - // Make sure the PrintTicket is passed on - // - hr = m_xpsArchive.SendCurrentFile(); - } - } - else - { - ERR("Failed to load PT\n"); - - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXPSProcessor::AddPrintTicket - -Routine Description: - - This routine intialises the appropriate read and write streams for a fixed - page processor and calls the processor to do the work - -Arguments: - - szFPPartName - The name of the FixedPage part - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXPSProcessor::ProcessFixedPage( - _In_ PCSTR szFPPartName - ) -{ - HRESULT hr = S_OK; - // - // Retrieve the file stream and pass to the page scaling handler - // - CComPtr pFileReader(NULL); - CXPSWriteFile* pXpsWriteFile = new(std::nothrow) CXPSWriteFile(szFPPartName); - - IXMLDOMDocument2* pPT = NULL; - - if (SUCCEEDED(hr = CHECK_POINTER(pXpsWriteFile, E_OUTOFMEMORY)) && - SUCCEEDED(hr = CHECK_POINTER(m_pPageProcessor, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(szFPPartName, E_PENDING)) && - SUCCEEDED(hr = m_xpsArchive.GetFileStream(szFPPartName, &pFileReader)) && - SUCCEEDED(hr = m_pPtManager->GetTicket(kPTPageScope, &pPT)) && - SUCCEEDED(hr = CHECK_POINTER(pPT, E_FAIL)) && - SUCCEEDED(hr = m_pPageProcessor->ProcessFixedPage(pPT, pFileReader, pXpsWriteFile))) - { - // - // Send the new fixed page - // - ULONG cb = 0; - PVOID pv = NULL; - - if (SUCCEEDED(hr = pXpsWriteFile->GetBuffer(&pv, &cb))) - { - hr = m_xpsArchive.SendFile(szFPPartName, pv, cb, CompDeflated); - } - } - else if (hr == HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED)) - { - // - // The page processor does not want to do any work - just send the page - // - hr = m_xpsArchive.SendCurrentFile(); - } - - if (pXpsWriteFile != NULL) - { - delete pXpsWriteFile; - pXpsWriteFile = NULL; - } - - // - // Close the current file ready for the next - // - m_xpsArchive.CloseCurrent(); - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpsproc.h b/print/XPSDrvSmpl/src/filters/xdcont/xpsproc.h deleted file mode 100644 index 70b08ec6..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpsproc.h +++ /dev/null @@ -1,137 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpsproc.h - -Abstract: - - Definition of the XPS processor. This class is responsible for handling - the logical document and page structure of the XPS container. The class starts - with the content types part and .rels part to find the Fixed Document Sequence. - It then parses the FDS to find the Fixed Documents and finally the FDs to find - each Fixed Page. Each fixed page is then reported to a client FixedPageProcessor - to interpret the mark-up and write out modifications as required. The class is - additionally responsible for ensuring all XPS parts and accompanying resources are - sent on to the PK archive handler to be written out. - ---*/ - -#pragma once - -#include "xps.h" -#include "xpsarch.h" -#include "xpstype.h" -#include "xpsrels.h" -#include "xpsfds.h" -#include "xpsfd.h" -#include "ptmanage.h" - -class IFixedPageProcessor -{ -public: - IFixedPageProcessor(){} - - virtual ~IFixedPageProcessor(){} - - virtual HRESULT - ProcessFixedPage( - _In_ IXMLDOMDocument2* pFPPT, - _In_ ISequentialStream* pPageReadStream, - _Out_ ISequentialStream* pPageWriteStream - ) = 0; -}; - -class CXPSProcessor -{ -public: - CXPSProcessor( - _In_ IPrintReadStream* pReadStream, - _In_ IPrintWriteStream* pWriteStream, - _In_ IFixedPageProcessor* pPageProcessor, - _In_ IPrintPipelinePropertyBag* pPropertyBag, - _In_ CPTManager* pPtManager - ); - - virtual ~CXPSProcessor(); - - HRESULT - Start( - VOID - ); - -private: - HRESULT - GetFixedDocumentSequenceParts( - _Inout_ FileList* pFixedDocumentSequenceParts - ); - - HRESULT - GetFixedDocumentParts( - _In_ PCSTR szFixedDocSeq, - _Out_ FileList* pFixedDocumentParts - ); - - HRESULT - GetFixedPageParts( - _In_ PCSTR szFixedDoc, - _Out_ FileList* pFixedPageParts - ); - - HRESULT - GetRelsForPart( - _In_ PCSTR szPartName - ); - - HRESULT - MakeRelsPartName( - _In_ PCSTR szPartName, - _Out_ CStringXDA* pcstrRelsPartName - ); - - HRESULT - ProcessRelsParts( - _In_ PCSTR szPartName, - _In_ CONST EContentType contentType - ); - - HRESULT - AddPrintTicket( - _In_ PCSTR szPartName, - _In_ CONST EContentType eContentType - ); - - HRESULT - ProcessFixedPage( - _In_ PCSTR szPartName - ); - -private: - CXPSArchive m_xpsArchive; - - CContentTypes m_contentTypes; - - CRels m_rels; - - CFixedDocumentSequence m_fixedDocSeq; - - CFixedDocument m_fixedDoc; - - CComPtr m_pSaxRdr; - - IFixedPageProcessor* m_pPageProcessor; - - CPTManager* m_pPtManager; - - CComPtr m_pPrintPropertyBag; -}; - diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpsrels.cpp b/print/XPSDrvSmpl/src/filters/xdcont/xpsrels.cpp deleted file mode 100644 index 8bb8fed8..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpsrels.cpp +++ /dev/null @@ -1,419 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpsrels.cpp - -Abstract: - - Implementation of the XPS rels part SAX handler. This class is responsible - for retrieving all the rels parts for a particular rels file and storing - them for access by the XPS processor. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "xpsrels.h" - -static PCSTR szRelationship = "Relationship"; -static PCSTR szTarget = "Target"; -static PCSTR szType = "Type"; - -static PCSTR szRels[ERelsTypeMax] = { - "http://schemas.microsoft.com/xps/2005/06/annotations", - "http://schemas.microsoft.com/xps/2005/06/signature-definitions", - "http://schemas.microsoft.com/xps/2005/06/discard-control", - "http://schemas.microsoft.com/xps/2005/06/documentstructure", - "http://schemas.microsoft.com/xps/2005/06/printticket", - "http://schemas.microsoft.com/xps/2005/06/required-resource", - "http://schemas.microsoft.com/xps/2005/06/restricted-font", - "http://schemas.microsoft.com/xps/2005/06/fixedrepresentation", - "http://schemas.microsoft.com/xps/2005/06/storyfragments", - "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties", - "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature", - "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/certificate", - "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin", - "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail", -}; - -/*++ - -Routine Name: - - CRels::CRels - -Routine Description: - - CRels class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CRels::CRels() -{ -} - -/*++ - -Routine Name: - - CRels::~CRels - -Routine Description: - - CRels class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CRels::~CRels() -{ -} - -/*++ - -Routine Name: - - CRels::startElement - -Routine Description: - - This routine is the startElement method of the SAX handler. This is used - to parse a relationships part mark-up retrieving and storing the list of - relationships - -Arguments: - - pwchNamespaceUri - Unused: Local namespace URI - cchNamespaceUri - Unused: Length of the namespace URI - pwchLocalName - Unused: Local name string - cchLocalName - Unused: Length of the local name string - pwchQName - The qualified name with prefix - cchQName - The length of the qualified name with prefix - pAttributes - Pointer to the ISAXAttributes interface containing attributes attached to the element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CRels::startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pwchQName, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pAttributes, E_POINTER))) - { - if (cchQName <= 0) - { - hr = E_INVALIDARG; - } - } - - try - { - CStringXDA cstrElementName(pwchQName, cchQName); - - if (SUCCEEDED(hr) && - cstrElementName == szRelationship) - { - CStringXDA cstrTargetName; - CStringXDA cstrRelsType; - - INT cAttributes = 0; - - if (SUCCEEDED(hr)) - { - hr = pAttributes->getLength(&cAttributes); - } - - // - // Run over all attributes identifying part names and part types - // - for (INT cIndex = 0; cIndex < cAttributes && SUCCEEDED(hr); cIndex++) - { - PCWSTR pszAttUri = NULL; - INT cchAttUri = 0; - PCWSTR pszAttName = NULL; - INT cchAttName = 0; - PCWSTR pszAttQName = NULL; - INT cchAttQName = 0; - PCWSTR pszAttValue = NULL; - INT cchAttValue = 0; - - // - // Get the attribute data ready to write out - // - if (SUCCEEDED(hr = pAttributes->getName(cIndex, &pszAttUri, &cchAttUri, &pszAttName, &cchAttName, &pszAttQName, &cchAttQName)) && - SUCCEEDED(hr = pAttributes->getValue(cIndex, &pszAttValue, &cchAttValue))) - { - CStringXDA cstrAttName(pszAttQName, cchAttQName); - CStringXDA cstrAttValue(pszAttValue, cchAttValue); - - if (cstrAttName == szTarget) - { - cstrTargetName = cstrAttValue; - } - else if (cstrAttName == szType) - { - cstrRelsType = cstrAttValue; - } - } - } - - if (cstrTargetName.GetLength() > 0) - { - if (cstrRelsType.GetLength() > 0) - { - ERelsType relsType; - if (SUCCEEDED(hr = GetRelsTypeFromString(cstrRelsType, &relsType))) - { - // - // Strip any leading "/" - // - if (cstrTargetName.GetAt(0) == '/') - { - cstrTargetName.Delete(0); - } - - try - { - m_relsMap[m_cstrCurrentFileName].push_back(RelsNameType(cstrTargetName, relsType)); - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - } - else - { - RIP("Target name identified with no corresponding type\n"); - - hr = E_FAIL; - } - } - } - } - catch (CXDException& e) - { - hr = e; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CRels::SetCurrentFileName - -Routine Description: - - This routine sets the filename of the part for which the relationships - are being identified - -Arguments: - - szFileName - The name of the XPS part - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CRels::SetCurrentFileName( - _In_ PCSTR szFileName - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(szFileName, E_POINTER))) - { - try - { - m_cstrCurrentFileName = szFileName; - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CRels::GetRelsTypeList - -Routine Description: - - This routine retrieves the list of the relationships for the specified - part name - -Arguments: - - szFileName - The name of the XPS part to retrieve the relationships list for - ppFileList - Pointer to a RelsTypeList pointer that recieves the relationships list - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CRels::GetRelsTypeList( - _In_ PCSTR szFileName, - _Outptr_ CONST RelsTypeList** ppFileList - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppFileList, E_POINTER))) - { - try - { - RelsMap::const_iterator iterRels = m_relsMap.find(szFileName); - if (iterRels != m_relsMap.end()) - { - *ppFileList = &(iterRels->second); - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_NOT_FOUND); - } - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CRels::GetRelsTypeFromString - -Routine Description: - - This routine retrieves the relationship enumeration defining the type from the - relationships string defining the type - -Arguments: - - cstrRelsType - The string defining the rels type - pRelsType - Pointer to the rels type that recieves the type - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CRels::GetRelsTypeFromString( - _In_ CONST CStringXDA& cstrRelsType, - _Out_ ERelsType* pRelsType - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pRelsType, E_POINTER))) - { - *pRelsType = RelsUnknown; - - try - { - if (cstrRelsType.GetLength() > 0) - { - for (ERelsType relsType = ERelsTypeMin; - relsType < ERelsTypeMax; - relsType = static_cast(relsType + 1)) - { - if (cstrRelsType.CompareNoCase(szRels[relsType]) == 0) - { - *pRelsType = relsType; - break; - } - } - - if (*pRelsType == RelsUnknown) - { - ERR("Unrecognized relationships type string.\n"); - - hr = E_FAIL; - } - } - else - { - hr = E_INVALIDARG; - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpsrels.h b/print/XPSDrvSmpl/src/filters/xdcont/xpsrels.h deleted file mode 100644 index 29ee4a9c..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpsrels.h +++ /dev/null @@ -1,70 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpsrels.h - -Abstract: - - Definition of the XPS rels part SAX handler. This class is responsible - for retrieving all the rels parts for a particular rels file and storing - them for access by the XPS processor. - ---*/ - -#pragma once - -#include "saxhndlr.h" -#include "xps.h" - -class CRels : public CSaxHandler -{ -public: - CRels(); - - virtual ~CRels(); - - virtual HRESULT STDMETHODCALLTYPE - startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ); - - HRESULT - GetRelsTypeList( - _In_ PCSTR szFileName, - _Outptr_ CONST RelsTypeList** ppFileList - ); - - HRESULT - SetCurrentFileName( - _In_ PCSTR szFileName - ); - -private: - HRESULT - GetRelsTypeFromString( - _In_ CONST CStringXDA& cstrRelsType, - _Out_ ERelsType* pRelsType - ); - -private: - RelsMap m_relsMap; - - CStringXDA m_cstrCurrentFileName; -}; - diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpstype.cpp b/print/XPSDrvSmpl/src/filters/xdcont/xpstype.cpp deleted file mode 100644 index 35dca7cf..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpstype.cpp +++ /dev/null @@ -1,417 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpstype.cpp - -Abstract: - - Implementation of the XPS content type part SAX handler. This class is responsible - for retrieving all the content types information and storing them for access by the - XPS processor. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "xpstype.h" - -static PCSTR szCTOverride = "Override"; -static PCSTR szCTPartName = "PartName"; -static PCSTR szCTContentType = "ContentType"; -static PCSTR szCTDefault = "Default"; -static PCSTR szCTExtension = "Extension"; - -static PCSTR szContentType[EContentTypeMax] = { - "application/vnd.ms-package.xps-fixeddocumentsequence+xml", - "application/vnd.ms-package.xps-fixeddocument+xml", - "application/vnd.ms-package.xps-fixedpage+xml", - "application/vnd.ms-package.xps-discard-control+xml", - "application/vnd.ms-package.xps-documentstructure+xml", - "application/vnd.ms-opentype", - "application/vnd.ms-color.iccprofile", - "application/vnd.ms-package.obfuscated-opentype", - "application/vnd.ms-printing.printticket+xml", - "application/vnd.ms-package.xps-resourcedictionary+xml", - "application/vnd.ms-package.xps-storyfragments+xml", - "image/jpeg", - "image/png", - "image/tiff", - "image/vnd.ms-photo", - "application/vnd.openxmlformats-package.core-properties+xml", - "application/vnd.openxmlformats-package.digital-signature-certificate", - "application/vnd.openxmlformats-package.digital-signature-origin", - "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml", - "application/vnd.openxmlformats-package.relationships+xml", -}; - -/*++ - -Routine Name: - - CContentTypes::CContentTypes - -Routine Description: - - CContentTypes class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CContentTypes::CContentTypes() -{ -} - -/*++ - -Routine Name: - - CContentTypes::~CContentTypes - -Routine Description: - - CContentTypes class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CContentTypes::~CContentTypes() -{ -} - -/*++ - -Routine Name: - - CContentTypes::startElement - -Routine Description: - - This routine is the startElement method of the SAX handler. This is used - to parse the content types part mark-up retrieving and storing the list of - content types - -Arguments: - - pwchNamespaceUri - Unused: Local namespace URI - cchNamespaceUri - Unused: Length of the namespace URI - pwchLocalName - Unused: Local name string - cchLocalName - Unused: Length of the local name string - pwchQName - The qualified name with prefix - cchQName - The length of the qualified name with prefix - pAttributes - Pointer to the ISAXAttributes interface containing attributes attached to the element - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CContentTypes::startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pwchQName, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pAttributes, E_POINTER))) - { - if (cchQName <= 0) - { - hr = E_INVALIDARG; - } - } - - try - { - CStringXDA cstrElementName(pwchQName, cchQName); - - if (cstrElementName == szCTOverride || - cstrElementName == szCTDefault) - { - CStringXDA cstrPartName; - CStringXDA cstrPartType; - - INT cAttributes = 0; - - if (SUCCEEDED(hr)) - { - hr = pAttributes->getLength(&cAttributes); - } - - // - // Run over all attributes identifying part names and part types - // - for (INT cIndex = 0; cIndex < cAttributes && SUCCEEDED(hr); cIndex++) - { - PCWSTR pszAttUri = NULL; - INT cchAttUri = 0; - PCWSTR pszAttName = NULL; - INT cchAttName = 0; - PCWSTR pszAttQName = NULL; - INT cchAttQName = 0; - PCWSTR pszAttValue = NULL; - INT cchAttValue = 0; - - // - // Get the attribute data ready to write out - // - if (SUCCEEDED(hr = pAttributes->getName(cIndex, &pszAttUri, &cchAttUri, &pszAttName, &cchAttName, &pszAttQName, &cchAttQName)) && - SUCCEEDED(hr = pAttributes->getValue(cIndex, &pszAttValue, &cchAttValue))) - { - CStringXDA cstrAttName(pszAttQName, cchAttQName); - CStringXDA cstrAttValue(pszAttValue, cchAttValue); - - if (cstrAttName == szCTPartName || - cstrAttName == szCTExtension) - { - cstrPartName = cstrAttValue; - } - else if (cstrAttName == szCTContentType) - { - cstrPartType = cstrAttValue; - } - } - } - - if (cstrPartName.GetLength() > 0) - { - if (cstrPartType.GetLength() > 0) - { - EContentType contentType; - if (SUCCEEDED(hr = GetContentTypeFromString(cstrPartType, &contentType))) - { - // - // Strip any leading "/" - // - if (cstrPartName.GetAt(0) == '/') - { - cstrPartName.Delete(0); - } - - try - { - m_contentMap[cstrPartName] = contentType; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - } - else - { - RIP("Part name identified with no corresponding type\n"); - - hr = E_FAIL; - } - } - } - } - catch (CXDException& e) - { - hr = e; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CContentTypes::ValidateContentType - -Routine Description: - - This routine validates a part against a content type - -Arguments: - - szPartName - The name of the XPS part - contentType - The content type to validate against - -Return Value: - - HRESULT - S_OK - On success - E_ELEMENT_NOT_FOUND - When the part is not present - E_* - On error - ---*/ -HRESULT -CContentTypes::ValidateContentType( - _In_ PCSTR szPartName, - _In_ CONST EContentType contentType - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(szPartName, E_POINTER))) - { - try - { - CStringXDA cstrPartName(szPartName); - - if (cstrPartName.GetLength() > 0) - { - // - // Check if the content type is defined for the full part name - // - ContentMap::const_iterator iterContents = m_contentMap.find(cstrPartName); - if (iterContents == m_contentMap.end()) - { - // - // Check if the type is defined by the extension - // - CStringXDA partExt(PathFindExtensionA(cstrPartName)); - - // - // Strip any leading "/" - // - if (partExt.GetAt(0) == '/') - { - partExt.Delete(0); - } - - iterContents = m_contentMap.find(partExt); - } - - if (iterContents != m_contentMap.end()) - { - if (contentType != iterContents->second) - { - hr = E_FAIL; - } - } - else - { - hr = E_ELEMENT_NOT_FOUND; - } - } - else - { - hr = E_INVALIDARG; - } - } - catch (CXDException& e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR_EXC(hr, E_ELEMENT_NOT_FOUND); - return hr; -} - -/*++ - -Routine Name: - - CContentTypes::GetContentTypeFromString - -Routine Description: - - This routine retrieves the content type enumeration defining the type from the - content type string defining the type - -Arguments: - - cstrPartType - The string defining the content type - pContentType - Pointer to the content type that recieves the type - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CContentTypes::GetContentTypeFromString( - _In_ CONST CStringXDA& cstrPartType, - _Out_ EContentType* pContentType - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pContentType, E_POINTER))) - { - *pContentType = ContentUnknown; - - try - { - if (cstrPartType.GetLength() > 0) - { - for (EContentType contentType = EContentTypeMin; - contentType < EContentTypeMax; - contentType = static_cast(contentType + 1)) - { - if (cstrPartType.CompareNoCase(szContentType[contentType]) == 0) - { - *pContentType = contentType; - break; - } - } - - if (*pContentType == ContentUnknown) - { - ERR("Unrecognized content type string.\n"); - - hr = E_FAIL; - } - } - else - { - hr = E_INVALIDARG; - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/filters/xdcont/xpstype.h b/print/XPSDrvSmpl/src/filters/xdcont/xpstype.h deleted file mode 100644 index 0a5b5b06..00000000 --- a/print/XPSDrvSmpl/src/filters/xdcont/xpstype.h +++ /dev/null @@ -1,63 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xpstype.h - -Abstract: - - Definition of the XPS content type part SAX handler. This class is responsible - for retrieving all the content types information and storing them for access by the - XPS processor. - ---*/ - -#pragma once - -#include "saxhndlr.h" -#include "xps.h" - -class CContentTypes : public CSaxHandler -{ -public: - CContentTypes(); - - virtual ~CContentTypes(); - - virtual HRESULT STDMETHODCALLTYPE - startElement( - CONST wchar_t*, - INT, - CONST wchar_t*, - INT, - _In_reads_(cchQName) CONST wchar_t* pwchQName, - _In_ INT cchQName, - _In_ ISAXAttributes* pAttributes - ); - - HRESULT - ValidateContentType( - _In_ PCSTR szPartName, - _In_ CONST EContentType contentType - ); - -private: - HRESULT - GetContentTypeFromString( - _In_ CONST CStringXDA& cstrPartType, - _Out_ EContentType* pContentType - ); - -private: - ContentMap m_contentMap; -}; - diff --git a/print/XPSDrvSmpl/src/inc/cunknown.h b/print/XPSDrvSmpl/src/inc/cunknown.h deleted file mode 100644 index c7cceff0..00000000 --- a/print/XPSDrvSmpl/src/inc/cunknown.h +++ /dev/null @@ -1,212 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - cunknown.h - -Abstract: - - Provides a simple template implementation for classes that need to - implement IUnknown. - ---*/ - -#pragma once - -template -class CUnknown : public _T -{ -public: - /*++ - - Routine Name: - - CUnknown - - Routine Description: - - CUnknown class constructor - - Arguments: - - IIDTarget - The target interface guid - - Return Value: - - None - - --*/ - CUnknown( - REFIID IIDTarget - ) : - m_IIDTarget(IIDTarget), - m_cRef(1) - { - } - - /*++ - - Routine Name: - - ~CUnknown - - Routine Description: - - CUnknown class destructor - - Arguments: - - None - - Return Value: - - None - - --*/ - virtual ~CUnknown() - { - } - - // - // IUnknown methods - // - /*++ - - Routine Name: - - QueryInterface - - Routine Description: - - This routine implements the IUnknown::QueryInterface method. Returns the raw interface - pointer for the requested IID if it matches the target IID - - Arguments: - - riid - The IID of the requested interface - ppv - The raw interface pointer - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - virtual HRESULT STDMETHODCALLTYPE - QueryInterface( - REFIID riid, - _Out_ PVOID* ppv - ) - { - HRESULT hr = S_OK; - - if (ppv != NULL) - { - if (riid == IID_IUnknown || - riid == m_IIDTarget) - { - *ppv = static_cast<_T*>(this); - } - else - { - *ppv = NULL; - - hr = E_NOINTERFACE; - } - } - else - { - hr = E_POINTER; - } - - if (SUCCEEDED(hr)) - { - AddRef(); - } - - return hr; - } - - /*++ - - Routine Name: - - AddRef - - Routine Description: - - This routine increments the reference count on the current interface - - Arguments: - - None - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - virtual ULONG STDMETHODCALLTYPE - AddRef() - { - return InterlockedIncrement(&m_cRef); - } - - /*++ - - Routine Name: - - Release - - Routine Description: - - This routine decrements the reference count on the current interface - - Arguments: - - None - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - Notes: - - The drv_at annotation tells Prefast to consider this object's memory - freed after Release has been called. - - --*/ - virtual - ULONG STDMETHODCALLTYPE - Release() - { - ULONG cRef = InterlockedDecrement(&m_cRef); - - if (0 == cRef) - { - delete this; - } - - return cRef; - } - -private: - LONG m_cRef; - - IID m_IIDTarget; -}; - diff --git a/print/XPSDrvSmpl/src/inc/gdip.h b/print/XPSDrvSmpl/src/inc/gdip.h deleted file mode 100644 index 923c3430..00000000 --- a/print/XPSDrvSmpl/src/inc/gdip.h +++ /dev/null @@ -1,121 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - gdip.h - -Abstract: - - Provides a wrapper class around GDIPlus that takes care of intialisation - and shutdown. A class only need define this as a member variable to use - GDIPlus - intialisation and shutdown are handled during construction and - destruction. - -Known issues: - - The class does not yet implement debug event handling. - ---*/ - -#pragma once - -class GDIPlus -{ -public: - /*++ - - Routine Name: - - GDIPlus - - Routine Description: - - GDIPlus class constructor - - Arguments: - - None - - Return Value: - - None - - --*/ - GDIPlus() : - m_pGDIPlusToken(NULL), - m_GDIPlusStartStatus(GdiplusNotInitialized) - { - GdiplusStartupInput gdiPlusStartInput; - - m_GDIPlusStartStatus = GdiplusStartup(&m_pGDIPlusToken, &gdiPlusStartInput, NULL); - } - - /*++ - - Routine Name: - - ~GDIPlus - - Routine Description: - - GDIPlus class destructor - - Arguments: - - None - - Return Value: - - None - - --*/ - virtual ~GDIPlus() - { - GdiplusShutdown(m_pGDIPlusToken); - m_pGDIPlusToken = NULL; - m_GDIPlusStartStatus = GdiplusNotInitialized; - } - - /*++ - - Routine Name: - - GetGDIPlusStartStatus - - Routine Description: - - This routine returns the start status of GDI Plus - - Arguments: - - None - - Return Value: - - Gdiplus::Status - Ok - On success - Gdiplus error - On Error - - --*/ - Status GetGDIPlusStartStatus( - VOID - ) - { - return m_GDIPlusStartStatus; - } - -private: - ULONG_PTR m_pGDIPlusToken; - - Status m_GDIPlusStartStatus; -}; - diff --git a/print/XPSDrvSmpl/src/inc/ipkarch.h b/print/XPSDrvSmpl/src/inc/ipkarch.h deleted file mode 100644 index 7721a2db..00000000 --- a/print/XPSDrvSmpl/src/inc/ipkarch.h +++ /dev/null @@ -1,230 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - ipkarch.h - -Abstract: - - Definition of the interface supported by the PK archive handling module. - ---*/ - -#pragma once - -#include "ipkfile.h" - -// -// {5A0F4115-D4D3-401e-8071-A440D6D07092} -// -DEFINE_GUID(CLSID_PKArchiveHandler, 0x5a0f4115, 0xd4d3, 0x401e, 0x80, 0x71, 0xa4, 0x40, 0xd6, 0xd0, 0x70, 0x92); - -// -// {BDBBDF56-C742-4efd-8075-AF2C7B247F38} -// -DEFINE_GUID(IID_IPKArchive, 0xbdbbdf56, 0xc742, 0x4efd, 0x80, 0x75, 0xaf, 0x2c, 0x7b, 0x24, 0x7f, 0x38); - - -typedef map NameIndex; - -class IPKArchive : public IUnknown -{ -public: - /*++ - - Routine Name: - - SetReadStream - - Routine Description: - - This routine sets the read stream for the PK archive handler - - Arguments: - - pReadStream - Pointer to the print read stream interface - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT - virtual SetReadStream( - _In_ IPrintReadStream* pReadStream - ) = 0; - - /*++ - - Routine Name: - - SetWriteStream - - Routine Description: - - This routine sets the write stream for the PK archive handler - - Arguments: - - pWriteStream - Pointer to the print write stream interface - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT - virtual SetWriteStream( - _In_ IPrintWriteStream* pWriteStream - ) = 0; - - /*++ - - Routine Name: - - ProcessReadStream - - Routine Description: - - This method instructs the PK archive handler to process the PK archive for all records - - Arguments: - - None - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT - virtual ProcessReadStream( - VOID - ) = 0; - - /*++ - - Routine Name: - - GetNameIndex - - Routine Description: - - This routine retrieves the archives indexed by name - - Arguments: - - ppNameIdx - Pointer to a NameIndex pointer that recieves the archive index - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT - virtual GetNameIndex( - _Outptr_ NameIndex** ppNameIdx - ) = 0; - - /*++ - - Routine Name: - - SendFile - - Routine Description: - - This routine sends the PK file to the write stream - - Arguments: - - pFile - Pointer to the IPKFile to be sent to the write stream - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT - virtual SendFile( - _In_ CONST IPKFile* pFile - ) = 0; - - /*++ - - Routine Name: - - SendFile - - Routine Description: - - This routine compresses and sends a buffer as a PK archive to the write stream - - Arguments: - - szFileName - The name of the archive to be created - pBuffer - The buffer containing the uncompressed archive data - cbBuffer - The size of the uncompressed archive data - compressionType - The type of compression to be used (only CompNone and CompDeflated are supported) - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT - virtual SendFile( - _In_z_ PCSTR szFileName, - _In_reads_bytes_(cbBuffer) PVOID pBuffer, - ULONG cbBuffer, - ECompressionType eCompType - ) = 0; - - /*++ - - Routine Name: - - Close - - Routine Description: - - This routine closes and finalises the PK archive - - Arguments: - - None - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT - virtual Close( - VOID - ) = 0; -}; - diff --git a/print/XPSDrvSmpl/src/inc/ipkfile.h b/print/XPSDrvSmpl/src/inc/ipkfile.h deleted file mode 100644 index 184b194c..00000000 --- a/print/XPSDrvSmpl/src/inc/ipkfile.h +++ /dev/null @@ -1,128 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - ipkfile.h - -Abstract: - - Definition of the PK file interface supported by the PK archive handling module. - ---*/ - -#pragma once - -// -// All compression types added for completeness. Only CompNone and -// CompDeflated are correctly supported. -// -enum ECompressionType -{ - CompNone = 0, - CompShrunk, - CompFactor1, - CompFactor2, - CompFactor3, - CompFactor4, - CompImploded, - CompTokenized, - CompDeflated, - CompDefalted64, - CompPKImploded, - CompPKReserved, - CompBZIP2 -}; - -class IPKFile -{ -public: - /*++ - - Routine Name: - - GetCompressionMethod - - Routine Description: - - This method returns the current compression methof for the archive file - - Arguments: - - pCompType - Pointer to the ECompressionType enumeration that recieves the compression type - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - virtual HRESULT - GetCompressionMethod( - _Out_ ECompressionType* peCompType - ) CONST = 0; - - /*++ - - Routine Name: - - GetDecompressedSize - - Routine Description: - - This routine retrieves the size of the uncompressed archive file - - Arguments: - - pcbUnCompressed - Pointer to a ULONG that recieves the decompressed data size - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - virtual HRESULT - GetDecompressedSize( - _Out_ ULONG* pcbUnCompressed - ) CONST = 0; - - /*++ - - Routine Name: - - DecompressTo - - Routine Description: - - This routine decompresses the archive file data to the buffer passed - - Arguments: - - pDecompBuffer - Pointer to the buffer to be filled with decompressed data - cbDecompBuffer - Size of the decompresssion buffer passed - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - virtual HRESULT - DecompressTo( - _Out_writes_bytes_(cbDecompBuffer) PVOID pDecompBuffer, - ULONG cbDecompBuffer - ) CONST = 0; -}; - diff --git a/print/XPSDrvSmpl/src/inc/streamcnv.h b/print/XPSDrvSmpl/src/inc/streamcnv.h deleted file mode 100644 index 2877073f..00000000 --- a/print/XPSDrvSmpl/src/inc/streamcnv.h +++ /dev/null @@ -1,593 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - streamcnv.h - -Abstract: - - This wrapper class presents an IStream interface to an IPrintReadStream object. - This is useful for where an IStream interface is required for an API but is not - available without creating a seperate buffer and copying data in, e.g. decoding - bitmap data in WIC. This is not appropriate for use with interfaces that write - back into the stream. - ---*/ - -#pragma once - -#include "cunknown.h" - -class CPrintReadStreamToIStream : public CUnknown -{ -public: - /*++ - - Routine Name: - - CPrintReadStreamToIStream - - Routine Description: - - CPrintReadStreamToIStream constructor - - Arguments: - - pReadStream - the print read stream to wrap with an IStream interface - - Return Value: - - None - - --*/ - CPrintReadStreamToIStream( - _In_ IPrintReadStream* pReadStream - ) : - CUnknown(IID_IStream), - m_pReadStream(pReadStream) - { - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CoFileTimeNow(&m_mTime)) && - SUCCEEDED(hr = CoFileTimeNow(&m_cTime)) && - SUCCEEDED(hr = CoFileTimeNow(&m_aTime))) - { - m_cbStream.QuadPart = 0; - if (m_pReadStream == NULL) - { - hr = E_POINTER; - } - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } - } - - /*++ - - Routine Name: - - ~CPrintReadStreamToIStream - - Routine Description: - - CPrintReadStreamToIStream destructor - - Arguments: - - None - - Return Value: - - None - - --*/ - virtual ~CPrintReadStreamToIStream() - { - } - - // - // ISequentialStream methods - // - /*++ - - Routine Name: - - Read - - Routine Description: - - Implements IStream::Read by calling on to IPrintReadStream::ReadBytes - - Arguments: - - pv - Pointer to the buffer to read into - cb - Count of bytes avaiable in the buffer pointed to by pv - pcbRead - pointer to a ULONG that recieves the count of bytes actually read - - Return Value: - - HRESULT - S_OK - On success and *pcbRead == cb - S_FALSE - On success and *pcbRead < cb - E_* - On error - - --*/ - HRESULT STDMETHODCALLTYPE - Read( - _Out_writes_bytes_to_(cb, *pcbRead) PVOID pv, - _In_ ULONG cb, - _Out_opt_ PULONG pcbRead - ) - { - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pv, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcbRead, E_POINTER)) && - SUCCEEDED(hr = CoFileTimeNow(&m_aTime))) - { - BOOL bEOF = FALSE; - - *pcbRead = 0; - - while (SUCCEEDED(hr) && - !bEOF && - *pcbRead < cb) - { - DWORD cbRead = 0; - - hr = m_pReadStream->ReadBytes(reinterpret_cast(reinterpret_cast(pv) + *pcbRead), cb - *pcbRead, &cbRead, &bEOF); - - if (SUCCEEDED(hr)) - { - *pcbRead += cbRead; - } - } - } - - if (SUCCEEDED(hr) && - *pcbRead < cb) - { - hr = S_FALSE; - } - - ERR_ON_HR(hr); - return hr; - } - - /*++ - - Routine Name: - - Write - - Routine Description: - - Not implemented - - Arguments: - - None - - Return Value: - - E_NOTIMPL - - --*/ - HRESULT STDMETHODCALLTYPE - Write( - _In_reads_bytes_(cb) CONST VOID*, - _In_ ULONG cb, - _Out_opt_ PULONG - ) - { - UNREFERENCED_PARAMETER(cb); - ERR("Unsupported method called.\n"); - return E_NOTIMPL; - } - - // - // IStream methods - // - /*++ - - Routine Name: - - Seek - - Routine Description: - - Implements IStream::Seek by calling on to IPrintReadStream::Seek - - Arguments: - - dlibMove - Count of bytes to displace the current position relative to the dwOrigin parameter - dwOrigin - The origin to apply the displacement from - plibNewPosition - Pointer to a variable to recieve the new position of the seek pointer - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT STDMETHODCALLTYPE - Seek( - LARGE_INTEGER dlibMove, - DWORD dwOrigin, - _Out_opt_ ULARGE_INTEGER* plibNewPosition - ) - { - HRESULT hr = S_OK; - - ULONGLONG libNewPos = 0; - if (SUCCEEDED(hr = m_pReadStream->Seek(dlibMove.QuadPart, dwOrigin, &libNewPos)) && - plibNewPosition != NULL) - { - plibNewPosition->QuadPart = libNewPos; - } - - ERR_ON_HR(hr); - return hr; - } - - /*++ - - Routine Name: - - SetSize - - Routine Description: - - Not implemented - - Arguments: - - None - - Return Value: - - E_NOTIMPL - - --*/ - HRESULT STDMETHODCALLTYPE - SetSize( - ULARGE_INTEGER - ) - { - ERR("Unsupported method called.\n"); - return E_NOTIMPL; - } - - /*++ - - Routine Name: - - CopyTo - - Routine Description: - - Not implemented - - Arguments: - - None - - Return Value: - - E_NOTIMPL - - --*/ - HRESULT STDMETHODCALLTYPE - CopyTo( - _In_ IStream*, - ULARGE_INTEGER, - _Out_opt_ ULARGE_INTEGER*, - _Out_opt_ ULARGE_INTEGER* - ) - { - ERR("Unsupported method called.\n"); - return E_NOTIMPL; - } - - /*++ - - Routine Name: - - Commit - - Routine Description: - - Not implemented - - Arguments: - - None - - Return Value: - - E_NOTIMPL - - --*/ - HRESULT STDMETHODCALLTYPE - Commit( - DWORD - ) - { - ERR("Unsupported method called.\n"); - return E_NOTIMPL; - } - - /*++ - - Routine Name: - - Revert - - Routine Description: - - Not implemented - - Arguments: - - None - - Return Value: - - E_NOTIMPL - - --*/ - HRESULT STDMETHODCALLTYPE - Revert( - VOID - ) - { - ERR("Unsupported method called.\n"); - return E_NOTIMPL; - } - - /*++ - - Routine Name: - - LockRegion - - Routine Description: - - Not implemented - - Arguments: - - None - - Return Value: - - E_NOTIMPL - - --*/ - HRESULT STDMETHODCALLTYPE - LockRegion( - ULARGE_INTEGER, - ULARGE_INTEGER, - DWORD - ) - { - ERR("Unsupported method called.\n"); - return E_NOTIMPL; - } - - /*++ - - Routine Name: - - UnlockRegion - - Routine Description: - - Not implemented - - Arguments: - - None - - Return Value: - - E_NOTIMPL - - --*/ - HRESULT STDMETHODCALLTYPE - UnlockRegion( - ULARGE_INTEGER, - ULARGE_INTEGER, - DWORD - ) - { - ERR("Unsupported method called.\n"); - return E_NOTIMPL; - } - - /*++ - - Routine Name: - - Stat - - Routine Description: - - Retrieves the STATSG structure for this stream - - Arguments: - - pstatstg - Pointer to the STATSG structure to be completed - grfStatFlag - Flag determining what should be completed - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT STDMETHODCALLTYPE Stat( - STATSTG* pstatstg, - DWORD grfStatFlag - ) - { - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pstatstg, E_POINTER)) && - SUCCEEDED(hr = GetStreamSize(&pstatstg->cbSize))) - { - if (grfStatFlag == STATFLAG_DEFAULT) - { - CComBSTR bstrStoreName(L"PrintReadStream"); - UINT cchStoreName = bstrStoreName.Length(); - - pstatstg->pwcsName = reinterpret_cast(CoTaskMemAlloc((cchStoreName + 1) * sizeof(BSTR))); - - if (pstatstg->pwcsName != NULL) - { - CopyMemory(pstatstg->pwcsName, bstrStoreName.m_str, cchStoreName * sizeof(BSTR)); - pstatstg->pwcsName[cchStoreName] = 0; - } - else - { - hr = E_OUTOFMEMORY; - } - } - else - { - pstatstg->pwcsName = NULL; - } - - pstatstg->type = STGTY_STREAM; - pstatstg->mtime = m_mTime; - pstatstg->ctime = m_cTime; - pstatstg->atime = m_aTime; - pstatstg->grfMode = STGM_READ | STGM_SHARE_DENY_WRITE; - pstatstg->grfLocksSupported = LOCK_WRITE; - pstatstg->clsid = CLSID_NULL; - pstatstg->grfStateBits = 0; - } - - ERR_ON_HR(hr); - return hr; - } - - /*++ - - Routine Name: - - Clone - - Routine Description: - - Not implemented - - Arguments: - - None - - Return Value: - - E_NOTIMPL - - --*/ - HRESULT STDMETHODCALLTYPE - Clone( - IStream** - ) - { - ERR("Unsupported method called.\n"); - return E_NOTIMPL; - } - -private: - /*++ - - Routine Name: - - GetStreamSize - - Routine Description: - - Retrieves the stream size. If this is the first time the stream size is accessed - the method retrieves teh size by seeking to the end of the stream and reporting - the offset from the start. This value is then stored and used in subsequent - calls to this method - - Arguments: - - pcbSize - Pointer to the size to be filled out - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT - GetStreamSize( - ULARGE_INTEGER* pcbSize - ) - { - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pcbSize, E_POINTER))) - { - // - // This stream implementation can never shrink, so if the size is greater - // than 0 we do not need to re-acquire. - // - if (m_cbStream.QuadPart > 0) - { - *pcbSize = m_cbStream; - } - else - { - // - // Seek to the end of the stream to find the size then reset to the current position - // - ULONGLONG libOldPosition = 0; - if (SUCCEEDED(hr = m_pReadStream->Seek(0, STREAM_SEEK_CUR, &libOldPosition)) && - SUCCEEDED(hr = m_pReadStream->Seek(0, STREAM_SEEK_END, &pcbSize->QuadPart)) && - SUCCEEDED(hr = m_pReadStream->Seek(libOldPosition, STREAM_SEEK_SET, NULL))) - { - // - // Store the result - // - m_cbStream.QuadPart = pcbSize->QuadPart; - } - } - } - - ERR_ON_HR(hr); - return hr; - } - - -private: - CComPtr m_pReadStream; - - ULARGE_INTEGER m_cbStream; - - FILETIME m_mTime; - - FILETIME m_cTime; - - FILETIME m_aTime; -}; - diff --git a/print/XPSDrvSmpl/src/inc/xdexcept.h b/print/XPSDrvSmpl/src/inc/xdexcept.h deleted file mode 100644 index 6dfc653f..00000000 --- a/print/XPSDrvSmpl/src/inc/xdexcept.h +++ /dev/null @@ -1,104 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdexcept.h - -Abstract: - - XPSDrv sample driver exception class - ---*/ - -#pragma once - -class CXDException -{ -public: - /*++ - - Routine Name: - - CXDException - - Routine Description: - - Class constructor - - Arguments: - - None - - Return Value: - - None - - --*/ - CXDException() throw() : - m_hr(E_FAIL) - { - } - - /*++ - - Routine Name: - - CXDException - - Routine Description: - - Class constructor - - Arguments: - - hr - HRESULT value for the error for which the exception is thrown - - Return Value: - - None - - --*/ - CXDException( - HRESULT hr - ) throw() : - m_hr(hr) - { - } - - /*++ - - Routine Name: - - operator HRESULT() - - Routine Description: - - HRESULT cast operator - - Arguments: - - None - - Return Value: - - The HRESULT value associated with the exception - - --*/ - operator HRESULT() CONST throw() - { - return m_hr; - } - -public: - HRESULT m_hr; -}; - diff --git a/print/XPSDrvSmpl/src/inc/xdstring.h b/print/XPSDrvSmpl/src/inc/xdstring.h deleted file mode 100644 index 0a1f7177..00000000 --- a/print/XPSDrvSmpl/src/inc/xdstring.h +++ /dev/null @@ -1,2889 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdstring.h - -Abstract: - - A string class that emulates the CStringT class interface. The class uses an - internal string of default length 128 characters. The string size is doubled - on each resize. - ---*/ - -#pragma once - -#include -#include "xdexcept.h" - -#define CCH_INITIAL_BUFFER 128 - -template< typename _T = CHAR > -class ChTraitsBaseXD -{ -public: - typedef CHAR XCHARXD; - typedef WCHAR YCHARXD; -}; - -template<> -class ChTraitsBaseXD< WCHAR > -{ -public: - typedef WCHAR XCHARXD; - typedef CHAR YCHARXD; -}; - -template -class CStringXDT -{ -public: - typedef typename ChTraitsBaseXD<_T>::XCHARXD XCHARXD; - typedef typename ChTraitsBaseXD<_T>::YCHARXD YCHARXD; - -public: - /*++ - - Routine Name: - - CStringXDT - - Routine Description: - - Class constructor - - Arguments: - - None - - Return Value: - - None - - --*/ - CStringXDT() : - m_pszData(NULL) - { - } - - /*++ - - Routine Name: - - CStringXDT - - Routine Description: - - Class constructor - - Arguments: - - cstrSrc - source CStringXDT class to construct from - - Return Value: - - None - - --*/ - CStringXDT( - _In_ CONST CStringXDT<_T>& cstrSrc - ) : - m_pszData(NULL) - { - CreateString(cstrSrc.GetString()); - } - - /*++ - - Routine Name: - - CStringXDT - - Routine Description: - - Class constructor - - Arguments: - - pszSrc - source string that matches the template argument to construct from - - Return Value: - - None - - --*/ - CStringXDT( - _In_z_ CONST XCHARXD* pszSrc - ) : - m_pszData(NULL) - { - CreateString(pszSrc); - } - - - /*++ - - Routine Name: - - CStringXDT - - Routine Description: - - Class constructor - - Arguments: - - pszSrc - source string to construct from. This is the "cross" - string, i.e. CHAR for WCHAR template and vice versa - - Return Value: - - None - - --*/ - CStringXDT( - _In_z_ CONST YCHARXD* pszSrc - ) : - m_pszData(NULL) - { - CreateStringFromY(pszSrc); - } - - /*++ - - Routine Name: - - CStringXDT - - Routine Description: - - Class constructor - - Arguments: - - pszSrc - source string that matches the template argument to construct from - cchSrc - the length of the source string to construct from - - Return Value: - - None - - --*/ - CStringXDT( - _In_reads_(cchSrc) CONST XCHARXD* pszSrc, - _In_ INT cchSrc - ) : - m_pszData(NULL) - { - if (cchSrc < 0) - { - RIP("Negative string size requested.\n"); - throw CXDException(E_INVALIDARG); - } - - CreateString(pszSrc, static_cast(cchSrc)); - } - - /*++ - - Routine Name: - - CStringXDT - - Routine Description: - - Class constructor - - Arguments: - - pszSrc - source string to construct from. This is the "cross" - string, i.e. CHAR for WCHAR template and vice versa - cchSrc - the length of the source string to construct from - - Return Value: - - None - - --*/ - CStringXDT( - _In_reads_(cchSrc) CONST YCHARXD* pszSrc, - _In_ INT cchSrc - ) : - m_pszData(NULL) - { - if (cchSrc < 0) - { - RIP("Negative string size requested.\n"); - throw CXDException(E_INVALIDARG); - } - - CreateStringFromY(pszSrc, static_cast(cchSrc)); - } - - /*++ - - Routine Name: - - ~CStringXDT - - Routine Description: - - Class destructor - - Arguments: - - None - - Return Value: - - None - - --*/ - ~CStringXDT() - { - if (m_pszData != NULL) - { - HeapFree(GetProcessHeap(), 0, GetDataBuffer()); - m_pszData = NULL; - } - } - - // - // Operators - // - /*++ - - Routine Name: - - operator= - - Routine Description: - - Assignment operator - - Arguments: - - cstrSrc - const reference to the source CStringXDT - - Return Value: - - Reference to the newly assigned CStringXDT instance - - --*/ - CStringXDT<_T>& - operator=( - _In_ CONST CStringXDT<_T>& cstrSrc - ) - { - *this = cstrSrc.m_pszData; - - return *this; - } - - /*++ - - Routine Name: - - operator= - - Routine Description: - - Assignment operator - - Arguments: - - pszSrc - const pointer to the source string of the same type as the template - - Return Value: - - Reference to the newly assigned CStringXDT instance - - --*/ - CStringXDT<_T>& - operator=( - _In_z_ CONST XCHARXD* pszSrc - ) - { - if (this->operator!=(pszSrc)) - { - Empty(); - CreateString(pszSrc); - } - - return *this; - } - - /*++ - - Routine Name: - - operator= - - Routine Description: - - Assignment operator - - Arguments: - - pszSrc - const pointer to the source string of the opposite type to the template - - Return Value: - - Reference to the newly assigned CStringXDT instance - - --*/ - CStringXDT<_T>& - operator=( - _In_z_ CONST YCHARXD* pszSrc - ) - { - if (this->operator!=(pszSrc)) - { - Empty(); - CreateStringFromY(pszSrc); - } - - return *this; - } - - /*++ - - Routine Name: - - operator+= - - Routine Description: - - Addition assignment operator - appends a source string to the current underlying string - - Arguments: - - pszSrc - pointer to the native string to append - - Return Value: - - Reference to this instance - - --*/ - CStringXDT<_T>& - operator+=( - _In_z_ CONST XCHARXD* pszSrc - ) - { - size_t cchSrc = StringLength(pszSrc); - size_t cchCur = StringLength(GetString()); - - SetBufferSize(cchSrc + cchCur); - CopyString(GetString() + cchCur, GetBufferCharCount() - cchCur, pszSrc, cchSrc); - - return *this; - } - - /*++ - - Routine Name: - - operator+= - - Routine Description: - - Addition assignment operator - appends a source string to the current underlying string - - Arguments: - - pszSrc - pointer to the opposite string type to append - - Return Value: - - Reference to this instance - - --*/ - CStringXDT<_T>& - operator+=( - _In_z_ CONST YCHARXD* pszSrc - ) - { - size_t cchSrc = StringLength(pszSrc); - size_t cchCur = StringLength(GetString()); - - SetBufferSize(cchSrc + cchCur); - CopyYString(GetString() + cchCur, GetBufferCharCount() - cchCur, pszSrc, cchSrc); - - return *this; - } - - /*++ - - Routine Name: - - operator CONST _T*() - - Routine Description: - - const cast operator - - Arguments: - - None - - Return Value: - - Pointer to the underlying string - - --*/ - operator CONST _T*() CONST throw() - { - return GetString(); - } - - /*++ - - Routine Name: - - operator!= - - Routine Description: - - Inequality operator - compares against the native string type - - Arguments: - - pszCompare - the string to compare to - - Return Value: - - true - the strings do not match - false - the strings match - - --*/ - bool - operator!=( - _In_z_ CONST XCHARXD* pszCompare - ) CONST - { - return !operator==(pszCompare); - } - - /*++ - - Routine Name: - - operator== - - Routine Description: - - Equality operator - compares against the native string type - - Arguments: - - pszCompare - the string to compare to - - Return Value: - - true - the strings match - false - the strings do not match - - --*/ - bool - operator==( - _In_z_ CONST XCHARXD* pszCompare - ) CONST - { - return CompareXDString(GetString(), pszCompare) == 0; - } - - /*++ - - Routine Name: - - operator!= - - Routine Description: - - Inequality operator - compares against the oposite string type - - Arguments: - - pszCompare - the string to compare to - - Return Value: - - true - the strings do not match - false - the strings match - - --*/ - bool - operator!=( - _In_z_ CONST YCHARXD* pszCompare - ) CONST - { - return !operator==(pszCompare); - } - - /*++ - - Routine Name: - - operator== - - Routine Description: - - Equality operator - compares against the opposite string type - - Arguments: - - pszCompare - the string to compare to - - Return Value: - - true - the strings match - false - the strings do not match - - --*/ - bool - operator==( - _In_z_ CONST YCHARXD* pszCompare - ) CONST - { - CStringXDT cstrCompare(pszCompare); - return CompareXDString(GetString(), cstrCompare) == 0; - } - - /*++ - - Routine Name: - - operator< - - Routine Description: - - Less than operator - - Arguments: - - cstrCompare - The CStringXDT instance to compare to - - Return Value: - - true - this string instance is less than the compare string - false - this string instance is not less than the compare string - - --*/ - bool - operator<( - _In_ CONST CStringXDT<_T>& cstrCompare - ) CONST - { - return CompareXDString(GetString(), cstrCompare.GetString()) < 0; - } - - /*++ - - Routine Name: - - operator< - - Routine Description: - - Less than operator - - Arguments: - - cstrCompare - pointer to a native string to compate with - - Return Value: - - true - this string instance is less than the compare string - false - this string instance is not less than the compare string - - --*/ - bool - operator<( - _In_z_ CONST XCHARXD* pszCompare - ) CONST - { - return CompareXDString(GetString(), pszCompare) < 0; - } - - /*++ - - Routine Name: - - operator< - - Routine Description: - - Less than operator - - Arguments: - - cstrCompare - pointer to a opposite string type to compate with - - Return Value: - - true - this string instance is less than the compare string - false - this string instance is not less than the compare string - - --*/ - bool - operator<( - _In_z_ CONST YCHARXD* pszCompare - ) CONST - { - CStringXDT cstrCompare(pszCompare); - return CompareXDString(GetString(), cstrCompare) < 0; - } - - /*++ - - Routine Name: - - operator[] - - Routine Description: - - Array index operator - - Arguments: - - cchIndex - the character index into the string - - Return Value: - - The value of the character at the specified index - - --*/ - _T operator[]( - _In_ INT cchIndex - ) CONST - { - if (cchIndex < 0 || - cchIndex > GetLength()) - { - throw CXDException(E_INVALIDARG); - } - - return GetString()[cchIndex]; - } - - // - // Methods - // - /*++ - - Routine Name: - - AllocSysString - - Routine Description: - - Allocates a BSTR from the underlying string - - Arguments: - - None - - Return Value: - - The newly allocated BSTR - - --*/ - BSTR - AllocSysString() - { - return AllocSysString(GetString()); - } - - /*++ - - Routine Name: - - Find - - Routine Description: - - Finds the location of a sub string in the underlying string - - Arguments: - - pszSub - the sub string to search for - cchStart - the point to start searching the underlying string from - - Return Value: - - -1 if the sub string is not found - the index of the sub-string in the underlying strings - - --*/ - INT - Find( - _In_z_ CONST _T* pszSub, - _In_ INT cchStart = 0 - ) CONST throw() - { - return Find(GetString(), pszSub, cchStart); - } - - /*++ - - Routine Name: - - Delete - - Routine Description: - - Deletes one or more characters from a given offset - - Arguments: - - cchStart - the starting character to delete from - cchDelete - the number of characters to delete - - Return Value: - - The length of the remaining string - - --*/ - INT - Delete( - INT cchStart, - INT cchDelete = 1 - ) - { - if (cchStart < 0) - { - cchStart = 0; - } - - if (cchDelete < 0) - { - cchDelete = 0; - } - - size_t cchStr = StringLength(GetString()); - if (cchStr < static_cast(cchStart + cchDelete)) - { - throw CXDException(E_INVALIDARG); - } - - size_t cchToMove = cchStr + 1 - static_cast(cchDelete + cchStart); - MoveMemory(GetString() + cchStart, m_pszData + cchStart + cchDelete, cchToMove * sizeof(_T)); - - return GetLength(); - } - - /*++ - - Routine Name: - - GetLength - - Routine Description: - - Retrieves the length of the string - - Arguments: - - None - - Return Value: - - The count of characters in the string - - --*/ - INT - GetLength() CONST throw() - { - INT cch = 0; - - try - { - cch = static_cast(StringLength(GetString())); - } - catch (CXDException&) - { - } - - return cch; - } - - /*++ - - Routine Name: - - Format - - Routine Description: - - Writes formatted data to the string. - - Arguments: - - pszFormat - the format string - ... - Variable argument list - - Return Value: - - None - - --*/ - VOID - Format( - _In_z_ CONST _T* pszFormat, - ... - ) - { - if (pszFormat == NULL) - { - throw CXDException(E_INVALIDARG); - } - - va_list argList; - va_start(argList, pszFormat); - Format(pszFormat, argList); - va_end(argList); - } - - /*++ - - Routine Name: - - Empty - - Routine Description: - - Sets the string to zero length - - Arguments: - - None - - Return Value: - - None - - --*/ - VOID - Empty() - { - try - { - *GetString() = 0; - } - catch (CXDException&) - { - } - } - - /*++ - - Routine Name: - - Compare - - Routine Description: - - Compares the string data with a compare string passed in - case sensitive. - This is the same functionality as strcmp. - - Arguments: - - pszCompare - the string to compare against - - Return Value: - - < 0 if the string data is less than the compare string - 0 if the strings are identical - > 0 if the string data is more than the compare string - - --*/ - INT - Compare( - _In_z_ CONST _T* pszCompare - ) CONST - { - return CompareXDString(GetString(), pszCompare); - } - - /*++ - - Routine Name: - - CompareNoCase - - Routine Description: - - Compares the string data with a compare string passed in - case insensitive. - This is the same functionality as stricmp. - - Arguments: - - pszCompare - the string to compare against - - Return Value: - - < 0 if the string data is less than the compare string - 0 if the strings are identical - > 0 if the string data is more than the compare string - - --*/ - INT - CompareNoCase( - _In_z_ CONST _T* pszCompare - ) CONST throw() - { - return CompareXDStringNoCase(GetString(), pszCompare); - } - - /*++ - - Routine Name: - - Replace - - Routine Description: - - Replaces all instances of a target string with a new string - - Arguments: - - pszOld - the string to replace - pszNew - the replacement string - - Return Value: - - The number of replaced instances - - --*/ - INT - Replace( - _In_z_ CONST _T* pszOld, - _In_z_ CONST _T* pszNew - ) - { - // - // Find the length of the old and new strings - // - size_t cchOld = StringLength(pszOld); - size_t cchNew = StringLength(pszNew); - - // - // Count the instances of the string to replace - // - _T* pszCurr = GetString(); - INT cReplace = 0; - INT cchStart = Find(pszCurr, pszOld, 0); - while (cchStart >= 0) - { - cReplace++; - pszCurr += cchStart + cchOld; - cchStart = Find(pszCurr, pszOld, 0); - } - - if (cReplace > 0) - { - // - // Resize the buffer to accomodate the replacements - // - INT cchDelta = static_cast(cchNew - cchOld); - INT cchDeltaBuffer = cReplace * cchDelta; - SetBufferSize(StringLength(GetString()) + cchDeltaBuffer); - - // - // Replace all instances of the old string and replace with - // the new string - // - pszCurr = GetString(); - cchStart = Find(pszCurr, pszOld, 0); - while (cchStart >= 0) - { - // - // Move the remainder of the string up by the length of the replacement - // this makes room to insert the replacement string - // - pszCurr += cchStart; - _T* pszOldEnd = pszCurr + cchOld; - size_t cchToMove = StringLength(pszOldEnd) + 1; - MoveMemory(pszCurr + cchNew, pszOldEnd, cchToMove * sizeof(_T)); - - // - // Fill the "gap" with the new string - // - CopyMemory(pszCurr, pszNew, cchNew * sizeof(_T)); - - // - // Look for the next string from the end of the current instance - // - pszCurr += cchNew; - cchStart = Find(pszCurr, pszOld, 0); - } - } - - return cReplace; - } - - /*++ - - Routine Name: - - Append - - Routine Description: - - Appends a string to the current string data - - Arguments: - - pszSrc - the string to append - - Return Value: - - None - - --*/ - VOID - Append( - _In_z_ CONST _T* pszSrc - ) - { - *this += pszSrc; - } - - /*++ - - Routine Name: - - Insert - - Routine Description: - - Inserts a string to the current string data - - Arguments: - - cch - the index at which to insert the string - pszSrc - the string to insert - - Return Value: - - None - - --*/ - INT - Insert( - _In_ CONST INT& cch, - _In_z_ CONST _T* pszSrc - ) - { - if (cch >= 0 && - pszSrc != NULL) - { - _T* pszCurr = GetString(); - size_t cchCurr = StringLength(pszCurr); - - if (cchCurr >= static_cast(cch)) - { - size_t cchSrc = StringLength(pszSrc); - SetBufferSize(cchCurr + cchSrc); - - // - // Move the remainder of the string up by the length of the replacement - // this makes room to insert the replacement string - // - pszCurr += cch; - size_t cchToMove = StringLength(pszCurr) + 1; - MoveMemory(pszCurr + cchSrc, pszCurr, cchToMove * sizeof(_T)); - - // - // Fill the "gap" with the new string - // - CopyMemory(pszCurr, pszSrc, cchSrc * sizeof(_T)); - } - } - else - { - throw CXDException(E_INVALIDARG); - } - - return static_cast(StringLength(GetString())); - } - - /*++ - - Routine Name: - - IsEmpty - - Routine Description: - - Indicates whether the string is zero length - - Arguments: - - None - - Return Value: - - true - the string is empty - false - otherwise - - --*/ - bool - IsEmpty() CONST throw() - { - return GetLength() == 0; - } - - /*++ - - Routine Name: - - GetBuffer - - Routine Description: - - Returns the underlying string buffer - - Arguments: - - None - - Return Value: - - The underlying string buffer - - --*/ - _T* - GetBuffer() - { - return GetString(); - } - - /*++ - - Routine Name: - - Tokenize - - Routine Description: - - Retrieves the position of the next token in a string - - Arguments: - - pszTokens - string defining the token - cchStart - the point at which the token search should start. This value is updated - by the call to the posiion following the end character of the token. - - Return Value: - - Returns a CStringXDT object containing the token value. - - --*/ - CStringXDT<_T> - Tokenize( - _In_z_ CONST _T* pszTokens, - _Inout_ INT& cchStart - ) CONST - { - CStringXDT<_T> cstrResult; - - if (cchStart < 0) - { - throw CXDException(E_INVALIDARG); - } - - INT cchTokens = static_cast(StringLength(pszTokens)); - if (cchTokens == 0) - { - if (cchStart < GetLength()) - { - cstrResult = GetString() + cchStart; - } - else - { - // - // There are no tokens or data - // - cchStart = -1; - } - } - else - { - // - // Skip leading tokens - // - while (Find(pszTokens, cchStart) == cchStart) - { - cchStart += cchTokens; - } - - INT cchFirstToken = Find(pszTokens, cchStart); - - if (cchFirstToken > 0) - { - // - // The result string runs from the start to the first token - // - cstrResult = Mid(cchStart, cchFirstToken - cchStart); - cchStart = cchFirstToken + cchTokens; - } - else - { - if (cchStart < GetLength()) - { - // - // There are no more tokens but there is data left - // - cstrResult = GetString() + cchStart; - cchStart = GetLength() + cchTokens; - } - else - { - // - // There are no more tokens or data - // - cchStart = -1; - } - } - } - - return cstrResult; - } - - /*++ - - Routine Name: - - GetAt - - Routine Description: - - Retrieves character at the given index - - Arguments: - - cchAt - character count index of the character to return - - Return Value: - - The character value at the specified index - - --*/ - _T GetAt( - _In_ INT cchAt - ) CONST - { - if (cchAt < 0 || - cchAt > GetLength()) - { - throw CXDException(E_INVALIDARG); - } - - return GetString()[cchAt]; - } - - /*++ - - Routine Name: - - Trim - - Routine Description: - - Trims the string of leading and trailing white space - - Arguments: - - None - - Return Value: - - Reference to the trimmed CStringXDT object - - --*/ - CStringXDT<_T>& - Trim() - { - return TrimRight().TrimLeft(); - } - - /*++ - - Routine Name: - - TrimRight - - Routine Description: - - Trims the string of trailing white space - - Arguments: - - None - - Return Value: - - Reference to the trimmed CStringXDT object - - --*/ - CStringXDT<_T>& - TrimRight() - { - _T* pszFirstTrailing = NULL; - _T* pszData = GetString(); - while (*pszData != 0) - { - if (IsSpace(*pszData)) - { - if (pszFirstTrailing == NULL) - { - pszFirstTrailing = pszData; - } - } - else - { - pszFirstTrailing = NULL; - } - pszData++; - } - - if (pszFirstTrailing != NULL) - { - Truncate(static_cast(pszFirstTrailing - GetString())); - } - - return *this; - } - - /*++ - - Routine Name: - - Trim - - Routine Description: - - Trims the string of leading white space - - Arguments: - - None - - Return Value: - - Reference to the trimmed CStringXDT object - - --*/ - CStringXDT<_T>& - TrimLeft() - { - _T* pszData = GetString(); - - while (IsSpace(*pszData)) - { - pszData++; - } - - INT cchWhite = static_cast(pszData - GetString()); - if (cchWhite > 0) - { - Delete(0, cchWhite); - } - - return *this; - } - - /*++ - - Routine Name: - - Left - - Routine Description: - - Returns a CStringXDT object containing the string of the specified length - from the left of the string data - - Arguments: - - cchLeft - count of characters to return from the string data - - Return Value: - - The CStringXDT object containing the requested string - - --*/ - CStringXDT<_T> - Left( - _In_ INT cchLeft - ) CONST - { - if (cchLeft < 0) - { - cchLeft = 0; - } - - if (cchLeft > GetLength()) - { - return *this; - } - - return CStringXDT<_T>(GetString(), cchLeft); - } - - /*++ - - Routine Name: - - Mid - - Routine Description: - - Returns a CStringXDT object containing the string from the specified offset - to the end of the string data - - Arguments: - - cchFirst - the index of the character to start the string - - Return Value: - - The CStringXDT object containing the requested string - - --*/ - CStringXDT<_T> - Mid( - _In_ INT cchFirst - ) CONST - { - return Mid(cchFirst, GetLength() - cchFirst); - } - - /*++ - - Routine Name: - - Mid - - Routine Description: - - Returns a CStringXDT object containing the string from the specified offset - of the requested length - - Arguments: - - cchFirst - the index of the character to start the string - cchSize - the count of characters to compose the return string from - - Return Value: - - The CStringXDT object containing the requested string - - --*/ - CStringXDT<_T> - Mid( - _In_ INT cchFirst, - _In_ INT cchSize - ) CONST - { - INT cchCurr = GetLength(); - - if (cchFirst < 0 || - cchSize < 0 || - cchSize + cchFirst > cchCurr || - cchFirst > cchCurr) - { - throw CXDException(E_INVALIDARG); - } - - if (cchFirst == 0 && - cchSize == cchCurr) - { - return *this; - } - - return CStringXDT<_T>(GetString() + cchFirst, cchSize); - } - - /*++ - - Routine Name: - - MakeLower - - Routine Description: - - Makes all characters in the string lower case - - Arguments: - - None - - Return Value: - - Reference to the modified string object - - --*/ - CStringXDT<_T>& - MakeLower() - { - MakeLower(GetString(), GetBufferCharCount()); - return *this; - } - - /*++ - - Routine Name: - - Truncate - - Routine Description: - - Truncates the string data to the specified size - - Arguments: - - cchNew - the length to which the string data is to be truncated - - Return Value: - - None - - --*/ - VOID - Truncate( - INT cchNew - ) - { - if (cchNew < 0) - { - cchNew = 0; - } - - if (cchNew < GetLength()) - { - GetString()[cchNew] = 0; - } - } - - /*++ - - Routine Name: - - Preallocate - - Routine Description: - - Preallocate the string buffer to accomodate a string of length cChars - Note: this function adds one for the NULL terminator - - Arguments: - - cChars - the count of chars to allocate for - - Return Value: - - None - - --*/ - VOID - Preallocate( - INT cChars - ) - { - if (cChars < 0) - { - cChars = 0; - } - - SetBufferSize(static_cast(cChars) + 1); - } - - -private: - /*++ - - Routine Name: - - CreateString - - Routine Description: - - Creates a native string specifically from a WCHAR source string - - Arguments: - - pszSrc - the WCHAR source string - - Return Value: - - None - - --*/ - VOID - CreateString( - _In_z_ CONST WCHAR* pszSrc - ) - { - if (pszSrc != NULL) - { - CreateString(pszSrc, StringLength(pszSrc)); - } - } - - /*++ - - Routine Name: - - CreateString - - Routine Description: - - Creates a native string specifically from a CHAR source string - - Arguments: - - pszSrc - the CHAR source string - - Return Value: - - None - - --*/ - VOID - CreateString( - _In_z_ CONST CHAR* pszSrc - ) - { - if (pszSrc != NULL) - { - CreateString(pszSrc, StringLength(pszSrc)); - } - } - - /*++ - - Routine Name: - - CreateString - - Routine Description: - - Creates a snative tring from a native source string and character count - - Arguments: - - pszSrc - the source string - cchSrc - count of characters to copy from the source string - - Return Value: - - None - - --*/ - VOID - CreateString( - _In_reads_(cchSrc) CONST _T* pszSrc, - _In_ size_t cchSrc - ) - { - if (pszSrc != NULL) - { - SetBufferSize(cchSrc); - CopyString(GetString(), GetBufferCharCount(), pszSrc, cchSrc); - } - } - - /*++ - - Routine Name: - - CreateStringFromY - - Routine Description: - - Creates a string from a source string of the opposite type. - WCHAR specific implementation. - - Arguments: - - pszSrc - the source string - cchSrc - count of characters to copy from the source string - - Return Value: - - None - - --*/ - VOID - CreateStringFromY( - _In_z_ CONST WCHAR* pszSrc - ) - { - if (pszSrc != NULL) - { - CreateStringFromY(pszSrc, StringLength(pszSrc)); - } - } - - /*++ - - Routine Name: - - CreateStringFromY - - Routine Description: - - Creates a string from a source string of the opposite type and character count. - WCHAR specific implementation. - - Arguments: - - pszSrc - the source string - cchSrc - count of characters to copy from the source string - - Return Value: - - None - - --*/ - VOID - CreateStringFromY( - _In_reads_(cchSrc) CONST WCHAR* pszSrc, - _In_ size_t cchSrc - ) - { - if (pszSrc != NULL && - cchSrc > 0) - { - SetBufferSize(cchSrc); - CopyYString(GetString(), GetBufferCharCount(), pszSrc, cchSrc); - } - } - - /*++ - - Routine Name: - - CreateStringFromY - - Routine Description: - - Creates a string from a source string of the opposite type and a chacter count. - CHAR specific implementation. - - Arguments: - - pszSrc - the source string - - Return Value: - - None - - --*/ - VOID - CreateStringFromY( - _In_z_ CONST CHAR* pszSrc - ) - { - if (pszSrc != NULL) - { - CreateStringFromY(pszSrc, StringLength(pszSrc)); - } - } - - /*++ - - Routine Name: - - CreateStringFromY - - Routine Description: - - Creates a string from a source string of the opposite type. - CHAR specific implementation. - - Arguments: - - pszSrc - the source string - cchSrc - count of characters to copy from the source string - - Return Value: - - None - - --*/ - VOID - CreateStringFromY( - _In_reads_(cchSrc) CONST CHAR* pszSrc, - _In_ size_t cchSrc - ) - { - if (pszSrc != NULL && - cchSrc > 0) - { - SetBufferSize(cchSrc); - CopyYString(GetString(), GetBufferCharCount(), pszSrc, cchSrc); - } - } - - /*++ - - Routine Name: - - StringLength - - Routine Description: - - Returns the character count of the string. WCHAR specific. - - Arguments: - - pszSrc - source to string to retrieve the length of - - Return Value: - - The count of characters in the string - - --*/ - static size_t - StringLength( - _In_opt_z_ CONST WCHAR* pszSrc - ) - { - size_t cch = 0; - if( pszSrc != NULL ) - { - while( *pszSrc != 0 ) - { - cch++; - pszSrc++; - } - } - - return cch; - } - - /*++ - - Routine Name: - - StringLength - - Routine Description: - - Returns the character count of the string. CHAR specific. - - Arguments: - - pszSrc - source to string to retrieve the length of - - Return Value: - - The count of characters in the string - - --*/ - static size_t - StringLength( - _In_opt_z_ CONST CHAR* pszSrc - ) - { - size_t cch = 0; - - if( pszSrc != NULL ) - { - while( *pszSrc != 0 ) - { - cch++; - pszSrc++; - } - } - - return cch; - } - - /*++ - - Routine Name: - - GetBufferCharCount - - Routine Description: - - Gets the total count of available characters in the buffer. This is the length - of the buffer as opposed to the count of characters in the string (the buffer) - can be larger. - - Arguments: - - None - - Return Value: - - The count of available characters in the data buffer - - --*/ - size_t - GetBufferCharCount( - VOID - ) CONST - { - size_t cch = 0; - - if (m_pszData != NULL) - { - cch = *reinterpret_cast(reinterpret_cast(m_pszData) - sizeof(size_t)); - } - else - { - throw CXDException(E_PENDING); - } - - return cch; - } - - /*++ - - Routine Name: - - GetDataBuffer - - Routine Description: - - Retrieves the pointer to the start of the data buffer. The size of the - buffer is stored before the actual string data. - - Arguments: - - None - - Return Value: - - Pointer to the start of the data buffer - - --*/ - PVOID - GetDataBuffer( - VOID - ) CONST - { - PVOID pData = NULL; - - if (m_pszData != NULL) - { - pData = reinterpret_cast(reinterpret_cast(m_pszData) - sizeof(size_t)); - } - else - { - throw CXDException(E_PENDING); - } - - return pData; - } - - /*++ - - Routine Name: - - SetBufferSize - - Routine Description: - - Sets the size of the buffer according to the character count passed in. If - the character count is less than that available no action is required. If it - is larger the data buffer is doubled in size till it is sufficient. - - Arguments: - - cch - count of characters the buffer must accomodate - - Return Value: - - None - - --*/ - VOID - SetBufferSize( - size_t cch - ) CONST - { - if (m_pszData == NULL) - { - // - // Allocate a new buffer - // - size_t cchAllocate = CCH_INITIAL_BUFFER; - - // - // Double the buffer size till we have enough room - // - while (cch >= cchAllocate) - { - cchAllocate *= 2; - } - - LPVOID pData = HeapAlloc(GetProcessHeap(), 0, cchAllocate * sizeof(_T) + sizeof(size_t)); - - if (pData != NULL) - { - *static_cast(pData) = cchAllocate; - m_pszData = reinterpret_cast<_T*>(reinterpret_cast(pData) + sizeof(size_t)); - *m_pszData = 0; - } - else - { - throw CXDException(E_OUTOFMEMORY); - } - } - else - { - size_t cchAllocated = GetBufferCharCount(); - - if (cch >= cchAllocated) - { - // - // Double the buffer size till we have enough room - // - while (cch >= cchAllocated) - { - cchAllocated *= 2; - } - - // - // Re-allocate the existing buffer - // - LPVOID pData = HeapReAlloc(GetProcessHeap(), 0, GetDataBuffer(), cchAllocated * sizeof(_T) + sizeof(size_t)); - - if (pData != NULL) - { - *static_cast(pData) = cchAllocated; - m_pszData = reinterpret_cast<_T*>(reinterpret_cast(pData) + sizeof(size_t)); - } - else - { - throw CXDException(E_OUTOFMEMORY); - } - } - } - } - - /*++ - - Routine Name: - - CopyString - - Routine Description: - - Copys a native string from one buffer to another. WCHAR specific implementation. - - Arguments: - - pszDst - pointer to the destination buffer to copy to - cchDst - count of characters available in the destination buffer - pszSrc - pointer to the source buffer - cchSrc - count of characters to copy - - Return Value: - - None - - --*/ - static VOID - CopyString( - _Inout_updates_(cchDst) WCHAR* pszDst, - _In_ size_t cchDst, - _In_reads_(cchSrc) CONST WCHAR* pszSrc, - _In_ size_t cchSrc - ) - { - HRESULT hr = S_OK; - - if (cchDst < cchSrc) - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - else if (pszDst == NULL) - { - hr = E_INVALIDARG; - } - - if (SUCCEEDED(hr) && - pszSrc != NULL && - cchSrc > 0) - { - hr = StringCchCopyNW(pszDst, cchDst, pszSrc, cchSrc); - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } - } - - /*++ - - Routine Name: - - CopyString - - Routine Description: - - Copys a native string from one buffer to another. CHAR specific implementation. - - Arguments: - - pszDst - pointer to the destination buffer to copy to - cchDst - count of characters available in the destination buffer - pszSrc - pointer to the source buffer - cchSrc - count of characters to copy - - Return Value: - - None - - --*/ - static VOID - CopyString( - _Inout_updates_(cchDst) CHAR* pszDst, - _In_ size_t cchDst, - _In_reads_(cchSrc) CONST CHAR* pszSrc, - _In_ size_t cchSrc - ) - { - HRESULT hr = S_OK; - - if (cchDst < cchSrc) - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - else if (pszDst == NULL) - { - hr = E_INVALIDARG; - } - - if (SUCCEEDED(hr) && - pszSrc != NULL && - cchSrc > 0) - { - hr = StringCchCopyNA(pszDst, cchDst, pszSrc, cchSrc); - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } - } - - /*++ - - Routine Name: - - CopyYString - - Routine Description: - - Copys a string of the opposite type from one buffer to another. CHAR specific implementation. - - Arguments: - - pszDst - pointer to the destination buffer to copy to - cchDst - count of characters available in the destination buffer - pszSrc - pointer to the source buffer - cchSrc - count of characters to copy - - Return Value: - - None - - --*/ - static VOID - CopyYString( - _Inout_updates_(cchDst) CHAR* pszDst, - _In_ size_t cchDst, - _In_reads_(cchSrc) CONST WCHAR* pszSrc, - _In_ size_t cchSrc - ) - { - HRESULT hr = S_OK; - - if (cchDst < cchSrc) - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - else if (pszDst == NULL) - { - hr = E_INVALIDARG; - } - - if (SUCCEEDED(hr) && - pszSrc != NULL && - cchSrc > 0) - { - size_t cbWritten = WideCharToMultiByte(CP_ACP, - 0, - pszSrc, - static_cast(cchSrc), - pszDst, - static_cast(cchDst * sizeof(_T)), - NULL, - NULL); - - if (cbWritten == cchSrc && - cchSrc < cchDst) - { - pszDst[cchSrc] = 0; - } - else - { - ERR("Failed to convert wide char to multibyte string\n"); - throw CXDException(E_FAIL); - } - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } - } - - /*++ - - Routine Name: - - CopyYString - - Routine Description: - - Copys a string of the opposite type from one buffer to another. WCHAR specific implementation. - - Arguments: - - pszDst - pointer to the destination buffer to copy to - cchDst - count of characters available in the destination buffer - pszSrc - pointer to the source buffer - cchSrc - count of characters to copy - - Return Value: - - None - - --*/ - static VOID - CopyYString( - _Inout_updates_(cchDst) WCHAR* pszDst, - _In_ size_t cchDst, - _In_reads_(cchSrc) CONST CHAR* pszSrc, - _In_ size_t cchSrc - ) - { - HRESULT hr = S_OK; - - if (cchDst < cchSrc) - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - else if (pszDst == NULL) - { - hr = E_INVALIDARG; - } - - if (SUCCEEDED(hr) && - pszSrc != NULL && - cchSrc > 0) - { - size_t cchWritten = MultiByteToWideChar(CP_ACP, - 0, - pszSrc, - static_cast(cchSrc), - pszDst, - static_cast(cchDst)); - - if (cchWritten == cchSrc && - cchSrc < cchDst) - { - pszDst[cchSrc] = 0; - } - else - { - ERR("Failed to convert multibyte to wide char string\n"); - throw CXDException(E_FAIL); - } - } - - if (FAILED(hr)) - { - throw CXDException(hr); - } - } - - /*++ - - Routine Name: - - CompareXDString - - Routine Description: - - Case sensitive comparison of a native string with another - WCHAR specific implementation. - - Arguments: - - psz - first string in comparison - pszCmp - second string in comparison - - Return Value: - - < 0 if the string data is less than the compare string - 0 if the strings are identical - > 0 if the string data is more than the compare string - - --*/ - static INT - CompareXDString( - _In_z_ CONST WCHAR* psz, - _In_z_ CONST WCHAR* pszCmp - ) - { - if (pszCmp == NULL) - { - throw CXDException(E_FAIL); - } - - return wcscmp(psz, pszCmp); - } - - /*++ - - Routine Name: - - CompareXDString - - Routine Description: - - Case sensitive comparison of a native string with another - CHAR specific implementation. - - Arguments: - - psz - first string in comparison - pszCmp - second string in comparison - - Return Value: - - < 0 if the string data is less than the compare string - 0 if the strings are identical - > 0 if the string data is more than the compare string - - --*/ - static INT - CompareXDString( - _In_z_ CONST CHAR* psz, - _In_z_ CONST CHAR* pszCmp - ) - { - if (pszCmp == NULL) - { - throw CXDException(E_FAIL); - } - - return strcmp(psz, pszCmp); - } - - /*++ - - Routine Name: - - CompareXDString - - Routine Description: - - Case insensitive comparison of a native string with another - WCHAR specific implementation. - - Arguments: - - psz - first string in comparison - pszCmp - second string in comparison - - Return Value: - - < 0 if the string data is less than the compare string - 0 if the strings are identical - > 0 if the string data is more than the compare string - - --*/ - static INT - CompareXDStringNoCase( - _In_z_ CONST WCHAR* psz, - _In_z_ CONST WCHAR* pszCmp - ) - { - if (pszCmp == NULL) - { - throw CXDException(E_FAIL); - } - - return _wcsicmp(psz, pszCmp); - } - - /*++ - - Routine Name: - - CompareXDString - - Routine Description: - - Case insensitive comparison of a native string with another - CHAR specific implementation. - - Arguments: - - psz - first string in comparison - pszCmp - second string in comparison - - Return Value: - - < 0 if the string data is less than the compare string - 0 if the strings are identical - > 0 if the string data is more than the compare string - - --*/ - static INT - CompareXDStringNoCase( - _In_z_ CONST CHAR* psz, - _In_z_ CONST CHAR* pszCmp - ) - { - if (pszCmp == NULL) - { - throw CXDException(E_FAIL); - } - - return _stricmp(psz, pszCmp); - } - - /*++ - - Routine Name: - - AllocSysString - - Routine Description: - - Allocates a system string from the string data. WCHAR specific implementation. - - Arguments: - - psz - The string to allocate from - - Return Value: - - The newly allocated BSTR - - --*/ - static BSTR - AllocSysString( - _In_z_ CONST WCHAR* psz - ) - { - BSTR bstr = ::SysAllocString(psz); - - if (bstr == NULL) - { - throw CXDException(E_OUTOFMEMORY); - } - - return bstr; - } - - /*++ - - Routine Name: - - AllocSysString - - Routine Description: - - Allocates a system string from the string data. CHAR specific implementation. - - Arguments: - - psz - The string to allocate from - - Return Value: - - The newly allocated BSTR - - --*/ - static BSTR - AllocSysString( - _In_z_ CONST CHAR* psz - ) - { - CStringXDW cstrWide(psz); - BSTR bstr = ::SysAllocString(cstrWide); - - if (bstr == NULL) - { - throw CXDException(E_OUTOFMEMORY); - } - - return bstr; - } - - /*++ - - Routine Name: - - Find - - Routine Description: - - Retrieves the location of a sub string in another string. This is the - CHAR spzecific implementation for native string type - - Arguments: - - pszSrc - string to search in - pszSub - sub string to search for - cchStart - starting point for the search - - Return Value: - - < 0 if the substring was not found - Otherwise, the location of the substring - - --*/ - static INT - Find( - _In_z_ CONST CHAR* pszSrc, - _In_z_ CONST CHAR* pszSub, - _In_ INT cchStart = 0 - ) throw() - { - INT cchIndex = -1; - size_t cchLen = StringLength(pszSrc); - - if (pszSrc != NULL && - pszSub != NULL && - cchStart >= 0 && - cchStart <= static_cast(cchLen)) - { - CHAR* psz = strstr(const_cast(pszSrc + cchStart), pszSub); - - if (psz != NULL) - { - cchIndex = static_cast(psz - pszSrc); - } - } - - return cchIndex; - } - - /*++ - - Routine Name: - - Find - - Routine Description: - - Retrieves the location of a sub string in another string. This is the - WCHAR spzecific implementation for native string type - - Arguments: - - pszSrc - string to search in - pszSub - sub string to search for - cchStart - starting point for the search - - Return Value: - - < 0 if the substring was not found - Otherwise, the location of the substring - - --*/ - static INT - Find( - _In_z_ CONST WCHAR* pszSrc, - _In_z_ CONST WCHAR* pszSub, - _In_ INT cchStart = 0 - ) throw() - { - INT cchIndex = -1; - size_t cchLen = StringLength(pszSrc); - - if (pszSrc != NULL && - pszSub != NULL && - cchStart >= 0 && - cchStart <= static_cast(cchLen)) - { - WCHAR* psz = wcsstr(const_cast(pszSrc + cchStart), pszSub); - - if (psz != NULL) - { - cchIndex = static_cast(psz - pszSrc); - } - } - - return cchIndex; - } - - /*++ - - Routine Name: - - Format - - Routine Description: - - Writes formatted data to the string. WCHAR specific implementation. - - Arguments: - - pszFormat - the format string - argList - Variable argument list - - Return Value: - - None - - --*/ - VOID - Format( - _In_z_ CONST WCHAR* pszFormat, - va_list argList - ) - { - INT cchFormatedLen = _vscwprintf(pszFormat, argList); - - if (cchFormatedLen >= 0) - { - SetBufferSize(cchFormatedLen); - vswprintf_s(GetString(), GetBufferCharCount(), pszFormat, argList); - } - else - { - throw CXDException(E_INVALIDARG); - } - } - - /*++ - - Routine Name: - - Format - - Routine Description: - - Writes formatted data to the string. CHAR specific implementation. - - Arguments: - - pszFormat - the format string - argList - Variable argument list - - Return Value: - - None - - --*/ - VOID - Format( - _In_z_ CONST CHAR* pszFormat, - va_list argList - ) - { - INT cchFormatedLen = _vscprintf(pszFormat, argList); - - if (cchFormatedLen >= 0) - { - SetBufferSize(cchFormatedLen); - vsprintf_s(GetString(), GetBufferCharCount(), pszFormat, argList); - } - else - { - throw CXDException(E_INVALIDARG); - } - } - - /*++ - - Routine Name: - - IsSpace - - Routine Description: - - Determinese if a character is white space character. WCHAR specific implementation. - - Arguments: - - szCandidate - candidate character value - - Return Value: - - true - if the character is a white space character - false - otherwise - - --*/ - static bool - IsSpace( - _In_ CONST WCHAR& szCandidate - ) - { - return iswspace(szCandidate) != 0; - } - - /*++ - - Routine Name: - - IsSpace - - Routine Description: - - Determinese if a character is white space character. CHAR specific implementation. - - Arguments: - - szCandidate - candidate character value - - Return Value: - - true - if the character is a white space character - false - otherwise - - --*/ - static bool - IsSpace( - _In_z_ CONST CHAR& szCandidate - ) - { - return isspace(szCandidate) != 0; - } - - /*++ - - Routine Name: - - MakeLower - - Routine Description: - - Converts all characters in the source string to lower case characters. - WCHAR specific implementation. - - Arguments: - - pszSrc - string to be converted - cchSrc - character count of the string - - Return Value: - - NULL if the conversion fails - Pointer to the converted string on success - - --*/ - static PWSTR - MakeLower( - PWSTR pszSrc, - size_t cchSrc - ) - { - PWSTR pszRet = NULL; - if (_wcslwr_s(pszSrc, cchSrc) == 0) - { - pszRet = pszSrc; - } - - return pszRet; - } - - /*++ - - Routine Name: - - MakeLower - - Routine Description: - - Converts all characters in the source string to lower case characters. - CHAR specific implementation. - - Arguments: - - pszSrc - string to be converted - cchSrc - character count of the string - - Return Value: - - NULL if the conversion fails - Pointer to the converted string on success - - --*/ - static PSTR - MakeLower( - PSTR pszSrc, - size_t cchSrc - ) - { - PSTR pszRet = NULL; - if (_strlwr_s(pszSrc, cchSrc) == 0) - { - pszRet = pszSrc; - } - - return pszRet; - } - - /*++ - - Routine Name: - - GetString - - Routine Description: - - Retrieves the underlying string. - - Arguments: - - None - - Return Value: - - The underlying string - - --*/ - _T*& - GetString( - VOID - ) CONST - { - if (m_pszData == NULL) - { - SetBufferSize(1); - } - - return m_pszData; - } - -private: - mutable _T* m_pszData; -}; - -typedef CStringXDT CStringXD; -typedef CStringXDT CStringXDW; -typedef CStringXDT CStringXDA; - diff --git a/print/XPSDrvSmpl/src/ui/bkdmptcnv.cpp b/print/XPSDrvSmpl/src/ui/bkdmptcnv.cpp deleted file mode 100644 index 00c4e905..00000000 --- a/print/XPSDrvSmpl/src/ui/bkdmptcnv.cpp +++ /dev/null @@ -1,433 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bkdmptcnv.cpp - -Abstract: - - Booklet/Binding devmode <-> PrintTicket conversion class implementation. The class - defines a common data representation between the DevMode (GPD) and PrintTicket - representations and implements the conversion and validation methods required - by CFeatureDMPTConvert. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "xdstring.h" -#include "bkdmptcnv.h" -#include "bkpchndlr.h" - -using XDPrintSchema::Binding::BindingData; -using XDPrintSchema::Binding::EBinding; -using XDPrintSchema::Binding::EBindingMin; -using XDPrintSchema::Binding::JobBindAllDocuments; -using XDPrintSchema::Binding::DocumentBinding; -using XDPrintSchema::Binding::EBindingMax; - -using XDPrintSchema::Binding::EBindingOption; -using XDPrintSchema::Binding::None; -using XDPrintSchema::Binding::BindLeft; -using XDPrintSchema::Binding::BindRight; -using XDPrintSchema::Binding::BindTop; -using XDPrintSchema::Binding::BindBottom; - -PCSTR g_pszBindFeature[EBindingMax] = { - "JobBindAllDocuments", - "DocumentBinding", -}; -static GPDStringToOption g_bindingTypeOption[] = { - {"None", None}, - {"BindLeft", BindLeft}, - {"BindRight", BindRight}, - {"BindTop", BindTop}, - {"BindBottom", BindBottom}, -}; -UINT g_cBindOption = sizeof(g_bindingTypeOption)/sizeof(GPDStringToOption); - -/*++ - -Routine Name: - - CBookletDMPTConv::CBookletDMPTConv - -Routine Description: - - CBookletDMPTConv class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CBookletDMPTConv::CBookletDMPTConv() -{ -} - -/*++ - -Routine Name: - - CBookletDMPTConv::~CBookletDMPTConv - -Routine Description: - - CBookletDMPTConv class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CBookletDMPTConv::~CBookletDMPTConv() -{ -} - -/*++ - -Routine Name: - - CBookletDMPTConv::GetPTDataSettingsFromDM - -Routine Description: - - Populates the booklet data structure from the Devmode passed in. - -Arguments: - - pDevmode - pointer to input devmode buffer. - cbDevmode - size in bytes of full input devmode. - pPrivateDevmode - pointer to input private devmode buffer. - cbDrvPrivateSize - size in bytes of private devmode. - pDataSettings - Pointer to booklet data structure to be updated. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBookletDMPTConv::GetPTDataSettingsFromDM( - _In_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _In_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize, - _Out_ BookletSettings* pDataSettings - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrivateDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDataSettings, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE) || - cbDrvPrivateSize == 0) - { - hr = E_INVALIDARG; - } - } - - // - // Retrieve the GPD and devmode controlled settings for both Job and Document binding - // - for (EBinding bindFeature = EBindingMin; - bindFeature < EBindingMax && SUCCEEDED(hr); - bindFeature = static_cast(bindFeature + 1)) - { - pDataSettings->settings[bindFeature].bindFeature = bindFeature; - hr = GetOptionFromGPDString(pDevmode, - cbDevmode, - g_pszBindFeature[bindFeature], - g_bindingTypeOption, - g_cBindOption, - pDataSettings->settings[bindFeature].bindOption); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBookletDMPTConv::MergePTDataSettingsWithPT - -Routine Description: - - This method updates the booklet data structure from a PrintTicket description. - -Arguments: - - pPrintTicket - Pointer to the input PrintTicket. - pDataSettings - Pointer to the booklet data structure - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBookletDMPTConv::MergePTDataSettingsWithPT( - _In_ IXMLDOMDocument2* pPrintTicket, - _Inout_ BookletSettings* pDataSettings - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDataSettings, E_POINTER))) - { - try - { - // - // Get the binding settings from the PrintTicket and set the options in - // the appropriate Job or Document equivalent in the BookletSettings structure - // - BindingData bindData; - CBookPTHandler bkPTHndlr(pPrintTicket); - - if (SUCCEEDED(hr = bkPTHndlr.GetData(&bindData))) - { - // - // Only update settings relevant to the feature - // - if (bindData.bindFeature < EBindingMax && - bindData.bindFeature >= EBindingMin) - { - pDataSettings->settings[bindData.bindFeature] = bindData; - } - } - else if (hr == E_ELEMENT_NOT_FOUND) - { - // - // Binding setting not in the PT - make sure neither Job or - // Document binding are set in the outgoing data structure - // - pDataSettings->settings[JobBindAllDocuments].bindOption = None; - pDataSettings->settings[DocumentBinding].bindOption = None; - - hr = S_OK; - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBookletDMPTConv::SetPTDataInDM - -Routine Description: - - This method updates the booklet options in the devmode from the UI Settings. - -Arguments: - - dataSettings - Reference to booklet data settings to be updated. - pDevmode - pointer to devmode to be updated. - cbDevmode - size in bytes of full devmode. - pPrivateDevmode - pointer to input private devmode buffer. - cbDrvPrivateSize - size in bytes of private devmode. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBookletDMPTConv::SetPTDataInDM( - _In_ CONST BookletSettings& dataSettings, - _Inout_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _Inout_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrivateDevmode, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE) || - cbDrvPrivateSize == 0) - { - hr = E_INVALIDARG; - } - } - - for (EBinding bindFeature = EBindingMin; - bindFeature < EBindingMax && SUCCEEDED(hr); - bindFeature = static_cast(bindFeature + 1)) - { - hr = SetGPDStringFromOption(pDevmode, - cbDevmode, - g_pszBindFeature[bindFeature], - g_bindingTypeOption, - g_cBindOption, - dataSettings.settings[bindFeature].bindOption); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBookletDMPTConv::SetPTDataInPT - -Routine Description: - - This method updates the watemark PrintTicket description from booklet data structure. - -Arguments: - - dataSettings - Reference to booklet data structure to update from. - pPrintTicket - Pointer to the PrintTicket to be updated. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CBookletDMPTConv::SetPTDataInPT( - _In_ CONST BookletSettings& dataSettings, - _Inout_ IXMLDOMDocument2* pPrintTicket - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER))) - { - try - { - CBookPTHandler bkPTHndlr(pPrintTicket); - BindingData bkData; - - // - // Preferentially set Job over Document - // - if (dataSettings.settings[JobBindAllDocuments].bindOption != None) - { - bkData.bindFeature = JobBindAllDocuments; - bkData.bindOption = dataSettings.settings[JobBindAllDocuments].bindOption; - } - else - { - bkData.bindFeature = DocumentBinding; - bkData.bindOption = dataSettings.settings[DocumentBinding].bindOption; - } - - // - // If the option is enabled set, otherwise delete it from the PT - // - if (bkData.bindOption != None) - { - hr = bkPTHndlr.SetData(&bkData); - } - else - { - hr = bkPTHndlr.Delete(); - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CBookletDMPTConv::CompletePrintCapabilities - -Routine Description: - - Unidrv calls this routine with an input Device Capabilities Document - that is partially populated with Device capabilities information - filled in by Unidrv for features that it understands. The plug-in - needs to read any private features in the input PrintTicket, delete - them and add them back under Printschema namespace so that higher - level applications can understand them and make use of them. - -Arguments: - - pPrintTicket - pointer to input PrintTicket - pCapabilities - pointer to Device Capabilities Document. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CBookletDMPTConv::CompletePrintCapabilities( - _In_opt_ IXMLDOMDocument2*, - _Inout_ IXMLDOMDocument2* pPrintCapabilities - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPrintCapabilities, E_POINTER))) - { - try - { - CBookPCHandler bookpcHandler(pPrintCapabilities); - bookpcHandler.SetCapabilities(); - } - catch(CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/ui/bkdmptcnv.h b/print/XPSDrvSmpl/src/ui/bkdmptcnv.h deleted file mode 100644 index bd6640c9..00000000 --- a/print/XPSDrvSmpl/src/ui/bkdmptcnv.h +++ /dev/null @@ -1,84 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - bkdmptcnv.h - -Abstract: - - Booklet/Binding devmode <-> PrintTicket conversion class definition. The class - defines a common data representation between the DevMode (GPD) and PrintTicket - representations and implements the conversion and validation methods required - by CFeatureDMPTConvert. - ---*/ - -#pragma once - -#include "ftrdmptcnv.h" -#include "bkpthndlr.h" - -// -// The PT handling code defines a single BindingData structure that covers both -// JobBindAllDocuments and DocumentBinding to avoid conflicts. The GPD however -// controls both so we re-use the BindingData structure to handle both in -// the DevMode -// -struct BookletSettings -{ - XDPrintSchema::Binding::BindingData settings[XDPrintSchema::Binding::EBindingMax]; -}; - -class CBookletDMPTConv : public CFeatureDMPTConvert -{ -public: - CBookletDMPTConv(); - - ~CBookletDMPTConv(); - -private: - HRESULT - GetPTDataSettingsFromDM( - _In_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _In_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize, - _Out_ BookletSettings* pDataSettings - ); - - HRESULT - MergePTDataSettingsWithPT( - _In_ IXMLDOMDocument2* pPrintTicket, - _Inout_ BookletSettings* pDrvSettings - ); - - HRESULT - SetPTDataInDM( - _In_ CONST BookletSettings& drvSettings, - _Inout_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _Inout_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize - ); - - HRESULT - SetPTDataInPT( - _In_ CONST BookletSettings& drvSettings, - _Inout_ IXMLDOMDocument2* pPrintTicket - ); - - HRESULT STDMETHODCALLTYPE - CompletePrintCapabilities( - _In_opt_ IXMLDOMDocument2* pPrintTicket, - _Inout_ IXMLDOMDocument2* pPrintCapabilities - ); -}; diff --git a/print/XPSDrvSmpl/src/ui/colctrls.cpp b/print/XPSDrvSmpl/src/ui/colctrls.cpp deleted file mode 100644 index acffdada..00000000 --- a/print/XPSDrvSmpl/src/ui/colctrls.cpp +++ /dev/null @@ -1,371 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - colctrls.cpp - -Abstract: - - Implementation of the color management specific UI controls. These are the - combo box used to select the PageColorManagement option, a list box - for selecting the PageSourceColorProfile option and a combo box for - selecting the PageSourceColorProfile option. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "resource.h" -#include "colctrls.h" - -PCSTR CUICtrlPageColManCombo::m_pszPageColManName = "PageColorManagement"; -PCSTR CUICtrlColProfList::m_pszDestColProf = "PageSourceColorProfile"; -PCSTR CUICtrlPageColIntentCombo::m_pszPageIntentName = "PageICMRenderingIntent"; - -#define DRIVER_COL_MAN_SEL 2 - -/*++ - -Routine Name: - - CUICtrlPageColManCombo::CUICtrlPageColManCombo - -Routine Description: - - CUICtrlPageColManCombo class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlPageColManCombo::CUICtrlPageColManCombo() : - CUICtrlDefaultCombo(m_pszPageColManName, IDC_COMBO_COL_MANAGE) -{ -} - -/*++ - -Routine Name: - - CUICtrlPageColManCombo::~CUICtrlPageColManCombo - -Routine Description: - - CUICtrlPageColManCombo class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlPageColManCombo::~CUICtrlPageColManCombo() -{ -} - -/*++ - -Routine Name: - - CUICtrlPageColManCombo::OnInit - -Routine Description: - - This is responsible for initialising the control and is called when - the WM_INITDIALOG message is recieved. This method populates the combo - box with the appropriate option strings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlPageColManCombo::OnInit( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - // - // Populate the combo box - // - if (SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_NONE)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_DEVICE)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_DRIVER))) - { - hr = AddString(hDlg, g_hInstance, IDS_GPD_SYSTEM); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlPageColManCombo::EnableDependentCtrls - -Routine Description: - - This method is used to enable or disable other controls in the UI based on the - current combo box selection. - -Arguments: - - hDlg - handle to the parent window - lSel - current combo box selection - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlPageColManCombo::EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ) -{ - HRESULT hr = S_OK; - HWND hWnd = NULL; - - if (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TEXT_COLPROF), E_HANDLE))) - { - EnableWindow(hWnd, lSel == DRIVER_COL_MAN_SEL); - } - - if (SUCCEEDED(hr) && - (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_LIST_COLPROF), E_HANDLE)))) - { - EnableWindow(hWnd, lSel == DRIVER_COL_MAN_SEL); - } - - if (SUCCEEDED(hr) && - (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_COL_INTENT), E_HANDLE)))) - { - EnableWindow(hWnd, lSel == DRIVER_COL_MAN_SEL); - } - - if (SUCCEEDED(hr) && - (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_COMBO_COL_INTENT), E_HANDLE)))) - { - EnableWindow(hWnd, lSel == DRIVER_COL_MAN_SEL); - } - - if (FAILED(hr)) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlColProfList::CUICtrlColProfList - -Routine Description: - - CUICtrlColProfList class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlColProfList::CUICtrlColProfList() : - CUICtrlDefaultList(m_pszDestColProf, IDC_LIST_COLPROF) -{ -} - -/*++ - -Routine Name: - - CUICtrlColProfList::~CUICtrlColProfList - -Routine Description: - - CUICtrlColProfList class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlColProfList::~CUICtrlColProfList() -{ -} - -/*++ - -Routine Name: - - CUICtrlColProfList::OnInit - -Routine Description: - - This is responsible for initialising the control and is called when - the WM_INITDIALOG message is recieved. This method populates the list - box with the appropriate option strings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlColProfList::OnInit( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - // - // Populate the combo box - // - if (SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_CMYK))) - { - hr = AddString(hDlg, g_hInstance, IDS_GPD_SCRGB); - } - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CUICtrlPageColIntentCombo::CUICtrlPageColIntentCombo - -Routine Description: - - CUICtrlPageColIntentCombo class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlPageColIntentCombo::CUICtrlPageColIntentCombo() : - CUICtrlDefaultCombo(m_pszPageIntentName, IDC_COMBO_COL_INTENT) -{ -} - -/*++ - -Routine Name: - - CUICtrlPageColIntentCombo::~CUICtrlPageColIntentCombo - -Routine Description: - - CUICtrlPageColIntentCombo class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlPageColIntentCombo::~CUICtrlPageColIntentCombo() -{ -} - -/*++ - -Routine Name: - - CUICtrlPageColIntentCombo::OnInit - -Routine Description: - - This is responsible for initialising the control and is called when - the WM_INITDIALOG message is recieved. This method populates the combo - box with the appropriate option strings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlPageColIntentCombo::OnInit( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - // - // Populate the combo box - // - if (SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_ABSCOLINTENT)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_RELCOLINTENT)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_PHOTOINTENT))) - { - hr = AddString(hDlg, g_hInstance, IDS_GPD_BIZINTENT); - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/ui/colctrls.h b/print/XPSDrvSmpl/src/ui/colctrls.h deleted file mode 100644 index 90ebd21c..00000000 --- a/print/XPSDrvSmpl/src/ui/colctrls.h +++ /dev/null @@ -1,83 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - colctrls.h - -Abstract: - - Definition of the color management specific UI controls. These are the - combo box used to select the PageColorManagement option, a list box - for selecting the PageSourceColorProfile option and a combo box for - selecting the PageSourceColorProfile option. - ---*/ - -#pragma once - -#include "uictrl.h" - -class CUICtrlPageColManCombo : public CUICtrlDefaultCombo -{ -public: - CUICtrlPageColManCombo(); - - virtual ~CUICtrlPageColManCombo(); - - HRESULT - OnInit( - _In_ CONST HWND hDlg - ); - -private: - HRESULT - EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ); - -private: - static PCSTR m_pszPageColManName; -}; - -class CUICtrlColProfList : public CUICtrlDefaultList -{ -public: - CUICtrlColProfList(); - - virtual ~CUICtrlColProfList(); - - HRESULT - OnInit( - _In_ CONST HWND hDlg - ); - -private: - static PCSTR m_pszDestColProf; -}; - -class CUICtrlPageColIntentCombo : public CUICtrlDefaultCombo -{ -public: - CUICtrlPageColIntentCombo(); - - virtual ~CUICtrlPageColIntentCombo(); - - HRESULT - OnInit( - _In_ CONST HWND hDlg - ); - -private: - static PCSTR m_pszPageIntentName; -}; - diff --git a/print/XPSDrvSmpl/src/ui/coldmptcnv.cpp b/print/XPSDrvSmpl/src/ui/coldmptcnv.cpp deleted file mode 100644 index 3d20af57..00000000 --- a/print/XPSDrvSmpl/src/ui/coldmptcnv.cpp +++ /dev/null @@ -1,395 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - coldmptcnv.cpp - -Abstract: - - PageSourceColorProfile devmode <-> PrintTicket conversion class implementation. - The class defines a common data representation between the DevMode (GPD) and PrintTicket - representations and implements the conversion and validation methods required - by CFeatureDMPTConvert. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "xdstring.h" -#include "cmprofpchndlr.h" -#include "coldmptcnv.h" - -using XDPrintSchema::PageSourceColorProfile::PageSourceColorProfileData; -using XDPrintSchema::PageSourceColorProfile::EProfileOption; -using XDPrintSchema::PageSourceColorProfile::RGB; -using XDPrintSchema::PageSourceColorProfile::CMYK; - -PCWSTR g_pszCMYKProfileName = L"xdCMYKPrinter.icc"; -PCWSTR g_pszRGBProfileName = L"xdwscRGB.icc"; -PCSTR g_pszColProfFeature = "PageSourceColorProfile"; -static GPDStringToOption g_colProfTypeOption[] = { - {"CMYK", CMYK}, - {"scRGB", RGB}, -}; -UINT g_cColProfOption = sizeof(g_colProfTypeOption)/sizeof(GPDStringToOption); - -/*++ - -Routine Name: - - CColorProfileDMPTConv::CColorProfileDMPTConv - -Routine Description: - - CColorProfileDMPTConv class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CColorProfileDMPTConv::CColorProfileDMPTConv() -{ -} - -/*++ - -Routine Name: - - CColorProfileDMPTConv::~CColorProfileDMPTConv - -Routine Description: - - CColorProfileDMPTConv class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CColorProfileDMPTConv::~CColorProfileDMPTConv() -{ -} - -/*++ - -Routine Name: - - CColorProfileDMPTConv::GetPTDataSettingsFromDM - -Routine Description: - - Populates the color profile data structure from the Devmode passed in. - -Arguments: - - pDevmode - pointer to input devmode buffer. - cbDevmode - size in bytes of full input devmode. - pPrivateDevmode - pointer to input private devmode buffer. - cbDrvPrivateSize - size in bytes of private devmode. - pDataSettings - Pointer to color profile data structure to be updated. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorProfileDMPTConv::GetPTDataSettingsFromDM( - _In_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _In_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize, - _Out_ PageSourceColorProfileData* pDataSettings - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrivateDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDataSettings, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE) || - cbDrvPrivateSize == 0) - { - hr = E_INVALIDARG; - } - } - - // - // Defer setting up the profile file names until we write to the PT - // as they only have meaning at that point - // - if (SUCCEEDED(hr)) - { - GetOptionFromGPDString(pDevmode, - cbDevmode, - g_pszColProfFeature, - g_colProfTypeOption, - g_cColProfOption, - pDataSettings->cmProfile); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorProfileDMPTConv::MergePTDataSettingsWithPT - -Routine Description: - - This method updates the color profile data structure from a PrintTicket description. - -Arguments: - - pPrintTicket - Pointer to the input PrintTicket. - pDataSettings - Pointer to the color profile data structure - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorProfileDMPTConv::MergePTDataSettingsWithPT( - _In_ IXMLDOMDocument2* pPrintTicket, - _Inout_ PageSourceColorProfileData* pDataSettings - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDataSettings, E_POINTER))) - { - try - { - PageSourceColorProfileData profData; - CColorManageProfilePTHandler profPTHndlr(pPrintTicket); - - if (SUCCEEDED(hr = profPTHndlr.GetData(&profData))) - { - pDataSettings->cmProfile = profData.cmProfile; - } - else if (hr == E_ELEMENT_NOT_FOUND) - { - // - // The property is not in the PT. This is not an error - reset hresult - // and continue - // - hr = S_OK; - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorProfileDMPTConv::SetPTDataInDM - -Routine Description: - - This method updates the color profile options in the devmode from the UI Settings. - -Arguments: - - dataSettings - Reference to color profile data settings to be updated. - pDevmode - pointer to devmode to be updated. - cbDevmode - size in bytes of full devmode. - pPrivateDevmode - pointer to input private devmode buffer. - cbDrvPrivateSize - size in bytes of private devmode. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorProfileDMPTConv::SetPTDataInDM( - _In_ CONST PageSourceColorProfileData& dataSettings, - _Inout_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _Inout_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrivateDevmode, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE) || - cbDrvPrivateSize == 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - hr = SetGPDStringFromOption(pDevmode, - cbDevmode, - g_pszColProfFeature, - g_colProfTypeOption, - g_cColProfOption, - dataSettings.cmProfile); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorProfileDMPTConv::SetPTDataInPT - -Routine Description: - - This method updates the watemark PrintTicket description from color profile data structure. - -Arguments: - - dataSettings - Reference to color profile data structure to update from. - pPrintTicket - Pointer to the PrintTicket to be updated. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorProfileDMPTConv::SetPTDataInPT( - _In_ CONST PageSourceColorProfileData& dataSettings, - _Inout_ IXMLDOMDocument2* pPrintTicket - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER))) - { - try - { - CColorManageProfilePTHandler cmProfPTHndlr(pPrintTicket); - PageSourceColorProfileData profData; - profData.cmProfile = dataSettings.cmProfile; - - // - // Ensure profile file names are set from the enumerated type - // - if (profData.cmProfile == CMYK) - { - profData.cmProfileName = g_pszCMYKProfileName; - } - else - { - profData.cmProfileName = g_pszRGBProfileName; - } - - hr = cmProfPTHndlr.SetData(&profData); - } - catch (CXDException& e) - { - hr = e; - } - } - else - { - hr = E_POINTER; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CColorProfileDMPTConv::CompletePrintCapabilities - -Routine Description: - - Unidrv calls this routine with an input Device Capabilities Document - that is partially populated with Device capabilities information - filled in by Unidrv for features that it understands. The plug-in - needs to read any private features in the input PrintTicket, delete - them and add them back under Printschema namespace so that higher - level applications can understand them and make use of them. - -Arguments: - - pPrintTicket - pointer to input PrintTicket - pCapabilities - pointer to Device Capabilities Document. - -Return Value: - - HRESULT - S_OK - Always - ---*/ -HRESULT STDMETHODCALLTYPE -CColorProfileDMPTConv::CompletePrintCapabilities( - _In_opt_ IXMLDOMDocument2*, - _Inout_ IXMLDOMDocument2* pPrintCapabilities - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPrintCapabilities, E_POINTER))) - { - try - { - CColorManageProfilePCHandler cmProfPCHandler(pPrintCapabilities); - cmProfPCHandler.SetCapabilities(); - } - catch(CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/ui/coldmptcnv.h b/print/XPSDrvSmpl/src/ui/coldmptcnv.h deleted file mode 100644 index 0c890758..00000000 --- a/print/XPSDrvSmpl/src/ui/coldmptcnv.h +++ /dev/null @@ -1,76 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - coldmptcnv.h - -Abstract: - - PageSourceColorProfile devmode <-> PrintTicket conversion class definition. - The class defines a common data representation between the DevMode (GPD) and PrintTicket - representations and implements the conversion and validation methods required - by CFeatureDMPTConvert. - ---*/ - -#pragma once - -#include "ftrdmptcnv.h" -#include "cmprofpthndlr.h" -#include "cmprofiledata.h" - -class CColorProfileDMPTConv : - public CFeatureDMPTConvert -{ -public: - CColorProfileDMPTConv(); - - virtual ~CColorProfileDMPTConv(); - -private: - HRESULT - GetPTDataSettingsFromDM( - _In_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _In_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize, - _Out_ XDPrintSchema::PageSourceColorProfile::PageSourceColorProfileData* pDataSettings - ); - - HRESULT - MergePTDataSettingsWithPT( - _In_ IXMLDOMDocument2* pPrintTicket, - _Inout_ XDPrintSchema::PageSourceColorProfile::PageSourceColorProfileData* pDrvSettings - ); - - HRESULT - SetPTDataInDM( - _In_ CONST XDPrintSchema::PageSourceColorProfile::PageSourceColorProfileData& drvSettings, - _Inout_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _Inout_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize - ); - - HRESULT - SetPTDataInPT( - _In_ CONST XDPrintSchema::PageSourceColorProfile::PageSourceColorProfileData& drvSettings, - _Inout_ IXMLDOMDocument2* pPrintTicket - ); - - HRESULT STDMETHODCALLTYPE - CompletePrintCapabilities( - _In_opt_ IXMLDOMDocument2*, - _Inout_ IXMLDOMDocument2* pPrintCapabilities - ); -}; - diff --git a/print/XPSDrvSmpl/src/ui/colppg.cpp b/print/XPSDrvSmpl/src/ui/colppg.cpp deleted file mode 100644 index 24e9eb35..00000000 --- a/print/XPSDrvSmpl/src/ui/colppg.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - colppg.cpp - -Abstract: - - Implementation of the color management property page. This class is - responsible for initialising and registering the color management - property page and its controls. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "xdstring.h" -#include "resource.h" -#include "colppg.h" -#include "colctrls.h" - -/*++ - -Routine Name: - - CColorPropPage::CColorPropPage - -Routine Description: - - CColorPropPage class constructor. - Creates a handler class object for every control on the color profile property page. - Each of these handlers is stored in a collection. - -Arguments: - - None - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CColorPropPage::CColorPropPage() -{ - HRESULT hr = S_OK; - - try - { - CUIControl* pControl = new(std::nothrow) CUICtrlPageColManCombo(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_COMBO_COL_MANAGE, pControl); - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlColProfList(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_LIST_COLPROF, pControl); - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlPageColIntentCombo(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_COMBO_COL_INTENT, pControl); - } - } - } - catch (CXDException& e) - { - hr = e; - } - - if (FAILED(hr)) - { - DestroyUIComponents(); - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CColorPropPage::~CColorPropPage - -Routine Description: - - CColorPropPage class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CColorPropPage::~CColorPropPage() -{ -} - -/*++ - -Routine Name: - - CColorPropPage::InitDlgBox - -Routine Description: - - Provides the base class with the data required to intialise the dialog box. - -Arguments: - - ppszTemplate - Pointer to dialog box template to be intialised. - ppszTitle - Pointer to dialog box title to be intialised. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CColorPropPage::InitDlgBox( - _Out_ LPCTSTR* ppszTemplate, - _Out_ LPCTSTR* ppszTitle - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppszTemplate, E_POINTER)) || - SUCCEEDED(hr = CHECK_POINTER(ppszTitle, E_POINTER))) - { - *ppszTemplate = MAKEINTRESOURCE(IDD_COL_MANAGE); - *ppszTitle = MAKEINTRESOURCE(IDS_COLMAN); - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/ui/colppg.h b/print/XPSDrvSmpl/src/ui/colppg.h deleted file mode 100644 index 76fff12d..00000000 --- a/print/XPSDrvSmpl/src/ui/colppg.h +++ /dev/null @@ -1,42 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - colppg.h - -Abstract: - - Definition of the color management property page. This class is - responsible for initialising and registering the color management - property page and its controls. - ---*/ - -#pragma once - -#include "precomp.h" -#include "docppg.h" - -class CColorPropPage : public CDocPropPage -{ -public: - CColorPropPage(); - - virtual ~CColorPropPage(); - - HRESULT - InitDlgBox( - _Out_ LPCTSTR* ppszTemplate, - _Out_ LPCTSTR* ppszTitle - ); -}; - diff --git a/print/XPSDrvSmpl/src/ui/devmode.h b/print/XPSDrvSmpl/src/ui/devmode.h deleted file mode 100644 index c5e74fbc..00000000 --- a/print/XPSDrvSmpl/src/ui/devmode.h +++ /dev/null @@ -1,82 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - devmode.h - -Abstract: - - Definition of the OEM devmode structure. - ---*/ - -#pragma once - - -//////////////////////////////////////////////////////// -// OEM Devmode Defines -//////////////////////////////////////////////////////// - -#define MAX_WATERMARK_TEXT 24 - -//////////////////////////////////////////////////////// -// OEM Devmode Type Definitions -//////////////////////////////////////////////////////// - -// -//Can add info to the private devmode bellow here. -//Note : -// This structure must be prefixed by OEM_DMEXTRAHEADER -// Your plug-in must implement the IPrintOemUI::DevMode method -// -typedef struct tagOEMDEV -{ - OEM_DMEXTRAHEADER dmOEMExtra; - - // - //Private DevMode Members - // - - // - // Page Scaling Members - // - - DWORD dwPgScaleX; - DWORD dwPgScaleY; - INT iPgOffsetX; - INT iPgOffsetY; - - // - // Watermark Members - // - INT iWMTransparency; - INT iWMAngle; - INT iWMOffsetX; - INT iWMOffsetY; - - // - // Text Watermark Members - // - INT iWMFontSize; - DWORD dwColText; - TCHAR strWMText[MAX_WATERMARK_TEXT]; - - // - // Bitmap / Vector Members - // - INT iWMWidth; - INT iWMHeight; - -} OEMDEV, *POEMDEV; - -typedef CONST OEMDEV *PCOEMDEV; - diff --git a/print/XPSDrvSmpl/src/ui/dllentry.cpp b/print/XPSDrvSmpl/src/ui/dllentry.cpp deleted file mode 100644 index 47c8a728..00000000 --- a/print/XPSDrvSmpl/src/ui/dllentry.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - dllentry.cpp - -Abstract: - - Implementation of the UI plugin dllentry points. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "xdsmplcf.h" - -/*++ - -Routine Name: - - DllMain - -Routine Description: - - Entry point into the dynamic-link library (DLL). - Called by the system when processes and threads are initialized and terminated, - or upon calls to the LoadLibrary and FreeLibrary functions. - -Arguments: - - hInst - Handle to the DLL module. - wReason - Indicates why the DLL entry-point function is being called. - -Return Value: - - TRUE - ---*/ -BOOL WINAPI -DllMain( - _In_ HINSTANCE hInst, - _In_ WORD wReason, - _In_opt_ LPVOID - ) -{ - switch (wReason) - { - case DLL_PROCESS_ATTACH: - { - g_hInstance = hInst; - } - break; - } - - return TRUE; -} - -/*++ - -Routine Name: - - DllCanUnloadNow - -Routine Description: - - Determines whether the DLL is in use. - If not, the caller can unload the DLL from memory. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - Dll can unload - S_FALSE - Dll can't unload - ---*/ -STDAPI -DllCanUnloadNow() -{ - if (g_cServerLocks == 0) - { - return S_OK ; - } - else - { - return S_FALSE; - } -} - -/*++ - -Routine Name: - - DllGetClassObject - -Routine Description: - - Retrieves the class objects for the DLL. - Supported class ids are CLSID_OEMUI and CLSID_OEMPTPROVIDER. - Called from within the CoGetClassObject function. - -Arguments: - - rclsid - CLSID that will associate the correct data and code. - riid - Reference to the identifier of the interface that the caller is to use to communicate with the class object. - ppv - Address of pointer variable that receives the interface pointer requested in riid. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - CLASS_E_CLASSNOTAVAILABLE - On unsupported class - ---*/ -STDAPI -DllGetClassObject( - _In_ REFCLSID rclsid, - _In_ REFIID riid, - _Outptr_ LPVOID FAR* ppv - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppv, E_POINTER))) - { - *ppv = NULL; - - // - // Make sure the appropriate CLSID is being requested - // - if (rclsid == CLSID_OEMUI || - rclsid == CLSID_OEMPTPROVIDER) - { - CXDSmplUICF* pXDSmplUICF = new(std::nothrow) CXDSmplUICF(); - hr = CHECK_POINTER(pXDSmplUICF, E_OUTOFMEMORY); - - if (SUCCEEDED(hr)) - { - // - // Get the requested interface. - // - hr = pXDSmplUICF->QueryInterface(riid, ppv); - - // - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - // - pXDSmplUICF->Release(); - } - } - else - { - hr = CLASS_E_CLASSNOTAVAILABLE; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/ui/docppg.cpp b/print/XPSDrvSmpl/src/ui/docppg.cpp deleted file mode 100644 index c297741a..00000000 --- a/print/XPSDrvSmpl/src/ui/docppg.cpp +++ /dev/null @@ -1,1314 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - docppg.cpp - -Abstract: - - Implementation of the document property page class. This is an abstract - class that provides common functionality for all property pages including - accessors and the dialog proc. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "xdstring.h" -#include "docppg.h" - -/*++ - -Routine Name: - - CDocPropPage::CDocPropPage - -Routine Description: - - CDocPropPage class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CDocPropPage::CDocPropPage() : - m_hPage(NULL), - m_hComPropSheet(NULL), - m_pOemCUIPParam(NULL), - m_pfnComPropSheet(NULL), - m_pDriverUIHelp(NULL), - m_pUIProperties(NULL) -{ -} - -/*++ - -Routine Name: - - CDocPropPage::~CDocPropPage - -Routine Description: - - CDocPropPage class destructor. - -Arguments: - - None - -Return Value: - - None - ---*/ -CDocPropPage::~CDocPropPage() -{ - HRESULT hr = S_OK; - hr = DestroyUIComponents(); - - ASSERTMSG(SUCCEEDED(hr), "Error Deleting Property Pages/n"); -} - -/*++ - -Routine Name: - - CDocPropPage::PropPageInit - -Routine Description: - - Adds an additional Feature property page to the existing Unidrv supplied property pages. - Called from the Unidrv UI Plug-in entry point for DocumentPropertySheets(), - on the PROPSHEETUI_REASON_INIT message. - - This base class implementation provides common property page intialisation functionality for - all property pages. Derived property page classes are required to provide the dialog box template - and the dialog box title. - -Arguments: - - pPSUIInfo - Pointer to a PPROPSHEETUI_INFO structure. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::PropPageInit( - _In_ CONST PPROPSHEETUI_INFO pPSUIInfo - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPSUIInfo, E_POINTER))) - { - // - // Only proceed if we have effectively published the helper interfaces to the UI - // control objects. - // - // We also need to retrieve the dialog template resource and dialog title from the - // derived property page class. - // - PROPSHEETPAGE page = {0}; - if (SUCCEEDED(hr = PublishHelpToControls()) && - SUCCEEDED(hr = InitDlgBox(&page.pszTemplate, &page.pszTitle))) - { - page.dwSize = sizeof(PROPSHEETPAGE); - page.dwFlags = PSP_DEFAULT | PSP_USETITLE; - page.hInstance = g_hInstance; - - page.pfnDlgProc = CDocPropPage::DlgProc; - page.lParam = reinterpret_cast(this); - - pPSUIInfo->Result = pPSUIInfo->pfnComPropSheet(pPSUIInfo->hComPropSheet, - CPSFUNC_ADD_PROPSHEETPAGE, - reinterpret_cast(&page), - 0); - - if (SUCCEEDED(hr = SetComPropSheetFunc(pPSUIInfo->pfnComPropSheet)) && - SUCCEEDED(hr = SetPageHandle(reinterpret_cast(pPSUIInfo->Result)))) - { - hr = SetComPropSheetHandle(pPSUIInfo->hComPropSheet); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::StoreThis - -Routine Description: - - Stores a pointer to this instance of the CDocPropPage class - that will be associated with the windows handle provided. - -Arguments: - - hDlg - Handle of the property page window associated with this class. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::StoreThis( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - if (!SetProp(hDlg, MAKEINTATOM(ID_XDSMPL_DLG_ATOM), reinterpret_cast(this))) - { - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::RetrieveThis - -Routine Description: - - Obtains the instance of the CDocPropPage class that is associated with a windows handle. - -Arguments: - - hDlg - Handle of the property page Window associated with this class. - pDocPropPage - Address of a pointer to be filled out with the instance of this class. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ - -HRESULT -CDocPropPage::RetrieveThis( - _In_ CONST HWND hDlg, - _Outptr_ CDocPropPage** pDocPropPage - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_HANDLE(hDlg, E_HANDLE)) && - SUCCEEDED(hr = CHECK_POINTER(pDocPropPage, E_POINTER))) - { - *pDocPropPage = reinterpret_cast(GetProp(hDlg, MAKEINTATOM(ID_XDSMPL_DLG_ATOM))); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::RemoveThis - -Routine Description: - - Removes the class pointer from the associated windows handle. - -Arguments: - - hDlg - Handle of the property page Window associated with this class. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::RemoveThis( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_HANDLE(hDlg, E_HANDLE))) - { - RemoveProp(hDlg, MAKEINTATOM(ID_XDSMPL_DLG_ATOM)); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::SetComPropSheetFunc - -Routine Description: - - Store the pointer to the PFNCOMPROPSHEET function. - -Arguments: - - pfnComPropSheet - pointer to the PFNCOMPROPSHEET function. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::SetComPropSheetFunc( - _In_ CONST PFNCOMPROPSHEET pfnComPropSheet - ) -{ - HRESULT hr = S_OK; - - ASSERTMSG(pfnComPropSheet != NULL, "NULL pointer to common propert sheet functions.\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(pfnComPropSheet, E_POINTER))) - { - m_pfnComPropSheet = pfnComPropSheet; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::SetPageHandle - -Routine Description: - - Store the handle of a property page window. - -Arguments: - - hPage - Handle of a property page window. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::SetPageHandle( - _In_ CONST HANDLE hPage - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_HANDLE(hPage, E_HANDLE))) - { - m_hPage = hPage; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::SetComPropSheetHandle - -Routine Description: - - Store the handle of the Common Property Sheet window. - -Arguments: - - hComPropSheet - Handle of the common property sheet window. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::SetComPropSheetHandle( - _In_ CONST HANDLE hComPropSheet - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_HANDLE(hComPropSheet, E_HANDLE))) - { - m_hComPropSheet = hComPropSheet; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::GetComPropSheetFunc - -Routine Description: - - Retrieve the pointer of the PFNCOMPROPSHEET function. - -Arguments: - - ppfnComPropSheet - Address of a pointer that will be filled out with the PFNCOMPROPSHEET function. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::GetComPropSheetFunc( - _Outptr_ PFNCOMPROPSHEET* ppfnComPropSheet - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppfnComPropSheet, E_POINTER))) - { - *ppfnComPropSheet = m_pfnComPropSheet; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::GetPageHandle - -Routine Description: - - Retrieves the property page handle. - -Arguments: - - None - -Return Value: - - Handle to the property page - ---*/ -HANDLE -CDocPropPage::GetPageHandle( - VOID - ) -{ - return m_hPage; -} - -/*++ - -Routine Name: - - CDocPropPage::GetComPropSheetHandle - -Routine Description: - - Retrieves the common property sheet handle - -Arguments: - - None - -Return Value: - - Handle to the common property sheet - ---*/ -HANDLE -CDocPropPage::GetComPropSheetHandle( - VOID - ) -{ - return m_hComPropSheet; -} - -/*++ - -Routine Name: - - CDocPropPage::DestroyUIComponents - -Routine Description: - - Destroy all control handler classes that have been added into the collection. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::DestroyUIComponents( - VOID - ) -{ - HRESULT hr = S_OK; - - try - { - UIControlMap::iterator iterUIComponents = m_UIControls.begin(); - - while (iterUIComponents != m_UIControls.end()) - { - if (iterUIComponents->second != NULL) - { - delete iterUIComponents->second; - iterUIComponents->second = NULL; - } - iterUIComponents++; - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::AddUIControl - -Routine Description: - - Adds a control handler class into the collection. - -Arguments: - - iCtrlID - Resource Identifier of control. - pUIControl - Pointer to a control handler class. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::AddUIControl( - _In_ CONST INT iCtrlID, - _In_ CUIControl* pUIControl - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pUIControl, E_POINTER))) - { - try - { - m_UIControls[iCtrlID] = pUIControl; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::GetUIComponents - -Routine Description: - - Obtains the collection of control handlers. - -Arguments: - - ppUIComponents - Address of the pointer that will be filled out with the contain handler collection. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::GetUIComponents( - _Outptr_ UIControlMap** ppUIComponents - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppUIComponents, E_POINTER))) - { - *ppUIComponents = &m_UIControls; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::SetOemCUIPParam - -Routine Description: - - Store the pointer to the POEMCUIPPARAM function. - -Arguments: - - pOemCUIPParam - pointer to the POEMCUIPPARAM function. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::SetOemCUIPParam( - _In_ CONST POEMCUIPPARAM pOemCUIPParam - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pOemCUIPParam, E_POINTER))) - { - m_pOemCUIPParam = pOemCUIPParam; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::SetUIProperties - -Routine Description: - - Store the pointer to an CUIProperties interface. - -Arguments: - - pUIProperties - pointer to an CUIProperties interface. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::SetUIProperties( - _In_ CUIProperties* pUIProperties - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pUIProperties, E_POINTER))) - { - m_pUIProperties = pUIProperties; - } - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CDocPropPage::GetOemCUIPParam - -Routine Description: - - Retrieve the pointer to the OEMCUIPPARAM function. - -Arguments: - - ppOemCUIPParam - Address of a pointer that will be filled out with the POEMCUIPPARAM function. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::GetOemCUIPParam( - _Outptr_ POEMCUIPPARAM* ppOemCUIPParam - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppOemCUIPParam, E_POINTER))) - { - *ppOemCUIPParam = m_pOemCUIPParam; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::SetPrintOemDriverUI - -Routine Description: - - Store a pointer to the IPrintOemDriverUI interface. - -Arguments: - - pOEMDriverUI - pointer to the IPrintOemDriverUI interface. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::SetPrintOemDriverUI( - _In_ CONST IPrintOemDriverUI* pOEMDriverUI - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pOEMDriverUI, E_POINTER))) - { - m_pDriverUIHelp = const_cast(pOEMDriverUI); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::PublishHelpToControls - -Routine Description: - - Propagate any useful interfaces used in this class down to the collection of control handlers. - This allows access to these helper interfaces in the control handlers classes. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::PublishHelpToControls( - VOID - ) -{ - ASSERTMSG(m_pDriverUIHelp != NULL, "NULL pointer to driver UI help interface.\n"); - ASSERTMSG(m_pOemCUIPParam != NULL, "NULL pointer to OEMCUIPPARAM structure.\n"); - ASSERTMSG(m_pUIProperties != NULL, "NULL pointer to CUIProperties.\n"); - - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pDriverUIHelp, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pOemCUIPParam, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_PENDING))) - { - try - { - // - // Iterate over all controls and report the helper interfaces - // - if (!m_UIControls.empty()) - { - UIControlMap::iterator iterUIComponents = m_UIControls.begin(); - - while (iterUIComponents != m_UIControls.end()) - { - CUIControl* pControl = iterUIComponents->second; - - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_POINTER)) && - SUCCEEDED(hr = pControl->SetPrintOemDriverUI(m_pDriverUIHelp)) && - SUCCEEDED(hr = pControl->SetUIProperties(m_pUIProperties)) && - SUCCEEDED(hr = pControl->SetOemCUIPParam(m_pOemCUIPParam))) - { - iterUIComponents++; - } - } - - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::SendCommand - -Routine Description: - - Call the OnCommand() method in the relevant control handler in the collection. - -Arguments: - - hDlg - Handle of property page. - wParam - Windows WPARAM value passed with the windows message WM_COMMAND. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::SendCommand( - _In_ CONST HWND hDlg, - _In_ CONST WPARAM wParam - ) -{ - // - // Use the wParam as the index into the control map and - // inform the control that generated the command - // - HRESULT hr = S_OK; - - UIControlMap* pComponents = NULL; - - if (SUCCEEDED(hr = GetUIComponents(&pComponents)) && - SUCCEEDED(hr = CHECK_POINTER(pComponents, E_POINTER))) - { - try - { - CUIControl* pControl = (*pComponents)[LOWORD(wParam)]; - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_POINTER))) - { - hr = pControl->OnCommand(hDlg, HIWORD(wParam)); - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::SendNotify - -Routine Description: - - Call the OnNotify() method in the relevant control handler in the collection. - -Arguments: - - hDlg - Handle of property page. - pNMhdr - Windows Notify structure that was passed with the windows message WM_NOTIFY. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::SendNotify( - _In_ CONST HWND hDlg, - _In_ CONST NMHDR* pNMhdr - ) -{ - // - // Use the wParam as the index into the control map and - // inform the control of an activation - // - HRESULT hr = S_OK; - - UIControlMap* pComponents = NULL; - - if (SUCCEEDED(hr = GetUIComponents(&pComponents)) && - SUCCEEDED(hr = CHECK_POINTER(pComponents, E_POINTER))) - { - try - { - CUIControl* pControl = (*pComponents)[pNMhdr->idFrom]; - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_POINTER))) - { - hr = pControl->OnNotify(hDlg, pNMhdr); - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::SendSetActive - -Routine Description: - - Call the OnActivate() method in all control handlers in the collection. - -Arguments: - - hDlg - Handle of property page. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::SendSetActive( - _In_ CONST HWND hDlg - ) -{ - // - // Use the wParam as the index into the control map and - // inform the control of an activation - // - HRESULT hr = S_OK; - - UIControlMap* pComponents = NULL; - - if (SUCCEEDED(hr = GetUIComponents(&pComponents)) && - SUCCEEDED(hr = CHECK_POINTER(pComponents, E_POINTER))) - { - try - { - UIControlMap::iterator iterUIComponents = pComponents->begin(); - - while (iterUIComponents != pComponents->end()) - { - CUIControl* pControl = iterUIComponents->second; - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_POINTER))) - { - if (FAILED(hr = pControl->OnActivate(hDlg))) - { - break; - } - } - - iterUIComponents++; - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::SendInit - -Routine Description: - - Call the OnInit() method in all control handlers in the collection. - -Arguments: - - hDlg - Handle of property page. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CDocPropPage::SendInit( - _In_ CONST HWND hDlg - ) -{ - // - // Use the wParam as the index into the control map and - // inform the control of an activation - // - HRESULT hr = S_OK; - - UIControlMap* pComponents = NULL; - - if (SUCCEEDED(hr = GetUIComponents(&pComponents)) && - SUCCEEDED(hr = CHECK_POINTER(pComponents, E_POINTER))) - { - try - { - UIControlMap::iterator iterUIComponents = pComponents->begin(); - - while (iterUIComponents != pComponents->end()) - { - CUIControl* pControl = iterUIComponents->second; - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_POINTER))) - { - if (FAILED(hr = pControl->OnInit(hDlg))) - { - break; - } - } - - iterUIComponents++; - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CDocPropPage::DlgProc - -Routine Description: - - Dialog proccedure for the property page. - This handles all windows messages that are sent to the property page. - -Arguments: - - hDlg - Handle of the property page. - uiMessage - Specifies the message. - wParam - Specifies additional message-specific information. - lParam - Specifies additional message-specific information. - -Return Value: - - The return value is the result of the message processing and depends on the message sent. - ---*/ -INT_PTR CALLBACK -CDocPropPage::DlgProc( - _In_ CONST HWND hDlg, - _In_ CONST UINT uiMessage, - _In_ CONST WPARAM wParam, - _In_ CONST LPARAM lParam - ) -{ - HRESULT hr = S_OK; - BOOL retVal = FALSE; - - switch (uiMessage) - { - case WM_INITDIALOG: - { - // - // Store the class instance - // - PROPSHEETPAGE* pPage = reinterpret_cast(lParam); - - if (SUCCEEDED(hr = CHECK_POINTER(pPage, E_POINTER))) - { - if (pPage->lParam != NULL) - { - CDocPropPage* thisInst = reinterpret_cast(pPage->lParam); - - if (SUCCEEDED(hr = CHECK_POINTER(thisInst, E_FAIL))) - { - if (SUCCEEDED(hr = thisInst->StoreThis(hDlg))) - { - hr = thisInst->SendInit(hDlg); - } - } - } - else - { - hr = E_FAIL; - } - } - - // - // Set the keyboard focus to the control specified by wParam - // - retVal = TRUE; - } - break; - - case WM_COMMAND: - { - switch (HIWORD(wParam)) - { - case EN_CHANGE: - case BN_CLICKED: - case CBN_SELCHANGE: - // case LBN_SELCHANGE: CBN_SELCHANGE=LBN_SELCHANGE - { - CDocPropPage* thisInst; - - if (SUCCEEDED(hr = RetrieveThis(hDlg, &thisInst))) - { - if (SUCCEEDED(hr = CHECK_POINTER(thisInst, E_FAIL))) - { - hr = thisInst->SendCommand(hDlg, wParam); - } - } - - // - // Set to FALSE to indiate that the message has been handled. - // - retVal = FALSE; - } - break; - - default: - { - // - // Unhandled command so return TRUE - // - retVal = TRUE; - } - break; - } - } - break; - - case WM_NOTIFY: - { - NMHDR* pHdr = reinterpret_cast(lParam); - if (SUCCEEDED(hr = CHECK_POINTER(pHdr, E_POINTER))) - { - switch (pHdr->code) - { - case PSN_SETACTIVE: - { - CDocPropPage* thisInst; - - if (SUCCEEDED(hr = RetrieveThis(hDlg, &thisInst)) && - SUCCEEDED(hr = CHECK_POINTER(thisInst, E_FAIL))) - { - hr = thisInst->SendSetActive(hDlg); - } - - // - // Return FALSE to accept the page activation - // - retVal = FALSE; - } - break; - - case PSN_KILLACTIVE: - { - // - // Return FALSE to allow the page to lose activation - // - retVal = FALSE; - } - break; - - case PSN_APPLY: - { - PFNCOMPROPSHEET pfnComPropSheet = NULL; - - CDocPropPage* thisInst; - - if (SUCCEEDED(hr = RetrieveThis(hDlg, &thisInst)) && - SUCCEEDED(hr = CHECK_POINTER(thisInst, E_FAIL)) && - SUCCEEDED(hr = thisInst->GetComPropSheetFunc(&pfnComPropSheet)) && - SUCCEEDED(hr = CHECK_POINTER(pfnComPropSheet, E_FAIL))) - { - // - // Ensure that the last error is in a known state. - // - SetLastError(0); - - // - // We do not need to validate any settings so set PSNRET_NOERROR - // - if (SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR) == 0) - { - // - // A return value of 0 does not necessarily indicate a failure. - // - hr = HRESULT_FROM_WIN32(GetLastError()); - } - - if (SUCCEEDED(hr)) - { - // - // We have applied the change... - // - PropSheet_UnChanged(GetParent(hDlg), hDlg); - - // - // Inform the propsheet - // - pfnComPropSheet(thisInst->GetComPropSheetHandle(), - CPSFUNC_SET_RESULT, - reinterpret_cast(thisInst->GetPageHandle()), - (LPARAM)CPSUI_OK); - } - } - - retVal = TRUE; - } - break; - - case UDN_DELTAPOS: - { - CDocPropPage* thisInst; - - if (SUCCEEDED(hr = RetrieveThis(hDlg, &thisInst)) && - SUCCEEDED(hr = CHECK_POINTER(thisInst, E_FAIL))) - { - hr = thisInst->SendNotify(hDlg, pHdr); - } - - // - // Set return to FALSE to allow the control value - // - retVal = FALSE; - } - break; - } - } - } - break; - - case WM_NCDESTROY: - { - CDocPropPage* thisInst; - - if (SUCCEEDED(hr = CDocPropPage::RetrieveThis(hDlg, &thisInst)) && - SUCCEEDED(hr = CHECK_POINTER(thisInst, E_FAIL))) - { - hr = thisInst->RemoveThis(hDlg); - } - - // - // Set return to FALSE to indicate that the message was processed - // - retVal = FALSE; - } - break; - } - - ERR_ON_HR(hr); - return retVal; -} - diff --git a/print/XPSDrvSmpl/src/ui/docppg.h b/print/XPSDrvSmpl/src/ui/docppg.h deleted file mode 100644 index 1a6d1dc5..00000000 --- a/print/XPSDrvSmpl/src/ui/docppg.h +++ /dev/null @@ -1,186 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - docppg.h - -Abstract: - - Definition of the document property page class. This is an abstract - class that provides common functionality for all property pages including - accessors and the dialog proc. - ---*/ - -#pragma once - -#include "uictrl.h" - -#define ID_XDSMPL_DLG_ATOM 1000 - -typedef std::map UIControlMap; - -class CDocPropPage -{ -public: - CDocPropPage(); - - virtual ~CDocPropPage(); - - virtual HRESULT - InitDlgBox( - _Out_ LPCTSTR* ppszTemplate, - _Out_ LPCTSTR* ppszTitle - ) = 0; - - // - // Implementation - // - virtual HRESULT - PropPageInit( - _In_ CONST PPROPSHEETUI_INFO pPSUIInfo - ); - - virtual HRESULT - SetPrintOemDriverUI( - _In_ CONST IPrintOemDriverUI* pOEMDriverUI - ); - - virtual HRESULT - SetOemCUIPParam( - _In_ CONST POEMCUIPPARAM pOemCUIParam - ); - - virtual HRESULT - SetUIProperties( - _In_ CUIProperties* pUIProperties - ); - - static INT_PTR CALLBACK - DlgProc( - _In_ HWND hDlg, - _In_ UINT uiMessage, - _In_ WPARAM wParam, - _In_ LPARAM lParam - ); - -protected: - HRESULT - StoreThis( - _In_ CONST HWND hDlg - ); - - static HRESULT - RetrieveThis( - _In_ CONST HWND hDlg, - _Outptr_ CDocPropPage** pDocPropPage - ); - - HRESULT - RemoveThis( - _In_ CONST HWND hDlg - ); - - HRESULT - SetComPropSheetFunc( - _In_ CONST PFNCOMPROPSHEET pfnComPropSheet - ); - - HRESULT - SetPageHandle( - _In_ CONST HANDLE hPage - ); - - HRESULT - SetComPropSheetHandle( - _In_ CONST HANDLE hComPropSheet - ); - - HRESULT - GetComPropSheetFunc( - _Outptr_ PFNCOMPROPSHEET* ppfnComPropSheet - ); - - HANDLE - GetPageHandle( - VOID - ); - - HANDLE - GetComPropSheetHandle( - VOID - ); - - HRESULT - AddUIControl( - _In_ CONST INT iCtrlID, - _In_ CUIControl* pUIControl - ); - - HRESULT - GetUIComponents( - _Outptr_ UIControlMap** ppUIComponents - ); - - HRESULT - GetOemCUIPParam( - _Outptr_ POEMCUIPPARAM* ppOemCUIPParam - ); - - HRESULT - PublishHelpToControls( - VOID - ); - - HRESULT - SendCommand( - _In_ CONST HWND hDlg, - _In_ CONST WPARAM wParam - ); - - HRESULT - SendSetActive( - _In_ CONST HWND hDlg - ); - - HRESULT - SendInit( - _In_ CONST HWND hDlg - ); - - HRESULT - SendNotify( - _In_ CONST HWND hDlg, - _In_ CONST NMHDR* pNMhdr - ); - - HRESULT - DestroyUIComponents( - VOID - ); - -private: - UIControlMap m_UIControls; - - CComPtr m_pDriverUIHelp; - - HANDLE m_hPage; - - HANDLE m_hComPropSheet; - - PFNCOMPROPSHEET m_pfnComPropSheet; - - POEMCUIPPARAM m_pOemCUIPParam; - - CUIProperties* m_pUIProperties; -}; - diff --git a/print/XPSDrvSmpl/src/ui/ftrctrls.cpp b/print/XPSDrvSmpl/src/ui/ftrctrls.cpp deleted file mode 100644 index 94923e9a..00000000 --- a/print/XPSDrvSmpl/src/ui/ftrctrls.cpp +++ /dev/null @@ -1,1667 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - ftrctrls.cpp - -Abstract: - - Implementation of the features property page UI controls. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "resource.h" -#include "ftrctrls.h" -#include "privatedefs.h" - -PCSTR CUICtrlFeatPgScaleCombo::m_pszFeatPgScale = "PageScaling"; - -PCSTR CUICtrlFeatScaleOffsetCombo::m_pszFeatScaleOffset = "ScaleOffsetAlignment"; - -PCSTR CUICtrlFeatPgScaleXEdit::m_pszFeatPgScaleX = "PageScalingScaleWidth"; -PCSTR CUICtrlFeatPgScaleXSpin::m_pszFeatPgScaleX = "PageScalingScaleWidth"; -PCSTR CUICtrlFeatPgScaleYEdit::m_pszFeatPgScaleY = "PageScalingScaleHeight"; -PCSTR CUICtrlFeatPgScaleYSpin::m_pszFeatPgScaleY = "PageScalingScaleHeight"; -PCSTR CUICtrlFeatPgOffsetXEdit::m_pszFeatPgOffsetX = "PageScalingOffsetWidth"; -PCSTR CUICtrlFeatPgOffsetXSpin::m_pszFeatPgOffsetX = "PageScalingOffsetWidth"; -PCSTR CUICtrlFeatPgOffsetYEdit::m_pszFeatPgOffsetY = "PageScalingOffsetHeight"; -PCSTR CUICtrlFeatPgOffsetYSpin::m_pszFeatPgOffsetY = "PageScalingOffsetHeight"; - -PCSTR CUICtrlFeatNUpCombo::m_pszFeatNUp = "DocumentNUp"; -PCSTR CUICtrlFeatNUpOrderCombo::m_pszFeatNUpOrder = "DocumentNUpPresentationOrder"; - -PCSTR CUICtrlFeatDocDuplexCombo::m_pszFeatDocDuplex = "DocumentDuplex"; -PCSTR CUICtrlFeatPhotIntCombo::m_pszFeatPhotInt = "PagePhotoPrintingIntent"; -PCSTR CUICtrlFeatBordersCheck::m_pszFeatBorders = "PageBorderless"; - -PCSTR CUICtrlFeatJobBindCombo::m_pszFeatJobBind = "JobBindAllDocuments"; -PCSTR CUICtrlFeatDocBindCombo::m_pszFeatDocBind = "DocumentBinding"; - -#define PGSCALE_NONE_SEL 0 -#define PGSCALE_CUSTOM_SEL 1 -#define PGSCALE_CUSTSQUARE_SEL 2 -#define PGSCALE_FITBLEED_SEL 3 -#define PGSCALE_FITCONTENT_SEL 4 -#define PGSCALE_FITPAGE_SEL 5 -#define PGSCALE_SCALEPAGETOPAGE_SEL 6 - -#define JOBBIND_NONE_SEL 0 - -// -// Page scale selection combo box control -// -/*++ - -Routine Name: - - CUICtrlFeatPgScaleCombo::CUICtrlFeatPgScaleCombo - -Routine Description: - - CUICtrlFeatPgScaleCombo class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPgScaleCombo::CUICtrlFeatPgScaleCombo() : - CUICtrlDefaultCombo(m_pszFeatPgScale, IDC_COMBO_PGSCALE) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgScaleCombo::~CUICtrlFeatPgScaleCombo - -Routine Description: - - CUICtrlFeatPgScaleCombo class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPgScaleCombo::~CUICtrlFeatPgScaleCombo() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgScaleCombo::OnInit - -Routine Description: - - This is responsible for initialising the control and is called when - the WM_INITDIALOG message is recieved. This method populates the combo - box with the appropriate option strings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlFeatPgScaleCombo::OnInit( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - // - // Populate the combo box - // - if (SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_NONE)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_CUSTOM)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_CUSTSQUARE)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_FITBLEED)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_FITCONTENT)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_FITPAGE))) - { - hr = AddString(hDlg, g_hInstance, IDS_GPD_SCALEPAGETOPAGE); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlFeatPgScaleCombo::EnableDependentCtrls - -Routine Description: - - This method is used to enable or disable other controls in the UI based on the - current combo box selection. - -Arguments: - - hDlg - handle to the parent window - lSel - current combo box selection - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlFeatPgScaleCombo::EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ) -{ - HRESULT hr = S_OK; - HWND hWnd = NULL; - - BOOL bNone = (lSel == PGSCALE_NONE_SEL); - BOOL bCustom = (lSel == PGSCALE_CUSTOM_SEL); - BOOL bCustomSquare = (lSel == PGSCALE_CUSTSQUARE_SEL); - BOOL bFit = !(bCustom | bCustomSquare) && !bNone; - - // - // Here we are enabling/disabling and showing/hiding the page scale controls - // based on the currently selected options. - // - // If custom scaling is selected we need to enable and show the X/Y offset and X/Y - // scaling controls and hide the "fit to" options. If we custom square scaling is - // selected we show the same controls as custom scaling but disable the Y scaling - // control so the user can only apply the scale in one dimension. - // - // If one of the "fit to" options (FitApplicationBleedSizeToPageImageableSize etc.) - // is selected we disable and hide the custom controls (X/Y offset and scale) and enable - // the offset alignment option control. - // - if (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_EDIT_PGSCALEX), E_HANDLE))) - { - EnableWindow(hWnd, bCustom | bCustomSquare); - ShowWindow(hWnd, (bCustom | bCustomSquare | bNone) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_SPIN_PGSCALEX), E_HANDLE))) - { - EnableWindow(hWnd, bCustom | bCustomSquare); - ShowWindow(hWnd, (bCustom | bCustomSquare | bNone) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_PGSCALEX), E_HANDLE))) - { - EnableWindow(hWnd, bCustom | bCustomSquare); - ShowWindow(hWnd, (bCustom | bCustomSquare | bNone) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_EDIT_PGSCALEY), E_HANDLE))) - { - EnableWindow(hWnd, bCustom); - ShowWindow(hWnd, (bCustom | bCustomSquare | bNone) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_SPIN_PGSCALEY), E_HANDLE))) - { - EnableWindow(hWnd, bCustom); - ShowWindow(hWnd, (bCustom | bCustomSquare | bNone) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_PGSCALEY), E_HANDLE))) - { - EnableWindow(hWnd, bCustom); - ShowWindow(hWnd, (bCustom | bCustomSquare | bNone) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_EDIT_PGOFFX), E_HANDLE))) - { - EnableWindow(hWnd, bCustom | bCustomSquare); - ShowWindow(hWnd, (bCustom | bCustomSquare | bNone) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_SPIN_PGOFFX), E_HANDLE))) - { - EnableWindow(hWnd, bCustom | bCustomSquare); - ShowWindow(hWnd, (bCustom | bCustomSquare | bNone) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_PGOFFX), E_HANDLE))) - { - EnableWindow(hWnd, bCustom | bCustomSquare); - ShowWindow(hWnd, (bCustom | bCustomSquare | bNone) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_EDIT_PGOFFY), E_HANDLE))) - { - EnableWindow(hWnd, bCustom | bCustomSquare); - ShowWindow(hWnd, (bCustom | bCustomSquare | bNone) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_SPIN_PGOFFY), E_HANDLE))) - { - EnableWindow(hWnd, bCustom | bCustomSquare); - ShowWindow(hWnd, (bCustom | bCustomSquare | bNone) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_PGOFFY), E_HANDLE))) - { - EnableWindow(hWnd, bCustom | bCustomSquare); - ShowWindow(hWnd, (bCustom | bCustomSquare | bNone) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_COMBO_SCALEOFF), E_HANDLE))) - { - EnableWindow(hWnd, bFit); - ShowWindow(hWnd, bFit ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_SCALEOFF), E_HANDLE))) - { - EnableWindow(hWnd, bFit); - ShowWindow(hWnd, bFit ? SW_SHOW : SW_HIDE); - } - - if (FAILED(hr)) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - - ERR_ON_HR(hr); - return hr; -} - -// -// Page scale selection combo box control -// -/*++ - -Routine Name: - - CUICtrlFeatScaleOffsetCombo::CUICtrlFeatScaleOffsetCombo - -Routine Description: - - CUICtrlFeatScaleOffsetCombo class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatScaleOffsetCombo::CUICtrlFeatScaleOffsetCombo() : - CUICtrlDefaultCombo(m_pszFeatScaleOffset, IDC_COMBO_SCALEOFF) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatScaleOffsetCombo::~CUICtrlFeatScaleOffsetCombo - -Routine Description: - - CUICtrlFeatScaleOffsetCombo class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatScaleOffsetCombo::~CUICtrlFeatScaleOffsetCombo() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatScaleOffsetCombo::OnInit - -Routine Description: - - This is responsible for initialising the control and is called when - the WM_INITDIALOG message is recieved. This method populates the combo - box with the appropriate option strings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlFeatScaleOffsetCombo::OnInit( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - // - // Populate the combo box - // - if (SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_SCALE_ALIGN_BC)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_SCALE_ALIGN_BL)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_SCALE_ALIGN_BR)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_SCALE_ALIGN_CC)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_SCALE_ALIGN_LC)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_SCALE_ALIGN_CR)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_SCALE_ALIGN_CT)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_SCALE_ALIGN_TL))) - { - hr = AddString(hDlg, g_hInstance, IDS_GPD_SCALE_ALIGN_TR); - } - - ERR_ON_HR(hr); - return hr; -} - -#define NUP_1PPS_SEL 0 - -// -// NUp page per sheet combo box control -// -/*++ - -Routine Name: - - CUICtrlFeatNUpCombo::CUICtrlFeatNUpCombo - -Routine Description: - - CUICtrlFeatNUpCombo class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatNUpCombo::CUICtrlFeatNUpCombo() : - CUICtrlDefaultCombo(m_pszFeatNUp, IDC_COMBO_NUP) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatNUpCombo::~CUICtrlFeatNUpCombo - -Routine Description: - - CUICtrlFeatNUpCombo class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatNUpCombo::~CUICtrlFeatNUpCombo() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatNUpCombo::OnInit - -Routine Description: - - This is responsible for initialising the control and is called when - the WM_INITDIALOG message is recieved. This method populates the combo - box with the appropriate option strings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlFeatNUpCombo::OnInit( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - // - // Populate the combo box - // - if (SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_1PPS)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_2PPS)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_4PPS)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_6PPS)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_8PPS)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_9PPS))) - { - hr = AddString(hDlg, g_hInstance, IDS_GPD_16PPS); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlFeatNUpCombo::EnableDependentCtrls - -Routine Description: - - This method is used to enable or disable other controls in the UI based on the - current combo box selection. - -Arguments: - - hDlg - handle to the parent window - lSel - current combo box selection - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlFeatNUpCombo::EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ) -{ - HRESULT hr = S_OK; - HWND hWnd = NULL; - - // - // Here we are enabling/disabling the NUp and Binding controls depending on the current - // NUp selection. - // - // When NUp is more than 1 page per sheet we enable the NUp order controls and disable - // binding option controls. - // - if (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_COMBO_NUP_ORDER), E_HANDLE))) - { - EnableWindow(hWnd, lSel > NUP_1PPS_SEL); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_NUP_ORDER), E_HANDLE))) - { - EnableWindow(hWnd, lSel > NUP_1PPS_SEL); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_COMBO_JOBBIND), E_HANDLE))) - { - EnableWindow(hWnd, lSel == NUP_1PPS_SEL); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_JOBBIND), E_HANDLE))) - { - EnableWindow(hWnd, lSel == NUP_1PPS_SEL); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_COMBO_DOCBIND), E_HANDLE))) - { - EnableWindow(hWnd, lSel == NUP_1PPS_SEL); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_DOCBIND), E_HANDLE))) - { - EnableWindow(hWnd, lSel == NUP_1PPS_SEL); - } - - if (FAILED(hr)) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - - ERR_ON_HR(hr); - return hr; -} - -// -// NUp presentation order combo box control -// -/*++ - -Routine Name: - - CUICtrlFeatNUpOrderCombo::CUICtrlFeatNUpOrderCombo - -Routine Description: - - CUICtrlFeatNUpOrderCombo class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatNUpOrderCombo::CUICtrlFeatNUpOrderCombo() : - CUICtrlDefaultCombo(m_pszFeatNUpOrder, IDC_COMBO_NUP_ORDER) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatNUpOrderCombo::~CUICtrlFeatNUpOrderCombo - -Routine Description: - - CUICtrlFeatNUpOrderCombo class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatNUpOrderCombo::~CUICtrlFeatNUpOrderCombo() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatNUpOrderCombo::OnInit - -Routine Description: - - This is responsible for initialising the control and is called when - the WM_INITDIALOG message is recieved. This method populates the combo - box with the appropriate option strings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlFeatNUpOrderCombo::OnInit( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - // - // Populate the combo box - // - if (SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_LTORTTOB)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_TTOBLTOR)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_RTOLTTOB)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_TTOBRTOL)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_LTORBTOT)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_BTOTLTOR)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_RTOLBTOT))) - { - hr = AddString(hDlg, g_hInstance, IDS_GPD_BTOTRTOL); - } - - ERR_ON_HR(hr); - return hr; -} - -// -// Binding combo box control -// -/*++ - -Routine Name: - - CUICtrlFeatJobBindCombo::CUICtrlFeatJobBindCombo - -Routine Description: - - CUICtrlFeatJobBindCombo class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatJobBindCombo::CUICtrlFeatJobBindCombo() : - CUICtrlDefaultCombo(m_pszFeatJobBind, IDC_COMBO_JOBBIND) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatJobBindCombo::~CUICtrlFeatJobBindCombo - -Routine Description: - - CUICtrlFeatJobBindCombo class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatJobBindCombo::~CUICtrlFeatJobBindCombo() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatJobBindCombo::OnInit - -Routine Description: - - This is responsible for initialising the control and is called when - the WM_INITDIALOG message is recieved. This method populates the combo - box with the appropriate option strings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlFeatJobBindCombo::OnInit( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - // - // Populate the combo box - // - if (SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_NONE)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_LTOR)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_RTOL)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_TTOB))) - { - hr = AddString(hDlg, g_hInstance, IDS_GPD_BTOT); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlFeatJobBindCombo::EnableDependentCtrls - -Routine Description: - - This method is used to enable or disable other controls in the UI based on the - current combo box selection. - -Arguments: - - hDlg - handle to the parent window - lSel - current combo box selection - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlFeatJobBindCombo::EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ) -{ - HRESULT hr = S_OK; - HWND hWnd = NULL; - - // - // Here we are enabling/disabling binding and NUp controls based off the current - // binding option. - // - // If JobBindAllDocuments option is selected we disable DocumentBinding and NUp controls. - // - if (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_COMBO_DOCBIND), E_HANDLE))) - { - EnableWindow(hWnd, (lSel == JOBBIND_NONE_SEL)); - } - - if (SUCCEEDED(hr) && - (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_DOCBIND), E_HANDLE)))) - { - EnableWindow(hWnd, (lSel == JOBBIND_NONE_SEL)); - } - - if (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_COMBO_NUP), E_HANDLE))) - { - EnableWindow(hWnd, (lSel == JOBBIND_NONE_SEL)); - } - - if (SUCCEEDED(hr) && - (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_NUP), E_HANDLE)))) - { - EnableWindow(hWnd, (lSel == JOBBIND_NONE_SEL)); - } - - if (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_NUP_ORDER), E_HANDLE))) - { - EnableWindow(hWnd, (lSel == JOBBIND_NONE_SEL)); - } - - if (SUCCEEDED(hr) && - (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_COMBO_NUP_ORDER), E_HANDLE)))) - { - EnableWindow(hWnd, (lSel == JOBBIND_NONE_SEL)); - } - - if (FAILED(hr)) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - - ERR_ON_HR(hr); - return hr; -} - -// -// Binding Direction combo box control -// -/*++ - -Routine Name: - - CUICtrlFeatDocBindCombo::CUICtrlFeatDocBindCombo - -Routine Description: - - CUICtrlFeatDocBindCombo class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatDocBindCombo::CUICtrlFeatDocBindCombo() : - CUICtrlDefaultCombo(m_pszFeatDocBind, IDC_COMBO_DOCBIND) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatDocBindCombo::~CUICtrlFeatDocBindCombo - -Routine Description: - - CUICtrlFeatDocBindCombo class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatDocBindCombo::~CUICtrlFeatDocBindCombo() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatDocBindCombo::OnInit - -Routine Description: - - This is responsible for initialising the control and is called when - the WM_INITDIALOG message is recieved. This method populates the combo - box with the appropriate option strings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlFeatDocBindCombo::OnInit( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - // - // Populate the combo box - // - if (SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_NONE)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_LTOR)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_RTOL)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_TTOB))) - { - hr = AddString(hDlg, g_hInstance, IDS_GPD_BTOT); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlFeatDocBindCombo::EnableDependentCtrls - -Routine Description: - - This method is used to enable or disable other controls in the UI based on the - current combo box selection. - -Arguments: - - hDlg - handle to the parent window - lSel - current combo box selection - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlFeatDocBindCombo::EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ) -{ - HRESULT hr = S_OK; - HWND hWnd = NULL; - - // - // Here we are enabling/disabling binding and NUp controls based off the current - // DocumentBinding option. - // - // If DocumentBinding option is selected we disable JobBindAllDocuments and NUp controls. - // - if (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_COMBO_NUP), E_HANDLE))) - { - EnableWindow(hWnd, (lSel == JOBBIND_NONE_SEL)); - } - - if (SUCCEEDED(hr) && - (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_NUP), E_HANDLE)))) - { - EnableWindow(hWnd, (lSel == JOBBIND_NONE_SEL)); - } - - if (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_NUP_ORDER), E_HANDLE))) - { - EnableWindow(hWnd, (lSel == JOBBIND_NONE_SEL)); - } - - if (SUCCEEDED(hr) && - (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_COMBO_NUP_ORDER), E_HANDLE)))) - { - EnableWindow(hWnd, (lSel == JOBBIND_NONE_SEL)); - } - - if (FAILED(hr)) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - - ERR_ON_HR(hr); - return hr; -} - -// -// Document photo printing intent combo box control -// -/*++ - -Routine Name: - - CUICtrlFeatPhotIntCombo::CUICtrlFeatPhotIntCombo - -Routine Description: - - CUICtrlFeatPhotIntCombo class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPhotIntCombo::CUICtrlFeatPhotIntCombo() : - CUICtrlDefaultCombo(m_pszFeatPhotInt, IDC_COMBO_PHOTO_INTENT) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPhotIntCombo::~CUICtrlFeatPhotIntCombo - -Routine Description: - - CUICtrlFeatPhotIntCombo class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPhotIntCombo::~CUICtrlFeatPhotIntCombo() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPhotIntCombo::OnInit - -Routine Description: - - This is responsible for initialising the control and is called when - the WM_INITDIALOG message is recieved. This method populates the combo - box with the appropriate option strings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlFeatPhotIntCombo::OnInit( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - // - // Populate the combo box - // - if (SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_NONE)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_BEST)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_DRAFT))) - { - hr = AddString(hDlg, g_hInstance, IDS_GPD_STANDARD); - } - - ERR_ON_HR(hr); - return hr; -} - -// -// Document duplex combo box control -// -/*++ - -Routine Name: - - CUICtrlFeatDocDuplexCombo::CUICtrlFeatDocDuplexCombo - -Routine Description: - - CUICtrlFeatDocDuplexCombo class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatDocDuplexCombo::CUICtrlFeatDocDuplexCombo() : - CUICtrlDefaultCombo(m_pszFeatDocDuplex, IDC_COMBO_DOCDUPLEX) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatDocDuplexCombo::~CUICtrlFeatDocDuplexCombo - -Routine Description: - - CUICtrlFeatDocDuplexCombo class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatDocDuplexCombo::~CUICtrlFeatDocDuplexCombo() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatDocDuplexCombo::OnInit - -Routine Description: - - This is responsible for initialising the control and is called when - the WM_INITDIALOG message is recieved. This method populates the combo - box with the appropriate option strings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlFeatDocDuplexCombo::OnInit( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - // - // Populate the combo box - // - if (SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_NONE))&& - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_HORIZONTAL))) - { - hr = AddString(hDlg, g_hInstance, IDS_GPD_VERTICAL); - } - - ERR_ON_HR(hr); - return hr; -} - -// -// Document duplex combo box control -// -/*++ - -Routine Name: - - CUICtrlFeatPgScaleXEdit::CUICtrlFeatPgScaleXEdit - -Routine Description: - - CUICtrlFeatPgScaleXEdit class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPgScaleXEdit::CUICtrlFeatPgScaleXEdit() : - CUICtrlDefaultEditNum(m_pszFeatPgScaleX, - IDC_EDIT_PGSCALEX, - pgscParamDefIntegers[ePageScalingScaleWidth].min_length, - pgscParamDefIntegers[ePageScalingScaleWidth].max_length, - IDC_SPIN_PGSCALEX) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgScaleXEdit::~CUICtrlFeatPgScaleXEdit - -Routine Description: - - CUICtrlFeatPgScaleXEdit class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPgScaleXEdit::~CUICtrlFeatPgScaleXEdit() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgScaleXSpin::CUICtrlFeatPgScaleXSpin - -Routine Description: - - CUICtrlFeatPgScaleXSpin class constructor - -Arguments: - - pEdit - Pointer to the edit num buddy control - -Return Value: - - None - ---*/ -CUICtrlFeatPgScaleXSpin::CUICtrlFeatPgScaleXSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ) : - CUICtrlDefaultSpin(pEdit) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgScaleXSpin::~CUICtrlFeatPgScaleXSpin - -Routine Description: - - CUICtrlFeatPgScaleXSpin class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPgScaleXSpin::~CUICtrlFeatPgScaleXSpin() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgScaleYEdit::CUICtrlFeatPgScaleYEdit - -Routine Description: - - CUICtrlFeatPgScaleYEdit class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPgScaleYEdit::CUICtrlFeatPgScaleYEdit() : - CUICtrlDefaultEditNum(m_pszFeatPgScaleY, - IDC_EDIT_PGSCALEY, - pgscParamDefIntegers[ePageScalingScaleHeight].min_length, - pgscParamDefIntegers[ePageScalingScaleHeight].max_length, - IDC_SPIN_PGSCALEY) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgScaleYEdit::~CUICtrlFeatPgScaleYEdit - -Routine Description: - - CUICtrlFeatPgScaleYEdit class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPgScaleYEdit::~CUICtrlFeatPgScaleYEdit() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgScaleYSpin::CUICtrlFeatPgScaleYSpin - -Routine Description: - - CUICtrlFeatPgScaleYSpin class constructor - -Arguments: - - pEdit - Pointer to the edit num buddy control - -Return Value: - - None - ---*/ -CUICtrlFeatPgScaleYSpin::CUICtrlFeatPgScaleYSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ) : - CUICtrlDefaultSpin(pEdit) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgScaleYSpin::~CUICtrlFeatPgScaleYSpin - -Routine Description: - - CUICtrlFeatPgScaleYSpin class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPgScaleYSpin::~CUICtrlFeatPgScaleYSpin() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgOffsetXEdit::CUICtrlFeatPgOffsetXEdit - -Routine Description: - - CUICtrlFeatPgOffsetXEdit class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPgOffsetXEdit::CUICtrlFeatPgOffsetXEdit() : - CUICtrlDefaultEditNum(m_pszFeatPgOffsetX, - IDC_EDIT_PGOFFX, - MICRON_TO_HUNDREDTH_OFINCH(pgscParamDefIntegers[ePageScalingOffsetWidth].min_length), - MICRON_TO_HUNDREDTH_OFINCH(pgscParamDefIntegers[ePageScalingOffsetWidth].max_length), - IDC_SPIN_PGOFFX) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgOffsetXEdit::~CUICtrlFeatPgOffsetXEdit - -Routine Description: - - CUICtrlFeatPgOffsetXEdit class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPgOffsetXEdit::~CUICtrlFeatPgOffsetXEdit() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgOffsetXSpin::CUICtrlFeatPgOffsetXSpin - -Routine Description: - - CUICtrlFeatPgOffsetXSpin class constructor - -Arguments: - - pEdit - Pointer to the edit num buddy control - -Return Value: - - None - ---*/ -CUICtrlFeatPgOffsetXSpin::CUICtrlFeatPgOffsetXSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ) : - CUICtrlDefaultSpin(pEdit) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgOffsetXSpin::~CUICtrlFeatPgOffsetXSpin - -Routine Description: - - CUICtrlFeatPgOffsetXSpin class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPgOffsetXSpin::~CUICtrlFeatPgOffsetXSpin() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgOffsetYEdit::CUICtrlFeatPgOffsetYEdit - -Routine Description: - - CUICtrlFeatPgOffsetYEdit class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPgOffsetYEdit::CUICtrlFeatPgOffsetYEdit() : - CUICtrlDefaultEditNum(m_pszFeatPgOffsetY, - IDC_EDIT_PGOFFY, - MICRON_TO_HUNDREDTH_OFINCH(pgscParamDefIntegers[ePageScalingOffsetHeight].min_length), - MICRON_TO_HUNDREDTH_OFINCH(pgscParamDefIntegers[ePageScalingOffsetHeight].max_length), - IDC_SPIN_PGOFFY) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgOffsetYEdit::~CUICtrlFeatPgOffsetYEdit - -Routine Description: - - CUICtrlFeatPgOffsetYEdit class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPgOffsetYEdit::~CUICtrlFeatPgOffsetYEdit() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgOffsetYSpin::CUICtrlFeatPgOffsetYSpin - -Routine Description: - - CUICtrlFeatPgOffsetYSpin class constructor - -Arguments: - - pEdit - Pointer to the edit num buddy control - -Return Value: - - None - ---*/ -CUICtrlFeatPgOffsetYSpin::CUICtrlFeatPgOffsetYSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ) : - CUICtrlDefaultSpin(pEdit) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatPgOffsetYSpin::~CUICtrlFeatPgOffsetYSpin - -Routine Description: - - CUICtrlFeatPgOffsetYSpin class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatPgOffsetYSpin::~CUICtrlFeatPgOffsetYSpin() -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatBordersCheck::CUICtrlFeatBordersCheck - -Routine Description: - - CUICtrlFeatBordersCheck class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatBordersCheck::CUICtrlFeatBordersCheck() : - CUICtrlDefaultCheck(m_pszFeatBorders, IDC_CHECK_BORDERLESS) -{ -} - -/*++ - -Routine Name: - - CUICtrlFeatBordersCheck::~CUICtrlFeatBordersCheck - -Routine Description: - - CUICtrlFeatBordersCheck class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlFeatBordersCheck::~CUICtrlFeatBordersCheck() -{ -} - diff --git a/print/XPSDrvSmpl/src/ui/ftrctrls.h b/print/XPSDrvSmpl/src/ui/ftrctrls.h deleted file mode 100644 index 6351bb49..00000000 --- a/print/XPSDrvSmpl/src/ui/ftrctrls.h +++ /dev/null @@ -1,288 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - ftrctrls.h - -Abstract: - - Definition of the features property page UI controls. - ---*/ - -#pragma once - -#include "uictrl.h" - -class CUICtrlFeatPgScaleCombo : public CUICtrlDefaultCombo -{ -public: - CUICtrlFeatPgScaleCombo(); - - virtual ~CUICtrlFeatPgScaleCombo(); - - HRESULT - OnInit( - _In_ CONST HWND hDlg - ); - -private: - HRESULT - EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ); - -private: - static PCSTR m_pszFeatPgScale; -}; - -class CUICtrlFeatScaleOffsetCombo : public CUICtrlDefaultCombo -{ -public: - CUICtrlFeatScaleOffsetCombo(); - - virtual ~CUICtrlFeatScaleOffsetCombo(); - - HRESULT - OnInit( - _In_ CONST HWND hDlg - ); - -private: - static PCSTR m_pszFeatScaleOffset; -}; - -class CUICtrlFeatPgScaleXEdit : public CUICtrlDefaultEditNum -{ -public: - CUICtrlFeatPgScaleXEdit(); - - virtual ~CUICtrlFeatPgScaleXEdit(); - -private: - static PCSTR m_pszFeatPgScaleX; -}; - -class CUICtrlFeatPgScaleXSpin : public CUICtrlDefaultSpin -{ -public: - CUICtrlFeatPgScaleXSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ); - - virtual ~CUICtrlFeatPgScaleXSpin(); - -private: - static PCSTR m_pszFeatPgScaleX; -}; - -class CUICtrlFeatPgOffsetXEdit : public CUICtrlDefaultEditNum -{ -public: - CUICtrlFeatPgOffsetXEdit(); - - virtual ~CUICtrlFeatPgOffsetXEdit(); - -private: - static PCSTR m_pszFeatPgOffsetX; -}; - -class CUICtrlFeatPgOffsetXSpin : public CUICtrlDefaultSpin -{ -public: - CUICtrlFeatPgOffsetXSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ); - - virtual ~CUICtrlFeatPgOffsetXSpin(); - -private: - static PCSTR m_pszFeatPgOffsetX; -}; - -class CUICtrlFeatPgScaleYEdit : public CUICtrlDefaultEditNum -{ -public: - CUICtrlFeatPgScaleYEdit(); - - virtual ~CUICtrlFeatPgScaleYEdit(); - -private: - static PCSTR m_pszFeatPgScaleY; -}; - -class CUICtrlFeatPgScaleYSpin : public CUICtrlDefaultSpin -{ -public: - CUICtrlFeatPgScaleYSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ); - - virtual ~CUICtrlFeatPgScaleYSpin(); - -private: - static PCSTR m_pszFeatPgScaleY; -}; - -class CUICtrlFeatPgOffsetYEdit : public CUICtrlDefaultEditNum -{ -public: - CUICtrlFeatPgOffsetYEdit(); - - virtual ~CUICtrlFeatPgOffsetYEdit(); - -private: - static PCSTR m_pszFeatPgOffsetY; -}; - -class CUICtrlFeatPgOffsetYSpin : public CUICtrlDefaultSpin -{ -public: - CUICtrlFeatPgOffsetYSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ); - - virtual ~CUICtrlFeatPgOffsetYSpin(); - -private: - static PCSTR m_pszFeatPgOffsetY; -}; - -class CUICtrlFeatNUpCombo : public CUICtrlDefaultCombo -{ -public: - CUICtrlFeatNUpCombo(); - - virtual ~CUICtrlFeatNUpCombo(); - - HRESULT - OnInit( - _In_ CONST HWND hDlg - ); - -private: - HRESULT - EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ); - -private: - static PCSTR m_pszFeatNUp; -}; - -class CUICtrlFeatNUpOrderCombo : public CUICtrlDefaultCombo -{ -public: - CUICtrlFeatNUpOrderCombo(); - - virtual ~CUICtrlFeatNUpOrderCombo(); - - HRESULT - OnInit( - _In_ CONST HWND hDlg - ); - -private: - static PCSTR m_pszFeatNUpOrder; -}; - -class CUICtrlFeatJobBindCombo : public CUICtrlDefaultCombo -{ -public: - CUICtrlFeatJobBindCombo(); - - virtual ~CUICtrlFeatJobBindCombo(); - - HRESULT - OnInit( - _In_ CONST HWND hDlg - ); - -private: - HRESULT - EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ); - -private: - static PCSTR m_pszFeatJobBind; -}; - -class CUICtrlFeatDocBindCombo : public CUICtrlDefaultCombo -{ -public: - CUICtrlFeatDocBindCombo(); - - virtual ~CUICtrlFeatDocBindCombo(); - - HRESULT - OnInit( - _In_ CONST HWND hDlg - ); - -private: - HRESULT - EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ); - -private: - static PCSTR m_pszFeatDocBind; -}; - -class CUICtrlFeatPhotIntCombo : public CUICtrlDefaultCombo -{ -public: - CUICtrlFeatPhotIntCombo(); - - virtual ~CUICtrlFeatPhotIntCombo(); - - HRESULT - OnInit( - _In_ CONST HWND hDlg - ); - -private: - static PCSTR m_pszFeatPhotInt; -}; - -class CUICtrlFeatDocDuplexCombo : public CUICtrlDefaultCombo -{ -public: - CUICtrlFeatDocDuplexCombo(); - - virtual ~CUICtrlFeatDocDuplexCombo(); - - HRESULT - OnInit( - _In_ CONST HWND hDlg - ); - -private: - static PCSTR m_pszFeatDocDuplex; -}; - -class CUICtrlFeatBordersCheck : public CUICtrlDefaultCheck -{ -public: - CUICtrlFeatBordersCheck(); - - virtual ~CUICtrlFeatBordersCheck(); - -private: - static PCSTR m_pszFeatBorders; -}; - diff --git a/print/XPSDrvSmpl/src/ui/ftrdmptcnv.h b/print/XPSDrvSmpl/src/ui/ftrdmptcnv.h deleted file mode 100644 index 4ae471ea..00000000 --- a/print/XPSDrvSmpl/src/ui/ftrdmptcnv.h +++ /dev/null @@ -1,631 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - ftrdmptcnv.h - -Abstract: - - Defines the interface for a DevMode <-> PrintTicket feature conversion class - and an abstract class that handles the print core helper interface pointer. - ---*/ - -#pragma once - -template -struct GPDStringToOption -{ - PCSTR pszOption; - _T option; -}; - -class IFeatureDMPTConvert -{ -public: - IFeatureDMPTConvert(){} - - virtual ~IFeatureDMPTConvert(){} - - virtual HRESULT STDMETHODCALLTYPE - ConvertPrintTicketToDevMode( - _In_ IXMLDOMDocument2* pPrintTicket, - _In_ ULONG cbDevmode, - _Inout_ PDEVMODE pDevmode, - _In_ ULONG cbDrvPrivateSize, - _In_ PVOID pPrivateDevmode - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE - ConvertDevModeToPrintTicket( - _In_ ULONG cbDevmode, - _In_ PDEVMODE pDevmode, - _In_ ULONG cbDrvPrivateSize, - _In_ PVOID pPrivateDevmode, - _Inout_ IXMLDOMDocument2* pPrintTicket - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE - CompletePrintCapabilities( - _In_opt_ IXMLDOMDocument2* pPrintTicket, - _Inout_ IXMLDOMDocument2* pPrintCapabilities - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE - PublishPrintTicketHelperInterface( - _In_ IPrintCoreHelperUni* pHelper - ) = 0; - - - virtual HRESULT STDMETHODCALLTYPE - ValidatePrintTicket( - _Inout_ IXMLDOMDocument2* pPrintTicket - ) = 0; -}; - -template -class CFeatureDMPTConvert : public IFeatureDMPTConvert -{ -public: - CFeatureDMPTConvert(){} - - virtual ~CFeatureDMPTConvert(){} - - /*++ - - Routine Name: - - ConvertPrintTicketToDevMode - - Routine Description: - - - The plug-in is passed an input Print Ticket that is fully populated, - and a devmode. This method controls the calls to update the DevMode - to reflect the settings defined in the PrintTicket. - - The template this class is instantiated using defines the data - type passed between routines. Derived classes define this data - and then act on it as appropriate to the feature. - - Arguments: - - pPrintTicket - pointer to input Print Ticket - cbDevmode - size in bytes of input full devmode - pDevmode - pointer to input full devmode buffer - cbDrvPrivateSize - buffer size in bytes of plug-in private devmode - pPrivateDevmode - pointer to plug-in private devmode buffer - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT STDMETHODCALLTYPE - ConvertPrintTicketToDevMode( - _In_ IXMLDOMDocument2* pPrintTicket, - _In_ ULONG cbDevmode, - _Inout_ PDEVMODE pDevmode, - _In_ ULONG cbDrvPrivateSize, - _In_ PVOID pPrivateDevmode - ) - { - HRESULT hr = S_OK; - - // - // Validate parameters - // - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrivateDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE) || - cbDrvPrivateSize == 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - // - // Initialise the GPD settings from the devmode and merge with - // the PrintTicket settings - // - _T ptData; - - if (SUCCEEDED(hr = GetPTDataSettingsFromDM(pDevmode, cbDevmode, pPrivateDevmode, cbDrvPrivateSize, &ptData)) && - SUCCEEDED(hr = MergePTDataSettingsWithPT(pPrintTicket, &ptData))) - { - // - // Set the combined options in the devmode - // - hr = SetPTDataInDM(ptData, pDevmode, cbDevmode, pPrivateDevmode, cbDrvPrivateSize); - } - } - - ERR_ON_HR(hr); - return hr; - } - - /*++ - - Routine Name: - - ConvertDevModeToPrintTicket - - Routine Description: - - Unidrv will call the routine with an Input PrintTicket that is - populated with public and Unidrv private features. This method - controls the calls to update the PrintTicket to reflect the - settings defined in the devmode. - - The template this class is instantiated using defines the data - type passed between routines. Derived classes define this data - and then act on it as appropriate to the feature. - - Arguments: - - cbDevmode - size in bytes of input full devmode - pDevmode - pointer to input full devmode buffer - cbDrvPrivateSize - buffer size in bytes of plug-in private devmode - pPrivateDevmode - pointer to plug-in private devmode buffer - pPrintTicket - pointer to input Print Ticket - - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT STDMETHODCALLTYPE - ConvertDevModeToPrintTicket( - _In_ ULONG cbDevmode, - _In_ PDEVMODE pDevmode, - _In_ ULONG cbDrvPrivateSize, - _In_ PVOID pPrivateDevmode, - _Inout_ IXMLDOMDocument2* pPrintTicket - ) - { - HRESULT hr = S_OK; - - // - // Validate parameters - // - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrivateDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE) || - cbDrvPrivateSize == 0) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - // - // Initialise the GPD settings from the devmode - // - _T ptData; - - if (SUCCEEDED(hr = GetPTDataSettingsFromDM(pDevmode, cbDevmode, pPrivateDevmode, cbDrvPrivateSize, &ptData))) - { - // - // Set the options in the PrintTicket - // - hr = SetPTDataInPT(ptData, pPrintTicket); - } - } - - ERR_ON_HR(hr); - return hr; - } - - /*++ - - Routine Name: - - PublishPrintTicketHelperInterface - - Routine Description: - - This routine is stores the print core helper interface for use by - derived feature specific DM<->PT conversion classes. - - Arguments: - - pHelper - Pointer to core helper interface - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - HRESULT STDMETHODCALLTYPE - PublishPrintTicketHelperInterface( - _In_ IPrintCoreHelperUni* pHelper - ) - { - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pHelper, E_POINTER)) && - m_pCoreHelper == NULL) - { - m_pCoreHelper = pHelper; - } - - ERR_ON_HR(hr); - return hr; - } - - /*++ - - Routine Name: - - ValidatePrintTicket - - Routine Description: - - Default validate implementation - just returns S_NO_CONFLICT. If the - derived feature specific class needs to validate the PrintTicket it - should provide its own implementation and handle the PrintTicket - appropriately. - - Arguments: - - pPrintTicket - Pointer to input Print Ticket. - - Return Value: - - HRESULT - S_NO_CONFLICT - On success - E_* - On error - - --*/ - virtual HRESULT STDMETHODCALLTYPE - ValidatePrintTicket( - _Inout_ IXMLDOMDocument2* pPrintTicket - ) - { - HRESULT hr = S_NO_CONFLICT; - - if (SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER))) - { - hr = S_NO_CONFLICT; - } - - ERR_ON_HR(hr); - return hr; - } - -protected: - /*++ - - Routine Name: - - GetPTDataSettingsFromDM - - Routine Description: - - This pure virtual function ensures the concrete feature converter class - implements a means of retrieving the data type defined by that class from - the DevMode. - - Arguments: - - pDevmode - pointer to input devmode buffer. - cbDevmode - size in bytes of full input devmode. - pPrivateDevmode - pointer to input private devmode buffer. - cbDrvPrivateSize - size in bytes of private devmode. - pDataSettings - Pointer to data structure defined by a template argument to be updated. - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - virtual HRESULT - GetPTDataSettingsFromDM( - _In_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _In_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize, - _Out_ _T* pDataSettings - ) = 0; - - /*++ - - Routine Name: - - MergePTDataSettingsWithPT - - Routine Description: - - This pure virtual function ensures the concrete feature converter class - implements a means of merging the data type defined by that class from - the PrintTicket settings. - - Arguments: - - pPrintTicket - Pointer to the PrintTicket to merge the data structure with. - pDataSettings - Pointer to data structure defined by a template argument to be updated. - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - virtual HRESULT - MergePTDataSettingsWithPT( - _In_ IXMLDOMDocument2* pPrintTicket, - _Inout_ _T* pDrvSettings - ) = 0; - - /*++ - - Routine Name: - - SetPTDataInDM - - Routine Description: - - This pure virtual function ensures the concrete feature converter class - implements a means of setting the data type defined by that class in the - DevMode. - - Arguments: - - dataSettings - const reference to the data structure defined by a template argument to be update from. - pDevmode - pointer to input devmode buffer. - cbDevmode - size in bytes of full input devmode. - pPrivateDevmode - pointer to input private devmode buffer. - cbDrvPrivateSize - size in bytes of private devmode. - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - virtual HRESULT - SetPTDataInDM( - _In_ CONST _T& dataSettings, - _Inout_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _Inout_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize - ) = 0; - - /*++ - - Routine Name: - - SetPTDataInPT - - Routine Description: - - This pure virtual function ensures the concrete feature converter class - implements a means of setting the data type defined by that class in the - PrintTicket. - - Arguments: - - dataSettings - const reference to the data structure defined by a template argument to be update from. - pPrintTicket - Pointer to the PrintTicket to update the data structure with. - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - virtual HRESULT - SetPTDataInPT( - _In_ CONST _T& dataSettings, - _Inout_ IXMLDOMDocument2* pPrintTicket - ) = 0; - - /*++ - - Routine Name: - - GetOptionFromGPDString - - Routine Description: - - This template function takes as a template parameter the type of the - data to be retrieved from the DevMode. A table is passed through that - provides the look-up between the GPD string and the data type to be - returned. The routine then iterates through the options for the feature - specified matching against look-up and returning the corresponding value. - - Arguments: - - pDevmode - pointer to input DevMode. - cbDevmode - count of bytes in the input devmode. - pszFeature - string defining the feature name to match against. - pOptTable - pointer to the look-up table matching the GPD option strings to the option value. - cOptEntries - the number of entries in the look-up table - result - reference to the result value to be updated (type defined by the template argument) - - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - template - HRESULT - GetOptionFromGPDString( - _In_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _In_z_ PCSTR pszFeature, - _In_ CONST GPDStringToOption<_U>* pOptTable, - _In_ CONST UINT cOptEntries, - _Out_ _U& result - ) - { - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pszFeature, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pOptTable, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE)) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - BOOL bFound = FALSE; - - if (cOptEntries > 0) - { - PCSTR pszOption = NULL; - - if (SUCCEEDED(hr = m_pCoreHelper->GetOption(pDevmode, cbDevmode, pszFeature, &pszOption))) - { - CStringXDA cstrOption(pszOption); - for (UINT index = 0; index < cOptEntries && !bFound; index++) - { - if (cstrOption == pOptTable->pszOption) - { - result = pOptTable->option; - bFound = TRUE; - } - else - { - pOptTable++; - } - } - } - } - - if (!bFound) - { - hr = E_ELEMENT_NOT_FOUND; - } - } - - ERR_ON_HR(hr); - return hr; - } - - /*++ - - Routine Name: - - SetGPDStringFromOption - - Routine Description: - - This template function takes as a template parameter the type of the - data to be set in the DevMode. A table is passed through that provides - the look-up between the GPD string and the data type to be set. The routine - then iterates through the options for the feature specified matching against - the look-up and setting the corresponding value in the DevMode. - - Arguments: - - pDevmode - pointer to input DevMode. - cbDevmode - count of bytes in the input devmode. - pszFeature - string defining the feature name to match against. - pOptTable - pointer to the look-up table matching the GPD option strings to the option value. - cOptEntries - the number of entries in the look-up table - result - const reference to the result value to update from (type defined by the template argument) - - Return Value: - - HRESULT - S_OK - On success - E_* - On error - - --*/ - template - HRESULT - SetGPDStringFromOption( - _Inout_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _In_z_ PCSTR pszFeature, - _In_ CONST GPDStringToOption<_U>* pOptTable, - _In_ CONST UINT cOptEntries, - _In_ CONST _U& option - ) - { - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pszFeature, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pOptTable, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE)) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - if (cOptEntries > 0) - { - for (UINT index = 0; index < cOptEntries; index++) - { - if (option == pOptTable->option) - { - PRINT_FEATURE_OPTION featureOption[1] = { - pszFeature, - pOptTable->pszOption - }; - - DWORD dwResult = 0; - DWORD cPairsWritten = 0; - - hr = m_pCoreHelper->SetOptions(pDevmode, cbDevmode, TRUE, featureOption, 1, &cPairsWritten, &dwResult); - - break; - } - else - { - pOptTable++; - } - } - } - } - - ERR_ON_HR(hr); - return hr; - } - - -protected: - CComPtr m_pCoreHelper; -}; - diff --git a/print/XPSDrvSmpl/src/ui/ftrppg.cpp b/print/XPSDrvSmpl/src/ui/ftrppg.cpp deleted file mode 100644 index 5cb4ea8f..00000000 --- a/print/XPSDrvSmpl/src/ui/ftrppg.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - ftrppg.cpp - -Abstract: - - Implementation of the feature property page. This class is - responsible for initialising and registering the features - property page and its controls. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "xdstring.h" -#include "resource.h" -#include "ftrppg.h" -#include "ftrctrls.h" - -/*++ - -Routine Name: - - CFeaturePropPage::CFeaturePropPage - -Routine Description: - - CFeaturePropPage class constructor. - Creates a handler class object for every control on the feature property page. - Each of these handlers is stored in a collection. - -Arguments: - - None - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CFeaturePropPage::CFeaturePropPage() -{ - HRESULT hr = S_OK; - - try - { - CUIControl* pControl = new(std::nothrow) CUICtrlFeatPgScaleCombo(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_COMBO_PGSCALE, pControl); - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlFeatScaleOffsetCombo(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_COMBO_SCALEOFF, pControl); - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlFeatPgScaleXEdit(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY)) && - SUCCEEDED(hr = AddUIControl(IDC_EDIT_PGSCALEX, pControl))) - { - pControl = new(std::nothrow) CUICtrlFeatPgScaleXSpin(reinterpret_cast(pControl)); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_SPIN_PGSCALEX, pControl); - } - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlFeatPgOffsetXEdit(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY)) && - SUCCEEDED(hr = AddUIControl(IDC_EDIT_PGOFFX, pControl))) - { - pControl = new(std::nothrow) CUICtrlFeatPgOffsetXSpin(reinterpret_cast(pControl)); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_SPIN_PGOFFX, pControl); - } - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlFeatPgScaleYEdit(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY)) && - SUCCEEDED(hr = AddUIControl(IDC_EDIT_PGSCALEY, pControl))) - { - pControl = new(std::nothrow) CUICtrlFeatPgScaleYSpin(reinterpret_cast(pControl)); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_SPIN_PGSCALEY, pControl); - } - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlFeatPgOffsetYEdit(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY)) && - SUCCEEDED(hr = AddUIControl(IDC_EDIT_PGOFFY, pControl))) - { - pControl = new(std::nothrow) CUICtrlFeatPgOffsetYSpin(reinterpret_cast(pControl)); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_SPIN_PGOFFY, pControl); - } - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlFeatNUpCombo(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_COMBO_NUP, pControl); - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlFeatNUpOrderCombo(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_COMBO_NUP_ORDER, pControl); - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlFeatPhotIntCombo(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_COMBO_PHOTO_INTENT, pControl); - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlFeatDocDuplexCombo(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_COMBO_DOCDUPLEX, pControl); - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlFeatBordersCheck(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_CHECK_BORDERLESS, pControl); - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlFeatJobBindCombo(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_COMBO_JOBBIND, pControl); - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlFeatDocBindCombo(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_COMBO_DOCBIND, pControl); - } - } - } - catch (CXDException& e) - { - hr = e; - } - - if (FAILED(hr)) - { - DestroyUIComponents(); - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CFeaturePropPage::~CFeaturePropPage - -Routine Description: - - CFeaturePropPage class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CFeaturePropPage::~CFeaturePropPage() -{ -} - -/*++ - -Routine Name: - - CFeaturePropPage::InitDlgBox - -Routine Description: - - Provides the base class with the data required to intialise the dialog box. - -Arguments: - - ppszTemplate - Pointer to dialog box template to be intialised. - ppszTitle - Pointer to dialog box title to be intialised. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CFeaturePropPage::InitDlgBox( - _Out_ LPCTSTR* ppszTemplate, - _Out_ LPCTSTR* ppszTitle - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppszTemplate, E_POINTER)) || - SUCCEEDED(hr = CHECK_POINTER(ppszTitle, E_POINTER))) - { - *ppszTemplate = MAKEINTRESOURCE(IDD_FEATURES); - *ppszTitle = MAKEINTRESOURCE(IDS_FEATURE); - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/ui/ftrppg.h b/print/XPSDrvSmpl/src/ui/ftrppg.h deleted file mode 100644 index 73384fa5..00000000 --- a/print/XPSDrvSmpl/src/ui/ftrppg.h +++ /dev/null @@ -1,42 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - ftrppg.h - -Abstract: - - Definition of the feature property page. This class is - responsible for initialising and registering the features - property page and its controls. - ---*/ - -#pragma once - -#include "precomp.h" -#include "docppg.h" - -class CFeaturePropPage : public CDocPropPage -{ -public: - CFeaturePropPage(); - - virtual ~CFeaturePropPage(); - - HRESULT - InitDlgBox( - _Out_ LPCTSTR* ppszTemplate, - _Out_ LPCTSTR* ppszTitle - ); -}; - diff --git a/print/XPSDrvSmpl/src/ui/nupptcnv.cpp b/print/XPSDrvSmpl/src/ui/nupptcnv.cpp deleted file mode 100644 index 017d87ca..00000000 --- a/print/XPSDrvSmpl/src/ui/nupptcnv.cpp +++ /dev/null @@ -1,477 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nupptcnv.cpp - -Abstract: - - JobNUpAllDocumentsContiguously and DocumentNUp devmode <-> PrintTicket conversion class implementation. - The class defines a common data representation between the DevMode (GPD) and PrintTicket - representations and implements the conversion and validation methods required - by CFeatureDMPTConvert. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "xdstring.h" -#include "nupptcnv.h" -#include "nupchndlr.h" - -using XDPrintSchema::NUp::NUpData; -using XDPrintSchema::NUp::ENUpFeature; -using XDPrintSchema::NUp::ENUpFeatureMin; -using XDPrintSchema::NUp::JobNUpAllDocumentsContiguously; -using XDPrintSchema::NUp::DocumentNUp; -using XDPrintSchema::NUp::ENUpFeatureMax; - -using XDPrintSchema::NUp::PresentationDirection::ENUpDirectionOption; -using XDPrintSchema::NUp::PresentationDirection::LeftTop; -using XDPrintSchema::NUp::PresentationDirection::LeftBottom; -using XDPrintSchema::NUp::PresentationDirection::RightTop; -using XDPrintSchema::NUp::PresentationDirection::RightBottom; -using XDPrintSchema::NUp::PresentationDirection::BottomRight; -using XDPrintSchema::NUp::PresentationDirection::BottomLeft; -using XDPrintSchema::NUp::PresentationDirection::TopRight; -using XDPrintSchema::NUp::PresentationDirection::TopLeft; - -PCSTR g_pszNUpFeature[ENUpFeatureMax] = { - "JobNUpAllDocumentsContiguously", - "DocumentNUp" -}; -static GPDStringToOption g_pagesPerSheetOption[] = { - {"1", 1}, - {"2", 2}, - {"4", 4}, - {"6", 6}, - {"8", 8}, - {"9", 9}, - {"16", 16}, -}; -UINT g_cPagesPerSheetOption = sizeof(g_pagesPerSheetOption)/sizeof(GPDStringToOption); - -PCSTR g_pszPresDirFeature[ENUpFeatureMax] = { - "JobNUpContiguouslyPresentationOrder", - "DocumentNUpPresentationOrder", -}; -static GPDStringToOption g_presDirTypeOption[] = { - {"RightBottom", RightBottom}, - {"BottomRight", BottomRight}, - {"LeftBottom", LeftBottom}, - {"BottomLeft", BottomLeft}, - {"RightTop", RightTop}, - {"TopRight", TopRight}, - {"LeftTop", LeftTop}, - {"TopLeft", TopLeft}, -}; -UINT g_cPresDirOption = sizeof(g_presDirTypeOption)/sizeof(GPDStringToOption); - - -/*++ - -Routine Name: - - CNUpDMPTConv::CNUpDMPTConv - -Routine Description: - - CNUpDMPTConv class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CNUpDMPTConv::CNUpDMPTConv() -{ -} - -/*++ - -Routine Name: - - CNUpDMPTConv::~CNUpDMPTConv - -Routine Description: - - CNUpDMPTConv class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CNUpDMPTConv::~CNUpDMPTConv() -{ -} - -/*++ - -Routine Name: - - CNUpDMPTConv::GetPTDataSettingsFromDM - -Routine Description: - - Populates the NUp data structure from the Devmode passed in. - -Arguments: - - pDevmode - pointer to input devmode buffer. - cbDevmode - size in bytes of full input devmode. - pPrivateDevmode - pointer to input private devmode buffer. - cbDrvPrivateSize - size in bytes of private devmode. - pDataSettings - Pointer to NUp data structure to be updated. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpDMPTConv::GetPTDataSettingsFromDM( - _In_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _In_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize, - _Out_ NUpSettings* pDataSettings - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrivateDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDataSettings, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE) || - cbDrvPrivateSize == 0) - { - hr = E_INVALIDARG; - } - } - - // - // Retrieve the GPD and devmode controlled settings for both Job and Document NUp - // - for (ENUpFeature nUpFeature = ENUpFeatureMin; - nUpFeature < ENUpFeatureMax && SUCCEEDED(hr); - nUpFeature = static_cast(nUpFeature + 1)) - { - pDataSettings->settings[nUpFeature].nUpFeature = nUpFeature; - if (SUCCEEDED(hr = GetOptionFromGPDString(pDevmode, - cbDevmode, - g_pszNUpFeature[nUpFeature], - g_pagesPerSheetOption, - g_cPagesPerSheetOption, - pDataSettings->settings[nUpFeature].cNUp))) - { - hr = GetOptionFromGPDString(pDevmode, - cbDevmode, - g_pszPresDirFeature[nUpFeature], - g_presDirTypeOption, - g_cPresDirOption, - pDataSettings->settings[nUpFeature].nUpPresentDir); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpDMPTConv::MergePTDataSettingsWithPT - -Routine Description: - - This method updates the NUp data structure from a PrintTicket description. - -Arguments: - - pPrintTicket - Pointer to the input PrintTicket. - pDataSettings - Pointer to the NUp data structure - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpDMPTConv::MergePTDataSettingsWithPT( - _In_ IXMLDOMDocument2* pPrintTicket, - _Inout_ NUpSettings* pDataSettings - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDataSettings, E_POINTER))) - { - try - { - // - // Get the NUp settings from the PrintTicket and set the options in - // the appropriate Job or Document equivalent in the NUpSettings structure - // - NUpData nUpData; - CNUpPTHandler nUpPTHndlr(pPrintTicket); - - if (SUCCEEDED(hr = nUpPTHndlr.GetData(&nUpData))) - { - // - // Only update settings relevant to the feature - // - if (nUpData.nUpFeature < ENUpFeatureMax && - nUpData.nUpFeature >= ENUpFeatureMin) - { - pDataSettings->settings[nUpData.nUpFeature] = nUpData; - } - } - else if (hr == E_ELEMENT_NOT_FOUND) - { - // - // NUp setting not in the PT - make sure neither Job or - // Document NUp are set in the outgoing data structure - // - pDataSettings->settings[JobNUpAllDocumentsContiguously].cNUp = 1; - pDataSettings->settings[DocumentNUp].cNUp = 1; - - hr = S_OK; - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpDMPTConv::SetPTDataInDM - -Routine Description: - - This method updates the NUp options in the devmode from the UI Settings. - -Arguments: - - dataSettings - Reference to NUp data settings to be updated. - pDevmode - pointer to devmode to be updated. - cbDevmode - size in bytes of full devmode. - pPrivateDevmode - pointer to input private devmode buffer. - cbDrvPrivateSize - size in bytes of private devmode. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpDMPTConv::SetPTDataInDM( - _In_ CONST NUpSettings& dataSettings, - _Inout_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _Inout_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrivateDevmode, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE) || - cbDrvPrivateSize == 0) - { - hr = E_INVALIDARG; - } - } - - for (ENUpFeature nUpFeature = ENUpFeatureMin; - nUpFeature < ENUpFeatureMax && SUCCEEDED(hr); - nUpFeature = static_cast(nUpFeature + 1)) - { - if (SUCCEEDED(hr = SetGPDStringFromOption(pDevmode, - cbDevmode, - g_pszNUpFeature[nUpFeature], - g_pagesPerSheetOption, - g_cPagesPerSheetOption, - dataSettings.settings[nUpFeature].cNUp))) - { - hr = SetGPDStringFromOption(pDevmode, - cbDevmode, - g_pszPresDirFeature[nUpFeature], - g_presDirTypeOption, - g_cPresDirOption, - dataSettings.settings[nUpFeature].nUpPresentDir); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpDMPTConv::SetPTDataInPT - -Routine Description: - - This method updates the watemark PrintTicket description from NUp data structure. - -Arguments: - - dataSettings - Reference to NUp data structure to update from. - pPrintTicket - Pointer to the PrintTicket to be updated. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CNUpDMPTConv::SetPTDataInPT( - _In_ CONST NUpSettings& dataSettings, - _Inout_ IXMLDOMDocument2* pPrintTicket - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER))) - { - try - { - CNUpPTHandler nUpPTHndlr(pPrintTicket); - NUpData nUpData; - - // - // Preferentially set Job over Document - // - if (dataSettings.settings[JobNUpAllDocumentsContiguously].cNUp > 1) - { - nUpData.nUpFeature = JobNUpAllDocumentsContiguously; - nUpData.cNUp = dataSettings.settings[JobNUpAllDocumentsContiguously].cNUp; - nUpData.nUpPresentDir = dataSettings.settings[JobNUpAllDocumentsContiguously].nUpPresentDir; - } - else - { - nUpData.nUpFeature = DocumentNUp; - nUpData.cNUp = dataSettings.settings[DocumentNUp].cNUp; - nUpData.nUpPresentDir = dataSettings.settings[DocumentNUp].nUpPresentDir; - } - - // - // If the option is enabled set, otherwise delete it from the PT - // - if (nUpData.cNUp > 1) - { - hr = nUpPTHndlr.SetData(&nUpData); - } - else - { - hr = nUpPTHndlr.Delete(); - } - } - catch (CXDException& e) - { - hr = e; - } - } - else - { - hr = E_POINTER; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CNUpDMPTConv::CompletePrintCapabilities - -Routine Description: - - Unidrv calls this routine with an input Device Capabilities Document - that is partially populated with Device capabilities information - filled in by Unidrv for features that it understands. The plug-in - needs to read any private features in the input PrintTicket, delete - them and add them back under Printschema namespace so that higher - level applications can understand them and make use of them. - -Arguments: - - pPrintTicket - pointer to input PrintTicket - pCapabilities - pointer to Device Capabilities Document. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CNUpDMPTConv::CompletePrintCapabilities( - _In_opt_ IXMLDOMDocument2*, - _Inout_ IXMLDOMDocument2* pPrintCapabilities - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPrintCapabilities, E_POINTER))) - { - try - { - CNUpPCHandler nuppcHandler(pPrintCapabilities); - nuppcHandler.SetCapabilities(); - } - catch(CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/ui/nupptcnv.h b/print/XPSDrvSmpl/src/ui/nupptcnv.h deleted file mode 100644 index e77798c8..00000000 --- a/print/XPSDrvSmpl/src/ui/nupptcnv.h +++ /dev/null @@ -1,86 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - nupptcnv.h - -Abstract: - - JobNUpAllDocumentsContiguously and DocumentNUp devmode <-> PrintTicket conversion class definition. - The class defines a common data representation between the DevMode (GPD) and PrintTicket - representations and implements the conversion and validation methods required - by CFeatureDMPTConvert. - ---*/ - -#pragma once - -#include "ftrdmptcnv.h" -#include "nupthndlr.h" -#include "nupdata.h" - -// -// The PT handling code defines a single NUpData structure that covers -// both JobNUpAllDocumentsContiguously and DocumentNUp to avoid conflicts. The GPD however -// controls both so we re-use the NUpData structure to handle both in -// the DevMode by using a NUpData for each Job and Document feature -// -struct NUpSettings -{ - XDPrintSchema::NUp::NUpData settings[XDPrintSchema::NUp::ENUpFeatureMax]; -}; - -class CNUpDMPTConv : public CFeatureDMPTConvert -{ -public: - CNUpDMPTConv(); - - virtual ~CNUpDMPTConv(); - -private: - HRESULT - GetPTDataSettingsFromDM( - _In_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _In_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize, - _Out_ NUpSettings* pDataSettings - ); - - HRESULT - MergePTDataSettingsWithPT( - _In_ IXMLDOMDocument2* pPrintTicket, - _Inout_ NUpSettings* pDrvSettings - ); - - HRESULT - SetPTDataInDM( - _In_ CONST NUpSettings& drvSettings, - _Inout_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _Inout_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize - ); - - HRESULT - SetPTDataInPT( - _In_ CONST NUpSettings& drvSettings, - _Inout_ IXMLDOMDocument2* pPrintTicket - ); - - HRESULT STDMETHODCALLTYPE - CompletePrintCapabilities( - _In_opt_ IXMLDOMDocument2*, - _Inout_ IXMLDOMDocument2* pPrintCapabilities - ); -}; - diff --git a/print/XPSDrvSmpl/src/ui/pgscdmptcnv.cpp b/print/XPSDrvSmpl/src/ui/pgscdmptcnv.cpp deleted file mode 100644 index 73b717d0..00000000 --- a/print/XPSDrvSmpl/src/ui/pgscdmptcnv.cpp +++ /dev/null @@ -1,468 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pgscdmptcnv.cpp - -Abstract: - - PageScaling devmode <-> PrintTicket conversion class implementation. - The class defines a common data representation between the DevMode (GPD) and PrintTicket - representations and implements the conversion and validation methods required - by CFeatureDMPTConvert. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "xdstring.h" -#include "pgscdmptcnv.h" - -using XDPrintSchema::PageScaling::PageScalingData; -using XDPrintSchema::PageScaling::EScaleOption; -using XDPrintSchema::PageScaling::None; -using XDPrintSchema::PageScaling::Custom; -using XDPrintSchema::PageScaling::CustomSquare; -using XDPrintSchema::PageScaling::FitBleedToImageable; -using XDPrintSchema::PageScaling::FitContentToImageable; -using XDPrintSchema::PageScaling::FitMediaToImageable; -using XDPrintSchema::PageScaling::FitMediaToMedia; - -using XDPrintSchema::PageScaling::OffsetAlignment::EScaleOffsetOption; -using XDPrintSchema::PageScaling::OffsetAlignment::BottomCenter; -using XDPrintSchema::PageScaling::OffsetAlignment::BottomLeft; -using XDPrintSchema::PageScaling::OffsetAlignment::BottomRight; -using XDPrintSchema::PageScaling::OffsetAlignment::Center; -using XDPrintSchema::PageScaling::OffsetAlignment::LeftCenter; -using XDPrintSchema::PageScaling::OffsetAlignment::RightCenter; -using XDPrintSchema::PageScaling::OffsetAlignment::TopCenter; -using XDPrintSchema::PageScaling::OffsetAlignment::TopLeft; -using XDPrintSchema::PageScaling::OffsetAlignment::TopRight; - -// -// Lookup table between GPD page scaling option string and schema enumerated type -// -PCSTR g_pszPageScalingTypeFeature = "PageScaling"; -static GPDStringToOption g_pageScalingTypeOption[] = { - {"None", None}, - {"Custom", Custom}, - {"CustomSquare", CustomSquare}, - {"FitApplicationBleedSizeToPageImageableSize", FitBleedToImageable}, - {"FitApplicationContentSizeToPageImageableSize", FitContentToImageable}, - {"FitApplicationMediaSizeToPageImageableSize", FitMediaToImageable}, - {"FitApplicationMediaSizeToPageMediaSize", FitMediaToMedia}, -}; -UINT g_cPageScalingTypeOption = sizeof(g_pageScalingTypeOption)/sizeof(GPDStringToOption); - -// -// Lookup table between GPD scaling offset alignment option string and schema enumerated type -// -PCSTR g_pszScaleOffsetTypeFeature = "ScaleOffsetAlignment"; -static GPDStringToOption g_scaleOffsetTypeOption[] = { - {"BottomCenter", BottomCenter}, - {"BottomLeft", BottomLeft}, - {"BottomRight", BottomRight}, - {"Center", Center}, - {"LeftCenter", LeftCenter}, - {"RightCenter", RightCenter}, - {"TopCenter", TopCenter}, - {"TopLeft", TopLeft}, - {"TopRight", TopRight}, -}; -UINT g_cScaleOffsetTypeOption = sizeof(g_scaleOffsetTypeOption)/sizeof(GPDStringToOption); - - - -/*++ - -Routine Name: - - CPageScalingDMPTConv::CPageScalingDMPTConv - -Routine Description: - - CPageScalingDMPTConv class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPageScalingDMPTConv::CPageScalingDMPTConv() -{ -} - -/*++ - -Routine Name: - - CPageScalingDMPTConv::~CPageScalingDMPTConv - -Routine Description: - - CPageScalingDMPTConv class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CPageScalingDMPTConv::~CPageScalingDMPTConv() -{ -} - -/*++ - -Routine Name: - - CPageScalingDMPTConv::GetPTDataSettingsFromDM - -Routine Description: - - Populates the page scaling data structure from the Devmode passed in. - -Arguments: - - pDevmode - pointer to input devmode buffer. - cbDevmode - size in bytes of full input devmode. - pPrivateDevmode - pointer to input private devmode buffer. - cbDrvPrivateSize - size in bytes of private devmode. - pDataSettings - Pointer to page scaling data structure to be updated. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScalingDMPTConv::GetPTDataSettingsFromDM( - _In_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _In_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize, - _Out_ PageScalingData* pDataSettings - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrivateDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDataSettings, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE) || - cbDrvPrivateSize == 0) - { - hr = E_INVALIDARG; - } - } - - // - // Retrieve the GPD and devmode controlled settings - // - CUIProperties uiProperties(static_cast(pPrivateDevmode)); - if (SUCCEEDED(hr) && - SUCCEEDED(hr = GetOptionFromGPDString(pDevmode, - cbDevmode, - g_pszPageScalingTypeFeature, - g_pageScalingTypeOption, - g_cPageScalingTypeOption, - pDataSettings->pgscOption)) && - SUCCEEDED(hr = GetOptionFromGPDString(pDevmode, - cbDevmode, - g_pszScaleOffsetTypeFeature, - g_scaleOffsetTypeOption, - g_cScaleOffsetTypeOption, - pDataSettings->offsetOption)) && - SUCCEEDED(hr = uiProperties.GetItem(g_pszPSScaleWidth, &pDataSettings->scaleWidth, sizeof(pDataSettings->scaleWidth))) && - SUCCEEDED(hr = uiProperties.GetItem(g_pszPSScaleHeight, &pDataSettings->scaleHeight, sizeof(pDataSettings->scaleHeight))) && - SUCCEEDED(hr = uiProperties.GetItem(g_pszOffsetWidth, &pDataSettings->offWidth, sizeof(pDataSettings->offWidth))) && - SUCCEEDED(hr = uiProperties.GetItem(g_pszOffsetHeight, &pDataSettings->offHeight, sizeof(pDataSettings->offHeight)))) - { - // - // Convert length measurements from 100ths of an inch to microns - // - pDataSettings->scaleWidth = pDataSettings->scaleWidth; - pDataSettings->scaleHeight = pDataSettings->scaleHeight; - pDataSettings->offWidth = HUNDREDTH_OFINCH_TO_MICRON(pDataSettings->offWidth); - pDataSettings->offHeight = HUNDREDTH_OFINCH_TO_MICRON(pDataSettings->offHeight); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPageScalingDMPTConv::MergePTDataSettingsWithPT - -Routine Description: - - This method updates the page scaling data structure from a PrintTicket description. - -Arguments: - - pPrintTicket - Pointer to the input PrintTicket. - pDataSettings - Pointer to the page scaling data structure - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScalingDMPTConv::MergePTDataSettingsWithPT( - _In_ IXMLDOMDocument2* pPrintTicket, - _Inout_ PageScalingData* pDataSettings - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDataSettings, E_POINTER))) - { - try - { - // - // Get the page scaling settings from the PrintTicket and set the options in - // the input Watermark data structure - // - PageScalingData pgScData; - CPageScalingPTHandler pgScPTHndlr(pPrintTicket); - - if (SUCCEEDED(hr = pgScPTHndlr.GetData(&pgScData))) - { - *pDataSettings = pgScData; - } - else if (hr == E_ELEMENT_NOT_FOUND) - { - // - // PageScaling setting not in the PT - this is not an error. Just - // leave set the type as None and reset the HRESULT to S_OK - // - pDataSettings->pgscOption = None; - hr = S_OK; - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPageScalingDMPTConv::SetPTDataInDM - -Routine Description: - - This method updates the page scaling options in the devmode from the UI Settings. - -Arguments: - - dataSettings - Reference to page scaling data settings to be updated. - pDevmode - pointer to devmode to be updated. - cbDevmode - size in bytes of full devmode. - pPrivateDevmode - pointer to input private devmode buffer. - cbDrvPrivateSize - size in bytes of private devmode. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScalingDMPTConv::SetPTDataInDM( - _In_ CONST PageScalingData& dataSettings, - _Inout_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _Inout_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrivateDevmode, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE) || - cbDrvPrivateSize == 0) - { - hr = E_INVALIDARG; - } - } - - // - // Convert lengths from microns to 100ths of an inch before writing to the DevMode - // - if (SUCCEEDED(hr)) - { - INT scaleWidth = dataSettings.scaleWidth; - INT scaleHeight = dataSettings.scaleHeight; - INT offWidth = MICRON_TO_HUNDREDTH_OFINCH(dataSettings.offWidth); - INT offHeight = MICRON_TO_HUNDREDTH_OFINCH(dataSettings.offHeight); - - // - // Set the GPD and devmode controlled settings - // - CUIProperties uiProperties(static_cast(pPrivateDevmode)); - - if (SUCCEEDED(hr = SetGPDStringFromOption(pDevmode, - cbDevmode, - g_pszPageScalingTypeFeature, - g_pageScalingTypeOption, - g_cPageScalingTypeOption, - dataSettings.pgscOption)) && - SUCCEEDED(hr = SetGPDStringFromOption(pDevmode, - cbDevmode, - g_pszScaleOffsetTypeFeature, - g_scaleOffsetTypeOption, - g_cScaleOffsetTypeOption, - dataSettings.offsetOption)) && - SUCCEEDED(hr = uiProperties.SetItem(g_pszPSScaleWidth, &scaleWidth, sizeof(scaleWidth))) && - SUCCEEDED(hr = uiProperties.SetItem(g_pszPSScaleHeight, &scaleHeight, sizeof(scaleHeight))) && - SUCCEEDED(hr = uiProperties.SetItem(g_pszOffsetWidth, &offWidth, sizeof(offWidth)))) - { - hr = uiProperties.SetItem(g_pszOffsetHeight, &offHeight, sizeof(offHeight)); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPageScalingDMPTConv::SetPTDataInPT - -Routine Description: - - This method updates the watemark PrintTicket description from page scaling data structure. - -Arguments: - - drvSettings - Reference to page scaling data structure to update from. - pPrintTicket - Pointer to the PrintTicket to be updated. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CPageScalingDMPTConv::SetPTDataInPT( - _In_ CONST PageScalingData& dataSettings, - _Inout_ IXMLDOMDocument2* pPrintTicket - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER))) - { - try - { - CPageScalingPTHandler pgScPTHndlr(pPrintTicket); - hr = pgScPTHndlr.SetData(&dataSettings); - } - catch (CXDException& e) - { - hr = e; - } - } - else - { - hr = E_POINTER; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CPageScalingDMPTConv::CompletePrintCapabilities - -Routine Description: - - Unidrv calls this routine with an input Device Capabilities Document - that is partially populated with Device capabilities information - filled in by Unidrv for features that it understands. The plug-in - needs to read any private features in the input PrintTicket, delete - them and add them back under Printschema namespace so that higher - level applications can understand them and make use of them. - -Arguments: - - pPrintTicket - pointer to input PrintTicket - pCapabilities - pointer to Device Capabilities Document. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CPageScalingDMPTConv::CompletePrintCapabilities( - _In_opt_ IXMLDOMDocument2*, - _Inout_ IXMLDOMDocument2* pPrintCapabilities - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPrintCapabilities, E_POINTER))) - { - try - { - CPageScalingPCHandler pagescalingpcHandler(pPrintCapabilities); - pagescalingpcHandler.SetCapabilities(); - } - catch(CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} diff --git a/print/XPSDrvSmpl/src/ui/pgscdmptcnv.h b/print/XPSDrvSmpl/src/ui/pgscdmptcnv.h deleted file mode 100644 index 3f8b188a..00000000 --- a/print/XPSDrvSmpl/src/ui/pgscdmptcnv.h +++ /dev/null @@ -1,76 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - pgscdmptcnv.h - -Abstract: - - PageScaling devmode <-> PrintTicket conversion class definition. - The class defines a common data representation between the DevMode (GPD) and PrintTicket - representations and implements the conversion and validation methods required - by CFeatureDMPTConvert. - ---*/ - -#pragma once - -#include "ftrdmptcnv.h" -#include "pgscpthndlr.h" -#include "pgscpchndlr.h" -#include "uiproperties.h" - -class CPageScalingDMPTConv : public CFeatureDMPTConvert -{ -public: - CPageScalingDMPTConv(); - - ~CPageScalingDMPTConv(); - -private: - HRESULT - GetPTDataSettingsFromDM( - _In_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _In_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize, - _Out_ XDPrintSchema::PageScaling::PageScalingData* pDataSettings - ); - - HRESULT - MergePTDataSettingsWithPT( - _In_ IXMLDOMDocument2* pPrintTicket, - _Inout_ XDPrintSchema::PageScaling::PageScalingData* pDrvSettings - ); - - HRESULT - SetPTDataInDM( - _In_ CONST XDPrintSchema::PageScaling::PageScalingData& drvSettings, - _Inout_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _Inout_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize - ); - - HRESULT - SetPTDataInPT( - _In_ CONST XDPrintSchema::PageScaling::PageScalingData& drvSettings, - _Inout_ IXMLDOMDocument2* pPrintTicket - ); - - HRESULT STDMETHODCALLTYPE - CompletePrintCapabilities( - _In_opt_ IXMLDOMDocument2*, - _Inout_ IXMLDOMDocument2* pPrintCapabilities - ); -}; - diff --git a/print/XPSDrvSmpl/src/ui/precomp.h b/print/XPSDrvSmpl/src/ui/precomp.h deleted file mode 100644 index b9847ea0..00000000 --- a/print/XPSDrvSmpl/src/ui/precomp.h +++ /dev/null @@ -1,103 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - precomp.h - -Abstract: - - Precompiled header for UI plugin module. - ---*/ - -#pragma once - -// -// Annotate this as a usermode driver for static analysis -// -#include -_Analysis_mode_(_Analysis_code_type_user_driver_) - -// -// Standard Annotation Language include -// -#include - -// -// Prefast warning suppression macros -// -#include - -// -// Windows includes -// -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif // WIN32_LEAN_AND_MEAN -#include -#include -#include -#include - -// -// COM includes -// -#include -#include - -// -// ATL Includes -// -#include - -#pragma warning (push) -#pragma warning (disable:4458) -// -// GDIPlus includes -// -#include -#pragma warning (pop) - -// -// MSXML includes -// -#include - -// -// Standard library includes -// -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -// -// Commonly used namespaces -// -using namespace std; -using namespace Gdiplus; - -// -// StrSafe.h needs to be included last to disallow bad string functions. -// -#include - -#define E_ELEMENT_NOT_FOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND) - - diff --git a/print/XPSDrvSmpl/src/ui/precompsrc.cpp b/print/XPSDrvSmpl/src/ui/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/XPSDrvSmpl/src/ui/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/ui/resource.h b/print/XPSDrvSmpl/src/ui/resource.h deleted file mode 100644 index 448397a5..00000000 --- a/print/XPSDrvSmpl/src/ui/resource.h +++ /dev/null @@ -1,232 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - resource.h - -Abstract: - - Resource specific defines. - ---*/ - -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by xdsmpldlg.rc -// -#define IDD_COL_MANAGE 100 -#define IDD_WATERMARK 101 -#define IDD_FEATURES 102 -#define IDS_LAYOUT 126 -#define IDS_PAPQUAL 127 -#define IDS_COLMAN 128 -#define IDS_WMARK 129 -#define IDS_FEATURE 130 -#define IDC_COMBO_COL_MANAGE 1001 -#define IDC_LIST_COLPROF 1002 -#define IDC_TEXT_COLPROF 1003 -#define IDC_COMBO_WMTYPE 1004 -#define IDC_TXT_WMTYPE 1005 -#define IDC_GRP_WM 1006 -#define IDC_COMBO_WMLAYERING 1007 -#define IDC_GRP_COLPROF 1008 -#define IDC_TXT_WMLAYERING 1009 -#define IDC_GRP_PGSCALE 1010 -#define IDC_GRP_DOCNUP 1011 -#define IDC_EDIT_WMTEXT 1012 -#define IDC_TXT_WMTEXT 1013 -#define IDC_COMBO_PGSCALE 1014 -#define IDC_TXT_PGSCALE 1015 -#define IDC_EDIT_PGSCALEX 1018 -#define IDC_EDIT_PGOFFX 1019 -#define IDC_EDIT_PGSCALEY 1022 -#define IDC_GRP_WM_MIMIC 1023 -#define IDC_EDIT_PGOFFY 1024 -#define IDC_SPIN_PGSCALEX 1025 -#define IDC_SPIN_PGOFFX 1026 -#define IDC_SPIN_PGSCALEY 1027 -#define IDC_SPIN_PGOFFY 1028 -#define IDC_COMBO_NUP 1029 -#define IDC_TXT_NUP 1030 -#define IDC_COMBO_NUP_ORDER 1031 -#define IDC_TXT_NUP_ORDER 1032 -#define IDC_COMBO_JOBBIND 1033 -#define IDC_TXT_JOBBIND 1034 -#define IDC_COMBO_DOCBIND 1035 -#define IDC_TXT_DOCBIND 1036 -#define IDC_COMBO_PHOTO_INTENT 1037 -#define IDC_TXT_PHOTO_INTENT 1038 -#define IDC_CHECK_BORDERLESS 1039 -#define IDC_TXT_PGOFFY 1040 -#define IDC_TXT_PGOFFX 1041 -#define IDC_TXT_PGSCALEY 1042 -#define IDC_TXT_PGSCALEX 1043 -#define IDC_CHECK_DEVFONTSUB 1044 -#define IDC_GRP_DOCDUP 1045 -#define IDC_CHECK_DOCDUPLEX 1046 -#define IDC_COMBO_DOCDUPLEX 1047 -#define IDC_TXT_DOCDUPLEX 1048 -#define IDC_TXT_COL_MANAGE 1049 -#define IDC_EDIT_WMTRANSPARENCY 1050 -#define IDC_SPIN_WMTRANSPARENCY 1051 -#define IDC_EDIT_WMANGLE 1052 -#define IDC_SPIN_WMANGLE 1053 -#define IDC_EDIT_WMOFFX 1054 -#define IDC_SPIN_WMOFFX 1055 -#define IDC_EDIT_WMOFFY 1056 -#define IDC_SPIN_WMOFFY 1057 -#define IDC_TXT_WMTRANSPARENCY 1058 -#define IDC_TXT_WMANGLE 1059 -#define IDC_TXT_WMOFFX 1060 -#define IDC_TXT_WMOFFY 1061 -#define IDC_EDIT_WMWIDTH 1062 -#define IDC_SPIN_WMWIDTH 1063 -#define IDC_EDIT_WMHEIGHT 1064 -#define IDC_SPIN_WMHEIGHT 1065 -#define IDC_TXT_WMWIDTH 1066 -#define IDC_TXT_WMHEIGHT 1067 -#define IDC_EDIT_WMSIZE 1068 -#define IDC_SPIN_WMSIZE 1069 -#define IDC_TXT_WMSIZE 1070 -#define IDC_BUTTON_WMCOLOR 1071 -#define IDC_COMBO_COL_INTENT 1073 -#define IDC_TXT_COL_INTENT 1074 -#define IDC_COMBO_SCALEOFF 1075 -#define IDC_TXT_SCALEOFF 1076 - -// -// String resource IDs used in GPD -// -#define IDS_GPD_1PPS 2000 -#define IDS_GPD_2PPS 2001 -#define IDS_GPD_4PPS 2002 -#define IDS_GPD_6PPS 2003 -#define IDS_GPD_8PPS 2004 -#define IDS_GPD_9PPS 2005 -#define IDS_GPD_16PPS 2006 -#define IDS_GPD_RES1200 2007 -#define IDS_GPD_RES600 2008 -#define IDS_GPD_AUTOMATIC 2009 -#define IDS_GPD_BORDERED 2010 -#define IDS_GPD_BORDERLESS 2011 -#define IDS_GPD_BTOT 2012 -#define IDS_GPD_BTOTLTOR 2013 -#define IDS_GPD_BTOTRTOL 2014 -#define IDS_GPD_CMYK 2015 -#define IDS_GPD_COLOR 2016 -#define IDS_GPD_CONFIDENTIAL 2017 -#define IDS_GPD_CUSTSQUARE 2018 -#define IDS_GPD_CUSTOM 2019 -#define IDS_GPD_SRCCOLPROF 2020 -#define IDS_GPD_DEVICE 2021 -#define IDS_GPD_DOCBIND 2022 -#define IDS_GPD_PAGECOLMAN 2023 -#define IDS_GPD_PAGEPHOTINTENT 2024 -#define IDS_GPD_DOCDUPLEX 2025 -#define IDS_GPD_DOCNUP 2026 -#define IDS_GPD_DOCNUPPRESENTORDER 2027 -#define IDS_GPD_DRAFT 2028 -#define IDS_GPD_DRIVER 2029 -#define IDS_GPD_DUPLEX 2030 -#define IDS_GPD_FAX 2031 -#define IDS_GPD_FITBLEED 2032 -#define IDS_GPD_FITCONTENT 2033 -#define IDS_GPD_FITPAGE 2034 -#define IDS_GPD_GLOSSY 2035 -#define IDS_GPD_GRAYSCALE 2036 -#define IDS_GPD_HIGH 2037 -#define IDS_GPD_HORIZONTAL 2038 -#define IDS_GPD_JOBBINDING 2039 -#define IDS_GPD_JOBNUPPRESENTORDER 2040 -#define IDS_GPD_JOBNUP 2041 -#define IDS_GPD_JOBPAGEORDER 2042 -#define IDS_GPD_LANDSCAPE 2043 -#define IDS_GPD_LTOR 2044 -#define IDS_GPD_LTORBTOT 2045 -#define IDS_GPD_LTORTTOB 2046 -#define IDS_GPD_MEDIATYPE 2047 -#define IDS_GPD_MONO 2048 -#define IDS_GPD_NONE 2049 -#define IDS_GPD_NORMAL 2050 -#define IDS_GPD_OFF 2051 -#define IDS_GPD_ON 2052 -#define IDS_GPD_ORIENATION 2053 -#define IDS_GPD_OVERLAYED 2054 -#define IDS_GPD_PAGEBORDER 2055 -#define IDS_GPD_PAGEQUALITY 2056 -#define IDS_GPD_PAGESCALING 2057 -#define IDS_GPD_PAPERSOURCE 2058 -#define IDS_GPD_PHOTOGRAPHIC 2059 -#define IDS_GPD_PORTRAIT 2060 -#define IDS_GPD_RASTERIMAGE 2061 -#define IDS_GPD_RESOLUTION 2062 -#define IDS_GPD_REVERSELANDSCAPE 2063 -#define IDS_GPD_REVERSE 2064 -#define IDS_GPD_RTOL 2065 -#define IDS_GPD_RTOLBTOT 2066 -#define IDS_GPD_RTOLTTOB 2067 -#define IDS_GPD_SCALEPAGETOPAGE 2068 -#define IDS_GPD_SCRGB 2069 -#define IDS_GPD_STANDARD 2070 -#define IDS_GPD_TEXT 2071 -#define IDS_GPD_TTOB 2072 -#define IDS_GPD_TTOBLTOR 2073 -#define IDS_GPD_TTOBRTOL 2074 -#define IDS_GPD_TRANSPARENCY 2075 -#define IDS_GPD_TRANSPARENT 2076 -#define IDS_GPD_UNDERLAYED 2077 -#define IDS_GPD_UPPER 2078 -#define IDS_GPD_VECTORIMAGE 2079 -#define IDS_GPD_VERTICAL 2080 -#define IDS_GPD_WATERMARKLAYERING 2081 -#define IDS_GPD_WATERMARKTEXT 2082 -#define IDS_GPD_WATERMARKTYPE 2083 -#define IDS_GPD_WATERMARKBITMAP 2084 -#define IDS_GPD_WATERMARKGRAPHIC 2087 -#define IDS_GPD_BEST 2090 -#define IDS_GPD_PAGEICMINTENT 2091 -#define IDS_GPD_ABSCOLINTENT 2092 -#define IDS_GPD_RELCOLINTENT 2093 -#define IDS_GPD_PHOTOINTENT 2094 -#define IDS_GPD_BIZINTENT 2095 -#define IDS_GPD_SYSTEM 2096 -#define IDS_GPD_WATERMARKTEXTCOLOR 2097 -#define IDS_GPD_RED 2098 -#define IDS_GPD_GREEN 2099 -#define IDS_GPD_BLUE 2100 -#define IDS_GPD_MAGENTA 2101 -#define IDS_GPD_CYAN 2102 -#define IDS_GPD_YELLOW 2103 -#define IDS_GPD_BLACK 2104 -#define IDS_GPD_SCALE_ALIGN 2105 -#define IDS_GPD_SCALE_ALIGN_BC 2106 -#define IDS_GPD_SCALE_ALIGN_BL 2107 -#define IDS_GPD_SCALE_ALIGN_BR 2108 -#define IDS_GPD_SCALE_ALIGN_CC 2109 -#define IDS_GPD_SCALE_ALIGN_LC 2110 -#define IDS_GPD_SCALE_ALIGN_CR 2111 -#define IDS_GPD_SCALE_ALIGN_CT 2112 -#define IDS_GPD_SCALE_ALIGN_TL 2113 -#define IDS_GPD_SCALE_ALIGN_TR 2114 - -// -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 131 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1077 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif - diff --git a/print/XPSDrvSmpl/src/ui/uictrl.cpp b/print/XPSDrvSmpl/src/ui/uictrl.cpp deleted file mode 100644 index a424a3a4..00000000 --- a/print/XPSDrvSmpl/src/ui/uictrl.cpp +++ /dev/null @@ -1,2117 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - uictrl.cpp - -Abstract: - - Implementation of the abstract UI control class and the base default - UI controls for check boxe, list, combo, edit and spin controls. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "uictrl.h" - -/*++ - -Routine Name: - - CUIControl::CUIControl - -Routine Description: - - CUIControl class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUIControl::CUIControl() : - m_pDriverUIHelp(NULL), - m_pOemCUIPParam(NULL), - m_pUIProperties(NULL) -{ -} - -/*++ - -Routine Name: - - CUIControl::~CUIControl - -Routine Description: - - CUIControl class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUIControl::~CUIControl() -{ -} - -/*++ - -Routine Name: - - CUIControl::SetOemCUIPParam - -Routine Description: - - Store a pointer to a OEMCUIPPARAM structure as a member in the class. - -Arguments: - - pOemCUIPParam - Pointer to a OEMCUIPPARAM structure - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUIControl::SetOemCUIPParam( - _In_ CONST POEMCUIPPARAM pOemCUIPParam - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pOemCUIPParam, E_POINTER))) - { - m_pOemCUIPParam = pOemCUIPParam; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUIControl::SetUIProperties - -Routine Description: - - Store a pointer to an CUIProperties interface as a member in the class. - -Arguments: - - pUIProperties - Pointer to an instance of the CUIProperties interface. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUIControl::SetUIProperties( - _In_ CUIProperties* pUIProperties - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pUIProperties, E_POINTER))) - { - m_pUIProperties = pUIProperties; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUIControl::SetPrintOemDriverUI - -Routine Description: - - Store a pointer to an IPrintOemDriverUI interface as a member in the class. - -Arguments: - - pOEMDriverUI - Pointer to an instance of the IPrintOemDriverUI interface. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUIControl::SetPrintOemDriverUI( - _In_ CONST IPrintOemDriverUI* pOEMDriverUI - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pOEMDriverUI, E_POINTER))) - { - m_pDriverUIHelp = const_cast(pOEMDriverUI); - } - - ERR_ON_HR(hr); - return hr; -} - -// -// Message handling stubs -// -/*++ - -Routine Name: - - CUIControl::OnInit - -Routine Description: - - This is a default implementation that returns S_OK. - Called from the property page handler on a WM_INITDIALOG message. - -Arguments: - - None referenced. - -Return Value: - - HRESULT - S_OK - ---*/ -HRESULT -CUIControl::OnInit( - _In_ CONST HWND - ) -{ - // - // A sub class is required to implement this method if it requires intialisation. The - // implementation is optional however so we return S_OK by default. - // - return S_OK; -} - -/*++ - -Routine Name: - - CUIControl::OnCommand - -Routine Description: - - This is a place holder method with no implementation. - Called from the property page handler on a WM_COMMAND message. - -Arguments: - - None referenced. - -Return Value: - - HRESULT - E_NOTIMPL - Method not implemented - ---*/ -HRESULT -CUIControl::OnCommand( - _In_ CONST HWND , - _In_ INT - ) -{ - // - // A sub class is required to implement this method if it can recieve command messages. The - // implementation is optional however so we return S_OK by default. - // - return S_OK; -} - -/*++ - -Routine Name: - - CUIControl::OnNotify - -Routine Description: - - This is a place holder method with no implementation. - Called from the property page handler on a WM_NOTIFY message. - -Arguments: - - None referenced. - -Return Value: - - HRESULT - E_NOTIMPL - Method not implemented - ---*/ -HRESULT -CUIControl::OnNotify( - _In_ CONST HWND, - _In_ CONST NMHDR* - ) -{ - // - // A sub class is required to implement this method if it can recieve notify messages. The - // implementation is optional however so we return S_OK by default. - // - return S_OK; -} - -// -// Check box control -// -/*++ - -Routine Name: - - CUICtrlDefaultCheck::CUICtrlDefaultCheck - -Routine Description: - - CUICtrlDefaultCheck class constructor - -Arguments: - - gpdString - Property name of the data associated with this control. - iCheckResID - Resource id for the checkbox control. - -Return Value: - - None - ---*/ -CUICtrlDefaultCheck::CUICtrlDefaultCheck( - _In_ PCSTR gpdString, - _In_ CONST INT iCheckResID - ) : - m_szGPDString(gpdString), - m_iCheckResID(iCheckResID) -{ -} - -/*++ - -Routine Name: - - CUICtrlDefaultCheck::~CUICtrlDefaultCheck - -Routine Description: - - CUICtrlDefaultCheck class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlDefaultCheck::~CUICtrlDefaultCheck() -{ -} - -/*++ - -Routine Name: - - CUICtrlDefaultCheck::OnActivate - -Routine Description: - - Called when the parent property page becomes active. - This method initialises the state of the control to reflect the Unidrv GPD settings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultCheck::OnActivate( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - POPTITEM pOptItem = NULL; - - ASSERTMSG(m_pOemCUIPParam != NULL, "NULL pointer to OEMCUIPPARAM structure.\n"); - ASSERTMSG(m_pUIProperties != NULL, "NULL pointer to UI properties interface.\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pOemCUIPParam, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_PENDING)) && - SUCCEEDED(hr = m_pUIProperties->GetOptItem(m_pOemCUIPParam, m_szGPDString, &pOptItem)) && - SUCCEEDED(hr = CHECK_POINTER(pOptItem, E_FAIL))) - { - - // - // Convert from a selection to a checkbox state - // and initialise the controls state. - // - - LONG lSel = pOptItem->Sel; - - UINT uChecked = (lSel == 0) ? BST_UNCHECKED : BST_CHECKED; - - if (CheckDlgButton(hDlg, m_iCheckResID, uChecked) > 0) - { - hr = EnableDependentCtrls(hDlg, lSel); - } - else - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultCheck::OnCommand - -Routine Description: - - Called from the property page handler when a WM_COMMAND message is recieved. - Filters out any button click (BN_CLICKED) messages intended for this control. - -Arguments: - - hDlg - handle to the parent window - iCommand - specifies the notification code - -Return Value: - - HRESULT - S_OK - On success - E_NOTIMPL - Command not implemented - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultCheck::OnCommand( - _In_ CONST HWND hDlg, - _In_ INT iCommand - ) -{ - HRESULT hr = S_OK; - - switch (iCommand) - { - case BN_CLICKED: - { - hr = OnBnClicked(hDlg); - } - break; - - default: - hr = E_NOTIMPL; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultCheck::OnBnClicked - -Routine Description: - - This rountine handles the event of a button press. The state of the check box control is read which - can be either checked and unchecked, the result is communicated through the Unidrv helper functions - informing the Unidrv core that a change has occured. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultCheck::OnBnClicked( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - ASSERTMSG(m_pUIProperties != NULL, "NULL pointer to UI properties interface.\n"); - ASSERTMSG(m_pOemCUIPParam != NULL, "NULL pointer to OEMCUIPPARAM structure.\n"); - ASSERTMSG(m_pOemCUIPParam->poemuiobj != NULL, "NULL pointer to OEMCUIPPARAM->poemuiobj structure.\n"); - ASSERTMSG(m_pDriverUIHelp != NULL, "NULL pointer to driver UI help interface.\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pOemCUIPParam, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pOemCUIPParam->poemuiobj, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pDriverUIHelp, E_PENDING))) - { - // - // Retrieve the controls current selection - // and convert from checkbox state to a selection - // - UINT uChecked = IsDlgButtonChecked(hDlg, m_iCheckResID); - - LONG lSel = (uChecked == BST_UNCHECKED) ? 0 : 1; - - // - // Check against the optitem - // - POPTITEM pOptItem = NULL; - - if (SUCCEEDED(hr = m_pUIProperties->GetOptItem(m_pOemCUIPParam, m_szGPDString, &pOptItem)) && - SUCCEEDED(hr = CHECK_POINTER(pOptItem, E_FAIL))) - { - if (pOptItem->Sel != lSel) - { - PropSheet_Changed(GetParent(hDlg), hDlg); - - pOptItem->Sel = lSel; - pOptItem->Flags |= OPTIF_CHANGED; - - if (SUCCEEDED(hr = m_pDriverUIHelp->DrvUpdateUISetting(m_pOemCUIPParam->poemuiobj, pOptItem, 0, OEMCUIP_DOCPROP))) - { - hr = EnableDependentCtrls(hDlg, lSel); - } - } - else - { - PropSheet_UnChanged(GetParent(hDlg), hDlg); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultCheck::EnableDependentCtrls - -Routine Description: - - This is a default implementation simply returns S_OK - -Arguments: - - None referenced. - -Return Value: - - HRESULT - S_OK - Success - ---*/ -HRESULT -CUICtrlDefaultCheck::EnableDependentCtrls( - _In_ CONST HWND, - _In_ CONST LONG - ) -{ - return S_OK; -} - - -// -// List box control -// -/*++ - -Routine Name: - - CUICtrlDefaultList::CUICtrlDefaultList - -Routine Description: - - CUICtrlDefaultList class construtor - -Arguments: - - gpdString - Property name of the data associated with this control. - iListResID - Resource id for the List Box control. - -Return Value: - - None - ---*/ -CUICtrlDefaultList::CUICtrlDefaultList( - _In_ PCSTR gpdString, - _In_ CONST INT iListResID - ) : - m_szGPDString(gpdString), - m_iListResID(iListResID) -{ -} - -/*++ - -Routine Name: - - CUICtrlDefaultList::~CUICtrlDefaultList - -Routine Description: - - CUICtrlDefaultList class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlDefaultList::~CUICtrlDefaultList() -{ -} - -/*++ - -Routine Name: - - CUICtrlDefaultList::AddString - -Routine Description: - - Loads a string from the specified resource and adds it to the end of the list box. - -Arguments: - - hDlg - handle to the parent window - hStringResDLL - handle of the resource DLL that contains the string table. - idString - identifer of the string resource to be added - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultList::AddString( - _In_ CONST HWND hDlg, - _In_ CONST HINSTANCE hStringResDLL, - _In_ CONST INT idString - ) -{ - HRESULT hr = S_OK; - - TCHAR szItem[MAX_UISTRING_LEN]; - if (LoadString(hStringResDLL, idString, szItem, countof(szItem)) > 0) - { - LRESULT lResult = SendDlgItemMessage(hDlg, m_iListResID, LB_ADDSTRING, 0, reinterpret_cast(szItem)); - - if (lResult == LB_ERRSPACE || - lResult == LB_ERR) - { - hr = E_FAIL; - } - } - else - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultList::OnActivate - -Routine Description: - - Called when the parent property page becomes active. - This method initialises the state of the control to reflect the Unidrv GPD settings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultList::OnActivate( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - POPTITEM pOptItem = NULL; - - ASSERTMSG(m_pOemCUIPParam != NULL, "NULL pointer to OEMCUIPPARAM structure.\n"); - ASSERTMSG(m_pUIProperties != NULL, "NULL pointer to UI properties interface.\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pOemCUIPParam, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_PENDING)) && - SUCCEEDED(hr = m_pUIProperties->GetOptItem(m_pOemCUIPParam, m_szGPDString, &pOptItem)) && - SUCCEEDED(hr = CHECK_POINTER(pOptItem, E_FAIL))) - { - LONG lSel = pOptItem->Sel; - if (SendDlgItemMessage(hDlg, m_iListResID, LB_SETCURSEL, lSel, 0) != LB_ERR) - { - hr = EnableDependentCtrls(hDlg, lSel); - } - else - { - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultList::OnCommand - -Routine Description: - - Called from the property page handler when a WM_COMMAND message is recieved. - Filters out any list box selection change (LBN_SELCHANGE) messages intended for this control. - -Arguments: - - hDlg - handle to the parent window - iCommand - specifies the notification code - -Return Value: - - HRESULT - S_OK - On success - E_NOTIMPL - Command not implemented - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultList::OnCommand( - _In_ CONST HWND hDlg, - _In_ INT iCommand - ) -{ - HRESULT hr = S_OK; - - switch (iCommand) - { - case LBN_SELCHANGE: - { - hr = OnSelChange(hDlg); - } - break; - - default: - hr = E_NOTIMPL; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultList::OnSelChange - -Routine Description: - - This rountine handles the event of a change of selection in the list box. The selection of the - list box control is read and the result is communicated through the Unidrv helper functions - informing the Unidrv core that a change has occured. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultList::OnSelChange( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - ASSERTMSG(m_pUIProperties != NULL, "NULL pointer to UI properties interface.\n"); - ASSERTMSG(m_pOemCUIPParam != NULL, "NULL pointer to OEMCUIPPARAM structure.\n"); - ASSERTMSG(m_pOemCUIPParam->poemuiobj != NULL, "NULL pointer to OEMCUIPPARAM->poemuiobj structure.\n"); - ASSERTMSG(m_pDriverUIHelp != NULL, "NULL pointer to driver UI help interface.\n"); - - - if (SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pOemCUIPParam, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pOemCUIPParam->poemuiobj, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pDriverUIHelp, E_PENDING))) - { - // - // Retrieve the controls current selection - // - LONG lSel = static_cast(SendDlgItemMessage(hDlg, m_iListResID, LB_GETCURSEL, 0, 0)); - - if (lSel != LB_ERR) - { - // - // Check against the optitem - // - POPTITEM pOptItem = NULL; - - if (SUCCEEDED(hr = m_pUIProperties->GetOptItem(m_pOemCUIPParam, m_szGPDString, &pOptItem)) && - SUCCEEDED(hr = CHECK_POINTER(pOptItem, E_FAIL))) - { - if (pOptItem->Sel != lSel) - { - PropSheet_Changed(GetParent(hDlg), hDlg); - - pOptItem->Sel = lSel; - pOptItem->Flags |= OPTIF_CHANGED; - - if (SUCCEEDED(hr = m_pDriverUIHelp->DrvUpdateUISetting(m_pOemCUIPParam->poemuiobj, pOptItem, 0, OEMCUIP_DOCPROP))) - { - hr = EnableDependentCtrls(hDlg, lSel); - } - } - else - { - PropSheet_UnChanged(GetParent(hDlg), hDlg); - } - } - } - else - { - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultList::EnableDependentCtrls - -Routine Description: - - This is a default implementation that returns S_OK. - Called when a selection is changed in the list box to show/enable any dependent controls. - -Arguments: - - None referenced. - -Return Value: - - HRESULT - S_OK - Success - ---*/ -HRESULT -CUICtrlDefaultList::EnableDependentCtrls( - _In_ CONST HWND, - _In_ CONST LONG - ) -{ - return S_OK; -} - -// -// Combo box control -// -/*++ - -Routine Name: - - CUICtrlDefaultCombo::CUICtrlDefaultCombo - -Routine Description: - - CUICtrlDefaultCombo class constructor. - -Arguments: - - gpdString - Property name of the data associated with this control. - iComboResID - Resource id for the Combo Box control. - -Return Value: - - None - ---*/ -CUICtrlDefaultCombo::CUICtrlDefaultCombo( - _In_ PCSTR gpdString, - _In_ CONST INT iComboResID - ) : - m_szGPDString(gpdString), - m_iComboResID(iComboResID) -{ -} - -/*++ - -Routine Name: - - CUICtrlDefaultCombo::~CUICtrlDefaultCombo - -Routine Description: - - CUICtrlDefaultCombo class destructor. - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlDefaultCombo::~CUICtrlDefaultCombo() -{ -} - -/*++ - -Routine Name: - - CUICtrlDefaultCombo::OnActivate - -Routine Description: - - Called when the parent property page becomes active. - This method initialises the state of the control to reflect the Unidrv GPD settings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultCombo::OnActivate( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - POPTITEM pOptItem = NULL; - - ASSERTMSG(m_pOemCUIPParam != NULL, "NULL pointer to OEMCUIPPARAM structure.\n"); - ASSERTMSG(m_pUIProperties != NULL, "NULL pointer to UI properties interface.\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pOemCUIPParam, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_PENDING)) && - SUCCEEDED(hr = m_pUIProperties->GetOptItem(m_pOemCUIPParam, m_szGPDString, &pOptItem)) && - SUCCEEDED(hr = CHECK_POINTER(pOptItem, E_FAIL))) - { - LONG lSel = pOptItem->Sel; - - LRESULT lResult = SendDlgItemMessage(hDlg, m_iComboResID, CB_SETCURSEL, lSel, 0); - - if (lResult != CB_ERR && - lResult != CB_ERRSPACE) - { - hr = EnableDependentCtrls(hDlg, lSel); - } - else - { - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultCombo::OnCommand - -Routine Description: - - Called from the property page handler when a WM_COMMAND message is recieved. - Filters out any Combo Box selection change (CBN_SELCHANGE) messages intended for this control. - -Arguments: - - hDlg - handle to the parent window - iCommand - specifies the notification code - -Return Value: - - HRESULT - S_OK - On success - E_NOTIMPL - Command not implemented - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultCombo::OnCommand( - _In_ CONST HWND hDlg, - _In_ INT iCommand - ) -{ - HRESULT hr = S_OK; - - switch (iCommand) - { - case CBN_SELCHANGE: - { - hr = OnSelChange(hDlg); - } - break; - - default: - { - hr = E_NOTIMPL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultCombo::OnSelChange - -Routine Description: - - This rountine handles the event of a change of selection in the combo box. The selection of the - combo box control is read and the result is communicated through the Unidrv helper functions - informing the Unidrv core that a change has occured. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultCombo::OnSelChange( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - ASSERTMSG(m_pUIProperties != NULL, "NULL pointer to UI properties interface.\n"); - ASSERTMSG(m_pOemCUIPParam != NULL, "NULL pointer to OEMCUIPPARAM structure.\n"); - ASSERTMSG(m_pOemCUIPParam->poemuiobj != NULL, "NULL pointer to OEMCUIPPARAM->poemuiobj structure.\n"); - ASSERTMSG(m_pDriverUIHelp != NULL, "NULL pointer to driver UI help interface.\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pOemCUIPParam, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pOemCUIPParam->poemuiobj, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pDriverUIHelp, E_PENDING))) - { - // - // Retrieve the controls current selection - // - - LONG lSel = static_cast(SendDlgItemMessage(hDlg, m_iComboResID, CB_GETCURSEL, 0, 0)); - - if (lSel == CB_ERR) - { - hr = E_FAIL; - } - - POPTITEM pOptItem = NULL; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = m_pUIProperties->GetOptItem(m_pOemCUIPParam, m_szGPDString, &pOptItem)) && - SUCCEEDED(hr = CHECK_POINTER(pOptItem, E_FAIL))) - { - if (pOptItem->Sel != lSel) - { - PropSheet_Changed(GetParent(hDlg), hDlg); - - pOptItem->Sel = lSel; - pOptItem->Flags |= OPTIF_CHANGED; - - if (SUCCEEDED(hr = m_pDriverUIHelp->DrvUpdateUISetting(m_pOemCUIPParam->poemuiobj, pOptItem, 0, OEMCUIP_DOCPROP))) - { - hr = EnableDependentCtrls(hDlg, lSel); - } - } - else - { - PropSheet_UnChanged(GetParent(hDlg), hDlg); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultCombo::EnableDependentCtrls - -Routine Description: - - This is a default implementation that returns S_OK. - Called when a selection is changed in the combo box to show/enable any dependent controls. - -Arguments: - - None referenced - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultCombo::EnableDependentCtrls( - _In_ CONST HWND, - _In_ CONST LONG - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CUICtrlDefaultCombo::AddString - -Routine Description: - - Loads a string from the specified resource and adds it to the end of the Combo Box. - -Arguments: - - hDlg - handle to the parent window - hStringResDLL - handle of the resource DLL that contains the string table. - idString - identifer of the string resource to be added - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultCombo::AddString( - _In_ CONST HWND hDlg, - _In_ CONST HINSTANCE hStringResDLL, - _In_ CONST INT idString - ) -{ - HRESULT hr = S_OK; - - TCHAR szItem[MAX_UISTRING_LEN]; - if (LoadString(hStringResDLL, idString, szItem, countof(szItem)) > 0) - { - LRESULT lResult = SendDlgItemMessage(hDlg, m_iComboResID, CB_ADDSTRING, 0, reinterpret_cast(szItem)); - - if (lResult == CB_ERRSPACE || - lResult == CB_ERR) - { - hr = E_FAIL; - } - } - else - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - - ERR_ON_HR(hr); - return hr; -} - -// -// EditNum control -// -/*++ - -Routine Name: - - CUICtrlDefaultEditNum::CUICtrlDefaultEditNum - -Routine Description: - - CUICtrlDefaultEditNum class constructor - -Arguments: - - gpdString - Property name of the data associated with this control. - iEditResID - Resource id for the Combo Box control. - iPropMin - Minimum integer value that is valid. - iPropMax - Maximum integer value that is valid. - iSpinResID - Resource id for the associated Up/Down spinner control. - -Return Value: - - None - ---*/ -CUICtrlDefaultEditNum::CUICtrlDefaultEditNum( - _In_ PCSTR propString, - _In_ CONST INT iEditResID, - _In_ CONST INT iPropMin, - _In_ CONST INT iPropMax, - _In_ CONST INT iSpinResID - ) : - m_szPropString(propString), - m_iEditResID(iEditResID), - m_iPropMin(iPropMin), - m_iPropMax(iPropMax), - m_iSpinResID(iSpinResID) - -{ -} - -/*++ - -Routine Name: - - CUICtrlDefaultEditNum::~CUICtrlDefaultEditNum - -Routine Description: - - CUICtrlDefaultEditNum class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlDefaultEditNum::~CUICtrlDefaultEditNum() -{ -} - -/*++ - -Routine Name: - - CUICtrlDefaultEditNum::OnActivate - -Routine Description: - - Called when the parent property page becomes active. - This method initialises the state of the control to reflect the OEM private devmode. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultEditNum::OnActivate( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - ASSERTMSG(m_pUIProperties != NULL, "NULL pointer to UI properties interface.\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_PENDING))) - { - INT iPos = 0; - TCHAR szItem[MAX_UISTRING_LEN]; - - if (SUCCEEDED(hr = m_pUIProperties->GetItem(m_szPropString, reinterpret_cast(&iPos), sizeof(iPos))) && - SUCCEEDED(hr = StringCchPrintf(szItem, MAX_UISTRING_LEN, TEXT("%d"), iPos))) - { - if (SetDlgItemText(hDlg, m_iEditResID, reinterpret_cast(szItem)) == 0) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultEditNum::OnCommand - -Routine Description: - - Called from the property page handler when a WM_COMMAND message is recieved. - Filters out any Edit Text change (EN_CHANGE) messages intended for this control. - -Arguments: - - hDlg - handle to the parent window - iCommand - specifies the notification code - -Return Value: - - HRESULT - S_OK - On success - E_NOTIMPL - Command not implemented - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultEditNum::OnCommand( - _In_ CONST HWND hDlg, - _In_ INT iCommand - ) -{ - HRESULT hr = S_OK; - - switch (iCommand) - { - case EN_CHANGE: - { - hr = OnEnChange(hDlg); - } - break; - - default: - hr = E_NOTIMPL; - - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultEditNum::CheckInRange - -Routine Description: - - Ensures that a value is within range of the controls min/max extents. - -Arguments: - - pValue - pointer to the integer value to check. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultEditNum::CheckInRange( - _In_ PINT pValue - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pValue, E_POINTER))) - { - if (*pValue > m_iPropMax) - { - *pValue = m_iPropMax; - } - - if (*pValue < m_iPropMin) - { - *pValue = m_iPropMin; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultEditNum::OnEnChange - -Routine Description: - - This rountine handles the event of a change in the text box. The text in the control is read then - validated and the result is stored in the OEM private devmode. In addition the buddy spinner - control is updated to reflect the change in value. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultEditNum::OnEnChange( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - ASSERTMSG(m_pUIProperties != NULL, "NULL pointer to UI properties interface.\n"); - - BOOL bTranslated; - - INT iPos = static_cast(GetDlgItemInt(hDlg, m_iEditResID, &bTranslated, TRUE)); - - if (bTranslated) - { - INT iOrgPos = 0; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_PENDING)) && - SUCCEEDED(hr = m_pUIProperties->GetItem(m_szPropString, reinterpret_cast(&iOrgPos), sizeof(iOrgPos))) && - SUCCEEDED(hr = CheckInRange(&iPos)) && - iOrgPos != iPos) - { - SendDlgItemMessage(hDlg, m_iSpinResID, UDM_SETPOS32, 0, static_cast(iPos)); - - if (SUCCEEDED(hr = m_pUIProperties->SetItem(m_szPropString, reinterpret_cast(&iPos), sizeof(iPos)))) - { - PropSheet_Changed(GetParent(hDlg), hDlg); - } - } - } - else - { - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - -// -// Edit control -// -/*++ - -Routine Name: - - CUICtrlDefaultSpin::CUICtrlDefaultSpin - -Routine Description: - - CUICtrlDefaultSpin class constructor. - - Requires a Text Box buddy control class. - Settings for this Spin control are taken from the buddy class. - -Arguments: - - pEdit - Pointer to the buddy Text Box control. - -Return Value: - - None - ---*/ -CUICtrlDefaultSpin::CUICtrlDefaultSpin( - _In_ CUICtrlDefaultEditNum * pEdit - ): - m_szPropString(0), - m_iSpinResID(0), - m_iPropMin(0), - m_iPropMax(0), - m_iEditResID(0) -{ - if (pEdit !=NULL) - { - m_szPropString = pEdit->m_szPropString; - m_iSpinResID = pEdit->m_iSpinResID; - m_iPropMin = pEdit->m_iPropMin; - m_iPropMax = pEdit->m_iPropMax; - m_iEditResID = pEdit->m_iEditResID; - } -} - -/*++ - -Routine Name: - - CUICtrlDefaultSpin::~CUICtrlDefaultSpin - -Routine Description: - - CUICtrlDefaultSpin class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlDefaultSpin::~CUICtrlDefaultSpin() -{ -} - -/*++ - -Routine Name: - - CUICtrlDefaultSpin::OnActivate - -Routine Description: - - Called when the parent property page becomes active. - This method initialises the state of the control to reflect the OEM private devmode. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultSpin::OnActivate( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - INT iPos = 0; - - ASSERTMSG(m_pUIProperties != NULL, "NULL pointer to UI properties interface.\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_PENDING)) && - SUCCEEDED(hr = m_pUIProperties->GetItem(m_szPropString, reinterpret_cast(&iPos), sizeof(iPos)))) - { - SendDlgItemMessage(hDlg, m_iSpinResID, UDM_SETRANGE32, m_iPropMin, m_iPropMax); - SendDlgItemMessage(hDlg, m_iSpinResID, UDM_SETPOS32, 0, iPos); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultSpin::OnNotify - -Routine Description: - - Called from the property page handler when a WM_NOTIFY message is recieved. - Filters out any Up/Down position (UDN_DELTAPOS) messages intended for this control. - -Arguments: - - hDlg - handle to the parent window - pNmhdr - pointer to the notification message - -Return Value: - - HRESULT - S_OK - On success - E_NOTIMPL - Command not implemented - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultSpin::OnNotify( - _In_ CONST HWND hDlg, - _In_ CONST NMHDR* pNmhdr - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pNmhdr, E_POINTER))) - { - switch (pNmhdr->code) - { - case UDN_DELTAPOS: - { - hr = OnDeltaPos(hDlg, reinterpret_cast(pNmhdr)); - } - break; - - default: - hr = E_NOTIMPL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultSpin::CheckInRange - -Routine Description: - - Ensures that a value is within range of the controls min/max extents. - -Arguments: - - pValue - Pointer to the integer value to check. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultSpin::CheckInRange( - _In_ PINT pValue - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pValue, E_POINTER))) - { - if (*pValue > m_iPropMax) - { - *pValue = m_iPropMax; - } - - if (*pValue < m_iPropMin) - { - *pValue = m_iPropMin; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultSpin::OnDeltaPos - -Routine Description: - - This rountine handles the event of a change in value of the Up/Down control. The new value - of the control is validated and stored in the OEM private devmode. In addition the buddy text - box control is updated to reflect the change. - -Arguments: - - hDlg - handle to the parent window - pNmud - this structure contains information specific to up-down control messages - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultSpin::OnDeltaPos( - _In_ CONST HWND hDlg, - _In_ CONST NMUPDOWN* pNmud - ) -{ - HRESULT hr = S_OK; - INT iOrgPos = 0; - INT iPos = 0; - - ASSERTMSG(m_pUIProperties != NULL, "NULL pointer to UI properties interface.\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(pNmud, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_PENDING)) && - SUCCEEDED(hr = m_pUIProperties->GetItem(m_szPropString, reinterpret_cast(&iOrgPos), sizeof(iOrgPos)))) - { - iPos = iOrgPos + pNmud->iDelta; - TCHAR szItem[MAX_UISTRING_LEN]; - - if (SUCCEEDED(hr = CheckInRange(&iPos)) && - iOrgPos != iPos && - SUCCEEDED(hr = StringCchPrintf(szItem, MAX_UISTRING_LEN, TEXT("%d"), iPos))) - { - if (SetDlgItemText(hDlg, m_iEditResID, reinterpret_cast(szItem)) > 0) - { - if (SUCCEEDED(hr = m_pUIProperties->SetItem(m_szPropString, reinterpret_cast(&iPos), sizeof(iPos)))) - { - PropSheet_Changed(GetParent(hDlg), hDlg); - } - } - else - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -// -// EditText control -// -/*++ - -Routine Name: - - CUICtrlDefaultEditText::CUICtrlDefaultEditText - -Routine Description: - - CUICtrlDefaultEditText class constructor - -Arguments: - - gpdString - Property name of the data associated with this control. - iEditResID - Resource id for the Combo Box control. - cbMaxLength - Maximum number of characters allowed. - -Return Value: - - None - ---*/ -CUICtrlDefaultEditText::CUICtrlDefaultEditText( - _In_ PCSTR propString, - _In_ CONST INT iEditResID, - _In_ CONST INT cbMaxLength - ) : - m_szPropString(propString), - m_iEditResID(iEditResID), - m_cbMaxLength(cbMaxLength) - -{ -} - -/*++ - -Routine Name: - - CUICtrlDefaultEditText::~CUICtrlDefaultEditText - -Routine Description: - - CUICtrlDefaultEditText class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlDefaultEditText::~CUICtrlDefaultEditText() -{ -} - -/*++ - -Routine Name: - - CUICtrlDefaultEditText::OnActivate - -Routine Description: - - Called when the parent property page becomes active. - This method initialises the state of the control to reflect the OEM private devmode. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultEditText::OnActivate( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - ASSERTMSG(m_pUIProperties != NULL, "NULL pointer to UI properties interface.\n"); - - if (SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_PENDING))) - { - SIZE_T cbBuffer = sizeof(TCHAR) * m_cbMaxLength; - LPTSTR lpBuffer = new(std::nothrow) TCHAR[m_cbMaxLength]; - - if (SUCCEEDED(hr = CHECK_POINTER(lpBuffer, E_OUTOFMEMORY))) - { - if (SUCCEEDED(hr = m_pUIProperties->GetItem(m_szPropString, reinterpret_cast(lpBuffer), cbBuffer)) && - SUCCEEDED(hr = CHECK_POINTER(lpBuffer, E_FAIL))) - { - if (SetDlgItemText(hDlg, m_iEditResID, reinterpret_cast(lpBuffer)) == 0) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - } - - delete[] lpBuffer; - lpBuffer = NULL; - } - } - - if (SUCCEEDED(hr)) - { - SendDlgItemMessage(hDlg, m_iEditResID, EM_LIMITTEXT, m_cbMaxLength - 1, 0L); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultEditText::OnCommand - -Routine Description: - - Called from the property page handler when a WM_COMMAND message is recieved. - Filters out any Edit Text change (EN_CHANGE) messages intended for this control. - -Arguments: - - hDlg - handle to the parent window - iCommand - specifies the notification code - -Return Value: - - HRESULT - S_OK - On success - E_NOTIMPL - Command not implemented - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultEditText::OnCommand( - _In_ CONST HWND hDlg, - _In_ INT iCommand - ) -{ - HRESULT hr = S_OK; - - switch (iCommand) - { - case EN_CHANGE: - { - hr = OnEnChange(hDlg); - } - break; - - default: - hr = E_NOTIMPL; - - } - - ERR_ON_HR(hr); - return hr; -} - - -/*++ - -Routine Name: - - CUICtrlDefaultEditNum::OnEnChange - -Routine Description: - - This rountine handles the event of a change in the text box. - The text in the control is read and the result is stored in the OEM private devmode. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultEditText::OnEnChange( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - ASSERTMSG(m_pUIProperties != NULL, "NULL pointer to UI properties interface.\n"); - - SIZE_T cbBuffer = sizeof(TCHAR) * m_cbMaxLength; - LPTSTR lpBuffer = new(std::nothrow) TCHAR[m_cbMaxLength]; - - if (SUCCEEDED(hr = CHECK_POINTER(lpBuffer, E_OUTOFMEMORY))) - { - if (GetDlgItemText(hDlg, m_iEditResID, lpBuffer, m_cbMaxLength) == 0) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - else - { - LPTSTR lpOrgBuffer = new(std::nothrow) TCHAR[m_cbMaxLength]; - - if (SUCCEEDED(hr = CHECK_POINTER(lpOrgBuffer, E_OUTOFMEMORY))) - { - if (SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_PENDING)) && - SUCCEEDED(hr = m_pUIProperties->GetItem(m_szPropString, reinterpret_cast(lpOrgBuffer), cbBuffer)) && - SUCCEEDED(hr = CHECK_POINTER(lpOrgBuffer, E_FAIL)) && - wcsncmp(lpBuffer, lpOrgBuffer, m_cbMaxLength) != 0 && - SUCCEEDED(hr = m_pUIProperties->SetItem(m_szPropString, reinterpret_cast(lpBuffer), cbBuffer))) - { - PropSheet_Changed(GetParent(hDlg), hDlg); - } - - delete[] lpOrgBuffer; - lpOrgBuffer = NULL; - } - } - - delete[] lpBuffer; - lpBuffer = NULL; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlDefaultBtn::CUICtrlDefaultBtn - -Routine Description: - - CUICtrlDefaultBtn class constructor. - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlDefaultBtn::CUICtrlDefaultBtn( - _In_ PCSTR propertyString, - _In_ INT iBtnResID - ) : - m_szPropertyString(propertyString), - m_iBtnResID(iBtnResID) -{ -} - -/*++ - -Routine Name: - - CUICtrlDefaultBtn::CUICtrlDefaultBtn - -Routine Description: - - CUICtrlDefaultBtn class constructor. - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlDefaultBtn::~CUICtrlDefaultBtn() -{ -} - -/*++ - -Routine Name: - - CUICtrlDefaultBtn::CUICtrlDefaultBtn - -Routine Description: - - Default button OnActivate handler. - -Arguments: - - None - -Return Value: - - S_OK - ---*/ -HRESULT -CUICtrlDefaultBtn::OnActivate( - _In_ CONST HWND - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CUICtrlDefaultBtn::OnCommand - -Routine Description: - - Default button OnCommand handler. - -Arguments: - - hDlg - handle to the parent window - iCommand - specifies the notification code - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlDefaultBtn::OnCommand( - _In_ CONST HWND hDlg, - _In_ INT iCommand - ) -{ - HRESULT hr = S_OK; - - switch (iCommand) - { - case BN_CLICKED: - { - hr = OnBnClicked(hDlg); - } - break; - - default: - hr = E_NOTIMPL; - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/ui/uictrl.h b/print/XPSDrvSmpl/src/ui/uictrl.h deleted file mode 100644 index 5292e78b..00000000 --- a/print/XPSDrvSmpl/src/ui/uictrl.h +++ /dev/null @@ -1,405 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - uictrl.h - -Abstract: - - Definition of the UI control interface called by the containing property page, - the abstract UI control class and the base default UI controls for check boxe, - list, combo, edit and spin controls. - ---*/ - -#pragma once - -#include "UIProperties.h" - -class CUIControl -{ -public: - CUIControl(); - - virtual ~CUIControl(); - - virtual HRESULT - SetPrintOemDriverUI( - _In_ CONST IPrintOemDriverUI* pOEMDriverUI - ); - - virtual HRESULT - SetOemCUIPParam( - _In_ CONST POEMCUIPPARAM pOemCUIPParam - ); - - virtual HRESULT - SetUIProperties( - _In_ CUIProperties* pUIProperties - ); - - // - // Message handling stubs - // - virtual HRESULT - OnActivate( - _In_ CONST HWND hDlg - ) = 0; - - virtual HRESULT - OnInit( - _In_ CONST HWND hDlg - ); - - virtual HRESULT - OnCommand( - _In_ CONST HWND hDlg, - _In_ INT iCommand - ); - - virtual HRESULT - OnNotify( - _In_ CONST HWND hDlg, - _In_ CONST NMHDR* pNmhdr - ); - -protected: - CComPtr m_pDriverUIHelp; - - POEMCUIPPARAM m_pOemCUIPParam; - - CUIProperties * m_pUIProperties; -}; - -class CUICtrlDefaultCheck : public CUIControl -{ -public: - CUICtrlDefaultCheck( - _In_ PCSTR gpdString, - _In_ INT iCheckResID - ); - - virtual ~CUICtrlDefaultCheck(); - - HRESULT - OnActivate( - _In_ CONST HWND hDlg - ); - - HRESULT - OnCommand( - _In_ CONST HWND hDlg, - _In_ INT iCommand - ); - -private: - virtual HRESULT - OnBnClicked( - _In_ CONST HWND hDlg - ); - - virtual HRESULT - EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ); - - CUICtrlDefaultCheck& operator = (CONST CUICtrlDefaultCheck&); - -private: - PCSTR m_szGPDString; - - CONST INT m_iCheckResID; -}; - -class CUICtrlDefaultList : public CUIControl -{ -public: - CUICtrlDefaultList( - _In_ PCSTR gpdString, - _In_ INT iListResID - ); - - virtual ~CUICtrlDefaultList(); - - HRESULT - OnActivate( - _In_ CONST HWND hDlg - ); - - HRESULT - OnCommand( - _In_ CONST HWND hDlg, - _In_ INT iCommand - ); - -protected: - HRESULT - AddString( - _In_ CONST HWND hDlg, - _In_ CONST HINSTANCE hStringResDLL, - _In_ CONST INT idString - ); - -private: - virtual HRESULT - EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ); - - virtual HRESULT - OnSelChange( - _In_ CONST HWND hDlg - ); - - CUICtrlDefaultList& operator = (CONST CUICtrlDefaultList&); - -private: - PCSTR m_szGPDString; - - CONST INT m_iListResID; -}; - -class CUICtrlDefaultCombo : public CUIControl -{ -public: - CUICtrlDefaultCombo( - _In_ PCSTR gpdString, - _In_ INT iComboResID - ); - - virtual ~CUICtrlDefaultCombo(); - - HRESULT - OnActivate( - _In_ CONST HWND hDlg - ); - - HRESULT - OnCommand( - _In_ CONST HWND hDlg, - _In_ INT iCommand - ); - - virtual HRESULT - OnSelChange( - _In_ CONST HWND hDlg - ); - -protected: - HRESULT - AddString( - _In_ CONST HWND hDlg, - _In_ CONST HINSTANCE hStringResDLL, - _In_ CONST INT idString - ); - -private: - virtual HRESULT - EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ); - - CUICtrlDefaultCombo& operator = (CONST CUICtrlDefaultCombo&); - -private: - PCSTR m_szGPDString; - - CONST INT m_iComboResID; -}; - -class CUICtrlDefaultSpin; - -class CUICtrlDefaultEditNum : public CUIControl -{ -public: - CUICtrlDefaultEditNum( - _In_ PCSTR propString, - _In_ CONST INT iEditResID, - _In_ CONST INT iPropMin, - _In_ CONST INT iPropMax, - _In_ CONST INT iSpinResID - ); - - virtual ~CUICtrlDefaultEditNum(); - - friend class CUICtrlDefaultSpin; - - HRESULT - virtual OnActivate( - _In_ CONST HWND hDlg - ); - - virtual HRESULT - OnCommand( - _In_ CONST HWND hDlg, - _In_ INT iCommand - ); - -private: - CUICtrlDefaultEditNum() : - m_iEditResID(0), - m_iPropMin(0), - m_iPropMax(0), - m_iSpinResID(0) - {} - - virtual HRESULT - CheckInRange( - _In_ PINT pValue - ); - - virtual HRESULT - OnEnChange( - _In_ CONST HWND hDlg - ); - - CUICtrlDefaultEditNum& operator = (CONST CUICtrlDefaultEditNum&); - - -private: - PCSTR m_szPropString; - - CONST INT m_iPropMin; - - CONST INT m_iPropMax; - - CONST INT m_iEditResID; - - CONST INT m_iSpinResID; -}; - -class CUICtrlDefaultSpin : public CUIControl -{ - -public: - CUICtrlDefaultSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ); - - virtual ~CUICtrlDefaultSpin(); - - virtual HRESULT - OnActivate( - _In_ CONST HWND hDlg - ); - - virtual HRESULT - OnNotify( - _In_ CONST HWND hDlg, - _In_ CONST NMHDR* pNmhdr - ); - - -private: - virtual HRESULT - CheckInRange( - _In_ PINT pValue - ); - - virtual HRESULT - OnDeltaPos( - _In_ CONST HWND hDlg, - _In_ CONST NMUPDOWN* pNmud - ); - - CUICtrlDefaultSpin& operator = (CONST CUICtrlDefaultSpin&); - -private: - PCSTR m_szPropString; - - INT m_iPropMin; - - INT m_iPropMax; - - INT m_iSpinResID; - - INT m_iEditResID; -}; - -class CUICtrlDefaultEditText : public CUIControl -{ -public: - CUICtrlDefaultEditText( - _In_ PCSTR propString, - _In_ CONST INT iEditResID, - _In_ CONST INT cbMaxLength - ); - - virtual ~CUICtrlDefaultEditText(); - - HRESULT - virtual OnActivate( - _In_ CONST HWND hDlg - ); - - virtual HRESULT - OnCommand( - _In_ CONST HWND hDlg, - _In_ INT iCommand - ); - -private: - virtual HRESULT - OnEnChange( - _In_ CONST HWND hDlg - ); - - CUICtrlDefaultEditText& operator = (CONST CUICtrlDefaultEditText&); - - -private: - PCSTR m_szPropString; - - CONST INT m_cbMaxLength; - - CONST INT m_iEditResID; -}; - -class CUICtrlDefaultBtn : public CUIControl -{ -public: - CUICtrlDefaultBtn( - _In_ PCSTR propertyString, - _In_ INT iCheckResID - ); - - virtual ~CUICtrlDefaultBtn(); - - HRESULT - OnActivate( - _In_ CONST HWND hDlg - ); - - HRESULT - OnCommand( - _In_ CONST HWND hDlg, - _In_ INT iCommand - ); - -private: - virtual HRESULT - OnBnClicked( - _In_ CONST HWND hDlg - ) = 0; - - CUICtrlDefaultBtn& operator = (CONST CUICtrlDefaultCheck&); - -protected: - PCSTR m_szPropertyString; - -private: - CONST INT m_iBtnResID; -}; - diff --git a/print/XPSDrvSmpl/src/ui/uiproperties.cpp b/print/XPSDrvSmpl/src/ui/uiproperties.cpp deleted file mode 100644 index c6ceb4e7..00000000 --- a/print/XPSDrvSmpl/src/ui/uiproperties.cpp +++ /dev/null @@ -1,783 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - uiproperties.cpp - -Abstract: - - This class encapsulates all handling of GPD and OEM private devmode settings - used in the XPSDrv feature sample UI. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "xdexcept.h" -#include "uiproperties.h" -#include "privatedefs.h" - -PCSTR g_pszPSScaleWidth = "PageScalingScaleWidth"; -PCSTR g_pszPSScaleHeight = "PageScalingScaleHeight"; -PCSTR g_pszOffsetWidth = "PageScalingOffsetWidth"; -PCSTR g_pszOffsetHeight = "PageScalingOffsetHeight"; -PCSTR g_pszWMTransparency = "PageWatermarkTransparency"; -PCSTR g_pszWMAngle = "PageWatermarkTextAngle"; -PCSTR g_pszWMOffsetWidth = "PageWatermarkOriginWidth"; -PCSTR g_pszWMOffsetHeight = "PageWatermarkOriginHeight"; -PCSTR g_pszWMSizeWidth = "PageWatermarkSizeWidth"; -PCSTR g_pszWMSizeHeight = "PageWatermarkSizeHeight"; -PCSTR g_pszWMFontSize = "PageWatermarkTextFontSize"; -PCSTR g_pszWMFontColor = "PageWatermarkTextColor"; -PCSTR g_pszWMText = "PageWatermarkTextText"; - -/*++ - -Routine Name: - - CUIProperties::CUIProperties - -Routine Description: - - CUIProperties default class constructor. - -Arguments: - - None. - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CUIProperties::CUIProperties(): - m_pOEMDev(NULL) -{ - HRESULT hr = InitialiseMap(); - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CUIProperties::CUIProperties - -Routine Description: - - CUIProperties class constructor. - -Arguments: - - pOEMDM - Pointer to an OEMDEV structure. - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CUIProperties::CUIProperties( - POEMDEV pOEMDM): - m_pOEMDev(pOEMDM) -{ - HRESULT hr = InitialiseMap(); - - if (FAILED(hr)) - { - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CUIProperties::~CUIProperties - -Routine Description: - - CUIProperties class destructor. - -Arguments: - - None - -Return Value: - - None - ---*/ -CUIProperties::~CUIProperties() -{ -} - -/*++ - -Routine Name: - - CUIProperties::InitialiseMap - -Routine Description: - - Creates a map of GPD names and private OEM devmode properties that will be used by the driver. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUIProperties::InitialiseMap( - VOID - ) -{ - HRESULT hr = S_OK; - - try - { - // - // Initialise the OEM devmode entries - // - m_PropertyMap[g_pszPSScaleWidth] = UIPropertyPair(sizeof(DWORD), offsetof(OEMDEV, dwPgScaleX)); - m_PropertyMap[g_pszPSScaleHeight] = UIPropertyPair(sizeof(DWORD), offsetof(OEMDEV, dwPgScaleY)); - m_PropertyMap[g_pszOffsetWidth] = UIPropertyPair(sizeof(INT), offsetof(OEMDEV, iPgOffsetX)); - m_PropertyMap[g_pszOffsetHeight] = UIPropertyPair(sizeof(INT), offsetof(OEMDEV, iPgOffsetY)); - m_PropertyMap[g_pszWMTransparency] = UIPropertyPair(sizeof(INT), offsetof(OEMDEV, iWMTransparency)); - m_PropertyMap[g_pszWMAngle] = UIPropertyPair(sizeof(INT), offsetof(OEMDEV, iWMAngle)); - m_PropertyMap[g_pszWMFontSize] = UIPropertyPair(sizeof(INT), offsetof(OEMDEV, iWMFontSize)); - m_PropertyMap[g_pszWMFontColor] = UIPropertyPair(sizeof(DWORD), offsetof(OEMDEV, dwColText)); - m_PropertyMap[g_pszWMOffsetWidth] = UIPropertyPair(sizeof(INT), offsetof(OEMDEV, iWMOffsetX)); - m_PropertyMap[g_pszWMOffsetHeight] = UIPropertyPair(sizeof(INT), offsetof(OEMDEV, iWMOffsetY)); - m_PropertyMap[g_pszWMSizeWidth] = UIPropertyPair(sizeof(INT), offsetof(OEMDEV, iWMWidth)); - m_PropertyMap[g_pszWMSizeHeight] = UIPropertyPair(sizeof(INT), offsetof(OEMDEV, iWMHeight)); - m_PropertyMap[g_pszWMText] = UIPropertyPair(sizeof(TCHAR) * MAX_WATERMARK_TEXT, offsetof(OEMDEV, strWMText)); - - // - // Initialise the GPD OptItem entries. - // NOTE: These options will be removed from the standard Unidrv UI Treeview. - // - m_OptItemList.push_back("JobBindAllDocuments"); - m_OptItemList.push_back("DocumentBinding"); - m_OptItemList.push_back("PageColorManagement"); - m_OptItemList.push_back("PageSourceColorProfile"); - m_OptItemList.push_back("PageICMRenderingIntent"); - m_OptItemList.push_back("PageScaling"); - m_OptItemList.push_back("ScaleOffsetAlignment"); - m_OptItemList.push_back("PageWatermarkType"); - m_OptItemList.push_back("PageWatermarkLayering"); - m_OptItemList.push_back("JobNUpAllDocumentsContiguously"); - m_OptItemList.push_back("JobNUpContiguouslyPresentationOrder"); - m_OptItemList.push_back("DocumentNUp"); - m_OptItemList.push_back("DocumentNUpPresentationOrder"); - m_OptItemList.push_back("PageBorderless"); - m_OptItemList.push_back("PagePhotoPrintingIntent"); - m_OptItemList.push_back("DocumentDuplex"); - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUIProperties::SetItem - -Routine Description: - - This method is used to set properties in the private OEM devmode. - -Arguments: - - pFeatureName - Pointer to the property name. - pUIProperty - Pointer to the property value. - cbSize - Size of the buffer pointed to by pUIProperty. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUIProperties::SetItem( - _In_ PCSTR pFeatureName, - _In_reads_bytes_(cbSize) CONST UIProperty* pUIProperty, - _In_ SIZE_T cbSize - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pOEMDev, E_PENDING))) - { - try - { - UIPropertyMap::const_iterator iterItem = m_PropertyMap.find(pFeatureName); - - if (iterItem != m_PropertyMap.end()) - { - if (iterItem->second.first >= cbSize) - { - memcpy(reinterpret_cast(m_pOEMDev) + iterItem->second.second, pUIProperty, cbSize); - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - else - { - hr = E_INVALIDARG; - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUIProperties::GetItem - - -Routine Description: - - This method is used to get properties in the private OEM devmode. - -Arguments: - - pFeatureName - Pointer to the property name. - pUIProperty - Pointer to the property value. - cbSize - Size of the buffer pointed to by pUIProperty. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUIProperties::GetItem( - _In_ PCSTR pFeatureName, - _Out_writes_bytes_(cbSize) UIProperty* pUIProperty, - _In_ SIZE_T cbSize - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pOEMDev, E_PENDING))) - { - try - { - UIPropertyMap::const_iterator iterItem = m_PropertyMap.find(pFeatureName); - - if (iterItem != m_PropertyMap.end()) - { - if (iterItem->second.first == cbSize) - { - memcpy(pUIProperty, reinterpret_cast(m_pOEMDev) + iterItem->second.second, cbSize); - } - else - { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - else - { - hr = E_INVALIDARG; - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUIProperties::SetHeader - -Routine Description: - - Initialises the Unidrv private header portion of the OEM devmode. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUIProperties::SetHeader() -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pOEMDev, E_PENDING))) - { - // - //OEM_DMEXTRAHEADER Members - // - m_pOEMDev->dmOEMExtra.dwSize = sizeof(OEMDEV); - m_pOEMDev->dmOEMExtra.dwSignature = OEM_SIGNATURE; - m_pOEMDev->dmOEMExtra.dwVersion = OEM_VERSION; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUIProperties::SetDefaults - -Routine Description: - - Initialises the OEM devmode with default values. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUIProperties::SetDefaults() -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pOEMDev, E_PENDING))) - { - if (SUCCEEDED(hr = SetHeader())) - { - // - //Private members - // - - // - // Page Scaling - // - m_pOEMDev->dwPgScaleX = pgscParamDefIntegers[ePageScalingScaleWidth].default_value; - m_pOEMDev->dwPgScaleY = pgscParamDefIntegers[ePageScalingScaleHeight].default_value; - m_pOEMDev->iPgOffsetX = MICRON_TO_HUNDREDTH_OFINCH(pgscParamDefIntegers[ePageScalingOffsetWidth].default_value); - m_pOEMDev->iPgOffsetY = MICRON_TO_HUNDREDTH_OFINCH(pgscParamDefIntegers[ePageScalingOffsetHeight].default_value); - - // - // Page Watermark - // - m_pOEMDev->iWMTransparency = wmParamDefIntegers[ePageWatermarkTransparency].default_value; - m_pOEMDev->iWMAngle = wmParamDefIntegers[ePageWatermarkAngle].default_value; - m_pOEMDev->iWMOffsetX = MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkOriginWidth].default_value); - m_pOEMDev->iWMOffsetY = MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkOriginHeight].default_value); - - m_pOEMDev->iWMFontSize = wmParamDefIntegers[ePageWatermarkTextFontSize].default_value; - m_pOEMDev->dwColText = wmParamDefIntegers[ePageWatermarkTextColor].default_value; - - try - { - CStringXD cstrWMText(wmParamDefStrings[ePageWatermarkTextText].default_value); - hr = StringCchCopyN(m_pOEMDev->strWMText, MAX_WATERMARK_TEXT, cstrWMText.GetBuffer(), cstrWMText.GetLength()); - } - catch (CXDException& e) - { - hr = e; - } - - m_pOEMDev->iWMWidth = MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkSizeWidth].default_value); - m_pOEMDev->iWMHeight = MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkSizeHeight].default_value); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUIProperties::Convert - -Routine Description: - - This method is used to convert the OEM private devmode portion of this IUIProperty interface - given another interface as input. - -Arguments: - - pUIProperties - Pointer to the source IUIProperty interface to be converted. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUIProperties::Convert( - _In_ CUIProperties * pUIProperties - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pUIProperties, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pUIProperties->m_pOEMDev, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(m_pOEMDev, E_PENDING))) - { - // - // Check OEM Signature, if it doesn't match ours, - // then just assume DMIn is bad and use defaults. - // - if (m_pOEMDev->dmOEMExtra.dwSignature == pUIProperties->m_pOEMDev->dmOEMExtra.dwSignature) - { - if (SUCCEEDED(hr = SetDefaults())) - { - // Copy the old structure in to the new using which ever size is the smaller. - // Devmode maybe from newer Devmode (not likely since there is only one), or - // Devmode maybe a newer Devmode, in which case it maybe larger, - // but the first part of the structure should be the same. - - // DESIGN ASSUMPTION: the private DEVMODE structure only gets added to; - // the fields that are in the DEVMODE never change only new fields get added to the end. - - DWORD dwSize = __min(m_pOEMDev->dmOEMExtra.dwSize, pUIProperties->m_pOEMDev->dmOEMExtra.dwSize); - memcpy(m_pOEMDev, pUIProperties->m_pOEMDev, dwSize); - - // Re-fill in the size and version fields to indicated - // that the DEVMODE is the current private DEVMODE version. - hr = SetHeader(); - } - } - else - { - hr = SetDefaults(); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUIProperties::Validate - -Routine Description: - - This method is used to ensure that the OEM private devmode is validated. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUIProperties::Validate() -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(m_pOEMDev, E_PENDING))) - { - // - // ASSUMPTION: pOEMDevmode is large enough to contain OEMDEV structure. - // Make sure that dmOEMExtra indicates the current OEMDEV structure. - // - if (SUCCEEDED(hr = SetHeader())) - { - // - // Page Scaling Members - // - if (m_pOEMDev->dwPgScaleX < static_cast(pgscParamDefIntegers[ePageScalingScaleWidth].min_length) || - m_pOEMDev->dwPgScaleX > static_cast(pgscParamDefIntegers[ePageScalingScaleWidth].max_length)) - { - m_pOEMDev->dwPgScaleX = static_cast(pgscParamDefIntegers[ePageScalingScaleWidth].default_value); - } - - if (m_pOEMDev->dwPgScaleY < static_cast(pgscParamDefIntegers[ePageScalingScaleHeight].min_length) || - m_pOEMDev->dwPgScaleY > static_cast(pgscParamDefIntegers[ePageScalingScaleHeight].max_length)) - { - m_pOEMDev->dwPgScaleY = static_cast(pgscParamDefIntegers[ePageScalingScaleHeight].default_value); - } - - if (m_pOEMDev->iPgOffsetX < MICRON_TO_HUNDREDTH_OFINCH(pgscParamDefIntegers[ePageScalingOffsetWidth].min_length) || - m_pOEMDev->iPgOffsetX > MICRON_TO_HUNDREDTH_OFINCH(pgscParamDefIntegers[ePageScalingOffsetWidth].max_length)) - { - m_pOEMDev->iPgOffsetX = MICRON_TO_HUNDREDTH_OFINCH(pgscParamDefIntegers[ePageScalingOffsetWidth].default_value); - } - - if (m_pOEMDev->iPgOffsetY < MICRON_TO_HUNDREDTH_OFINCH(pgscParamDefIntegers[ePageScalingOffsetHeight].min_length) || - m_pOEMDev->iPgOffsetY > MICRON_TO_HUNDREDTH_OFINCH(pgscParamDefIntegers[ePageScalingOffsetHeight].max_length)) - { - m_pOEMDev->iPgOffsetY = MICRON_TO_HUNDREDTH_OFINCH(pgscParamDefIntegers[ePageScalingOffsetHeight].default_value); - } - - // - // Watermark Members - // - if (m_pOEMDev->iWMTransparency < wmParamDefIntegers[ePageWatermarkTransparency].min_length || - m_pOEMDev->iWMTransparency > wmParamDefIntegers[ePageWatermarkTransparency].max_length) - { - m_pOEMDev->iWMTransparency = wmParamDefIntegers[ePageWatermarkTransparency].default_value; - } - - if (m_pOEMDev->iWMAngle < wmParamDefIntegers[ePageWatermarkAngle].min_length || - m_pOEMDev->iWMAngle > wmParamDefIntegers[ePageWatermarkAngle].max_length) - { - m_pOEMDev->iWMAngle = wmParamDefIntegers[ePageWatermarkAngle].default_value; - } - - if (m_pOEMDev->iWMOffsetX < MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkOriginWidth].min_length) || - m_pOEMDev->iWMOffsetX > MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkOriginWidth].max_length)) - { - m_pOEMDev->iWMOffsetX = MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkOriginWidth].default_value); - } - - if (m_pOEMDev->iWMOffsetY < MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkOriginHeight].min_length) || - m_pOEMDev->iWMOffsetY > MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkOriginHeight].max_length)) - { - m_pOEMDev->iWMOffsetY = MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkOriginHeight].default_value); - } - - if (m_pOEMDev->iWMFontSize < wmParamDefIntegers[ePageWatermarkTextFontSize].min_length || - m_pOEMDev->iWMFontSize > wmParamDefIntegers[ePageWatermarkTextFontSize].max_length) - { - m_pOEMDev->iWMFontSize = wmParamDefIntegers[ePageWatermarkTextFontSize].default_value; - } - - if (m_pOEMDev->dwColText < static_cast(wmParamDefIntegers[ePageWatermarkTextColor].min_length) || - m_pOEMDev->dwColText > static_cast(wmParamDefIntegers[ePageWatermarkTextColor].max_length)) - { - m_pOEMDev->dwColText = wmParamDefIntegers[ePageWatermarkTextColor].default_value; - } - - if (m_pOEMDev->iWMWidth < MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkSizeWidth].min_length) || - m_pOEMDev->iWMWidth > MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkSizeWidth].max_length)) - { - m_pOEMDev->iWMWidth = MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkSizeWidth].default_value); - } - - if (m_pOEMDev->iWMHeight < MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkSizeHeight].min_length) || - m_pOEMDev->iWMHeight > MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkSizeHeight].max_length)) - { - m_pOEMDev->iWMHeight = MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkSizeHeight].default_value); - } - - // - // Valid text is a NULL terminated string of length < MAX_WATERMARK_TEXT - // - size_t cch = 0; - if (FAILED(StringCchLength(m_pOEMDev->strWMText, MAX_WATERMARK_TEXT, &cch))) - { - try - { - CStringXD cstrWMText(wmParamDefStrings[ePageWatermarkTextText].default_value); - hr = StringCchCopyN(m_pOEMDev->strWMText, MAX_WATERMARK_TEXT, cstrWMText.GetBuffer(), cstrWMText.GetLength()); - } - catch (CXDException& e) - { - hr = e; - } - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUIProperties::GetOptItem - -Routine Description: - - This method is used to get properties in the GPD. - -Arguments: - - pOemCUIPParam - Pointer to the POEMCUIPPARAM function. - pFeatureName - Pointer to a GPD property name. - ppOptItem - Address of a pointer that will be filled out with an OPTITEM structure. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUIProperties::GetOptItem( - _In_ POEMCUIPPARAM pOemCUIPParam, - _In_ PCSTR pFeatureName, - _Outptr_result_maybenull_ POPTITEM* ppOptItem - ) -{ - HRESULT hr = S_OK; - POPTITEM pOIResult = NULL; - - if (SUCCEEDED(hr = CHECK_POINTER(pOemCUIPParam, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pOemCUIPParam->pDrvOptItems, E_PENDING)) && - SUCCEEDED(hr = CHECK_POINTER(pFeatureName, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppOptItem, E_POINTER))) - { - *ppOptItem = NULL; - - for (DWORD indexOptItem = 0; indexOptItem < pOemCUIPParam->cDrvOptItems; indexOptItem++) - { - pOIResult = &(pOemCUIPParam->pDrvOptItems[indexOptItem]); - - if (pOIResult->UserData != NULL) - { - PUSERDATA pUserData = reinterpret_cast(pOIResult->UserData); - if (SUCCEEDED(hr = CHECK_POINTER(pUserData->pKeyWordName, E_FAIL))) - { - if (strncmp(pUserData->pKeyWordName, pFeatureName, strlen(pFeatureName)) == 0) - { - hr = S_OK; - *ppOptItem = pOIResult; - break; - } - else - { - hr = E_ELEMENT_NOT_FOUND; - } - } - } - else - { - hr = E_FAIL; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUIProperties::HideOptItems - -Routine Description: - - Ensures that all GPD settings managed by the UI Plug-in are removed from the main Unidrv driver UI. - -Arguments: - - pOemCUIPParam - Pointer to the POEMCUIPPARAM function. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUIProperties::HideOptItems( - _In_ POEMCUIPPARAM pOemCUIPParam - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pOemCUIPParam, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pOemCUIPParam->pDrvOptItems, E_PENDING))) - { - POPTITEM pOptItem = NULL; - - try - { - UIOptItemList::const_iterator iterOptItem = m_OptItemList.begin(); - - for (; iterOptItem != m_OptItemList.end() && SUCCEEDED(hr); iterOptItem++) - { - if (SUCCEEDED(hr = GetOptItem(pOemCUIPParam, *iterOptItem, &pOptItem)) && - SUCCEEDED(hr = CHECK_POINTER(pOptItem, E_FAIL))) - { - pOptItem->Flags |= OPTIF_HIDE; - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - - diff --git a/print/XPSDrvSmpl/src/ui/uiproperties.h b/print/XPSDrvSmpl/src/ui/uiproperties.h deleted file mode 100644 index 7fe0ab85..00000000 --- a/print/XPSDrvSmpl/src/ui/uiproperties.h +++ /dev/null @@ -1,111 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - uiproperties.h - -Abstract: - - This class encapsulates all handling of GPD and OEM private devmode settings - used in the XPSDrv feature sample UI. - ---*/ - -#pragma once - -#include "devmode.h" - -extern PCSTR g_pszPSScaleWidth; -extern PCSTR g_pszPSScaleHeight; -extern PCSTR g_pszOffsetWidth; -extern PCSTR g_pszOffsetHeight; -extern PCSTR g_pszWMTransparency; -extern PCSTR g_pszWMAngle; -extern PCSTR g_pszWMOffsetWidth; -extern PCSTR g_pszWMOffsetHeight; -extern PCSTR g_pszWMSizeWidth; -extern PCSTR g_pszWMSizeHeight; -extern PCSTR g_pszWMFontSize; -extern PCSTR g_pszWMFontColor; -extern PCSTR g_pszWMText; - -// -// Forward declaration -// -class CUIProperties; - -typedef VOID UIProperty; - -typedef pair UIPropertyPair; -typedef map UIPropertyMap; - -typedef vector UIOptItemList; - -class CUIProperties -{ -public: - CUIProperties(); - - CUIProperties(POEMDEV pOEMDev); - - virtual ~CUIProperties(); - - HRESULT - GetItem( - _In_ PCSTR pFeatureName, - _Out_writes_bytes_(cbSize) UIProperty* pUIProperty, - _In_ SIZE_T cbSize - ); - - HRESULT - SetItem( - _In_ PCSTR pFeatureName, - _In_reads_bytes_(cbSize) CONST UIProperty* pUIProperty, - _In_ SIZE_T cbSize - ); - - HRESULT - SetDefaults(); - - HRESULT - Validate(); - - HRESULT - Convert( - _In_ CUIProperties* pUIProperties - ); - - HRESULT - GetOptItem( - _In_ POEMCUIPPARAM pOemCUIPParam, - _In_ PCSTR pFeatureName, - _Outptr_result_maybenull_ POPTITEM* ppOptItem - ); - - HRESULT - HideOptItems( - _In_ POEMCUIPPARAM pOemCUIPParam - ); - -private: - HRESULT SetHeader(); - - HRESULT InitialiseMap(); - -private: - POEMDEV m_pOEMDev; - - UIPropertyMap m_PropertyMap; - - UIOptItemList m_OptItemList; -}; - diff --git a/print/XPSDrvSmpl/src/ui/wmctrls.cpp b/print/XPSDrvSmpl/src/ui/wmctrls.cpp deleted file mode 100644 index 66647cc3..00000000 --- a/print/XPSDrvSmpl/src/ui/wmctrls.cpp +++ /dev/null @@ -1,1381 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmctrls.cpp - -Abstract: - - Implementation of the watermark specific UI controls. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "resource.h" -#include "wmctrls.h" -#include "privatedefs.h" - -PCSTR CUICtrlWMTypeCombo::m_pszWMType = "PageWatermarkType"; - -PCSTR CUICtrlWMLayeringCombo::m_pszWMLayering = "PageWatermarkLayering"; -PCSTR CUICtrlWMTransparencyEdit::m_pszWMTransparency = "PageWatermarkTransparency"; -PCSTR CUICtrlWMTransparencySpin::m_pszWMTransparency = "PageWatermarkTransparency"; -PCSTR CUICtrlWMAngleEdit::m_pszWMAngle = "PageWatermarkTextAngle"; -PCSTR CUICtrlWMAngleSpin::m_pszWMAngle = "PageWatermarkTextAngle"; -PCSTR CUICtrlWMOffsetXEdit::m_pszWMOffsetX = "PageWatermarkOriginWidth"; -PCSTR CUICtrlWMOffsetXSpin::m_pszWMOffsetX = "PageWatermarkOriginWidth"; -PCSTR CUICtrlWMOffsetYEdit::m_pszWMOffsetY = "PageWatermarkOriginHeight"; -PCSTR CUICtrlWMOffsetYSpin::m_pszWMOffsetY = "PageWatermarkOriginHeight"; - -PCSTR CUICtrlWMWidthEdit::m_pszWMWidth = "PageWatermarkSizeWidth"; -PCSTR CUICtrlWMWidthSpin::m_pszWMWidth = "PageWatermarkSizeWidth"; -PCSTR CUICtrlWMHeightEdit::m_pszWMHeight = "PageWatermarkSizeHeight"; -PCSTR CUICtrlWMHeightSpin::m_pszWMHeight = "PageWatermarkSizeHeight"; - -PCSTR CUICtrlWMTextEdit::m_pszWMText = "PageWatermarkTextText"; - -PCSTR CUICtrlWMFontSizeEdit::m_pszWMFontSize = "PageWatermarkTextFontSize"; -PCSTR CUICtrlWMFontSizeSpin::m_pszWMFontSize = "PageWatermarkTextFontSize"; - -PCSTR CUICtrlColorBtn::m_pszWMFontColor = "PageWatermarkTextColor"; - -#define WMTYPE_NONE_SEL 0 -#define WMTYPE_TEXT_SEL 1 -#define WMTYPE_RAST_SEL 2 -#define WMTYPE_VECT_SEL 3 - -// -// Watermark type combo box control -// -/*++ - -Routine Name: - - CUICtrlWMTypeCombo::CUICtrlWMTypeCombo - -Routine Description: - - CUICtrlWMTypeCombo class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMTypeCombo::CUICtrlWMTypeCombo() : - CUICtrlDefaultCombo(m_pszWMType, IDC_COMBO_WMTYPE) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMTypeCombo::~CUICtrlWMTypeCombo - -Routine Description: - - CUICtrlWMTypeCombo class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMTypeCombo::~CUICtrlWMTypeCombo() -{ -} - -/*++ - -Routine Name: - - CUICtrlWMTypeCombo::OnInit - -Routine Description: - - This is responsible for initialising the control and is called when - the WM_INITDIALOG message is recieved. This method populates the combo - box with the appropriate option strings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlWMTypeCombo::OnInit( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - // - // Populate the combo box - // - if (SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_NONE)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_TEXT)) && - SUCCEEDED(hr = AddString(hDlg, g_hInstance, IDS_GPD_RASTERIMAGE))) - { - hr = AddString(hDlg, g_hInstance, IDS_GPD_VECTORIMAGE); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CUICtrlWMTypeCombo::EnableDependentCtrls - -Routine Description: - - This method is used to enable or disable other controls in the UI based on the - current combo box selection. - -Arguments: - - hDlg - handle to the parent window - lSel - current combo box selection - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlWMTypeCombo::EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ) -{ - HRESULT hr = S_OK; - HWND hWnd = NULL; - - BOOL bWatermarkEnabled = (lSel != WMTYPE_NONE_SEL); - BOOL bRasterType = (lSel == WMTYPE_RAST_SEL); - BOOL bVectorType = (lSel == WMTYPE_VECT_SEL); - BOOL bTextType = (lSel == WMTYPE_TEXT_SEL); - - // - // Common Watermark Properties - // - // Here we are enabling/disabling common watermark controls based off the current - // watermark option. - // - // If a watermark is selected we enable the layering, transparentcy offset and angle controls - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_COMBO_WMLAYERING), E_HANDLE))) - { - EnableWindow(hWnd, bWatermarkEnabled); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_WMLAYERING), E_HANDLE))) - { - EnableWindow(hWnd, bWatermarkEnabled); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_EDIT_WMTRANSPARENCY), E_HANDLE))) - { - EnableWindow(hWnd, bWatermarkEnabled); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_SPIN_WMTRANSPARENCY), E_HANDLE))) - { - EnableWindow(hWnd, bWatermarkEnabled); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_WMTRANSPARENCY), E_HANDLE))) - { - EnableWindow(hWnd, bWatermarkEnabled); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_EDIT_WMANGLE), E_HANDLE))) - { - EnableWindow(hWnd, bWatermarkEnabled); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_SPIN_WMANGLE), E_HANDLE))) - { - EnableWindow(hWnd, bWatermarkEnabled); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_WMANGLE), E_HANDLE))) - { - EnableWindow(hWnd, bWatermarkEnabled); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_EDIT_WMOFFX), E_HANDLE))) - { - EnableWindow(hWnd, bWatermarkEnabled); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_SPIN_WMOFFX), E_HANDLE))) - { - EnableWindow(hWnd, bWatermarkEnabled); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_WMOFFX), E_HANDLE))) - { - EnableWindow(hWnd, bWatermarkEnabled); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_EDIT_WMOFFY), E_HANDLE))) - { - EnableWindow(hWnd, bWatermarkEnabled); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_SPIN_WMOFFY), E_HANDLE))) - { - EnableWindow(hWnd, bWatermarkEnabled); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_WMOFFY), E_HANDLE))) - { - EnableWindow(hWnd, bWatermarkEnabled); - } - - // - // Vector / Bitmap Watermark Properties - // - // Here we are enabling/disabling vector/bitmap watermark controls based off the current - // watermark option. - // - // If a vector or bitmap watermark is selected we enable the width and height controls - // - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_EDIT_WMWIDTH), E_HANDLE))) - { - EnableWindow(hWnd, (bRasterType || bVectorType)); - ShowWindow(hWnd, (bRasterType || bVectorType) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_SPIN_WMWIDTH), E_HANDLE))) - { - EnableWindow(hWnd, (bRasterType || bVectorType)); - ShowWindow(hWnd, (bRasterType || bVectorType) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_WMWIDTH), E_HANDLE))) - { - EnableWindow(hWnd, (bRasterType || bVectorType)); - ShowWindow(hWnd, (bRasterType || bVectorType) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_EDIT_WMHEIGHT), E_HANDLE))) - { - EnableWindow(hWnd, (bRasterType || bVectorType)); - ShowWindow(hWnd, (bRasterType || bVectorType) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_SPIN_WMHEIGHT), E_HANDLE))) - { - EnableWindow(hWnd, (bRasterType || bVectorType)); - ShowWindow(hWnd, (bRasterType || bVectorType) ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_WMHEIGHT), E_HANDLE))) - { - EnableWindow(hWnd, (bRasterType || bVectorType)); - ShowWindow(hWnd, (bRasterType || bVectorType) ? SW_SHOW : SW_HIDE); - } - - // - // Text Watermark Properties - // - // Here we are enabling/disabling text watermark controls based off the current - // watermark option. - // - // If a text watermark is selected we enable the text and font controls - // - if (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_EDIT_WMTEXT), E_HANDLE))) - { - EnableWindow(hWnd, bTextType); - ShowWindow(hWnd, bTextType ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_WMTEXT), E_HANDLE)))) - { - EnableWindow(hWnd, bTextType); - ShowWindow(hWnd, bTextType ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_EDIT_WMSIZE), E_HANDLE)))) - { - EnableWindow(hWnd, bTextType); - ShowWindow(hWnd, bTextType ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_SPIN_WMSIZE), E_HANDLE)))) - { - EnableWindow(hWnd, bTextType); - ShowWindow(hWnd, bTextType ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_TXT_WMSIZE), E_HANDLE)))) - { - EnableWindow(hWnd, bTextType); - ShowWindow(hWnd, bTextType ? SW_SHOW : SW_HIDE); - } - - if (SUCCEEDED(hr) && - (SUCCEEDED(hr = CHECK_HANDLE(hWnd = GetDlgItem(hDlg, IDC_BUTTON_WMCOLOR), E_HANDLE)))) - { - EnableWindow(hWnd, bTextType); - ShowWindow(hWnd, bTextType ? SW_SHOW : SW_HIDE); - } - - if (FAILED(hr)) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - - ERR_ON_HR(hr); - return hr; -} - -// -// Watermark Layering combo box control -// -/*++ - -Routine Name: - - CUICtrlWMLayeringCombo::CUICtrlWMLayeringCombo - -Routine Description: - - CUICtrlWMLayeringCombo class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMLayeringCombo::CUICtrlWMLayeringCombo() : - CUICtrlDefaultCombo(m_pszWMLayering, IDC_COMBO_WMLAYERING) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMLayeringCombo::~CUICtrlWMLayeringCombo - -Routine Description: - - CUICtrlWMLayeringCombo class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMLayeringCombo::~CUICtrlWMLayeringCombo() -{ -} - -/*++ - -Routine Name: - - CUICtrlWMLayeringCombo::OnInit - -Routine Description: - - This is responsible for initialising the control and is called when - the WM_INITDIALOG message is recieved. This method populates the combo - box with the appropriate option strings. - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlWMLayeringCombo::OnInit( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - // - // Populate the combo box - // - if (SUCCEEDED (hr = AddString(hDlg, g_hInstance, IDS_GPD_OVERLAYED))) - { - hr = AddString(hDlg, g_hInstance, IDS_GPD_UNDERLAYED); - } - - ERR_ON_HR(hr); - return hr; -} - -// -// Watermark text combo box control -// -/*++ - -Routine Name: - - CUICtrlWMTextEdit::CUICtrlWMTextEdit - -Routine Description: - - CUICtrlWMTextEdit class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMTextEdit::CUICtrlWMTextEdit() : - CUICtrlDefaultEditText(m_pszWMText, - IDC_EDIT_WMTEXT, - MAX_WATERMARK_TEXT) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMTextEdit::~CUICtrlWMTextEdit - -Routine Description: - - CUICtrlWMTextEdit class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMTextEdit::~CUICtrlWMTextEdit() -{ -} - -// -// Page Watermark Transparency -// - -/*++ - -Routine Name: - - CUICtrlWMTransparencyEdit::CUICtrlWMTransparencyEdit - -Routine Description: - - CUICtrlWMTransparencyEdit class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMTransparencyEdit::CUICtrlWMTransparencyEdit() : - CUICtrlDefaultEditNum(m_pszWMTransparency, - IDC_EDIT_WMTRANSPARENCY, - wmParamDefIntegers[ePageWatermarkTransparency].min_length, - wmParamDefIntegers[ePageWatermarkTransparency].max_length, - IDC_SPIN_WMTRANSPARENCY) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMTransparencyEdit::~CUICtrlWMTransparencyEdit - -Routine Description: - - CUICtrlWMTransparencyEdit class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMTransparencyEdit::~CUICtrlWMTransparencyEdit() -{ -} - -/*++ - -Routine Name: - - CUICtrlWMTransparencySpin::CUICtrlWMTransparencySpin - -Routine Description: - - CUICtrlWMTransparencySpin class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMTransparencySpin::CUICtrlWMTransparencySpin( - _In_ CUICtrlDefaultEditNum* pEdit - ) : - CUICtrlDefaultSpin(pEdit) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMTransparencySpin::~CUICtrlWMTransparencySpin - -Routine Description: - - CUICtrlWMTransparencySpin class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMTransparencySpin::~CUICtrlWMTransparencySpin() -{ -} - -// -// Page Watermark Angle -// - -/*++ - -Routine Name: - - CUICtrlWMAngleEdit::CUICtrlWMAngleEdit - -Routine Description: - - CUICtrlWMAngleEdit class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMAngleEdit::CUICtrlWMAngleEdit() : - CUICtrlDefaultEditNum(m_pszWMAngle, - IDC_EDIT_WMANGLE, - wmParamDefIntegers[ePageWatermarkAngle].min_length, - wmParamDefIntegers[ePageWatermarkAngle].max_length, - IDC_SPIN_WMANGLE) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMAngleEdit::~CUICtrlWMAngleEdit - -Routine Description: - - CUICtrlWMAngleEdit class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMAngleEdit::~CUICtrlWMAngleEdit() -{ -} - -/*++ - -Routine Name: - - CUICtrlWMAngleSpin::CUICtrlWMAngleSpin - -Routine Description: - - CUICtrlWMAngleSpin class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMAngleSpin::CUICtrlWMAngleSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ) : - CUICtrlDefaultSpin(pEdit) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMAngleSpin::~CUICtrlWMAngleSpin - -Routine Description: - - CUICtrlWMAngleSpin class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMAngleSpin::~CUICtrlWMAngleSpin() -{ -} - -// -// Page Watermark Offset X -// - -/*++ - -Routine Name: - - CUICtrlWMOffsetXEdit::CUICtrlWMOffsetXEdit - -Routine Description: - - CUICtrlWMOffsetXEdit class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMOffsetXEdit::CUICtrlWMOffsetXEdit() : - CUICtrlDefaultEditNum(m_pszWMOffsetX, - IDC_EDIT_WMOFFX, - MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkOriginWidth].min_length), - MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkOriginWidth].max_length), - IDC_SPIN_WMOFFX) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMOffsetXEdit::~CUICtrlWMOffsetXEdit - -Routine Description: - - CUICtrlWMOffsetXEdit class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMOffsetXEdit::~CUICtrlWMOffsetXEdit() -{ -} - -/*++ - -Routine Name: - - CUICtrlWMOffsetXSpin::CUICtrlWMOffsetXSpin - -Routine Description: - - CUICtrlWMOffsetXSpin class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMOffsetXSpin::CUICtrlWMOffsetXSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ) : - CUICtrlDefaultSpin(pEdit) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMOffsetXSpin::~CUICtrlWMOffsetXSpin - -Routine Description: - - CUICtrlWMOffsetXSpin class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMOffsetXSpin::~CUICtrlWMOffsetXSpin() -{ -} - -// -// Page Watermark Offset Y -// - -/*++ - -Routine Name: - - CUICtrlWMOffsetYEdit::CUICtrlWMOffsetYEdit - -Routine Description: - - CUICtrlWMOffsetYEdit class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMOffsetYEdit::CUICtrlWMOffsetYEdit() : - CUICtrlDefaultEditNum(m_pszWMOffsetY, - IDC_EDIT_WMOFFY, - MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkOriginHeight].min_length), - MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkOriginHeight].max_length), - IDC_SPIN_WMOFFY) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMOffsetYEdit::~CUICtrlWMOffsetYEdit - -Routine Description: - - CUICtrlWMOffsetYEdit class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMOffsetYEdit::~CUICtrlWMOffsetYEdit() -{ -} - -/*++ - -Routine Name: - - CUICtrlWMOffsetYSpin::CUICtrlWMOffsetYSpin - -Routine Description: - - CUICtrlWMOffsetYSpin class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMOffsetYSpin::CUICtrlWMOffsetYSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ) : - CUICtrlDefaultSpin(pEdit) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMOffsetYSpin::~CUICtrlWMOffsetYSpin - -Routine Description: - - CUICtrlWMOffsetYSpin class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMOffsetYSpin::~CUICtrlWMOffsetYSpin() -{ -} - -// -// Page Watermark Width -// - -/*++ - -Routine Name: - - CUICtrlWMWidthEdit::CUICtrlWMWidthEdit - -Routine Description: - - CUICtrlWMWidthEdit class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMWidthEdit::CUICtrlWMWidthEdit() : - CUICtrlDefaultEditNum(m_pszWMWidth, - IDC_EDIT_WMWIDTH, - MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkSizeWidth].min_length), - MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkSizeWidth].max_length), - IDC_SPIN_WMWIDTH) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMWidthEdit::~CUICtrlWMWidthEdit - -Routine Description: - - CUICtrlWMWidthEdit class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMWidthEdit::~CUICtrlWMWidthEdit() -{ -} - -/*++ - -Routine Name: - - CUICtrlWMWidthSpin::CUICtrlWMWidthSpin - -Routine Description: - - CUICtrlWMWidthSpin class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMWidthSpin::CUICtrlWMWidthSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ) : - CUICtrlDefaultSpin(pEdit) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMWidthSpin::~CUICtrlWMWidthSpin - -Routine Description: - - CUICtrlWMWidthSpin class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMWidthSpin::~CUICtrlWMWidthSpin() -{ -} - -// -// Page Watermark Height -// - -/*++ - -Routine Name: - - CUICtrlWMHeightEdit::CUICtrlWMHeightEdit - -Routine Description: - - CUICtrlWMHeightEdit class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMHeightEdit::CUICtrlWMHeightEdit() : - CUICtrlDefaultEditNum(m_pszWMHeight, - IDC_EDIT_WMHEIGHT, - MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkSizeHeight].min_length), - MICRON_TO_HUNDREDTH_OFINCH(wmParamDefIntegers[ePageWatermarkSizeHeight].max_length), - IDC_SPIN_WMHEIGHT) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMHeightEdit::~CUICtrlWMHeightEdit - -Routine Description: - - CUICtrlWMHeightEdit class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMHeightEdit::~CUICtrlWMHeightEdit() -{ -} - -/*++ - -Routine Name: - - CUICtrlWMHeightSpin::CUICtrlWMHeightSpin - -Routine Description: - - CUICtrlWMHeightSpin class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMHeightSpin::CUICtrlWMHeightSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ) : - CUICtrlDefaultSpin(pEdit) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMHeightSpin::~CUICtrlWMHeightSpin - -Routine Description: - - CUICtrlWMHeightSpin class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMHeightSpin::~CUICtrlWMHeightSpin() -{ -} - -// -// Page Watermark Font Size -// - -/*++ - -Routine Name: - - CUICtrlWMFontSizeEdit::CUICtrlWMFontSizeEdit - -Routine Description: - - CUICtrlWMFontSizeEdit class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMFontSizeEdit::CUICtrlWMFontSizeEdit() : - CUICtrlDefaultEditNum(m_pszWMFontSize, - IDC_EDIT_WMSIZE, - wmParamDefIntegers[ePageWatermarkTextFontSize].min_length, - wmParamDefIntegers[ePageWatermarkTextFontSize].max_length, - IDC_SPIN_WMSIZE) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMFontSizeEdit::~CUICtrlWMFontSizeEdit - -Routine Description: - - CUICtrlWMFontSizeEdit class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMFontSizeEdit::~CUICtrlWMFontSizeEdit() -{ -} - -/*++ - -Routine Name: - - CUICtrlWMHeightSpin::CUICtrlWMHeightSpin - -Routine Description: - - CUICtrlWMHeightSpin class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMFontSizeSpin::CUICtrlWMFontSizeSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ) : - CUICtrlDefaultSpin(pEdit) -{ -} - -/*++ - -Routine Name: - - CUICtrlWMFontSizeSpin::~CUICtrlWMFontSizeSpin - -Routine Description: - - CUICtrlWMFontSizeSpin class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlWMFontSizeSpin::~CUICtrlWMFontSizeSpin() -{ -} - -/*++ - -Routine Name: - - CUICtrlWMFontSizeSpin::~CUICtrlWMFontSizeSpin - -Routine Description: - - CUICtrlWMFontSizeSpin class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlColorBtn::CUICtrlColorBtn() : - CUICtrlDefaultBtn(m_pszWMFontColor, IDC_BUTTON_WMCOLOR) -{ -} - -/*++ - -Routine Name: - - CUICtrlColorBtn::~CUICtrlColorBtn - -Routine Description: - - CUICtrlColorBtn class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CUICtrlColorBtn::~CUICtrlColorBtn() -{ -} - -/*++ - -Routine Name: - - CUICtrlColorBtn::OnBnClicked - -Routine Description: - - Color button clicked handler - -Arguments: - - hDlg - handle to the parent window - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CUICtrlColorBtn::OnBnClicked( - _In_ CONST HWND hDlg - ) -{ - HRESULT hr = S_OK; - - ASSERTMSG(m_pUIProperties != NULL, "NULL pointer to UI properties interface.\n"); - - DWORD colorText = 0; - if (SUCCEEDED(hr = CHECK_HANDLE(hDlg, E_HANDLE)) && - SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_PENDING)) && - SUCCEEDED(hr = m_pUIProperties->GetItem(m_szPropertyString, reinterpret_cast(&colorText), sizeof(colorText)))) - { - PBYTE pChannels = reinterpret_cast(&colorText); - - COLORREF colorsCust[16] = {0}; - COLORREF rgbIn = RGB(pChannels[2], pChannels[1], pChannels[0]); - - colorsCust[0] = rgbIn; - - CHOOSECOLOR chooseColor = { - sizeof(CHOOSECOLOR), - hDlg, - NULL, - colorText, - colorsCust, - CC_RGBINIT | CC_SOLIDCOLOR, - NULL, - NULL, - NULL - }; - - if (ChooseColor(&chooseColor) && - chooseColor.rgbResult != rgbIn) - { - pChannels[2] = GetRValue(chooseColor.rgbResult); - pChannels[1] = GetGValue(chooseColor.rgbResult); - pChannels[0] = GetBValue(chooseColor.rgbResult); - - if (SUCCEEDED(hr = m_pUIProperties->SetItem(m_szPropertyString, reinterpret_cast(&colorText), sizeof(colorText)))) - { - PropSheet_Changed(GetParent(hDlg), hDlg); - } - } - } - - ERR_ON_HR(hr); - return hr; -} - - diff --git a/print/XPSDrvSmpl/src/ui/wmctrls.h b/print/XPSDrvSmpl/src/ui/wmctrls.h deleted file mode 100644 index ed5e7d98..00000000 --- a/print/XPSDrvSmpl/src/ui/wmctrls.h +++ /dev/null @@ -1,259 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmctrls.h - -Abstract: - - Definition of the watermark specific UI controls. - ---*/ - -#pragma once - -#include "uictrl.h" - -class CUICtrlWMTypeCombo : public CUICtrlDefaultCombo -{ -public: - CUICtrlWMTypeCombo(); - - virtual ~CUICtrlWMTypeCombo(); - - HRESULT - OnInit( - _In_ CONST HWND hDlg - ); - -private: - HRESULT - EnableDependentCtrls( - _In_ CONST HWND hDlg, - _In_ CONST LONG lSel - ); - -private: - static PCSTR m_pszWMType; -}; - -class CUICtrlWMLayeringCombo : public CUICtrlDefaultCombo -{ -public: - CUICtrlWMLayeringCombo(); - - virtual ~CUICtrlWMLayeringCombo(); - - HRESULT - OnInit( - _In_ CONST HWND hDlg - ); - -private: - static PCSTR m_pszWMLayering; -}; - -class CUICtrlWMTextEdit : public CUICtrlDefaultEditText -{ -public: - CUICtrlWMTextEdit(); - - virtual ~CUICtrlWMTextEdit(); - -private: - static PCSTR m_pszWMText; -}; - -class CUICtrlWMTransparencyEdit : public CUICtrlDefaultEditNum -{ -public: - CUICtrlWMTransparencyEdit(); - - virtual ~CUICtrlWMTransparencyEdit(); - -private: - static PCSTR m_pszWMTransparency; -}; - -class CUICtrlWMTransparencySpin : public CUICtrlDefaultSpin -{ -public: - CUICtrlWMTransparencySpin( - _In_ CUICtrlDefaultEditNum* pEdit - ); - - virtual ~CUICtrlWMTransparencySpin(); - -private: - static PCSTR m_pszWMTransparency; -}; - -class CUICtrlWMAngleEdit : public CUICtrlDefaultEditNum -{ -public: - CUICtrlWMAngleEdit(); - - virtual ~CUICtrlWMAngleEdit(); - -private: - static PCSTR m_pszWMAngle; -}; - -class CUICtrlWMAngleSpin : public CUICtrlDefaultSpin -{ -public: - CUICtrlWMAngleSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ); - - virtual ~CUICtrlWMAngleSpin(); - -private: - static PCSTR m_pszWMAngle; -}; - -class CUICtrlWMOffsetXEdit : public CUICtrlDefaultEditNum -{ -public: - CUICtrlWMOffsetXEdit(); - - virtual ~CUICtrlWMOffsetXEdit(); - -private: - static PCSTR m_pszWMOffsetX; -}; - -class CUICtrlWMOffsetXSpin : public CUICtrlDefaultSpin -{ -public: - CUICtrlWMOffsetXSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ); - - virtual ~CUICtrlWMOffsetXSpin(); - -private: - static PCSTR m_pszWMOffsetX; -}; - -class CUICtrlWMOffsetYEdit : public CUICtrlDefaultEditNum -{ -public: - CUICtrlWMOffsetYEdit(); - - virtual ~CUICtrlWMOffsetYEdit(); - -private: - static PCSTR m_pszWMOffsetY; -}; - -class CUICtrlWMOffsetYSpin : public CUICtrlDefaultSpin -{ -public: - CUICtrlWMOffsetYSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ); - - virtual ~CUICtrlWMOffsetYSpin(); - -private: - static PCSTR m_pszWMOffsetY; -}; - -class CUICtrlWMWidthEdit : public CUICtrlDefaultEditNum -{ -public: - CUICtrlWMWidthEdit(); - - virtual ~CUICtrlWMWidthEdit(); - -private: - static PCSTR m_pszWMWidth; -}; - -class CUICtrlWMWidthSpin : public CUICtrlDefaultSpin -{ -public: - CUICtrlWMWidthSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ); - - virtual ~CUICtrlWMWidthSpin(); - -private: - static PCSTR m_pszWMWidth; -}; - -class CUICtrlWMHeightEdit : public CUICtrlDefaultEditNum -{ -public: - CUICtrlWMHeightEdit(); - - virtual ~CUICtrlWMHeightEdit(); - -private: - static PCSTR m_pszWMHeight; -}; - -class CUICtrlWMHeightSpin : public CUICtrlDefaultSpin -{ -public: - CUICtrlWMHeightSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ); - - virtual ~CUICtrlWMHeightSpin(); - -private: - static PCSTR m_pszWMHeight; -}; - -class CUICtrlWMFontSizeEdit : public CUICtrlDefaultEditNum -{ -public: - CUICtrlWMFontSizeEdit(); - - virtual ~CUICtrlWMFontSizeEdit(); - -private: - static PCSTR m_pszWMFontSize; -}; - -class CUICtrlWMFontSizeSpin : public CUICtrlDefaultSpin -{ -public: - CUICtrlWMFontSizeSpin( - _In_ CUICtrlDefaultEditNum* pEdit - ); - - virtual ~CUICtrlWMFontSizeSpin(); - -private: - static PCSTR m_pszWMFontSize; -}; - -class CUICtrlColorBtn : public CUICtrlDefaultBtn -{ -public: - CUICtrlColorBtn(); - - ~CUICtrlColorBtn(); - - HRESULT - OnBnClicked( - _In_ CONST HWND hDlg - ); - -private: - static PCSTR m_pszWMFontColor; -}; - diff --git a/print/XPSDrvSmpl/src/ui/wmdmptcnv.cpp b/print/XPSDrvSmpl/src/ui/wmdmptcnv.cpp deleted file mode 100644 index 22cfde42..00000000 --- a/print/XPSDrvSmpl/src/ui/wmdmptcnv.cpp +++ /dev/null @@ -1,591 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmdmptcnv.cpp - -Abstract: - - PageWatermark devmode <-> PrintTicket conversion class implementation. - The class defines a common data representation between the DevMode (GPD) and PrintTicket - representations and implements the conversion and validation methods required - by CFeatureDMPTConvert. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdstring.h" -#include "wmdmptcnv.h" -#include "wmpchndlr.h" - -using XDPrintSchema::PageWatermark::WatermarkData; -using XDPrintSchema::PageWatermark::EWatermarkOption; -using XDPrintSchema::PageWatermark::NoWatermark; -using XDPrintSchema::PageWatermark::TextWatermark; -using XDPrintSchema::PageWatermark::BitmapWatermark; -using XDPrintSchema::PageWatermark::VectorWatermark; -using XDPrintSchema::PageWatermark::WatermarkData; -using XDPrintSchema::PageWatermark::WatermarkData; -using XDPrintSchema::PageWatermark::WatermarkData; -using XDPrintSchema::PageWatermark::WatermarkData; - -using XDPrintSchema::PageWatermark::Layering::ELayeringOption; -using XDPrintSchema::PageWatermark::Layering::Overlay; -using XDPrintSchema::PageWatermark::Layering::Underlay; - -// -// Look-up data converting GPD PageWatermarkType feature options to -// watermark type enumeration -// -PCSTR g_pszWatermarkTypeFeature = "PageWatermarkType"; -static GPDStringToOption g_watermarkTypeOption[] = { - {"None", NoWatermark}, - {"Text", TextWatermark}, - {"Raster", BitmapWatermark}, - {"Vector", VectorWatermark}, -}; -UINT g_cWatermarkTypeOption = sizeof(g_watermarkTypeOption)/sizeof(GPDStringToOption); - -// -// Look-up data converting GPD PageWatermarkLayering feature options to -// watermark layering enumeration -// -PCSTR g_pszLayeringFeature = "PageWatermarkLayering"; -static GPDStringToOption g_watermarkLayeringOption[] = { - {"Overlay", Overlay}, - {"Underlay", Underlay}, -}; -UINT g_cLayeringOption = sizeof(g_watermarkLayeringOption)/sizeof(GPDStringToOption); - -/*++ - -Routine Name: - - CWatermarkDMPTConv::CWatermarkDMPTConv - -Routine Description: - - CWatermarkDMPTConv class constructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CWatermarkDMPTConv::CWatermarkDMPTConv() -{ -} - -/*++ - -Routine Name: - - CWatermarkDMPTConv::~CWatermarkDMPTConv - -Routine Description: - - CWatermarkDMPTConv class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CWatermarkDMPTConv::~CWatermarkDMPTConv() -{ -} - -/*++ - -Routine Name: - - CWatermarkDMPTConv::GetPTDataSettingsFromDM - -Routine Description: - - Populates the watermark data structure from the Devmode passed in. - -Arguments: - - pDevmode - pointer to input devmode buffer. - cbDevmode - size in bytes of full input devmode. - pPrivateDevmode - pointer to input private devmode buffer. - cbDrvPrivateSize - size in bytes of private devmode. - pDataSettings - Pointer to watermark data structure to be updated. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkDMPTConv::GetPTDataSettingsFromDM( - _In_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _In_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize, - _Out_ WatermarkData* pDataSettings - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrivateDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDataSettings, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE) || - cbDrvPrivateSize == 0) - { - hr = E_INVALIDARG; - } - } - - // - // Retrieve the GPD and devmode controlled settings - // - CUIProperties uiProperties(static_cast(pPrivateDevmode)); - - DWORD dwTextColor = 0; - if (SUCCEEDED(hr) && - SUCCEEDED(hr = GetOptionFromGPDString(pDevmode, - cbDevmode, - g_pszWatermarkTypeFeature, - g_watermarkTypeOption, - g_cWatermarkTypeOption, - pDataSettings->type)) && - SUCCEEDED(hr = GetOptionFromGPDString(pDevmode, - cbDevmode, - g_pszLayeringFeature, - g_watermarkLayeringOption, - g_cLayeringOption, - pDataSettings->layering)) && - SUCCEEDED(hr = uiProperties.GetItem(g_pszWMOffsetWidth, &pDataSettings->widthOrigin, sizeof(pDataSettings->widthOrigin))) && - SUCCEEDED(hr = uiProperties.GetItem(g_pszWMOffsetHeight, &pDataSettings->heightOrigin, sizeof(pDataSettings->heightOrigin))) && - SUCCEEDED(hr = uiProperties.GetItem(g_pszWMSizeWidth, &pDataSettings->widthExtent, sizeof(pDataSettings->widthExtent))) && - SUCCEEDED(hr = uiProperties.GetItem(g_pszWMSizeHeight, &pDataSettings->heightExtent, sizeof(pDataSettings->heightExtent))) && - SUCCEEDED(hr = uiProperties.GetItem(g_pszWMTransparency, &pDataSettings->transparency, sizeof(pDataSettings->transparency))) && - SUCCEEDED(hr = uiProperties.GetItem(g_pszWMAngle, &pDataSettings->angle, sizeof(pDataSettings->angle))) && - SUCCEEDED(hr = uiProperties.GetItem(g_pszWMFontSize, &pDataSettings->txtData.fontSize, sizeof(pDataSettings->txtData.fontSize))) && - SUCCEEDED(hr = uiProperties.GetItem(g_pszWMFontColor, &dwTextColor, sizeof(dwTextColor)))) - { - // - // Convert the color to the txtData BSTR - // - try - { - CStringXDW cstrColor; - cstrColor.Format(L"#%08X", dwTextColor); - pDataSettings->txtData.bstrFontColor.Empty(); - pDataSettings->txtData.bstrFontColor.Attach(cstrColor.AllocSysString()); - } - catch (CXDException& e) - { - hr = e; - } - - TCHAR text[MAX_WATERMARK_TEXT + 1] = {0}; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = uiProperties.GetItem(g_pszWMText, text, MAX_WATERMARK_TEXT * sizeof(TCHAR)))) - { - pDataSettings->txtData.bstrText = text; - - // - // Convert measurements from 100ths of an inch to microns - // - pDataSettings->widthOrigin = HUNDREDTH_OFINCH_TO_MICRON(pDataSettings->widthOrigin); - pDataSettings->heightOrigin = HUNDREDTH_OFINCH_TO_MICRON(pDataSettings->heightOrigin); - pDataSettings->widthExtent = HUNDREDTH_OFINCH_TO_MICRON(pDataSettings->widthExtent); - pDataSettings->heightExtent = HUNDREDTH_OFINCH_TO_MICRON(pDataSettings->heightExtent); - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkDMPTConv::MergePTDataSettingsWithPT - -Routine Description: - - This method updates the watermark data structure from a PrintTicket description. - -Arguments: - - pPrintTicket - Pointer to the input PrintTicket. - pDataSettings - Pointer to the watermark data structure - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkDMPTConv::MergePTDataSettingsWithPT( - _In_ IXMLDOMDocument2* pPrintTicket, - _Inout_ WatermarkData* pDataSettings - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pDataSettings, E_POINTER))) - { - try - { - // - // Get the watermark settings from the PrintTicket and set the options in - // the input Watermark data structure - // - WatermarkData wmData; - CWMPTHandler wmPTHndlr(pPrintTicket); - - if (SUCCEEDED(hr = wmPTHndlr.GetData(&wmData))) - { - // - // Only update settings relevant to the feature so that we do not unset - // other watermark settings in the devmode - // - pDataSettings->type = NoWatermark; - switch (wmData.type) - { - case TextWatermark: - { - pDataSettings->type = TextWatermark; - pDataSettings->widthOrigin = wmData.widthOrigin; - pDataSettings->heightOrigin = wmData.heightOrigin; - pDataSettings->transparency = wmData.transparency; - pDataSettings->angle = wmData.angle; - pDataSettings->layering = wmData.layering; - pDataSettings->txtData.bstrFontColor = wmData.txtData.bstrFontColor; - pDataSettings->txtData.fontSize = wmData.txtData.fontSize; - pDataSettings->txtData.bstrText = wmData.txtData.bstrText; - } - break; - - case BitmapWatermark: - { - pDataSettings->type = BitmapWatermark; - pDataSettings->widthOrigin = wmData.widthOrigin; - pDataSettings->heightOrigin = wmData.heightOrigin; - pDataSettings->widthExtent = wmData.widthExtent; - pDataSettings->heightExtent = wmData.heightExtent; - pDataSettings->transparency = wmData.transparency; - pDataSettings->angle = wmData.angle; - pDataSettings->layering = wmData.layering; - } - break; - - case VectorWatermark: - { - pDataSettings->type = VectorWatermark; - pDataSettings->widthOrigin = wmData.widthOrigin; - pDataSettings->heightOrigin = wmData.heightOrigin; - pDataSettings->widthExtent = wmData.widthExtent; - pDataSettings->heightExtent = wmData.heightExtent; - pDataSettings->transparency = wmData.transparency; - pDataSettings->angle = wmData.angle; - pDataSettings->layering = wmData.layering; - } - break; - - case NoWatermark: - break; - - default: - { - WARNING("Unrecognized watermark feature - setting to default\n"); - } - break; - } - } - else if (hr == E_ELEMENT_NOT_FOUND) - { - // - // Watermark setting not in the PT - this is not an error. Just - // leave the type as NoWatermark and reset the HRESULT to S_OK - // - hr = S_OK; - } - } - catch (CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkDMPTConv::SetPTDataInDM - -Routine Description: - - This method updates the watermark options in the devmode from the UI Settings. - -Arguments: - - dataSettings - Reference to watermark data settings to be updated. - pDevmode - pointer to devmode to be updated. - cbDevmode - size in bytes of full devmode. - pPrivateDevmode - pointer to input private devmode buffer. - cbDrvPrivateSize - size in bytes of private devmode. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkDMPTConv::SetPTDataInDM( - _In_ CONST WatermarkData& dataSettings, - _Inout_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _Inout_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrivateDevmode, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE) || - cbDrvPrivateSize == 0) - { - hr = E_INVALIDARG; - } - } - - // - // Convert from microns to 100ths of an inch before writing to the DevMode - // - if (SUCCEEDED(hr)) - { - INT widthOrigin = MICRON_TO_HUNDREDTH_OFINCH(dataSettings.widthOrigin); - INT heightOrigin = MICRON_TO_HUNDREDTH_OFINCH(dataSettings.heightOrigin); - INT widthExtent = MICRON_TO_HUNDREDTH_OFINCH(dataSettings.widthExtent); - INT heightExtent = MICRON_TO_HUNDREDTH_OFINCH(dataSettings.heightExtent); - - // - // Set the GPD and devmode controlled settings - // - CUIProperties uiProperties(static_cast(pPrivateDevmode)); - if (SUCCEEDED(hr = SetGPDStringFromOption(pDevmode, - cbDevmode, - g_pszWatermarkTypeFeature, - g_watermarkTypeOption, - g_cWatermarkTypeOption, - dataSettings.type)) && - SUCCEEDED(hr = SetGPDStringFromOption(pDevmode, - cbDevmode, - g_pszLayeringFeature, - g_watermarkLayeringOption, - g_cLayeringOption, - dataSettings.layering)) && - SUCCEEDED(hr = uiProperties.SetItem(g_pszWMOffsetWidth, &widthOrigin, sizeof(widthOrigin))) && - SUCCEEDED(hr = uiProperties.SetItem(g_pszWMOffsetHeight, &heightOrigin, sizeof(heightOrigin))) && - SUCCEEDED(hr = uiProperties.SetItem(g_pszWMSizeWidth, &widthExtent, sizeof(widthExtent))) && - SUCCEEDED(hr = uiProperties.SetItem(g_pszWMSizeHeight, &heightExtent, sizeof(heightExtent))) && - SUCCEEDED(hr = uiProperties.SetItem(g_pszWMTransparency, &dataSettings.transparency, sizeof(dataSettings.transparency))) && - SUCCEEDED(hr = uiProperties.SetItem(g_pszWMAngle, &dataSettings.angle, sizeof(dataSettings.angle))) && - SUCCEEDED(hr = uiProperties.SetItem(g_pszWMFontSize, &dataSettings.txtData.fontSize, sizeof(dataSettings.txtData.fontSize)))) - { - try - { - // - // Convert the font color to a channel array - // - BYTE fontColor[4] = {0}; - CStringXDW cstrFontColor(dataSettings.txtData.bstrFontColor); - cstrFontColor.Trim(); - if (cstrFontColor.Find(L"#") == 0) - { - cstrFontColor.Delete(0); - cstrFontColor.Trim(); - } - - cstrFontColor.Truncate(8); - INT cChannel = 3; - while (cstrFontColor.GetLength() > 0 && - cChannel < sizeof(DWORD) && - cChannel >= 0) - { - // - // Add the data a channel at a time so we dont overflow wcstol - // -#pragma prefast(suppress:__WARNING_MUST_USE, "All possible two-digit hex numbers are valid.") - fontColor[cChannel] = static_cast(wcstol(cstrFontColor.Left(2), NULL, 16)); - - // - // Delete the channel from the color ref string - // - cstrFontColor.Delete(0, 2); - - // - // Traverse array in reverse to correct for endianness - // - cChannel--; - } - - hr = uiProperties.SetItem(g_pszWMFontColor, fontColor, sizeof(DWORD)); - - // - // Set the text string - // - if (SUCCEEDED(hr)) - { - CStringXD text(dataSettings.txtData.bstrText); - text.Truncate(MAX_WATERMARK_TEXT); - - hr = uiProperties.SetItem(g_pszWMText, text.GetBuffer(), (text.GetLength() + 1) * sizeof(TCHAR)); - } - } - catch (CXDException& e) - { - hr = e; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkDMPTConv::SetPTDataInPT - -Routine Description: - - This method updates the watemark PrintTicket description from watermark data structure. - -Arguments: - - drvSettings - Reference to watermark data structure to update from. - pPrintTicket - Pointer to the PrintTicket to be updated. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkDMPTConv::SetPTDataInPT( - _In_ CONST WatermarkData& dataSettings, - _Inout_ IXMLDOMDocument2* pPrintTicket - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER))) - { - try - { - CWMPTHandler wmPTHndlr(pPrintTicket); - hr = wmPTHndlr.SetData(&dataSettings); - } - catch (CXDException& e) - { - hr = e; - } - } - else - { - hr = E_POINTER; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CWatermarkDMPTConv::CompletePrintCapabilities - -Routine Description: - - Unidrv calls this routine with an input Device Capabilities Document - that is partially populated with Device capabilities information - filled in by Unidrv for features that it understands. The plug-in - needs to read any private features in the input PrintTicket, delete - them and add them back under Printschema namespace so that higher - level applications can understand them and make use of them. - -Arguments: - - pPrintTicket - pointer to input PrintTicket - pCapabilities - pointer to Device Capabilities Document. - -Return Value: - - HRESULT - S_OK - Always - ---*/ -HRESULT STDMETHODCALLTYPE -CWatermarkDMPTConv::CompletePrintCapabilities( - _In_opt_ IXMLDOMDocument2*, - _Inout_ IXMLDOMDocument2* pPrintCapabilities - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pPrintCapabilities, E_POINTER))) - { - try - { - CWMPCHandler watermarkpcHandler(pPrintCapabilities); - watermarkpcHandler.SetCapabilities(); - } - catch(CXDException& e) - { - hr = e; - } - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/ui/wmdmptcnv.h b/print/XPSDrvSmpl/src/ui/wmdmptcnv.h deleted file mode 100644 index 37b8a8ae..00000000 --- a/print/XPSDrvSmpl/src/ui/wmdmptcnv.h +++ /dev/null @@ -1,75 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmdmptcnv.h - -Abstract: - - PageWatermark devmode <-> PrintTicket conversion class definition. - The class defines a common data representation between the DevMode (GPD) and PrintTicket - representations and implements the conversion and validation methods required - by CFeatureDMPTConvert. - ---*/ - -#pragma once - -#include "ftrdmptcnv.h" -#include "wmpthndlr.h" -#include "uiproperties.h" - -class CWatermarkDMPTConv : public CFeatureDMPTConvert -{ -public: - CWatermarkDMPTConv(); - - ~CWatermarkDMPTConv(); - -private: - HRESULT - GetPTDataSettingsFromDM( - _In_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _In_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize, - _Out_ XDPrintSchema::PageWatermark::WatermarkData* pDataSettings - ); - - HRESULT - MergePTDataSettingsWithPT( - _In_ IXMLDOMDocument2* pPrintTicket, - _Inout_ XDPrintSchema::PageWatermark::WatermarkData* pDrvSettings - ); - - HRESULT - SetPTDataInDM( - _In_ CONST XDPrintSchema::PageWatermark::WatermarkData& drvSettings, - _Inout_ PDEVMODE pDevmode, - _In_ ULONG cbDevmode, - _Inout_ PVOID pPrivateDevmode, - _In_ ULONG cbDrvPrivateSize - ); - - HRESULT - SetPTDataInPT( - _In_ CONST XDPrintSchema::PageWatermark::WatermarkData& drvSettings, - _Inout_ IXMLDOMDocument2* pPrintTicket - ); - - HRESULT STDMETHODCALLTYPE - CompletePrintCapabilities( - _In_opt_ IXMLDOMDocument2*, - _Inout_ IXMLDOMDocument2* pPrintCapabilities - ); -}; - diff --git a/print/XPSDrvSmpl/src/ui/wmppg.cpp b/print/XPSDrvSmpl/src/ui/wmppg.cpp deleted file mode 100644 index 64faee63..00000000 --- a/print/XPSDrvSmpl/src/ui/wmppg.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmppg.cpp - -Abstract: - - Implementation of the watermark property page. This class is - responsible for initialising and registering the color management - property page and its controls. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "xdstring.h" -#include "resource.h" -#include "wmppg.h" -#include "wmctrls.h" - -/*++ - -Routine Name: - - CWatermarkPropPage::CWatermarkPropPage - -Routine Description: - - CWatermarkPropPage class constructor. - Creates a handler class object for every control on the watermark property page. - Each of these handlers is stored in a collection. - -Arguments: - - None - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CWatermarkPropPage::CWatermarkPropPage() -{ - HRESULT hr = S_OK; - - try - { - CUIControl* pControl = new(std::nothrow) CUICtrlWMTypeCombo(); - - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_COMBO_WMTYPE, pControl); - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlWMLayeringCombo(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_COMBO_WMLAYERING, pControl); - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlWMTextEdit(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_EDIT_WMTEXT, pControl); - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlWMTransparencyEdit(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY)) && - SUCCEEDED(hr = AddUIControl(IDC_EDIT_WMTRANSPARENCY, pControl))) - { - pControl = new(std::nothrow) CUICtrlWMTransparencySpin(reinterpret_cast(pControl)); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_SPIN_WMTRANSPARENCY, pControl); - } - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlWMAngleEdit(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY)) && - SUCCEEDED(hr = AddUIControl(IDC_EDIT_WMANGLE, pControl))) - { - pControl = new(std::nothrow) CUICtrlWMAngleSpin(reinterpret_cast(pControl)); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_SPIN_WMANGLE, pControl); - } - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlWMOffsetXEdit(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY)) && - SUCCEEDED(hr = AddUIControl(IDC_EDIT_WMOFFX, pControl))) - { - pControl = new(std::nothrow) CUICtrlWMOffsetXSpin(reinterpret_cast(pControl)); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_SPIN_WMOFFX, pControl); - } - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlWMOffsetYEdit(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY)) && - SUCCEEDED(hr = AddUIControl(IDC_EDIT_WMOFFY, pControl))) - { - pControl = new(std::nothrow) CUICtrlWMOffsetYSpin(reinterpret_cast(pControl)); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_SPIN_WMOFFY, pControl); - } - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlWMWidthEdit(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY)) && - SUCCEEDED(hr = AddUIControl(IDC_EDIT_WMWIDTH, pControl))) - { - pControl = new(std::nothrow) CUICtrlWMWidthSpin(reinterpret_cast(pControl)); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_SPIN_WMWIDTH, pControl); - } - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlWMHeightEdit(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY)) && - SUCCEEDED(hr = AddUIControl(IDC_EDIT_WMHEIGHT, pControl))) - { - pControl = new(std::nothrow) CUICtrlWMHeightSpin(reinterpret_cast(pControl)); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_SPIN_WMHEIGHT, pControl); - } - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlWMFontSizeEdit(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY)) && - SUCCEEDED(hr = AddUIControl(IDC_EDIT_WMSIZE, pControl))) - { - pControl = new(std::nothrow) CUICtrlWMFontSizeSpin(reinterpret_cast(pControl)); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_SPIN_WMSIZE, pControl); - } - } - } - - if (SUCCEEDED(hr)) - { - pControl = new(std::nothrow) CUICtrlColorBtn(); - if (SUCCEEDED(hr = CHECK_POINTER(pControl, E_OUTOFMEMORY))) - { - hr = AddUIControl(IDC_BUTTON_WMCOLOR, pControl); - } - } - } - catch (CXDException& e) - { - hr = e; - } - - if (FAILED(hr)) - { - DestroyUIComponents(); - throw CXDException(hr); - } -} - -/*++ - -Routine Name: - - CWatermarkPropPage::~CWatermarkPropPage - -Routine Description: - - CWatermarkPropPage class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CWatermarkPropPage::~CWatermarkPropPage() -{ -} - -/*++ - -Routine Name: - - CWatermarkPropPage::InitDlgBox - -Routine Description: - - Provides the base class with the data required to intialise the dialog box. - -Arguments: - - ppszTemplate - Pointer to dialog box template to be intialised. - ppszTitle - Pointer to dialog box title to be intialised. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CWatermarkPropPage::InitDlgBox( - _Out_ LPCTSTR* ppszTemplate, - _Out_ LPCTSTR* ppszTitle - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(ppszTemplate, E_POINTER)) || - SUCCEEDED(hr = CHECK_POINTER(ppszTitle, E_POINTER))) - { - *ppszTemplate = MAKEINTRESOURCE(IDD_WATERMARK); - *ppszTitle = MAKEINTRESOURCE(IDS_WMARK); - } - - ERR_ON_HR(hr); - return hr; -} - diff --git a/print/XPSDrvSmpl/src/ui/wmppg.h b/print/XPSDrvSmpl/src/ui/wmppg.h deleted file mode 100644 index e28d5ea5..00000000 --- a/print/XPSDrvSmpl/src/ui/wmppg.h +++ /dev/null @@ -1,42 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - wmppg.h - -Abstract: - - Definiiion of the watermark property page. This class is - responsible for initialising and registering the color management - property page and its controls. - ---*/ - -#pragma once - -#include "precomp.h" -#include "docppg.h" - -class CWatermarkPropPage : public CDocPropPage -{ -public: - CWatermarkPropPage(); - - virtual ~CWatermarkPropPage(); - - HRESULT - InitDlgBox( - _Out_ LPCTSTR* ppszTemplate, - _Out_ LPCTSTR* ppszTitle - ); -}; - diff --git a/print/XPSDrvSmpl/src/ui/xdsmplcf.cpp b/print/XPSDrvSmpl/src/ui/xdsmplcf.cpp deleted file mode 100644 index abbdb3e4..00000000 --- a/print/XPSDrvSmpl/src/ui/xdsmplcf.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdsmplcf.cpp - -Abstract: - - XPSDrv feature sample class factory implementation. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "xdstring.h" -#include "xdsmplcf.h" -#include "xdsmplui.h" -#include "xdsmplptprov.h" - -/*++ - -Routine Name: - - CXDSmplUICF::CreateInstance - -Routine Description: - - Creates an object of the specified CLSID and retrieves an interface pointer to this object. - The supported class objects are currently IPrintOemUI and IPrintOemPrintTicketProvider. - -Arguments: - - pUnkOuter - This must be NULL, as aggregare object creation is not supported. - riid - The IID of the requested interface. - ppvObject - A pointer to the interface pointer identified by riid. - If the object does not support this interface, ppvObj is set to NULL. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDSmplUICF::CreateInstance( - _In_opt_ LPUNKNOWN pUnkOuter, - _In_ REFIID riid, - _Outptr_ PVOID* ppvObject - ) -{ - HRESULT hr = S_OK; - - if (ppvObject == NULL) - { - hr = E_POINTER; - goto Exit; - } - *ppvObject = NULL; - - if (pUnkOuter == NULL) - { - // - // Create UI component - // - CXDSmplUI* pXDSmplUI = NULL; - - try - { - pXDSmplUI = new(std::nothrow) CXDSmplUI; - hr = CHECK_POINTER(pXDSmplUI, E_OUTOFMEMORY); - } - catch (CXDException& e) - { - hr = e; - } - catch (...) - { - hr = E_FAIL; - } - - if (SUCCEEDED(hr)) - { - // - // Get the requested interface - // - hr = pXDSmplUI->QueryInterface(riid, ppvObject) ; - - // - // Release the IUnknown pointer. If QueryInterface failed - // the Release() call will clean up - // - pXDSmplUI->Release(); - - // - // If QueryInterface failed this could be a request for the - // PTProvider Interface - // - if (FAILED(hr)) - { - CXDSmplPTProvider* pXDSmplPT = NULL; - - try - { - pXDSmplPT = new(std::nothrow) CXDSmplPTProvider; - hr = CHECK_POINTER(pXDSmplPT, E_OUTOFMEMORY); - } - catch (CXDException& e) - { - _Analysis_assume_((*ppvObject) == NULL); - hr = e; - } - catch (...) - { - hr = E_FAIL; - } - - if (SUCCEEDED(hr)) - { - hr = pXDSmplPT->QueryInterface(riid, ppvObject) ; - - // - // Release the IUnknown pointer. - // (If QueryInterface failed, component will delete itself.) - // - pXDSmplPT->Release(); - } - } - } - } - else - { - // - // Cannot aggregate - // - hr = CLASS_E_NOAGGREGATION; - } - -Exit: - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDSmplUICF::LockServer - -Routine Description: - - Increments and decrements the UI Plug-in Module lock count. - -Arguments: - - bLock - If TRUE, the lock count is incremented; otherwise, the lock count is decremented. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDSmplUICF::LockServer( - BOOL bLock - ) -{ - if (bLock) - { - InterlockedIncrement(&g_cServerLocks); - } - else - { - InterlockedDecrement(&g_cServerLocks); - } - - return S_OK; -} - diff --git a/print/XPSDrvSmpl/src/ui/xdsmplcf.h b/print/XPSDrvSmpl/src/ui/xdsmplcf.h deleted file mode 100644 index ae1a78c8..00000000 --- a/print/XPSDrvSmpl/src/ui/xdsmplcf.h +++ /dev/null @@ -1,56 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdsmplcf.cpp - -Abstract: - - XPSDrv feature sample class factory definition. - ---*/ - -#pragma once - -#include "cunknown.h" - -class CXDSmplUICF : public CUnknown -{ -public: - // - // Constructor and Destruction - // - CXDSmplUICF() : - CUnknown(IID_IClassFactory) - { - } - - virtual ~CXDSmplUICF() - { - } - - // - // IClassFactory methods - // - virtual HRESULT STDMETHODCALLTYPE - CreateInstance( - _In_opt_ LPUNKNOWN pUnkOuter, - _In_ REFIID riid, - _Outptr_ PVOID* ppvObject - ); - - virtual HRESULT STDMETHODCALLTYPE - LockServer( - BOOL bLock - ); -}; - diff --git a/print/XPSDrvSmpl/src/ui/xdsmpldlg.rc b/print/XPSDrvSmpl/src/ui/xdsmpldlg.rc deleted file mode 100644 index bfbdee3f..00000000 --- a/print/XPSDrvSmpl/src/ui/xdsmpldlg.rc +++ /dev/null @@ -1,326 +0,0 @@ -// -// Copyright (c) 2005 Microsoft Corporation -// -// All rights reserved. -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// File Name: -// -// xdsmpldlg.rc -// -// Abstract: -// -// XPSDrv sample driver UI plug-in resource file. -// -// - -#include "winres.h" -#include "resource.h" -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT2_UNKNOWN -#define VER_FILEDESCRIPTION_STR "XPSDrv Sample UI Plug-In" -#define VER_INTERNALNAME_STR "PrintFeatureFilters" - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// - -#include "common.ver" - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_COL_MANAGE DIALOGEX 0, 0, 296, 200 -STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_DISABLED -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - LISTBOX IDC_LIST_COLPROF,21,63,252,82,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - LTEXT "Select color profile",IDC_TEXT_COLPROF,22,51,89,8 - GROUPBOX "",IDC_GRP_COLPROF,4,4,288,192 - COMBOBOX IDC_COMBO_COL_MANAGE,137,28,135,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Select Color Management Method",IDC_TXT_COL_MANAGE,24,31,108,8 - LTEXT "Select ICM Rendering Intent",IDC_TXT_COL_INTENT,24,164,92,8 - COMBOBOX IDC_COMBO_COL_INTENT,137,162,135,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP -END - -IDD_WATERMARK DIALOGEX 0, 0, 296, 200 -STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_DISABLED -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - COMBOBOX IDC_COMBO_WMTYPE,14,32,107,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Watermark Type",IDC_TXT_WMTYPE,14,21,65,8 - COMBOBOX IDC_COMBO_WMLAYERING,14,66,75,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Layering",IDC_TXT_WMLAYERING,14,55,65,8 - GROUPBOX "Settings",IDC_GRP_WM,4,4,284,192 - EDITTEXT IDC_EDIT_WMTEXT,14,131,107,14, ES_AUTOHSCROLL - LTEXT "Text",IDC_TXT_WMTEXT,14,120,65,8 - EDITTEXT IDC_EDIT_WMTRANSPARENCY,236,65,33,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPIN_WMTRANSPARENCY,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,260,65,11,14 - EDITTEXT IDC_EDIT_WMANGLE,133,66,33,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPIN_WMANGLE,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,157,66,11,14 - EDITTEXT IDC_EDIT_WMOFFX,70,96,50,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPIN_WMOFFX,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,109,96,11,14 - EDITTEXT IDC_EDIT_WMOFFY,190,96,50,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPIN_WMOFFY,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,229,96,11,14 - LTEXT "Transparency",IDC_TXT_WMTRANSPARENCY,186,68,45,8 - LTEXT "Angle",IDC_TXT_WMANGLE,104,68,23,8 - LTEXT "Offset X .01""",IDC_TXT_WMOFFX,17,99,43,8 - LTEXT "Offset Y .01""",IDC_TXT_WMOFFY,140,98,43,8 - EDITTEXT IDC_EDIT_WMWIDTH,70,125,50,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPIN_WMWIDTH,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,108,125,11,14 - EDITTEXT IDC_EDIT_WMHEIGHT,190,125,50,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPIN_WMHEIGHT,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,229,125,11,14 - LTEXT "Width .01""",IDC_TXT_WMWIDTH,17,128,51,8 - LTEXT "Height .01""",IDC_TXT_WMHEIGHT,140,127,37,8 - EDITTEXT IDC_EDIT_WMSIZE,129,163,33,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPIN_WMSIZE,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,158,163,11,14 - LTEXT "Size",IDC_TXT_WMSIZE,104,166,18,8 - PUSHBUTTON "Color",IDC_BUTTON_WMCOLOR,27,163,50,14 -END - -IDD_FEATURES DIALOGEX 0, 0, 296, 200 -STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_DISABLED -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "Page Scaling",IDC_GRP_PGSCALE,4,2,285,56 - GROUPBOX "Document Multi-Up",IDC_GRP_DOCNUP,4,61,285,45 - COMBOBOX IDC_COMBO_PGSCALE,11,28,88,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Scaling Option",IDC_TXT_PGSCALE,11,18,46,8 - COMBOBOX IDC_COMBO_SCALEOFF,144,28,114,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Scale Offset Alignment",IDC_TXT_SCALEOFF,144,17,88,8 - EDITTEXT IDC_EDIT_PGSCALEX,138,14,40,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPIN_PGSCALEX,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,168,14,10,14 - EDITTEXT IDC_EDIT_PGOFFX,234,14,50,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPIN_PGOFFX,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,273,14,10,14 - EDITTEXT IDC_EDIT_PGSCALEY,138,38,40,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPIN_PGSCALEY,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,168,38,10,14 - EDITTEXT IDC_EDIT_PGOFFY,234,38,50,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPIN_PGOFFY,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,273,38,10,14 - LTEXT "Scale X",IDC_TXT_PGSCALEX,108,18,25,8 - LTEXT "Scale Y",IDC_TXT_PGSCALEY,108,40,25,8 - LTEXT "Offset X .01""",IDC_TXT_PGOFFX,187,17,42,8 - LTEXT "Offset Y .01""",IDC_TXT_PGOFFY,187,40,42,8 - COMBOBOX IDC_COMBO_NUP,11,81,114,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_NUP_ORDER,155,81,114,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Number Up",IDC_TXT_NUP,11,70,36,8 - LTEXT "Presentation Order",IDC_TXT_NUP_ORDER,155,70,88,8 - COMBOBOX IDC_COMBO_PHOTO_INTENT,93,176,83,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Page Photo Printing Intent",IDC_TXT_PHOTO_INTENT,93,165,86,8 - CONTROL "Enable Borderless Pages",IDC_CHECK_BORDERLESS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,177,94,10 - COMBOBOX IDC_COMBO_DOCDUPLEX,11,176,68,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Duplex Option",IDC_TXT_DOCDUPLEX,11,165,46,8 - GROUPBOX "Other",IDC_STATIC,4,157,285,38 - LTEXT "Job Binding (all documents)",IDC_TXT_JOBBIND,11,118,100,8 - COMBOBOX IDC_COMBO_JOBBIND,11,129,115,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Binding Option",IDC_STATIC,4,109,285,45 - LTEXT "Document Binding",IDC_TXT_DOCBIND,155,118,100,8 - COMBOBOX IDC_COMBO_DOCBIND,155,129,114,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP -END - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_COLMAN "Color Management" - IDS_WMARK "Watermarks" - IDS_FEATURE "Features" -END - -STRINGTABLE -BEGIN - IDS_GPD_1PPS "1 Page per Sheet" - IDS_GPD_2PPS "2 Page per Sheet" - IDS_GPD_4PPS "4 Page per Sheet" - IDS_GPD_6PPS "6 Page per Sheet" - IDS_GPD_8PPS "8 Page per Sheet" - IDS_GPD_9PPS "9 Page per Sheet" - IDS_GPD_16PPS "16 Page per Sheet" - IDS_GPD_RES1200 "1200 x 1200 dpi" - IDS_GPD_RES600 "600 x 600 dpi" - IDS_GPD_AUTOMATIC "Automatic" - IDS_GPD_BORDERED "Bordered" - IDS_GPD_BORDERLESS "Borderless" - IDS_GPD_BTOT "Bottom to Top" - IDS_GPD_BTOTLTOR "Bottom to Top, Left to Right" - IDS_GPD_BTOTRTOL "Bottom to Top, Right to Left" - IDS_GPD_CMYK "CMYK" -END - -STRINGTABLE -BEGIN - IDS_GPD_COLOR "Color" - IDS_GPD_CONFIDENTIAL "Confidential" - IDS_GPD_CUSTSQUARE "Custom Square" - IDS_GPD_CUSTOM "Custom" - IDS_GPD_SRCCOLPROF "Source Color Profile" - IDS_GPD_DEVICE "Device" - IDS_GPD_DOCBIND "Document Binding" - IDS_GPD_PAGECOLMAN "Page Color Management" - IDS_GPD_PAGEPHOTINTENT "Page Photo Printing Intent" - IDS_GPD_DOCDUPLEX "Document Duplex" - IDS_GPD_DOCNUP "Document NUp" - IDS_GPD_DOCNUPPRESENTORDER "Document NUp Presentation Order" - IDS_GPD_DRAFT "Draft" - IDS_GPD_DRIVER "Driver" - IDS_GPD_DUPLEX "Duplex" - IDS_GPD_FAX "Fax" -END - -STRINGTABLE -BEGIN - IDS_GPD_FITBLEED "Fit Bleed Size" - IDS_GPD_FITCONTENT "Fit Content Size" - IDS_GPD_FITPAGE "Fit Page Size" - IDS_GPD_GLOSSY "Glossy" - IDS_GPD_GRAYSCALE "Grayscale" - IDS_GPD_HIGH "High" - IDS_GPD_HORIZONTAL "Horizontal" - IDS_GPD_JOBBINDING "Job Binding (all documents)" - IDS_GPD_JOBNUPPRESENTORDER "Job NUp Presentation Order" - IDS_GPD_JOBNUP "Job NUp (contigously)" - IDS_GPD_JOBPAGEORDER "Job Page Order" - IDS_GPD_LANDSCAPE "Landscape" - IDS_GPD_LTOR "Left to Right" - IDS_GPD_LTORBTOT "Left to Right, Bottom to Top" - IDS_GPD_LTORTTOB "Left to Right, Top to Bottom" - IDS_GPD_MEDIATYPE "Media Type" -END - -STRINGTABLE -BEGIN - IDS_GPD_MONO "Mono" - IDS_GPD_NONE "None" - IDS_GPD_NORMAL "Normal" - IDS_GPD_OFF "Off" - IDS_GPD_ON "On" - IDS_GPD_ORIENATION "Orientation" - IDS_GPD_OVERLAYED "Overlaid" - IDS_GPD_PAGEBORDER "Page Border" - IDS_GPD_PAGEQUALITY "Page Output Quality" - IDS_GPD_PAGESCALING "Page Scaling" - IDS_GPD_PAPERSOURCE "Paper Source" - IDS_GPD_PHOTOGRAPHIC "Photographic" - IDS_GPD_PORTRAIT "Portrait" - IDS_GPD_RASTERIMAGE "Raster Image" - IDS_GPD_RESOLUTION "Resolution" - IDS_GPD_REVERSELANDSCAPE "Reverse Landscape" -END - -STRINGTABLE -BEGIN - IDS_GPD_REVERSE "Reverse" - IDS_GPD_RTOL "Right to Left" - IDS_GPD_RTOLBTOT "Right to Left, Bottom to Top" - IDS_GPD_RTOLTTOB "Right to Left, Top to Bottom" - IDS_GPD_SCALEPAGETOPAGE "Scale Page to Page" - IDS_GPD_SCRGB "scRGB" - IDS_GPD_STANDARD "Standard" - IDS_GPD_TEXT "Text" - IDS_GPD_TTOB "Top to Bottom" - IDS_GPD_TTOBLTOR "Top to Bottom, Left to Right" - IDS_GPD_TTOBRTOL "Top to Bottom, Right to Left" - IDS_GPD_TRANSPARENCY "Transparency" - IDS_GPD_TRANSPARENT "Transparent" - IDS_GPD_UNDERLAYED "Underlayed" - IDS_GPD_UPPER "Upper" - IDS_GPD_VECTORIMAGE "Vector Image" -END - -STRINGTABLE -BEGIN - IDS_GPD_VERTICAL "Vertical" - IDS_GPD_WATERMARKLAYERING "Watermark Layering" - IDS_GPD_WATERMARKTEXT "Watermark Text" - IDS_GPD_WATERMARKTYPE "Watermark Type" - IDS_GPD_BEST "Best" - IDS_GPD_PAGEICMINTENT "Page ICM Rendering Intent" - IDS_GPD_ABSCOLINTENT "Absolute Colorimetric" - IDS_GPD_RELCOLINTENT "Relative Colorimetric" - IDS_GPD_PHOTOINTENT "Photographs" - IDS_GPD_BIZINTENT "Business Graphics" - IDS_GPD_SYSTEM "System" - IDS_GPD_WATERMARKTEXTCOLOR "Watermark Text Color" - IDS_GPD_RED "Red" - IDS_GPD_GREEN "Green" - IDS_GPD_BLUE "Blue" - IDS_GPD_MAGENTA "Magenta" - IDS_GPD_CYAN "Cyan" - IDS_GPD_YELLOW "Yellow" - IDS_GPD_BLACK "Black" -END - -STRINGTABLE -BEGIN - IDS_GPD_SCALE_ALIGN "Scale Offset Alignment" - IDS_GPD_SCALE_ALIGN_BC "Bottom Centre" - IDS_GPD_SCALE_ALIGN_BL "Bottom Left" - IDS_GPD_SCALE_ALIGN_BR "Bottom Right" - IDS_GPD_SCALE_ALIGN_CC "Centre" - IDS_GPD_SCALE_ALIGN_LC "Centre Left" - IDS_GPD_SCALE_ALIGN_CR "Centre Right" - IDS_GPD_SCALE_ALIGN_CT "Centre Top" - IDS_GPD_SCALE_ALIGN_TL "Top Left" - IDS_GPD_SCALE_ALIGN_TR "Top Right" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/print/XPSDrvSmpl/src/ui/xdsmplptprov.cpp b/print/XPSDrvSmpl/src/ui/xdsmplptprov.cpp deleted file mode 100644 index 5e0f521f..00000000 --- a/print/XPSDrvSmpl/src/ui/xdsmplptprov.cpp +++ /dev/null @@ -1,891 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdsmplptprov.cpp - -Abstract: - - Implementation of the PrintTicket provider plugin. This is responsible for - handling PrintTicket features that are too complex for the GPD->PrintTicket - automapping facility. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "xdstring.h" -#include "xdsmplptprov.h" -#include "wmdmptcnv.h" -#include "pgscdmptcnv.h" -#include "bkdmptcnv.h" -#include "nupptcnv.h" -#include "coldmptcnv.h" -#include "pthndlr.h" -#include "pchndlr.h" - -static LPCWSTR PRIVATE_URI = L"http://schemas.microsoft.com/windows/2003/08/printing/XPSDrv_Feature_Sample"; - - -/*++ - -Routine Name: - - CXDSmplPTProvider::CXDSmplPTProvider - -Routine Description: - - CXDSmplPTProvider class constructor - -Arguments: - - None - -Return Value: - - None - Throws CXDException(HRESULT) on an error - ---*/ -CXDSmplPTProvider::CXDSmplPTProvider() : - CUnknown(IID_IPrintOemPrintTicketProvider), - m_hPrinterCached(NULL), - m_pCoreHelper(NULL), - m_bstrPrivateNS(PRIVATE_URI) -{ - HRESULT hr = S_OK; - IFeatureDMPTConvert* pHandler = NULL; - -// -// This Prefast warning indicates that memory could be leaked -// in the event of an exception. We suppress this false positive because we -// know that the local try/catch block will clean up a single -// IFeatureDMPTConvert, and the destructor will clean up any that are -// successfully added to the vector. -// -#pragma prefast(push) -#pragma prefast(disable:__WARNING_ALIASED_MEMORY_LEAK_EXCEPTION) - try - { - // - // Populate the feature DM<->PT conversion vector - // - pHandler = new(std::nothrow) CWatermarkDMPTConv(); - - hr = AddConverter(pHandler); - - if (SUCCEEDED(hr)) - { - pHandler = new(std::nothrow) CPageScalingDMPTConv(); - - hr = AddConverter(pHandler); - } - - if (SUCCEEDED(hr)) - { - pHandler = new(std::nothrow) CBookletDMPTConv(); - - hr = AddConverter(pHandler); - } - - if (SUCCEEDED(hr)) - { - pHandler = new(std::nothrow) CNUpDMPTConv(); - - hr = AddConverter(pHandler); - } - - if (SUCCEEDED(hr)) - { - pHandler = new(std::nothrow) CColorProfileDMPTConv(); - - hr = AddConverter(pHandler); - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - - hr = E_FAIL; - } - - if (FAILED(hr)) - { - // - // If we successfully created a handler but failed to push it onto - // the handler vector we need to free the allocated handler - // - if (pHandler != NULL) - { - delete pHandler; - pHandler = NULL; - } - - // - // Delete any DM<->PT converters that were successfully instantiated - // - DeleteConverters(); - - throw CXDException(hr); - } -#pragma prefast(pop) -} - -/*++ - -Routine Name: - - CXDSmplPTProvider::~CXDSmplPTProvider - -Routine Description: - - CXDSmplPTProvider class destructor - -Arguments: - - None - -Return Value: - - None - ---*/ -CXDSmplPTProvider::~CXDSmplPTProvider() -{ - // - // Clean up all DM<->PT converters - // - DeleteConverters(); -} - -/*++ - -Routine Name: - - CXDSmplPTProvider::GetSupportedVersions - -Routine Description: - - The routine returns major versions of Printschema schema supported by the plug-in Provider. - -Arguments: - - hPrinter - Printer Handle - ppVersions - OUT pointer to array of version numbers to be filled in by the plug-in - cVersions - OUT pointer to count of Number of versions supported by plug-in - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CXDSmplPTProvider::GetSupportedVersions( - _In_ HANDLE, - _Outptr_result_buffer_(*pcVersions) INT* ppVersions[], - _Out_ INT* pcVersions - ) -{ - HRESULT hr = S_OK; - - // - // Check if input parameters are valid - // - if (SUCCEEDED(hr = CHECK_POINTER(ppVersions, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcVersions, E_POINTER))) - { - *pcVersions = 0; - - // - // The Plug-in Provider need to allocate memory for the input version array and - // then fill it with version information - // - *ppVersions = static_cast(CoTaskMemAlloc(sizeof(INT))); - - if (*ppVersions != NULL) - { - // - // version number 1 is the only version supported currently - // - *pcVersions = 1; - (*ppVersions)[0] = PRINTSCHEMA_VERSION_NUMBER; - } - else - { - hr = E_OUTOFMEMORY; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDSmplPTProvider::BindPrinter - -Routine Description: - - Bind Printer is the part of the Unidrv's activity to bind to a device. It allows the plug-in to cache - certain information that can be used later on such as the private namespaces used by the plug-in. - -Arguments: - - hPrinter - Printer Handle supplied by Unidrv - version - version of Printschema - pOptions - Flags passed out to set configurable options supported by caller - cNamespaces - Count of private namespaces of plug-in - ppNamespaces - OUT pointer to the array of Namespace URIs filled in by plug-in - -Return Value: - - HRESULT - S_OK - On success - E_VERSION_NOT_SUPPORTED - if printer version specified is not supported by plug-in - E_* - On any other failure - ---*/ -HRESULT STDMETHODCALLTYPE -CXDSmplPTProvider::BindPrinter( - _In_ HANDLE hPrinter, - INT version, - _Out_ POEMPTOPTS pOptions, - _Out_ INT* pcNamespaces, - _Outptr_result_buffer_maybenull_(*pcNamespaces) BSTR** ppNamespaces - ) -{ - HRESULT hr = S_OK; - - // - // Printer Handle should be provided by Unidrv in this call, which is cached by plug-in provider and - // is later on used while making calls to Plug-in Helper Interface methods. - // - if (SUCCEEDED(hr = CHECK_POINTER(pOptions, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pcNamespaces, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(ppNamespaces, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(hPrinter, E_HANDLE))) - { - *ppNamespaces = NULL; - *pcNamespaces = 0; - - // - // Agree on the Printschema version with Unidrv Version 1 is the only - // version currently supported - // - if (PRINTSCHEMA_VERSION_NUMBER == version) - { - // - // Cache the printer handle for further use - // - m_hPrinterCached = hPrinter; - - // - // Flags to set configurable options, OEMPT_DEFAULT defined in prcomoem.h - // - *pOptions = OEMPT_NOSNAPSHOT; - - // - // Publish the private namespace - // - *pcNamespaces = 1; - *ppNamespaces = static_cast(CoTaskMemAlloc(sizeof(BSTR))); - - if (SUCCEEDED(hr = CHECK_POINTER(*ppNamespaces, E_OUTOFMEMORY))) - { - hr = m_bstrPrivateNS.CopyTo(*ppNamespaces); - } - } - else - { - hr = E_VERSION_NOT_SUPPORTED; - } - } - - ERR_ON_HR_EXC(hr, E_VERSION_NOT_SUPPORTED); - return hr; -} - -/*++ - -Routine Name: - - CXDSmplPTProvider::PublishPrintTicketHelperInterface - -Routine Description: - - For a number of operations, the plug-in needs to use the Helper Interface utilities provided by - Unidrv. Unidrv uses this method to publish the PrintTicket Helper Interface, IPrintCoreHelper. - Plug-in should return SUCCESS after successfully incrementing the reference count of the interface. - -Arguments: - - pHelper - IPrintCoreHelper interface pointer - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CXDSmplPTProvider::PublishPrintTicketHelperInterface( - _In_ IUnknown *pHelper - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pHelper, E_POINTER))) - { - // - // Need to store pointer to Driver Helper functions, if we already haven't. - // - if (m_pCoreHelper == NULL) - { - hr = pHelper->QueryInterface(IID_IPrintCoreHelperUni, reinterpret_cast(&m_pCoreHelper)); - } - - // - // It's possible that this routine will publish other interfaces in the future. - // If the object published did not support the desired interface, this routine - // should still succeed. - // - // If the helper interface is needed, but for some reason was not published - // (this would be an error on the OS's part), you should detect this and fail - // during the call-back where you intended to use the helper interface. - // - if (E_NOINTERFACE == hr) - { - hr = S_OK; - } - else - { - try - { - // - // Iterate over all PrintTicket feature converters publishing the helper interface - // - DMPTConvCollection::iterator iterConverters = m_vectFtrDMPTConverters.begin(); - - for (; iterConverters != m_vectFtrDMPTConverters.end() && SUCCEEDED(hr); iterConverters++) - { - hr = (*iterConverters)->PublishPrintTicketHelperInterface(m_pCoreHelper); - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDSmplPTProvider::QueryDeviceDefaultNamespace - -Routine Description: - - This method provides the plug-in with the opportunity to specify the name of the - Private namespace URI that Unidrv should be using to handle any features defined - in the GPD that Unidrv does not recognize. The plug-in may specify a set of - namespaces as a result of the call to BindPrinter method, and Unidrv needs to know - which of them is to be used as default namespace so that, for all the features that - Unidrv does not recognize, it will put them under this namespace in the PrintTicket. - - Note: It is Unidrv's responsibility to add the private namespace URI that plug-in - has specified through this call in the root node of the DOM document, and also define - a prefix for it so that plug-in should use the prefix defined by Unidrv when it wishes - to add any new node to the PrintTicket under its private namespace. Plug-in should - not define its own prefix for this default private namespace URI. - -Arguments: - - pbstrNamespaceUri - OUT Pointer to namespace URI to be filled in and returned by plug-in - -Return Value: - - HRESULT - S_OK - On success - E_NOTIMPL - The plugin does not require a private namespace - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CXDSmplPTProvider::QueryDeviceDefaultNamespace( - _Out_ BSTR* pbstrNamespaceUri - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pbstrNamespaceUri, E_POINTER))) - { - hr = m_bstrPrivateNS.CopyTo(pbstrNamespaceUri); - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDSmplPTProvider::ConvertPrintTicketToDevMode - -Routine Description: - - Unidrv will call this routine before it performs its part of PT->DM - conversion. The plug-in is passed with an input PrintTicket that is - fully populated, and Devmode which has default settings in it. - - This routine merely passes the call on to the individual feature handlers. - -Arguments: - - pPrintTicket - pointer to input PrintTicket - cbDevmode - size in bytes of input full devmode - pDevmode - pointer to input full devmode buffer - cbDrvPrivateSize - buffer size in bytes of plug-in private devmode - pPrivateDevmode - pointer to plug-in private devmode buffer - - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CXDSmplPTProvider::ConvertPrintTicketToDevMode( - _In_ IXMLDOMDocument2* pPrintTicket, - ULONG cbDevmode, - _Inout_updates_bytes_(cbDevmode) - PDEVMODE pDevmode, - ULONG cbDrvPrivateSize, - _Inout_ PVOID pPrivateDevmode - ) -{ - HRESULT hr = S_OK; - - // - // Validate parameters - // - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrivateDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE) || - cbDrvPrivateSize == 0) - { - hr = E_INVALIDARG; - } - } - - try - { - if (SUCCEEDED(hr)) - { - // - // Iterate over all PrintTicket feature converters letting them - // provide the conversion - // - DMPTConvCollection::iterator iterConverters = m_vectFtrDMPTConverters.begin(); - - for (; iterConverters != m_vectFtrDMPTConverters.end() && SUCCEEDED(hr); iterConverters++) - { - hr = (*iterConverters)->ConvertPrintTicketToDevMode(pPrintTicket, cbDevmode, pDevmode, cbDrvPrivateSize, pPrivateDevmode); - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDSmplPTProvider::ConvertDevModeToPrintTicket - -Routine Description: - - Unidrv will call the routine with an Input PrintTicket that is populated - with public and Unidrv private features. For those features in the GPD that - Unidrv does not understand, it puts them in the PT under the private namespace - (either specified by the plug-in through QueryDeviceDefaultNamespace or created - by itself). It is the plug-in's responsibility to read the corresponding features - from the input PT and put them in public printschema namespace, so that any higher - level application making use of a PrintTicket can read and interpret these settings. - - This routine merely passes the call on to the individual feature handlers. - - -Arguments: - - cbDevmode - size in bytes of input full devmode - pDevmode - pointer to input full devmode buffer - cbDrvPrivateSize - buffer size in bytes of plug-in private devmode - pPrivateDevmode - pointer to plug-in private devmode buffer - pPrintTicket - pointer to input PrintTicket - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CXDSmplPTProvider::ConvertDevModeToPrintTicket( - ULONG cbDevmode, - _Inout_updates_bytes_(cbDevmode) - PDEVMODE pDevmode, - ULONG cbDrvPrivateSize, - _Inout_ PVOID pPrivateDevmode, - _Inout_ IXMLDOMDocument2* pPrintTicket - ) -{ - HRESULT hr = S_OK; - - // - // Validate parameters - // - if (SUCCEEDED(hr = CHECK_POINTER(pDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrivateDevmode, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pPrintTicket, E_POINTER))) - { - if (cbDevmode < sizeof(DEVMODE) || - cbDrvPrivateSize == 0) - { - hr = E_INVALIDARG; - } - } - - try - { - if (SUCCEEDED(hr)) - { - // - // Iterate over all PrintTicket feature converters letting them - // provide the conversion - // - DMPTConvCollection::iterator iterConverters = m_vectFtrDMPTConverters.begin(); - - for (; iterConverters != m_vectFtrDMPTConverters.end() && SUCCEEDED(hr); iterConverters++) - { - hr = (*iterConverters)->ConvertDevModeToPrintTicket(cbDevmode, pDevmode, cbDrvPrivateSize, pPrivateDevmode, pPrintTicket); - } - - // - // Delete all the private features generated by the Unidrv parser from the GPD. - // These are not required in the PrintTicket as they are only used to control - // features in the public PrintSchema and have no meaning outside the config - // module. - // - if (SUCCEEDED(hr)) - { - CPTHandler ptHandler(pPrintTicket); - hr = ptHandler.DeletePrivateFeatures(m_bstrPrivateNS); - } - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDSmplPTProvider::CompletePrintCapabilities - -Routine Description: - - Unidrv calls this routine with an input Device Capabilities Document - that is partially populated with Device capabilities information - filled in by Unidrv for features that it understands. The plug-in - needs to read any private features in the input PrintTicket, delete - them and add them back under Printschema namespace so that higher - level applications can understand them and make use of them. - - The XPSDrv sample driver does not define any private device capabilities - so this method merely returns S_OK - -Arguments: - - pPrintTicket - pointer to input PrintTicket - pCapabilities - pointer to Device Capabilities Document. - -Return Value: - - HRESULT - S_OK - Always - ---*/ -HRESULT STDMETHODCALLTYPE -CXDSmplPTProvider::CompletePrintCapabilities( - _In_opt_ IXMLDOMDocument2* pPrintTicket, - _Inout_ IXMLDOMDocument2* pPrintCapabilities - ) -{ - HRESULT hr = S_OK; - - // - // Validate parameters - // - if (SUCCEEDED(hr = CHECK_POINTER(pPrintCapabilities, E_POINTER))) - { - try - { - // - // Iterate over all PrintTicket feature converters letting them - // provide the conversion - // - DMPTConvCollection::iterator iterConverters = m_vectFtrDMPTConverters.begin(); - - for (; iterConverters != m_vectFtrDMPTConverters.end() && SUCCEEDED(hr); iterConverters++) - { - hr = (*iterConverters)->CompletePrintCapabilities(pPrintTicket, pPrintCapabilities); - } - - // - // Delete all the private features generated by the Unidrv parser from the GPD. - // These are not required in the PrintCapabilities as they are only used to control - // features in the public PrintSchema and have no meaning outside the config - // module. - // - if (SUCCEEDED(hr)) - { - CPCHandler pcHandler(pPrintCapabilities); - hr = pcHandler.DeletePrivateFeatures(m_bstrPrivateNS); - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDSmplPTProvider::ExpandIntentOptions - -Routine Description: - - As part of its Merge and Validate Procedure, the Unidrv/Postscript driver - will call this routine to give the plug-in a chance to expand options - which represent intent into their individual settings in other features - in the PrintTicket. This has two important effects: the client sees the - results of the intent expansion, and unidrv resolves constraints against - the individual features which are affected by the intent. - - The XPSDrv sample driver plug-in does not support any intent features, therefore - simply returns S_OK. - -Arguments: - - pPrintTicket - Pointer to input PrintTicket. - -Return Value: - - HRESULT - S_OK - Always - ---*/ -HRESULT STDMETHODCALLTYPE -CXDSmplPTProvider::ExpandIntentOptions( - _Inout_ IXMLDOMDocument2 * - ) -{ - return S_OK; -} - -/*++ - -Routine Name: - - CXDSmplPTProvider::ValidatePrintTicket - -Routine Description: - - The plug-in might need to delete any feature under private namespace - from input PT that are also in the public namespace because of Merge - and Validate. - - The Validate method should also perform any conflict resolution if - necessary looking at the settings made in public and unidrv private - part of PrintTicket, to make sure that the resultant PrintTicket is a - valid one, and has all constraints resolved. - - This routine merely passes the validate call on to the feature handlers - -Arguments: - - pPrintTicket - Pointer to input PrintTicket. - -Return Value: - - HRESULT - S_NO_CONFLICT/S_CONFLICT_RESOLVED - On success - E_* - On error - ---*/ -HRESULT STDMETHODCALLTYPE -CXDSmplPTProvider::ValidatePrintTicket( - _Inout_ IXMLDOMDocument2* pPrintTicket - ) -{ - HRESULT hr = S_NO_CONFLICT; - - // - // Validate parameters - // - if (pPrintTicket != NULL) - { - try - { - // - // Iterate over all PrintTicket feature converters letting them - // provide the validation - // - DMPTConvCollection::iterator iterConverters = m_vectFtrDMPTConverters.begin(); - - for (; iterConverters != m_vectFtrDMPTConverters.end() && SUCCEEDED(hr); iterConverters++) - { - HRESULT hrConverter = (*iterConverters)->ValidatePrintTicket(pPrintTicket); - - if (FAILED(hrConverter) || - hrConverter == static_cast(S_CONFLICT_RESOLVED)) - { - hr = hrConverter; - } - } - } - catch (...) - { - hr = E_FAIL; - } - } - else - { - hr = E_POINTER; - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDSmplPTProvider::DeleteConverters - -Routine Description: - - This routine cleans up the vector of DM <-> PT converters. - -Arguments: - - NONE - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDSmplPTProvider::DeleteConverters( - VOID - ) -{ - HRESULT hr = S_OK; - - try - { - while (!m_vectFtrDMPTConverters.empty()) - { - if (m_vectFtrDMPTConverters.back() != NULL) - { - delete m_vectFtrDMPTConverters.back(); - m_vectFtrDMPTConverters.back() = NULL; - } - - m_vectFtrDMPTConverters.pop_back(); - } - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - ERR_ON_HR(hr); - return hr; -} - -// -// Use __drv_aliasesMem annotation to avoid PREfast warning 28197: Possibly leaking memory, -// -HRESULT -// Prefast warning 28194: The function was declared as aliasing the value in variable and exited without doing so. -// We suppress this false positive because STL vector does not have annotation, and we know the pointer has been saved -// to STL vector, which is released in DeleteConverters(). -#pragma warning(suppress: 28194) -CXDSmplPTProvider::AddConverter( - _In_opt_ __drv_aliasesMem IFeatureDMPTConvert *pHandler - ) -{ - HRESULT hr = CHECK_POINTER(pHandler, E_OUTOFMEMORY); - - if (SUCCEEDED(hr)) - { - m_vectFtrDMPTConverters.push_back(pHandler); - } - - return hr; -} diff --git a/print/XPSDrvSmpl/src/ui/xdsmplptprov.h b/print/XPSDrvSmpl/src/ui/xdsmplptprov.h deleted file mode 100644 index 3286944f..00000000 --- a/print/XPSDrvSmpl/src/ui/xdsmplptprov.h +++ /dev/null @@ -1,124 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdsmplptprov.h - -Abstract: - - Definition of the PrintTicket provider plugin. This is responsible for - handling PrintTicket features that are too complex for the GPD->PrintTicket - automapping facility. - ---*/ - -#pragma once - -#include "cunknown.h" -#include "schema.h" -#include "ftrdmptcnv.h" - -typedef vector DMPTConvCollection; - -class CXDSmplPTProvider : public CUnknown -{ -public: - CXDSmplPTProvider(); - - virtual ~CXDSmplPTProvider(); - - // - // IPrintOemPrintTicketProvider methods - // - virtual HRESULT STDMETHODCALLTYPE - GetSupportedVersions( - _In_ HANDLE hPrinter, - _Outptr_result_buffer_(*pcVersions) INT* ppVersions[], - _Out_ INT* pcVersions - ); - - virtual HRESULT STDMETHODCALLTYPE - BindPrinter( - _In_ HANDLE hPrinter, - INT version, - _Out_ POEMPTOPTS pOptions, - _Out_ INT* pcNamespaces, - _Outptr_result_buffer_maybenull_(*pcNamespaces) BSTR** ppNamespaces - ); - - virtual HRESULT STDMETHODCALLTYPE - PublishPrintTicketHelperInterface( - _In_ IUnknown* pHelper - ); - - virtual HRESULT STDMETHODCALLTYPE - QueryDeviceDefaultNamespace( - _Out_ BSTR* pbstrNamespaceUri - ); - - virtual HRESULT STDMETHODCALLTYPE - ConvertPrintTicketToDevMode( - _In_ IXMLDOMDocument2* pPrintTicket, - ULONG cbDevmode, - _Inout_updates_bytes_(cbDevmode) - PDEVMODE pDevmode, - ULONG cbDrvPrivateSize, - _Inout_ PVOID pPrivateDevmode - ); - - virtual HRESULT STDMETHODCALLTYPE - ConvertDevModeToPrintTicket( - ULONG cbDevmode, - _Inout_updates_bytes_(cbDevmode) - PDEVMODE pDevmode, - ULONG cbDrvPrivateSize, - _Inout_ PVOID pPrivateDevmode, - _Inout_ IXMLDOMDocument2* pPrintTicket - ); - - virtual HRESULT STDMETHODCALLTYPE - CompletePrintCapabilities( - _In_opt_ IXMLDOMDocument2* pPrintTicket, - _Inout_ IXMLDOMDocument2* pCapabilities - ); - - virtual HRESULT STDMETHODCALLTYPE - ExpandIntentOptions( - _Inout_ IXMLDOMDocument2* pPrintTicket - ); - - virtual HRESULT STDMETHODCALLTYPE - ValidatePrintTicket( - _Inout_ IXMLDOMDocument2* pPrintTicket - ); - -private: - HRESULT - DeleteConverters( - VOID - ); - - HRESULT - AddConverter( - _In_opt_ __drv_aliasesMem IFeatureDMPTConvert* pHandler - ); - -private: - HANDLE m_hPrinterCached; - - CComPtr m_pCoreHelper; - - DMPTConvCollection m_vectFtrDMPTConverters; - - CComBSTR m_bstrPrivateNS; -}; - diff --git a/print/XPSDrvSmpl/src/ui/xdsmplui.cpp b/print/XPSDrvSmpl/src/ui/xdsmplui.cpp deleted file mode 100644 index b41116a6..00000000 --- a/print/XPSDrvSmpl/src/ui/xdsmplui.cpp +++ /dev/null @@ -1,1018 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdsmplui.cpp - -Abstract: - - Implementation of the UI plugin. This is responsible for initialising and maintaining - the property pages used in the XPSDrv feature sample UI. - ---*/ - -#include "precomp.h" -#include "debug.h" -#include "globals.h" -#include "xdexcept.h" -#include "xdstring.h" -#include "xdsmplui.h" -#include "colppg.h" -#include "wmppg.h" -#include "ftrppg.h" -#include "UIProperties.h" - -/*++ - -Routine Name: - - CXDSmplUI::CXDSmplUI - -Routine Description: - - CXDSmplUI class constructor. - Creates a handler class object for every property page added in Unidrv UI Plug-in. - Each of these handlers is stored in a collection. - - -Arguments: - - None - -Return Value: - - None - ---*/ -CXDSmplUI::CXDSmplUI() : - CUnknown(IID_IPrintOemUI), - m_pDriverUIHelp(NULL), - m_pOemCUIPParam(NULL), - m_pUIProperties(NULL) -{ -} - -/*++ - -Routine Name: - - CXDSmplUI::~CXDSmplUI - -Routine Description: - - CXDSmplUI class destructor. - -Arguments: - - None - -Return Value: - - None. - ---*/ -CXDSmplUI::~CXDSmplUI() -{ - DestroyPropPages(); -} - -/*++ - -Routine Name: - - CXDSmplUI::PublishDriverInterface - -Routine Description: - - The PublishDriverInterface method allows a user interface plug-in to obtain - the Unidrv driver's IPrintOemDriverUI interface. - -Arguments: - - pIUnknown - Caller-supplied pointer to the IUnknown interface of the driver's - IPrintOemDriverUI COM Interface. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDSmplUI::PublishDriverInterface( - _In_ IUnknown* pIUnknown - ) -{ - HRESULT hr = E_FAIL; - PVOID pInterface = NULL; - - if (m_pDriverUIHelp == NULL && - SUCCEEDED(hr = pIUnknown->QueryInterface(IID_IPrintOemDriverUI, &pInterface))) - { - m_pDriverUIHelp = reinterpret_cast(pInterface); - hr = S_OK; - } - - return hr; -} - -/*++ - -Routine Name: - - CXDSmplUI::GetInfo - -Routine Description: - - Unidrv will call this routine to obtain identification information. - -Arguments: - - dwMode - Supported modes are OEMGI_GETSIGNATURE and OEMGI_GETVERSION. - pBuffer - Caller-supplied pointer to memory allocated to receive the information specified by dwMode. - cbSize - Caller-supplied size of the buffer pointed to by pBuffer. - pcbNeeded - Caller-supplied pointer to a location to receive the number of bytes written into the buffer pointed to by pBuffer. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDSmplUI::GetInfo( - _In_ DWORD dwMode, - _Out_writes_bytes_(cbSize) PVOID pBuffer, - _In_ DWORD cbSize, - _Out_ PDWORD pcbNeeded - ) -{ - HRESULT hr = S_OK; - - if ((NULL == pcbNeeded) || - ((OEMGI_GETSIGNATURE != dwMode) && - (OEMGI_GETVERSION != dwMode) && - (OEMGI_GETREQUESTEDHELPERINTERFACES != dwMode))) - { - SetLastError(ERROR_INVALID_PARAMETER); - hr = E_INVALIDARG; - } - else - { - *pcbNeeded = sizeof(DWORD); - - if ((cbSize < *pcbNeeded) || - (NULL == pBuffer)) - { - SetLastError(ERROR_INSUFFICIENT_BUFFER); - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - else - { - switch (dwMode) - { - case OEMGI_GETSIGNATURE: - { - *reinterpret_cast(pBuffer) = OEM_SIGNATURE; - } - break; - - case OEMGI_GETVERSION: - { - *reinterpret_cast(pBuffer) = OEM_VERSION; - } - break; - - default: - { - *pcbNeeded = 0; - hr = E_NOTIMPL; - } - break; - } - } - } - - ERR_ON_HR_EXC(hr, E_NOTIMPL); - return hr; -} - -/*++ - -Routine Name: - - CXDSmplUI::DevMode - -Routine Description: - - Performs operation on UI Plugins Private DevMode Members. - Called via IPrintOemUI::DevMode - -Arguments: - - dwMode - Supported modes are OEMDM_SIZE, OEMDM_DEFAULT, OEMDM_CONVERT and OEMDM_MERGE. - pOemDMParam - Caller-supplied pointer to an OEMDMPARAM structure. - Dependent on which dwMode is set. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDSmplUI::DevMode( - _In_ DWORD dwMode, - _In_ POEMDMPARAM pOemDMParam - ) -{ - HRESULT hr = S_OK; - - if (SUCCEEDED(hr = CHECK_POINTER(pOemDMParam, E_POINTER))) - { - if ((OEMDM_SIZE != dwMode) && - (OEMDM_DEFAULT != dwMode) && - (OEMDM_CONVERT != dwMode)&& - (OEMDM_MERGE != dwMode)) - { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) - { - switch (dwMode) - { - // - // The method should return the size of the memory allocation needed to store the UI plugin Private DEVMODE. - // - case OEMDM_SIZE: - { - pOemDMParam->cbBufSize = sizeof(OEMDEV); - } - break; - - // - // Should fill the Private DEVMODE with the default values. - // - case OEMDM_DEFAULT: - { - try - { - if (SUCCEEDED(hr = CHECK_POINTER(pOemDMParam->pOEMDMOut, E_POINTER))) - { - CUIProperties oemDevOut = CUIProperties(reinterpret_cast(pOemDMParam->pOEMDMOut)); - - hr = oemDevOut.SetDefaults(); - } - } - catch (CXDException &e) - { - hr = e; - } - catch (...) - { - hr = E_FAIL; - } - } - break; - - // - // The method should convert private DEVMODE members to the current version, if necessary. - // - case OEMDM_CONVERT: - { - try - { - if (SUCCEEDED(hr = CHECK_POINTER(pOemDMParam->pOEMDMOut, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pOemDMParam->pOEMDMIn, E_POINTER))) - { - CUIProperties oemDevIn = CUIProperties(reinterpret_cast(pOemDMParam->pOEMDMIn)); - CUIProperties oemDevOut = CUIProperties(reinterpret_cast(pOemDMParam->pOEMDMOut)); - - hr = oemDevOut.Convert(&oemDevIn); - } - } - catch (CXDException &e) - { - hr = e; - } - catch (...) - { - hr = E_FAIL; - } - } - break; - - // - //The method should validate the information contained in private DEVMODE members and merge validated values into a private DEVMODE structure containing default values - // - case OEMDM_MERGE: - { - try - { - if (SUCCEEDED(hr = CHECK_POINTER(pOemDMParam->pOEMDMOut, E_POINTER)) && - SUCCEEDED(hr = CHECK_POINTER(pOemDMParam->pOEMDMIn, E_POINTER))) - { - CUIProperties oemDevIn = CUIProperties(reinterpret_cast(pOemDMParam->pOEMDMIn)); - CUIProperties oemDevOut = CUIProperties(reinterpret_cast(pOemDMParam->pOEMDMOut)); - - if (SUCCEEDED(hr = oemDevOut.Convert(&oemDevIn))) - { - hr = oemDevOut.Validate(); - } - } - } - catch (CXDException &e) - { - hr = e; - } - catch (...) - { - hr = E_FAIL; - } - } - break; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDSmplUI::CommonUIProp - -Routine Description: - - This method allows a user interface plug-in to modify an existing printer property sheet page. - -Arguments: - - dwMode - Supported modes are OEMCUIP_DOCPROP and OEMCUIP_PRNPROP. - pOemCUIPParam - Caller-supplied pointer to an OEMCUIPPARAM structure. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDSmplUI::CommonUIProp( - _In_ DWORD dwMode, - _In_ POEMCUIPPARAM pOemCUIPParam - ) -{ - HRESULT hr = S_OK; - - if (dwMode == OEMCUIP_PRNPROP) - { - // - // We do not implement any printer property sheets - // - hr = E_NOTIMPL; - } - else if (dwMode != OEMCUIP_DOCPROP) - { - // - // Unknown mode encountered - // - hr = E_INVALIDARG; - } - - if (SUCCEEDED(hr) && - SUCCEEDED(hr = CHECK_POINTER(pOemCUIPParam, E_POINTER))) - { - // - // Store the OEMCUIPPARAM pointer so we can modify data and OPTITEMS. - // - m_pOemCUIPParam = pOemCUIPParam; - - // - // The pDrvOptItems member is NULL on the first call through to CommonUIProp(). - // - if (pOemCUIPParam->pDrvOptItems != NULL) - { - try - { - CUIProperties uiProperties; - hr = uiProperties.HideOptItems(pOemCUIPParam); - } - catch (CXDException& e) - { - hr = e; - } - catch (...) - { - hr = E_FAIL; - } - } - } - - ERR_ON_HR_EXC(hr, E_NOTIMPL); - return hr; -} - -/*++ - -Routine Name: - - CXDSmplUI::DocumentPropertySheets - -Routine Description: - - This method allows a user interface plug-in to append a new page to a printer device's - document property sheet. - -Arguments: - - pPSUIInfo - Caller-supplied pointer to a PROPSHEETUI_INFO structure. - lParam - Caller-supplied value that depends on the reason value in pPSUIInfo->Reason. - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDSmplUI::DocumentPropertySheets( - _In_ PPROPSHEETUI_INFO pPSUIInfo, - _In_ LPARAM lParam - ) -{ - HRESULT hr = S_OK; - - if (pPSUIInfo == NULL || - pPSUIInfo->Version != PROPSHEETUI_INFO_VERSION) - { - SetLastError(ERROR_INVALID_PARAMETER); - hr = E_INVALIDARG; - } - else - { - switch (pPSUIInfo->Reason) - { - case PROPSHEETUI_REASON_INIT: - { - // - // We need to report the OEMCUIPPARAM structure to the prop sheet - // so ASSERT it is valid. We will let the prop sheet decide if it - // is critical to have a valid pointer or not - // - ASSERTMSG(m_pOemCUIPParam != NULL, "NULL pointer to OEMCUIPPARAM structure.\n"); - - try - { - // - // Create the UI properties object - // - m_pUIProperties = new(std::nothrow) CUIProperties(reinterpret_cast(m_pOemCUIPParam->pOEMDM)); - - // - // Create the property pages for the document property sheet - // - if (SUCCEEDED(hr = CHECK_POINTER(m_pUIProperties, E_OUTOFMEMORY)) && - SUCCEEDED(hr = CreatePropertyPages())) - { - DocPropertyPageMap::iterator iterPropSheets = m_vectPropPages.begin(); - - // - // Make sure the helper interfaces and the OEMCUIPPARAM structure - // are published to the page first. This allows the prop sheet to - // propogate these interfaces to the UI control objects when initializing - // - while (iterPropSheets != m_vectPropPages.end() && - SUCCEEDED(hr = CHECK_POINTER(*iterPropSheets, E_FAIL)) && - SUCCEEDED(hr = (*iterPropSheets)->SetPrintOemDriverUI(m_pDriverUIHelp)) && - SUCCEEDED(hr = (*iterPropSheets)->SetOemCUIPParam(m_pOemCUIPParam))&& - SUCCEEDED(hr = (*iterPropSheets)->SetUIProperties(m_pUIProperties))&& - SUCCEEDED(hr = (*iterPropSheets)->PropPageInit(pPSUIInfo))) - { - iterPropSheets++; - } - } - } - catch (CXDException &e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - } - break; - - case PROPSHEETUI_REASON_GET_INFO_HEADER: - { - if (SUCCEEDED(hr = CHECK_POINTER(pPSUIInfo, E_POINTER))) - { - pPSUIInfo->Result = TRUE; - } - } - break; - - case PROPSHEETUI_REASON_DESTROY: - { - if (SUCCEEDED(hr = CHECK_POINTER(pPSUIInfo, E_POINTER))) - { - pPSUIInfo->Result = TRUE; - } - } - break; - - case PROPSHEETUI_REASON_SET_RESULT: - { - if (SUCCEEDED(hr = CHECK_POINTER(pPSUIInfo, E_POINTER))) - { - pPSUIInfo->Result = reinterpret_cast(lParam)->Result; - } - } - break; - - case PROPSHEETUI_REASON_GET_ICON: - { - if (SUCCEEDED(hr = CHECK_POINTER(pPSUIInfo, E_POINTER))) - { - // - // No icon - // - pPSUIInfo->Result = FALSE; - } - } - break; - - default: - { - hr = E_FAIL; - } - break; - } - } - - ERR_ON_HR(hr); - return hr; -} - -/*++ - -Routine Name: - - CXDSmplUI::DevicePropertySheets - -Routine Description: - - This method allows a user interface plug-in to append a new page to a printer device's - printer property sheet. - -Arguments: - - None referenced. - -Return Value: - - HRESULT - E_NOTIMPL - Method not implemented - ---*/ -HRESULT -CXDSmplUI::DevicePropertySheets( - _In_ PPROPSHEETUI_INFO, - _In_ LPARAM - ) -{ - return E_NOTIMPL; -} - -/*++ - -Routine Name: - - CXDSmplUI::DevQueryPrintEx - -Routine Description: - - This method allows a user interface plug-in to help determine if a print job is printable. - -Arguments: - - None referenced. - -Return Value: - - HRESULT - E_NOTIMPL - Method not implemented - ---*/ -HRESULT -CXDSmplUI::DevQueryPrintEx( - _In_ POEMUIOBJ, - _In_ PDEVQUERYPRINT_INFO, - _In_ PDEVMODE, - _In_ PVOID - ) -{ - return E_NOTIMPL; -} - -/*++ - -Routine Name: - - CXDSmplUI::DeviceCapabilities - -Routine Description: - - This method enables a user interface plug-in to specify customized device capabilities. - -Arguments: - - None referenced. - -Return Value: - - HRESULT - E_NOTIMPL - Method not implemented - ---*/ -HRESULT -CXDSmplUI::DeviceCapabilities( - _In_ POEMUIOBJ, - _In_ HANDLE, - _In_z_ PWSTR, - _In_ WORD, - _In_ PVOID, - _In_ PDEVMODE, - _In_ PVOID, - _In_ DWORD, - _In_ DWORD* - ) -{ - return E_NOTIMPL; -} - -/*++ - -Routine Name: - - CXDSmplUI::UpgradePrinter - -Routine Description: - - This method allows a user interface plug-in to upgrade device option values - that are stored in the registry. - -Arguments: - - None referenced. - -Return Value: - - HRESULT - E_NOTIMPL - Method not implemented - ---*/ -HRESULT -CXDSmplUI::UpgradePrinter( - _In_ DWORD, - _In_ PBYTE - ) -{ - return E_NOTIMPL; -} - -/*++ - -Routine Name: - - CXDSmplUI::PrinterEvent - -Routine Description: - - This method allows a user interface plug-in to process printer events. - -Arguments: - - None referenced. - -Return Value: - - HRESULT - E_NOTIMPL - Method not implemented - ---*/ -HRESULT -CXDSmplUI::PrinterEvent( - _In_ PWSTR , - _In_ INT , - _In_ DWORD , - _In_ LPARAM - ) -{ - return E_NOTIMPL; -} - -/*++ - -Routine Name: - - CXDSmplUI::DriverEvent - -Routine Description: - - The printer driver's DrvDriverEvent function calls a user interface plug-in's - IPrintOemUI::DriverEvent method for additional processing of printer driver events. - -Arguments: - - None referenced. - -Return Value: - - HRESULT - E_NOTIMPL - Method not implemented - ---*/ -HRESULT -CXDSmplUI::DriverEvent( - _In_ DWORD , - _In_ DWORD , - _In_reads_(_Inexpressible_("varies")) PBYTE , - _In_ LPARAM - ) -{ - return E_NOTIMPL; -} - -/*++ - -Routine Name: - - CXDSmplUI::QueryColorProfile - -Routine Description: - - This method allows a user interface plug-in to specify an ICC profile to use for color management. - -Arguments: - - None referenced. - -Return Value: - - HRESULT - E_NOTIMPL - Method not implemented - ---*/ -HRESULT -CXDSmplUI::QueryColorProfile( - _In_ HANDLE , - _In_ POEMUIOBJ , - _In_ PDEVMODE , - _In_ PVOID , - _In_ ULONG , - _Out_writes_(*pcbProfileData) VOID* , - _Inout_ ULONG* pcbProfileData, - _Out_ FLONG* - ) -{ - UNREFERENCED_PARAMETER(pcbProfileData); - return E_NOTIMPL; -} - -/*++ - -Routine Name: - - CXDSmplUI::FontInstallerDlgProc - -Routine Description: - - A user interface plug-in's IPrintOemUI::FontInstallerDlgProc method replaces - the Unidrv font installer's user interface. - -Arguments: - - None referenced. - -Return Value: - - HRESULT - E_NOTIMPL - Method not implemented - ---*/ -HRESULT -CXDSmplUI::FontInstallerDlgProc( - _In_ HWND , - _In_ UINT , - _In_ WPARAM , - _In_ LPARAM - ) -{ - return E_NOTIMPL; -} - -/*++ - -Routine Name: - - CXDSmplUI::UpdateExternalFonts - -Routine Description: - - This allows a user interface plug-in to update a printer's Unidrv Font Format Files (.uff file). - -Arguments: - - None referenced. - -Return Value: - - HRESULT - E_NOTIMPL - Method not implemented - ---*/ -HRESULT -CXDSmplUI::UpdateExternalFonts( - _In_ HANDLE, - _In_ HANDLE, - _In_z_ PWSTR - ) -{ - return E_NOTIMPL; -} - -/*++ - -Routine Name: - - CXDSmplUI::CreatePropertyPages - -Routine Description: - - Creates all property page handler objects. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -HRESULT -CXDSmplUI::CreatePropertyPages( - VOID - ) -{ - HRESULT hr = S_OK; - CDocPropPage* pPropPage = NULL; - -// -// This Prefast warning indicates that memory could be leaked -// in the event of an exception. We suppress this false positive because we -// know that the local try/catch block will clean up a single -// CDocPropPage, and the destructor will clean up any that are -// successfully added to the vector. -// -#pragma prefast(push) -#pragma prefast(disable:__WARNING_ALIASED_MEMORY_LEAK_EXCEPTION) - - try - { - // - // Populate the property page vector - // - pPropPage = new(std::nothrow) CColorPropPage(); - - hr = AddPropPage(pPropPage); - - if (SUCCEEDED(hr)) - { - pPropPage = new(std::nothrow) CWatermarkPropPage(); - hr = AddPropPage(pPropPage); - } - - if (SUCCEEDED(hr)) - { - pPropPage = new(std::nothrow) CFeaturePropPage(); - hr = AddPropPage(pPropPage); - } - } - catch (CXDException &e) - { - hr = e; - } - catch (exception& DBG_ONLY(e)) - { - ERR(e.what()); - hr = E_FAIL; - } - - if (FAILED(hr)) - { - // - // If we successfully created a property page but failed to push it onto - // the vector we need to free the allocated property page - // - if (pPropPage != NULL) - { - delete pPropPage; - pPropPage = NULL; - } - } - -#pragma prefast(pop) - - return hr; -} - -/*++ - -Routine Name: - - CXDSmplUI::DestroyPropPages - -Routine Description: - - Destroy all property page handler classes that have been added into the collection. - -Arguments: - - None - -Return Value: - - HRESULT - S_OK - On success - E_* - On error - ---*/ -inline VOID -CXDSmplUI::DestroyPropPages( - VOID - ) -{ - while (!m_vectPropPages.empty()) - { - if (m_vectPropPages.back() != NULL) - { - delete m_vectPropPages.back(); - m_vectPropPages.back() = NULL; - } - - m_vectPropPages.pop_back(); - } - - if (m_pUIProperties != NULL) - { - delete m_pUIProperties; - m_pUIProperties = NULL; - } -} - -// -// Use __drv_aliasesMem annotation to avoid PREfast warning 28197: Possibly leaking memory, -// -HRESULT -// Prefast warning 28194: The function was declared as aliasing the value in variable and exited without doing so. -// We suppress this false positive because STL vector does not have annotation, and we know the pointer has been saved -// to STL vector, which is released in DestroyPropPages(). -#pragma warning(suppress: 28194) -CXDSmplUI::AddPropPage( - _In_opt_ __drv_aliasesMem CDocPropPage* pPropPage - ) -{ - HRESULT hr = CHECK_POINTER(pPropPage, E_OUTOFMEMORY); - - if (SUCCEEDED(hr)) - { - m_vectPropPages.push_back(pPropPage); - } - - return hr; -} - diff --git a/print/XPSDrvSmpl/src/ui/xdsmplui.def b/print/XPSDrvSmpl/src/ui/xdsmplui.def deleted file mode 100644 index dccec9d5..00000000 --- a/print/XPSDrvSmpl/src/ui/xdsmplui.def +++ /dev/null @@ -1,23 +0,0 @@ -; -; Copyright (c) 2005 Microsoft Corporation -; -; All rights reserved. -; -; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -; ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -; PARTICULAR PURPOSE. -; -; File Name: -; -; xdsmplui.def -; -; Abstract: -; -; XPSDrv feature sample config plugin module definition file -; - -LIBRARY XDSmplUI -EXPORTS DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE - diff --git a/print/XPSDrvSmpl/src/ui/xdsmplui.h b/print/XPSDrvSmpl/src/ui/xdsmplui.h deleted file mode 100644 index c175de88..00000000 --- a/print/XPSDrvSmpl/src/ui/xdsmplui.h +++ /dev/null @@ -1,161 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -All rights reserved. - -THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -PARTICULAR PURPOSE. - -File Name: - - xdsmplui.h - -Abstract: - - Definition of the UI plugin. This is responsible for initialising and maintining - the property pages used in the XPSDrv feature sample UI. - ---*/ - -#pragma once - -#include "cunknown.h" -#include "docppg.h" - -typedef std::vector DocPropertyPageMap; - -class CXDSmplUI : public CUnknown -{ -public: - // - // Construction and Destruction - // - CXDSmplUI(); - - virtual ~CXDSmplUI(); - - // - // IPrintOemUI methods - // - STDMETHOD(PublishDriverInterface)(THIS_ - _In_ IUnknown* pIUnknown - ); - - STDMETHOD(GetInfo)(THIS_ - _In_ DWORD dwMode, - _Out_writes_bytes_(cbSize) PVOID pBuffer, - _In_ DWORD cbSize, - _Out_ PDWORD pcbNeeded - ); - - STDMETHOD(DevMode)(THIS_ - _In_ DWORD dwMode, - _In_ POEMDMPARAM pOemDMParam - ); - - STDMETHOD(CommonUIProp)(THIS_ - _In_ DWORD dwMode, - _In_ POEMCUIPPARAM pOemCUIPParam - ); - - STDMETHOD(DocumentPropertySheets)(THIS_ - _In_ PPROPSHEETUI_INFO pPSUIInfo, - _In_ LPARAM lParam - ); - - STDMETHOD(DevicePropertySheets)(THIS_ - _In_ PPROPSHEETUI_INFO pPSUIInfo, - _In_ LPARAM lParam - ); - - STDMETHOD(DevQueryPrintEx)(THIS_ - _In_ POEMUIOBJ poemuiobj, - _In_ PDEVQUERYPRINT_INFO pDQPInfo, - _In_ PDEVMODE pPublicDM, - _In_ PVOID pOEMDM - ); - - STDMETHOD(DeviceCapabilities)(THIS_ - _In_ POEMUIOBJ poemuiobj, - _In_ HANDLE hPrinter, - _In_z_ PWSTR pDeviceName, - _In_ WORD wCapability, - _In_ PVOID pOutput, - _In_ PDEVMODE pPublicDM, - _In_ PVOID pOEMDM, - _In_ DWORD dwOld, - _In_ DWORD* dwResult - ); - - STDMETHOD(UpgradePrinter)(THIS_ - _In_ DWORD dwLevel, - _In_ PBYTE pDriverUpgradeInfo - ); - - STDMETHOD(PrinterEvent)(THIS_ - _In_ PWSTR pPrinterName, - _In_ INT iDriverEvent, - _In_ DWORD dwFlags, - _In_ LPARAM lParam - ); - - STDMETHOD(DriverEvent)(THIS_ - _In_ DWORD dwDriverEvent, - _In_ DWORD dwLevel, - _In_reads_(_Inexpressible_("varies")) PBYTE pDriverInfo, - _In_ LPARAM lParam - ); - - STDMETHOD(QueryColorProfile)(THIS_ - _In_ HANDLE hPrinter, - _In_ POEMUIOBJ poemuiobj, - _In_ PDEVMODE pPublicDM, - _In_ PVOID pOEMDM, - _In_ ULONG ulReserved, - _Out_writes_(*pcbProfileData) VOID* pvProfileData, - _Inout_ ULONG* pcbProfileData, - _Out_ FLONG* pflProfileData - ); - - STDMETHOD(FontInstallerDlgProc)(THIS_ - _In_ HWND hWnd, - _In_ UINT usMsg, - _In_ WPARAM wParam, - _In_ LPARAM lParam - ); - - STDMETHOD(UpdateExternalFonts)(THIS_ - _In_ HANDLE hPrinter, - _In_ HANDLE hHeap, - _In_z_ PWSTR pwstrCartridges - ); - -private: - HRESULT - CreatePropertyPages( - VOID - ); - - HRESULT - AddPropPage( - _In_opt_ __drv_aliasesMem CDocPropPage* pPropPage - ); - - inline VOID - DestroyPropPages( - VOID - ); - -private: - POEMCUIPPARAM m_pOemCUIPParam; - - CUIProperties* m_pUIProperties; - - CComPtr m_pDriverUIHelp; - - DocPropertyPageMap m_vectPropPages; -}; - diff --git a/print/XPSDrvSmpl/src/ui/xdsmplui.vcxproj b/print/XPSDrvSmpl/src/ui/xdsmplui.vcxproj deleted file mode 100644 index 74f727cb..00000000 --- a/print/XPSDrvSmpl/src/ui/xdsmplui.vcxproj +++ /dev/null @@ -1,582 +0,0 @@ - - - - - Debug - ARM - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {7441D7F2-F509-4A47-9404-3EB8653AE037} - $(MSBuildProjectName) - false - true - Debug - Win32 - {84F0AEE3-8A8E-436B-A381-D88F6D804CB0} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - - - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - - - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - - - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - - - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - - - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - - - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - - - MultiThreaded - MultiThreadedDebug - true - Level4 - Sync - - - - xdsmplui - - - xdsmplui - - - xdsmplui - - - xdsmplui - - - xdsmplui - - - xdsmplui - - - xdsmplui - - - xdsmplui - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib;Comdlg32.lib;.\..\debug\$(IntDir)\xdsdbg.lib;.\..\common\$(IntDir)\xdsmplcmn.lib - xdsmplui.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib;Comdlg32.lib;.\..\debug\$(IntDir)\xdsdbg.lib;.\..\common\$(IntDir)\xdsmplcmn.lib - xdsmplui.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib;Comdlg32.lib;.\..\debug\$(IntDir)\xdsdbg.lib;.\..\common\$(IntDir)\xdsmplcmn.lib - xdsmplui.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib;Comdlg32.lib;.\..\debug\$(IntDir)\xdsdbg.lib;.\..\common\$(IntDir)\xdsmplcmn.lib - xdsmplui.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib;Comdlg32.lib;.\..\debug\$(IntDir)\xdsdbg.lib;.\..\common\$(IntDir)\xdsmplcmn.lib - xdsmplui.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib;Comdlg32.lib;.\..\debug\$(IntDir)\xdsdbg.lib;.\..\common\$(IntDir)\xdsmplcmn.lib - xdsmplui.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib;Comdlg32.lib;.\..\debug\$(IntDir)\xdsdbg.lib;.\..\common\$(IntDir)\xdsmplcmn.lib - xdsmplui.def - - - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(PreprocessorDefinitions);USERMODE_DRIVER;_UNICODE;UNICODE - %(PreprocessorDefinitions);PLUGIN_PRINTTICKET - %(AdditionalIncludeDirectories);..\inc;..\debug;..\common;$(DDK_INC_PATH);$(SDK_INC_PATH)\gdiplus - - - %(AdditionalDependencies);kernel32.lib;user32.lib;winspool.lib;ole32.lib;oleaut32.lib;advapi32.lib;msxml6.lib;uuid.lib;Comdlg32.lib;.\..\debug\$(IntDir)\xdsdbg.lib;.\..\common\$(IntDir)\xdsmplcmn.lib - xdsmplui.def - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/XPSDrvSmpl/src/ui/xdsmplui.vcxproj.Filters b/print/XPSDrvSmpl/src/ui/xdsmplui.vcxproj.Filters deleted file mode 100644 index cf11c7f8..00000000 --- a/print/XPSDrvSmpl/src/ui/xdsmplui.vcxproj.Filters +++ /dev/null @@ -1,611 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {2AD80BD3-541F-43F0-BAF3-C9D1407DB40F} - - - h;hpp;hxx;hm;inl;inc;xsd - {1C5775CA-818E-4201-BF0E-79C149173495} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {4155F8D0-42D6-4420-B759-01020F4BFE90} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - - - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - \ No newline at end of file diff --git a/print/XpsRasFilter/README.md b/print/XpsRasFilter/README.md deleted file mode 100644 index 55f637df..00000000 --- a/print/XpsRasFilter/README.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -page_type: sample -description: "Implements an XPSDrv filter that rasterizes fixed pages in an XPS document." -languages: -- cpp -products: -- windows -- windows-wdk ---- - -# XPS Rasterization Filter Service Sample - -This sample implements an XPSDrv filter that rasterizes fixed pages in an XPS document. Hardware vendors can modify this sample to build an XPSDrv filter that produces bitmap images for their printers or other display devices. The sample uses the XPS Rasterization Service that creates rasterizer objects for use by XPSDrv filters. A rasterizer object takes an XPS Object Model (XPS OM) page object and creates a bitmap of a specified region of the page. The sample implements an XPSDrv filter (xpsrasfilter.dll) that can be inserted into the XPS Filter Pipeline. For each fixed page in an XPS document, the sample filter does the following: - -- Uses the XPS rasterization service to create a rasterizer object for the fixed page. - -- Partitions the fixed page into several horizontal bands. - -- Uses the rasterizer object to render each horizontal band as a bitmap image. - -The Print Filter Pipeline is part of the XPS Print Path [Windows Print Path Overview](https://docs.microsoft.com/windows-hardware/drivers/print/windows-print-path-overview). Fixed pages are sent as an XPS data stream from the XPS Spooler to the print filter pipeline. The print filter pipeline manager takes the XPS fixed page, calls each filter in the order defined in the pipeline configuration file, and then sends either Fixed Page OM objects or a data stream to each filter as required. The filters process the data and return either Fixed Page OM objects or a data stream back to the print filter pipeline manager. - -For more information, see [IXpsDocumentProvider](https://docs.microsoft.com/windows-hardware/drivers/ddi/content/filterpipeline/nn-filterpipeline-ixpsdocumentprovider), [IXpsDocumentConsumer](https://docs.microsoft.com/windows-hardware/drivers/ddi/content/filterpipeline/nn-filterpipeline-ixpsdocumentconsumer), [IPrintWriteStream](https://docs.microsoft.com/windows-hardware/drivers/ddi/content/filterpipeline/nn-filterpipeline-iprintwritestream), and [IPrintReadStream](https://docs.microsoft.com/windows-hardware/drivers/ddi/content/filterpipeline/nn-filterpipeline-iprintreadstream). - -As a print filter pipeline service, the XPS Rasterization Service can be loaded into the filter pipeline when the pipeline is initialized by adding a filter service provider tag to the configuration XML file (for example, \). The service is then available to be called by the filters when they are initialized and called by the print filter pipeline manager. - -The XPS Rasterization Service operates as follows: - -- The calling filter initializes an instance of the rasterizer by passing in the XPS OM for the fixed page. - -- The calling filter calls the RasterizeRect method of the rasterizer to render a specified rectangle area of the fixed page. - -- RasterizeRect writes the WIC (Windows Imaging Component) bitmap data to memory. (The address is specified as a parameter to RasterizeRect.) - -The default parameters in this sample are as follows: - -- Letter-sized physical page (can override in print ticket). - -- 0.25-inch margins (creating an 8-inch by 10.5-inch imageable area). - -- Scaling is set to FitApplicationBleedSizeToImageableSize. - -- Destination resolution set to 96 dpi (can override in print ticket). diff --git a/print/XpsRasFilter/XpsRasFilter.sln b/print/XpsRasFilter/XpsRasFilter.sln deleted file mode 100644 index 1c155e19..00000000 --- a/print/XpsRasFilter/XpsRasFilter.sln +++ /dev/null @@ -1,34 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26430.16 -MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xpsrasfilter", "src\xpsrasfilter.vcxproj", "{D8784A15-C959-4CDF-B5B8-A603F347BDA4}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM64 = Debug|ARM64 - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|ARM64 = Release|ARM64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D8784A15-C959-4CDF-B5B8-A603F347BDA4}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {D8784A15-C959-4CDF-B5B8-A603F347BDA4}.Debug|ARM64.Build.0 = Debug|ARM64 - {D8784A15-C959-4CDF-B5B8-A603F347BDA4}.Debug|Win32.ActiveCfg = Debug|Win32 - {D8784A15-C959-4CDF-B5B8-A603F347BDA4}.Debug|Win32.Build.0 = Debug|Win32 - {D8784A15-C959-4CDF-B5B8-A603F347BDA4}.Debug|x64.ActiveCfg = Debug|x64 - {D8784A15-C959-4CDF-B5B8-A603F347BDA4}.Debug|x64.Build.0 = Debug|x64 - {D8784A15-C959-4CDF-B5B8-A603F347BDA4}.Release|ARM64.ActiveCfg = Release|ARM64 - {D8784A15-C959-4CDF-B5B8-A603F347BDA4}.Release|ARM64.Build.0 = Release|ARM64 - {D8784A15-C959-4CDF-B5B8-A603F347BDA4}.Release|Win32.ActiveCfg = Release|Win32 - {D8784A15-C959-4CDF-B5B8-A603F347BDA4}.Release|Win32.Build.0 = Release|Win32 - {D8784A15-C959-4CDF-B5B8-A603F347BDA4}.Release|x64.ActiveCfg = Release|x64 - {D8784A15-C959-4CDF-B5B8-A603F347BDA4}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/print/XpsRasFilter/install/xpsrassmpl-PipelineConfig.xml b/print/XpsRasFilter/install/xpsrassmpl-PipelineConfig.xml deleted file mode 100644 index c391b545..00000000 --- a/print/XpsRasFilter/install/xpsrassmpl-PipelineConfig.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - diff --git a/print/XpsRasFilter/install/xpsrassmpl.gpd b/print/XpsRasFilter/install/xpsrassmpl.gpd deleted file mode 100644 index 0c300802..00000000 --- a/print/XpsRasFilter/install/xpsrassmpl.gpd +++ /dev/null @@ -1,342 +0,0 @@ -*% -*% Copyright (c) 2005 Microsoft Corporation -*% -*% All rights reserved. -*% -*% THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -*% ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -*% THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -*% PARTICULAR PURPOSE. -*% -*% File Name: -*% -*% xpsrassmpl.gpd -*% -*% Abstract: -*% -*% Xps Rasterization Service WDK sample driver install file GPD file. -*% - -*GPDFileVersion: "1.0" -*GPDSpecVersion: "1.0" -*GPDFileName: "xpsrassmpl.gpd" -*Include: "msxpsinc.gpd" -*Include: "StdNames.gpd" -*ModelName: "XPSRas WDK Sample Driver" -*MasterUnits: PAIR(1200, 1200) -*ResourceDLL: "unires.dll" -*PrinterType: PAGE -*MaxCopies: 1 - -*%****************************************************************************** -*% PageMediaSize - Paper Size -*%****************************************************************************** -*Feature: PaperSize -{ - *rcNameID: =PAPER_SIZE_DISPLAY - *DefaultOption: LETTER - - *Option: A3 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 9667 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(13460, 19440) - *PrintableOrigin: PAIR(284, 200) - *CursorOrigin: PAIR(284, 200) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(13628, 19368) - *PrintableOrigin: PAIR(200, 236) - *CursorOrigin: PAIR(200, 19604) - } - } - } - - *Option: A4 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4249 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9352, 13628) - *PrintableOrigin: PAIR(284, 200) - *CursorOrigin: PAIR(284, 200) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(9520, 13556) - *PrintableOrigin: PAIR(200, 236) - *CursorOrigin: PAIR(200, 13792) - } - } - } - - *Option: B4 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 6391 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(11572, 16796) - *PrintableOrigin: PAIR(284, 200) - *CursorOrigin: PAIR(284, 200) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(11740, 16724) - *PrintableOrigin: PAIR(200, 236) - *CursorOrigin: PAIR(200, 16960) - } - } - } - - *Option: B5 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 3198 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(7900, 11140) - *PrintableOrigin: PAIR(352, 300) - *CursorOrigin: PAIR(300, 100) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(7760, 11140) - *PrintableOrigin: PAIR(300, 400) - *CursorOrigin: PAIR(100, 11940) - } - } - } - - *Option: EXECUTIVE - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4109 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(8100, 11500) - *PrintableOrigin: PAIR(300, 300) - *CursorOrigin: PAIR(300, 200) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(8300, 11500) - *PrintableOrigin: PAIR(200, 300) - *CursorOrigin: PAIR(200, 12300) - } - } - } - - *Option: ENV_10 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4109 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(4348, 11000) - *PrintableOrigin: PAIR(300, 200) - *CursorOrigin: PAIR(300, 200) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(4548, 10920) - *PrintableOrigin: PAIR(200, 240) - *CursorOrigin: PAIR(200, 11160) - } - } - } - - *Option: LEGAL - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1692 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 600) - *CursorOrigin: PAIR(180, 300) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 900) - *CursorOrigin: PAIR(180, 16500) - } - } - } - - *Option: LETTER - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1028 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9500, 12500) - *PrintableOrigin: PAIR(400, 400) - *CursorOrigin: PAIR(300, 300) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(9500, 12200) - *PrintableOrigin: PAIR(450, 300) - *CursorOrigin: PAIR(200, 12900) - } - } - } - - *Option: ENV_MONARCH - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4109 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(4048, 8600) - *PrintableOrigin: PAIR(300, 200) - *CursorOrigin: PAIR(300, 200) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(4248, 8520) - *PrintableOrigin: PAIR(200, 240) - *CursorOrigin: PAIR(200, 8760) - } - } - } - - *Option: TABLOID - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4109 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(12000, 19200) - *PrintableOrigin: PAIR(400, 400) - *CursorOrigin: PAIR(400, 400) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(12000, 19200) - *PrintableOrigin: PAIR(400, 600) - *CursorOrigin: PAIR(400, 18000) - } - } - } -} - -*%****************************************************************************** -*% PageOrientation -*%****************************************************************************** -*Feature: Orientation -{ - *rcNameID: =ORIENTATION_DISPLAY - *DefaultOption: PORTRAIT - - *Option: PORTRAIT - { - *rcNameID: =PORTRAIT_DISPLAY - } - - *Option: LANDSCAPE_CC270 - { - *rcNameID: =LANDSCAPE_DISPLAY - } -} - -*%****************************************************************************** -*% Resolution -*%****************************************************************************** -*Feature: Resolution -{ - *rcNameID: =RESOLUTION_DISPLAY - *DefaultOption: DPI600 - - *Option: DPI600 - { - *Name: "600 x 600 " =DOTS_PER_INCH - *DPI: PAIR(600, 600) - *TextDPI: PAIR(600, 600) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - } - - *Option: DPI1200 - { - *Name: "1200 x 1200 " =DOTS_PER_INCH - *DPI: PAIR(1200, 1200) - *TextDPI: PAIR(1200, 1200) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rC" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - } -} - -*%****************************************************************************** -*% Input Bin -*%****************************************************************************** -*Feature: InputBin -{ - *rcNameID: =PAPER_SOURCE_DISPLAY - *DefaultOption: UPPER - *ConcealFromUI?: TRUE - - *Option: UPPER - { - *rcNameID: =UPPER_TRAY_DISPLAY - } -} - - -*%****************************************************************************** -*% Printer Memory -*%****************************************************************************** -*Feature: Memory -{ - *rcNameID: =PRINTER_MEMORY_DISPLAY - *DefaultOption: 32768KB - *Option: 16384KB - { - *Name: "16MB" - *MemoryConfigKB: PAIR(16384, 13950) - } - *Option: 32768KB - { - *Name: "32MB" - *MemoryConfigKB: PAIR(32768, 28350) - } -} - -*%****************************************************************************** -*% Cursor Commands -*%****************************************************************************** -*Command: CmdCR { *Cmd : "<0D>" } -*Command: CmdLF { *Cmd : "<0A>" } -*Command: CmdFF { *Cmd : "<0C>" } - - diff --git a/print/XpsRasFilter/install/xpsrassmpl.inf b/print/XpsRasFilter/install/xpsrassmpl.inf deleted file mode 100644 index d080e428..00000000 Binary files a/print/XpsRasFilter/install/xpsrassmpl.inf and /dev/null differ diff --git a/print/XpsRasFilter/src/BitmapHandler.cpp b/print/XpsRasFilter/src/BitmapHandler.cpp deleted file mode 100644 index d887ddab..00000000 --- a/print/XpsRasFilter/src/BitmapHandler.cpp +++ /dev/null @@ -1,361 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// BitmapHandler.cpp -// -// Abstract: -// -// Abstract class that encapsulates the processing done to each -// individual band bitmap, as well as the concrete implemention -// that streams the bands as Tiffs to the output stream. -// - -#include "precomp.h" -#include "WppTrace.h" -#include "Exception.h" -#include "filtertypes.h" -#include "UnknownBase.h" -#include "xpsrasfilter.h" -#include "OMConvertor.h" -#include "rasinterface.h" -#include "BitmapHandler.h" - -#include "BitmapHandler.tmh" - -namespace xpsrasfilter -{ - -// -//Routine Name: -// -// TiffStreamBitmapHandler::CreateTiffStreamBitmapHandler -// -//Routine Description: -// -// Static factory method that creates an instance of -// TiffStreamBitmapHandler. -// -//Arguments: -// -// pStream - Filter output stream (IPrintWriteStream) -// -//Return Value: -// -// TiffStreamBitmapHandler_t (smart ptr) -// The new TiffStreamBitmapHandler. -// -TiffStreamBitmapHandler_t -TiffStreamBitmapHandler::CreateTiffStreamBitmapHandler( - const IPrintWriteStream_t &pStream - ) -{ - IWICImagingFactory_t pWICFactory; - - // - // Create an instance of a WIC Imaging Factory - // - THROW_ON_FAILED_HRESULT( - ::CoCreateInstance( - CLSID_WICImagingFactory, - NULL, - CLSCTX_INPROC_SERVER, - __uuidof(IWICImagingFactory), - reinterpret_cast(&pWICFactory) - ) - ); - - // - // Construct the TiffStreamBitmapHandler and return it - // - TiffStreamBitmapHandler_t toReturn( - new TiffStreamBitmapHandler( - pWICFactory, - pStream - ) - ); - - return toReturn; -} - -// -//Routine Name: -// -// TiffStreamBitmapHandler::TiffStreamBitmapHandler -// -//Routine Description: -// -// Construct the bitmap handler with the WIC factory -// and filter output stream. -// -//Arguments: -// -// pWICFactory - Windows Imaging Components object factory -// pStream - Output stream -// pHG - Encoder cache HGLOBAL -// -TiffStreamBitmapHandler::TiffStreamBitmapHandler( - const IWICImagingFactory_t &pWICFactory, - const IPrintWriteStream_t &pStream - ) : m_pWICFactory(pWICFactory), - m_pWriter(pStream), - m_nextTiffStart(0), - m_numTiffs(0), - m_tiffStarts(0) -{ -} - -// -//Routine Name: -// -// TiffStreamBitmapHandler::ProcessBitmap -// -//Routine Description: -// -// Encode the bitmap as a TIFF and stream out of the filter. -// -//Arguments: -// -// bitmap - bitmap of a single band, to stream -// -void -TiffStreamBitmapHandler::ProcessBitmap( - const IWICBitmap_t &bitmap - ) -{ - - // - // Create an empty HGLOBAL to hold the encode cache - // - SafeHGlobal_t pHG( - new SafeHGlobal(GMEM_SHARE | GMEM_MOVEABLE, 0) - ); - - // - // Create a stream to the encode buffer so that WIC can - // encode the TIFF in-memory - // - IStream_t pIStream; - - THROW_ON_FAILED_HRESULT( - ::CreateStreamOnHGlobal( - *pHG, - FALSE, // Do NOT Free the HGLOBAL on Release of the stream - &pIStream - ) - ); - - // - // Create a WIC TIFF Encoder on the stream - // - IWICBitmapEncoder_t pWICEncoder; - THROW_ON_FAILED_HRESULT( - m_pWICFactory->CreateEncoder(GUID_ContainerFormatTiff, NULL, &pWICEncoder) - ); - THROW_ON_FAILED_HRESULT( - pWICEncoder->Initialize(pIStream, WICBitmapEncoderNoCache) - ); - - // - // Create a new frame for the band and configure it - // - IWICBitmapFrameEncode_t pWICFrame; - IPropertyBag2_t pFramePropertyBag; - - THROW_ON_FAILED_HRESULT( - pWICEncoder->CreateNewFrame(&pWICFrame, &pFramePropertyBag) - ); - - { - // - // Write the compression method to the frame's property bag - // - PROPBAG2 option = { 0 }; - option.pstrName = L"TiffCompressionMethod"; - - VARIANT varValue; - VariantInit(&varValue); - varValue.vt = VT_UI1; - varValue.bVal = WICTiffCompressionLZW; - - THROW_ON_FAILED_HRESULT( - pFramePropertyBag->Write( - 1, // number of properties being set - &option, - &varValue - ) - ); - } - - THROW_ON_FAILED_HRESULT( - pWICFrame->Initialize(pFramePropertyBag) - ); - - // - // Set the frame's size - // - UINT bitmapWidth, bitmapHeight; - THROW_ON_FAILED_HRESULT( - bitmap->GetSize(&bitmapWidth, &bitmapHeight) - ); - THROW_ON_FAILED_HRESULT( - pWICFrame->SetSize(bitmapWidth, bitmapHeight) - ); - - // - // Set the frame's resolution - // - DOUBLE xDPI, yDPI; - THROW_ON_FAILED_HRESULT( - bitmap->GetResolution(&xDPI, &yDPI) - ); - THROW_ON_FAILED_HRESULT( - pWICFrame->SetResolution(xDPI, yDPI) - ); - - // - // Set the frame's pixel format - // - WICPixelFormatGUID format; - THROW_ON_FAILED_HRESULT( - bitmap->GetPixelFormat(&format) - ); - THROW_ON_FAILED_HRESULT( - pWICFrame->SetPixelFormat(&format) - ); - - // - // Write the bitmap data to the frame - // - WICRect rect = {0, 0, 0, 0}; - rect.Width = bitmapWidth; - rect.Height = bitmapHeight; - THROW_ON_FAILED_HRESULT( - pWICFrame->WriteSource(bitmap, &rect) - ); - - // - // Commit the frame and encoder - // - THROW_ON_FAILED_HRESULT( - pWICFrame->Commit() - ); - THROW_ON_FAILED_HRESULT( - pWICEncoder->Commit() - ); - - // - // Get the size of the TIFF from the stream position - // - ULARGE_INTEGER tiffSize; - LARGE_INTEGER zero; - zero.QuadPart = 0; - - THROW_ON_FAILED_HRESULT( - pIStream->Seek(zero, SEEK_CUR, &tiffSize) - ); - - ULONG cb; - - THROW_ON_FAILED_HRESULT( - ::ULongLongToULong(tiffSize.QuadPart, &cb) - ); - - // - // Update the list of Tiff locations so that it can be written to - // the end of the Tiff stream. - // - m_tiffStarts.push_back(m_nextTiffStart); - m_nextTiffStart += tiffSize.QuadPart; - m_numTiffs++; - - { - // - // Get a pointer to the HGLOBAL memory - // - HGlobalLock_t lock = pHG->Lock(); - BYTE *pCache = lock->GetAddress(); - - // - // Write the encoded Tiff to the output stream - // - ULONG written; - - THROW_ON_FAILED_HRESULT( - m_pWriter->WriteBytes(pCache, cb, &written) - ); - } -} - -// -//Routine Name: -// -// TiffStreamBitmapHandler::WriteFooter -// -//Routine Description: -// -// Write the footer to the stream, making it easier -// to decode the individual TIFFs later. The footer -// looks like this: -// -// |<--8 bytes--->| -// -// +--------------+ -// | Tiff 1 start | -// +--------------+ -// | Tiff 2 start | -// +--------------+ -// | ... | -// +--------------+ -// | Tiff N start | -// +--------------+ -// | N | -// +--------------+ -// -void -TiffStreamBitmapHandler::WriteFooter() -{ - ULONG written; - - // - // Write the vector of Tiff starts to the stream, if any Tiffs - // have been written to the stream. - // - if (m_numTiffs > 0) - { - ULONG toWrite; - - THROW_ON_FAILED_HRESULT( - SizeTToULong( - sizeof(ULONGLONG) * m_tiffStarts.size(), - &toWrite - ) - ); - - THROW_ON_FAILED_HRESULT( - m_pWriter->WriteBytes( - reinterpret_cast(&m_tiffStarts[0]), - toWrite, - &written - ) - ); - } - - // - // Write the number of Tiffs to the stream - // - THROW_ON_FAILED_HRESULT( - m_pWriter->WriteBytes( - reinterpret_cast(&m_numTiffs), - sizeof(m_numTiffs), - &written - ) - ); -} - -} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/BitmapHandler.h b/print/XpsRasFilter/src/BitmapHandler.h deleted file mode 100644 index 3f78dc30..00000000 --- a/print/XpsRasFilter/src/BitmapHandler.h +++ /dev/null @@ -1,64 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// BitmapHandler.h -// -// Abstract: -// -// Abstract class that encapsulates the processing done to each -// individual band bitmap, as well as the concrete implemention -// that streams the bands as Tiffs to the output stream. -// - -#pragma once - -namespace xpsrasfilter -{ - -class TiffStreamBitmapHandler -{ -public: - - static - TiffStreamBitmapHandler_t - CreateTiffStreamBitmapHandler( - const IPrintWriteStream_t &pStream - ); - - void - ProcessBitmap( - const IWICBitmap_t &bitmap - ); - - void - WriteFooter(); - -private: - IWICImagingFactory_t m_pWICFactory; - IPrintWriteStream_t m_pWriter; // output stream - - // - // Members to keep track of where each Tiff - // starts in the output stream - // - ULONGLONG m_nextTiffStart; - ULONGLONG m_numTiffs; - std::vector m_tiffStarts; - - // - // Constructor is private; use CreateTiffStreamBitmapHandler - // to create instances - // - TiffStreamBitmapHandler( - const IWICImagingFactory_t &pWICFactory, - const IPrintWriteStream_t &pStream - ); -}; - -} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/Exception.cpp b/print/XpsRasFilter/src/Exception.cpp deleted file mode 100644 index 141c1ac3..00000000 --- a/print/XpsRasFilter/src/Exception.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// Exception.cpp -// -// Abstract: -// -// Exception routine definitions. -// - -#include "precomp.h" -#include "WppTrace.h" -#include "Exception.h" - -#include "Exception.tmh" - -namespace xpsrasfilter -{ - -void ThrowHRException( - HRESULT hr, - char const *fileName, - int lineNum - ) -{ - DoTraceMessage( - XPSRASFILTER_TRACE_ERROR, - L"Throwing HRESULT Exception from %s:%d (HRESULT=%!HRESULT!)", - fileName, - lineNum, - hr - ); - - throw hr_error(hr); -} - -} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/Exception.h b/print/XpsRasFilter/src/Exception.h deleted file mode 100644 index 887bfbc4..00000000 --- a/print/XpsRasFilter/src/Exception.h +++ /dev/null @@ -1,86 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// Exception.h -// -// Abstract: -// -// Exception macro and class declarations. -// - -#pragma once - -// -// Macro to convert HRESULT into an exception throw -// -#ifndef THROW_ON_FAILED_HRESULT -#define THROW_ON_FAILED_HRESULT(func_) \ -{ \ - HRESULT hr_ = func_; \ - if (FAILED(hr_)) { xpsrasfilter::ThrowHRException(hr_, __FILE__, __LINE__); } \ -} -#endif // THROW_ON_FAILED_HRESULT - -#ifndef THROW_LAST_ERROR -#define THROW_LAST_ERROR() \ -{ \ - HRESULT errhr_ = HRESULT_FROM_WIN32(::GetLastError()); \ - THROW_ON_FAILED_HRESULT(errhr_); \ -} -#endif // THROW_LAST_ERROR - -// -// Macro to catch various exceptions, including -// HRESULT-turned-exceptions. -// -// Because we have defined USE_NATIVE_EH=1, the -// catch(...) block will not catch structural -// exceptions. -// -#ifndef CATCH_VARIOUS -#define CATCH_VARIOUS(hr_) \ - catch(std::bad_alloc const& ) \ - { \ - hr_ = E_OUTOFMEMORY; \ - } \ - catch(xpsrasfilter::hr_error const& e) \ - { \ - hr_ = e.hr; \ - } \ - catch(std::exception const& ) \ - { \ - hr_ = E_FAIL; \ - } \ - catch(...) \ - { \ - hr_ = E_UNEXPECTED; \ - } -#endif // CATCH_VARIOUS - -namespace xpsrasfilter -{ - -// -// HRESULT exception -// -struct hr_error -{ - HRESULT hr; - - hr_error(HRESULT hr_in) : hr(hr_in) - { } -}; - -void ThrowHRException( - HRESULT hr, - char const *fileName, - int lineNum - ); - -} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/OMConvertor.cpp b/print/XpsRasFilter/src/OMConvertor.cpp deleted file mode 100644 index 2cd478c2..00000000 --- a/print/XpsRasFilter/src/OMConvertor.cpp +++ /dev/null @@ -1,774 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// omconvertor.cpp -// -// Abstract: -// -// Object model conversion routines. This class provides routines -// to convert from filter pipeline objects into Xps Object Model -// objects. -// - -#include "precomp.h" -#include "WppTrace.h" -#include "Exception.h" -#include "filtertypes.h" -#include "UnknownBase.h" -#include "OMConvertor.h" - -#include "OMConvertor.tmh" - -namespace xpsrasfilter -{ - -// -//Routine Name: -// -// CreateXpsOMPageFromIFixedPage -// -//Routine Description: -// -// This is the main method called by the filter. It -// proceeds to call the remaining Create* methods -// to convert from the print pipeline Object Model -// to the Xps Object Model. -// -// Takes an IFixedPage (print pipeline Object Model) -// and converts it to an IXpsOMPage (Xps Object Model). -// -//Arguments: -// -// pPageIn - IFixedPage to convert -// pOMFactory - Xps Object Model Object Factory -// pOpcFactory - Opc Object Factory -// -//Return Value: -// -// IXpsOMPage_t (smart pointer) -// Result IXpsOMPage -// -IXpsOMPage_t -CreateXpsOMPageFromIFixedPage( - const IFixedPage_t &pPageIn, - const IXpsOMObjectFactory_t &pOMFactory, - const IOpcFactory_t &pOpcFactory - ) -{ - // - // Get additional page parameters (uri and stream) - // - IOpcPartUri_t pPartUri; - IStream_t pPartStream; - - pPartStream = GetStreamFromPart( - static_cast(pPageIn) - ); - pPartUri = CreateOpcPartUriFromPart( - static_cast(pPageIn), - pOpcFactory - ); - - // - // Call Xps Object Model to create the page resource - // - IXpsOMPage_t pPageOut; - - THROW_ON_FAILED_HRESULT( - pOMFactory->CreatePageFromStream( - pPartStream, - pPartUri, - CollectPageResources(pPageIn, pOMFactory, pOpcFactory), - FALSE, // Do not reuse objects - &pPageOut - ) - ); - - return pPageOut; -} - -// -//Routine Name: -// -// CreateImageFromIPartImage -// -//Routine Description: -// -// Takes an IPartImage (print pipeline Object Model) -// and converts it to an IXpsOMImageResource (Xps Object Model). -// -//Arguments: -// -// pImageIn - IPartImage to convert -// pOMFactory - Xps Object Model Object Factory -// pOpcFactory - Opc Object Factory -// -//Return Value: -// -// IXpsOMImageResource_t (smart pointer) -// Result IXpsOMImageResource -// -IXpsOMImageResource_t -CreateImageFromIPartImage( - const IPartImage_t &pImageIn, - const IXpsOMObjectFactory_t &pOMFactory, - const IOpcFactory_t &pOpcFactory - ) -{ - // - // Get IPartBase parameters (stream and uri) - // - IStream_t pPartStream; - IOpcPartUri_t pPartUri; - - pPartStream = GetStreamFromPart( - static_cast(pImageIn) - ); - pPartUri = CreateOpcPartUriFromPart( - static_cast(pImageIn), - pOpcFactory - ); - - // - // Get the image type and convert it to the corresponding enum - // - BSTR_t strContentType; - XPS_IMAGE_TYPE type = XPS_IMAGE_TYPE_WDP; - - THROW_ON_FAILED_HRESULT( - pImageIn->GetImageProperties(&strContentType) - ); - - if (0 == _wcsicmp(strContentType, L"image/jpeg")) - { - type = XPS_IMAGE_TYPE_JPEG; - } - else if (0 == _wcsicmp(strContentType, L"image/png")) - { - type = XPS_IMAGE_TYPE_PNG; - } - else if (0 == _wcsicmp(strContentType, L"image/tiff")) - { - type = XPS_IMAGE_TYPE_TIFF; - } - else if (0 == _wcsicmp(strContentType, L"image/vnd.ms-photo")) - { - type = XPS_IMAGE_TYPE_WDP; - } - else - { - // - // unknown content type - // - THROW_ON_FAILED_HRESULT(E_INVALIDARG); - } - - // - // Call Xps Object Model to create the image resource - // - IXpsOMImageResource_t pImageOut; - - THROW_ON_FAILED_HRESULT( - pOMFactory->CreateImageResource( - pPartStream, - type, - pPartUri, - &pImageOut - ) - ); - - return pImageOut; -} - -// -//Routine Name: -// -// CreateProfileFromIPartColorProfile -// -//Routine Description: -// -// Takes an IPartColorProfile (print pipeline Object Model) -// and converts it to an IXpsOMColorProfileResource (Xps Object Model). -// -//Arguments: -// -// pProfileIn - IPartColorProfile to convert -// pOMFactory - Xps Object Model Object Factory -// pOpcFactory - Opc Object Factory -// -//Return Value: -// -// IXpsOMColorProfileResource_t (smart pointer) -// Result IXpsOMColorProfileResource -// -IXpsOMColorProfileResource_t -CreateProfileFromIPartColorProfile( - const IPartColorProfile_t &pProfileIn, - const IXpsOMObjectFactory_t &pOMFactory, - const IOpcFactory_t &pOpcFactory - ) -{ - // - // Get IPartBase parameters (stream and uri) - // - IStream_t pPartStream; - IOpcPartUri_t pPartUri; - - pPartStream = GetStreamFromPart( - static_cast(pProfileIn) - ); - pPartUri = CreateOpcPartUriFromPart( - static_cast(pProfileIn), - pOpcFactory - ); - - // - // Call Xps Object Model to create the color profile resource - // - IXpsOMColorProfileResource_t pProfileOut; - - THROW_ON_FAILED_HRESULT( - pOMFactory->CreateColorProfileResource( - pPartStream, - pPartUri, - &pProfileOut - ) - ); - - return pProfileOut; -} - -// -//Routine Name: -// -// CreateDictionaryFromIPartResourceDictionary -// -//Routine Description: -// -// Takes an IPartResourceDictionary (print pipeline Object Model) -// and converts it to an IXpsOMRemoteDictionaryResource (Xps Object Model). -// -//Arguments: -// -// pDictionaryIn - IPartResourceDictionary to convert -// pOMFactory - Xps Object Model Object Factory -// pOpcFactory - Opc Object Factory -// pResources - The resources of the fixed page -// -//Return Value: -// -// IXpsOMRemoteDictionaryResource_t (smart pointer) -// Result IXpsOMRemoteDictionaryResource -// -IXpsOMRemoteDictionaryResource_t -CreateDictionaryFromIPartResourceDictionary( - const IPartResourceDictionary_t &pDictionaryIn, - const IXpsOMObjectFactory_t &pOMFactory, - const IOpcFactory_t &pOpcFactory, - const IXpsOMPartResources_t &pResources - ) -{ - // - // Get IPartBase parameters (stream and uri) - // - IStream_t pPartStream; - IOpcPartUri_t pPartUri; - - pPartStream = GetStreamFromPart( - static_cast(pDictionaryIn) - ); - pPartUri = CreateOpcPartUriFromPart( - static_cast(pDictionaryIn), - pOpcFactory - ); - - // - // Call Xps Object Model to create the remote dictionary resource - // - IXpsOMRemoteDictionaryResource_t pDictionaryOut; - - THROW_ON_FAILED_HRESULT( - pOMFactory->CreateRemoteDictionaryResourceFromStream( - pPartStream, - pPartUri, - pResources, - &pDictionaryOut) - ); - - return pDictionaryOut; -} - -// -//Routine Name: -// -// CreateFontFromIPartFont -// -//Routine Description: -// -// Takes an IPartFont (print pipeline Object Model) -// and converts it to an IXpsOMFontResource (Xps Object Model). -// -//Arguments: -// -// pFontIn - IPartFont to convert -// pFactory - Xps Object Model Object Factory -// pOpcFactory - Opc Object Factory -// -//Return Value: -// -// IXpsOMFontResource_t (smart pointer) -// Result IXpsOMFontResource -// -IXpsOMFontResource_t -CreateFontFromIPartFont( - const IPartFont_t &pFontIn, - const IXpsOMObjectFactory_t &pOMFactory, - const IOpcFactory_t &pOpcFactory - ) -{ - // - // Get IPartBase parameters (stream and uri) - // - IStream_t pPartStream; - IOpcPartUri_t pPartUri; - - pPartStream = GetStreamFromPart( - static_cast(pFontIn) - ); - pPartUri = CreateOpcPartUriFromPart( - static_cast(pFontIn), - pOpcFactory - ); - - // - // Get the font restriction - // - EXpsFontRestriction eFontRestriction = Xps_Restricted_Font_Installable; - - { - IPartFont2_t pFont2In; - - if (SUCCEEDED(pFontIn->QueryInterface(__uuidof(IPartFont2), reinterpret_cast(&pFont2In)))) - { - pFont2In->GetFontRestriction(&eFontRestriction); - } - } - - // - // Get the font obfuscation - // - EXpsFontOptions eFontOptions; - - { - BSTR_t contentType; - - THROW_ON_FAILED_HRESULT( - pFontIn->GetFontProperties(&contentType, &eFontOptions) - ); - } - - // - // It is necessary to combine the obfuscation and restriction - // attributes from the print pipeline into the one parameter that - // the Xps Object Model consumes. - // - - XPS_FONT_EMBEDDING omEmbedding; - - if (eFontOptions == Font_Normal) - { - omEmbedding = XPS_FONT_EMBEDDING_NORMAL; - } - else if (eFontOptions == Font_Obfusticate && - (eFontRestriction & - (Xps_Restricted_Font_PreviewPrint | - Xps_Restricted_Font_NoEmbedding))) - { - // - // If the font is obfuscated, and either the PreviewPrint or - // NoEmbedding restriction flags are set, then create a - // Restricted font - // - omEmbedding = XPS_FONT_EMBEDDING_RESTRICTED; - } - else - { - omEmbedding = XPS_FONT_EMBEDDING_OBFUSCATED; - } - - // - // Call Xps Object Model to create the font resource - // - IXpsOMFontResource_t pFontOut; - - THROW_ON_FAILED_HRESULT( - pOMFactory->CreateFontResource( - pPartStream, - omEmbedding, - pPartUri, - FALSE, // fonts received from the pipeline are already de-obfuscated - &pFontOut - ) - ); - - return pFontOut; -} - -// -//Routine Name: -// -// CollectPageResources -// -//Routine Description: -// -// Iterates over all of the resources related to -// a fixed page and adds them to a resource -// collection. -// -//Arguments: -// -// pPage - The page to query for resources -// pOMFactory - Xps Object Model Object Factory -// pOpcFactory - Opc Object Factory -// -//Return Value: -// -// IXpsOMPartResources_t (smart pointer) -// The resource collection of all of the resources of the page -// -IXpsOMPartResources_t -CollectPageResources( - const IFixedPage_t &pPage, - const IXpsOMObjectFactory_t &pOMFactory, - const IOpcFactory_t &pOpcFactory - ) -{ - IXpsOMPartResources_t pResources; - - IXpsOMFontResourceCollection_t pFonts; - IXpsOMImageResourceCollection_t pImages; - IXpsOMColorProfileResourceCollection_t pProfiles; - IXpsOMRemoteDictionaryResourceCollection_t pDictionaries; - - // - // collection of resource dictionaries saved for later processing. - // - ResourceDictionaryList_t dictionaryList; - - // - // Create the resource collection and get all of the - // resource-specific sub-collections. - // - THROW_ON_FAILED_HRESULT( - pOMFactory->CreatePartResources(&pResources) - ); - THROW_ON_FAILED_HRESULT( - pResources->GetFontResources(&pFonts) - ); - THROW_ON_FAILED_HRESULT( - pResources->GetImageResources(&pImages) - ); - THROW_ON_FAILED_HRESULT( - pResources->GetColorProfileResources(&pProfiles) - ); - THROW_ON_FAILED_HRESULT( - pResources->GetRemoteDictionaryResources(&pDictionaries) - ); - // - // Get the XpsPartIterator and iterate through all of the parts - // related to this fixed page. - // - IXpsPartIterator_t itPart; - - THROW_ON_FAILED_HRESULT( - pPage->GetXpsPartIterator(&itPart) - ); - - for (; !itPart->IsDone(); itPart->Next()) - { - BSTR_t uri; - IUnknown_t pUnkPart; - - THROW_ON_FAILED_HRESULT( - itPart->Current(&uri, &pUnkPart) - ); - - IPartFont_t pFontPart; - IPartImage_t pImagePart; - IPartColorProfile_t pProfilePart; - IPartResourceDictionary_t pDictionaryPart; - - if (SUCCEEDED(pUnkPart.QueryInterface(&pFontPart))) - { - // - // Convert the font part to Xps Object Model and add it to the - // font resource collection - // - THROW_ON_FAILED_HRESULT( - pFonts->Append( - CreateFontFromIPartFont( - pFontPart, - pOMFactory, - pOpcFactory - ) - ) - ); - } - else if (SUCCEEDED(pUnkPart.QueryInterface(&pImagePart))) - { - // - // Convert the image part to Xps Object Model and add it to the - // image resource collection - // - THROW_ON_FAILED_HRESULT( - pImages->Append( - CreateImageFromIPartImage( - pImagePart, - pOMFactory, - pOpcFactory - ) - ) - ); - } - else if (SUCCEEDED(pUnkPart.QueryInterface(&pProfilePart))) - { - // - // Convert the color profile part to Xps Object Model and add it - // to the color profile resource collection - // - THROW_ON_FAILED_HRESULT( - pProfiles->Append( - CreateProfileFromIPartColorProfile( - pProfilePart, - pOMFactory, - pOpcFactory - ) - ) - ); - } - else if (SUCCEEDED(pUnkPart.QueryInterface(&pDictionaryPart))) - { - // - // In order to process the remote resource dictionary, all of - // its linked resources must be present in pResources. To ensure - // this, we delay the conversion of the remote resource - // dictionaries until all of the other resources have been converted. - // - dictionaryList.push_back(pDictionaryPart); - } - else - { - // - // Any other page resources are ignored - // - } - } - - for (ResourceDictionaryList_t::const_iterator it = dictionaryList.begin(); - it != dictionaryList.end(); - ++it) - { - // - // Convert the remote dictionary to Xps Object Model and add it - // to the remote dictionary collection - // - THROW_ON_FAILED_HRESULT( - pDictionaries->Append( - CreateDictionaryFromIPartResourceDictionary( - *it, - pOMFactory, - pOpcFactory, - pResources - ) - ) - ); - } - - return pResources; -} - -// -//Routine Name: -// -// GetStreamFromPart -// -//Routine Description: -// -// Gets the IStream from this part. -// -//Arguments: -// -// pPart - An Xps Part -// -//Return Value: -// -// IStream_t (smart pointer) -// The stream of the part's content -// -IStream_t -GetStreamFromPart( - const IPartBase_t &pPart - ) -{ - // - // Get the IPrintReadStream for the part from the pipeline Object Model - // - IPrintReadStream_t pStream; - THROW_ON_FAILED_HRESULT( - pPart->GetStream(&pStream) - ); - - return CreateIStreamFromIPrintReadStream(pStream); -} - -// -//Routine Name: -// -// CreateIStreamFromIPrintReadStream -// -//Routine Description: -// -// Creates an IStream from an IPrintReadStream. -// -//Arguments: -// -// pReadStream - A Print Pipeline IPrintReadStream -// -//Return Value: -// -// IStream_t (smart pointer) -// A stream with the same content as the argument stream. -// -IStream_t -CreateIStreamFromIPrintReadStream( - const IPrintReadStream_t &pReadStream - ) -{ - // - // Get the size of the stream - // - ULONGLONG tmpPos; - size_t partSize; - - THROW_ON_FAILED_HRESULT( - pReadStream->Seek(0, SEEK_END, &tmpPos) - ); - - // - // GlobalAlloc can only allocate size_t bytes, so - // throw if the part is larger than that - // - THROW_ON_FAILED_HRESULT( - ULongLongToSizeT(tmpPos, &partSize) - ); - - THROW_ON_FAILED_HRESULT( - pReadStream->Seek(0, SEEK_SET, &tmpPos) - ); - - // - // Allocate an HGLOBAL for the part cache - // - SafeHGlobal_t pHBuf( - new SafeHGlobal(GMEM_FIXED, partSize) - ); - - // - // Read the part into the cache - // - { - // - // Lock the HGLOBAL and get the address of the buffer - // from the RAII lock object - // - HGlobalLock_t lock = pHBuf->Lock(); - BYTE *pBuffer = lock->GetAddress(); - - // - // Allow the number of bytes to read to be clipped to max ULONG - // and then spin on fEOF until the stream is exhausted - // - ULONG numToRead; - - if (FAILED(SizeTToULong(partSize, &numToRead))) - { - numToRead = MAXUINT; - } - - BOOL fEOF; - ULONG numRead; - size_t pos = 0; - - // - // Iterate until all bytes from the stream - // have been read into the buffer - // - do - { - THROW_ON_FAILED_HRESULT( - pReadStream->ReadBytes(pBuffer + pos, numToRead, &numRead, &fEOF) - ); - - pos += numRead; - } while (!fEOF && numRead); - } - - // - // Create an IStream from the part cache - // - IStream_t pIStream = pHBuf->ConvertToIStream(); - - LARGE_INTEGER zero = {0}; - THROW_ON_FAILED_HRESULT( - pIStream->Seek(zero, SEEK_SET, NULL) - ); - - return pIStream; -} - -// -//Routine Name: -// -// CreateOpcPartUriFromPart -// -//Routine Description: -// -// Gets the Opc Uri from the Xps Part. -// -//Arguments: -// -// pPart - An Xps Part -// pFactory - Opc Factory -// -//Return Value: -// -// IOpcPartUri_t (smart pointer) -// The Uri of the part -// -IOpcPartUri_t -CreateOpcPartUriFromPart( - const IPartBase_t &pPart, - const IOpcFactory_t &pFactory - ) -{ - BSTR_t strPartUri; - - THROW_ON_FAILED_HRESULT( - pPart->GetUri(&strPartUri) - ); - - IOpcPartUri_t pPartUri; - THROW_ON_FAILED_HRESULT( - pFactory->CreatePartUri(strPartUri, &pPartUri) - ); - return pPartUri; -} - -} // namespace xpsrasfilter - diff --git a/print/XpsRasFilter/src/OMConvertor.h b/print/XpsRasFilter/src/OMConvertor.h deleted file mode 100644 index 7257da3b..00000000 --- a/print/XpsRasFilter/src/OMConvertor.h +++ /dev/null @@ -1,90 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// omconvertor.h -// -// Abstract: -// -// Object model conversion routines. -// - -#pragma once - -namespace xpsrasfilter -{ - -// -// Top-level Create Page routine -// -IXpsOMPage_t -CreateXpsOMPageFromIFixedPage( - const IFixedPage_t &pPageIn, - const IXpsOMObjectFactory_t &pFactory, - const IOpcFactory_t &pOpcFactory - ); - -// -// Individual Part conversion routines -// -IXpsOMImageResource_t -CreateImageFromIPartImage( - const IPartImage_t &pImageIn, - const IXpsOMObjectFactory_t &pFactory, - const IOpcFactory_t &pOpcFactory - ); - -IXpsOMColorProfileResource_t -CreateProfileFromIPartColorProfile( - const IPartColorProfile_t &pProfileIn, - const IXpsOMObjectFactory_t &pFactory, - const IOpcFactory_t &pOpcFactory - ); - -IXpsOMRemoteDictionaryResource_t -CreateDictionaryFromIPartResourceDictionary( - const IPartResourceDictionary_t &pDictionaryIn, - const IXpsOMObjectFactory_t &pFactory, - const IOpcFactory_t &pOpcFactory, - const IXpsOMPartResources_t &pResources - ); - -IXpsOMFontResource_t -CreateFontFromIPartFont( - const IPartFont_t &pFontIn, - const IXpsOMObjectFactory_t &pFactory, - const IOpcFactory_t &pOpcFactory - ); - -// -// Utility Routines -// -IStream_t -GetStreamFromPart( - const IPartBase_t &pPart - ); - -IOpcPartUri_t -CreateOpcPartUriFromPart( - const IPartBase_t &pPart, - const IOpcFactory_t &pOpcFactory - ); - -IXpsOMPartResources_t -CollectPageResources( - const IFixedPage_t &pPage, - const IXpsOMObjectFactory_t &pFactory, - const IOpcFactory_t &pOpcFactory - ); - -IStream_t -CreateIStreamFromIPrintReadStream( - const IPrintReadStream_t &pReadStream - ); - -} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/PThandler.cpp b/print/XpsRasFilter/src/PThandler.cpp deleted file mode 100644 index 6b158032..00000000 --- a/print/XpsRasFilter/src/PThandler.cpp +++ /dev/null @@ -1,781 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// PThandler.cpp -// -// Abstract: -// -// Print Ticket Handler class definition. -// - -#include "precomp.h" -#include "WppTrace.h" -#include "Exception.h" -#include "filtertypes.h" -#include "UnknownBase.h" -#include "OMConvertor.h" -#include "rasinterface.h" -#include "xpsrasfilter.h" -#include "PTHandler.h" - -#include "PThandler.tmh" - -namespace xpsrasfilter -{ - -// -// This is an arbitrary page margin that is used to simulate -// an imageable area for scaling calculations. -// -const FLOAT g_pageMargin = 0.25f; - -// -//Routine Name: -// -// PrintTicketHandler::CreatePrintTicketHandler -// -//Routine Description: -// -// Static factory method that creates an instance of -// PrintTicketHandler. -// -//Arguments: -// -// pPropertyBag - Property Bag -// -//Return Value: -// -// PrintTicketHandler_t (smart ptr) -// The new PrintTicketHandler. -// -PrintTicketHandler_t -PrintTicketHandler::CreatePrintTicketHandler( - const IPrintPipelinePropertyBag_t &pPropertyBag - ) -{ - // - // Create MSXML DOM document - // - IXMLDOMDocument2_t pDOMDoc; - - THROW_ON_FAILED_HRESULT( - ::CoCreateInstance( - __uuidof(DOMDocument60), - NULL, - CLSCTX_INPROC_SERVER, - __uuidof(IXMLDOMDocument2), - reinterpret_cast(&pDOMDoc) - ) - ); - - // - // Get the default user Print Ticket Stream Factory - // - Variant_t varUserPrintTicket; - THROW_ON_FAILED_HRESULT( - pPropertyBag->GetProperty( - XPS_FP_USER_PRINT_TICKET, - &varUserPrintTicket - ) - ); - IUnknown_t pUnk = varUserPrintTicket.punkVal; - - IPrintReadStreamFactory_t pStreamFactory; - - THROW_ON_FAILED_HRESULT( - pUnk.QueryInterface(&pStreamFactory) - ); - - // - // Get the default user Print Ticket stream - // and wrap it in an IStream - // - - IPrintReadStream_t pUserPrintTicketStream; - - THROW_ON_FAILED_HRESULT( - pStreamFactory->GetStream(&pUserPrintTicketStream) - ); - - IStream_t pUserPrintTicket = - CreateIStreamFromIPrintReadStream(pUserPrintTicketStream); - - // - // Get the Printer Name - // - Variant_t varPrinterName; - THROW_ON_FAILED_HRESULT( - pPropertyBag->GetProperty( - XPS_FP_PRINTER_NAME, - &varPrinterName - ) - ); - - BSTR_t pPrinterName(varPrinterName.bstrVal); - - // - // Get the User Security Token - // Avoid CComVariant if getting the XPS_FP_USER_TOKEN property. - // Please refer to http://go.microsoft.com/fwlink/?LinkID=255534 for detailed information. - // - SafeVariant varUserSecurityToken; - THROW_ON_FAILED_HRESULT( - pPropertyBag->GetProperty( - XPS_FP_USER_TOKEN, - &varUserSecurityToken - ) - ); - - // - // Open the Print Ticket Provider - // - SafeHPTProvider_t pHProvider( - new SafeHPTProvider( - pPrinterName, - varUserSecurityToken.byref - ) - ); - - PrintTicketHandler_t toReturn( - new PrintTicketHandler( - pDOMDoc, - pHProvider, - pUserPrintTicket - ) - ); - - return toReturn; -} - -// -//Routine Name: -// -// PrintTicketHandler::PrintTicketHandler -// -//Routine Description: -// -// Constructor for the Print Ticket Handler. -// -//Arguments: -// -// pDoc - initialized MSXML DOM document -// pHProvider - handle to the Print Ticket Provider -// -PrintTicketHandler::PrintTicketHandler( - const IXMLDOMDocument2_t &pDoc, - SafeHPTProvider_t pHProvider, - const IStream_t &pUserPrintTicket - ) : m_pDOMDoc(pDoc), - m_pHProvider(pHProvider), - m_pDefaultUserPrintTicket(pUserPrintTicket) -{ -} - -// -//Routine Name: -// -// PrintTicketHandler::ProcessPrintTicket -// -//Routine Description: -// -// Gets the print ticket from the part, merges with -// the base ticket, and returns the result. -// -//Arguments: -// -// pBasePrintTicket - Base Print Ticket -// pDeltaPrintTicketPart - Delta Print Pipeline Print Ticket Part -// scope - Scope of the merged Print Ticket -// -//Return Value: -// -// IStream_t (smart pointer) -// Merged stream -// -IStream_t -PrintTicketHandler::ProcessPrintTicket( - const IStream_t &pBasePrintTicket, - const IPartPrintTicket_t &pDeltaPrintTicketPart, - EPrintTicketScope scope - ) -{ - IStream_t pMergedPrintTicket; - IStream_t pDeltaPrintTicket; - - pDeltaPrintTicket = GetStreamFromPart( - static_cast(pDeltaPrintTicketPart) - ); - - // - // Before calling PTMergeAndValidatePrintTicket, both input - // Print Ticket streams MUST be at position 0. The temp Print - // Ticket stream is already at position 0, but the Base Print - // Ticket may not be. Seek it to 0 to be sure. - // - LARGE_INTEGER zero; - zero.QuadPart = 0; - THROW_ON_FAILED_HRESULT( - pBasePrintTicket->Seek(zero, SEEK_SET, NULL) - ); - - // - // Merge the delta Print Ticket with the - // base Print Ticket - // - THROW_ON_FAILED_HRESULT( - ::CreateStreamOnHGlobal( - NULL, - TRUE, // delete on release - &pMergedPrintTicket - ) - ); - - m_pHProvider->PTMergeAndValidatePrintTicket( - pBasePrintTicket, - pDeltaPrintTicket, - scope, - pMergedPrintTicket - ); - - return pMergedPrintTicket; -} - -// -//Routine Name: -// -// PrintTicketHandler::ProcessPart -// -//Routine Description: -// -// Merges the Fixed Document Sequence Print Ticket with -// the default user Print Ticket and caches the result. -// -//Arguments: -// -// pFDS - Fixed Document Sequence part -// -void -PrintTicketHandler::ProcessPart( - const IFixedDocumentSequence_t &pFDS - ) -{ - IPartPrintTicket_t pPrintTicket; - - HRESULT hr = pFDS->GetPrintTicket(&pPrintTicket); - - // - // E_ELEMENT_NOT_FOUND means that this Fixed Document Sequence - // does not have a Print Ticket. Propagate the Default User - // Print Ticket. - // All other failed HRESULTs should be thrown. - // - if (hr == E_ELEMENT_NOT_FOUND) - { - m_pJobPrintTicket = m_pDefaultUserPrintTicket; - return; - } - - THROW_ON_FAILED_HRESULT(hr); - - m_pDocumentPrintTicket = NULL; - m_pPagePrintTicket = NULL; - - m_pJobPrintTicket = ProcessPrintTicket( - m_pDefaultUserPrintTicket, - pPrintTicket, - kPTJobScope - ); -} - -// -//Routine Name: -// -// PrintTicketHandler::ProcessPart -// -//Routine Description: -// -// Merges the Fixed Document Print Ticket with the -// Fixed Document Sequence Print Ticket and caches -// the result. The tickets are merged at the Document -// scope, so the result contains no job-level features. -// -//Arguments: -// -// pFD - Fixed Document part -// -void -PrintTicketHandler::ProcessPart( - const IFixedDocument_t &pFD - ) -{ - IPartPrintTicket_t pPrintTicket; - - HRESULT hr = pFD->GetPrintTicket(&pPrintTicket); - - // - // E_ELEMENT_NOT_FOUND means that this Fixed Document - // does not have a Print Ticket. Propagate the Job - // Print Ticket. - // All other failed HRESULTs should be thrown. - // - if (hr == E_ELEMENT_NOT_FOUND) - { - m_pDocumentPrintTicket = m_pJobPrintTicket; - return; - } - - THROW_ON_FAILED_HRESULT(hr); - - m_pPagePrintTicket = NULL; - - m_pDocumentPrintTicket = ProcessPrintTicket( - m_pJobPrintTicket, - pPrintTicket, - kPTDocumentScope - ); -} - -// -//Routine Name: -// -// PrintTicketHandler::ProcessPart -// -//Routine Description: -// -// Merges the Fixed Page Print Ticket with the -// Fixed Document Print Ticket and caches the result. -// The tickets are merged at the Page scope, so the -// result contains no job-level or document-level features. -// -//Arguments: -// -// pFP - Fixed Page part -// -void -PrintTicketHandler::ProcessPart( - const IFixedPage_t &pFP - ) -{ - IPartPrintTicket_t pPrintTicket; - - HRESULT hr = pFP->GetPrintTicket(&pPrintTicket); - - // - // E_ELEMENT_NOT_FOUND means that this Fixed Page - // does not have a Print Ticket. Propagate the Document - // Print Ticket. - // All other failed HRESULTs should be thrown. - // - if (hr == E_ELEMENT_NOT_FOUND) - { - m_pPagePrintTicket = m_pDocumentPrintTicket; - return; - } - - THROW_ON_FAILED_HRESULT(hr); - - m_pPagePrintTicket = ProcessPrintTicket( - m_pDocumentPrintTicket, - pPrintTicket, - kPTPageScope - ); -} - -// -//Routine Name: -// -// PrintTicketHandler::GetMergedPrintTicketParams -// -//Routine Description: -// -// Queries a set of parameters from the merged print ticket. -// -// NOTE: Relies on successful calls to all three PrintTicket -// processing methods. -// -//Return Value: -// -// ParametersFromPrintTicket -// The set of parameters queried from the merged -// Print Ticket. -// -ParametersFromPrintTicket -PrintTicketHandler::GetMergedPrintTicketParams() -{ - DoTraceMessage(XPSRASFILTER_TRACE_VERBOSE, L"Getting Print Ticket parameters"); - - if (!m_pPagePrintTicket) - { - DoTraceMessage(XPSRASFILTER_TRACE_ERROR, L"GetMergedPrintTicketParams called before ProcessPagePrintTicket"); - THROW_ON_FAILED_HRESULT(E_FAIL); - } - - ParametersFromPrintTicket params; - - // - // Seek the Page-level Print Ticket to 0 - // - LARGE_INTEGER zero; - zero.QuadPart = 0; - THROW_ON_FAILED_HRESULT( - m_pPagePrintTicket->Seek(zero, SEEK_SET, NULL) - ); - - // - // Load the print ticket stream into a DOM document - // - // NOTE: We are only looking for features at the Page scope for this sample, - // so we only extract features from the effective page-level PrintTicket. - // - Variant_t varStream(m_pPagePrintTicket); - VARIANT_BOOL success; - - THROW_ON_FAILED_HRESULT( - m_pDOMDoc->load(varStream, &success) - ); - if (!success) - { - WPP_LOG_ON_FAILED_HRESULT(E_FAIL); - THROW_ON_FAILED_HRESULT(E_FAIL); - } - - // - // Set the DOM Selection namespace to simplify queries - // - BSTR_t ns(L"xmlns:psf='http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework'"); - Variant_t nsProp(ns); - THROW_ON_FAILED_HRESULT( - m_pDOMDoc->setProperty(L"SelectionNamespaces", nsProp) - ); - - // - // Query the print ticket for parameters of interest - // - params.destDPI = QueryDPI(); - params.scaling = QueryScaling(); - params.physicalPageSize = QueryPhysicalPageSize(); - - // - // We simulate imageable area by assuming a constant margin of - // around the entire page - // - params.imageableArea.x = g_pageMargin * xpsDPI; - params.imageableArea.y = g_pageMargin * xpsDPI; - params.imageableArea.height = params.physicalPageSize.height - - 2 * g_pageMargin * xpsDPI; - params.imageableArea.width = params.physicalPageSize.width - - 2 * g_pageMargin * xpsDPI; - - return params; -} - -// -//Routine Name: -// -// PrintTicketHandler::QueryDPI -// -//Routine Description: -// -// Queries the DPI from the Print Ticket using an XPath query. -// -//Return Value: -// -// FLOAT -// DPI from the Print Ticket. -// -FLOAT -PrintTicketHandler::QueryDPI() -{ - // - // Default DPI: 96 DPI - // - FLOAT dpi = 96.0; - - // - // Perform the page resolution query on the print ticket - // - IXMLDOMNodeList_t pNodes; - - // - // The following XPath query is fairly straightforward, except for the - // predicate attached to Feature. This is necessary to match both the - // keyword AND the namespace of the "name" of the Feature as in: - // - // - // - // In order to match the keyword, we match the substring after the colon: - // - // [substring-after(@name,':')='PageResolution'] - // - // We also need to ensure that the namespace refers to the correct - // printschemakeywords namespace. Thus we get: - // - // [name(namespace::*[.=PRINTSCHEMAKEYWORDNS])=substring-before(@name,':')] - // - // where PRINTSCHEMAKEYWORDNS is: - // - // http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords - // - BSTR_t query(L"psf:PrintTicket/psf:Feature[substring-after(@name,':')='PageResolution']" - L"[name(namespace::*[.='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords'])=substring-before(@name,':')]" - L"/*/*/psf:Value"); - - THROW_ON_FAILED_HRESULT( - m_pDOMDoc->selectNodes(query, &pNodes) - ); - - if (pNodes) - { - // - // The Print Ticket may have both X and Y resolutions defined, but - // the Xps Rasterization Service only accepts a single resolution. - // We query for both X and Y resolutions and take the larger of the - // two as the destination DPI. The resultant raster data could then - // be scaled down in the other dimension to achieve the non-square - // pixels. - // - - LONG numResolutions; - - THROW_ON_FAILED_HRESULT( - pNodes->get_length(&numResolutions) - ); - - if (numResolutions != 0 && - numResolutions != 1 && - numResolutions != 2) - { - // - // We expect 0, 1, or 2 resolutions to be set in the Print Ticket. - // Throw if this is not the case. - // - THROW_ON_FAILED_HRESULT(E_UNEXPECTED); - } - - LONG maxResolution = 0; - - for (INT i = 0; i < numResolutions; i++) - { - IXMLDOMNode_t pCurrentNode; - - THROW_ON_FAILED_HRESULT( - pNodes->get_item(i, &pCurrentNode) - ); - - BSTR_t strResolution; - - THROW_ON_FAILED_HRESULT( - pCurrentNode->get_text(&strResolution) - ); - - LONG resolution; - - THROW_ON_FAILED_HRESULT( - ::VarI4FromStr( - strResolution, - LOCALE_USER_DEFAULT, - 0, // no custom flags - &resolution - ) - ); - - if (resolution > maxResolution) - { - maxResolution = resolution; - } - } - - dpi = static_cast(maxResolution); - } - - DoTraceMessage(XPSRASFILTER_TRACE_VERBOSE, L"Got DPI: %f", dpi); - - return dpi; -} - -// -//Routine Name: -// -// PrintTicketHandler::QueryPhysicalPageSize -// -//Routine Description: -// -// Queries the physical page size from the -// Print Ticket using an XPath query. -// -//Return Value: -// -// XPS_SIZE -// Physical page size from the Print Ticket (in XPS units). -// -XPS_SIZE -PrintTicketHandler::QueryPhysicalPageSize() -{ - // - // Default page size: 8.5" x 11" at Xps DPI - // - XPS_SIZE pageSize = {11.0f * xpsDPI, - 8.5f * xpsDPI}; - - { - // - // Perform the page width query on the print ticket - // - IXMLDOMNode_t pNode; - - // - // See the comment in PrintTicketHandler::QueryDPI() for details - // about this XPath query. - // - BSTR_t query(L"psf:PrintTicket/psf:Feature[substring-after(@name,':')='PageMediaSize']" - L"[name(namespace::*[.='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords'])=substring-before(@name,':')]" - L"/*/psf:ScoredProperty[substring-after(@name,':')='MediaSizeWidth']" - L"[name(namespace::*[.='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords'])=substring-before(@name,':')]" - L"/psf:Value"); - - THROW_ON_FAILED_HRESULT( - m_pDOMDoc->selectSingleNode(query, &pNode) - ); - - if (pNode) - { - BSTR_t strWidth; - THROW_ON_FAILED_HRESULT( - pNode->get_text(&strWidth) - ); - - LONG width; - THROW_ON_FAILED_HRESULT( - ::VarI4FromStr( - strWidth, - LOCALE_USER_DEFAULT, - 0, // no custom flags - &width - ) - ); - - // - // the page dimensions are in microns; convert to Xps units - // - pageSize.width = MicronsToXpsUnits(width); - } - } - - { - // - // Perform the page height query on the print ticket - // - IXMLDOMNode_t pNode; - - // - // See the comment in PrintTicketHandler::QueryDPI() for details - // about this XPath query. - // - BSTR_t query(L"psf:PrintTicket/psf:Feature[substring-after(@name,':')='PageMediaSize']" - L"[name(namespace::*[.='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords'])=substring-before(@name,':')]" - L"/*/psf:ScoredProperty[substring-after(@name,':')='MediaSizeHeight']" - L"[name(namespace::*[.='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords'])=substring-before(@name,':')]" - L"/psf:Value"); - - THROW_ON_FAILED_HRESULT( - m_pDOMDoc->selectSingleNode(query, &pNode) - ); - - if (pNode) - { - BSTR_t strHeight; - THROW_ON_FAILED_HRESULT( - pNode->get_text(&strHeight) - ); - - LONG height; - THROW_ON_FAILED_HRESULT( - ::VarI4FromStr( - strHeight, - LOCALE_USER_DEFAULT, - 0, // no custom flags - &height - ) - ); - - // - // the page dimensions are in microns; convert to Xps unit - // - pageSize.height = MicronsToXpsUnits(height); - } - } - - { - // - // Perform the landscape query on the print ticket - // - IXMLDOMNode_t pNode; - - // - // See the comment in PrintTicketHandler::QueryDPI() for details - // about this XPath query. - // - BSTR_t query(L"psf:PrintTicket/psf:Feature[substring-after(@name,':')='PageOrientation']" - L"[name(namespace::*[.='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords'])=substring-before(@name,':')]" - L"/psf:Option[substring-after(@name,':')='Landscape']" - L"[name(namespace::*[.='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords'])=substring-before(@name,':')]"); - - THROW_ON_FAILED_HRESULT( - m_pDOMDoc->selectSingleNode(query, &pNode) - ); - - if (pNode) - { - // - // landscape. swap height and width. - // - FLOAT tmp; - - tmp = pageSize.height; - pageSize.height = pageSize.width; - pageSize.width = tmp; - } - - DoTraceMessage(XPSRASFILTER_TRACE_VERBOSE, L"Physical Page Size: %f x %f", pageSize.width, pageSize.height); - } - - return pageSize; -} - -// -//Routine Name: -// -// PrintTicketHandler::QueryScaling -// -//Routine Description: -// -// Queries the desired type of scaling from the -// Print Ticket using an XPath query. -// -//Return Value: -// -// PrintTicketScaling -// Scaling type from the Print Ticket. -// -PrintTicketScaling -PrintTicketHandler::QueryScaling() -{ - // - // Default Scaling: FitApplicationBleedSizeToPageImageableSize - // - PrintTicketScaling scaling = SCALE_BLEEDTOIMAGEABLE; - - // - // We do not query for media scaling. Rather, we always return - // the equivalent of FitApplicationBleedSizeToPageImageableSize - // - return scaling; -} - -} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/PThandler.h b/print/XpsRasFilter/src/PThandler.h deleted file mode 100644 index 103e5d78..00000000 --- a/print/XpsRasFilter/src/PThandler.h +++ /dev/null @@ -1,112 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// PThandler.h -// -// Abstract: -// -// Print Ticket Handler class declaration. -// - -#pragma once - -namespace xpsrasfilter -{ - -class PrintTicketHandler -{ -public: - static - PrintTicketHandler_t - CreatePrintTicketHandler( - const IPrintPipelinePropertyBag_t &pPropertyBag - ); - - void - ProcessPart( - const IFixedDocumentSequence_t &pFDS - ); - - void - ProcessPart( - const IFixedDocument_t &pFD - ); - - void - ProcessPart( - const IFixedPage_t &pFP - ); - - ParametersFromPrintTicket - GetMergedPrintTicketParams(); - -private: - // - // Constructor is private; use CreatePrintTicketHandler - // to create instances. - // - PrintTicketHandler( - const IXMLDOMDocument2_t &pDoc, - SafeHPTProvider_t pHProvider, - const IStream_t &pUserPrintTicket - ); - - IStream_t - ProcessPrintTicket( - const IStream_t &pBasePrintTicket, - const IPartPrintTicket_t &pDeltaPrintTicketPart, - EPrintTicketScope scope - ); - - // - // Inline function to convert from microns to Xps Units - // - inline - FLOAT - MicronsToXpsUnits( - long dimensionInMicrons - ) - { - const FLOAT micronsPerInch = 25400.0f; // 2.54 cm/in --> 25400 um/in - - return ((static_cast(dimensionInMicrons) / micronsPerInch) * xpsDPI); - } - - // - // Routines to query parameters from the DOM document - // - FLOAT - QueryDPI(); - - XPS_SIZE - QueryPhysicalPageSize(); - - PrintTicketScaling - QueryScaling(); - - // - // MSXML DOM document - // - IXMLDOMDocument2_t m_pDOMDoc; - - // - // Handle to the Print Ticket Provider - // - SafeHPTProvider_t m_pHProvider; - - // - // Cached Print Tickets - // - IStream_t m_pDefaultUserPrintTicket; - IStream_t m_pJobPrintTicket; - IStream_t m_pDocumentPrintTicket; - IStream_t m_pPagePrintTicket; -}; - -} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/UnknownBase.h b/print/XpsRasFilter/src/UnknownBase.h deleted file mode 100644 index 5ecd2487..00000000 --- a/print/XpsRasFilter/src/UnknownBase.h +++ /dev/null @@ -1,158 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// UnknownBase.h -// -// Abstract: -// -// IUnknown implementation common to filter components derived from -// IUnknown. -// - -#pragma once - -namespace xpsrasfilter -{ - -template -class UnknownBase : public Interface -{ -public: - UnknownBase() : m_cRef(1) { } - virtual ~UnknownBase() { }; - - // - //Routine Name: - // - // UnknownBase::QueryInterface - // - //Routine Description: - // - // Implements IUnknown QueryInterface. - // - //Arguments: - // - // riid - id of the interface - // ppv - void pointer to the requested interface - // - //Return Value: - // - // HRESULT - // S_OK - On success - // E_NOINTERFACE - Invalid interface - // - _Must_inspect_result_ - HRESULT STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID riid, - _Outptr_ PVOID *ppv - ) - { - HRESULT hr = S_OK; - - if (ppv == NULL) - { - WPP_LOG_ON_FAILED_HRESULT(E_POINTER); - - return E_POINTER; - } - - if (riid == IID_IUnknown) - { - *ppv = static_cast(this); - } - else if (riid == __uuidof(Interface)) - { - *ppv = static_cast(this); - } - else - { - *ppv = NULL; - WPP_LOG_ON_FAILED_HRESULT( - hr = E_NOINTERFACE - ); - } - - if (SUCCEEDED(hr)) - { - AddRef(); - } - - return hr; - } - - // - //Routine Name: - // - // UnknownBase::AddRef - // - //Routine Description: - // - // Implements IUnknown reference count increment - // on the current interface. - // - //Arguments: - // - // None - // - //Return Value: - // - // ULONG - // New reference count - // - ULONG STDMETHODCALLTYPE - AddRef() - { - return ::InterlockedIncrement(&m_cRef); - } - - // - //Routine Name: - // - // UnknownBase::Release - // - //Routine Description: - // - // Implements IUnknown reference count decrement - // on the current interface. - // - //Arguments: - // - // None - // - //Return Value: - // - // ULONG - // New reference count - // - //Note: - // - // The drv_at annotation tells Prefast to consider this object's memory - // freed after Release has been called. - // - _At_(this, __drv_freesMem(object)) - ULONG STDMETHODCALLTYPE - Release() - { - ULONG cRef = ::InterlockedDecrement(&m_cRef); - - if (0 == cRef) - { - delete this; - } - - return cRef; - } - -private: - volatile ULONG m_cRef; // interface reference count -}; - -} // namespace xpsrasfilter - diff --git a/print/XpsRasFilter/src/WppTrace.cpp b/print/XpsRasFilter/src/WppTrace.cpp deleted file mode 100644 index b788c461..00000000 --- a/print/XpsRasFilter/src/WppTrace.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// WppTrace.h -// -// Abstract: -// -// WPP tracing definitions. -// - -#include "precomp.h" -#include "WppTrace.h" - -#include "WppTrace.tmh" - -namespace xpsrasfilter -{ - -void TraceFailedHRESULT( - HRESULT hr, - char const *fileName, - int lineNum, - wchar_t const *extraText - ) -{ - DoTraceMessage(XPSRASFILTER_TRACE_ERROR, - "Failed HRESULT (%!HRESULT!) at %s:%d (%S)", - hr, - fileName, - lineNum, - extraText - ); -} - -} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/WppTrace.h b/print/XpsRasFilter/src/WppTrace.h deleted file mode 100644 index 4f33db3b..00000000 --- a/print/XpsRasFilter/src/WppTrace.h +++ /dev/null @@ -1,58 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// WppTrace.h -// -// Abstract: -// -// WPP tracing definitions. -// - -#pragma once - -#define WPP_CONTROL_GUIDS WPP_DEFINE_CONTROL_GUID( \ - XpsRasFilter, \ - (EB4C6075, 0B67, 4a79, A0A3, 7CD9DF881194), \ - WPP_DEFINE_BIT(XPSRASFILTER_TRACE_ERROR) \ - WPP_DEFINE_BIT(XPSRASFILTER_TRACE_WARNING) \ - WPP_DEFINE_BIT(XPSRASFILTER_TRACE_INFO) \ - WPP_DEFINE_BIT(XPSRASFILTER_TRACE_VERBOSE) \ - ) - -#define WPP_LOG_ON_FAILED_HRESULT_WITH_TEXT(func_,text_) \ - { \ - HRESULT hr_ = func_; \ - if (FAILED(hr_)) \ - { \ - xpsrasfilter::TraceFailedHRESULT( \ - hr_, \ - __FILE__, \ - __LINE__, \ - text_ \ - ); \ - } \ - } - -#define WPP_LOG_ON_FAILED_HRESULT(func_) \ - { \ - WPP_LOG_ON_FAILED_HRESULT_WITH_TEXT(func_, L"") \ - } - -namespace xpsrasfilter -{ - -void -TraceFailedHRESULT( - HRESULT hr, - char const *fileName, - int lineNum, - wchar_t const *extraText - ); - -} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/dllentry.cpp b/print/XpsRasFilter/src/dllentry.cpp deleted file mode 100644 index 8e19ae16..00000000 --- a/print/XpsRasFilter/src/dllentry.cpp +++ /dev/null @@ -1,326 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// dllentry.cpp -// -// Abstract: -// -// Xps Rasterization Service filter DLL entry points. -// - -#include "precomp.h" -#include "WppTrace.h" -#include "Exception.h" -#include "filtertypes.h" -#include "UnknownBase.h" -#include "xpsrasfilter.h" - -#include "dllentry.tmh" - -namespace xpsrasfilter -{ - -// -// Class Factory returned by DllGetClassObject() -// -class __declspec( uuid("CFF7BE69-E62D-403b-BE4F-48EC73F5DA1A") ) XPSRasFilterFactory : public UnknownBase -{ -public: - XPSRasFilterFactory() : - m_serverLocks(0) - { - ::InterlockedIncrement(&XPSRasFilter::ms_numObjects); - } - - ~XPSRasFilterFactory() - { - ::InterlockedDecrement(&XPSRasFilter::ms_numObjects); - } - - // - //Routine Name: - // - // XPSRasFilterFactory::CreateInstance - // - //Routine Description: - // - // Returns an instance of XPSRasFilter. - // - //Arguments: - // - // pUnkOuter - Outer class (must be NULL) - // riid - Requested interface (IPrintPipelineFilter) - // ppvObject - Pointer to the requested interface - // - //Return Value: - // - // HRESULT - // S_OK - On success - // Otherwise - Failure - // - HRESULT - STDMETHODCALLTYPE - CreateInstance( - IUnknown *pUnkOuter, - REFIID riid, - void **ppvObject - ) - { - HRESULT hr = S_OK; - - if (pUnkOuter != NULL) - { - WPP_LOG_ON_FAILED_HRESULT(CLASS_E_NOAGGREGATION); - - return CLASS_E_NOAGGREGATION; - } - - if (ppvObject == NULL) - { - WPP_LOG_ON_FAILED_HRESULT(E_POINTER); - - return E_POINTER; - } - - *ppvObject = NULL; - - xpsrasfilter::XPSRasFilter *pFilter = NULL; - - // - // XpsRasFilter::XpsRasFilter() can throw, as can new - // - try - { - DoTraceMessage(XPSRASFILTER_TRACE_INFO, L"Instantiating filter"); - pFilter = new xpsrasfilter::XPSRasFilter(); - } - CATCH_VARIOUS(hr) - - if (SUCCEEDED(hr)) - { - WPP_LOG_ON_FAILED_HRESULT( - hr = pFilter->QueryInterface(riid, ppvObject) - ); - - pFilter->Release(); - } - - return hr; - } - - // - //Routine Name: - // - // XPSRasFilterFactory::LockServer - // - //Routine Description: - // - // Allows clients to lock the filter factory in - // memory. - // - //Arguments: - // - // fLock - TRUE - lock; FALSE - unlock - // - //Return Value: - // - // HRESULT - // S_OK - On success - // - HRESULT - STDMETHODCALLTYPE - LockServer( - BOOL fLock - ) - { - LONG result; - - if (fLock) // lock - { - result = ::InterlockedIncrement(&m_serverLocks); - - if (result == 1) - { - // - // This was the first 'lock' call; increment the - // global numObjects - // - ::InterlockedIncrement(&XPSRasFilter::ms_numObjects); - } - } - else // unlock - { - result = ::InterlockedDecrement(&m_serverLocks); - - if (result == 0) - { - // - // All locks have been unlocked; decrement the - // global numObjects - // - ::InterlockedDecrement(&XPSRasFilter::ms_numObjects); - } - } - - return S_OK; - } - -private: - volatile LONG m_serverLocks; -}; - -} // namespace xpsrasfilter - -// -//Routine Name: -// -// DllGetClassObject -// -//Routine Description: -// -// Returns an instance of XPSRasFilterFactory. -// -//Arguments: -// -// rclsid - Requested class (XPSRasFilter) -// riid - Requested interface (IClassFactory) -// ppv - Pointer to the requested interface -// -//Return Value: -// -// HRESULT -// S_OK - On success -// Otherwise - Failure -// -STDAPI -DllGetClassObject( - _In_ REFCLSID rclsid, - _In_ REFIID riid, - _Outptr_ LPVOID *ppv - ) -{ - HRESULT hr = S_OK; - - if (ppv == NULL) - { - WPP_LOG_ON_FAILED_HRESULT(E_POINTER); - - return E_POINTER; - } - - *ppv = NULL; - - if (rclsid != __uuidof(xpsrasfilter::XPSRasFilterFactory)) - { - WPP_LOG_ON_FAILED_HRESULT(CLASS_E_CLASSNOTAVAILABLE); - - return CLASS_E_CLASSNOTAVAILABLE; - } - - DoTraceMessage(XPSRASFILTER_TRACE_INFO, L"Instantiating class factory"); - - xpsrasfilter::XPSRasFilterFactory *pFactory = NULL; - pFactory = new(std::nothrow) xpsrasfilter::XPSRasFilterFactory(); - - if (pFactory == NULL) - { - WPP_LOG_ON_FAILED_HRESULT(E_OUTOFMEMORY); - - hr = E_OUTOFMEMORY; - } - - if (SUCCEEDED(hr)) - { - WPP_LOG_ON_FAILED_HRESULT( - hr = pFactory->QueryInterface(riid, ppv) - ); - - pFactory->Release(); - } - - return hr; -} - -// -//Routine Name: -// -// DllCanUnloadNow -// -//Routine Description: -// -// Checks whether the DLL can be unloaded. That is, -// whether there are any instances of XPSRasFilter. -// -//Arguments: -// -// None -// -//Return Value: -// -// HRESULT -// S_OK - Can unload. -// Otherwise - Cannot unload. -// -STDAPI -DllCanUnloadNow() -{ - return (0 == xpsrasfilter::XPSRasFilter::ms_numObjects) ? S_OK : S_FALSE; -} - -// -//Routine Name: -// -// DllMain -// -//Routine Description: -// -// Initializes WPP tracing when the DLL is loaded -// and cleans up WPP tracing when the DLL is unloaded. -// -//Arguments: -// -// None -// -//Return Value: -// -// HRESULT -// S_OK - On success. -// Otherwise - Otherwise. -// -extern "C" -BOOL -WINAPI -DllMain( - _In_ HINSTANCE hinstDLL, - _In_ DWORD fdwReason, - _In_opt_ LPVOID /*lpvReserved*/ - ) -{ - switch(fdwReason) - { - case DLL_PROCESS_ATTACH: - - ::DisableThreadLibraryCalls(hinstDLL); - - WPP_INIT_TRACING(L"XpsRasFilter"); - DoTraceMessage(XPSRASFILTER_TRACE_INFO, L"DLL_PROCESS_ATTACH"); - - break; - - case DLL_PROCESS_DETACH: - - DoTraceMessage(XPSRASFILTER_TRACE_INFO, L"DLL_PROCESS_DETACH"); - WPP_CLEANUP(); - - break; - } - - return TRUE; -} - diff --git a/print/XpsRasFilter/src/filtertypes.h b/print/XpsRasFilter/src/filtertypes.h deleted file mode 100644 index 6b5c35e6..00000000 --- a/print/XpsRasFilter/src/filtertypes.h +++ /dev/null @@ -1,497 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// filtertypes.h -// -// Abstract: -// -// Smart pointer types. Shared structures and enums. -// - -#pragma once - -// -// XpsDrv Print Pipeline types -// -typedef CComPtr IXpsDocument_t; -typedef CComPtr IFixedDocumentSequence_t; -typedef CComPtr IFixedDocument_t; -typedef CComPtr IFixedPage_t; -typedef CComPtr IPrintReadStreamFactory_t; -typedef CComPtr IPrintReadStream_t; -typedef CComPtr IPrintWriteStream_t; -typedef CComPtr IInterFilterCommunicator_t; -typedef CComPtr IPrintPipelinePropertyBag_t; -typedef CComPtr IPrintPipelineManagerControl_t; -typedef CComPtr IXpsDocumentProvider_t; -typedef CComPtr IXpsDocumentConsumer_t; -typedef CComPtr IXpsPartIterator_t; -typedef CComPtr IPartBase_t; -typedef CComPtr IPartFont2_t; -typedef CComPtr IPartFont_t; -typedef CComPtr IPartImage_t; -typedef CComPtr IPartColorProfile_t; -typedef CComPtr IPartResourceDictionary_t; -typedef std::vector> ResourceDictionaryList_t; -typedef CComPtr IPartPrintTicket_t; - -// -// Xps Object Model types -// -typedef CComPtr IXpsOMObjectFactory_t; -typedef CComPtr IXpsOMPartResources_t; -typedef CComPtr IXpsOMFontResourceCollection_t; -typedef CComPtr IXpsOMImageResourceCollection_t; -typedef CComPtr IXpsOMColorProfileResourceCollection_t; -typedef CComPtr IXpsOMRemoteDictionaryResourceCollection_t; -typedef CComPtr IXpsOMFontResource_t; -typedef CComPtr IXpsOMImageResource_t; -typedef CComPtr IXpsOMColorProfileResource_t; -typedef CComPtr IXpsOMRemoteDictionaryResource_t; -typedef CComPtr IXpsOMPage_t; - -// -// Opc Types -// -typedef CComPtr IOpcFactory_t; -typedef CComPtr IOpcPartUri_t; - -// -// Common types -// -typedef CComPtr IStream_t; -typedef CComPtr IUnknown_t; -typedef CComBSTR BSTR_t; -typedef CComVariant Variant_t; -typedef CComPtr IPropertyBag2_t; - -// -// WIC types -// -typedef CComPtr IWICImagingFactory_t; -typedef CComPtr IWICBitmap_t; -typedef CComPtr IWICStream_t; -typedef CComPtr IWICBitmapEncoder_t; -typedef CComPtr IWICBitmapFrameEncode_t; - -// -// Xps Rasterization Service types -// -typedef CComPtr IXpsRasterizationFactory_t; -typedef CComPtr IXpsRasterizer_t; - -// -// MSXML DOM types -// -typedef CComPtr IXMLDOMDocument2_t; -typedef CComPtr IXMLDOMNode_t; -typedef CComPtr IXMLDOMNodeList_t; - -namespace xpsrasfilter -{ - -// -// Supported types of print ticket scaling -// -enum PrintTicketScaling -{ - SCALE_NONE, - SCALE_BLEEDTOIMAGEABLE, - SCALE_CONTENTTOIMAGEABLE, - SCALE_MEDIASIZETOIMAGEABLE, - SCALE_MEDIASIZETOMEDIASIZE -}; - -// -// Parameters that can be read from the Print Ticket -// to feed into rasterization calculations. -// -struct ParametersFromPrintTicket -{ - XPS_SIZE physicalPageSize; // in XPS units - PrintTicketScaling scaling; // scaling type - FLOAT destDPI; // target rasterization dpi - XPS_RECT imageableArea; // in XPS units -}; - -// -// Parameters read from the FixedPage -// to feed into rasterization calculations. -// -struct ParametersFromFixedPage -{ - XPS_SIZE fixedPageSize; // in XPS units - XPS_RECT bleedBoxRect; // in XPS units - XPS_RECT contentBoxRect; // in XPS units -}; - -// -// Forward Declarations -// -class RasterizationInterface; -class PrintTicketHandler; -class TiffStreamBitmapHandler; -class FilterLiveness; - -} // namespace xpsrasfilter - -// -// This class handles setting and clearing the security -// context, based on a token. This token is retrieved from -// the filter pipeline, and we do not want to free it. -// -class ScopeImpersonation -{ -public: - ScopeImpersonation( - HANDLE token - ) - { - if ( - !SetThreadToken( - NULL, // set the current thread's token - token - ) - ) - { - THROW_LAST_ERROR(); - } - } - - ~ScopeImpersonation() - { - if ( - !SetThreadToken( - NULL, // set the current thread's token - NULL // revert to default security context - ) - ) - { - // - // We couldn't revert the security context. The filter pipeline - // manager will clean up the thread when operation is complete, - // when it is determined that the security context was not - // reverted. Since there are no security implications with - // running this filter in an elevated context, we can log the - // error and continue to run. - // - DWORD error = ::GetLastError(); - - WPP_LOG_ON_FAILED_HRESULT_WITH_TEXT( - HRESULT_FROM_WIN32(error), - L"Failed to revert thread security context." - ); - } - } - -private: - ScopeImpersonation(ScopeImpersonation const&); - ScopeImpersonation& operator=(ScopeImpersonation const&); -}; - -// -// RAII object to make HGLOBAL locks exception-safe. This requires -// unlocking during unwind. -// -class HGlobalLock -{ -public: - HGlobalLock( - HGLOBAL hG - ) : - m_hGlobal(hG) - { - m_pAddress = static_cast( - ::GlobalLock(m_hGlobal) - ); - - if (!m_pAddress) - { - THROW_LAST_ERROR(); - } - } - - ~HGlobalLock() - { - if (!::GlobalUnlock(m_hGlobal)) - { - WPP_LOG_ON_FAILED_HRESULT( - HRESULT_FROM_WIN32(::GetLastError()) - ); - } - } - - BYTE* - GetAddress() - { - return m_pAddress; - } -private: - HGLOBAL m_hGlobal; - BYTE *m_pAddress; - - HGlobalLock(HGlobalLock const&); - HGlobalLock& operator=(HGlobalLock const&); - -}; - -typedef std::auto_ptr HGlobalLock_t; - -// -// Safe handle to make HGLOBAL exception-safe. This requires both -// freeing and unlocking during unwind. -// -class SafeHGlobal -{ -public: - - SafeHGlobal( - UINT flags, - SIZE_T size - ) - { - m_hGlobal = ::GlobalAlloc(flags, size); - - if (!m_hGlobal) - { - THROW_ON_FAILED_HRESULT(E_OUTOFMEMORY); - } - } - - virtual - ~SafeHGlobal() - { - if (m_hGlobal) - { - // - // Free the HGLOBAL - // - ::GlobalFree(m_hGlobal); - } - } - - operator HGLOBAL() - { - return m_hGlobal; - } - - // - // Passes ownership of the HGLOBAL from this safe handle - // to a new IStream. - // - IStream_t - ConvertToIStream() - { - IStream_t pStream; - - THROW_ON_FAILED_HRESULT( - ::CreateStreamOnHGlobal( - m_hGlobal, - TRUE, // Free the HGLOBAL on Release of the stream - &pStream - ) - ); - - m_hGlobal = NULL; - - return pStream; - } - - HGlobalLock_t - Lock() - { - HGlobalLock_t toReturn( - new HGlobalLock(m_hGlobal) - ); - return toReturn; - } - -private: - - HGLOBAL m_hGlobal; - - SafeHGlobal(SafeHGlobal const&); - SafeHGlobal& operator=(SafeHGlobal const&); - -}; - -// -// Safe handle to make HPTPROVIDER exception safe. This -// requires closing the provider during unwind. -// -class SafeHPTProvider -{ -public: - SafeHPTProvider( - const wchar_t *printerName, - HANDLE userSecurityToken - ) : - m_token(userSecurityToken) - { - // - // We impersonate the user while we call PTQuerySchemaVersionSupport - // and PTOpenProviderEx. - // - ScopeImpersonation impersonate(m_token); - - DWORD maxVersion, - tempVersion; - - THROW_ON_FAILED_HRESULT( - ::PTQuerySchemaVersionSupport( - printerName, - &maxVersion - ) - ); - - THROW_ON_FAILED_HRESULT( - ::PTOpenProviderEx( - printerName, - maxVersion, // maximum version - maxVersion, // preferred version - &m_hProvider, - &tempVersion // version used by the provider - ) - ); - } - - virtual - ~SafeHPTProvider() - { - WPP_LOG_ON_FAILED_HRESULT( - ::PTCloseProvider(m_hProvider) - ); - } - - void - PTMergeAndValidatePrintTicket( - const IStream_t &pBasePrintTicket, - const IStream_t &pDeltaPrintTicket, - EPrintTicketScope scope, - _Inout_ IStream_t &pMergedPrintTicket - ) - { - // - // We impersonate the user while we call PTMergeAndValidatePrintTicket. - // - ScopeImpersonation impersonate(m_token); - - BSTR_t error; - - HRESULT hr = ::PTMergeAndValidatePrintTicket( - m_hProvider, - pBasePrintTicket, - pDeltaPrintTicket, - scope, - pMergedPrintTicket, - &error - ); - - WPP_LOG_ON_FAILED_HRESULT_WITH_TEXT( - hr, - error - ); - - THROW_ON_FAILED_HRESULT(hr); - } - -private: - - HPTPROVIDER m_hProvider; - HANDLE m_token; - - SafeHPTProvider(SafeHPTProvider const&); - SafeHPTProvider& operator=(SafeHPTProvider const&); -}; - -// -// CoInitialize/CoUninitialize RAII object -// -// This object ensures that COM is initialized for the duration -// of the XpsRasFilter's lifetime, and then uninitialized after -// all of the COM objects, regardless of how the filter exits -// -class SafeCoInit -{ -public: - SafeCoInit() : - m_doCoUninitialize(FALSE) - { - // - // Initialize COM - // - HRESULT hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); - - if (FAILED(hr) && - hr != RPC_E_CHANGED_MODE) - { - // - // RPC_E_CHANGED_MODE indicates that we attempted to change the - // threading model. It is safe to ignore since we do not *require* - // multi-threading. Throw on any other errors. - // - - THROW_ON_FAILED_HRESULT(hr); - } - else if (SUCCEEDED(hr)) - { - // - // It is important that we only call CoUninitialize() if we - // succeeded in setting the threading model. - // - - m_doCoUninitialize = TRUE; - } - } - - ~SafeCoInit() - { - if (m_doCoUninitialize) - { - ::CoUninitialize(); - } - } -private: - SafeCoInit(SafeCoInit const&); - SafeCoInit& operator=(SafeCoInit const&); - - BOOL m_doCoUninitialize; -}; - -// -// RAII object to make VARIANT exception-safe. This requires -// VariantClear during unwind. -// -class SafeVariant : public VARIANT -{ -public: - SafeVariant() - { - ::VariantInit(this); - } - - ~SafeVariant() - { - ::VariantClear(this); - } -private: - SafeVariant(SafeVariant const&); - SafeVariant& operator=(SafeVariant const&); -}; - -// -// Internal Types -// -typedef std::auto_ptr RasterizationInterface_t; -typedef std::auto_ptr PrintTicketHandler_t; -typedef std::auto_ptr TiffStreamBitmapHandler_t; -typedef std::auto_ptr SafeHGlobal_t; -typedef std::auto_ptr SafeHPTProvider_t; -typedef CComPtr FilterLiveness_t; - diff --git a/print/XpsRasFilter/src/precomp.h b/print/XpsRasFilter/src/precomp.h deleted file mode 100644 index 8cfbe37b..00000000 --- a/print/XpsRasFilter/src/precomp.h +++ /dev/null @@ -1,87 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// precomp.h -// -// Abstract: -// -// Precompiled header for the Xps Rasterization Service sample filter. -// - -#pragma once - -// -// Define this as a usermode driver for analysis purposes -// -#include -__user_driver - -// -// Standard Annotation Language include -// -#include - -// -// Windows includes -// -#include - -// Standard includes -#include -#include -#include -#include - -// STL -#include - -// -// COM includes -// -#include -#include - -// -// Filter pipeline includes -// -#include -#include -#include -#include - -// -// ATL -// -#include - -// -// WIC -// -#include - -// -// MSXML -// -#include - -// -// OPC Layer -// -#include - -// -// Xps Object Model -// -#include - -// -// Xps Rasterization Service -// -#include - diff --git a/print/XpsRasFilter/src/precompsrc.cpp b/print/XpsRasFilter/src/precompsrc.cpp deleted file mode 100644 index 5944cf51..00000000 --- a/print/XpsRasFilter/src/precompsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/XpsRasFilter/src/rasinterface.cpp b/print/XpsRasFilter/src/rasinterface.cpp deleted file mode 100644 index adbf73e4..00000000 --- a/print/XpsRasFilter/src/rasinterface.cpp +++ /dev/null @@ -1,412 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// rasinterface.cpp -// -// Abstract: -// -// Class to wrap rasterization-related calculations, interactions with -// the Xps Rasterization Service, Xps Rasterization Service Callback, -// and eventual raster output (i.e. TIFF encoding) -// - -#include "precomp.h" -#include "WppTrace.h" -#include "Exception.h" -#include "filtertypes.h" -#include "UnknownBase.h" -#include "xpsrasfilter.h" -#include "OMConvertor.h" -#include "rasinterface.h" -#include "BitmapHandler.h" - -#include "rasinterface.tmh" - -namespace xpsrasfilter -{ - -// -//Routine Name: -// -// RasterizationInterface::CreateRasterizationInterface -// -//Routine Description: -// -// Static factory method that creates an instance of -// RasterizationInterface. -// -//Arguments: -// -// pPropertyBag - Property Bag -// pStream - Filter output stream (IPrintWriteStream) -// -//Return Value: -// -// RasterizationInterface_t (smart ptr) -// The new RasterizationInterface. -// -RasterizationInterface_t -RasterizationInterface::CreateRasterizationInterface( - const IPrintPipelinePropertyBag_t &pPropertyBag, - const IPrintWriteStream_t &pStream - ) -{ - Variant_t varRasFactory; - IXpsRasterizationFactory_t pXPSRasFactory; - - // - // Get the Xps Rasterization Service factory. Since XpsRasterService.dll - // is specified as an OptionalFilterServiceProvider in the filter pipeline - // configuration file, the factory may not be available in the property bag - // (e.g. when running on Windows Vista, Windows XP, etc). In this case, - // this call will fail and the filter could fail, as we do here, or could - // default to some other behavior. - // - THROW_ON_FAILED_HRESULT( - pPropertyBag->GetProperty( - L"MS_IXpsRasterizationFactory", - &varRasFactory - ) - ); - - IUnknown_t pUnk(varRasFactory.punkVal); - - THROW_ON_FAILED_HRESULT( - pUnk.QueryInterface(&pXPSRasFactory) - ); - - // - // Prepare the rasterization/encode/stream interface - // - TiffStreamBitmapHandler_t pBitmapHandler( - TiffStreamBitmapHandler::CreateTiffStreamBitmapHandler(pStream) - ); - - RasterizationInterface_t pReturnInterface( - new RasterizationInterface( - pXPSRasFactory, - pBitmapHandler - ) - ); - - return pReturnInterface; -} - -// -//Routine Name: -// -// RasterizationInterface::RasterizationInterface -// -//Routine Description: -// -// Construct the Rasterization Interface with the -// IXpsRasterizationFactory interface and bitmap -// handler. -// -//Arguments: -// -// pRasFactory - Xps Rasterization Service object factory -// pBitmapHandler - Class to handle band bitmaps -// -RasterizationInterface::RasterizationInterface( - const IXpsRasterizationFactory_t &pRasFactory, - TiffStreamBitmapHandler_t pBitmapHandler - ) : m_pXPSRasFactory(pRasFactory), - m_pBitmapHandler(pBitmapHandler) -{ -} - -// -//Routine Name: -// -// RasterizationInterface::FinishRasterization -// -//Routine Description: -// -// Tell the Rasterization Interface that the last -// page has been rasterized. -// -//Arguments: -// -// None -// -void -RasterizationInterface::FinishRasterization() -{ - m_pBitmapHandler->WriteFooter(); -} - - -// -//Routine Name: -// -// RasterizationInterface::RasterizeAndStreamPage -// -//Routine Description: -// -// Given an IXpsOMPage and a set of Print Ticket -// parameters, this method invokes the Xps Rasterization -// Service for each band of the page, and outputs the -// resultant raster data. -// -//Arguments: -// -// pPage - page to rasterize -// printTicketparams - raw parameters from the print ticket(s) -// -void -RasterizationInterface::RasterizePage( - const IXpsOMPage_t &pPage, - const ParametersFromPrintTicket &printTicketParams, - const FilterLiveness_t &pLiveness - ) -{ - // - // Calculate rasterization parameters - // - ParametersFromFixedPage fixedPageParams; - THROW_ON_FAILED_HRESULT( - pPage->GetPageDimensions(&fixedPageParams.fixedPageSize) - ); - THROW_ON_FAILED_HRESULT( - pPage->GetBleedBox(&fixedPageParams.bleedBoxRect) - ); - THROW_ON_FAILED_HRESULT( - pPage->GetContentBox(&fixedPageParams.contentBoxRect) - ); - - RasterizationParameters rastParams( - printTicketParams, - fixedPageParams - ); - - // - // Create the Rasterizer - // - IXpsRasterizer_t rasterizer; - THROW_ON_FAILED_HRESULT( - m_pXPSRasFactory->CreateRasterizer( - pPage, - rastParams.rasterizationDPI, - XPSRAS_RENDERING_MODE_ANTIALIASED, - XPSRAS_RENDERING_MODE_ANTIALIASED, - &rasterizer - ) - ); - - // - // Set the minimal line width to 1 pixel - // - THROW_ON_FAILED_HRESULT( - rasterizer->SetMinimalLineWidth(1) - ); - - // - // Loop over bands - // - INT bandOriginY = 0; - - while (pLiveness->IsAlive() && - bandOriginY < rastParams.rasterHeight) - { - DoTraceMessage(XPSRASFILTER_TRACE_VERBOSE, L"Rasterizing Band"); - - IWICBitmap_t bitmap; - - // - // Calculate the height of this band - // - INT bandHeight = rastParams.bandHeight; - if (bandOriginY + rastParams.bandHeight >= rastParams.rasterHeight) - { - bandHeight = rastParams.rasterHeight - bandOriginY; - } - - // - // Rasterize this band - // - { - HRESULT hr = rasterizer->RasterizeRect( - rastParams.originX, - bandOriginY + rastParams.originY, - rastParams.rasterWidth, - bandHeight, - static_cast(pLiveness), - &bitmap - ); - - // - // Do not throw if we have cancelled rasterization - // - if (hr == HRESULT_FROM_WIN32(ERROR_PRINT_CANCELLED)) - { - DoTraceMessage(XPSRASFILTER_TRACE_VERBOSE, L"Rasterization Cancelled"); - return; - } - - THROW_ON_FAILED_HRESULT(hr); - } - - bandOriginY += bandHeight; - - // - // The resolution of the bitmap defaults to the - // rasterization DPI, which includes the scaling factor. - // We want the output bitmap to reflect the destination DPI. - // - THROW_ON_FAILED_HRESULT( - bitmap->SetResolution( - printTicketParams.destDPI, - printTicketParams.destDPI - ) - ); - - // - // Encode the raster data as TIFF and stream out - // - m_pBitmapHandler->ProcessBitmap(bitmap); - } -} - -// -//Routine Name: -// -// RasterizationParameters::RasterizationParameters -// -//Routine Description: -// -// Given a set of fixed page parameters and a set of Print Ticket -// parameters, this constructor calculates the parameters necessary to -// invoke the Xps Rasterization Service. -// -//Arguments: -// -// printTicketparams - raw parameters from the print ticket(s) -// fixedPageParams - raw parameters from the fixed page -// -RasterizationParameters::RasterizationParameters( - const ParametersFromPrintTicket &printTicketParams, - const ParametersFromFixedPage &fixedPageParams - ) -{ - // - // Rasterize the entire physical page at the desired resolution. The fixed page - // is scaled and traslated to place it correctly witin the physical page. - // - rasterHeight = static_cast( - printTicketParams.physicalPageSize.height - * (printTicketParams.destDPI / xpsDPI) - + 0.5 - ); - rasterWidth = static_cast( - printTicketParams.physicalPageSize.width - * (printTicketParams.destDPI / xpsDPI) - + 0.5 - ); - - // - // Determine the source rectangle for the scale operation - // - XPS_RECT srcRect = {0,0,0,0}; - - switch(printTicketParams.scaling) - { - case SCALE_BLEEDTOIMAGEABLE: - - srcRect = fixedPageParams.bleedBoxRect; - - break; - default: - DoTraceMessage(XPSRASFILTER_TRACE_ERROR, L"Unknown scaling type"); - THROW_ON_FAILED_HRESULT(E_UNEXPECTED); - break; - } - - // - // Determine the destination rectangle for the scale operation - // - XPS_RECT destRect = {0,0,0,0}; - - switch(printTicketParams.scaling) - { - case SCALE_BLEEDTOIMAGEABLE: - - destRect = printTicketParams.imageableArea; - - break; - default: - DoTraceMessage(XPSRASFILTER_TRACE_ERROR, L"Unknown scaling type"); - THROW_ON_FAILED_HRESULT(E_UNEXPECTED); - break; - } - - - // - // Because we want to fit the fixed page into a physical page of - // potentially different aspect ratio, it is necessary to calculate - // the scaling factor assuming either the height or width constrains - // the operation; the rasterization dpi is then the smaller of the two. - // - // - // The basic calculation for scaling factor is: - // - // Scaling Factor = (Destination Dimension / Source Dimension) - // - // Multiplying by desired Destination DPI we get the DPI at which to - // rasterize the source content in order to get the desired size - // - // Rasterization DPI = Scaling Factor * Desired Destination DPI - // - { - FLOAT heightScalingFactor = destRect.height / srcRect.height; - FLOAT widthScalingFactor = destRect.width / srcRect.width; - - FLOAT heightRastDPI = heightScalingFactor * printTicketParams.destDPI; - FLOAT widthRastDPI = widthScalingFactor * printTicketParams.destDPI; - - rasterizationDPI = min(heightRastDPI, widthRastDPI); - } - - // - // To determine the rasterization origin, subtract the translation - // due to the destination rectangle (e.g. imageable area) from the - // translation due to the choice of scale (e.g. bleed box origin) - // - { - FLOAT srcOffsetX = srcRect.x * rasterizationDPI / xpsDPI; - FLOAT srcOffsetY = srcRect.y * rasterizationDPI / xpsDPI; - - FLOAT destOffsetX = destRect.x * printTicketParams.destDPI / xpsDPI; - FLOAT destOffsetY = destRect.y * printTicketParams.destDPI / xpsDPI; - - originX = static_cast(srcOffsetX - destOffsetX - 0.5); - originY = static_cast(srcOffsetY - destOffsetY - 0.5); - } - - // - // The height of each band is determined by the maximum band size (in bytes) - // divided by 4 bytes per pixel to get the total pixels, and then divided by - // the width of the raster data. This results in a band bitmap that is close - // to the target band size. - // - bandHeight = (RasterizationInterface::ms_targetBandSize / 4) / rasterWidth; - - if (bandHeight == 0) - { - // - // The physical page is too wide to rasterize at this - // maximum band size and dpi. Throw. - // - THROW_ON_FAILED_HRESULT( - E_OUTOFMEMORY - ); - } -} - -} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/rasinterface.h b/print/XpsRasFilter/src/rasinterface.h deleted file mode 100644 index 3fae74cf..00000000 --- a/print/XpsRasFilter/src/rasinterface.h +++ /dev/null @@ -1,107 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// rasinterface.h -// -// Abstract: -// -// Class to wrap rasterization-related calculations, interactions with -// the Xps Rasterization Service, Xps Rasterization Service Callback, -// and eventual raster output (i.e. TIFF encoding) -// - -#pragma once - -namespace xpsrasfilter -{ - -class RasterizationInterface -{ -public: - static - RasterizationInterface_t - CreateRasterizationInterface( - const IPrintPipelinePropertyBag_t &pPropertyBag, - const IPrintWriteStream_t &pStream - ); - - RasterizationInterface(); - - void - RasterizePage( - const IXpsOMPage_t &pPage, - const ParametersFromPrintTicket &printTicketParams, - const FilterLiveness_t &pLiveness - ); - - void - CancelRasterization(); - - void - FinishRasterization(); - - // - // Target band size; 16MB - // - const static LONG ms_targetBandSize = 1024 * 1024 * 16; - -private: - - // - // Constructor is private; use CreateRasterizationInterface - // to create instances - // - RasterizationInterface( - const IXpsRasterizationFactory_t &pRasFactory, - TiffStreamBitmapHandler_t pBitmapHandler - ); - - // - // prevent copy semantics - // - RasterizationInterface(const RasterizationInterface&); - RasterizationInterface& operator=(const RasterizationInterface&); - - // - // Internal data members - // - - // - // Xps Rasterization Service Factory - // - IXpsRasterizationFactory_t m_pXPSRasFactory; - - // - // Bitmap Handler - // - TiffStreamBitmapHandler_t m_pBitmapHandler; -}; - -// -// Parameters that determine how a page is rasterized, in the -// units that the Rasterization Service expects -// -struct RasterizationParameters -{ - FLOAT rasterizationDPI; // dpi (scaling factor) - INT rasterHeight; // total size of raster - INT rasterWidth; - INT originX; // origin of the rasterization (translation) - INT originY; - INT bandHeight; // height of individual bands - - RasterizationParameters( - const ParametersFromPrintTicket &printTicketParams, - const ParametersFromFixedPage &fixedPageParams - ); -}; - -const FLOAT xpsDPI = 96.0f; - -} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/xpsrasfilter.cpp b/print/XpsRasFilter/src/xpsrasfilter.cpp deleted file mode 100644 index 1199a540..00000000 --- a/print/XpsRasFilter/src/xpsrasfilter.cpp +++ /dev/null @@ -1,396 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// xpsrasfilter.cpp -// -// Abstract: -// -// Xps Rasterization Service filter implementation. -// - -#include "precomp.h" -#include "WppTrace.h" -#include "Exception.h" -#include "filtertypes.h" -#include "UnknownBase.h" -#include "OMConvertor.h" -#include "rasinterface.h" -#include "BitmapHandler.h" -#include "PThandler.h" -#include "xpsrasfilter.h" - -#include "xpsrasfilter.tmh" - -namespace xpsrasfilter -{ - -long XPSRasFilter::ms_numObjects = 0; // Initialize static object count - -// -//Routine Name: -// -// XPSRasFilter::XPSRasFilter -// -//Routine Description: -// -// Xps Rasterization Service sample filter default constructor. -// -//Arguments: -// -// None -// -//Return Value: -// -// None -// -XPSRasFilter::XPSRasFilter() -{ - // - // Take ownership with no AddRef - // - m_pLiveness.Attach(new FilterLiveness()); - - ::InterlockedIncrement(&ms_numObjects); -} - -// -//Routine Name: -// -// XPSRasFilter::~XPSRasFilter -// -//Routine Description: -// -// Xps Rasterization Service sample filter destructor. -// -//Arguments: -// -// None -// -//Return Value: -// -// None -// -XPSRasFilter::~XPSRasFilter() -{ - ::InterlockedDecrement(&ms_numObjects); -} - -// -//Routine Name: -// -// XPSRasFilter::InitializeFilter -// -//Routine Description: -// -// Exception boundary wrapper for IPrintPipelineFilter initialization. -// -//Arguments: -// -// pICommunicator - interface to interfilter communicator -// pIPropertyBag - interface to pipeline property bag -// pIPipelineControl - interface to pipeline control methods -// -//Return Value: -// -// ULONG -// New reference count -// -_Must_inspect_result_ -HRESULT STDMETHODCALLTYPE -XPSRasFilter::InitializeFilter( - _In_ IInterFilterCommunicator *pICommunicator, - _In_ IPrintPipelinePropertyBag *pIPropertyBag, - _In_ IPrintPipelineManagerControl *pIPipelineControl - ) -{ - DoTraceMessage(XPSRASFILTER_TRACE_INFO, L"Initializing Filter"); - - if (pICommunicator == NULL || - pIPropertyBag == NULL || - pIPipelineControl == NULL) - { - WPP_LOG_ON_FAILED_HRESULT(E_POINTER); - - return E_POINTER; - } - - HRESULT hr = S_OK; - - try - { - InitializeFilter_throws( - pICommunicator, - pIPropertyBag - ); - } - CATCH_VARIOUS(hr); - - return hr; -} - -// -//Routine Name: -// -// XPSRasFilter::InitializeFilter_throws -// -//Routine Description: -// -// Implements IPrintPipelineFilter initialization. Gets -// all necessary communication interfaces. -// -//Arguments: -// -// pICommunicator - interface to interfilter communicator -// pIPropertyBag - interface to pipeline property bag -// -VOID -XPSRasFilter::InitializeFilter_throws( - const IInterFilterCommunicator_t &pICommunicator, - const IPrintPipelinePropertyBag_t &pIPropertyBag - ) -{ - // - // Get the pipeline communication interfaces - // - THROW_ON_FAILED_HRESULT( - pICommunicator->RequestReader(reinterpret_cast(&m_pReader)) - ); - THROW_ON_FAILED_HRESULT( - pICommunicator->RequestWriter(reinterpret_cast(&m_pWriter)) - ); - - { - // - // Check to ensure that the provided interfaces are as expected. - // That is, that the GUIDs were correctly listed in the - // pipeline configuration file - // - IXpsDocumentProvider_t pReaderCheck; - IPrintWriteStream_t pWriterCheck; - - THROW_ON_FAILED_HRESULT( - m_pReader.QueryInterface(&pReaderCheck) - ); - THROW_ON_FAILED_HRESULT( - m_pWriter.QueryInterface(&pWriterCheck) - ); - } - - // - // Save a pointer to the Property Bag for further - // initialization, later. - // - m_pIPropertyBag = pIPropertyBag; -} - -// -//Routine Name: -// -// XPSRasFilter::ShutdownOperation -// -//Routine Description: -// -// Called asynchronously by the pipeline manager -// to shutdown filter operation. -// -//Arguments: -// -// None -// -//Return Value: -// -// HRESULT -// S_OK - On success -// -_Must_inspect_result_ -HRESULT -XPSRasFilter::ShutdownOperation() -{ - DoTraceMessage(XPSRASFILTER_TRACE_INFO, L"Shutting Down Operation"); - - m_pLiveness->Cancel(); - - return S_OK; -} - -// -//Routine Name: -// -// XPSRasFilter::StartOperation -// -//Routine Description: -// -// Called by the pipeline manager to start processing -// a document. Exception boundary for page processing. -// -//Arguments: -// -// None -// -//Return Value: -// -// HRESULT -// S_OK - On success -// Otherwise - Failure -// -_Must_inspect_result_ -HRESULT -XPSRasFilter::StartOperation() -{ - HRESULT hr = S_OK; - - DoTraceMessage(XPSRASFILTER_TRACE_INFO, L"Starting Operation"); - - // - // Process the Xps Package - // - try { - StartOperation_throws(); - } - CATCH_VARIOUS(hr); - - m_pWriter->Close(); - - return hr; -} - -// -//Routine Name: -// -// XPSRasFilter::StartOperation_throws -// -//Routine Description: -// -// Iterates over the 'trunk' parts of the document -// and calls appropriate processing methods. -// -//Arguments: -// -// None -// -void -XPSRasFilter::StartOperation_throws() -{ - // - // CoInitialize/CoUninitialize RAII object. - // COM is inititalized for the lifetime of this method. - // - SafeCoInit coInit; - - IXpsOMObjectFactory_t pOMFactory; - - // - // Create Xps Object Model Object Factory instance - // - THROW_ON_FAILED_HRESULT( - ::CoCreateInstance( - __uuidof(XpsOMObjectFactory), - NULL, - CLSCTX_INPROC_SERVER, - __uuidof(IXpsOMObjectFactory), - reinterpret_cast(&pOMFactory) - ) - ); - - IOpcFactory_t pOpcFactory; - - // - // Create Opc Object Factory instance - // - THROW_ON_FAILED_HRESULT( - ::CoCreateInstance( - __uuidof(OpcFactory), - NULL, - CLSCTX_INPROC_SERVER, - __uuidof(IOpcFactory), - reinterpret_cast(&pOpcFactory) - ) - ); - - // - // Create the rasterization interface - // - RasterizationInterface_t pRasInterface = - RasterizationInterface::CreateRasterizationInterface( - m_pIPropertyBag, - m_pWriter - ); - - // - // Create the Print Ticket Handler - // - PrintTicketHandler_t pPrintTicketHandler = - PrintTicketHandler::CreatePrintTicketHandler( - m_pIPropertyBag - ); - - IUnknown_t pUnk; - - // - // Get first part - // - THROW_ON_FAILED_HRESULT(m_pReader->GetXpsPart(&pUnk)); - - while (m_pLiveness->IsAlive() && - pUnk != NULL) - { - IXpsDocument_t pDoc; - IFixedDocumentSequence_t pFDS; - IFixedDocument_t pFD; - IFixedPage_t pFP; - - if (SUCCEEDED(pUnk.QueryInterface(&pFP))) - { - DoTraceMessage(XPSRASFILTER_TRACE_VERBOSE, L"Handling a Page"); - - pPrintTicketHandler->ProcessPart(pFP); - - ParametersFromPrintTicket printTicketParams = - pPrintTicketHandler->GetMergedPrintTicketParams(); - - pRasInterface->RasterizePage( - CreateXpsOMPageFromIFixedPage(pFP, pOMFactory, pOpcFactory), - printTicketParams, - m_pLiveness - ); - } - else if (SUCCEEDED(pUnk.QueryInterface(&pFD))) - { - pPrintTicketHandler->ProcessPart(pFD); - } - else if (SUCCEEDED(pUnk.QueryInterface(&pFDS))) - { - pPrintTicketHandler->ProcessPart(pFDS); - } - else if (SUCCEEDED(pUnk.QueryInterface(&pDoc))) - { - // - // Do nothing with the XML Document part - // - } - else - { - // - // Any other document 'trunk' parts are ignored. - // - } - - pUnk.Release(); - - // - // Get Next Part - // - THROW_ON_FAILED_HRESULT(m_pReader->GetXpsPart(&pUnk)); - } - - pRasInterface->FinishRasterization(); -} - -} // namespace xpsrasfilter - diff --git a/print/XpsRasFilter/src/xpsrasfilter.def b/print/XpsRasFilter/src/xpsrasfilter.def deleted file mode 100644 index a3dac1cc..00000000 --- a/print/XpsRasFilter/src/xpsrasfilter.def +++ /dev/null @@ -1,22 +0,0 @@ -; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -; ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -; PARTICULAR PURPOSE. -; -; Copyright (c) Microsoft Corporation. All rights reserved -; -; File Name: -; -; xpsrasfilter.def -; -; Abstract: -; -; Defines DLL exports for xpsrasfilter.dll -; - -LIBRARY "xpsrasfilter.dll" - -EXPORTS - DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE - diff --git a/print/XpsRasFilter/src/xpsrasfilter.h b/print/XpsRasFilter/src/xpsrasfilter.h deleted file mode 100644 index 2ad3a4f9..00000000 --- a/print/XpsRasFilter/src/xpsrasfilter.h +++ /dev/null @@ -1,141 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// xpsrasfilter.h -// -// Abstract: -// -// Xps Rasterization Service sample filter definition. The -// XPSRasFilter provides the interface to the filter pipeline manager. -// - -#pragma once - -namespace xpsrasfilter -{ - -// -// Class to maintain the shared state of operation between multiple components -// of the filter. Also provides the callback for the Xps Rasterization Service. -// -class FilterLiveness : public UnknownBase -{ -public: - - FilterLiveness() : - m_isAlive(TRUE) - {} - - virtual - ~FilterLiveness() {} - - BOOL - IsAlive() - { - return m_isAlive; - } - - void - Cancel() - { - // - // May be called from a different thread - // - m_isAlive = FALSE; - } - - // - // IXpsRasterizerNotificationCallback Method - // - virtual _Must_inspect_result_ - HRESULT STDMETHODCALLTYPE - Continue() - { - return (m_isAlive) ? (S_OK) : (HRESULT_FROM_WIN32(ERROR_PRINT_CANCELLED)); - } - -private: - volatile BOOL m_isAlive; - - // - // prevent copy semantics - // - FilterLiveness(const FilterLiveness&); - FilterLiveness& operator=(const FilterLiveness&); -}; - -class XPSRasFilter : public UnknownBase -{ - -public: - - static LONG ms_numObjects; // Number of instances of XPSRasFilter - - XPSRasFilter(); - - virtual - ~XPSRasFilter(); - - // - // IPrintPipelineFilter Methods - // - virtual _Must_inspect_result_ - HRESULT STDMETHODCALLTYPE - InitializeFilter( - _In_ IInterFilterCommunicator *pICommunicator, - _In_ IPrintPipelinePropertyBag *pIPropertyBag, - _In_ IPrintPipelineManagerControl *pIPipelineControl - ); - - virtual _Must_inspect_result_ - HRESULT STDMETHODCALLTYPE - ShutdownOperation(); - - virtual _Must_inspect_result_ - HRESULT STDMETHODCALLTYPE - StartOperation(); - -private: - // - // prevent copy semantics - // - XPSRasFilter(const XPSRasFilter&); - XPSRasFilter& operator=(const XPSRasFilter&); - - // - // Xps package part reader - // - IXpsDocumentProvider_t m_pReader; - IPrintWriteStream_t m_pWriter; - - // - // Pipeline Property Bag - // - IPrintPipelinePropertyBag_t m_pIPropertyBag; - - // - // IPrintPipelineFilter Methods (throwing) - // - VOID - StartOperation_throws(); - - VOID - InitializeFilter_throws( - const IInterFilterCommunicator_t &pICommunicator, - const IPrintPipelinePropertyBag_t &pIPropertyBag - ); - - // - // Keeps track of whether the operation has been cancelled - // - FilterLiveness_t m_pLiveness; -}; - -} // namespace xpsrasfilter - diff --git a/print/XpsRasFilter/src/xpsrasfilter.rc b/print/XpsRasFilter/src/xpsrasfilter.rc deleted file mode 100644 index d7f2fc40..00000000 --- a/print/XpsRasFilter/src/xpsrasfilter.rc +++ /dev/null @@ -1,28 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// xpsrasfilter.rc -// -// Abstract: -// -// Xps Rasterization Service filter resource file. -// - -#include -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT2_UNKNOWN -#define VER_FILEDESCRIPTION_STR "XPS Rasterization Service WDK Sample Filter" -#define VER_INTERNALNAME_STR "xpsrasfilter.dll" -#define VER_ORIGINALFILENAME_STR "xpsrasfilter.dll" -#define VER_FILEVERSION 0, 3, VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE - -#include "common.ver" - diff --git a/print/XpsRasFilter/src/xpsrasfilter.vcxproj b/print/XpsRasFilter/src/xpsrasfilter.vcxproj deleted file mode 100644 index 267efbef..00000000 --- a/print/XpsRasFilter/src/xpsrasfilter.vcxproj +++ /dev/null @@ -1,454 +0,0 @@ - - - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {D8784A15-C959-4CDF-B5B8-A603F347BDA4} - $(MSBuildProjectName) - Debug - Win32 - {29519C3F-63DD-4C01-B6A7-E1E7B4B517BD} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - DynamicLibrary - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - true - .cpp.cxx.h.hxx.inl - .h.hxx.inl - XpsRasFilter - true - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - true - .cpp.cxx.h.hxx.inl - .h.hxx.inl - XpsRasFilter - true - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - true - .cpp.cxx.h.hxx.inl - .h.hxx.inl - XpsRasFilter - true - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - true - .cpp.cxx.h.hxx.inl - .h.hxx.inl - XpsRasFilter - true - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - true - .cpp.cxx.h.hxx.inl - .h.hxx.inl - XpsRasFilter - true - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - true - .cpp.cxx.h.hxx.inl - .h.hxx.inl - XpsRasFilter - true - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - true - .cpp.cxx.h.hxx.inl - .h.hxx.inl - XpsRasFilter - true - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - true - .cpp.cxx.h.hxx.inl - .h.hxx.inl - XpsRasFilter - true - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - true - .cpp.cxx.h.hxx.inl - .h.hxx.inl - XpsRasFilter - true - - - - xpsrasfilter - - - xpsrasfilter - - - xpsrasfilter - - - xpsrasfilter - - - xpsrasfilter - - - xpsrasfilter - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - _DllMainCRTStartup@12 - _DllMainCRTStartup - - - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalDependencies);uuid.lib;prntvpt.lib;Kernel32.lib;winspool.lib;ole32.lib;oleaut32.lib;Advapi32.lib - - - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalDependencies);uuid.lib;prntvpt.lib;Kernel32.lib;winspool.lib;ole32.lib;oleaut32.lib;Advapi32.lib - - - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalDependencies);uuid.lib;prntvpt.lib;Kernel32.lib;winspool.lib;ole32.lib;oleaut32.lib;Advapi32.lib - - - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalDependencies);uuid.lib;prntvpt.lib;Kernel32.lib;winspool.lib;ole32.lib;oleaut32.lib;Advapi32.lib - - - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalDependencies);uuid.lib;prntvpt.lib;Kernel32.lib;winspool.lib;ole32.lib;oleaut32.lib;Advapi32.lib - - - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalIncludeDirectories);$(DDK_INC_PATH) - - - %(AdditionalDependencies);uuid.lib;prntvpt.lib;Kernel32.lib;winspool.lib;ole32.lib;oleaut32.lib;Advapi32.lib - - - - Dynamic - - - Dynamic - - - Dynamic - - - Dynamic - - - Dynamic - - - Dynamic - - - - Sync - true - Level4 - - - - - Sync - true - Level4 - - - - - Sync - true - Level4 - - - - - Sync - true - Level4 - - - - - Sync - true - Level4 - - - - - Sync - true - Level4 - - - - - xpsrasfilter.def - - - - - xpsrasfilter.def - - - - - xpsrasfilter.def - - - - - xpsrasfilter.def - - - - - xpsrasfilter.def - - - - - xpsrasfilter.def - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/XpsRasFilter/src/xpsrasfilter.vcxproj.Filters b/print/XpsRasFilter/src/xpsrasfilter.vcxproj.Filters deleted file mode 100644 index 220e456f..00000000 --- a/print/XpsRasFilter/src/xpsrasfilter.vcxproj.Filters +++ /dev/null @@ -1,178 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {8AFE48DE-3776-4F24-9EB1-3DA85555D037} - - - h;hpp;hxx;hm;inl;inc;xsd - {01B86B81-A94E-4D93-8DCE-7DC040F8B64B} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {26A0ED4E-3E48-4ECB-96A1-B4B7F18BC8C9} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - Header Files - - - - - - - - - - - - - - Source Files - - - \ No newline at end of file diff --git a/print/autoconfig/ACnfgPS.gdl b/print/autoconfig/ACnfgPS.gdl deleted file mode 100644 index e2fb2eb0..00000000 --- a/print/autoconfig/ACnfgPS.gdl +++ /dev/null @@ -1,100 +0,0 @@ -*%****************************************************************************************** -*% ACnfgPS.GDL -*% This file implements the *BidiQuery, *BidiResponse and *Option elements that correspond to -*% the InstalledMemory, DuplexUnit and HardDisk features in AutoCnfg.PPD file. The feature -*% name in the GDL file should exaclty match the corresponding feature and option names in the PPD. -*%****************************************************************************************** - - -%******************************************************************************************* -*% Memory -*% -*%****************************************************************************************** - -*Feature: InstalledMemory -{ - *FeatureType: PRINTER_PROPERTY - *BidiQuery: InstalledMemory - { - *QueryString: "\Printer.Configuration.Memory:Size" - } - - *BidiResponse: InstalledMemory - { - *ResponseType: BIDI_INT - *ResponseData: ENUM_OPTION(Memory) - } - *Option: 32Meg - { - *BidiValue: INT(32768) - } - *Option: 64Meg - { - *BidiValue: INT(65536) - } - *Option: 128Meg - { - *BidiValue: INT(131072) - } - *Option: 256Meg - { - *BidiValue: INT(262144) - } - -} - - -*%****************************************************************************************** -*% Duplex Unit -*%****************************************************************************************** - -*Feature: DuplexUnit -{ - *FeatureType: PRINTER_PROPERTY - *BidiQuery: DuplexUnit - { - *QueryString: "\Printer.Configuration.DuplexUnit:Installed" - } - - *BidiResponse: DuplexUnit - { - *ResponseType: BIDI_BOOL - *ResponseData: ENUM_OPTION(DuplexUnit) - } - - *Option: False - { - *BidiValue: BOOL(FALSE) - } - - *Option: True - { - *BidiValue: BOOL(TRUE) - } -} - -*%****************************************************************************************** -*% Hard Disk -*%****************************************************************************************** - -*Feature: HardDisk -{ - *FeatureType: PRINTER_PROPERTY - *BidiQuery:HardDisk - { - *QueryString: "\Printer.Configuration.HardDisk:Installed" - } - *BidiResponse: HardDisk - { - *ResponseType: BIDI_BOOL - *ResponseData: ENUM_OPTION(PrinterHardDisk) - } - *Option: False - { - *BidiValue: BOOL(FALSE) - } - *Option: True - { - *BidiValue: BOOL(TRUE) - } -} diff --git a/print/autoconfig/ACnfgUni.GDL b/print/autoconfig/ACnfgUni.GDL deleted file mode 100644 index 655b4cb2..00000000 --- a/print/autoconfig/ACnfgUni.GDL +++ /dev/null @@ -1,111 +0,0 @@ -*%****************************************************************************************** -*% ACnfgUni.GDL -*% This file implements the *BidiQuery, *BidiResponse and *Option elements that correspond -*% to the Memory,DuplexUnit and PrinterHardDisk features in AutoCnfg.GPD file. The feature -*% name in the GDL file should exaclty match the corresponding feature and option names in the GPD. -*%****************************************************************************************** - - -%******************************************************************************************* -*% Memory -*% -*%****************************************************************************************** - -*Feature: Memory -{ - *FeatureType: PRINTER_PROPERTY - *BidiQuery: Memory - { - *QueryString: "\Printer.Configuration.Memory:Size" - } - - *BidiResponse: Memory - { - *ResponseType: BIDI_INT - *ResponseData: ENUM_OPTION(Memory) - } - *Option: 16384KB - { - *BidiValue: INT(16384) - } - *Option: 24576KB - { - *BidiValue: INT(24576) - } - *Option: 32768KB - { - *BidiValue: INT(32768) - } - *Option: 49152KB - { - *BidiValue: INT(49152) - } - *Option: 65536KB - { - *BidiValue: INT(65536) - } - *Option: 98304KB - { - *BidiValue: INT(98304) - } - *Option: 131072KB - { - *BidiValue: INT(131072) - } -} - - -*%****************************************************************************************** -*% Duplex Unit -*%****************************************************************************************** - -*Feature: DuplexUnit -{ - *FeatureType: PRINTER_PROPERTY - *BidiQuery: DuplexUnit - { - *QueryString: "\Printer.Configuration.DuplexUnit:Installed" - } - - *BidiResponse: DuplexUnit - { - *ResponseType: BIDI_BOOL - *ResponseData: ENUM_OPTION(DuplexUnit) - } - - *Option: FALSE - { - *BidiValue: BOOL(FALSE) - } - - *Option: TRUE - { - *BidiValue: BOOL(TRUE) - } -} - -*%****************************************************************************************** -*% Hard Disk -*%****************************************************************************************** - -*Feature: PrinterHardDisk -{ - *FeatureType: PRINTER_PROPERTY - *BidiQuery:PrinterHardDisk - { - *QueryString: "\Printer.Configuration.HardDisk:Installed" - } - *BidiResponse: PrinterHardDisk - { - *ResponseType: BIDI_BOOL - *ResponseData: ENUM_OPTION(PrinterHardDisk) - } - *Option: FALSE - { - *BidiValue: BOOL(FALSE) - } - *Option: TRUE - { - *BidiValue: BOOL(TRUE) - } -} diff --git a/print/autoconfig/AutoCnfg.GPD b/print/autoconfig/AutoCnfg.GPD deleted file mode 100644 index a9eb8b6f..00000000 --- a/print/autoconfig/AutoCnfg.GPD +++ /dev/null @@ -1,733 +0,0 @@ -*Include: "stdnames.gpd" -*Include: "ttfsub.gpd" - -*ModelName: "Unidrv AutoConfiguration Sample" -*PrinterType: PAGE -*GPDSpecVersion: "1.0" - -*MasterUnits: PAIR(1200, 1200) -*ResourceDLL: "pcl5eres.dll" -*MaxCopies: 32767 - - -*GPDFileName: "autocnfg.gpd" -*GPDFileVersion: "1.0" -*Personality: =PERSONALITY_PCL_DISPLAY -*PrintRatePPM: 16 - -*%****************************************************************************************** -*% Common Resources -*%****************************************************************************************** -*ResourceDLL: "pcl5eres.dll" -*ResourceDLL: "unires.dll" - -*Feature: RESDLL -{ - *Option: PCL5ERES - { - *Name: "pcl5eres.dll" - } -} - - -*rcInstalledOptionNameID: RESDLL.PCL5ERES.443 *% Installed -*rcNotInstalledOptionNameID: RESDLL.PCL5ERES.444 *% Not Installed - -*%****************************************************************************************** -*% Specify ACnfgUni.GDL as the Bidi query file which has the GDL extensions for -*% Autoconfig corresponding to the Memory,DuplexUnit and PrinterHardDisk features. The -*% GDL extensions can also be put in the GPD file itself instead of in a separate GDL -*% file. Using a separate GDL file reduces the amount of change in the original GPD -*% file, thereby reducing the chances for unintended alteration of the existing GPD data. -*%****************************************************************************************** - -*Ifdef: WINNT_60 -*BidiQueryFile: "ACnfgUni.GDL" -*Endif: WINNT_60 - -*%****************************************************************************************** -*% HP-GL/2 Graphics Support -*%****************************************************************************************** -*Ifdef: WINNT_51 -*Personality: =PERSONALITY_HPGL2 -*Feature: GraphicsMode -{ - *rcNameID: =GRAPHICSMODE_DISPLAY - *DefaultOption: RASTERMODE - *Option: HPGL2MODE - { - *rcNameID: =GRAPHICSMODE_HPGL2_DISPLAY - } - *Option: RASTERMODE - { - *rcNameID: =GRAPHICSMODE_RASTER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.3 - *Cmd: "@PJL SET LIMAGEENHANCE=OFF<0A>" - } - } -} -*Endif: - - - -*%****************************************************************************************** -*% Orientation -*%****************************************************************************************** -*Feature: Orientation -{ - *rcNameID: =ORIENTATION_DISPLAY - *DefaultOption: PORTRAIT - *Option: PORTRAIT - { - *rcNameID: =PORTRAIT_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.8 - *NoPageEject?: TRUE - *Cmd: "<1B>&l0o1E" - } - } - *Option: LANDSCAPE_CC90 - { - *rcNameID: =LANDSCAPE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.8 - *NoPageEject?: TRUE - *Cmd: "<1B>&l1o1E" - } - } -} - -*%****************************************************************************************** -*% Input Bin -*%****************************************************************************************** -*Feature: InputBin -{ - *rcNameID: =PAPER_SOURCE_DISPLAY - *DefaultOption: AUTO - *Option: AUTO - { - *rcNameID: =AUTO_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l7H" - } - } - *Option: UPPER - { - *rcNameID: =UPPER_TRAY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l1H" - } - } - *Option: LOWER - { - *rcNameID: =LOWER_TRAY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l1H" - } - } - *Option: ENVELOPE - { - *rcNameID: =ENV_FEED_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l6H" - } - } - *Option: MANUAL - { - *rcNameID: =MANUAL_FEED_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.11 - *Cmd: "<1B>&l2H" - } - } -} - -*%****************************************************************************************** -*% Resolution -*%****************************************************************************************** -*Feature: Resolution -{ - *rcNameID: =RESOLUTION_DISPLAY - *DefaultOption: 600_DPI - *Option: 600_DPI - { - *Name: "600 x 600 " =DOTS_PER_INCH - *DPI: PAIR(600, 600) - *TextDPI: PAIR(600, 600) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED,TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rB" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.5 - *Cmd: "@PJL SET RESOLUTION=600<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t600R" - } - } - *Option: 300_DPI - { - *Name: "300 x 300 " =DOTS_PER_INCH - *DPI: PAIR(300, 300) - *TextDPI: PAIR(300, 300) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED, TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rB" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.5 - *Cmd: "@PJL SET RESOLUTION=300<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t300R" - } - } - *Option: 150_DPI - { - *Name: "150 x 150 " =DOTS_PER_INCH - *DPI: PAIR(150, 150) - *TextDPI: PAIR(150, 150) - *MinStripBlankPixels: 32 - EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED, TRAILING) - *SpotDiameter: 100 - *Command: CmdBeginRaster { *Cmd : "<1B>*r1A" } - *Command: CmdEndRaster { *Cmd : "<1B>*rB" } - *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } - *Command: CmdSelect - { - *Order: DOC_SETUP.5 - *Cmd: "@PJL SET RESOLUTION=150<0A>@PJL ENTER LANGUAGE=PCL<0A0D1B>E<1B>*t150R" - } - } -} - -*%****************************************************************************************** -*% Paper Size -*%****************************************************************************************** -*Feature: PaperSize -{ - *rcNameID: =PAPER_SIZE_DISPLAY - *DefaultOption: LETTER - *Option: LETTER - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1028 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9500, 12500) - *PrintableOrigin: PAIR(400, 400) - *CursorOrigin: PAIR(300, 300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t5260x7704Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9500, 12200) - *PrintableOrigin: PAIR(450, 300) - *CursorOrigin: PAIR(200, 12900) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l2a8c1E<1B>*p0x0Y<1B>*c0t7332x5880Y" - } - } - } - } - *Option: LEGAL - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 1692 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 600) - *CursorOrigin: PAIR(180, 300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t5880x8900Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9000, 15500) - *PrintableOrigin: PAIR(400, 900) - *CursorOrigin: PAIR(180, 16500) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l3a8c1E<1B>*p0x0Y<1B>*c0t8900x5880Y" - } - } - } - } - *Option: EXECUTIVE - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4109 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(8100, 11500) - *PrintableOrigin: PAIR(300, 300) - *CursorOrigin: PAIR(300, 200) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t4860x7344Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(8300, 11500) - *PrintableOrigin: PAIR(200, 300) - *CursorOrigin: PAIR(200, 12300) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l1a8c1E<1B>*p0x0Y<1B>*c0t7272x4980Y" - } - } - } - } - *Option: A4 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 4249 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9100, 13200) - *PrintableOrigin: PAIR(400, 300) - *CursorOrigin: PAIR(288, 180) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t5594x8201Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(9100, 13200) - *PrintableOrigin: PAIR(400, 300) - *CursorOrigin: PAIR(204, 13824) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l26a8c1E<1B>*p0x0Y<1B>*c0t8129x5714Y" - } - } - } - } - *Option: B5 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME - *PageProtectMem: 3198 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(7900, 11140) - *PrintableOrigin: PAIR(352, 300) - *CursorOrigin: PAIR(300, 100) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l12a8c1E<1B>*p0x0Y<1B>*c0t4970x7040Y" - } - } - *case: LANDSCAPE_CC90 - { - *PrintableArea: PAIR(7760, 11140) - *PrintableOrigin: PAIR(300, 400) - *CursorOrigin: PAIR(100, 11940) - *Command: CmdSelect - { - *Order: DOC_SETUP.12 - *Cmd: "<1B>&l12a8c1E<1B>*p0x0Y<1B>*c0t6780x4970Y" - } - } - } - } -} - -*%****************************************************************************************** -*% Media Type -*%****************************************************************************************** -*Feature: MediaType -{ - *rcNameID: =MEDIA_TYPE_DISPLAY - *DefaultOption: PLAIN - *Option: PLAIN - { - *rcNameID: =PLAIN_PAPER_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.15 - *Cmd: "<1B>&n6WdPlain" - } - } - *Option: TRANSPARENCY - { - *rcNameID: =TRANSPARENCY_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.15 - *Cmd: "<1B>&n13WdTransparency" - } - } -} - -*%****************************************************************************************** -*% Color Mode -*%****************************************************************************************** -*Feature: ColorMode -{ - *rcNameID: =COLOR_PRINTING_MODE_DISPLAY - *DefaultOption: 24bpp - *Option: Mono - { - *rcNameID: =MONO_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 1 - *Color?: FALSE - } - *Option: 24bpp - { - *rcNameID: =24BPP_DISPLAY - *DevNumOfPlanes: 1 - *DevBPP: 24 - *DrvBPP: 24 -*% *Command: CmdEnableDRC { *Cmd : "<1B>*b3M" } - *PaletteSize: 256 - *PaletteProgrammable? : TRUE - *Command: CmdDefinePaletteEntry - { - *Cmd : "<1B>*v" %d{RedValue}"a" -+ %d{GreenValue}"b" -+ %d{BlueValue}"c" -+ %d{PaletteIndexToProgram}"I" - } - *Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } - *Command: CmdSetSrcBmpWidth { *Cmd : "<1B>*r" %d{RasterDataWidthInBytes / 3}"S" } - *Command: CmdSelect - { - *Order: PAGE_SETUP.16 - *Cmd: "<1B>*v1N<1B>*v1O<1B>*l184O<1B>*v6W<000308080808><1B>*v0a0b0c7i255a255b255c0I<1B>*o3W<060406>" - } - } -} - -*%****************************************************************************************** -*% HalfTone -*%****************************************************************************************** -*Feature: Halftone -{ - *rcNameID: =HALFTONING_DISPLAY - *DefaultOption: HT_PATSIZE_AUTO - *Option: HT_PATSIZE_AUTO - { - *rcNameID: =HT_AUTO_SELECT_DISPLAY - } - *Option: HT_PATSIZE_SUPERCELL_M - { - *rcNameID: =HT_SUPERCELL_DISPLAY - } - *Option: HT_PATSIZE_6x6_M - { - *rcNameID: =HT_DITHER6X6_DISPLAY - } - *Option: HT_PATSIZE_8x8_M - { - *rcNameID: =HT_DITHER8X8_DISPLAY - } -} - -*%****************************************************************************************** -*% Memory -*% -*% Note: Unidrv uses the font memory information to estimate when it needs to stop -*% downloading fonts for a page, and thus driver writers should err on the conservative -*% side. Otherwise, printers will generate "out of memory" device errors for pages with -*% a large number of fonts / unique glyphs. -*%****************************************************************************************** -*Feature: Memory -{ - *rcNameID: =PRINTER_MEMORY_DISPLAY - *FeatureType: PRINTER_PROPERTY - *DefaultOption: 32768KB - *Option: 16384KB - { - *Name: "16MB" - *MemoryConfigKB: PAIR(16384, 13950) - } - *Option: 24576KB - { - *Name: "24MB" - *MemoryConfigKB: PAIR(24576, 21150) - } - *Option: 32768KB - { - *Name: "32MB" - *MemoryConfigKB: PAIR(32768, 28350) - } - *Option: 49152KB - { - *Name: "48MB" - *MemoryConfigKB: PAIR(49152, 43050) - } - *Option: 65536KB - { - *Name: "64MB" - *MemoryConfigKB: PAIR(65536, 57150) - } - *Option: 98304KB - { - *Name: "96MB" - *MemoryConfigKB: PAIR(98304, 85950) - } - *Option: 131072KB - { - *Name: "128MB" - *MemoryConfigKB: PAIR(131072, 116250) - } -} - - -*%****************************************************************************************** -*% Duplex Unit -*%****************************************************************************************** -*Feature: DuplexUnit -{ - *rcNameID: RESDLL.PCL5ERES.429 - *FeatureType: PRINTER_PROPERTY - *DefaultOption: FALSE - *Option: FALSE - { - *rcNameID: RESDLL.PCL5ERES.444 - *DisabledFeatures: LIST(Duplex) - *Constraints: LIST(Duplex.VERTICAL, Duplex.HORIZONTAL) - } - *Option: TRUE - { - *rcNameID: RESDLL.PCL5ERES.443 - } -} - - -*%****************************************************************************************** -*% Duplex Type -*%****************************************************************************************** -*Feature: Duplex -{ - *rcNameID: =TWO_SIDED_PRINTING_DISPLAY - *DefaultOption: NONE - *Option: NONE - { - *rcNameID: =NONE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l0S" - } - } - *Option: VERTICAL - { - *rcNameID: =FLIP_ON_LONG_EDGE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l1S" - } - } - *Option: HORIZONTAL - { - *rcNameID: =FLIP_ON_SHORT_EDGE_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.9 - *Cmd: "<1B>&l2S" - } - } -} - -*%****************************************************************************************** -*% Hard Disk -*%****************************************************************************************** -*Feature: PrinterHardDisk -{ - *rcNameID: RESDLL.PCL5ERES.430 - *FeatureType: PRINTER_PROPERTY - *DefaultOption: FALSE - *Option: FALSE - { - *rcNameID: RESDLL.PCL5ERES.444 - } - *Option: TRUE - { - *rcNameID: RESDLL.PCL5ERES.443 - } -} - - -*%****************************************************************************************** -*% Page Protect -*%****************************************************************************************** -*Feature: PageProtect -{ - *rcNameID: =PAGE_PROTECTION_DISPLAY - *DefaultOption: OFF - *Option: ON - { - *rcNameID: =ON_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.1 - *Cmd: "@PJL SET PAGEPROTECT=ON<0A>" - } - } - *Option: OFF - { - *rcNameID: =OFF_DISPLAY - *Command: CmdSelect - { - *Order: DOC_SETUP.1 - *Cmd: "@PJL SET PAGEPROTECT=OFF<0A>" - } - } -} - -*%****************************************************************************************** -*% Doc setup commands -*%****************************************************************************************** -*Command: CmdStartDoc -{ - *Order: DOC_SETUP.7 - *Cmd: "<1B>&u1200D<1B>*r0F" -} -*Command: CmdStartPage -{ - *Order: PAGE_SETUP.1 - *Cmd: "<1B>*b0M<0D>" -} -*Command: CmdEndJob -{ - *Order: JOB_FINISH.1 - *Cmd: "<1B>E<1B>%%-12345X@PJL<20>LPORTROTATE<0A><1B>%%-12345X" -} -*Command: CmdCopies -{ - *Order: DOC_SETUP.13 - *Cmd: "<1B>&l" %d{NumOfCopies}"X" -} - -*%****************************************************************************************** -*% Cursor, Page and Color Commands -*%****************************************************************************************** -*RotateCoordinate?: TRUE -*RotateRaster?: TRUE -*RotateFont?: TRUE -*TextCaps: LIST(TC_CR_90,TC_UA_ABLE) -*MemoryUsage: LIST(FONT, RASTER, VECTOR) -*CursorXAfterCR: AT_PRINTABLE_X_ORIGIN -*BadCursorMoveInGrxMode: LIST(X_PORTRAIT,Y_LANDSCAPE) -*XMoveThreshold: 0 -*YMoveThreshold: 0 -*XMoveUnit: 300 -*YMoveUnit: 300 -*Command: CmdXMoveAbsolute { *Cmd : "<1B>*p" %d{(DestX) }"X" } -*Command: CmdXMoveRelRight { *Cmd : "<1B>*p+" %d[0,9600]{max_repeat((DestXRel) )}"X" } -*Command: CmdXMoveRelLeft { *Cmd : "<1B>*p-" %d[0,9600]{max_repeat((DestXRel) )}"X" } -*Command: CmdYMoveAbsolute { *Cmd : "<1B>*p" %d{(DestY) }"Y" } -*Command: CmdYMoveRelDown { *Cmd : "<1B>*p+" %d{(DestYRel) }"Y" } -*Command: CmdYMoveRelUp { *Cmd : "<1B>*p-" %d{(DestYRel) }"Y" } -*Command: CmdDefinePaletteEntry { *Cmd : "<1B>*v" %d{RedValue}"a" %d{GreenValue}"b" %d{BlueValue}"c" -+ %d{PaletteIndexToProgram} "I" } -*Command: CmdSelectPaletteEntry { *Cmd : "<1B>*v" %d{CurrentPaletteIndex}"S" } -*Command: CmdCR { *Cmd : "<0D>" } -*Command: CmdLF { *Cmd : "<0A>" } -*Command: CmdFF { *Cmd : "<0C>" } -*Command: CmdBackSpace { *Cmd : "<08>" } -*Command: CmdUniDirectionOn { *Cmd : "<00>" } -*Command: CmdUniDirectionOff { *Cmd : "<00>" } -*Command: CmdPushCursor { *Cmd : "<1B>&f0S" } -*Command: CmdPopCursor { *Cmd : "<1B>&f1S" } -*Command: CmdSetSimpleRotation { *Cmd : "<1B>&a" %d{PrintDirInCCDegrees}"P" } -*EjectPageWithFF?: TRUE -*Command: CmdEnableTIFF4 { *Cmd : "<1B>*b2M" } -*Command: CmdDisableCompression { *Cmd : "<1B>*b0M" } -*OutputDataFormat: H_BYTE -*OptimizeLeftBound?: TRUE -*CursorXAfterSendBlockData: AT_GRXDATA_ORIGIN -*CursorYAfterSendBlockData: AUTO_INCREMENT - -*%****************************************************************************************** -*% Font Descriptions and Commands -*%****************************************************************************************** -*TTFSEnabled?: TRUE -*DefaultFont: 136 -*DefaultCTT: 0 -*CharPosition: BASELINE -*DeviceFonts: LIST(136,138,146,147,148,149,150,151,152,153,154,155,156,157, -+ 163,164,165,166,196,197,198,199,200,201,202,203,209,210, -+ 211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226, -+ 227,228,229,230) -*MinFontID: 16534 -*MaxFontID: 32768 -*switch: Resolution -{ - *case: 600_DPI - { - *FontFormat: HPPCL_OUTLINE - } - *case: 300_DPI - { - *FontFormat: HPPCL_OUTLINE - } - *case: 150_DPI - { - *FontFormat: HPPCL_RES - } -} -*Command: CmdSetFontID { *Cmd : "<1B>*c" %d{NextFontID}"D" } -*Command: CmdSelectFontID { *Cmd : "<1B>(" %d{CurrentFontID}"X" } -*Command: CmdSetCharCode { *Cmd : "<1B>*c" %d{NextGlyph}"E" } -*Command: CmdUnderlineOn { *Cmd : "<1B>&dD" } -*Command: CmdUnderlineOff { *Cmd : "<1B>&d@" } -*Command: CmdWhiteTextOn { *Cmd : "<1B>*v1o1T" } -*Command: CmdWhiteTextOff { *Cmd : "<1B>*v0o0T" } - - -*%******************************************************************************************** -*%* Vector Commands. -*%******************************************************************************************** -*MinGrayFill: 1 -*MaxGrayFill: 100 -*Command: CmdSetRectWidth { *Cmd : "<1B>*c" %d{(RectXSize) }"A" } -*Command: CmdSetRectHeight { *Cmd : "<1B>*c" %d{(RectYSize) }"B" } -*Command: CmdRectGrayFill { *Cmd : "<1B>*c" %d{GrayPercentage }"g2P" } -*Command: CmdRectWhiteFill { *Cmd : "<1B>*c1P" } -*Command: CmdRectBlackFill { *Cmd : "<1B>*c0P" } diff --git a/print/autoconfig/AutoCnfg.PPD b/print/autoconfig/AutoCnfg.PPD deleted file mode 100644 index e6591b8c..00000000 --- a/print/autoconfig/AutoCnfg.PPD +++ /dev/null @@ -1,479 +0,0 @@ -*PPD-Adobe: "4.3" -*% Adobe Systems PostScript(R) Printer Description File -*% Copyright (c) 2005 Microsoft Corp. All rights reserved. - -*FormatVersion: "4.3" -*FileVersion: "2.0" -*LanguageEncoding: ISOLatin1 -*LanguageVersion: English -*Product: "(PostScript AutoConfiguration)" -*PSVersion: "(2015.105) 9" -*Manufacturer: "Microsoft" -*ModelName: "PostScript AutoConfiguration Sample" -*ShortNickName: "PostScript AutoConfiguration" -*NickName: "PostScript AutoConfiguration" -*PCFileName: "AutoCnfg.PPD" - -*MSBidiQueryFile: "ACnfgPS.GDL" - -*% === Installable Options =========== -*OpenGroup: InstallableOptions/Options Installed - -*OpenUI *DuplexUnit/Duplex Unit: Boolean -*DefaultDuplexUnit: False -*DuplexUnit True/Installed: "" -*DuplexUnit False/Not Installed: "" -*CloseUI: *DuplexUnit - -*OpenUI *HardDisk/Printer Hard Disk: Boolean -*DefaultHardDisk: False -*HardDisk True/Installed: "" -*HardDisk False/Not Installed: "" -*CloseUI: *HardDisk - -*OpenUI *InstalledMemory/Printer Memory: PickOne -*DefaultInstalledMemory: 32Meg -*InstalledMemory 32Meg/32 MB: "" -*InstalledMemory 64Meg/64 MB: "" -*InstalledMemory 128Meg/128 MB: "" -*InstalledMemory 256Meg/256 MB: "" -*CloseUI: *InstalledMemory - -*CloseGroup: InstallableOptions - -*% === Constraints =================== - - -*% === Basic Device Capabilities ============ - -*LanguageLevel: "2" -*Protocols: BCP - -*FreeVM: "6666752" -*VMOption 32Meg/32 MB: "6609408" -*VMOption 64Meg/64 MB: "6666752" -*VMOption 128Meg/128 MB: "9705984" -*VMOption 256Meg/256 MB: "13736448" - - -*ColorDevice: True -*DefaultColorSpace: CMYK -*AccurateScreensSupport: True -*SuggestedJobTimeout: "0" -*SuggestedWaitTimeout: "300" -*SuggestedManualFeedTimeout: "60" -*End -*TTRasterizer: Type42 -*?TTRasterizer: " - save - 42 /FontType resourcestatus - { pop pop (Type42)} {pop pop (None)} ifelse = flush - restore" -*End - -*Emulators: hpgl -*StartEmulator_hpgl: "currentfile /hpgl statusdict /emulate get exec " -*StopEmulator_hpgl: "<1B7F>0" - -*FileSystem: True -*?FileSystem: " - save false - (%disk?%) - { currentdevparams dup /Writeable known - { /Writeable get {pop true} if } {pop} ifelse - } 10 string /IODevice resourceforall - {(True)}{(False)} ifelse = flush - restore" -*End -*Throughput: "14" -*Password: "(0)" -*ExitServer: " - count 0 eq - { false } { true exch startjob } ifelse - not - { (WARNING: Cannot modify initial VM.) = - (Missing or invalid password.) = - (Please contact the author of this software.) = flush quit - } if" -*End -*Reset: " - count 0 eq - { false } { true exch startjob } ifelse - not - { (WARNING: Cannot reset printer.) = - (Missing or invalid password.) = - (Please contact the author of this software.) = flush quit - } if - systemdict /quit get exec - (WARNING : Printer Reset Failed.) = flush" -*End - -*DefaultResolution: 600x600dpi -*?Resolution: " - save currentpagedevice - /HWResolution get - aload pop exch ( ) cvs print (x) print ( ) cvs print (dpi) - = flush - restore" -*End - -*% Halftone Information ================= - -*DefaultHalftoneType: 9 -*ScreenFreq: "60.0" -*ScreenAngle: "0.0" -*DefaultScreenProc: Null -*ScreenProc Null: "{}" - -*DefaultTransfer: Null -*Transfer Null: "{ }" -*Transfer Null.Inverse: "{ 1 exch sub }" - - -*% Tray Selection ============ - -*OpenUI *InputSlot: PickOne -*OrderDependency: 10 AnySetup *InputSlot -*DefaultInputSlot: Paper -*InputSlot Upper: " - (<<) cvx exec - /MediaPosition 0 - /MediaType null - /TraySwitch false - /ManualFeed false - (>>) cvx exec setpagedevice" -*End -*InputSlot Middle: " - (<<) cvx exec - /MediaPosition 1 - /MediaType null - /TraySwitch false - /ManualFeed false - (>>) cvx exec setpagedevice" -*End -*InputSlot Lower: " - (<<) cvx exec - /MediaPosition 2 - /MediaType null - /TraySwitch false - /ManualFeed false - (>>) cvx exec setpagedevice" -*End -*InputSlot Paper: " - (<<) cvx exec - /MediaPosition null - /MediaType (Paper) - /TraySwitch true - /ManualFeed false - (>>) cvx exec setpagedevice" -*End -*InputSlot Transparency: " - (<<) cvx exec - /MediaPosition null - /MediaType (Transparency) - /TraySwitch true - /ManualFeed false - (>>) cvx exec setpagedevice" -*End -*InputSlot ManualPaper/Manual Paper: " - (<<) cvx exec - /MediaPosition null - /MediaType (Paper) - /TraySwitch false - /ManualFeed true - (>>) cvx exec setpagedevice" -*End -*InputSlot ManualTransparency/Manual Transparency: " - (<<) cvx exec - /MediaPosition null - /MediaType (Transparency) - /TraySwitch false - /ManualFeed true - (>>) cvx exec setpagedevice" -*End -*?InputSlot: " - save - currentpagedevice /MediaPosition get - dup null eq - { pop currentpagedevice /MediaType get - dup null eq - { pop (Upper) } - { dup (Paper) eq - { pop currentpagedevice /ManualFeed get - { (ManualPaper) } - { (Paper) } ifelse - } - { - (Transparency) eq - { currentpagedevice /ManualFeed get - { (ManualTransparency) } - { (Transparency) } ifelse - } - { (Unknown) } ifelse - } ifelse - } ifelse - } - { - dup 0 eq - { pop (Upper) } - { dup 1 eq - { pop (Middle) } - { 2 eq - { (Lower) } - { (Unknown) } ifelse - } ifelse - } ifelse - } ifelse - = flush restore" -*End -*CloseUI: *InputSlot - -*% Paper Handling =================== - -*% Use these entries to set paper size most of the time, unless there is -*% specific reason to use PageRegion. -*OpenUI *PageSize: PickOne -*OrderDependency: 20 AnySetup *PageSize -*DefaultPageSize: Letter -*PageSize Letter: "(<<) cvx exec /PageSize [612 792] /ImagingBBox null - (>>) cvx exec setpagedevice" -*End -*PageSize Legal: "(<<) cvx exec /PageSize [612 1008] /ImagingBBox null - (>>) cvx exec setpagedevice" -*End -*PageSize A4: "(<<) cvx exec /PageSize [595 842] /ImagingBBox null - (>>) cvx exec setpagedevice" -*End -*?PageSize: " - save currentpagedevice /PageSize get aload pop - 2 copy gt {exch} if (Unknown) - (<<) cvx exec - [612 792] (Letter) - [612 1008] (Legal) - [595 842] (A4) (>>) cvx exec - { exch aload pop 4 index sub abs 5 le exch 5 index sub abs 5 le and - { exch pop exit } { pop } ifelse - } bind forall = flush pop pop - restore" -*End -*CloseUI: *PageSize - -*% These entries will set up the frame buffer. Usually used with manual feed. -*OpenUI *PageRegion: PickOne -*OrderDependency: 30 AnySetup *PageRegion -*DefaultPageRegion: Letter -*PageRegion Letter: "(<<) cvx exec /PageSize [612 792] /ImagingBBox null - (>>) cvx exec setpagedevice" -*End -*PageRegion Legal: "(<<) cvx exec /PageSize [612 1008] /ImagingBBox null - (>>) cvx exec setpagedevice" -*End -*PageRegion A4: "(<<) cvx exec /PageSize [595 842] /ImagingBBox null - (>>) cvx exec setpagedevice" -*End -*CloseUI: *PageRegion - -*% The following entries provide information about specific paper keywords. -*DefaultImageableArea: Letter -*ImageableArea Letter: "10.32 15.9 601.68 776.22" -*ImageableArea Legal: "10.32 16.3801 601.68 991.74" -*ImageableArea A4: "13.44 14.46 581.76 828.54" -*?ImageableArea: " - save - /cvp { ( ) cvs print ( ) print } bind def - /upperright {10000 mul floor 10000 div} bind def - /lowerleft {10000 mul ceiling 10000 div} bind def - newpath clippath pathbbox - 4 -2 roll exch 2 {lowerleft cvp} repeat - exch 2 {upperright cvp} repeat flush - restore" -*End - -*% These provide the physical dimensions of the paper (by keyword) -*DefaultPaperDimension: Letter -*PaperDimension Letter: "612 792" -*PaperDimension Legal: "612 1008" -*PaperDimension A4: "595 842" - -*RequiresPageRegion All: True - -*% Print Quality Selection =================== - -*OpenUI *OutputMode/Print Quality: PickOne -*OrderDependency: 50 AnySetup *OutputMode -*DefaultOutputMode: Standard -*OutputMode Fast/Fast Color 600x600 dpi: " - (<<) cvx exec - /HWResolution [600 600] - /ProcessColorModel /DeviceCMY - (>>) cvx exec setpagedevice" -*End -*OutputMode Standard/Standard 600x600 dpi: " - (<<) cvx exec - /HWResolution [600 600] - /ProcessColorModel /DeviceCMYK - (>>) cvx exec setpagedevice" -*End -*OutputMode Enhanced/Enhanced 1200x600 dpi: " - (<<) cvx exec - /HWResolution [1200 600] - /ProcessColorModel /DeviceCMYK - (>>) cvx exec setpagedevice" -*End -*OutputMode Premium/Premium 1200x1200 dpi: " - (<<) cvx exec - /HWResolution [1200 1200] - /ProcessColorModel /DeviceCMYK - (>>) cvx exec setpagedevice" -*End -*?OutputMode: " - save - currentpagedevice /ProcessColorModel get /DeviceCMY eq - { (Fast) } - { currentpagedevice /HWResolution get - aload pop 1200 eq - { pop (Premium) } - { 1200 eq - { (Enhanced) } - { (Standard) } ifelse - } ifelse - } ifelse - = flush restore" -*End -*CloseUI: *OutputMode - -*OpenUI *OutputOrder/Output Order: PickOne -*OrderDependency: 60 AnySetup *OutputOrder -*DefaultOutputOrder: Reverse -*OutputOrder Normal/Face Down: " - (<<) cvx exec - /OutputFaceUp false - (>>) cvx exec setpagedevice" -*End -*OutputOrder Reverse/Face Up: " - (<<) cvx exec - /OutputFaceUp true - (>>) cvx exec setpagedevice" -*End -*?OutputOrder: " - save - currentpagedevice /OutputFaceUp get {(Reverse)}{(Normal)}ifelse - = flush restore" -*End -*CloseUI: *OutputOrder - -*OpenUI *Collate/Quick Collate: Boolean -*OrderDependency: 70 AnySetup *Collate -*DefaultCollate: False -*Collate False: " - (<<) cvx exec - /Collate false - (>>) cvx exec setpagedevice" -*End -*Collate True: " - (<<) cvx exec - /Collate true - (>>) cvx exec setpagedevice" -*End -*?Collate: " - save - currentpagedevice /Collate get {(True)}{(False)}ifelse - = flush restore" -*End -*CloseUI: *Collate - -*%================================ -*% Two-sided Printing (Duplex) -*%================================ - -*OpenUI *Duplex/Duplex: PickOne -*OrderDependency: 50 AnySetup *Duplex -*DefaultDuplex: None -*Duplex None/Off: " - <> setpagedevice" -*End -*Duplex DuplexNoTumble/Flip on Long Edge (Standard): " - <> setpagedevice" -*End -*Duplex DuplexTumble/Flip on Short Edge: " - <> setpagedevice" -*End -*?Duplex: "save - currentpagedevice dup /Duplex known - {dup /Duplex get - {/Tumble get{(DuplexTumble)}{(DuplexNoTumble)}ifelse} - {pop (None)} ifelse - } - {(None)} ifelse = flush -restore -" -*End -*CloseUI: *Duplex - -*% ================================= -*% User Interface Constraints -*% ================================= - -*% If the duplex unit is not installed disable duplex modes. - -*UIConstraints: *DuplexUnit NotInstalled *Duplex DuplexNoTumble -*UIConstraints: *DuplexUnit NotInstalled *Duplex DuplexTumble - - -*% Font Information ===================== -*DefaultFont: Courier -*Font Courier: Standard "(002.003)" Standard ROM -*Font Courier-Bold: Standard "(002.003)" Standard ROM -*Font Courier-BoldOblique: Standard "(002.003)" Standard ROM -*Font Courier-Oblique: Standard "(002.003)" Standard ROM -*Font Helvetica: Standard "(001.006)" Standard ROM -*Font Helvetica-Bold: Standard "(001.007)" Standard ROM -*Font Helvetica-BoldOblique: Standard "(001.007)" Standard ROM -*Font Helvetica-Condensed: Standard "(001.001)" Standard ROM -*Font Helvetica-Condensed-Bold: Standard "(001.002)" Standard ROM -*Font Helvetica-Condensed-BoldObl: Standard "(001.002)" Standard ROM -*Font Helvetica-Condensed-Oblique: Standard "(001.001)" Standard ROM -*Font Helvetica-Narrow: Standard "(001.006)" Standard ROM -*Font Helvetica-Narrow-Bold: Standard "(001.007)" Standard ROM -*Font Helvetica-Narrow-BoldOblique: Standard "(001.007)" Standard ROM -*Font Helvetica-Narrow-Oblique: Standard "(001.006)" Standard ROM -*Font Helvetica-Oblique: Standard "(001.006)" Standard ROM -*Font Symbol: Special "(001.007)" Special ROM -*Font Times-Bold: Standard "(001.007)" Standard ROM -*Font Times-BoldItalic: Standard "(001.009)" Standard ROM -*Font Times-Italic: Standard "(001.007)" Standard ROM -*Font Times-Roman: Standard "(001.007)" Standard ROM -*Font ZapfChancery-MediumItalic: Standard "(001.006)" Standard ROM -*Font ZapfDingbats: Special "(001.004)" Special ROM -*?FontQuery: " - save - { count 1 gt - { exch dup 127 string cvs (/) print print (:) print - /Font resourcestatus {pop pop (Yes)} {(No)} ifelse = - } { exit } ifelse - } bind loop - (*) = flush restore" -*End - -*?FontList: " - save (*) {cvn ==} 128 string /Font resourceforall - (*) = flush restore" -*End - -*DefaultColorSep: ProcessBlack.60lpi.600x600dpi/60 lpi / 600x600 dpi - -*% For 60 lpi / 600x600dpi ================================ - -*ColorSepScreenAngle ProcessBlack.60lpi.600x600dpi/60 lpi / 600x600 dpi: "0.0" -*ColorSepScreenAngle CustomColor.60lpi.600x600dpi/60 lpi / 600x600 dpi: "0.0" -*ColorSepScreenAngle ProcessCyan.60lpi.600x600dpi/60 lpi / 600x600 dpi: "0.0" -*ColorSepScreenAngle ProcessMagenta.60lpi.600x600dpi/60 lpi / 600x600 dpi: "0.0" -*ColorSepScreenAngle ProcessYellow.60lpi.600x600dpi/60 lpi / 600x600 dpi: "0.0" - -*ColorSepScreenFreq ProcessBlack.60lpi.600x600dpi/60 lpi / 600x600 dpi: "60.0" -*ColorSepScreenFreq CustomColor.60lpi.600x600dpi/60 lpi / 600x600 dpi: "60.0" -*ColorSepScreenFreq ProcessCyan.60lpi.600x600dpi/60 lpi / 600x600 dpi: "60.0" -*ColorSepScreenFreq ProcessMagenta.60lpi.600x600dpi/60 lpi / 600x600 dpi: "60.0" -*ColorSepScreenFreq ProcessYellow.60lpi.600x600dpi/60 lpi / 600x600 dpi: "60.0" - -*% end of PPD file for MS PS5 OEM Custimization diff --git a/print/autoconfig/AutoCnfg.inf b/print/autoconfig/AutoCnfg.inf deleted file mode 100644 index 8e0f0859..00000000 Binary files a/print/autoconfig/AutoCnfg.inf and /dev/null differ diff --git a/print/autoconfig/AutoConfig.htm b/print/autoconfig/AutoConfig.htm deleted file mode 100644 index 5a32268c..00000000 --- a/print/autoconfig/AutoConfig.htm +++ /dev/null @@ -1,367 +0,0 @@ - - - - -Auto-Configuration Samples - - - - - -

Auto-Configuration Samples

-

Summary

-

-AutoConfig sample -demonstrates how to implement Unidrv-based and PScript5-based drivers to -leverage the inbox support for auto-configuration.

-

-The sample -works only when used with the standard TCP/IP port monitor or the -Network-Connected Device (NCD) port monitor.

-

 

-

-Note: The -sample is provided here only as a proof of concept.

-

 

-

The -table shown below identifies which operating systems this sample will build and -work on.

-

 

-

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Operating System

-

- Can sample be - built in the OS? -

-

- Does sample work - in the OS?

-

- - Can sample be used in a production environment for the OS?

-

- Windows Vista

-

- Yes

-

- Yes

-

- No

-

- Windows Server - 2003

-

- No

-

- No

-

- No

-

- Windows XP

-

- No

-

- No

-

- No

-

- Windows 2000

-

- No

-

- No

-

- No

-

- Windows Me

-

- No

-

- No

-

- No

-

- Windows 98 SE

-

- No

-

- No

-

- No

-

 

-

Auto-Configuration -Basics

-

Prior -to Microsoft Windows Vista, the settings of a print queue are set initially to -the driver's default settings, rather than to the appropriate settings based on -the device. For Unidrv or Pscript5, this means that static default values -specified in the GPD or PPD file are used for the initial print queue setup. -This static set of defaults necessarily must represent the minimum configuration -that a printer can ship with. For instance, if a stapling unit is optional for a -device, then by default, such a device cannot have stapling capability enabled, -otherwise the user interface for devices without the stapling unit would show -stapling as an option. A customer who selected the stapling option but found -that it did not work would likely be confused.

-

For any device that -comes with features not present in the basic model, a user or administrator must -manually configure these features on the print queue after installation. This -can at times be a confusing and non-intuitive experience. The configuration -process is easy to get wrong, particularly with regard to internal parameters -such as memory and hard disk size, which significantly can affect printing speed -and quality.

-

Auto-configuration -solves this problem by -automatically configuring the print queue according to the installable features -on the device, rather than simply using the driver's static default settings. -The main target for auto-configuration is network printers. They are the most -likely ones to have multiple optional features and require more manual -configuration.

-

Auto-configuration -works by means of -bi-directional printer communication (also known as bidi communication) between -the print subsystem and the printer. In order for auto-configuration to work, -the printer must be able to:

-

-                  - -Understand a -query sent by the port monitor.

-

-                  - -Generate the -appropriate response to the query.

-

To support -auto-configuration, both the printer driver and the port monitor must be -modified.

-

A printer driver -must:

-

-                  - -Be aware of -the Bidi Notification Schema.

-

-                  - -Be able to -receive notifications about device configuration changes using the Bidi -Notification Schema.

-

-                  - -Be able to -solicit configuration data from the printer using the Bidi Communication -Interfaces, and specifically the IBidiSpl2 COM interface (described in -the Platform SDK documentation).

-

A port monitor -must:

-

-                  - -Support a -device protocol capable of querying the printer's configuration.

-

-                  - -Be able to -receive unsolicited status messages from the printer.

-

-                  - -Convert -unsolicited status messages to an appropriate driver notification.

-

-                  - -Keep all of -the device status and configuration data up-to date by means of polling or -alerts.

-

-                  - -Inform the -driver or application of any configuration changes in the device.

-

Unidrv-based and -PScript5-based drivers using the standard TCP/IP port monitor or the -Network-Connected Device (NCD) port monitor provide support for -auto-configuration.

-

CODE TOUR

-

 

-

-Unidrv - -Auto-Configuration Sample

-

- 

-

The main part of the -sample is the auto-configuration GDL file ACnfgUni.GDL. This file implements -the  *BidiQuery, *BidiResponse and *Option elements that correspond to the -Memory, DuplexUnit and PrinterHardDisk features in AutoCnfg.GPD file. The -Feature and Option names in the auto-configuration GDL file should exaclty match -the corresponding Feature and Option names in the GPD file. The -auto-configuration GDL file is specified in the GPD file using the *BidiQueryFile -keyword. The auto-configuration GDL content can also be contained directly -inside the GPD file itself instead of in a separate GDL file, in which case the -*BidiQueryFile keyword should specify the GPD file name.

-

 

-

-PScript5 Auto-Configuration -Sample

-

 

-

The -main part of the sample is the auto-configuration GDL file ACnfgPS.GDL. This -file implements the *BidiQuery, *BidiResponse and *Option elements that -corresponds to the InstalledMemory, DuplexUnit and HardDisk features in -AutoCnfg.PPD file. As mentioned for the Unidrv sample, the Feature and Option -names should exactly match. Please note that the GPD and PPD files do not have -the same Feature and Option names. That is why the two GDL files are not -identical. The auto-configuration GDL file is specified in the PPD file using -the *MSBidiQueryFile keyword.

-

INSTALLING/TESTING THE SAMPLE

-

The samples dont have -any binaries to be built. They may be installed by using Add Printer Wizard and -supplying the AutoCnfg.INF as the INF file. To test the auto-configuration -feature you need to install the driver to a Standard TCP/IP port.  You need a -printer, which understands and responds to the bidi SNMP queries, connected to -the port. The tcpbidi.xml file located in system32 directory has information -about the SNMP OIDs used for each query. The installable options in the device -settings will reflect the information obtained by querying the printer. -

-

File Manifest 

-
 
-
Root:
-
 
-
Files                  Description
-
 
-

AutoConfig.htm      The documentation for this sample -(this file)

-

AutoCnfg.INF        The printer INF that will install -Unidrv and PScript5 auto-configuration samples

-

AutoCnfg.GPD        The GPD file for the Unidrv -auto-configuration sample

-

AutoCnfg.PPD        The PPD file for the PScript5 -auto-configuration sample

-

ACnfgUni.GDL        The GDL file for the Unidrv -auto-configuration sample

-

ACnfgPS.GDL         The GDL file for the PScript5 -auto-configuration sample

-

Resources

-

For -the latest release of the Windows Device Driver Development Kit, see - -http://www.microsoft.com/whdc/ddk/winddk.mspx.

-

 

-

If -you have questions on using or adapting this sample for your project, you can -either contact - -Microsoft Technical Support or post your questions in the - -Microsoft driver development newsgroup.

- - - - diff --git a/print/autoconfig/AutoConfig.sln b/print/autoconfig/AutoConfig.sln deleted file mode 100644 index 41c3f755..00000000 --- a/print/autoconfig/AutoConfig.sln +++ /dev/null @@ -1,61 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26430.16 -MinimumVisualStudioVersion = 12.0 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Package", "Package", "{C8C5A4C2-DE1C-4B59-9E50-DD766C931F7A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AutoConfig", "AutoConfig", "{02B91EC2-24FC-4562-AEB5-4269AA96F54F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "package", "Package\package.VcxProj", "{34C973B1-CBF0-4A78-A05A-176FCFB1D25F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AutoConfig", "AutoConfig.vcxproj", "{DBBDF822-170C-4685-BAE7-5E0531334164}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM64 = Debug|ARM64 - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|ARM64 = Release|ARM64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F}.Debug|ARM64.Build.0 = Debug|ARM64 - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F}.Debug|Win32.ActiveCfg = Debug|Win32 - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F}.Debug|Win32.Build.0 = Debug|Win32 - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F}.Debug|x64.ActiveCfg = Debug|x64 - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F}.Debug|x64.Build.0 = Debug|x64 - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F}.Release|ARM64.ActiveCfg = Release|ARM64 - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F}.Release|ARM64.Build.0 = Release|ARM64 - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F}.Release|ARM64.Deploy.0 = Release|ARM64 - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F}.Release|Win32.ActiveCfg = Release|Win32 - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F}.Release|Win32.Build.0 = Release|Win32 - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F}.Release|x64.ActiveCfg = Release|x64 - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F}.Release|x64.Build.0 = Release|x64 - {DBBDF822-170C-4685-BAE7-5E0531334164}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {DBBDF822-170C-4685-BAE7-5E0531334164}.Debug|ARM64.Build.0 = Debug|ARM64 - {DBBDF822-170C-4685-BAE7-5E0531334164}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {DBBDF822-170C-4685-BAE7-5E0531334164}.Debug|Win32.ActiveCfg = Debug|Win32 - {DBBDF822-170C-4685-BAE7-5E0531334164}.Debug|Win32.Build.0 = Debug|Win32 - {DBBDF822-170C-4685-BAE7-5E0531334164}.Debug|x64.ActiveCfg = Debug|x64 - {DBBDF822-170C-4685-BAE7-5E0531334164}.Debug|x64.Build.0 = Debug|x64 - {DBBDF822-170C-4685-BAE7-5E0531334164}.Release|ARM64.ActiveCfg = Release|ARM64 - {DBBDF822-170C-4685-BAE7-5E0531334164}.Release|ARM64.Build.0 = Release|ARM64 - {DBBDF822-170C-4685-BAE7-5E0531334164}.Release|ARM64.Deploy.0 = Release|ARM64 - {DBBDF822-170C-4685-BAE7-5E0531334164}.Release|Win32.ActiveCfg = Release|Win32 - {DBBDF822-170C-4685-BAE7-5E0531334164}.Release|Win32.Build.0 = Release|Win32 - {DBBDF822-170C-4685-BAE7-5E0531334164}.Release|x64.ActiveCfg = Release|x64 - {DBBDF822-170C-4685-BAE7-5E0531334164}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {C8C5A4C2-DE1C-4B59-9E50-DD766C931F7A} = {02B91EC2-24FC-4562-AEB5-4269AA96F54F} - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F} = {C8C5A4C2-DE1C-4B59-9E50-DD766C931F7A} - {DBBDF822-170C-4685-BAE7-5E0531334164} = {02B91EC2-24FC-4562-AEB5-4269AA96F54F} - EndGlobalSection -EndGlobal diff --git a/print/autoconfig/AutoConfig.vcxproj b/print/autoconfig/AutoConfig.vcxproj deleted file mode 100644 index 157a3421..00000000 --- a/print/autoconfig/AutoConfig.vcxproj +++ /dev/null @@ -1,219 +0,0 @@ - - - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {DBBDF822-170C-4685-BAE7-5E0531334164} - $(MSBuildProjectName) - false - true - Debug - Win32 - {821AA832-43DA-484F-B436-A751BBC5E1F9} - - - - Windows10 - False - Desktop - None - WindowsKernelModeDriver10.0 - Utility - - - Windows10 - False - Desktop - None - WindowsKernelModeDriver10.0 - Utility - - - Windows10 - True - Desktop - None - WindowsKernelModeDriver10.0 - Utility - - - Windows10 - True - Desktop - None - WindowsKernelModeDriver10.0 - Utility - - - Windows10 - False - Desktop - None - WindowsKernelModeDriver10.0 - Utility - - - Windows10 - True - Desktop - None - WindowsKernelModeDriver10.0 - Utility - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - AutoConfig - - - AutoConfig - - - AutoConfig - - - AutoConfig - - - AutoConfig - - - AutoConfig - - - - - - - - - - - - - - - - - - - - sha256 - - - - - - - - - - - - - - - sha256 - - - - - - - - - - - - - - - sha256 - - - - - - - - - sha256 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/autoconfig/AutoConfig.vcxproj.Filters b/print/autoconfig/AutoConfig.vcxproj.Filters deleted file mode 100644 index de588577..00000000 --- a/print/autoconfig/AutoConfig.vcxproj.Filters +++ /dev/null @@ -1,33 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {D1B6D29E-5EA1-4F2A-960C-443922495DA5} - - - h;hpp;hxx;hm;inl;inc;xsd - {0ABCC6C5-B619-4FCF-AB9C-73DBCBE6068D} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {E239B7F1-0E58-4214-A82C-6EF67A1B3200} - - - inf;inv;inx;mof;mc; - {4E1D1476-C128-41DB-8AC6-44D5C6CD9B08} - - - - - Driver Files - - - - - - - - - - \ No newline at end of file diff --git a/print/autoconfig/Package/package.VcxProj b/print/autoconfig/Package/package.VcxProj deleted file mode 100644 index 2a7cb511..00000000 --- a/print/autoconfig/Package/package.VcxProj +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - {DBBDF822-170C-4685-BAE7-5E0531334164} - - - - WindowsKernelModeDriver10.0 - Utility - Package - true - Debug - - - - {34C973B1-CBF0-4A78-A05A-176FCFB1D25F} - {2E5E1DA7-8772-44A5-ABE9-1B80A98A90AD} - $(MSBuildProjectName) - - - Windows10 - true - - - Windows10 - false - - - Windows10 - true - - - Windows10 - true - - - Windows10 - false - - - Windows10 - false - - - - - - - - - - - DbgengKernelDebugger - False - None - - - - - - %PathToInf% - False - False - True - - 133563 - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - sha256 - - - - - - \ No newline at end of file diff --git a/print/autoconfig/Package/package.VcxProj.Filters b/print/autoconfig/Package/package.VcxProj.Filters deleted file mode 100644 index c693e880..00000000 --- a/print/autoconfig/Package/package.VcxProj.Filters +++ /dev/null @@ -1,21 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {AFCC4B11-852A-4DCE-95D8-5D2DCAE22085} - - - h;hpp;hxx;hm;inl;inc;xsd - {0ECC0278-CEC7-4209-951D-119A7D63A76D} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {51B9F757-EC1F-4B30-8B99-C9D27C96E97F} - - - inf;inv;inx;mof;mc; - {7FD4D4E0-CF4E-4AA5-ABAD-FC643918C407} - - - \ No newline at end of file diff --git a/print/autoconfig/README.md b/print/autoconfig/README.md deleted file mode 100644 index a4311618..00000000 --- a/print/autoconfig/README.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -page_type: sample -description: "Demonstrates how to implement auto-configuration in v4 print drivers." -languages: -- cpp -products: -- windows -- windows-wdk ---- - -# Print auto-configuration sample - -This sample demonstrates how to implement auto-configuration in v4 print drivers. - -## Auto-configuration basics - -Many printers ship with optional components which are not present in all versions of the printer. For these printers, it's important that the driver only shows options which are enabled by the currently installed hardware. For example, if a stapling unit is optional for a particular printer, then the driver shouldn't expose the stapling feature to the end user if that unit is not installed. - -Windows auto-configuration allows a print driver to specify a mapping between driver installable options and the state of the printer as expressed through the Bidi Schema. - -For more information on auto-configuration, see [Printer Autoconfiguration](https://docs.microsoft.com/windows-hardware/drivers/print/printer-autoconfiguration). - -For more information on the Bidi Schema, see [Bidirectional Communication Schema](https://docs.microsoft.com/windows-hardware/drivers/print/bidirectional-communication-schema). - -## Build the sample - -The auto-configuration sample doesn't have any binaries to be built. It may be installed by using **Add Printer Wizard** and supplying the AutoCnfg.INF as the INF file. - -Too build a signed driver package using Windows Driver Kit (WDK) 10 and Visual Studio 2015, for the project file (csproj) that ships with the auto-configuration sample, perform the following steps. - -1. Open the solution file in Visual Studio 2015. - -1. On the **Build** menu, select **Configuration Manager...**. - -1. In **Configuration Manager**, select the **Configuration** and **Platform** that you want to build your driver for. - -> [!NOTE] -> When the driver builds, it will be placed in the output folder for the architecture you selected. - -At this point, Visual Studio will be able to build a driver package and output the files to disk. In order to configure driver signing and deployment, see [Developing, Testing, and Deploying Drivers](https://docs.microsoft.com/windows-hardware/drivers/develop/). - -For more information about how to build a driver solution using Microsoft Visual Studio, see [Building a Driver with Visual Studio and the WDK](https://docs.microsoft.com/windows-hardware/drivers/develop/building-a-driver). - -## Run the sample - -To run the auto-configuration sample, you must install this driver to support a printer which is installed against either a WSD port, or TCP/IP port. Additionally, USB printers may be supported if the driver is updated to incorporate USB Bidi Javascript, as described here: [Print Driver USB Monitor and Bidi Sample](https://docs.microsoft.com/samples/microsoft/windows-driver-samples/print-driver-usb-monitor-and-bidi-sample/). diff --git a/print/cpsuisam/CPSUIDAT.C b/print/cpsuisam/CPSUIDAT.C deleted file mode 100644 index c3854001..00000000 --- a/print/cpsuisam/CPSUIDAT.C +++ /dev/null @@ -1,1331 +0,0 @@ -/*++ - -Copyright (c) 1990-2003 Microsoft Corporation -All Rights Reserved - - -Module Name: - - cpsuidat.c - - -Abstract: - - This module contains all the predefined data - - ---*/ - - -#include "precomp.h" -#pragma hdrstop - -#define DBG_CPSUIFILENAME DbgTVPage - - - -#define DBG_TVTESTCB 0x00000001 -#define DBG_PUSHDLGPROC 0x00000002 - -DEFINE_DBGVAR(0); - -#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) - - -HINSTANCE hInstApp = NULL; - -TCHAR TitleName[] = TEXT("Common Property Sheet UI Sample"); -TCHAR ClassName[] = TEXT("CPSUISampleClass"); -TCHAR MenuName[] = TEXT("CPSUISampleMenu"); -TCHAR OptItemName[] = TEXT("CPSUI TreeView Sample"); -TCHAR szWinSpool[] = TEXT("WinSpool.Drv"); -CHAR szDocPropSheets[] = "DocumentPropertySheets"; - -BOOL UpdatePermission = TRUE; -BOOL UseStdAbout = TRUE; - - -INT_PTR -CALLBACK -PushButtonProc( - HWND hDlg, - UINT Msg, - WPARAM wParam, - LPARAM lParam - ); - -CPSUICALLBACK -TVTestCallBack( - _In_ PCPSUICBPARAM pCPSUICBParam - ); - - -OPTPARAM NoYesOP[] = { - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - (LPTSTR)IDS_CPSUI_NO, // pData - IDI_CPSUI_NO, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - (LPTSTR)IDS_CPSUI_YES, // pData - IDI_CPSUI_YES, // IconID - 1 // lParam - } -}; - -EXTCHKBOX ECB_EP_ECB = { - - sizeof(EXTCHKBOX), - 0, - TEXT("Include Icon"), - (LPTSTR)IDS_CPSUI_SLASH_SEP, - TEXT("Icon"), - IDI_CPSUI_GRAPHIC }; - - -OPTPARAM ECB_EP_OP[] = { - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("None"), // pData - IDI_CPSUI_EMPTY, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("Extended CheckBox"), // pData - IDI_CPSUI_EMPTY, // IconID - 1 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("Extended Push"), // pData - IDI_CPSUI_EMPTY, // IconID - 0 // lParam - } -}; - - -OPTTYPE ECB_EP_OT = { - - sizeof(OPTTYPE), // cbSize - TVOT_3STATES, // Type - 0, // Flags OPTTF_xxxx - 3, // Count - 0, // BegCtrlID - ECB_EP_OP, // pOptParam - 0 // Style, OTS_xxxx - }; - -OPTTYPE NoYesOT = { - - sizeof(OPTTYPE), // cbSize - TVOT_2STATES, // Type - 0, // Flags OPTTF_xxxx - 2, // Count - 0, // BegCtrlID - NoYesOP, // pOptParam - 0 // Style, OTS_xxxx - }; - -OPTPARAM TVOT3StatesOP[] = { - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("States 1"), // pData - IDI_CPSUI_PORTRAIT, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("States 2"), // pData - IDI_CPSUI_LANDSCAPE, // IconID - 1 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("States 3"), // pData - IDI_CPSUI_ROT_LAND, // IconID - 0 // lParam - } -}; - -OPTTYPE TVOT2StatesOT = { - - sizeof(OPTTYPE), // cbSize - TVOT_2STATES, // Type - 0, // Flags OPTTF_xxxx - 2, // Count - 0, // BegCtrlID - TVOT3StatesOP, // pOptParam - 0 // Style, OTS_xxxx - }; - -OPTTYPE TVOT3StatesOT = { - - sizeof(OPTTYPE), // cbSize - TVOT_3STATES, // Type - 0, // Flags OPTTF_xxxx - 3, // Count - 0, // BegCtrlID - TVOT3StatesOP, // pOptParam - 0 // Style, OTS_xxxx - }; - -OPTPARAM MinRangeOP[] = { - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT(""), // pData (postfix) - IDI_CPSUI_EMPTY, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - NULL, // pData (help line) - (DWORD)MIN_INT, // IconID - MAX_INT // lParam - } -}; - -OPTTYPE MinRangeOT = { - - sizeof(OPTTYPE), // cbSize - TVOT_UDARROW, // Type - 0, // Flags OPTTF_xxxx - 2, // Count - 0, // BegCtrlID - MinRangeOP, // pOptParam - 0 // Style, OTS_xxxx - }; - -OPTPARAM MaxRangeOP[] = { - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT(""), // pData (postfix) - IDI_CPSUI_EMPTY, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - NULL, // pData (help line) - (DWORD)MIN_INT, // IconID - MAX_INT // lParam - } -}; - -OPTTYPE MaxRangeOT = { - - sizeof(OPTTYPE), // cbSize - TVOT_UDARROW, // Type - 0, // Flags OPTTF_xxxx - 2, // Count - 0, // BegCtrlID - MaxRangeOP, // pOptParam - 0 // Style, OTS_xxxx - }; - - -OPTPARAM MinMaxRangeOP[] = { - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("%"), // pData (postfix) - IDI_CPSUI_SCALING, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - NULL, // pData (help line) - (DWORD)MIN_INT, // IconID - MAX_INT // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - NULL, // pData (help line) - 2, // IconID - 50 // lParam - } -}; - -OPTTYPE TVOTUDArrowOT = { - - sizeof(OPTTYPE), // cbSize - TVOT_UDARROW, // Type - 0, // Flags OPTTF_xxxx - 2, // Count - 0, // BegCtrlID - MinMaxRangeOP, // pOptParam - 0 // Style, OTS_xxxx - }; - -OPTTYPE TVOTTrackBarOT = { - - sizeof(OPTTYPE), // cbSize - TVOT_TRACKBAR, // Type - 0, // Flags OPTTF_xxxx - 3, // Count - 0, // BegCtrlID - MinMaxRangeOP, // pOptParam - 0 // Style, OTS_xxxx - }; - -OPTTYPE TVOTScrollBarOT = { - - sizeof(OPTTYPE), // cbSize - TVOT_SCROLLBAR, // Type - 0, // Flags OPTTF_xxxx - 3, // Count - 0, // BegCtrlID - MinMaxRangeOP, // pOptParam - 0 // Style, OTS_xxxx - }; - -OPTPARAM TVOTLBCBOP[] = { - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - (LPTSTR)IDS_CPSUI_NOTINSTALLED, // pData - IDI_CPSUI_SEL_NONE, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT(" 1 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT(" 2 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT(" 4 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT(" 6 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT(" 8 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("10 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("12 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("14 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("16 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("18 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("20 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("24 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("32 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("48 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("64 MB"), // pData - IDI_CPSUI_MEM, // IconID - 0 // lParam - }, -}; - - -OPTTYPE TVOTListBoxOT = { - - sizeof(OPTTYPE), // cbSize - TVOT_LISTBOX, // Type - 0, // Flags OPTTF_xxxx - COUNT_ARRAY(TVOTLBCBOP), // Count - 0, // BegCtrlID - TVOTLBCBOP, // pOptParam - 0 // Style, OTS_xxxx - }; - - -OPTTYPE TVOTComboBoxOT = { - - sizeof(OPTTYPE), // cbSize - TVOT_COMBOBOX, // Type - 0, // Flags OPTTF_xxxx - COUNT_ARRAY(TVOTLBCBOP), // Count - 0, // BegCtrlID - TVOTLBCBOP, // pOptParam - 0 // Style, OTS_xxxx - }; - -TCHAR TVOTEditBoxBuf[128] = TEXT("Confidential"); - -OPTPARAM TVOTEditBoxOP[] = { - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("*Mark*"), // pData - IDI_CPSUI_WATERMARK, // IconID - 0 // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("Type in WaterMark text"), // pData - COUNT_ARRAY(TVOTEditBoxBuf), // IconID - 0 // lParam - } -}; - - -OPTTYPE TVOTEditBoxOT = { - - sizeof(OPTTYPE), // cbSize - TVOT_EDITBOX, // Type - 0, // Flags OPTTF_xxxx - 2, // Count - 0, // BegCtrlID - TVOTEditBoxOP, // pOptParam - 0 // Style, OTS_xxxx - }; - -OPTPARAM TVOTChkBoxOP[] = { - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - CHKBOXS_FALSE_TRUE, // style - TEXT("Let's do it!"), // pData - IDI_CPSUI_TELEPHONE, // IconID - 0 // lParam - } -}; - - - -OPTTYPE TVOTChkBoxOT = { - - sizeof(OPTTYPE), // cbSize - TVOT_CHKBOX, // Type - 0, // Flags OPTTF_xxxx - 1, // Count - 0, // BegCtrlID - TVOTChkBoxOP, // pOptParam - 0 // Style, OTS_xxxx - }; - - -OPTPARAM ChkBoxTypeOP[] = { - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("CHKBOXS_FALSE_TRUE"), // pData - IDI_CPSUI_EMPTY, // IconID - CHKBOXS_FALSE_TRUE // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("CHKBOXS_NO_YES"), // pData - IDI_CPSUI_EMPTY, // IconID - CHKBOXS_NO_YES // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("CHKBOXS_OFF_ON"), // pData - IDI_CPSUI_EMPTY, // IconID - CHKBOXS_OFF_ON // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("CHKBOXS_FALSE_PDATA"), // pData - IDI_CPSUI_EMPTY, // IconID - CHKBOXS_FALSE_PDATA // lParam - }, - - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("CHKBOXS_NO_PDATA"), // pData - IDI_CPSUI_EMPTY, // IconID - CHKBOXS_NO_PDATA // lParam - }, - - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("CHKBOXS_OFF_PDATA"), // pData - IDI_CPSUI_EMPTY, // IconID - CHKBOXS_OFF_PDATA // lParam - }, - - { - sizeof(OPTPARAM), // cbSize - 0, // OPTPF_xxx - 0, // style - TEXT("CHKBOXS_NONE_PDATA"), // pData - IDI_CPSUI_EMPTY, // IconID - CHKBOXS_NONE_PDATA // lParam - } -}; - - -OPTTYPE ChkBoxTypeOT = { - - sizeof(OPTTYPE), // cbSize - TVOT_LISTBOX, // Type - 0, // Flags OPTTF_xxxx - COUNT_ARRAY(ChkBoxTypeOP), // Count - 0, // BegCtrlID - ChkBoxTypeOP, // pOptParam - 0 // Style, OTS_xxxx - }; - -EXTCHKBOX TV_ECB = { - - sizeof(EXTCHKBOX), - ECBF_OVERLAY_WARNING_ICON, - TEXT("Extended CheckBox Test"), - (LPTSTR)IDS_CPSUI_SLASH_SEP, - TEXT("Got Checked!!!"), - IDI_APPLE }; - -EXTPUSH TV_EP = { - - sizeof(EXTPUSH), - 0, - TEXT("Extended Push Test"), - NULL, //DLGPROC - IDI_APPLE, - 0 }; - - - -OPTITEM TVTestOptItems[] = { - - { sizeof(OPTITEM), LEVEL_0, 0, OPTIF_NONE, 0, - (LPTSTR)TEXT("TreeView Test"), IDI_CPSUI_QUESTION, NULL, - NULL, 0, DMPUB_TVTEST }, - - { sizeof(OPTITEM), LEVEL_1, 0, OPTIF_COLLAPSE, 0, - (LPTSTR)TEXT("CPSUI Options"), 0, NULL, - NULL, 0, DMPUB_TVOPT }, - - { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, - (LPTSTR)TEXT("Extended Type"), 0, &ECB_EP_ECB, - &ECB_EP_OT, 0, DMPUB_TVOPT_ECB_EP }, - - { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, - (LPTSTR)TEXT("Disabled Extended"), 0, NULL, - &NoYesOT, 0, DMPUB_EXT_DISABLED }, - - { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, - (LPTSTR)TEXT("Overlay 'Warning' Icon"), 0, NULL, - &NoYesOT, 0, DMPUB_EXT_OVERLAY_WARNING }, - - { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, - (LPTSTR)TEXT("Overlay 'Stop' Icon"), 0, NULL, - &NoYesOT, 0, DMPUB_EXT_OVERLAY_STOP }, - - { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, - (LPTSTR)TEXT("Overlay 'No' Icon"), 0, NULL, - &NoYesOT, 0, DMPUB_EXT_OVERLAY_NO }, - - { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_COLLAPSE, 0, - (LPTSTR)TEXT("OptItem/OptType"), 0, NULL, - NULL, 0, DMPUB_TVOPT }, - - { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, - (LPTSTR)TEXT("Disabled OptType"), 0, NULL, - &NoYesOT, 0, DMPUB_TVOPT_DISABLED }, - - { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, - (LPTSTR)TEXT("Overlay 'Warning' Icon"), 0, NULL, - &NoYesOT, 0, DMPUB_TVOPT_OVERLAY_WARNING }, - - { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, - (LPTSTR)TEXT("Overlay 'Stop' Icon"), 0, NULL, - &NoYesOT, 0, DMPUB_TVOPT_OVERLAY_STOP }, - - { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, - (LPTSTR)TEXT("Overlay 'No' Icon"), 0, NULL, - &NoYesOT, 0, DMPUB_TVOPT_OVERLAY_NO }, - - { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_COLLAPSE, 0, - (LPTSTR)TEXT("ScrollBar/TrackBar Ranges"), 0, NULL, - NULL, 0, DMPUB_TVOPT }, - - { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, - TEXT("Min Range"), MIN_INT, NULL, - &MinRangeOT, 0, DMPUB_MINRANGE }, - - { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, - TEXT("Max. Range"), MAX_INT, NULL, - &MaxRangeOT, 0, DMPUB_MAXRANGE }, - - { sizeof(OPTITEM), LEVEL_1, 0, OPTIF_NONE, 0, - TEXT("TVOT Test"), IDI_CPSUI_QUESTION, NULL, - NULL, 0, DMPUB_TVOPT_TEST }, - - { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, - (LPTSTR)TEXT("TVOT_2STATES"), 0, NULL, - &TVOT2StatesOT, 0, DMPUB_2STATES }, - - { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, - TEXT("TVOT_3STATES"), 0, NULL, - &TVOT3StatesOT, 0, DMPUB_3STATES }, - - { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, - TEXT("TVOT_UDARROW"), 55, NULL, - &TVOTUDArrowOT, 0, DMPUB_UDARROW }, - - { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, - TEXT("TVOT_TRACKBAR"), 100, NULL, - &TVOTTrackBarOT, 0, DMPUB_TRACKBAR }, - - { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, - TEXT("TVOT_SCROLLBAR"), 210, NULL, - &TVOTScrollBarOT, 0, DMPUB_SCROLLBAR }, - - { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, - TEXT("TVOT_LISTBOX"), 2, NULL, - &TVOTListBoxOT, 0, DMPUB_LISTBOX }, - - { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, - (LPTSTR)TEXT("Include 16x16 Icons"), 1, NULL, - &NoYesOT, 0, DMPUB_TVOPT_ICONS }, - - { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, - TEXT("TVOT_COMBOBOX"), 4, NULL, - &TVOTComboBoxOT, 0, DMPUB_COMBOBOX }, - - { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, - (LPTSTR)TEXT("Include 16x16 Icons"), 1, NULL, - &NoYesOT, 0, DMPUB_TVOPT_ICONS }, - - { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, - TEXT("TVOT_EDITBOX"), 0, NULL, // fill in TVOTEditBoxBuf later - &TVOTEditBoxOT, 0, DMPUB_EDITBOX }, - - { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, - TEXT("TVOT_CHKBOX"), 0, NULL, - &TVOTChkBoxOT, 0, DMPUB_CHKBOX }, - - { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK, 0, - TEXT("CheckBox Type"), 0, NULL, - &ChkBoxTypeOT, 0, DMPUB_CHKBOX_TYPE } - -}; - - - -INT_PTR -CALLBACK -PushButtonProc( - HWND hDlg, - UINT Msg, - WPARAM wParam, - LPARAM lParam - ) -{ - -#ifndef DBG - UNREFERENCED_PARAMETER(lParam); -#endif - - switch (Msg) { - - case WM_INITDIALOG: /* message: initialize dialog box */ - - CPSUIDBG(DBG_PUSHDLGPROC, - ("PushButtonProc lParam=%s", (LPSTR)lParam)); - break; - - case WM_COMMAND: - - switch(LOWORD(wParam)) { - - case IDOK: - case IDCANCEL: - - EndDialog(hDlg, (BOOL)(LOWORD(wParam) == IDOK)); - return(TRUE); - } - } - - return(FALSE); -} - - - -INT_PTR -APIENTRY -MyAboutProc( - HWND hDlg, - UINT Msg, - WPARAM wParam, - LPARAM lParam - ) - -/*++ - -Routine Description: - - This is the about... callback which pop up appliation's own about - - ---*/ -{ - PCOMPROPSHEETUI pCPSUI = NULL; - TCHAR Buf[128] = {0}; - HRESULT hr = S_OK; - - switch (Msg) { - - case WM_INITDIALOG: /* message: initialize dialog box */ - - pCPSUI = (PCOMPROPSHEETUI)lParam; - - hr = pCPSUI ? S_OK : E_INVALIDARG; - - if (SUCCEEDED(hr)) - { - hr = StringCchPrintf(Buf, ARRAY_SIZE(Buf), TEXT("About %s"), pCPSUI->pCallerName); - } - - if (SUCCEEDED(hr)) - { - hr = SetWindowText(hDlg, Buf) ? S_OK : E_FAIL; - } - - if (SUCCEEDED(hr)) - { - hr = StringCchPrintf(Buf, ARRAY_SIZE(Buf), - TEXT("%s Version %u.%u"), - pCPSUI->pCallerName, - (UINT)HIBYTE(pCPSUI->CallerVersion), - (UINT)LOBYTE(pCPSUI->CallerVersion)); - } - - if (SUCCEEDED(hr)) - { - hr = SetDlgItemText(hDlg, IDD_ABOUT1, Buf) ? S_OK : E_FAIL; - } - - if (SUCCEEDED(hr)) - { - hr = StringCchPrintf(Buf, ARRAY_SIZE(Buf), - TEXT("%s Version %u.%u"), - pCPSUI->pOptItemName, - (UINT)HIBYTE(pCPSUI->OptItemVersion), - (UINT)LOBYTE(pCPSUI->OptItemVersion)); - } - - if (SUCCEEDED(hr)) - { - hr = SetDlgItemText(hDlg, IDD_ABOUT2, Buf) ? S_OK : E_FAIL; - } - - break; - - case WM_COMMAND: - - switch(LOWORD(wParam)) { - - case IDOK: - case IDCANCEL: - - EndDialog(hDlg, (BOOL)(LOWORD(wParam) == IDOK)); - return(TRUE); - } - } - - return (FALSE); -} - - - -POPTITEM -FindOptItem( - POPTITEM pOptItem, - UINT cOptItem, - BYTE DMPubID - ) -{ - while (cOptItem--) { - - if (pOptItem->DMPubID == DMPubID) { - - return(pOptItem); - } - - ++pOptItem; - } - - return(NULL); -} - - - -CPSUICALLBACK -TVTestCallBack( - _In_ PCPSUICBPARAM pCPSUICBParam - ) -{ - POPTITEM pCurItem = pCPSUICBParam->pCurItem; - POPTITEM pItem; - BYTE DMPubID; - LONG Sel; - LONG Action = CPSUICB_ACTION_NONE; - - - DMPubID = pCurItem->DMPubID; - Sel = pCurItem->Sel; - - switch (pCPSUICBParam->Reason) { - - case CPSUICB_REASON_OPTITEM_SETFOCUS: - - CPSUIDBG(DBG_TVTESTCB, ("Got OPTITEM_SETFOCUS CallBack now")); - - switch (DMPubID) - { - case DMPUB_MINRANGE: - { - pItem = FindOptItem(pCPSUICBParam->pOptItem, - pCPSUICBParam->cOptItem, - DMPUB_MAXRANGE); - - if (pItem) - { - pCurItem->pOptType->pOptParam[1].lParam = (LONG)pItem->Sel; - } - } - - break; - - case DMPUB_MAXRANGE: - { - pItem = FindOptItem(pCPSUICBParam->pOptItem, - pCPSUICBParam->cOptItem, - DMPUB_MINRANGE); - - if (pItem) - { - pCurItem->pOptType->pOptParam[1].IconID = (DWORD)pItem->Sel; - } - } - - break; - - } - - break; - - case CPSUICB_REASON_ABOUT: - - DialogBoxParam(hInstApp, - MAKEINTRESOURCE(DLGABOUT), - pCPSUICBParam->hDlg, - MyAboutProc, - (LPARAM)(pCPSUICBParam->pOldSel)); - - break; - - case CPSUICB_REASON_ECB_CHANGED: - - CPSUIDBG(DBG_TVTESTCB, ("Got ECB_CHANGED CallBack now")); - - switch (DMPubID) { - - case DMPUB_TVOPT_ECB_EP: - - if (pCurItem->Flags & OPTIF_ECB_CHECKED) { - - TV_EP.IconID = - TV_ECB.IconID = IDI_APPLE; - - } else { - - TV_EP.IconID = - TV_ECB.IconID = 0; - } - - Action = CPSUICB_ACTION_OPTIF_CHANGED; - break; - - default: - - break; - } - - break; - - case CPSUICB_REASON_SEL_CHANGED: - - CPSUIDBG(DBG_TVTESTCB, ("Got SEL_CHANGED CallBack now")); - - switch (DMPubID) - { - case DMPUB_CHKBOX_TYPE: - { - pItem = FindOptItem(pCPSUICBParam->pOptItem, - pCPSUICBParam->cOptItem, - DMPUB_CHKBOX); - - if (pItem) - { - pItem->pOptType->pOptParam[0].Style = (BYTE)pCurItem->Sel; - - pItem->Flags |= OPTIF_CHANGED; - Action = CPSUICB_ACTION_OPTIF_CHANGED; - } - } - break; - - case DMPUB_TVOPT_ICONS: - - pItem = pCurItem - 1; - - if (Sel) { - - pItem->pOptType->Style &= ~OTS_LBCB_NO_ICON16_IN_ITEM; - - } else { - - pItem->pOptType->Style |= OTS_LBCB_NO_ICON16_IN_ITEM; - } - - break; - - case DMPUB_EXT_OVERLAY_WARNING: - - if (Sel) { - - TV_EP.Flags |= EPF_OVERLAY_WARNING_ICON; - TV_ECB.Flags |= ECBF_OVERLAY_WARNING_ICON; - - } else { - - TV_EP.Flags &= ~EPF_OVERLAY_WARNING_ICON; - TV_ECB.Flags &= ~ECBF_OVERLAY_WARNING_ICON; - } - - break; - - case DMPUB_EXT_OVERLAY_STOP: - - if (Sel) { - - TV_EP.Flags |= EPF_OVERLAY_STOP_ICON; - TV_ECB.Flags |= ECBF_OVERLAY_STOP_ICON; - - } else { - - TV_EP.Flags &= ~EPF_OVERLAY_STOP_ICON; - TV_ECB.Flags &= ~ECBF_OVERLAY_STOP_ICON; - } - - break; - - case DMPUB_EXT_OVERLAY_NO: - - if (Sel) { - - TV_EP.Flags |= EPF_OVERLAY_NO_ICON; - TV_ECB.Flags |= ECBF_OVERLAY_NO_ICON; - - } else { - - TV_EP.Flags &= ~EPF_OVERLAY_NO_ICON; - TV_ECB.Flags &= ~ECBF_OVERLAY_NO_ICON; - } - - break; - - case DMPUB_MINRANGE: - - MinMaxRangeOP[1].IconID = (DWORD)Sel; - break; - - case DMPUB_MAXRANGE: - - MinMaxRangeOP[1].lParam = (LONG)Sel; - break; - - case DMPUB_TVOPT_OVERLAY_WARNING: - case DMPUB_TVOPT_OVERLAY_STOP: - case DMPUB_TVOPT_OVERLAY_NO: - - Action = CPSUICB_ACTION_REINIT_ITEMS; - - case DMPUB_TVOPT_ECB_EP: - - if (Sel) { - - pCurItem->Flags &= ~OPTIF_EXT_DISABLED; - - } else { - - pCurItem->Flags |= OPTIF_EXT_DISABLED; - } - - pCurItem->Flags |= OPTIF_CHANGED; - Action = CPSUICB_ACTION_OPTIF_CHANGED; - - // - // Fall through - // - - case DMPUB_TVOPT_DISABLED: - case DMPUB_EXT_DISABLED: - - pItem = FindOptItem(pCPSUICBParam->pOptItem, - pCPSUICBParam->cOptItem, - DMPUB_2STATES); - - if (pItem) { - - do { - - if ((pItem->DMPubID >= DMPUB_2STATES) && - (pItem->DMPubID <= DMPUB_CHKBOX)) { - - switch (DMPubID) { - - case DMPUB_TVOPT_OVERLAY_WARNING: - - if (Sel) { - - pItem->Flags |= OPTIF_OVERLAY_WARNING_ICON; - - } else { - - pItem->Flags &= ~OPTIF_OVERLAY_WARNING_ICON; - } - - break; - - case DMPUB_TVOPT_OVERLAY_STOP: - - if (Sel) { - - pItem->Flags |= OPTIF_OVERLAY_STOP_ICON; - - } else { - - pItem->Flags &= ~OPTIF_OVERLAY_STOP_ICON; - } - - break; - - case DMPUB_TVOPT_OVERLAY_NO: - - if (Sel) { - - pItem->Flags |= OPTIF_OVERLAY_NO_ICON; - - } else { - - pItem->Flags &= ~OPTIF_OVERLAY_NO_ICON; - } - - break; - - case DMPUB_TVOPT_DISABLED: - - if (Sel) { - - pItem->pOptType->Flags |= OPTTF_TYPE_DISABLED; - - } else { - - pItem->pOptType->Flags &= ~OPTTF_TYPE_DISABLED; - } - - break; - - case DMPUB_EXT_DISABLED: - - if (Sel) { - - pItem->Flags |= OPTIF_EXT_DISABLED; - - } else { - - pItem->Flags &= ~OPTIF_EXT_DISABLED; - } - - break; - - case DMPUB_TVOPT_ECB_EP: - - switch (Sel) { - - case 0: - - pItem->Flags |= OPTIF_EXT_HIDE; - break; - - case 1: - - pItem->Flags &= ~(OPTIF_EXT_HIDE | - OPTIF_EXT_IS_EXTPUSH); - pItem->pExtChkBox = &TV_ECB; - - break; - - case 2: - - pItem->Flags &= ~OPTIF_EXT_HIDE; - pItem->Flags |= OPTIF_EXT_IS_EXTPUSH; - pItem->pExtPush = &TV_EP; - break; - } - } - } - - pItem->Flags |= OPTIF_CHANGED; - - } while ((pItem++)->DMPubID != DMPUB_CHKBOX); - } - - break; - - default: - - break; - } - - break; - - case CPSUICB_REASON_PUSHBUTTON: - - CPSUIDBG(DBG_TVTESTCB, ("Got PUSH Button CallBack now")); - break; - - case CPSUICB_REASON_EXTPUSH: - - DialogBoxParam(hInstApp, - MAKEINTRESOURCE(EXTPUSH_DLG), - pCPSUICBParam->hDlg, - PushButtonProc, - (LPARAM)(pCPSUICBParam->pOldSel)); - break; - - default: - - break; - } - - return(Action); -} - - - -BOOL -SetupComPropSheetUI( - _In_ PCOMPROPSHEETUI pCPSUI - ) -{ - static BOOL UpdateEditBox = TRUE; - UINT i; - - - ZeroMemory(pCPSUI, sizeof(COMPROPSHEETUI)); - - pCPSUI->cbSize = sizeof(COMPROPSHEETUI); - pCPSUI->hInstCaller = hInstApp; - pCPSUI->pCallerName = (LPTSTR)TitleName; - pCPSUI->CallerVersion = 0x100; - pCPSUI->pOptItemName = (LPTSTR)OptItemName; - pCPSUI->OptItemVersion = 0x400; - pCPSUI->UserData = (ULONG_PTR)pCPSUI; - pCPSUI->pHelpFile = (LPTSTR)TEXT("CPSUISam.hlp"); - pCPSUI->pfnCallBack = TVTestCallBack; - pCPSUI->pOptItem = TVTestOptItems; - pCPSUI->cOptItem = COUNT_ARRAY(TVTestOptItems); - pCPSUI->Flags = 0; - pCPSUI->pDlgPage = CPSUI_PDLGPAGE_TREEVIWONLY; - pCPSUI->cDlgPage = 0; - - - if (UpdateEditBox) { - - // - // Fixup compiler warning for the LPSTR and LONG - // - - for (i = 0; i < COUNT_ARRAY(TVTestOptItems); i++) { - - if (TVTestOptItems[i].DMPubID == DMPUB_EDITBOX) { - - TVTestOptItems[i].pSel = (LPTSTR)TVOTEditBoxBuf; - UpdateEditBox = FALSE; - break; - } - } - } - - if (UpdatePermission) { - - pCPSUI->Flags |= CPSUIF_UPDATE_PERMISSION; - } - - if (!UseStdAbout) { - - pCPSUI->Flags |= CPSUIF_ABOUT_CALLBACK; - } - - return(TRUE); -} diff --git a/print/cpsuisam/CPSUIDAT.H b/print/cpsuisam/CPSUIDAT.H deleted file mode 100644 index 7043d9c2..00000000 --- a/print/cpsuisam/CPSUIDAT.H +++ /dev/null @@ -1,73 +0,0 @@ -/*++ - -Copyright (c) 1990-2003 Microsoft Corporation -All Rights Reserved - - -Module Name: - - cpsuidat.h - - -Abstract: - - This module - - -[Environment:] - - Windows 2000, Windows XP, Windows Server 2003 - Common Printer Driver UI DLL - - ---*/ - - -#define COUNT_ARRAY(a) (sizeof(a) / sizeof((a)[0])) - - -#define OPTIF_NONE 0 - -#define LEVEL_0 0 -#define LEVEL_1 1 -#define LEVEL_2 2 -#define LEVEL_3 3 -#define LEVEL_4 4 - - -#define DMPUB_TVTEST (DMPUB_USER + 1) -#define DMPUB_TVOPT (DMPUB_USER + 2) -#define DMPUB_TVOPT_ECB_EP (DMPUB_USER + 3) -#define DMPUB_TVOPT_ICONS (DMPUB_USER + 4) -#define DMPUB_TVOPT_DISABLED (DMPUB_USER + 5) -#define DMPUB_TVOPT_TEST (DMPUB_USER + 6) -#define DMPUB_2STATES (DMPUB_USER + 7) -#define DMPUB_3STATES (DMPUB_USER + 8) -#define DMPUB_UDARROW (DMPUB_USER + 9) -#define DMPUB_TRACKBAR (DMPUB_USER + 10) -#define DMPUB_SCROLLBAR (DMPUB_USER + 11) -#define DMPUB_LISTBOX (DMPUB_USER + 12) -#define DMPUB_COMBOBOX (DMPUB_USER + 13) -#define DMPUB_EDITBOX (DMPUB_USER + 14) -#define DMPUB_PUSHBUTTON (DMPUB_USER + 15) -#define DMPUB_CHKBOX (DMPUB_USER + 16) -#define DMPUB_CHKBOX_TYPE (DMPUB_USER + 17) -#define DMPUB_TVOPT_OVERLAY_WARNING (DMPUB_USER + 18) -#define DMPUB_TVOPT_OVERLAY_STOP (DMPUB_USER + 19) -#define DMPUB_TVOPT_OVERLAY_NO (DMPUB_USER + 20) -#define DMPUB_EXT_OVERLAY_WARNING (DMPUB_USER + 21) -#define DMPUB_EXT_OVERLAY_STOP (DMPUB_USER + 22) -#define DMPUB_EXT_OVERLAY_NO (DMPUB_USER + 23) -#define DMPUB_EXT_DISABLED (DMPUB_USER + 24) -#define DMPUB_MINRANGE (DMPUB_USER + 25) -#define DMPUB_MAXRANGE (DMPUB_USER + 26) - -#define MAX_INT 0x00007fff -#define MIN_INT 0xFFFF8000 - - - -BOOL -SetupComPropSheetUI -( - _In_ PCOMPROPSHEETUI pCPSUI -); diff --git a/print/cpsuisam/CPSUISAM.DEF b/print/cpsuisam/CPSUISAM.DEF deleted file mode 100644 index f254e960..00000000 --- a/print/cpsuisam/CPSUISAM.DEF +++ /dev/null @@ -1,6 +0,0 @@ -; module-definition file for SurPtrUI -- used by LINK.EXE - -NAME CPSUI ; application's module name - -DESCRIPTION 'Microsoft Windows 2000/Windows XP/Windows Server 2003 Common Property Sheet UI Sample Program' - diff --git a/print/cpsuisam/CPSUISAM.DLG b/print/cpsuisam/CPSUISAM.DLG deleted file mode 100644 index 29112c5d..00000000 --- a/print/cpsuisam/CPSUISAM.DLG +++ /dev/null @@ -1,35 +0,0 @@ -1 DLGINCLUDE "cpsuisam.h" - -PUSHBUTTON_DLG DIALOGEX 9, 18, 160, 100 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Push Button Dialog" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "The TVOT_PUSHBUTTON's Button is Pushed. Press OK to Continue...", - -1, 10, 21, 141, 37 - DEFPUSHBUTTON "OK", IDOK, 88, 78, 63, 14 -END - -DLGABOUT DIALOGEX 5, 15, 200, 90 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "About" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "About 1 Text", IDD_ABOUT1, 38, 12, 152, 20 - LTEXT "About 2 Text", IDD_ABOUT2, 38, 36, 152, 24 - DEFPUSHBUTTON "OK", IDOK, 126, 68, 59, 14 - ICON IDI_APPLE, IDD_ABOUTICON, 8, 20, 18, 20 -END - -EXTPUSH_DLG DIALOGEX 6, 18, 214, 78 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Extended Push Button DIALOG BOX" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "You just push the 'Extended Push Test' push button. To Continue press OK button...", - -1, 12, 10, 187, 30 - DEFPUSHBUTTON "OK", IDOK, 129, 54, 69, 14 -END diff --git a/print/cpsuisam/CPSUISAM.H b/print/cpsuisam/CPSUISAM.H deleted file mode 100644 index bcddc730..00000000 --- a/print/cpsuisam/CPSUISAM.H +++ /dev/null @@ -1,37 +0,0 @@ -/*++ - -Copyright (c) 1990-2003 Microsoft Corporation -All Rights Reserved - - -Module Name: - - cpsuisam.h - - -Abstract: - - This module is the header file for the sample - - -[Environment:] - - ---*/ - - -#define IDM_PERMISSION 10 -#define IDM_USESTDABOUT 20 -#define IDM_DOCPROP 30 -#define IDM_TVTEST 40 -#define IDM_DOCPROP_TVTEST 50 - -#define IDI_CPSUISAMPLE 500 -#define IDI_APPLE 510 - -#define PUSHBUTTON_DLG 1000 -#define DLGABOUT 1010 -#define EXTPUSH_DLG 1020 -#define IDD_ABOUT1 201 -#define IDD_ABOUT2 202 -#define IDD_ABOUTICON 203 diff --git a/print/cpsuisam/DEBUG.C b/print/cpsuisam/DEBUG.C deleted file mode 100644 index 48853686..00000000 --- a/print/cpsuisam/DEBUG.C +++ /dev/null @@ -1,114 +0,0 @@ -/*++ - -Copyright (c) 1990-2003 Microsoft Corporation -All Rights Reserved - -Module Name: - - debug.c - -Abstract: - - This module contains all debugging routines - -[Environment:] - - NT Windows - Common Printer Driver UI DLL. - -[Notes:] - -Revision History: - ---*/ - -#include "precomp.h" -#pragma hdrstop - -#if DBG - -BOOL DoCPSUIWarn = TRUE; - -VOID -cdecl -CPSUIDbgPrint -( - LPCSTR pszFormat, - ... -) -/*++ - -Routine Description: - - This fucntion output the debug informat to the debugger - -Arguments: - - pszFormat - format string - - ... - variable data - -Return Value: - - VOID - ---*/ -{ - va_list vaList; - static TCHAR OutBuf[768]; -#ifdef UNICODE - static WCHAR FormatBuf[256]; -#endif - // - // We assume that UNICODE flag is turn on for the compilation, bug the - // format string passed to here is ASCII version, so we need to convert - // it to LPWSTR before the wvsprintf() - // - - va_start(vaList, pszFormat); - -#ifdef UNICODE - MultiByteToWideChar(CP_ACP, 0, pszFormat, -1, FormatBuf, COUNT_ARRAY(FormatBuf)); - StringCchVPrintf(OutBuf, COUNT_ARRAY(OutBuf), FormatBuf, vaList); -#else - StringCchVPrintf(OutBuf, COUNT_ARRAY(OutBuf), pszFormat, vaList); -#endif - va_end(vaList); - - OutputDebugString((LPTSTR)OutBuf); - OutputDebugString(TEXT("\n")); -} - -VOID -CPSUIDbgType -( - INT Type -) -/*++ - -Routine Description: - - this function output the ERROR/WARNING message - -Arguments: - - Type - -Return Value: - ---*/ -{ - static TCHAR DebugDLLName[] = TEXT("SurPtrUI"); - - if (Type < 0) - { - OutputDebugString(TEXT("ERROR) ")); - } - else if (Type > 0) - { - OutputDebugString(TEXT("WARNING: ")); - } - OutputDebugString(DebugDLLName); - OutputDebugString(TEXT("!")); -} - -#endif // DBG diff --git a/print/cpsuisam/DEBUG.H b/print/cpsuisam/DEBUG.H deleted file mode 100644 index 5d6b88a3..00000000 --- a/print/cpsuisam/DEBUG.H +++ /dev/null @@ -1,66 +0,0 @@ -/*++ - -Copyright (c) 1990-2003 Microsoft Corporation -All Rights Reserved - - -Module Name: - - debug.h - - -Abstract: - - This module contains all debugger definitions - - -[Environment:] - - NT Windows - Common Printer Driver UI DLL. - - ---*/ - - -#if DBG - -VOID -cdecl -CPSUIDbgPrint -( - LPCSTR pszFormat, - ... -); - -VOID -CPSUIDbgType -( - INT Type -); - -extern BOOL DoCPSUIWarn; - -#define DBGP(x) (CPSUIDbgPrint x) - -#define DEFINE_DBGVAR(x) DWORD DBG_CPSUIFILENAME=(x) - -#define CPSUIDBG(x,y) if((x)&DBG_CPSUIFILENAME){CPSUIDbgType(0);DBGP(y);} - -#define CPSUIDBGBLK(x) x; -#define CPSUIWARN(x) if(DoCPSUIWarn) { CPSUIDbgType(1);DBGP(x); } -#define CPSUIERR(x) CPSUIDbgType(-1);DBGP(x) -#define CPSUIRIP(x) CPSUIERR(x); DebugBreak() -#define CPSUIASSERT(b,x,e,i) \ - if (!(e)) { _CPSUIAssert(x,#e,__FILE__,(UINT)__LINE__,(DWORD)i,b); } - -#else // DBG - -#define CPSUIDBGBLK(x) -#define DEFINE_DBGVAR(x) -#define CPSUIDBG(x,y) -#define CPSUIWARN(x) -#define CPSUIERR(x) -#define CPSUIRIP(x) -#define CPSUIASSERT(b,x,e,i) - -#endif // DBG diff --git a/print/cpsuisam/PRECOMP.H b/print/cpsuisam/PRECOMP.H deleted file mode 100644 index 4e63995b..00000000 --- a/print/cpsuisam/PRECOMP.H +++ /dev/null @@ -1,17 +0,0 @@ -// -// Copyright (c) 1990-2003 Microsoft Corporation -// All Rights Reserved -// - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "debug.h" -#include "cpsuisam.h" -#include "cpsuidat.h" diff --git a/print/cpsuisam/README.md b/print/cpsuisam/README.md deleted file mode 100644 index f43a5020..00000000 --- a/print/cpsuisam/README.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -page_type: sample -description: "The CPSUISAM application causes the CPSUI to call the print spooler to create property sheet pages for the default printer." -languages: -- cpp -products: -- windows -- windows-wdk ---- - -# Common Property Sheet UI Sample - -The CPSUISAM application causes the Common Property Sheet User Interface (CPSUI) to call the Windows print spooler to create property sheet pages for the system's default printer. - -Printer interface DLLs must not perform this action and this sample shows how create property sheet pages for a printer. - -The application then creates an additional property sheet page to illustrate some of the techniques that you can use when you are using CPSUI to create a new page. - -CPSUI is a user-mode DLL that enables you to create property sheet pages that have a standard appearance. - -CPSUIAM causes CPSUI to call the Windows print spooler to create property sheet pages for the system's default printer. The application then creates an additional property sheet page to illustrate some of the techniques that you can use when you are using CPSUI to create a new page. For more information, see [Common Property Sheet User Interface](https://docs.microsoft.com/windows-hardware/drivers/print/common-property-sheet-user-interface). diff --git a/print/cpsuisam/cpsuisam.c b/print/cpsuisam/cpsuisam.c deleted file mode 100644 index d63b5844..00000000 --- a/print/cpsuisam/cpsuisam.c +++ /dev/null @@ -1,665 +0,0 @@ -/*++ - -Copyright (c) 1990-2003 Microsoft Corporation -All Rights Reserved - - -Module Name: - - cpsuisam.c - - -Abstract: - - This module contrains sample prototype for the - Windows 2000/Windows XP/Windows Server 2003 common Property - Sheet user interface - ---*/ - -#include "precomp.h" -#pragma hdrstop - -#define DBG_CPSUIFILENAME DbgCPSUISam - - - -#define DBG_WINMAINPROC 0x00000001 - -DEFINE_DBGVAR(0); - - - -#define HAS_TVTEST_PAGES 0x01 -#define HAS_DOCPROP_PAGES 0x02 - - - -extern HINSTANCE hInstApp; -extern TCHAR TitleName[]; -extern TCHAR ClassName[]; -extern TCHAR MenuName[]; -extern TCHAR szWinSpool[]; -extern CHAR szDocPropSheets[]; -extern BOOL UpdatePermission; -extern BOOL UseStdAbout; - - -HWND hWndApp = NULL; - - -typedef struct _CPSUISAMPLE -{ - HANDLE hParent; - HANDLE hCPSUI; - HANDLE hDocProp; - PFNCOMPROPSHEET pfnCPS; - COMPROPSHEETUI CPSUI; - DOCUMENTPROPERTYHEADER DPHdr; - HGLOBAL hDevMode; - HGLOBAL hDevNames; -} CPSUISAMPLE, *PCPSUISAMPLE; - -BOOL -GetDefPrinter -( - PCPSUISAMPLE pCPSUISample -) -{ - HGLOBAL hDevMode = NULL; - HGLOBAL hDevNames = NULL; - LPTSTR pszPrinterName = NULL; - DEVMODE *pDM = NULL; - DEVNAMES *pDN = NULL; - HANDLE hPrinter = NULL; - PAGESETUPDLG PSD = {0}; - BOOL Ok = FALSE; - - PSD.lStructSize = sizeof(PSD); - PSD.Flags = PSD_RETURNDEFAULT; - - if (PageSetupDlg(&PSD)) - { - hDevMode = PSD.hDevMode; - - if (NULL != hDevMode) - { - pDM = (DEVMODE *)GlobalLock(hDevMode); - if (NULL != pDM) - { - hDevNames = PSD.hDevNames; - if (hDevNames) - { - pDN = (DEVNAMES *)GlobalLock(hDevNames); - if (NULL != pDN) - { - pszPrinterName = (LPTSTR)pDN + pDN->wDeviceOffset; - if (pszPrinterName != NULL) - { - if (OpenPrinter(pszPrinterName, &hPrinter, NULL)) - { - Ok = TRUE; - } - } - } - } - } - } - - if (Ok) - { - HGLOBAL h = pCPSUISample->hDevMode; - - if (NULL != h) - { - GlobalUnlock(h); - GlobalFree(h); - } - - h = pCPSUISample->hDevNames; - - if (NULL != h) - { - GlobalUnlock(h); - GlobalFree(h); - } - - if (pCPSUISample->DPHdr.hPrinter) - { - ClosePrinter(pCPSUISample->DPHdr.hPrinter); - } - - pCPSUISample->hDevMode = PSD.hDevMode; - pCPSUISample->hDevNames = PSD.hDevNames; - - pCPSUISample->DPHdr.cbSize = sizeof(DOCUMENTPROPERTYHEADER); - pCPSUISample->DPHdr.hPrinter = hPrinter; - pCPSUISample->DPHdr.pszPrinterName = pszPrinterName; - pCPSUISample->DPHdr.pdmIn = - pCPSUISample->DPHdr.pdmOut = pDM; - pCPSUISample->DPHdr.fMode = (DM_IN_BUFFER | DM_IN_PROMPT | DM_OUT_BUFFER); - - if (!UpdatePermission) - { - pCPSUISample->DPHdr.fMode |= DM_NOPERMISSION; - } - } - else - { - hDevMode = PSD.hDevMode; - hDevNames = PSD.hDevNames; - - if (NULL != hDevMode) - { - GlobalUnlock(hDevMode); - GlobalFree(hDevMode); - } - - if (NULL != hDevNames) - { - GlobalUnlock(hDevNames); - GlobalFree(hDevNames); - } - - if (hPrinter) - { - ClosePrinter(hPrinter); - } - } - } - - return Ok; -} - - -LONG -CALLBACK -CPSUIFunc -( - _In_ PPROPSHEETUI_INFO pPSUIInfo, - LPARAM lParam -) -{ - PPROPSHEETUI_INFO_HEADER pPSUIInfoHdr; - PCPSUISAMPLE pCPSUISample; - HANDLE h; - INSERTPSUIPAGE_INFO InsPI; - - if (!pPSUIInfo) - { - return FALSE; - } - - switch (pPSUIInfo->Reason) - { - case PROPSHEETUI_REASON_INIT: - - pCPSUISample = (PCPSUISAMPLE)LocalAlloc(LPTR, sizeof(CPSUISAMPLE)); - if (NULL == pCPSUISample) - { - return(-1); - } - - pPSUIInfo->UserData = (ULONG_PTR)pCPSUISample; - pCPSUISample->hParent = pPSUIInfo->hComPropSheet; - pCPSUISample->pfnCPS = pPSUIInfo->pfnComPropSheet; - - // - // Add Document Property Sheet for current default Printer - // - - switch (pPSUIInfo->lParamInit) - { - case IDM_DOCPROP: - case IDM_DOCPROP_TVTEST: - - if (GetDefPrinter(pCPSUISample)) - { - InsPI.cbSize = sizeof(INSERTPSUIPAGE_INFO); - InsPI.Type = PSUIPAGEINSERT_DLL; - InsPI.Mode = INSPSUIPAGE_MODE_FIRST_CHILD; - InsPI.dwData1 = (ULONG_PTR)szWinSpool; - InsPI.dwData2 = (ULONG_PTR)szDocPropSheets; - InsPI.dwData3 = (ULONG_PTR)&(pCPSUISample->DPHdr); - - pCPSUISample->hDocProp = - (HANDLE)pCPSUISample->pfnCPS( pCPSUISample->hParent, - CPSFUNC_INSERT_PSUIPAGE, - (LPARAM)0, - (LPARAM)&InsPI - ); - } - break; - } - - // - // Add TreeView Page - // - - switch (pPSUIInfo->lParamInit) - { - case IDM_TVTEST: - case IDM_DOCPROP_TVTEST: - - if (SetupComPropSheetUI(&(pCPSUISample->CPSUI))) - { - InsPI.cbSize = sizeof(INSERTPSUIPAGE_INFO); - InsPI.Type = PSUIPAGEINSERT_PCOMPROPSHEETUI; - InsPI.Mode = INSPSUIPAGE_MODE_FIRST_CHILD; - InsPI.dwData1 = (ULONG_PTR)&(pCPSUISample->CPSUI); - InsPI.dwData2 = - InsPI.dwData3 = 0; - - pCPSUISample->hCPSUI = - (HANDLE)pCPSUISample->pfnCPS( pCPSUISample->hParent, - CPSFUNC_INSERT_PSUIPAGE, - (LPARAM)0, - (LPARAM)&InsPI - ); - } - break; - } - - if ( (pCPSUISample->hCPSUI) - || (pCPSUISample->hDocProp) - ) - { - return 1; - } - - break; - - case PROPSHEETUI_REASON_GET_INFO_HEADER: - - pPSUIInfoHdr = (PPROPSHEETUI_INFO_HEADER)lParam; - if (NULL != pPSUIInfoHdr) - { - pPSUIInfoHdr->pTitle = (LPTSTR)TitleName; - - switch (pPSUIInfo->lParamInit) - { - case IDM_DOCPROP: - - pPSUIInfoHdr->IconID = IDI_CPSUI_PRINTER2; - break; - - case IDM_TVTEST: - - pPSUIInfoHdr->IconID = IDI_CPSUI_OPTION2; - break; - - case IDM_DOCPROP_TVTEST: - - pPSUIInfoHdr->IconID = IDI_CPSUI_RUN_DIALOG; - break; - } - - pPSUIInfoHdr->Flags = PSUIHDRF_PROPTITLE | PSUIHDRF_NOAPPLYNOW; - pPSUIInfoHdr->hWndParent = hWndApp; - pPSUIInfoHdr->hInst = hInstApp; - - return 1; - } - - break; - - case PROPSHEETUI_REASON_SET_RESULT: - - pCPSUISample = (PCPSUISAMPLE)pPSUIInfo->UserData; - if ( (NULL != pCPSUISample) - && (pCPSUISample->hCPSUI == ((PSETRESULT_INFO)lParam)->hSetResult) - ) - { - // - // Save the result and propagate to its owner - // - pPSUIInfo->Result = ((PSETRESULT_INFO)lParam)->Result; - return 1; - } - - break; - - case PROPSHEETUI_REASON_DESTROY: - - pCPSUISample = (PCPSUISAMPLE)pPSUIInfo->UserData; - if (NULL != pCPSUISample) - { - h = pCPSUISample->hDevMode; - if (NULL != h) - { - GlobalUnlock(h); - GlobalFree(h); - } - - h = pCPSUISample->hDevNames; - if (NULL != h) - { - GlobalUnlock(h); - GlobalFree(h); - } - - if (pCPSUISample->DPHdr.hPrinter) - { - ClosePrinter(pCPSUISample->DPHdr.hPrinter); - } - - LocalFree((HLOCAL)pCPSUISample); - pPSUIInfo->UserData = 0; - } - return 1; - } - return -1; -} - -LRESULT -CALLBACK -MainWndProc -( - HWND hWnd, - UINT Msg, - WPARAM wParam, - LPARAM lParam -) -/*++ - -Routine Description: - - This is the main window procedure to the testing program - - -Arguments: - - See SDK - - -Return Value: - - See SDK - ---*/ -{ - DWORD Result; - LONG Ret; - - switch (Msg) - { - case WM_INITMENUPOPUP: - - if (!HIWORD(lParam)) - { - CheckMenuItem( (HMENU)UIntToPtr((UINT)wParam), - IDM_PERMISSION, - MF_BYCOMMAND | ((UpdatePermission) ? MF_CHECKED : MF_UNCHECKED) - ); - - CheckMenuItem( (HMENU)UIntToPtr((UINT)wParam), - IDM_USESTDABOUT, - MF_BYCOMMAND | ((UseStdAbout) ? MF_CHECKED : MF_UNCHECKED) - ); - } - break; - - case WM_COMMAND: - - switch (wParam) - { - case IDM_USESTDABOUT: - - UseStdAbout = !UseStdAbout; - break; - - case IDM_PERMISSION: - - UpdatePermission = !UpdatePermission; - break; - - case IDM_DOCPROP: - case IDM_TVTEST: - case IDM_DOCPROP_TVTEST: - - Ret = CommonPropertySheetUI( hWnd, - (PFNPROPSHEETUI)CPSUIFunc, - (LPARAM)LOWORD(wParam), - &Result - ); - - CPSUIDBG( DBG_WINMAINPROC, - ("CommonPropertySheetUI()=%ld, Result=%ld", Ret, Result) - ); - - break; - - default: - - break; - } - break; - - case WM_DESTROY: - - PostQuitMessage(0); - break; - - default: - - return (DefWindowProc(hWnd, Msg, wParam, lParam)); - } - - return 0L; -} - -BOOL -InitInstance -( - HANDLE hInstance, - INT nCmdShow -) -/*++ - -Routine Description: - - Saves instance handle and creates main window - - This function is called at initialization time for every instance of - this application. This function performs initialization tasks that - cannot be shared by multiple instances. - - In this case, we save the instance handle in a static variable and - create and display the main program window. - - -Arguments: - - hInstance - Current instance identifier - - nComShow - Param for first ShowWindow() call. - - - -Return Value: - - TRUE/FALSE - - ---*/ -{ - // - // Save the instance handle in static variable, which will be used in - // many subsequence calls from this application to Windows. - // - - hInstApp = hInstance; - - // - // Create a main window for this application instance. - // - - hWndApp = CreateWindow( ClassName, - TitleName, - WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - NULL, - NULL, - hInstance, - NULL - ); - if (NULL != hWndApp) - { - // - // Make the window visible; update its client area; - // and send WM_PAINT message - // - - ShowWindow(hWndApp, nCmdShow); - UpdateWindow(hWndApp); - } - - return ((hWndApp) ? TRUE : FALSE); -} - - -BOOL -InitApplication -( - HANDLE hInstance -) -/*++ - -Routine Description: - - Initializes window data and registers window class - - This function is called at initialization time only if no other - instances of the application are running. This function performs - initialization tasks that can be done once for any number of running - instances. - - In this case, we initialize a window class by filling out a data - structure of type WNDCLASS and calling the Windows RegisterClass() - function. Since all instances of this application use the same window - class, we only need to do this when the first instance is initialized. - - -Arguments: - - hInstance - current instance - - -Return Value: - - BOOLEAN - ---*/ -{ - WNDCLASS wc; - - // - // Fill in window class structure with parameters that describe the - // main window. - // - - wc.style = 0L; - wc.lpfnWndProc = MainWndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_CPSUISAMPLE); - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = GetStockObject(WHITE_BRUSH); - wc.lpszMenuName = MenuName; - wc.lpszClassName = ClassName; - - // - // Register the window class and return success/failure code. - // - return RegisterClass(&wc); -} - - -INT -APIENTRY -WinMain -( - _In_ HINSTANCE hInstance, - _In_opt_ HINSTANCE hPrevInstance, - _In_ LPSTR lpCmdLine, - _In_ INT nCmdShow -) -/*++ - -Routine Description: - - calls initialization function, processes message loop - - Windows recognizes this function by name as the initial entry point - for the program. This function calls the application initialization - routine, if no other instance of the program is running, and always - calls the instance initialization routine. It then executes a message - retrieval and dispatch loop that is the top-level control structure - for the remainder of execution. The loop is terminated when a WM_QUIT - message is received, at which time this function exits the application - instance by returning the value passed by PostQuitMessage(). - - If this function must abort before entering the message loop, it - returns the conventional value NULL. - - -Arguments: - - - -Return Value: - - Integer - - ---*/ -{ - MSG Msg; - - UNREFERENCED_PARAMETER(lpCmdLine); - - // - // Other instances of app running? - // - - if (!hPrevInstance) - { - if (!InitApplication(hInstance)) - { - // - // Initialize shared things, Exits if unable to initialize - // - return FALSE; - } - } - - // - // Perform initializations that apply to a specific instance - // - if (!InitInstance(hInstance, nCmdShow)) - { - return FALSE; - } - - // - // Acquire and dispatch messages until a WM_QUIT message is received. - // - while (GetMessage(&Msg, NULL, 0L, 0L)) - { - // - // Translates virtual key codes and Dispatches message to window - // - TranslateMessage(&Msg); - DispatchMessage(&Msg); - } - - // - // Returns the value from PostQuitMessage - // - return((INT)Msg.wParam); -} - diff --git a/print/cpsuisam/cpsuisam.sln b/print/cpsuisam/cpsuisam.sln deleted file mode 100644 index 252f1c33..00000000 --- a/print/cpsuisam/cpsuisam.sln +++ /dev/null @@ -1,34 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26430.16 -MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpsuisam", "cpsuisam.vcxproj", "{96055373-96CC-491C-916C-0BC49C225094}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM64 = Debug|ARM64 - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|ARM64 = Release|ARM64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {96055373-96CC-491C-916C-0BC49C225094}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {96055373-96CC-491C-916C-0BC49C225094}.Debug|ARM64.Build.0 = Debug|ARM64 - {96055373-96CC-491C-916C-0BC49C225094}.Debug|Win32.ActiveCfg = Debug|Win32 - {96055373-96CC-491C-916C-0BC49C225094}.Debug|Win32.Build.0 = Debug|Win32 - {96055373-96CC-491C-916C-0BC49C225094}.Debug|x64.ActiveCfg = Debug|x64 - {96055373-96CC-491C-916C-0BC49C225094}.Debug|x64.Build.0 = Debug|x64 - {96055373-96CC-491C-916C-0BC49C225094}.Release|ARM64.ActiveCfg = Release|ARM64 - {96055373-96CC-491C-916C-0BC49C225094}.Release|ARM64.Build.0 = Release|ARM64 - {96055373-96CC-491C-916C-0BC49C225094}.Release|Win32.ActiveCfg = Release|Win32 - {96055373-96CC-491C-916C-0BC49C225094}.Release|Win32.Build.0 = Release|Win32 - {96055373-96CC-491C-916C-0BC49C225094}.Release|x64.ActiveCfg = Release|x64 - {96055373-96CC-491C-916C-0BC49C225094}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/print/cpsuisam/cpsuisam.vcxproj b/print/cpsuisam/cpsuisam.vcxproj deleted file mode 100644 index 8315bee6..00000000 --- a/print/cpsuisam/cpsuisam.vcxproj +++ /dev/null @@ -1,352 +0,0 @@ - - - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {96055373-96CC-491C-916C-0BC49C225094} - $(MSBuildProjectName) - Debug - Win32 - {2AE5A388-1218-47C7-9334-DCB816C78A26} - - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - Application - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - Application - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - Application - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - Application - - - Windows10 - False - Desktop - - WindowsApplicationForDrivers10.0 - Application - - - Windows10 - True - Desktop - - WindowsApplicationForDrivers10.0 - Application - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - cpsuisam - - - cpsuisam - - - cpsuisam - - - cpsuisam - - - cpsuisam - - - cpsuisam - - - - %(AdditionalDependencies);comdlg32.lib;winspool.lib;comctl32.lib;shlwapi.lib;compstui.lib - - - %(AdditionalIncludeDirectories);. - - - %(AdditionalIncludeDirectories);. - - - %(AdditionalIncludeDirectories);. - - - - - %(AdditionalDependencies);comdlg32.lib;winspool.lib;comctl32.lib;shlwapi.lib;compstui.lib - - - %(AdditionalIncludeDirectories);. - - - %(AdditionalIncludeDirectories);. - - - %(AdditionalIncludeDirectories);. - - - - - %(AdditionalDependencies);comdlg32.lib;winspool.lib;comctl32.lib;shlwapi.lib;compstui.lib - - - %(AdditionalIncludeDirectories);. - - - %(AdditionalIncludeDirectories);. - - - %(AdditionalIncludeDirectories);. - - - - - %(AdditionalDependencies);comdlg32.lib;winspool.lib;comctl32.lib;shlwapi.lib;compstui.lib - - - %(AdditionalIncludeDirectories);. - - - %(AdditionalIncludeDirectories);. - - - %(AdditionalIncludeDirectories);. - - - - - %(AdditionalDependencies);comdlg32.lib;winspool.lib;comctl32.lib;shlwapi.lib;compstui.lib - - - %(AdditionalIncludeDirectories);. - - - %(AdditionalIncludeDirectories);. - - - %(AdditionalIncludeDirectories);. - - - - - %(AdditionalDependencies);comdlg32.lib;winspool.lib;comctl32.lib;shlwapi.lib;compstui.lib - - - %(AdditionalIncludeDirectories);. - - - %(AdditionalIncludeDirectories);. - - - %(AdditionalIncludeDirectories);. - - - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - %(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Use - $(IntDir)\precomp.h.pch - - - ;%(AdditionalIncludeDirectories) - precomp.h - Create - $(IntDir)\precomp.h.pch - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/cpsuisam/cpsuisam.vcxproj.Filters b/print/cpsuisam/cpsuisam.vcxproj.Filters deleted file mode 100644 index d51cba0d..00000000 --- a/print/cpsuisam/cpsuisam.vcxproj.Filters +++ /dev/null @@ -1,70 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {52F472A8-2EE4-424B-9AFD-A0F409B178F1} - - - h;hpp;hxx;hm;inl;inc;xsd - {9E6BB288-E0CD-460B-A75D-5C898E94AE2F} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {2059241C-22E9-454A-81F8-B21673B3877D} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - - - Header Files - - - - - - Header Files - - - - - - Header Files - - - - - - Header Files - - - - - - - - Resource Files - - - Source Files - - - \ No newline at end of file diff --git a/print/cpsuisam/icons/apple.ico b/print/cpsuisam/icons/apple.ico deleted file mode 100644 index dd2f44f0..00000000 Binary files a/print/cpsuisam/icons/apple.ico and /dev/null differ diff --git a/print/cpsuisam/icons/cpsuisam.ico b/print/cpsuisam/icons/cpsuisam.ico deleted file mode 100644 index 33df6ef4..00000000 Binary files a/print/cpsuisam/icons/cpsuisam.ico and /dev/null differ diff --git a/print/cpsuisam/precompsrc.c b/print/cpsuisam/precompsrc.c deleted file mode 100644 index 5944cf51..00000000 --- a/print/cpsuisam/precompsrc.c +++ /dev/null @@ -1 +0,0 @@ -#include "precomp.h" \ No newline at end of file diff --git a/print/cpsuisam/res.rc b/print/cpsuisam/res.rc deleted file mode 100644 index f1e52605..00000000 --- a/print/cpsuisam/res.rc +++ /dev/null @@ -1,51 +0,0 @@ -// -// Copyright (c) 1990-2003 Microsoft Corporation -// All Rights Reserved -// - - -#include "windows.h" -#include "compstui.h" -#include "cpsuisam.h" - - - - -IDI_APPLE ICON PRELOAD icons\Apple.ico -IDI_CPSUISAMPLE ICON PRELOAD icons\cpsuisam.ico - - - -CPSUISampleMenu MENU -BEGIN - POPUP "&Test Options" - BEGIN - MENUITEM "&Default Printer Properties", IDM_DOCPROP - MENUITEM "CPSUI &TreeView Test", IDM_TVTEST - - MENUITEM SEPARATOR - - MENUITEM "&CPSUI Test All", IDM_DOCPROP_TVTEST - - MENUITEM SEPARATOR - - MENUITEM "&Permission", IDM_PERMISSION - MENUITEM "&Use Standard About" IDM_USESTDABOUT - - - END -END - - -#include "cpsuisam.dlg" - - -#include - -#define VER_FILETYPE VFT_APP -#define VER_FILESUBTYPE VFT2_UNKNOWN -#define VER_FILEDESCRIPTION_STR "Common Property Sheet UI Sample Applet" -#define VER_INTERNALNAME_STR "cpsuisam.exe" -#define VER_ORIGINALFILENAME_STR "cpsuisam.exe" - -#include "common.ver" diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml deleted file mode 100644 index f97fc473..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml +++ /dev/null @@ -1,7 +0,0 @@ - - diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml.cs deleted file mode 100644 index d37585c4..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml.cs +++ /dev/null @@ -1,146 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// -// Abstract: -// -// This file contains the entry point to the application. - -using System; -using System.Windows; -using System.Runtime; - -using Microsoft.Samples.Printing.PrinterExtension.Types; -using Microsoft.Samples.Printing.PrinterExtension.Helpers; - -using System.Windows.Interop; - -namespace Microsoft.Samples.Printing.PrinterExtension -{ - /// - /// Interaction logic for App.xaml. - /// - public partial class App : Application - { - /// - /// This is the event handler invoked on various driver events. - /// - /// - /// - private static void OnDriverEvent(object sender, PrinterExtensionEventArgs eventArgs) - { - // - // Display the print preferences window. - // - - if (eventArgs.ReasonId.Equals(PrinterExtensionReason.PrintPreferences)) - { - PrintPreferenceWindow printPreferenceWindow = new PrintPreferenceWindow(); - printPreferenceWindow.Initialize(eventArgs); - - // - // Set the caller application's window as parent/owner of the newly created printing preferences window. - // - - WindowInteropHelper wih = new WindowInteropHelper(printPreferenceWindow); - wih.Owner = eventArgs.WindowParent; - - // - // Display a modal/non-modal window based on the 'WindowModal' parameter. - // - - if (eventArgs.WindowModal) - { - printPreferenceWindow.ShowDialog(); - } - else - { - printPreferenceWindow.Show(); - - // Flash the window to draw the user's attention. This is required - // because the printer extension may be drawn behind the parent window. - // The return value of FlashWindow can be safely ignored if there is no need - // to know if the window has focus or not. - WindowHelper.FlashWindow(wih.Handle); - } - } - else if (eventArgs.ReasonId.Equals(PrinterExtensionReason.DriverEvent)) - { - // - // Handle driver events here. - // - } - } - - /// - /// Perform initialization tasks for the printer extension in this event handler. - /// - /// - /// - private void Application_Startup(object sender, StartupEventArgs e) - { - // - // It is recommended that exactly one instance of the PrinterExtensionManager be created per instance of - // the printer extension. - // - - if (manager != null) - { - return; - } - manager = new PrinterExtensionManager(); - - // - // Enable events to be received on one printer driver id. - // - // Note: The order of adding the delegate to PrinterExtensionManager.OnDriverEvent - // and invoking PrinterExtensionManager::EnableEvents is important. - // Adding the delegate should be done first. - // - - manager.OnDriverEvent += OnDriverEvent; - - // - // It is recommended that an instance of a printer extension invoke PrinterExtensionManager::EnableEvents - // for exactly one printer driver id. The printer driver id could come in from a command line argument, - // thereby allowing one application binary to dynamically invoke PrinterExtensionManager::EnableEvents against - // the appropriate printer driver id. - // - - manager.EnableEvents(Guid.Parse(PrinterDriverID)); - } - - /// - /// Perform uninitialization tasks for the printer extension in this event handler. - /// - /// - /// - private void Application_Exit(object sender, ExitEventArgs e) - { - manager.OnDriverEvent -= OnDriverEvent; - manager.DisableEvents(); - - manager = null; - } - - /// - /// This is the printer driver id, as defined in the printer driver manifest file. - /// Please replace this GUID with the printer driver id from your manifest file. - /// - /// It is recommended that you invoke PrinterExtensionManager::EnableEvents() on exactly - /// one printer driver id. The id could come in from a command line argument, thereby enabling - /// one application binary to work with multiple printer driver ids. - /// - private const string PrinterDriverID = "{E0691E8D-F7CC-456E-A7B5-D1FC19BA2279}"; - - /// - /// Instance of the PrinterExtensionManager. It is recommended that you have only instance - /// of the PrinterExtensionManager per application instance. - /// - private static PrinterExtensionManager manager = null; - } -} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/BidiHelper.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/BidiHelper.cs deleted file mode 100644 index c975ee7c..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/BidiHelper.cs +++ /dev/null @@ -1,154 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// -// Abstract: -// -// This file contains helper methods that provide a data-binding friendly way to access and parse bidi response data. - -using System; -using System.Collections.Generic; -using System.Windows.Media; -using System.Xml; - -namespace Microsoft.Samples.Printing.PrinterExtension.Helpers -{ - /// - /// Provide a data-binding friendly way to access and parse bidi response data. - /// - public class BidiHelper - { - /// - /// Parse the bidi response. - /// - /// Bidi response XML data. - public BidiHelper(string bidiResponse) - { - BidiResponseParser parser = new BidiResponseParser(bidiResponse); - InkLevelC = parser.GetInkLevel(Colors.Cyan); - InkLevelM = parser.GetInkLevel(Colors.Magenta); - InkLevelY = parser.GetInkLevel(Colors.Yellow); - InkLevelK = parser.GetInkLevel(Colors.Black); - } - - /// - /// Get the Cyan ink level. - /// - public double InkLevelC - { - get; - private set; - } - - /// - /// Get the Magenta ink level. - /// - public double InkLevelM - { - get; - private set; - } - - /// - /// Get the Yellow ink level. - /// - public double InkLevelY - { - get; - private set; - } - - /// - /// Get the Black ink level. - /// - public double InkLevelK - { - get; - private set; - } - } - - /// - /// This class parses bidi response xml data and provides wrapper methods that operate upon the xml. - /// - internal class BidiResponseParser - { - /// - /// Parse the bidi response. - /// - /// Bidi response XML data. - internal BidiResponseParser(string bidiResponse) - { - bidiData = new XmlDocument(); - bidiData.LoadXml(bidiResponse); - - namespaceManager = new XmlNamespaceManager(bidiData.NameTable); - namespaceManager.AddNamespace("bidi", "http://schemas.microsoft.com/windows/2005/03/printing/bidi"); - } - - /// - /// Get the ink level for a given color. - /// - /// Color - /// Ink level percentage - internal double GetInkLevel(Color color) - { - XmlElement root = bidiData.DocumentElement; - XmlNode inkNode = root.SelectSingleNode(CreateInkXPathQuery(color), namespaceManager); - return double.Parse(inkNode.FirstChild.Value) / 100; - } - - /// - /// Create an XPath query that retrieves the ink level from a standard bidi response. - /// - /// - /// - private static string CreateInkXPathQuery(Color color) - { - string colorName = null; - - if (color.Equals(Colors.Black)) - { - colorName = "Black"; - } - else if (color.Equals(Colors.Red)) - { - colorName = "Red"; - } - else if (color.Equals(Colors.Green)) - { - colorName = "Green"; - } - else if (color.Equals(Colors.Blue)) - { - colorName = "Blue"; - } - else if (color.Equals(Colors.Cyan)) - { - colorName = "Cyan"; - } - else if (color.Equals(Colors.Magenta)) - { - colorName = "Magenta"; - } - else if (color.Equals(Colors.Yellow)) - { - colorName = "Yellow"; - } - else - { - throw new ArgumentException("Unsupported color"); - } - - return "/bidi:Get/Query/Schema[@name='\\Printer.Consumables." + colorName + "Ink" + ":Level']/BIDI_INT"; - } - - private XmlDocument bidiData; - private XmlNamespaceManager namespaceManager; - } - -} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Fabrikam_Logo.png b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Fabrikam_Logo.png deleted file mode 100644 index 196cd5f6..00000000 Binary files a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Fabrikam_Logo.png and /dev/null differ diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml deleted file mode 100644 index 924efc21..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -